Browse Source

修改接口传参

zhangdan 4 years ago
parent
commit
39b9a4cf6c
2 changed files with 29 additions and 6 deletions
  1. 24 3
      src/pages/allStore/index.vue
  2. 5 3
      src/pages/bundleDetail/index.vue

+ 24 - 3
src/pages/allStore/index.vue

@@ -57,7 +57,9 @@ export default {
       pageSize: 10,
       isloaded: false, // 判断是否请求接口完成
       usedBundleId:'',
-      bundleName:'' // 套餐名称
+      bundleName:'' ,// 套餐名称
+      latitude:'', // 当前位置经度
+      longitude:'' // 当前位置维度
     };
   },
   computed: {
@@ -105,11 +107,18 @@ export default {
     // 获取套餐下的适用门店
     getBundleStoreList(){
       const _this=this
+      const params={bundleId:this.usedBundleId,pageNo: this.pageNo,pageSize: this.pageSize}
+      if(this.latitude && this.longitude){
+        params.store={
+          lat:this.latitude,
+          lng:this.longitude
+        }
+      }
       wx.showLoading({
         mask: true,
         title: '加载中'
       });
-      getBundleStore({id:this.usedBundleId,pageNo: this.pageNo,pageSize: this.pageSize,}).then(res=>{
+      getBundleStore(params).then(res=>{
         setTimeout(function(){
           wx.hideLoading();
         },500)
@@ -155,6 +164,9 @@ export default {
       title: '加载中'
     });
     this.pageInit()
+    setTimeout(()=>{
+      this.getBundleStoreList()
+    },500)
   },
   onLoad(options) {
     console.log(options,"sotore index options",options.bundleName,'bundleName')
@@ -162,8 +174,17 @@ export default {
     if(options && options.bundleId && options.bundleName){
       this.usedBundleId=options.bundleId
       this.bundleName=options.bundleName
-      this.getBundleStoreList()
     }
+    wx.getLocation({
+     type: 'wgs84',
+     success:(res=> {
+       if(res.latitude && res.longitude){
+         this.latitude = res.latitude
+         this.longitude = res.longitude
+       }
+       console.log(res,'位置信息',this.latitude,this.longitude)
+     })
+    })
   }
 };
 </script>

+ 5 - 3
src/pages/bundleDetail/index.vue

@@ -114,8 +114,10 @@ export default {
     getUsedStorelist(){
       const params={bundleId:this.$mp.query.id}
       if(this.latitude && this.longitude){
-        params.lat=this.latitude
-        params.lng=this.longitude
+        params.store={
+          lat:this.latitude,
+          lng:this.longitude
+        }
       }
       console.log(params,'this.latitude,this.latitude')
       getUsedStore(params).then(res=>{
@@ -140,7 +142,7 @@ export default {
   onShow() {
     setTimeout(()=>{
        this.getUsedStorelist()
-    },1000)
+    },500)
     wx.showLoading({
       mask: true,
       title: '加载中'