zs 2 anni fa
parent
commit
74b62779b3
3 ha cambiato i file con 40 aggiunte e 52 eliminazioni
  1. 1 0
      common/api.js
  2. 4 9
      pagesIntegral/home/index.vue
  3. 35 43
      pagesIntegral/order/detail.vue

+ 1 - 0
common/api.js

@@ -1,6 +1,7 @@
 import config from '../config.js';
 const getDomain = (uri, method, type) => {
 	if (type && type == 'file') return config.serverUrl + '/files' + uri;
+	if (type && type == 'integral') return config.serverUrl + '/point/zr/v1/api' + uri;
 	if (uri.startsWith('/wechat/api')) return config.serverUrl + uri;
 	else return config.serverUrl + '/point/v1/api' + uri;
 }

+ 4 - 9
pagesIntegral/home/index.vue

@@ -16,8 +16,7 @@
 								</view>
 								<view class="other">
 									<view class="money">
-										<text>¥</text>
-										<text>{{item.sell_money}}</text>
+										<text>{{item.cost}}</text>
 									</view>
 									<view class="btn">
 										<button type="default" size="mini" @click="toBuy(item)">兑换</button>
@@ -81,10 +80,10 @@
 					skip: that.skip,
 					limit: that.limit,
 				}
-				const res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
+				const res = await that.$api(`/zrGoods`, `GET`, {
 					...info,
 					...that.searchInfo
-				})
+				}, `integral`)
 				if (res.errcode == '0') {
 					let list = [...that.list, ...res.data]
 					that.$set(that, `list`, list)
@@ -131,7 +130,7 @@
 			},
 			toBuy(e) {
 				uni.navigateTo({
-					url: `/pagesIntegral/order/detail?id=${e.id||e._id}`
+					url: `/pagesIntegral/order/detail?id=${e._id}`
 				})
 			},
 			// 清空列表
@@ -209,10 +208,6 @@
 
 						.money {
 							color: var(--ff0Color);
-
-							text:nth-child(1) {
-								font-size: var(--font12Size);
-							}
 						}
 
 						.btn {

+ 35 - 43
pagesIntegral/order/detail.vue

@@ -17,12 +17,7 @@
 						<view class="two">
 							<view class="two_1">
 								<view class="money_1">
-									<text>¥</text>
-									<text>{{specs&&specs.length>0?specs[0].sell_money:0}}</text>
-								</view>
-								<view class="money_2">
-									<text>¥</text>
-									<text>{{specs&&specs.length>0?specs[0].flow_money:0}}</text>
+									<text>{{info.cost||0}}</text>
 								</view>
 							</view>
 							<view class="two_2">{{info.name}}</view>
@@ -62,7 +57,6 @@
 						</view>
 						<view class="five">
 							<view class="five_1">
-								<!-- <u-parse :content="info.brief"></u-parse> -->
 								<rich-text :nodes="info.brief"></rich-text>
 							</view>
 						</view>
@@ -113,7 +107,7 @@
 						</text>
 					</view>
 				</view>
-				<!-- <view class="thr">
+				<view class="thr">
 					<text>数量</text>
 					<view class="count">
 						<uni-number-box :min="1" :max="specsInfo.num" :disabled="disabled" v-model="num"
@@ -121,7 +115,7 @@
 						</uni-number-box>
 					</view>
 					<text>库存{{specsInfo.num||0}}</text>
-				</view> -->
+				</view>
 				<view class="btn" @click="toBuy">
 					立即兑换
 				</view>
@@ -217,22 +211,23 @@
 		onShow: async function() {
 			const that = this;
 			await that.search();
+			await that.searchOther();
 			await that.configShare();
 		},
 		methods: {
-			//店铺,
-			// 购物车,客服跳转
-			onClick(e) {
-				const that = this;
-				if (e.index == '0' && e.content.route) {
-					// 进入店铺
-					that.toShop();
-				} else {
-					uni.reLaunch({
-						url: `/${e.content.route}`
-					})
-				}
-			},
+			// //店铺,
+			// // 购物车,客服跳转
+			// onClick(e) {
+			// 	const that = this;
+			// 	if (e.index == '0' && e.content.route) {
+			// 		// 进入店铺
+			// 		that.toShop();
+			// 	} else {
+			// 		uni.reLaunch({
+			// 			url: `/${e.content.route}`
+			// 		})
+			// 	}
+			// },
 			// 进入店铺
 			toShop() {
 				const that = this;
@@ -372,32 +367,29 @@
 				const that = this;
 				uni.getStorage({
 					key: 'token',
-					success: function(res) {
+					success: async function(res) {
 						let user = that.$jwt(res.data);
 						if (user) that.$set(that, `user`, user);
-						that.searchOther();
+						let arr = await that.$api(`/zrGoods/${that.id}`, `POST`, {}, `integral`)
+						if (arr.errcode == '0') {
+							if (arr.data.brief) arr.data.brief = arr.data.brief.replace(/\<img/gi,
+								'<img class="rich-img"');
+							that.$set(that, `info`, arr.data)
+							that.$set(that, `bannerList`, arr.data.file)
+							let shop = await that.$api(`/shop/${arr.data.shop}`, `GET`)
+							if (shop.errcode == '0') {
+								that.$set(that, `shop`, shop.data)
+							}
+							let con = await that.$api(`/goodsRate`, `GET`, {
+								goods: arr.data._id
+							})
+							if (con.errcode == '0') {
+								that.$set(that, `comment`, con.total)
+							}
+						}
 					},
 					fail: function(err) {}
 				});
-				let res = await that.$api(`/viewGoods/goodsDetail`, `POST`, {
-					id: that.id
-				});
-				if (res.errcode == '0') {
-					let data = res.data;
-					if (data.goods.brief) data.goods.brief = data.goods.brief.replace(/\<img/gi,
-						'<img class="rich-img"');
-					that.$set(that, `info`, data.goods)
-					that.$set(that, `specs`, data.specs)
-					that.$set(that, `shop`, data.shop)
-					if (data.specs.length > 0) that.$set(that.specsInfo, `sell_money`, data.specs[0].sell_money)
-					that.$set(that, `bannerList`, data.goods.file)
-					let con = await that.$api(`/goodsRate`, `GET`, {
-						goods: data.goods._id
-					})
-					if (con.errcode == '0') {
-						that.$set(that, `comment`, con.total)
-					}
-				}
 			},
 			async searchOther() {
 				const that = this;