Browse Source

修改店铺id

zs 1 year ago
parent
commit
d2e17d2742

+ 6 - 19
pages/home/index.vue

@@ -108,8 +108,6 @@
 	export default {
 		data() {
 			return {
-				// 店铺id
-				shop: '',
 				frameStyle: {
 					useBar: true
 				},
@@ -134,7 +132,7 @@
 		},
 		onLoad: async function() {
 			const that = this;
-			await that.searchShop();
+			await that.search();
 		},
 		onPullDownRefresh: async function() {
 			const that = this;
@@ -149,7 +147,7 @@
 				// 轮播图
 				res = await that.$api(`/banner`, 'GET', {
 					status: '0',
-					shop: that.shop
+					shop: that.$config.shop
 				});
 				if (res.errcode == '0') {
 					that.$set(that, `bannerList`, res.data);
@@ -157,21 +155,21 @@
 				// 首页模块管理
 				res = await that.$api(`/indexModule`, 'GET', {
 					status: '0',
-					shop: that.shop
+					shop: that.$config.shop
 				});
 				if (res.errcode == '0') {
 					that.$set(that, `btnList`, res.data);
 				}
 				// 推荐好货
 				res = await that.$api(`/viewGoods/iatg`, 'GET', {
-					shop: that.shop
+					shop: that.$config.shop
 				});
 				if (res.errcode == '0') that.$set(that, `recomList`, res.data);
 				// 平台活动
 				res = await that.$api(`/platformAct`, 'GET', {
 					show_index: '0',
 					is_use: '0',
-					shop: that.shop
+					shop: that.$config.shop
 				});
 				if (res.errcode == '0') that.$set(that, `platformactList`, res.data);
 				// 首页产品查询
@@ -184,7 +182,7 @@
 				let info = {
 					skip: that.skip,
 					limit: that.limit,
-					shop: that.shop
+					shop: that.$config.shop
 				};
 				// 首页产品列表
 				res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
@@ -296,17 +294,6 @@
 						url
 					})
 				}
-			},
-			// 店铺信息
-			searchShop() {
-				const that = this;
-				uni.getStorage({
-					key: 'shop',
-					success: async function(res) {
-						that.$set(that, `shop`, res.data);
-						await that.search();
-					}
-				})
 			}
 		}
 	}

+ 44 - 49
pages/login/index.vue

@@ -443,57 +443,52 @@
 					} else if (system.uniPlatform == 'mp-weixin') {
 						if (e == 'wx') {
 							if (openid) {
-								uni.getStorage({
-									key: 'shop',
-									success: async function(aee) {
-										const res = await that.$api(`/user/wxLogin`, 'POST', {
-											openid: openid,
-											shop: aee.data
-										})
-										if (res.errcode == '0') {
-											uni.setStorage({
-												key: 'token',
-												data: res.data,
-												success: function() {
-													uni.navigateBack({
-														delta: 1
-													})
-													let user = that.$jwt(res.data);
-													//当websocket收到后端发送的消息时,触发
-													let config = that.$config.wsUrl;
-													// 开启websocket
-													that.$store.dispatch('websocketInit',
-														config + `/${user._id}`);
-													// 如果是团长,请求刷新
-													if (user.is_leader == '0') {
-														let pages = getCurrentPages();
-														let prePage = pages[pages.length - 2];
-														let prePage2 = pages[pages.length - 3];
-														if (prePage && prePage.route ==
-															'pagesHome/order/detail')
-															prePage.$vm
-															.search()
-														if (prePage2 && prePage2.route ==
-															'pages/home/index') {
-															prePage2.$vm.clearPage();
-															prePage2.$vm.search();
-														}
-													}
+								const res = await that.$api(`/user/wxLogin`, 'POST', {
+									openid: openid,
+									shop: that.$config.shop
+								})
+								if (res.errcode == '0') {
+									uni.setStorage({
+										key: 'token',
+										data: res.data,
+										success: function() {
+											uni.navigateBack({
+												delta: 1
+											})
+											let user = that.$jwt(res.data);
+											//当websocket收到后端发送的消息时,触发
+											let config = that.$config.wsUrl;
+											// 开启websocket
+											that.$store.dispatch('websocketInit',
+												config + `/${user._id}`);
+											// 如果是团长,请求刷新
+											if (user.is_leader == '0') {
+												let pages = getCurrentPages();
+												let prePage = pages[pages.length - 2];
+												let prePage2 = pages[pages.length - 3];
+												if (prePage && prePage.route ==
+													'pagesHome/order/detail')
+													prePage.$vm
+													.search()
+												if (prePage2 && prePage2.route ==
+													'pages/home/index') {
+													prePage2.$vm.clearPage();
+													prePage2.$vm.search();
 												}
-											});
-										} else {
-											if (res.errcode == '-5') {
-												// 无账号,注册账号
-												that.wxCreate(aee.data);
-											} else {
-												uni.showToast({
-													title: res.errmsg || '信息错误',
-													icon: 'none'
-												})
 											}
 										}
+									});
+								} else {
+									if (res.errcode == '-5') {
+										// 无账号,注册账号
+										that.wxCreate();
+									} else {
+										uni.showToast({
+											title: res.errmsg || '信息错误',
+											icon: 'none'
+										})
 									}
-								})
+								}
 							} else {
 								uni.showToast({
 									title: '系统更新中,请稍后再试!',
@@ -511,7 +506,7 @@
 				}
 			},
 			// wx,注册账号
-			wxCreate(shop) {
+			wxCreate() {
 				const that = this;
 				uni.getUserProfile({
 					desc: '用于展示',
@@ -521,7 +516,7 @@
 							icon: [{
 								url: res.userInfo.avatarUrl
 							}],
-							shop,
+							shop: that.$config.shop,
 							name: res.userInfo.nickName + moment().valueOf()
 						}
 						const arr = await that.$api(`/user`, 'POST', parmas);

+ 8 - 16
pages/my/index.vue

@@ -70,8 +70,6 @@
 				frameStyle: {
 					useBar: true
 				},
-				// 店铺id
-				shop: '',
 				// 用户信息
 				user: {},
 				// 客服信息
@@ -143,7 +141,7 @@
 						if (user && user._id) {
 							let res = await that.$api(`/notice`, 'GET', {
 								customer: user._id,
-								shop: that.shop,
+								shop: that.$config.shop,
 								status: '0'
 							});
 							if (res.errcode == '0') that.$set(that, `notice_total`, res.total);
@@ -181,19 +179,13 @@
 					// 菜单
 					that.$set(that, `menuList`, config.my_menu);
 				}
-				uni.getStorage({
-					key: 'shop',
-					success: async function(res) {
-						that.$set(that, `shop`, res.data);
-						const arr = await that.$api(`/serviceContact`, 'GET', {
-							shop: res.data
-						});
-						if (arr.errcode == '0' && arr.total > 0) {
-							that.$set(that, `serviceContactInfo`, arr.data[0])
-						}
-					}
-				})
-
+				// 客服联系方式
+				const arr = await that.$api(`/serviceContact`, 'GET', {
+					shop: that.$config.shop
+				});
+				if (arr.errcode == '0' && arr.total > 0) {
+					that.$set(that, `serviceContactInfo`, arr.data[0])
+				}
 			},
 			// 公共跳转
 			toCommon(e) {

+ 4 - 18
pages/week/index.vue

@@ -76,8 +76,6 @@
 	export default {
 		data() {
 			return {
-				// 店铺id
-				shop: '',
 				frameStyle: {
 					useBar: true
 				},
@@ -103,7 +101,7 @@
 		},
 		onLoad: async function() {
 			const that = this;
-			await that.searchShop();
+			await that.search();
 			await that.searchConfig();
 
 		},
@@ -137,7 +135,7 @@
 				let res;
 				res = await that.$api(`/goodsTags`, 'GET', {
 					status: '0',
-					shop: that.shop
+					shop: that.$config.shop,
 				})
 				if (res.errcode == '0') {
 					that.$set(that, `typeList`, res.data);
@@ -153,7 +151,7 @@
 			async searchRight(e) {
 				const that = this;
 				let info = {
-					shop: that.shop
+					shop: that.$config.shop,
 				};
 				if (e.id) info.pid = e.id;
 				const res = await that.$api(`/goodsTags/tree`, 'GET', {
@@ -170,7 +168,7 @@
 					skip: that.skip,
 					limit: that.limit,
 					tags: that.tags,
-					shop: that.shop
+					shop: that.$config.shop,
 				}
 				const res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
 					...info,
@@ -275,20 +273,8 @@
 						url
 					})
 				}
-			},
-			// 店铺信息
-			searchShop() {
-				const that = this;
-				uni.getStorage({
-					key: 'shop',
-					success: async function(res) {
-						that.$set(that, `shop`, res.data);
-						await that.search();
-					}
-				})
 			}
 		},
-
 	}
 </script>
 

+ 2 - 15
pagesHome/group/group.vue

@@ -95,8 +95,6 @@
 	export default {
 		data() {
 			return {
-				// 店铺id
-				shop: '',
 				// 系统设置
 				config: {},
 				// 设备信息
@@ -126,7 +124,7 @@
 			that.searchConfig();
 			await that.searchOther();
 			await that.watchlogin();
-			await that.searchShop();
+			await that.search();
 		},
 		onShow: async function(e) {
 			const that = this;
@@ -175,23 +173,12 @@
 				const that = this;
 				that.$set(that.searchInfo, `end_time`, e);
 			},
-			// 店铺信息
-			searchShop() {
-				const that = this;
-				uni.getStorage({
-					key: 'shop',
-					success: async function(res) {
-						that.$set(that, `shop`, res.data);
-						await that.search();
-					}
-				})
-			},
 			async search() {
 				const that = this;
 				let info = {
 					skip: that.skip,
 					limit: that.limit,
-					shop: that.shop,
+					shop: that.$config.shop,
 					status: '0'
 				}
 				let res = await that.$api(`/group/aq`, 'GET', {

+ 2 - 15
pagesHome/market/search.vue

@@ -85,8 +85,6 @@
 	export default {
 		data() {
 			return {
-				// 店铺id
-				shop: '',
 				// 系统设置
 				config: {},
 				tags: '',
@@ -118,7 +116,7 @@
 			that.$set(that, `pid`, e.pid || '');
 			that.searchConfig();
 			await that.searchOther();
-			await that.searchShop();
+			await that.search();
 		},
 		onPullDownRefresh: async function() {
 			const that = this;
@@ -175,7 +173,7 @@
 					skip: that.skip,
 					limit: that.limit,
 					tags: that.tags,
-					shop: that.shop
+					shop: that.$config.shop,
 				}
 				const res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
 					...info,
@@ -265,17 +263,6 @@
 					url: `/pagesHome/order/detail?id=${e.id||e._id}`
 				})
 			},
-			// 店铺信息
-			searchShop() {
-				const that = this;
-				uni.getStorage({
-					key: 'shop',
-					success: async function(res) {
-						that.$set(that, `shop`, res.data);
-						await that.search();
-					}
-				})
-			},
 			// 清空列表
 			clearPage() {
 				const that = this;

+ 3 - 16
pagesHome/market/type.vue

@@ -70,8 +70,6 @@
 	export default {
 		data() {
 			return {
-				// 店铺id
-				shop: "",
 				active: '0',
 				typeList: [],
 				list: [],
@@ -95,7 +93,7 @@
 		onLoad: function() {
 			const that = this;
 			that.searchConfig();
-			that.searchShop();
+			that.search();
 		},
 		onPullDownRefresh: async function() {
 			const that = this;
@@ -127,7 +125,7 @@
 				let res;
 				res = await that.$api(`/goodsTags`, 'GET', {
 					status: '0',
-					shop: that.shop
+					shop: that.$config.shop,
 				})
 				if (res.errcode == '0') {
 					that.$set(that, `typeList`, res.data);
@@ -158,7 +156,7 @@
 					skip: that.skip,
 					limit: that.limit,
 					tags: that.tags,
-					// shop:that.shop
+					shop: that.$config.shop,
 				}
 				const res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
 					...info,
@@ -244,17 +242,6 @@
 					url: `/${e}`
 				})
 			},
-			// 店铺信息
-			searchShop() {
-				const that = this;
-				uni.getStorage({
-					key: 'shop',
-					success: async function(res) {
-						that.$set(that, `shop`, res.data);
-						await that.search();
-					}
-				})
-			},
 			// 购买
 			toBuy(e) {
 				const that = this;

+ 1 - 14
pagesHome/notice/index.vue

@@ -27,9 +27,7 @@
 <script>
 	export default {
 		data() {
-			return {
-				// 店铺id
-				shop: '',
+			return {
 				user: {},
 				list: [],
 				// 状态
@@ -133,17 +131,6 @@
 					code: "notice_source"
 				});
 				if (res.errcode == '0') that.$set(that, `sourceList`, res.data)
-			},
-			// 店铺信息
-			searchShop() {
-				const that = this;
-				uni.getStorage({
-					key: 'shop',
-					success: async function(res) {
-						that.$set(that, `shop`, res.data);
-						await that.search();
-					}
-				})
 			},
 			// 分页
 			toPage() {

+ 2 - 15
pagesIntegral/home/index.vue

@@ -38,8 +38,6 @@
 	export default {
 		data() {
 			return {
-				// 店铺id
-				shop: "",
 				// 系统设置
 				config: {},
 				searchInfo: {},
@@ -56,7 +54,7 @@
 		onLoad: async function(e) {
 			const that = this;
 			that.searchConfig();
-			await that.searchShop();
+			await that.search();
 		},
 		onPullDownRefresh: async function() {
 			const that = this;
@@ -83,7 +81,7 @@
 				let info = {
 					skip: that.skip,
 					limit: that.limit,
-					shop: that.shop
+					shop: that.$config.shop,
 				}
 				const res = await that.$api(`/zrGoods`, `GET`, {
 					...info,
@@ -144,17 +142,6 @@
 				that.$set(that, `skip`, 0)
 				that.$set(that, `limit`, 6)
 				that.$set(that, `page`, 0)
-			},
-			// 店铺信息
-			searchShop() {
-				const that = this;
-				uni.getStorage({
-					key: 'shop',
-					success: async function(res) {
-						that.$set(that, `shop`, res.data);
-						await that.search();
-					}
-				})
 			}
 		}
 	}

+ 2 - 15
pagesRest/activity/info.vue

@@ -42,8 +42,6 @@
 		components: {},
 		data() {
 			return {
-				// 店铺id
-				shop: '',
 				// 系统设置
 				config: {},
 				id: '',
@@ -104,7 +102,7 @@
 					if (res.data.content.value) res.data.content.value = res.data.content.value.replace(/\<img/gi,
 						'<img class="rich-img"');
 					that.$set(that, `info`, res.data);
-					that.searchShop();
+					that.search();
 				}
 			},
 			async search() {
@@ -116,7 +114,7 @@
 					platform_act: that.id,
 					status: '0',
 					goods_status: '1',
-					shop: that.shop
+					shop: that.$config.shop,
 				}
 				let res = await that.$api(`/goodsJoinAct`, 'GET', {
 					...info,
@@ -178,17 +176,6 @@
 					path: `/pagesRest/activity/info?id=${that.id}`,
 					imageUrl: imageUrl
 				}
-			},
-			// 店铺信息
-			searchShop() {
-				const that = this;
-				uni.getStorage({
-					key: 'shop',
-					success: async function(res) {
-						that.$set(that, `shop`, res.data);
-						await that.search();
-					}
-				})
 			}
 		}
 	}

+ 3 - 16
pagesRest/recom/index.vue

@@ -52,9 +52,7 @@
 <script>
 	export default {
 		data() {
-			return {
-				// 店铺id
-				shop: '',
+			return {
 				// 系统设置
 				config: {},
 				// 路由参数
@@ -83,7 +81,7 @@
 			}
 			that.searchConfig();
 			that.searchOther();
-			that.searchShop();
+			that.search();
 		},
 		onPullDownRefresh: async function() {
 			const that = this;
@@ -107,7 +105,7 @@
 				let info = {
 					skip: that.skip,
 					limit: that.limit,
-					shop: that.shop
+					shop: that.$config.shop,
 				};
 				if (that.type == '1') info.tags = that.tags;
 				else if (that.type == '2') info.act_tags = that.act_tags;
@@ -191,17 +189,6 @@
 				that.$set(that, `skip`, 0)
 				that.$set(that, `limit`, 6)
 				that.$set(that, `page`, 0)
-			},
-			// 店铺信息
-			searchShop() {
-				const that = this;
-				uni.getStorage({
-					key: 'shop',
-					success: async function(res) {
-						that.$set(that, `shop`, res.data);
-						await that.search();
-					}
-				})
 			}
 		},
 	}