Explorar el Código

扫码锁定门店

xiaohaizhao hace 1 año
padre
commit
e9cb9488fd
Se han modificado 3 ficheros con 27 adiciones y 13 borrados
  1. 2 1
      App.vue
  2. 12 7
      pages/index/index.vue
  3. 13 5
      pages/index/index/index.vue

+ 2 - 1
App.vue

@@ -1,6 +1,7 @@
 <script>
 export default {
-	onLaunch: function () {
+	onLaunch: function (options) {
+		console.log("onLaunch", options.query)
 		let { mount, setBar } = require("./utils/tool");
 		mount()
 		setBar()

+ 12 - 7
pages/index/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<index ref="首页" v-show="page == '首页'" />
+		<index ref="首页" v-show="page == '首页'" :sa_storeid="sa_storeid" />
 		<store ref="活动" v-show="page == '活动'" />
 		<my-case ref="案例" v-show="page == '案例'" />
 		<videos ref="视频" v-show="page == '视频'" />
@@ -16,9 +16,6 @@
 </template>
 
 <script>
-import Vue from 'vue';
-
-
 import index from './index/index.vue'
 import store from './index/store.vue'
 import myCase from './index/myCase.vue'
@@ -40,15 +37,22 @@ export default {
 			user: {
 				wechatBindUserid: 0,
 				userName: ""
-			}
+			},
+			sa_storeid: 0
 		}
 	},
 	onLoad(options) {
 		if (options.wechatBindUserid) {
 			this.user.wechatBindUserid = options.wechatBindUserid;
 			this.user.userName = options.userName;
+		} else if (options.sa_storeid) {
+			this.sa_storeid = options.sa_storeid;
+		}
+		if (options.q) {
+			let data = this.getUrlParams(options.q);
+			if (data.wechatBindUserid) this.user = data;//绑定账号
+			if (data.sa_storeid) this.sa_storeid = data.sa_storeid;//锁定门店
 		}
-		if (options.q) this.user = this.getUrlParams(options.q);
 	},
 	onShow() {
 		this.isInitializeLogin(render.bind(this))
@@ -102,11 +106,12 @@ export default {
 						})
 					}
 				});
+			} else {
+				console.log("this.user", this.user)
 			}
 		}
 	},
 	methods: {
-
 		updatePageData(itemId, page) {
 			if (this.$refs[this.page].updatePage) this.$refs.pages.onClick(itemId, page)
 		},

+ 13 - 5
pages/index/index/index.vue

@@ -98,6 +98,12 @@ import contact from "../../../components/contact"
 import apps from "./modules/apps"
 export default {
     components: { contact, apps },
+    props: {
+        sa_storeid: {
+            type: [Number, String],
+            default: 0
+        }
+    },
     data() {
         return {
             updatePage: true,
@@ -153,13 +159,15 @@ export default {
                 this.getLocation().then(s => {
                     console.log("获取地理位置信息", s)
                     //"sa storeid":3
+                    let content = {
+                        "longitude": s ? s.longitude : '',
+                        "latitude": s ? s.latitude : '',
+                        date: Date.now()
+                    };
+                    if (this.sa_storeid) content.sa_storeid = this.sa_storeid;
                     this.$Http.basic({
                         "id": 20240416153202,
-                        "content": {
-                            "longitude": s ? s.longitude : '',
-                            "latitude": s ? s.latitude : '',
-                            date: Date.now()
-                        }
+                        content
                     }).then(res => {
                         resolve()
                         this.getLocationLoading = false;