Jelajahi Sumber

解决领取后多数据问题,我的代金券增加状态字段

asd123a20 2 tahun lalu
induk
melakukan
432787ad20
4 mengubah file dengan 21 tambahan dan 12 penghapusan
  1. 6 1
      api/voucher.js
  2. 8 8
      env.js
  3. 0 1
      pages/goods/index.vue
  4. 7 2
      pages/goods/my.vue

+ 6 - 1
api/voucher.js

@@ -17,4 +17,9 @@ const getMyList = async (data) => {
 	const res = await request.get({  url: `/discount/record/list` });
 	return res.data;
 }
-export default { getList, getInfo, receivevoucher, getMyList };
+
+const getDict = async (dictType) => {
+	const res = await request.get({ url: `/dict/data/type/${dictType}` });
+	return res.data;
+}
+export default { getList, getInfo, receivevoucher, getMyList, getDict };

+ 8 - 8
env.js

@@ -1,14 +1,14 @@
 const ENV_API_URL = {
-	development: {
-		url: 'http://192.168.0.18:7070/api',
-		imgUrl: 'http://192.168.0.19/static/wxa',
-		fileUrl: 'http://192.168.0.18:80'
-	},
 	// development: {
-	// 	url: 'https://fuyu.cc-lotus.info/wx-api/api',
-	// 	imgUrl: 'https://fuyu.cc-lotus.info/static/wxa',
-	// 	fileUrl: 'https://fuyu.cc-lotus.info'
+	// 	url: 'http://192.168.0.18:7070/api',
+	// 	imgUrl: 'http://192.168.0.19/static/wxa',
+	// 	fileUrl: 'http://192.168.0.18:80'
 	// },
+	development: {
+		url: 'https://fuyu.cc-lotus.info/wx-api/api',
+		imgUrl: 'https://fuyu.cc-lotus.info/static/wxa',
+		fileUrl: 'https://fuyu.cc-lotus.info'
+	},
 	production: {
 		url: 'https://fuyu.scapp.cn/wx-api/api',
 		imgUrl: 'https://fuyu.scapp.cn/static/wxa/',

+ 0 - 1
pages/goods/index.vue

@@ -86,7 +86,6 @@
 				if (res.code == 200) {
 					this.popupInfo.content = '领取成功'
 					this.$refs.popup.open();
-					this.query();
 				}
 			},
 			// 详情

+ 7 - 2
pages/goods/my.vue

@@ -11,7 +11,7 @@
 					<template v-slot:body>
 						<view class="slot-body titleBox" @click="btn(item)">
 							<view class="slot-box slot-title">{{ item['discountInfo.name'] }}</view>
-							<!-- <view class="slot-box slot-text">领取时间:{{ item.endTime }}前</view> -->
+							<view class="slot-box slot-text">状态:{{ item.statusText }}</view>
 							<view class="slot-box slot-text">领取地点:{{ item['discountInfo.location'] }}</view>
 							
 						</view>
@@ -37,9 +37,12 @@
 				page: 0,
 				size: 10,
 				more: 'more',
+				dicts: []
 			};
 		},
 		onLoad: async function() {
+			const dict = await voucher.getDict('voucher_status');
+			this.dicts = dict.data;
 			this.query();
 		},
 		methods: {
@@ -49,6 +52,8 @@
 				// 此处是查询函数
 				const res = await voucher.getMyList({ pageNum: this.page, pageSize: this.size });
 				this.list.push(...res.rows.map(e => {
+					const statusDict = this.dicts.find(j => j.dictValue == e.status)
+					if (statusDict) e.statusText = statusDict?.dictLabel;
 					for (const key in e.discountInfo) {
 						const itemKey = `discountInfo.${key}`;
 						e[itemKey] = e.discountInfo[key]
@@ -60,7 +65,7 @@
 			},
 			// 详情
 			btn(item) {
-				uni.navigateTo({ url: `/pages/good/details?id=${item.voucherId}` });
+				uni.navigateTo({ url: `/pages/goods/details?id=${item.discountId}` });
 			}
 		},
 		// 页面生命周期中onReachBottom(页面滚动到底部的事件)