|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
- <div class="container store-page" >
|
|
|
- <div v-if="selectVal" @click="selectVal=''" class='modal-page'></div>
|
|
|
+ <div class="container" >
|
|
|
+ <!-- <div v-if="selectVal" @click="selectVal=''" class='modal-page'></div>
|
|
|
<div class="store-toolbar">
|
|
|
<div class="toolbar">
|
|
|
<div class="item item1" @click="selectItem()">
|
|
@@ -35,7 +35,7 @@
|
|
|
<van-button block class="btn" type="danger" @click="searchHandle">确定</van-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
<scroll-view scroll-y class="store-content">
|
|
|
<v-card style="height:auto" :thumb="item.icon" v-for="(item, index) in storeList" :key="item.id">
|
|
|
<div class="store-info">
|
|
@@ -71,46 +71,27 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</v-card>
|
|
|
- <no-data :options="storeList" name="此地区还未开通门店"/>
|
|
|
+ <no-data :options="storeList" name="暂无数据"/>
|
|
|
</scroll-view>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getLookUpData } from '@/api/api';
|
|
|
-import { getListStore, getListArea, getCurrentArea } from '@/api/store.js'
|
|
|
+// import { getLookUpData } from '@/api/api';
|
|
|
+import { getBundleStore } from '@/api/store.js'
|
|
|
import NoData from '@/components/NoData';
|
|
|
import storage from '@/utils/storage.js'
|
|
|
-import { province, city, area } from '@/api/address.js'
|
|
|
+// import { province, city, area } from '@/api/address.js'
|
|
|
export default {
|
|
|
name: 'packageDetail',
|
|
|
components: { 'no-data': NoData },
|
|
|
data() {
|
|
|
return {
|
|
|
storeList: [],
|
|
|
- gpsCompletion: false,
|
|
|
- showBar: false,
|
|
|
- selectVal: '',
|
|
|
- currenCity: '', // 定位城市信息对象
|
|
|
- showCoupons: false,
|
|
|
- areaTitle: "所在区域", // 区域名称
|
|
|
- isLastPage: false,
|
|
|
pageNo: 1,
|
|
|
pageSize: 10,
|
|
|
isloaded: false, // 判断是否请求接口完成
|
|
|
- queryWord: '',
|
|
|
- currentCode: '', // 当前定位所在区域
|
|
|
- currentPosition: {
|
|
|
- lat: '',
|
|
|
- lng: ''
|
|
|
- },
|
|
|
- itemList: [],
|
|
|
- selectKey: '', // 所选区域code
|
|
|
- queryAddrDistrictList: '',
|
|
|
- queryStoreBizList: [],
|
|
|
- areaList: [],
|
|
|
- areaListTotal: [], // 从area的json中获取的城市的所有区
|
|
|
- optionCode: '' // 选择其他城市编码
|
|
|
+ usedBundleId:''
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -119,25 +100,9 @@ export default {
|
|
|
methods: {
|
|
|
// 页面初始化
|
|
|
pageInit () {
|
|
|
- this.selectVal = '';
|
|
|
this.pageNo = 1;
|
|
|
this.storeList = [];
|
|
|
- this.isLastPage = false
|
|
|
- this.isloaded = false
|
|
|
- },
|
|
|
- // 打开搜索页面
|
|
|
- openSearch () {
|
|
|
- console.log(this.queryAddrDistrictList,'选择的城市')
|
|
|
- wx.navigateTo({
|
|
|
- url: `/pages/storeSearch/main?lat=${this.currentPosition.lat}&lng=${this.currentPosition.lng}&areaCode=${this.queryAddrDistrictList}`
|
|
|
- })
|
|
|
- },
|
|
|
- // 打开选择城市页面
|
|
|
- openCitySelect () {
|
|
|
- wx.navigateTo({
|
|
|
- url: `/pages/selectCity/main?code=${this.currenCity.code}&name=${this.currenCity.name}`
|
|
|
-
|
|
|
- })
|
|
|
+ this.isloaded=false
|
|
|
},
|
|
|
|
|
|
callPhone(phone) {
|
|
@@ -145,134 +110,14 @@ export default {
|
|
|
phoneNumber: phone
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
- // 根据市的code获取该市所有的区 参数code:城市编码
|
|
|
- getAreaList (code) {
|
|
|
- console.log(code,'getAreaList--code')
|
|
|
- console.log(area,'area')
|
|
|
- console.log(city,'city')
|
|
|
- // 获取定位城市数据
|
|
|
- let currenArea = area.find(item=>{
|
|
|
- return item.code == this.currentCode
|
|
|
- })
|
|
|
- console.log(currenArea)
|
|
|
- this.currenCity = city.find(item=>{
|
|
|
- return item.code == code
|
|
|
- })
|
|
|
-
|
|
|
- this.areaTitle = currenArea ? currenArea.name : this.currenCity.name
|
|
|
- // 获取定位或选择城市的所有区
|
|
|
- let arr = []
|
|
|
- area.map( item =>{
|
|
|
- if (item.cityCode == code ){
|
|
|
- arr.push(item)
|
|
|
- }
|
|
|
- })
|
|
|
- this.areaListTotal = arr
|
|
|
- },
|
|
|
-
|
|
|
- // 获取当前定位所在区域的区域编码
|
|
|
- getAreaCode () {
|
|
|
- getCurrentArea({ lng: this.currentPosition.lng ,lat:this.currentPosition.lat }).then( res =>{
|
|
|
- console.log(res, 'res----code')
|
|
|
- if (res.status == 200) {
|
|
|
- this.queryWord = res.data.adcode
|
|
|
- this.currentCode = res.data.adcode // 区
|
|
|
- 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);
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- // 选择城市获取各区门店数量
|
|
|
- getAreaStore () {
|
|
|
- let _this = this
|
|
|
- let query = ""
|
|
|
- let hotCityList =[
|
|
|
- {name:"西安市",code:"6101"},
|
|
|
- {name:"咸阳市",code:"6104"},
|
|
|
- {name:"渭南市",code:"6105"},
|
|
|
- {name:"商洛市",code:"6110"},
|
|
|
- {name:"铜川市",code:"6102"},
|
|
|
- {name:"兰州市",code:"6201"},
|
|
|
- ]
|
|
|
- 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(res, 'res----store')
|
|
|
- if (res.status == 200) {
|
|
|
- let temp = []
|
|
|
- let arr = _this.areaListTotal
|
|
|
- //console.log(arr,"arr")
|
|
|
- for(let i=0;i<arr.length;i++){
|
|
|
- let has = res.data.find(item => { return item.addrDistrict == arr[i].code })
|
|
|
- if(!has){
|
|
|
- temp.push({
|
|
|
- addrDistrict: arr[i].code,
|
|
|
- addrDistrictName: arr[i].name,
|
|
|
- storeSum: 0
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.areaList = res.data.concat(temp)
|
|
|
- //console.log(this.areaList, "this.areaList")
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
getStarNum(level) {
|
|
|
const star = (5 - 0.5 * (level - 1)).toString();
|
|
|
return star.indexOf('.') > -1 ? star : star + '.0';
|
|
|
},
|
|
|
- searchHandle() {
|
|
|
- this.pageInit()
|
|
|
- this.getStoreList();
|
|
|
- },
|
|
|
- itemChangeHandle(val) {
|
|
|
- this.queryStoreBizList = val.mp.detail;
|
|
|
- },
|
|
|
- areaChangeHandle(val) {
|
|
|
- //console.log(val, 'val')
|
|
|
- this.queryAddrDistrictList = val.mp.detail;
|
|
|
- this.selectKey = val.mp.detail
|
|
|
- let selectArea = this.areaList.find( item =>{
|
|
|
- return item.addrDistrict == val.mp.detail
|
|
|
- })
|
|
|
- this.areaTitle = selectArea.addrDistrictName
|
|
|
- this.searchHandle()
|
|
|
- },
|
|
|
- selectItem() {
|
|
|
- if (this.selectVal !== 'item') {
|
|
|
- this.selectVal = 'item';
|
|
|
- } else {
|
|
|
- this.selectVal = '';
|
|
|
- }
|
|
|
- },
|
|
|
- // 选择区域
|
|
|
- selectArea() {
|
|
|
- if (this.selectVal !== 'area') {
|
|
|
- this.selectVal = 'area';
|
|
|
- } else {
|
|
|
- this.selectVal = '';
|
|
|
- }
|
|
|
- },
|
|
|
+ // searchHandle() {
|
|
|
+ // this.pageInit()
|
|
|
+ // this.getBundleStoreList();
|
|
|
+ // },
|
|
|
openLocation(item) {
|
|
|
wx.openLocation({
|
|
|
latitude: item.lat - 0,
|
|
@@ -284,7 +129,7 @@ export default {
|
|
|
// 格式化数据
|
|
|
formatList(list) {
|
|
|
const _this = this;
|
|
|
- if (_this.gpsCompletion && list.length) {
|
|
|
+ if (list.length) {
|
|
|
list.forEach(item => {
|
|
|
item.distance = item.distance ? (item.distance/1000).toFixed(2) : '';
|
|
|
item.star = this.getStarNum(item.level);
|
|
@@ -295,95 +140,51 @@ export default {
|
|
|
}
|
|
|
return [];
|
|
|
},
|
|
|
- // 获取门店列表
|
|
|
- getStoreList() {
|
|
|
- const {queryAddrDistrictList, queryStoreBizList} = this
|
|
|
- const _this = this;
|
|
|
+ // 获取套餐下的适用门店
|
|
|
+ getBundleStoreList(){
|
|
|
+ const _this=this
|
|
|
wx.showLoading({
|
|
|
mask: true,
|
|
|
title: '加载中'
|
|
|
});
|
|
|
- let params={
|
|
|
- queryStoreBizList,
|
|
|
- enableFlag: 1,
|
|
|
- pageNo: this.pageNo,
|
|
|
- pageSize: this.pageSize,
|
|
|
- lat: this.currentPosition.lat,
|
|
|
- lng: this.currentPosition.lng
|
|
|
- }
|
|
|
- if (queryAddrDistrictList.length == 4){ // 查询市的门店
|
|
|
- params.addrCity = queryAddrDistrictList
|
|
|
- } else { // 查询区的门店
|
|
|
- params.addrDistrict = queryAddrDistrictList
|
|
|
- }
|
|
|
- if (!params.lat && !params.lng){
|
|
|
- delete params.lat
|
|
|
- delete params.lng
|
|
|
- }
|
|
|
-
|
|
|
- getListStore(params).then(res => {
|
|
|
- setTimeout(function(){
|
|
|
- wx.hideLoading();
|
|
|
- },500)
|
|
|
- console.log(res, 'res')
|
|
|
- if(res.status == "200"){
|
|
|
- _this.isloaded = true
|
|
|
- if ( _this.pageNo == 1) {
|
|
|
- _this.storeList = _this.formatList(res.data.list)
|
|
|
- } else {
|
|
|
- _this.storeList = _this.storeList.concat(_this.formatList(res.data.list))
|
|
|
- }
|
|
|
- let len = _this.storeList.length
|
|
|
- if(len>=res.data.count){
|
|
|
- if(_this.pageNo!=1){
|
|
|
- wx.showToast({
|
|
|
- title: '已经是最后一页'
|
|
|
- })
|
|
|
+ getBundleStore({id:this.usedBundleId,pageNo: this.pageNo,pageSize: this.pageSize,}).then(res=>{
|
|
|
+ setTimeout(function(){
|
|
|
+ wx.hideLoading();
|
|
|
+ },500)
|
|
|
+ if(res.status == "200"){
|
|
|
+ _this.isloaded = true
|
|
|
+ if ( _this.pageNo == 1) {
|
|
|
+ console.log(res,'----------liebiaoshuju')
|
|
|
+ // _this.storeList = res.data.list
|
|
|
+ _this.storeList = _this.formatList(res.data.list)
|
|
|
+ console.log( _this.storeList,' _this.storeList','套餐下的门店')
|
|
|
+ } else {
|
|
|
+ _this.storeList = _this.storeList.concat(_this.formatList(res.data.list))
|
|
|
}
|
|
|
- _this.isLastPage = true
|
|
|
+ let len = _this.storeList.length
|
|
|
+ if(len>=res.data.count){
|
|
|
+ if(_this.pageNo!=1){
|
|
|
+ wx.showToast({
|
|
|
+ title: '已经是最后一页'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ _this.isLastPage = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.message,
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2500
|
|
|
+ });
|
|
|
}
|
|
|
- } else {
|
|
|
- wx.showToast({
|
|
|
- title: res.message,
|
|
|
- icon: 'none',
|
|
|
- duration: 2500
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- cancelSearchHandle() {
|
|
|
- if (this.selectVal === 'item') {
|
|
|
- this.queryStoreBizList = [];
|
|
|
- } else {
|
|
|
- this.queryAddrDistrictList = '';
|
|
|
- }
|
|
|
- wx.showLoading({
|
|
|
- mask: true,
|
|
|
- title: '加载中'
|
|
|
- });
|
|
|
- this.selectVal = '';
|
|
|
- this.getStoreList();
|
|
|
+ })
|
|
|
},
|
|
|
- // 默认西安的门店
|
|
|
- getDefaultStore () {
|
|
|
- // 没有定位 默认西安市'
|
|
|
- this.queryAddrDistrictList = this.queryAddrDistrictList ? this.queryAddrDistrictList : "6101"
|
|
|
- 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
|
|
|
- }
|
|
|
},
|
|
|
// 监听用户上拉触底事件
|
|
|
onReachBottom() {
|
|
|
if(!this.isLastPage){
|
|
|
this.pageNo = this.pageNo + 1
|
|
|
- this.getStoreList()
|
|
|
+ this.getBundleStoreList()
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
@@ -391,64 +192,16 @@ export default {
|
|
|
mask: true,
|
|
|
title: '加载中'
|
|
|
});
|
|
|
-
|
|
|
- const _this = this;
|
|
|
- this.showBar = false;
|
|
|
- // this.queryAddrDistrictList = '';
|
|
|
- // this.queryStoreBizList = [];
|
|
|
this.pageInit()
|
|
|
-
|
|
|
- // 选择其他城市
|
|
|
- if (this.optionCode&&this.optionCode!='null'){
|
|
|
- console.log(this.optionCode,'选择其他城市')
|
|
|
- this.areaListTotal = []
|
|
|
- this.queryWord = this.optionCode
|
|
|
- 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{
|
|
|
- // 根据定位获取城市
|
|
|
- wx.getLocation({
|
|
|
- type: 'wgs84', // 默认wgs84
|
|
|
- success: function(res) {
|
|
|
- console.log('getLocation success')
|
|
|
- _this.currentPosition.lat = res.latitude;
|
|
|
- _this.currentPosition.lng = res.longitude;
|
|
|
- _this.getAreaCode();
|
|
|
- },
|
|
|
- fail: function(res) {
|
|
|
- console.log(res,'getLocation fail')
|
|
|
- // 没有定位 默认西安市'
|
|
|
- _this.getDefaultStore()
|
|
|
- _this.gpsCompletion = false;
|
|
|
- },
|
|
|
- complete: function(){
|
|
|
- console.log('getLocation complete')
|
|
|
- _this.gpsCompletion = true;
|
|
|
- _this.showBar = true;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
console.log(options,"sotore index options")
|
|
|
- if (options.code&&options.code!='null'){ // 选择其他城市
|
|
|
- this.optionCode = options.code
|
|
|
- this.areaTitle = options.name
|
|
|
- this.selectKey = options.code
|
|
|
+ // 判断当前页面的上个页面是套餐详情页 筛选条件等不显示
|
|
|
+ if(options && options.bundleId){
|
|
|
+ this.usedBundleId=options.bundleId
|
|
|
+ this.getBundleStoreList()
|
|
|
+
|
|
|
}
|
|
|
- const _this = this;
|
|
|
- getLookUpData({ type: 'SERVICE_TYPE' }).then(res => {
|
|
|
- if (res.status === '200') {
|
|
|
- _this.itemList = res.data;
|
|
|
- }
|
|
|
- });
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
@@ -465,17 +218,6 @@ export default {
|
|
|
height: 100%;
|
|
|
overflow: hidden;
|
|
|
box-sizing: border-box;
|
|
|
- padding-top: 70rpx;
|
|
|
-}
|
|
|
-.modal-page {
|
|
|
- width :100%;
|
|
|
- height :100%;
|
|
|
- z-index :2;
|
|
|
- background-color :black;
|
|
|
- opacity :0.6;
|
|
|
- position: fixed;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
}
|
|
|
.store-content {
|
|
|
height: 100%;
|