Просмотр исходного кода

Merge remote-tracking branch 'origin/2025鹅状元数学' into 2025鹅状元数学

wangxy 15 часов назад
Родитель
Сommit
051872da95
3 измененных файлов с 110 добавлено и 86 удалено
  1. 5 1
      pages/chanpinMy/my.vue
  2. 96 81
      pages/chanpinMy/order.vue
  3. 9 4
      utils/request.js

+ 5 - 1
pages/chanpinMy/my.vue

@@ -102,7 +102,11 @@
 		testRef.value.showPopup(7)
 	}
 	/***************** 测试 ******************/
-
+	function bangPhone(){
+		uni.navigateTo({
+			url: '/pages/bindPhone/bindPhone?from=my'   
+		})
+	}
 
 	function bingPhoneSuccess(flag, tel) {
 		toast("绑定成功")

+ 96 - 81
pages/chanpinMy/order.vue

@@ -5,139 +5,154 @@
 			<text class="nav-bar-title">订单</text>
 		</view>
 		<view class="ezy-page-body order-body">
-            <scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="onScrolltolower"
+			<scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="onScrolltolower"
 				class="order-scroll-view" :refresher-triggered="data.loading" :refresher-threshold="50"
 				refresher-background="transparent" @refresherrefresh="onRefresh">
 				<view class="order-card-box" v-for="(item,index) in data.list" :key="index">
-				  <view class="card-head-box">
-				    <view class="head-name">鹅状元自营课程</view>
-					<view class="head-status">{{item.status}}</view>
-				  </view>
-				  <view class="card-body-box">
-					  <!-- 封面 -->
-					  <image :src="item.chanpinCover" class="order-img"></image>
-					  <view class="body-right-box">
-					    <!-- 名称 -->
-					    <view class="body-title">{{item.chanpinName}}</view>
-					    <!-- 简介 -->
-					    <view class="taocan-text">{{item.taocanName}}</view>
-					    <view class="tip-text">不支持7天无理由</view>
-					    <!-- 共计 -->
-					    <view class="money-text">¥{{item.money}}</view>
-					  </view>
-				  </view>
+					<view class="card-head-box">
+						<view class="head-name">鹅状元自营课程</view>
+						<view class="head-status">{{item.status}}</view>
+					</view>
+					<view class="card-body-box">
+						<!-- 封面 -->
+						<image :src="item.chanpinCover" class="order-img"></image>
+						<view class="body-right-box">
+							<!-- 名称 -->
+							<view class="body-title">{{item.chanpinName}}</view>
+							<!-- 简介 -->
+							<view class="taocan-text">{{item.taocanName}}</view>
+							<view class="tip-text">不支持7天无理由</view>
+							<!-- 共计 -->
+							<view class="money-text">¥{{item.money}}</view>
+						</view>
+					</view>
 				</view>
-				<uni-load-more :status="data.state" @click="getMore"
-					:contentText="data.contentText">
+				<uni-load-more :status="data.state" @click="getMore" :contentText="data.contentText">
 				</uni-load-more>
 			</scroll-view>
+			<tip-small-dialog ref="goBindDialogRef" @confirm-btn="goBindPhone" :content="tipContent"></tip-small-dialog>
 			<!-- <view @click="bangdingPhone">绑定手机号</view> -->
 		</view>
 	</view>
 </template>
 
 <script setup>
-	import { reactive, ref } from "vue";
-	import {orderList} from '@/api/shop.js'
-	import { onLoad, onShow } from "@dcloudio/uni-app"
+	import {
+		reactive,
+		ref
+	} from "vue";
+	import {
+		orderList
+	} from '@/api/shop.js'
+	import {
+		onLoad,
+		onShow
+	} from "@dcloudio/uni-app"
 	import {
 		getUserIsYouke
 	} from "@/utils/common.js"
-    const data = reactive({
-        page: 0,
-        list: [],
-        loading: false,
-        state: 'more',
-        contentText: {
-            contentdown: '查看更多',
-            contentrefresh: '加载中',
-            contentnomore: '没有更多'
-        }
-    })
-
+	import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue';
+	const data = reactive({
+		page: 0,
+		list: [],
+		loading: false,
+		state: 'more',
+		contentText: {
+			contentdown: '查看更多',
+			contentrefresh: '加载中',
+			contentnomore: '没有更多'
+		}
+	})
+	const tipContent = '请绑定手机号';
+	const goBindDialogRef = ref(null);
+	function goBindPhone(){
+		uni.switchTab({
+			url: '/pages/bindPhone/bindPhone'
+		})
+	}
 	function handleBack() {
 		uni.switchTab({
 			url: '/pages/chanpinMy/my'
 		})
 	}
 
-    function onScrolltolower() {
-        getMore()
-    }
-	
-    function getMore(code) {
-    	const opt = {
-    		page: 1,
-    		size: 10, 
-    	}
-    
-    	if (data.state == 'no-more') return;
-    	// 数学
-    	data.state = 'loading';
-    	data.page++;
-    	opt.page = data.page;
-		
-    	orderList(opt).then(res => {
-    		data.list = data.list.concat(res.data.data);
-    		data.loading = false;
-    		if (res.data.total > data.list.length) {
-    			data.state = 'more';
-    			data.loading = false;
-    		} else {
-    			data.state = 'no-more';
-    			data.loading = false;
-    		}
-    	}).catch(err => {
-    		data.state = 'more';
-    		data.loading = false;
-    	})
-    }
+	function onScrolltolower() {
+		getMore()
+	}
+
+	function getMore(code) {
+		const opt = {
+			page: 1,
+			size: 10,
+		}
+
+		if (data.state == 'no-more') return;
+		// 数学
+		data.state = 'loading';
+		data.page++;
+		opt.page = data.page;
+
+		orderList(opt).then(res => {
+			data.list = data.list.concat(res.data.data);
+			data.loading = false;
+			if (res.data.total > data.list.length) {
+				data.state = 'more';
+				data.loading = false;
+			} else {
+				data.state = 'no-more';
+				data.loading = false;
+			}
+		}).catch(err => {
+			data.state = 'more';
+			data.loading = false;
+		})
+	}
 
-	function onRefresh(){
+	function onRefresh() {
 		data.page = 0;
 		data.list = [];
 		data.loading = true;
 		refreshData(data.current);
 	}
-	
+
 	function refreshData(code) {
 		const opt = {
 			page: 1,
 			size: 10, // 固定查询10条
 		}
-	
+
 		data.list = [];
 		data.state = 'loading';
 		data.page++;
 		opt.page = data.page;
-			
+
 		orderList(opt).then(res => {
 			data.list = data.list.concat(res.data.data);
 			data.loading = false;
-				if (res.data.total > data.list.length) {
-					data.state = 'more';
-					data.loading = false;
-				} else {
-					data.state = 'no-more';
-					data.loading = false;
-				}
+			if (res.data.total > data.list.length) {
+				data.state = 'more';
+				data.loading = false;
+			} else {
+				data.state = 'no-more';
+				data.loading = false;
+			}
 		}).catch(err => {
 			data.state = 'more';
 			data.loading = false;
 		})
 	}
-	
+
 
 	onLoad((options) => {
 		getMore();
 		// 判断游客 如果是弹出弹窗,忽略和绑定, 忽略删除缓存,绑定更新用户userName 删除缓存
 		// 此时支付成功+游客模式支付进来的情况
-		if(options.zhifu &&getUserIsYouke()){
+		if (options.zhifu && getUserIsYouke()) {
 			// 弹出绑定手机号弹窗
-			
+
 		}
 	})
 </script>
 
 <style>
-</style>
+</style>

+ 9 - 4
utils/request.js

@@ -26,7 +26,7 @@ const request = config => {
 	//  }
 	if (cacheManager.get('auth')) {
 		config.headers['X-AUTH-SIGN'] = Md5.hashStr(JSON.stringify(config.data) + cacheManager.get('auth').secret);
-		config.headers['X-AUTH-TOKEN'] =cacheManager.get('auth').token;
+		config.headers['X-AUTH-TOKEN'] = cacheManager.get('auth').token;
 	}
 	return new Promise((resolve, reject) => {
 		//  debugger
@@ -50,7 +50,7 @@ const request = config => {
 				if (code === 401) {
 					showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
 						if (res.confirm) {
-							if(cacheManager.get('auth')){
+							if (cacheManager.get('auth')) {
 								cacheManager.clearAll()
 							}
 							uni.reLaunch({
@@ -62,7 +62,7 @@ const request = config => {
 				} else if (code === 405) {
 					showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
 						if (res.confirm) {
-							if(cacheManager.get('auth')){
+							if (cacheManager.get('auth')) {
 								cacheManager.clearAll()
 							}
 							uni.reLaunch({
@@ -75,9 +75,14 @@ const request = config => {
 				} else if (code === 500) {
 					toast("数据异常-500")
 					reject('500')
-				}else if (code === 400) {
+				} else if (code === 400) {
 					toast("数据异常-400")
 					reject('400')
+				} else if (code == 1002) {
+					reject({
+						code: 1002, 
+						data: res 
+					})
 				} else if (code !== 0) {
 					toast(msg)
 					reject(code)