Browse Source

首页问题

shish 5 years ago
parent
commit
ad6745f844

+ 25 - 27
mallApp/src/mixins/globalMixins.js

@@ -1,7 +1,7 @@
 import { mapGetters } from 'vuex'
 import { pageTo, getCheckLogin, isLogin } from '@/utils/util.js'
 import { wxLoginFn } from '@/utils/auth'
-import { initCustom } from '@/api/custom'
+import { getShopUser } from '@/utils/auth'
 import constant from '@/constant'
 export default {
 	data() {
@@ -25,29 +25,12 @@ export default {
 		if (option.token) {
 			uni.setStorageSync('token', option.token)
 		}
+		let oldAccount = uni.getStorageSync('account')
 		if (option.account) {
-
-			//切换门店,需要先确认有没生成客户id
-			// let oldAccount = uni.getStorageSync('account')
-			// if(oldAccount != option.account){
-			// 	getShopUser(true).then(res => {
-			// 		if(res.code == 1){
-			// 			uni.setStorageSync('customId', res.data.custom.id)
-			// 		}
-			// 	})
-			// }
-
 			uni.setStorageSync('account', option.account)
-
-		}
-		if (constant.source == 'mall') {
-			if (option.shopId) {
-				uni.setStorageSync('shopId', option.shopId)
-			}
 		}
 		uni.setStorageSync('currentQuery', JSON.stringify(option))
 
-		// #ifdef MP-WEIXIN
 		//线上检查小程序的登录态是否有效 checkSession
 		//checkSession开发环境无效,在真机调试有效
 		if (process.env.NODE_ENV == "production") {
@@ -60,27 +43,42 @@ export default {
 				}
 			})
 		}
-		// #endif
-
 		// 登录
 		if (isLogin()) {
-			console.log(1111)
 			if (this.init) {
-				this.init()
+				let self = this
+				//切换门店,需要先确认有没生成客户id shish 2021.5.2
+				if (oldAccount != option.account) {
+					getShopUser(true).then(res => {
+						if (!this.$util.isEmpty(res)) {
+							self.init()
+						}
+					})
+				} else {
+					this.init()
+				}
 			}
 		} else {
 			console.log(1112)
 			wxLoginFn().then(res => {
 				if (this.init) {
-					console.log(1113)
-					this.init()
-					console.log(1114)
+					let self = this
+					//切换门店,需要先确认有没生成客户id shish 2021.5.2
+					if (oldAccount != option.account) {
+						getShopUser(true).then(res => {
+							if (!this.$util.isEmpty(res)) {
+								self.init()
+							}
+						})
+					} else {
+						this.init()
+					}
 				}
 			})
 		}
 
 	},
 	mounted() {
-		if (this.mInit) {}
+		if (this.mInit) { }
 	}
 }

+ 5 - 5
mallApp/src/pages/goods/components/buy-foot.vue

@@ -5,10 +5,7 @@
                 <i class="iconfont iconxiaoxi"></i>
                 <div class="btn-text">客服</div>
             </div>
-            <div class="btn-wrap" @click="pageTo({
-                url: '/pages/home/shop',
-                type: 4
-            })">
+            <div class="btn-wrap" @click="goShop">
                 <i class="iconfont icondianpu"></i>
                 <div class="btn-text">店铺</div>
             </div>
@@ -27,7 +24,10 @@ export default {
 	methods: {
 		buy() {
 			this.$emit('buy')
-		}
+		},
+        goShop(){
+            this.$emit('goShop')
+        }
 	}
 }
 </script>

+ 13 - 2
mallApp/src/pages/goods/detail.vue

@@ -74,11 +74,11 @@
       @change="changeNum"
       @close="hidePopup"
     />
-    <buy-foot @buy="showPopup" :stock="data.stock" />
+    <buy-foot @buy="showPopup" @goShop="goToShop" :stock="data.stock" />
     <!-- login -->
     <go-login :show.sync="loginShow" />
     <!-- 分享 -->
-    <app-share-mask :show="showShare" text="即可分享商品" @click="hideShare" />
+    <app-share-mask :show="showShare" text="分享商品" @click="hideShare" />
   </div>
 </template>
 
@@ -165,6 +165,17 @@ export default {
     changeNum(e) {
       this.buyNum = e.value;
     },
+    goToShop(){
+      let account = uni.getStorageSync('account')
+      this.$util.pageTo({
+                url: '/pages/home/shop',
+                type: 4,
+query: {
+                account: account
+              }
+
+            })
+    },
     showPopup() {
       if (this.$util.isLogin()) {
         this.popupShow = true;

+ 1 - 3
mallApp/src/pages/home/index.vue

@@ -59,9 +59,7 @@ export default {
   computed: {
     ...mapGetters({ orderShop: "getOrderShop" })
   },
-  onLoad (option) {
-    console.log('onload===>', option)
-  },
+  onLoad (option) {},
   mounted () { },
   onShow () {
     uni.hideTabBar()