guhongwei 2 سال پیش
والد
کامیت
b5e4c77476

+ 26 - 0
config.js

@@ -82,6 +82,32 @@ export default {
 			route: "pagesMy/order/after",
 		},
 	],
+	condList: [ //筛选
+		{
+			name: '默认',
+		},
+		{
+			name: '销量',
+			shang: 'icon-shangjiantou',
+			shangActive: 'icon-shangjiantou-copy',
+			xia: 'icon-xiajiantou',
+			xiaActive: 'icon-xiajiantou-copy'
+		},
+		{
+			name: '价格',
+			shang: 'icon-shangjiantou',
+			shangActive: 'icon-shangjiantou-copy',
+			xia: 'icon-xiajiantou',
+			xiaActive: 'icon-xiajiantou-copy'
+		},
+		{
+			name: '浏览量',
+			shang: 'icon-shangjiantou',
+			shangActive: 'icon-shangjiantou-copy',
+			xia: 'icon-xiajiantou',
+			xiaActive: 'icon-xiajiantou-copy'
+		}
+	],
 	china: [
 		//全国地址
 		{

+ 1 - 1
pages/index/index.vue

@@ -37,7 +37,7 @@
 								path: '/pages/index/index',
 								imageUrl: config.config.share[0].url
 							}
-							let url = `/pages/my/index`;
+							let url = `/pages/home/index`;
 							uni.redirectTo({
 								url
 							})

+ 8 - 10
pagesHome/exchange/index.vue

@@ -41,12 +41,18 @@
 			// 监听用户是否登录
 			that.watchLogin();
 			// 下拉刷新
-			
+
 		},
 		onShow: function() {
 			const that = this;
 			that.searchConfig();
 		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+			uni.stopPullDownRefresh();
+		},
 		methods: {
 			// 查询基本设置
 			searchConfig() {
@@ -161,15 +167,7 @@
 				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>
 

+ 64 - 64
pagesHome/group/index.vue

@@ -91,7 +91,7 @@
 </template>
 
 <script>
-	import moment from 'moment'
+	import moment from 'moment';
 	export default {
 		data() {
 			return {
@@ -125,69 +125,6 @@
 			await that.search();
 		},
 		methods: {
-			// 开团
-			async toGroup() {
-				const that = this;
-				that.$refs.popup.open();
-			},
-			// 参团
-			async onJoin(e) {
-				const that = this;
-				that.$set(that, `join`, e)
-				that.$refs.popup1.open();
-			},
-			// 计数器
-			toCount(e) {
-				const that = this;
-				that.num = e;
-			},
-			// 确认开团 立即参团
-			async onSubmit(e) {
-				const that = this;
-				let user = that.user;
-				if (user._id) {
-					let data = {
-						customer: user._id,
-						shop: that.shopInfo._id,
-						goods: that.goodsInfo._id,
-						goodsSpec: that.specsInfo._id,
-						num: that.num,
-						type: '1'
-					}
-					if (e._id) {
-						data.group = e._id
-					}
-					let arr = await that.$api(`/util/checkCanBuy`, 'POST', data)
-					if (arr.errcode == '0') {
-						if (arr.data.result == true) {
-							that.clearPage();
-							if (e._id) {
-								uni.navigateTo({
-									url: `/pagesHome/order/order?key=${arr.data.key}&group_id=${e._id}`
-								})
-							} else {
-								uni.navigateTo({
-									url: `/pagesHome/order/order?key=${arr.data.key}`
-								})
-							}
-						} else {
-							uni.showToast({
-								title: arr.data.msg,
-								icon: 'none'
-							})
-						}
-					} else {
-						uni.showToast({
-							title: arr.errmsg,
-							icon: 'none'
-						})
-					}
-				} else {
-					uni.navigateTo({
-						url: `/pages/login/index`
-					})
-				}
-			},
 			// 监听用户是否登录
 			watchLogin() {
 				const that = this;
@@ -260,6 +197,69 @@
 					uni.hideLoading();
 				} else {}
 			},
+			// 开团
+			async toGroup() {
+				const that = this;
+				that.$refs.popup.open();
+			},
+			// 参团
+			async onJoin(e) {
+				const that = this;
+				that.$set(that, `join`, e)
+				that.$refs.popup1.open();
+			},
+			// 计数器
+			toCount(e) {
+				const that = this;
+				that.num = e;
+			},
+			// 确认开团 立即参团
+			async onSubmit(e) {
+				const that = this;
+				let user = that.user;
+				if (user._id) {
+					let data = {
+						customer: user._id,
+						shop: that.shopInfo._id,
+						goods: that.goodsInfo._id,
+						goodsSpec: that.specsInfo._id,
+						num: that.num,
+						type: '1'
+					}
+					if (e._id) {
+						data.group = e._id
+					}
+					let arr = await that.$api(`/util/checkCanBuy`, 'POST', data)
+					if (arr.errcode == '0') {
+						if (arr.data.result == true) {
+							that.clearPage();
+							if (e._id) {
+								uni.navigateTo({
+									url: `/pagesHome/order/order?key=${arr.data.key}&group_id=${e._id}`
+								})
+							} else {
+								uni.navigateTo({
+									url: `/pagesHome/order/order?key=${arr.data.key}`
+								})
+							}
+						} else {
+							uni.showToast({
+								title: arr.data.msg,
+								icon: 'none'
+							})
+						}
+					} else {
+						uni.showToast({
+							title: arr.errmsg,
+							icon: 'none'
+						})
+					}
+				} else {
+					uni.navigateTo({
+						url: `/pages/login/index`
+					})
+				}
+			},
 			// 清空列表
 			clearPage() {
 				const that = this;

+ 45 - 45
pagesHome/group/share.vue

@@ -71,8 +71,8 @@
 	export default {
 		data() {
 			return {
-				id: '',
 				user: {},
+				id: '',
 				info: {},
 				num: 1,
 			};
@@ -84,10 +84,48 @@
 			that.search();
 		},
 		methods: {
-			// 计数器
-			toCount(e) {
+			watchLogin() {
 				const that = this;
-				that.num = e;
+				uni.getStorage({
+					key: 'token',
+					success: function(res) {
+						let user = that.$jwt(res.data);
+						if (user) that.$set(that, `user`, user)
+					}
+				})
+			},
+			async search() {
+				const that = this;
+				if (that.id) {
+					let res = await that.$api(`/group/${that.id}`, `GET`);
+					if (res.errcode == '0') {
+						if (res.data.status != '-1') {
+							res.data.persons = res.data.persons.filter(i => i.status == '0')
+						}
+						that.$set(that, `info`, res.data);
+						uni.getStorage({
+							key: 'config',
+							success: function(config) {
+								// 赋值默认值
+								that.$config.share = {
+									title: res.data.goods.name,
+									path: '/pagesHome/group/share?id=${that.id}',
+									imageUrl: config.config.share[0].url
+								}
+							}
+						});
+					} else {
+						uni.showToast({
+							title: res.errmsg,
+							icon: 'none'
+						})
+					}
+				}
+			},
+			// 参团
+			toOpen() {
+				const that = this;
+				that.$refs.popup.open();
 			},
 			// 确认开团 立即参团
 			async onSubmit() {
@@ -133,48 +171,10 @@
 					})
 				}
 			},
-			watchLogin() {
-				const that = this;
-				uni.getStorage({
-					key: 'token',
-					success: function(res) {
-						let user = that.$jwt(res.data);
-						if (user) that.$set(that, `user`, user)
-					}
-				})
-			},
-			async search() {
-				const that = this;
-				if (that.id) {
-					let res = await that.$api(`/group/${that.id}`, `GET`);
-					if (res.errcode == '0') {
-						if (res.data.status != '-1') {
-							res.data.persons = res.data.persons.filter(i => i.status == '0')
-						}
-						that.$set(that, `info`, res.data);
-						uni.getStorage({
-							key: 'config',
-							success: function(config) {
-								// 赋值默认值
-								that.$config.share = {
-									title: res.data.goods.name,
-									path: '/pagesHome/group/share?id=${that.id}',
-									imageUrl: config.config.share[0].url
-								}
-							}
-						});
-					} else {
-						uni.showToast({
-							title: res.errmsg,
-							icon: 'none'
-						})
-					}
-				}
-			},
-			// 参团
-			toOpen() {
+			// 计数器
+			toCount(e) {
 				const that = this;
-				that.$refs.popup.open();
+				that.num = e;
 			}
 		}
 	}

+ 11 - 34
pagesHome/market/search.vue

@@ -84,30 +84,6 @@
 				shang: '',
 				xia: '',
 				condList: [ // 筛选
-					{
-						name: '默认',
-					},
-					{
-						name: '销量',
-						shang: 'icon-shangjiantou',
-						shangActive: 'icon-shangjiantou-copy',
-						xia: 'icon-xiajiantou',
-						xiaActive: 'icon-xiajiantou-copy'
-					},
-					{
-						name: '价格',
-						shang: 'icon-shangjiantou',
-						shangActive: 'icon-shangjiantou-copy',
-						xia: 'icon-xiajiantou',
-						xiaActive: 'icon-xiajiantou-copy'
-					},
-					{
-						name: '浏览量',
-						shang: 'icon-shangjiantou',
-						shangActive: 'icon-shangjiantou-copy',
-						xia: 'icon-xiajiantou',
-						xiaActive: 'icon-xiajiantou-copy'
-					}
 				],
 				// 筛选
 				screenList: [],
@@ -125,7 +101,12 @@
 			that.searchConfig();
 			await that.searchOther();
 			await that.search();
-			
+		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+			uni.stopPullDownRefresh();
 		},
 		methods: {
 			// 查询基本设置
@@ -154,6 +135,11 @@
 			},
 			async searchOther() {
 				const that = this;
+				let config = that.$config;
+				if (config) {
+					// 筛选条件
+					that.$set(that, `condList`, config.condList)
+				}
 				if (that.pid) {
 					let info = {};
 					info.pid = that.pid;
@@ -268,15 +254,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>

+ 18 - 16
pagesHome/market/type.vue

@@ -82,8 +82,12 @@
 			const that = this;
 			that.searchConfig();
 			that.search();
-			// 下拉刷新
-			
+		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPages();
+			await that.search();
+			uni.stopPullDownRefresh();
 		},
 		methods: {
 			// 查询基本设置
@@ -206,6 +210,17 @@
 				that.$set(that, `limit`, 6)
 				that.$set(that, `page`, 0)
 			},
+			// 清空总列表
+			clearPages() {
+				const that = this;
+				that.$set(that, `typeList`, [])
+				that.$set(that, `marketList`, [])
+				that.$set(that, `list`, [])
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 6)
+				that.$set(that, `page`, 0)
+				that.$set(that, `active`, 0)
+			},
 			// 搜索商品
 			toCommon(e) {
 				const that = this;
@@ -219,21 +234,8 @@
 				uni.navigateTo({
 					url: `/pagesHome/order/detail?id=${e.id||e._id}`
 				})
-			},
-		},
-		onPullDownRefresh: async function() {
-			const that = this;
-			that.$set(that, `typeList`, [])
-			that.$set(that, `marketList`, [])
-			that.$set(that, `list`, [])
-			that.$set(that, `skip`, 0)
-			that.$set(that, `limit`, 6)
-			that.$set(that, `page`, 0)
-			that.$set(that, `active`, 0)
-			await that.search();
-			uni.stopPullDownRefresh();
+			}
 		}
-
 	}
 </script>
 

+ 55 - 55
pagesHome/order/appraise.vue

@@ -103,61 +103,6 @@
 			that.watchLogin()
 		},
 		methods: {
-			async confirm(e) {
-				const that = this;
-				if (e) {
-					let reply = that.reply
-					let obj = {
-						content: e,
-						time: moment().format('YYYY-MM-DD HH:mm:ss')
-					}
-					reply.reply.push(obj)
-					const arr = await that.$api(`/goodsRate/${that.reply._id}`, 'POST', reply)
-					if (arr.errcode == '0') {
-						uni.showToast({
-							title: `回复成功`,
-							icon: 'success',
-						});
-						that.$set(that, `reply`, {});
-					} else {
-						uni.showToast({
-							title: arr.errmsg,
-							icon: 'none',
-						})
-					}
-				} else {
-					that.$set(that, `reply`, {});
-				}
-
-			},
-			// 回复
-			toReply(e, index) {
-				const that = this;
-				that.$set(that, `reply`, e);
-				that.$set(that.reply, `index`, index);
-			},
-			// 放大
-			toLarge(e, index) {
-				let url = e.reply[0].file.map(item => item.url)
-				uni.previewImage({
-					current: index,
-					urls: url
-				})
-			},
-			// 选择
-			toSelect(e) {
-				const that = this;
-				that.$set(that, `code`, e.code);
-				if (e.code == '0') {
-					that.search()
-				} else if (e.code == '1') {
-					that.$set(that, `list`, that.one);
-				} else if (e.code == '2') {
-					that.$set(that, `list`, that.two);
-				} else {
-					that.$set(that, `list`, that.thr);
-				}
-			},
 			// 监听用户是否登录
 			watchLogin() {
 				const that = this;
@@ -215,6 +160,61 @@
 					});
 				}
 			},
+			async confirm(e) {
+				const that = this;
+				if (e) {
+					let reply = that.reply
+					let obj = {
+						content: e,
+						time: moment().format('YYYY-MM-DD HH:mm:ss')
+					}
+					reply.reply.push(obj)
+					const arr = await that.$api(`/goodsRate/${that.reply._id}`, 'POST', reply)
+					if (arr.errcode == '0') {
+						uni.showToast({
+							title: `回复成功`,
+							icon: 'success',
+						});
+						that.$set(that, `reply`, {});
+					} else {
+						uni.showToast({
+							title: arr.errmsg,
+							icon: 'none',
+						})
+					}
+				} else {
+					that.$set(that, `reply`, {});
+				}
+
+			},
+			// 回复
+			toReply(e, index) {
+				const that = this;
+				that.$set(that, `reply`, e);
+				that.$set(that.reply, `index`, index);
+			},
+			// 放大
+			toLarge(e, index) {
+				let url = e.reply[0].file.map(item => item.url)
+				uni.previewImage({
+					current: index,
+					urls: url
+				})
+			},
+			// 选择
+			toSelect(e) {
+				const that = this;
+				that.$set(that, `code`, e.code);
+				if (e.code == '0') {
+					that.search()
+				} else if (e.code == '1') {
+					that.$set(that, `list`, that.one);
+				} else if (e.code == '2') {
+					that.$set(that, `list`, that.two);
+				} else {
+					that.$set(that, `list`, that.thr);
+				}
+			},
 		}
 	}
 </script>

+ 3 - 2
pagesHome/order/detail.vue

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

+ 47 - 47
pagesHome/order/order.vue

@@ -28,8 +28,7 @@
 								</view>
 								<view class="list_2" v-for="(tag,index) in item.goods" :key="index">
 									<view class="l">
-										<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''"
-											mode=""></image>
+										<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''" mode=""></image>
 									</view>
 									<view class="c">
 										<view class="name">
@@ -151,6 +150,51 @@
 			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(`/order/toMakeOrder`, 'POST', {
+					key: that.key
+				})
+				if (arr.errcode == '0') {
+					// 分享人id
+					that.$set(that, `inviter`, arr.data.inviter);
+					// 地址
+					that.$set(that, `address`, arr.data.address);
+					// 订单
+					that.$set(that, `orderList`, arr.data.goodsData);
+					// 总价
+					that.$set(that, `total_detail`, arr.data.orderTotal);
+					that.$set(that, `type`, arr.data.type);
+					this.computedTotal();
+					// 优惠劵
+					that.$set(that, `couponList`, arr.data.couponList);
+				}
+			},
 			// 使用优惠劵
 			toDiscount(e) {
 				const that = this;
@@ -280,51 +324,7 @@
 					})
 				}
 			},
-			// 监听用户是否登录
-			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(`/order/toMakeOrder`, 'POST', {
-					key: that.key
-				})
-				if (arr.errcode == '0') {
-					// 分享人id
-					that.$set(that, `inviter`, arr.data.inviter);
-					// 地址
-					that.$set(that, `address`, arr.data.address);
-					// 订单
-					that.$set(that, `orderList`, arr.data.goodsData);
-					// 总价
-					that.$set(that, `total_detail`, arr.data.orderTotal);
-					that.$set(that, `type`, arr.data.type);
-					this.computedTotal();
-					// 优惠劵
-					that.$set(that, `couponList`, arr.data.couponList);
-				}
-			},
+
 			async computedTotal() {
 				const total_detail = this.total_detail;
 				let total = this.$plus(total_detail.freight_total, total_detail.goods_total)

+ 40 - 56
pagesHome/shop/index.vue

@@ -174,30 +174,6 @@
 				shang: '',
 				xia: '',
 				condList: [ // 筛选
-					{
-						name: '默认',
-					},
-					{
-						name: '销量',
-						shang: 'icon-shangjiantou',
-						shangActive: 'icon-shangjiantou-copy',
-						xia: 'icon-xiajiantou',
-						xiaActive: 'icon-xiajiantou-copy'
-					},
-					{
-						name: '价格',
-						shang: 'icon-shangjiantou',
-						shangActive: 'icon-shangjiantou-copy',
-						xia: 'icon-xiajiantou',
-						xiaActive: 'icon-xiajiantou-copy'
-					},
-					{
-						name: '浏览量',
-						shang: 'icon-shangjiantou',
-						shangActive: 'icon-shangjiantou-copy',
-						xia: 'icon-xiajiantou',
-						xiaActive: 'icon-xiajiantou-copy'
-					}
 				],
 				// 数据是否触底
 				is_bottom: false,
@@ -208,16 +184,20 @@
 		},
 		onLoad: async function(e) {
 			const that = this;
-			let id = '6333d71d32c5f69745f9bd32';
+			let id = '';
 			if (e && e.id) id = e.id;
 			else id = decodeURIComponent(e.q).split('id=')[1];
 			that.$set(that, `id`, id);
 			that.searchConfig();
+			await that.searchOther();
 			await that.watchLogin();
 			await that.search();
-			await that.searchOther();
-			// 下拉刷新
-			
+		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPages();
+			await that.search();
+			uni.stopPullDownRefresh();
 		},
 		methods: {
 			// 查询基本设置
@@ -233,6 +213,27 @@
 					}
 				})
 			},
+			// 查询其他信息
+			async searchOther() {
+				const that = this;
+				let config = that.$config;
+				if (config) {
+					// 筛选条件
+					that.$set(that, `condList`, config.condList)
+				}
+				let user = that.user;
+				let shop = that.info;
+				if (user && user._id && shop && shop._id) {
+					// 商铺是否收藏
+					let arr = await that.$api(`/storeShop/check`, `GET`, {
+						customer: user._id,
+						shop: shop._id
+					});
+					if (arr.errcode == '0') {
+						that.$set(that, `collection`, arr.data)
+					}
+				}
+			},
 			// 监听用户是否登录
 			watchLogin() {
 				const that = this;
@@ -389,22 +390,6 @@
 				that.clearPage();
 				that.searchAll();
 			},
-			// 查询其他信息
-			async searchOther() {
-				const that = this;
-				let user = that.user;
-				let shop = that.info;
-				if (user && user._id && shop && shop._id) {
-					// 商铺是否收藏
-					let arr = await that.$api(`/storeShop/check`, `GET`, {
-						customer: user._id,
-						shop: shop._id
-					});
-					if (arr.errcode == '0') {
-						that.$set(that, `collection`, arr.data)
-					}
-				}
-			},
 			// 收藏
 			async toCollect() {
 				const that = this;
@@ -444,20 +429,19 @@
 				const that = this;
 				that.$set(that, `list`, [])
 				that.$set(that, `skip`, 0)
-				that.$set(that, `limit`, 5)
+				that.$set(that, `limit`, 6)
+				that.$set(that, `page`, 0)
+			},
+			// 清空总列表
+			clearPages() {
+				const that = this;
+				that.$set(that, `info`, {})
+				that.$set(that, `shoplist`, [])
+				that.$set(that, `list`, [])
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 6)
 				that.$set(that, `page`, 0)
 			}
-		},
-		onPullDownRefresh: async function() {
-			const that = this;
-			that.$set(that, `info`, {})
-			that.$set(that, `shoplist`, [])
-			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>