Browse Source

bug 修复

lilei 4 years ago
parent
commit
067d97f285
1 changed files with 16 additions and 47 deletions
  1. 16 47
      src/pages/store/index.vue

+ 16 - 47
src/pages/store/index.vue

@@ -3,11 +3,11 @@
     <div v-if="selectVal" @click="selectVal=''" class='modal-page'></div>
     <div class="store-toolbar">
       <div class="toolbar">
-        <div class="item item1" @click="selectItem()">
+        <div class="item item1" :class="selectVal === 'item'? 'red-text': ''" @click="selectItem()">
           服务项目
           <van-icon class="icon" :name="selectVal==='item' ? 'arrow-up': 'arrow-down' " />
         </div>
-        <div class="item" :class="areaTitle != '所在区域'? 'red-text': ''" @click="selectArea()">
+        <div class="item" :class="selectVal === 'area'? 'red-text': ''" @click="selectArea()">
           {{areaTitle}}
           <van-icon class="icon" :name="selectVal==='area' ? 'arrow-up': 'arrow-down' " />
         </div>
@@ -183,6 +183,8 @@ export default {
            }
        })
        this.areaListTotal = arr
+       // 获取当前区下的门店
+       this.getAreaStore()
     },
 
     // 获取当前定位所在区域的区域编码
@@ -195,11 +197,6 @@ export default {
           let cityCode = res.data.cityCode.slice(0,4) // 城市
           this.getAreaList(cityCode) // 获取定位城市的所有区
           this.queryAddrDistrictList = res.data.adcode
-          this.getStoreList()
-          let _this = this
-           setTimeout(function() {
-             _this.getAreaStore()
-           }, 100);
         }
       })
     },
@@ -207,29 +204,8 @@ export default {
     // 选择城市获取各区门店数量
     getAreaStore () {
       let _this = this
-      let query = ""
-      let hotCityList =[
-        {name:"成都市",code:"5101"},
-        {name:"西安市",code:"6101"},
-        {name:"重庆市",code:"5001"},
-        {name:"南昌市",code:"3601"},
-        {name:"长沙市",code:"4301"},
-        {name:"合肥市",code:"3401"},
-        ]
-        let has= hotCityList.find(item=>{
-          item.code == this.currenCity.code
-        })
-      if (!has && !this.optionCode){ // 定位城市不是热门城市
-        // wx.showToast({
-        // 	title: '您所在区域暂未开通服务,将为您默认展示西安区域门店'
-        // })
-        query = "6101"
-      }else if (!this.queryWord ) {
-        query = "6101"  // 没有定位 默认西安市
-      } else {
-        query = this.queryWord
-      }
-      getListArea({ queryWord:query, enableFlag:1 }).then( res =>{
+      console.log(this.queryWord, this.optionCode=='',this.currenCity,'55')
+      getListArea({ queryWord:this.queryWord, enableFlag:1 }).then( res =>{
         console.log(res, 'res----store')
         if (res.status == 200) {
             let temp = []
@@ -264,6 +240,7 @@ export default {
 
           this.areaList = res.data.concat(temp)
           console.log(this.areaList, "this.areaList")
+          this.getStoreList()
         }
       })
     },
@@ -416,11 +393,6 @@ export default {
       this.areaTitle = this.areaTitle ? this.areaTitle : "西安市"
       this.currentCode = this.queryAddrDistrictList
       this.getAreaList(this.queryAddrDistrictList.slice(0,4))
-      let _this = this
-      setTimeout(function() {
-        _this.getAreaStore()
-      }, 100);
-      this.getStoreList()
       this.showBar = false
     }
   },
@@ -439,8 +411,6 @@ export default {
 
     const _this = this;
     this.showBar = false;
-    // this.queryAddrDistrictList = '';
-    // this.queryStoreBizList = [];
     this.pageInit()
 
     // 选择其他城市
@@ -451,11 +421,6 @@ export default {
       this.queryAddrDistrictList = this.optionCode
       this.currentCode = this.optionCode
       this.getAreaList(this.optionCode)
-      let _this = this
-      setTimeout(function() {
-        _this.getAreaStore()
-      }, 100);
-      this.getStoreList();
       this.showBar = true;
     }else{
       // 根据定位获取城市
@@ -463,8 +428,9 @@ export default {
         type: 'wgs84', // 默认wgs84
         success: function(res) {
           console.log('getLocation success')
-          _this.currentPosition.lat = res.latitude;
-          _this.currentPosition.lng = res.longitude;
+          // 30.644118,104.046339
+          _this.currentPosition.lat = 30.644118;
+          _this.currentPosition.lng = 104.046339;
           _this.getAreaCode();
         },
         fail: function(res) {
@@ -638,7 +604,7 @@ export default {
   top: 10px;
 }
 .checkbox-group {
-  padding: 5px 20px 5px 40px;
+  padding: 5px 20px;
   display: flex;
   flex-wrap: wrap;
   justify-content: space-between;
@@ -653,10 +619,13 @@ export default {
 }
 .radiobox-item {
   width :100%;
-  padding :10px 0;
   display : flex;
   align-items : center;
-  border-bottom :1px solid #9999;
+  border-bottom :1px solid #eee;
+  .van-radio{
+    padding 10px;
+    width : 100%;
+  }
   .van-radio__label{
     flex-grow : 1;
   }