|
@@ -6,11 +6,27 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ <!-- 推荐渠道 -->
|
|
|
|
|
+ <view class="yt-list">
|
|
|
|
|
+ <view class="top-wrap flex">
|
|
|
|
|
+ <view class="top-left">
|
|
|
|
|
+ 推荐渠道
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="contet-list flex" >
|
|
|
|
|
+ <view class="tc " style="display: flex;text-align: center;" :class="{'action': is_tj}" @click="couldTj?istj==true:''">
|
|
|
|
|
+ 推荐渠道
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="tc" style="display: flex;text-align: center;" :class="{'action': !is_tj}">
|
|
|
|
|
+ {{isFj?'最近门店': '选择门店'}}
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
<!-- 门店选择 -->
|
|
<!-- 门店选择 -->
|
|
|
- <view class="yt-list tc-wrap" @click="navTo('/pages/shop/shopTab?select=1')">
|
|
|
|
|
|
|
+ <view class="yt-list tc-wrap" @click="navTo('/pages/shop/shopTab?select=1')" v-if="!is_tj">
|
|
|
<view class="top-wrap flex">
|
|
<view class="top-wrap flex">
|
|
|
<view class="top-left">
|
|
<view class="top-left">
|
|
|
- 选择门店
|
|
|
|
|
|
|
+ {{isFj?'最近门店': '选择门店'}}
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="store-wrap flex" v-if="selctStore && selctStore.id">
|
|
<view class="store-wrap flex" v-if="selctStore && selctStore.id">
|
|
@@ -168,6 +184,11 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
|
|
+ import {
|
|
|
|
|
+ openMap
|
|
|
|
|
+ } from '@/utils/rocessor.js';
|
|
|
|
|
+ // #endif
|
|
|
// #ifdef H5
|
|
// #ifdef H5
|
|
|
import weixinObj from "@/plugin/jweixin-module/index.js";
|
|
import weixinObj from "@/plugin/jweixin-module/index.js";
|
|
|
// #endif
|
|
// #endif
|
|
@@ -192,6 +213,9 @@
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ is_tj: false,//是否使用推荐渠道
|
|
|
|
|
+ couldTj: false,//是否可用推荐渠道
|
|
|
|
|
+ isFj: false,//是否为最近门店
|
|
|
selctStore: {
|
|
selctStore: {
|
|
|
id: ''
|
|
id: ''
|
|
|
},
|
|
},
|
|
@@ -213,6 +237,9 @@
|
|
|
},
|
|
},
|
|
|
onShow() {
|
|
onShow() {
|
|
|
this.userinfo()
|
|
this.userinfo()
|
|
|
|
|
+ if( this.address.latitude == '') {
|
|
|
|
|
+ this.getlocation()
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
onReachBottom() {
|
|
onReachBottom() {
|
|
|
|
|
|
|
@@ -221,7 +248,85 @@
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- ...mapMutations('user', ['setUserInfo']),
|
|
|
|
|
|
|
+ ...mapMutations('user', ['setUserInfo','setAddress']),
|
|
|
|
|
+ // 获取附近门店
|
|
|
|
|
+ storeList(source) {
|
|
|
|
|
+ let that = this
|
|
|
|
|
+ storeList({
|
|
|
|
|
+ page: 1,
|
|
|
|
|
+ limit: 1,
|
|
|
|
|
+ latitude: that.address.latitude,
|
|
|
|
|
+ longitude: that.address.longitude,
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(({
|
|
|
|
|
+ data
|
|
|
|
|
+ }) => {
|
|
|
|
|
+ // console.log(data, '结果');
|
|
|
|
|
+ if(data && data.list && data.list.length > 0) {
|
|
|
|
|
+ that.selctStore = data.list[0]
|
|
|
|
|
+ if(data.list[0].distance*1 <= 100 ) {
|
|
|
|
|
+ that.isFj = true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ // 获取经纬度
|
|
|
|
|
+ getlocation() {
|
|
|
|
|
+ let obj = this;
|
|
|
|
|
+ // #ifdef H5 || APP
|
|
|
|
|
+ uni.getLocation({
|
|
|
|
|
+ type: 'gcj02',
|
|
|
|
|
+ success(e) {
|
|
|
|
|
+ obj.getlocationSetInit(e)
|
|
|
|
|
+ },
|
|
|
|
|
+ fail(e) {
|
|
|
|
|
+ if(e.errCode==22){
|
|
|
|
|
+ uni.showModal({
|
|
|
|
|
+ title: '定位开启错误',
|
|
|
|
|
+ content: '请查看是否已经开启定位服务',
|
|
|
|
|
+ showCancel: false,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log(e, 'cw');
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
|
|
+ openMap().then((e) => {
|
|
|
|
|
+ console.log("授权");
|
|
|
|
|
+ wx.getLocation({
|
|
|
|
|
+ type: 'gcj02',
|
|
|
|
|
+ success: (e) => {
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ // 调用鉴定位置变化事件
|
|
|
|
|
+ this.getlocationSetInit(e)
|
|
|
|
|
+ },
|
|
|
|
|
+ fail() {
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ },
|
|
|
|
|
+ // 获取经纬度完毕后回调处理
|
|
|
|
|
+ getlocationSetInit(data) {
|
|
|
|
|
+ const obj = this;
|
|
|
|
|
+ try {
|
|
|
|
|
+ console.log(data, '位置数据');
|
|
|
|
|
+ // 保存当前经纬度
|
|
|
|
|
+ obj.setAddress({
|
|
|
|
|
+ latitude: data.latitude,
|
|
|
|
|
+ longitude: data.longitude
|
|
|
|
|
+ })
|
|
|
|
|
+ this.storeList()
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.log(e, 'cww');
|
|
|
|
|
+ this.storeList()
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
// 获取使用说明
|
|
// 获取使用说明
|
|
|
getSm() {
|
|
getSm() {
|
|
|
details({}, 1).then(res => {
|
|
details({}, 1).then(res => {
|
|
@@ -243,6 +348,10 @@
|
|
|
data
|
|
data
|
|
|
}) => {
|
|
}) => {
|
|
|
this.now_money = data.now_money;
|
|
this.now_money = data.now_money;
|
|
|
|
|
+ if(data.store_id > 0) {
|
|
|
|
|
+ this.couldTj = true
|
|
|
|
|
+ this.is_tj = true
|
|
|
|
|
+ }
|
|
|
this.setUserInfo(data)
|
|
this.setUserInfo(data)
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -268,12 +377,12 @@
|
|
|
},
|
|
},
|
|
|
toBuy() {
|
|
toBuy() {
|
|
|
let that = this
|
|
let that = this
|
|
|
- if (that.selctStore.id == '') {
|
|
|
|
|
|
|
+ if (!that.is_tj && that.selctStore.id == '') {
|
|
|
return that.$api.msg('请选择门店')
|
|
return that.$api.msg('请选择门店')
|
|
|
}
|
|
}
|
|
|
that.loading = true
|
|
that.loading = true
|
|
|
rentCreate({
|
|
rentCreate({
|
|
|
- store_id: that.selctStore.id,
|
|
|
|
|
|
|
+ store_id: that.is_tj?that.userinfo.store_id: that.selctStore.id,
|
|
|
rent_id: that.selectTc.id,
|
|
rent_id: that.selectTc.id,
|
|
|
// #ifdef H5
|
|
// #ifdef H5
|
|
|
from: 'weixin', //来源
|
|
from: 'weixin', //来源
|