Explorar el Código

pagesIntegral

guhongwei hace 2 años
padre
commit
fe4eeaf52b

+ 7 - 9
pagesIntegral/home/index.vue

@@ -56,6 +56,12 @@
 			that.searchConfig();
 			await that.search();
 		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+			uni.stopPullDownRefresh();
+		},
 		methods: {
 			// 查询基本设置
 			searchConfig() {
@@ -136,16 +142,8 @@
 				that.$set(that, `limit`, 6)
 				that.$set(that, `page`, 0)
 			}
-		},
-		onPullDownRefresh: async function() {
-			const that = this;
-			that.$set(that, `list`, [])
-			that.$set(that, `skip`, 0)
-			that.$set(that, `limit`, 6)
-			that.$set(that, `page`, 0)
-			await that.search();
-			uni.stopPullDownRefresh();
 		}
+
 	}
 </script>
 

+ 3 - 2
pagesIntegral/order/detail.vue

@@ -224,8 +224,9 @@
 			},
 			//主菜单跳转
 			toPath(e) {
-				if (e && e.route) uni.reLaunch({
-					url: `/${e.route}`
+				let url = `/${e.route}`;
+				uni.reLaunch({
+					url
 				})
 			},
 		}

+ 42 - 44
pagesIntegral/order/index.vue

@@ -28,9 +28,7 @@
 								</view>
 								<view class="list_2">
 									<view class="l">
-										<image class="image"
-											:src="orderInfo.file&&orderInfo.file.length>0?orderInfo.file[0].url:''"
-											mode=""></image>
+										<image class="image" :src="orderInfo.file&&orderInfo.file.length>0?orderInfo.file[0].url:''" mode=""></image>
 									</view>
 									<view class="c">
 										<view class="name">
@@ -97,8 +95,7 @@
 							<view class="two_1">
 								<checkbox-group @change="toCheckbox">
 									<label>
-										<checkbox :value="item._id" :checked="item.checked"
-											style="transform:scale(0.7)" />
+										<checkbox :value="item._id" :checked="item.checked" style="transform:scale(0.7)" />
 										选择地址
 									</label>
 								</checkbox-group>
@@ -142,6 +139,44 @@
 			that.watchLogin()
 		},
 		methods: {
+			// 监听用户是否登录
+			watchLogin() {
+				const that = this;
+				uni.getStorage({
+					key: 'token',
+					success: function(res) {
+						let user = that.$jwt(res.data);
+						that.$set(that, `user`, user);
+						that.search()
+					},
+					fail: function(err) {
+						uni.reLaunch({
+							url: `/pages/login/index`
+						})
+					}
+				})
+			},
+			// 查询列表
+			async search() {
+				const that = this;
+				let user = that.user;
+				const res = await that.$api(`/address`, 'GET', {
+					customer: user._id
+				})
+				if (res.errcode == '0') {
+					that.$set(that, `addressList`, res.data.reverse());
+				}
+				const arr = await that.$api(`/zrOrder/toMakeOrder`, 'POST', {
+					key: that.key
+				}, `integral`)
+				if (arr.errcode == '0') {
+					that.$set(that, `address`, arr.data.address);
+					that.$set(that, `orderInfo`, arr.data.goods);
+					that.$set(that, `costTotal`, arr.data.costTotal);
+					that.$set(that, `shopInfo`, arr.data.shop);
+					that.$set(that, `buy_num`, arr.data.buy_num);
+				}
+			},
 			// 选择收货地址
 			toChoose() {
 				const that = this;
@@ -236,44 +271,6 @@
 						icon: 'none'
 					})
 				}
-			},
-			// 监听用户是否登录
-			watchLogin() {
-				const that = this;
-				uni.getStorage({
-					key: 'token',
-					success: function(res) {
-						let user = that.$jwt(res.data);
-						that.$set(that, `user`, user);
-						that.search()
-					},
-					fail: function(err) {
-						uni.reLaunch({
-							url: `/pages/login/index`
-						})
-					}
-				})
-			},
-			// 查询列表
-			async search() {
-				const that = this;
-				let user = that.user;
-				const res = await that.$api(`/address`, 'GET', {
-					customer: user._id
-				})
-				if (res.errcode == '0') {
-					that.$set(that, `addressList`, res.data.reverse());
-				}
-				const arr = await that.$api(`/zrOrder/toMakeOrder`, 'POST', {
-					key: that.key
-				}, `integral`)
-				if (arr.errcode == '0') {
-					that.$set(that, `address`, arr.data.address);
-					that.$set(that, `orderInfo`, arr.data.goods);
-					that.$set(that, `costTotal`, arr.data.costTotal);
-					that.$set(that, `shopInfo`, arr.data.shop);
-					that.$set(that, `buy_num`, arr.data.buy_num);
-				}
 			}
 		}
 	}
@@ -369,7 +366,8 @@
 						.r {
 							width: 15vw;
 							text-align: right;
-							.price{
+
+							.price {
 								color: var(--ff0Color);
 							}
 						}

+ 26 - 31
pagesIntegral/record/index.vue

@@ -17,9 +17,7 @@
 							<view class="list_2">
 								<view class="market">
 									<view class="url">
-										<image class="image"
-											:src="item.goods.file&&item.goods.file.length>0?item.goods.file[0].url:''"
-											mode=""></image>
+										<image class="image" :src="item.goods.file&&item.goods.file.length>0?item.goods.file[0].url:''" mode=""></image>
 									</view>
 									<view class="name">
 										{{item.goods.name}}
@@ -44,8 +42,7 @@
 								</view>
 							</view>
 							<view class="btn">
-								<button v-if="item.status=='2'||item.status=='3'" type="default" size="mini"
-									@click="toLogi(item)">查看物流</button>
+								<button v-if="item.status=='2'||item.status=='3'" type="default" size="mini" @click="toLogi(item)">查看物流</button>
 							</view>
 						</view>
 						<view class="is_bottom" v-if="is_bottom">
@@ -88,6 +85,12 @@
 			const that = this;
 			that.clearPage();
 		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+			uni.stopPullDownRefresh();
+		},
 		methods: {
 			// 查询基本设置
 			searchConfig() {
@@ -113,23 +116,6 @@
 					}
 				})
 			},
-			// 输入框
-			toInput(e) {
-				const that = this;
-				if (e.detail.value == '') {
-					that.$set(that, `searchInfo`, {})
-				} else {
-					that.$set(that.searchInfo, `goods`, e.detail.value);
-				}
-				that.clearPage();
-				that.search();
-			},
-			// 查看物流
-			toLogi(e) {
-				uni.navigateTo({
-					url: `/pagesMy/logistics/index?id=${e._id}&type=${'integral'}`
-				})
-			},
 			// 查询列表
 			async search() {
 				const that = this;
@@ -191,6 +177,24 @@
 				let num = Math.sign(up - e.detail.scrollTop);
 				if (num == 1) that.$set(that, `is_bottom`, false);
 			},
+			// 输入框
+			toInput(e) {
+				const that = this;
+				if (e.detail.value == '') {
+					that.$set(that, `searchInfo`, {})
+				} else {
+					that.$set(that.searchInfo, `goods`, e.detail.value);
+				}
+				that.clearPage();
+				that.search();
+			},
+			// 查看物流
+			toLogi(e) {
+				uni.navigateTo({
+					url: `/pagesMy/logistics/index?id=${e._id}&type=${'integral'}`
+				})
+			},
+
 			// 清空列表
 			clearPage() {
 				const that = this;
@@ -199,15 +203,6 @@
 				that.$set(that, `limit`, 6)
 				that.$set(that, `page`, 0)
 			}
-		},
-		onPullDownRefresh: async function() {
-			const that = this;
-			that.$set(that, `list`, [])
-			that.$set(that, `skip`, 0)
-			that.$set(that, `limit`, 6)
-			that.$set(that, `page`, 0)
-			await that.search();
-			uni.stopPullDownRefresh();
 		}
 	}
 </script>