This commit is contained in:
parent
6b68c8f916
commit
d4e222e0b6
|
@ -3,9 +3,9 @@ let WSS_URL
|
|||
import store from "@/store/user.js"
|
||||
// 环境
|
||||
// let env = "dev"
|
||||
// let env = "prod"
|
||||
let env = "prod"
|
||||
// let env = "release";
|
||||
let env = "local";
|
||||
// let env = "local";
|
||||
|
||||
switch (env) {
|
||||
case 'dev':
|
||||
|
|
|
@ -244,7 +244,7 @@
|
|||
const cartList = ref([]);
|
||||
const cartInfo = ref({});
|
||||
const getcartList = (check = true) => {
|
||||
cartListApi().then(res => {
|
||||
cartListApi({store_id:STORE_INFO.id}).then(res => {
|
||||
if (check) {
|
||||
res.data.lists = res.data.lists.map(item => {
|
||||
item.check = true;
|
||||
|
|
|
@ -23,21 +23,16 @@
|
|||
<template #left>
|
||||
<view class="store-info">
|
||||
<view style="display: flex;font-size: 30rpx;font-weight: bold;">
|
||||
<!-- <text v-if=" vipList.includes(userStore.userInfo.user_ship) || shareInfo.store_id"
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
|
||||
<text v-if="vipList.includes(userStore.userInfo.user_ship)">
|
||||
{{ (userStore.userInfo.real_name || userStore.userInfo.nickname) + '的个人门店' }}</text>
|
||||
<text v-else>
|
||||
{{(shareInfo.real_name || (userStore.userInfo.real_name || userStore.userInfo.nickname)) + '的供销店' }}</text>
|
||||
</text> -->
|
||||
<text v-if="shareInfo.uid"
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
|
||||
{{shareInfo.real_name}}
|
||||
</text>
|
||||
<text v-else
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
|
||||
@click="navgo('/multipleShop/index/index?event=store_info')">{{
|
||||
STORE_INFO.store_name }}</text>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
<up-icon name="arrow-right" label="切换" labelSize="10px"
|
||||
@click="navgo('/multipleShop/index/index?event=store_info')"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -258,6 +253,20 @@
|
|||
</view>
|
||||
</view>
|
||||
</u-overlay>
|
||||
<up-popup :show="LocationShow" mode="bottom" @open="LocationShowOpen()">
|
||||
<view style="margin: 40rpx 10rpx;">
|
||||
<up-row customStyle="margin-bottom: 10px" gutter="10">
|
||||
<up-col span="6">
|
||||
<up-button text="取消" @click="userLocationfalse()"></up-button>
|
||||
</up-col>
|
||||
<up-col span="6">
|
||||
<up-button type="primary" text="设置授权" color="#20B128" @click="opensettings()"></up-button>
|
||||
</up-col>
|
||||
</up-row>
|
||||
|
||||
</view>
|
||||
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -298,6 +307,11 @@
|
|||
} from "@/api/multipleShop.js";
|
||||
|
||||
import useUserStore from "@/store/user";
|
||||
//定位坐标
|
||||
let location = {
|
||||
lat: '',
|
||||
long: "",
|
||||
};
|
||||
const vipList = reactive([1, 2, 3, 4, 5, 6, 7, 8])
|
||||
const userStore = useUserStore();
|
||||
const STORE_INFO = reactive({
|
||||
|
@ -310,6 +324,28 @@
|
|||
price: ""
|
||||
})
|
||||
|
||||
const showModal = ref(false)
|
||||
const navgo = (url) => {
|
||||
showModal.value &&= false
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
const LocationShow = ref(false)
|
||||
|
||||
uni.$on('store_info', function(data) {
|
||||
let datas = JSON.parse(data)
|
||||
if (datas) {
|
||||
datas.store_name = datas.name
|
||||
uni.setStorageSync("STORE_INFO", JSON.stringify(datas));
|
||||
STORE_INFO.id = datas.id
|
||||
STORE_INFO.store_name = datas.name
|
||||
shareInfo.value.real_name = datas.name
|
||||
shareInfo.value.store_id = datas.id
|
||||
}
|
||||
getgoodClassList(0)
|
||||
getGoodList()
|
||||
})
|
||||
const getStoreInfoFn = () => {
|
||||
if (uni.getStorageSync('STORE_INFO').length) {
|
||||
let data = JSON.parse(uni.getStorageSync('STORE_INFO'))
|
||||
|
@ -322,11 +358,13 @@
|
|||
let data = res.data;
|
||||
for (let key in data) {
|
||||
STORE_INFO[key] = data[key]
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
getgoodClassList(0);
|
||||
getGoodList();
|
||||
getCartList();
|
||||
}
|
||||
|
||||
|
||||
|
@ -673,6 +711,7 @@
|
|||
cartListApi({
|
||||
page_no: 1,
|
||||
page_size: 100,
|
||||
store_id: STORE_INFO.id,
|
||||
}).then(res => {
|
||||
cartInfo.value = {
|
||||
total_price: res.data?.extend?.total_price || '0.00',
|
||||
|
@ -729,8 +768,7 @@
|
|||
} else {
|
||||
uni.removeStorageSync('SHARE_INFO')
|
||||
}
|
||||
|
||||
getStoreInfoFn()
|
||||
getLocation()
|
||||
|
||||
// #ifndef H5
|
||||
// 胶囊布局信息
|
||||
|
@ -739,6 +777,9 @@
|
|||
})
|
||||
|
||||
onShow(() => {
|
||||
if(STORE_INFO.id){
|
||||
getCartList();
|
||||
}
|
||||
// 如果后台变更核销人员权限 可以及时切换
|
||||
if (userStore.token && userStore.userInfo.mobile) {
|
||||
userInfoApi().then(res => {
|
||||
|
@ -752,14 +793,110 @@
|
|||
uni.reLaunch({
|
||||
url: "/multipleShop/verificationOrder/index"
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//获取定位
|
||||
const getLocation = () => {
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.getSetting({
|
||||
success(res) {
|
||||
if (res.authSetting["scope.userLocation"] == false) {
|
||||
LocationShowOpen()
|
||||
} else {
|
||||
opensettings(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
userLocationfalse()
|
||||
// #endif
|
||||
|
||||
}
|
||||
const LocationShowOpen = () => {
|
||||
LocationShow.value = true;
|
||||
}
|
||||
|
||||
//获取小程序定位
|
||||
const opensettings = (a = false) => {
|
||||
if (a == false) {
|
||||
uni.openSetting({
|
||||
success(res) {
|
||||
LocationShow.value = false;
|
||||
if (res.authSetting["scope.userLocation"] == true) {
|
||||
uni.authorize({
|
||||
scope: 'scope.userLocation',
|
||||
success() {
|
||||
uni.getLocation({
|
||||
type: "gcj02",
|
||||
success(res) {
|
||||
location.lat = res.latitude;
|
||||
location.long = res.longitude;
|
||||
uni.setStorageSync('location', JSON.stringify(
|
||||
location))
|
||||
getStoreInfo(location).then(res => {
|
||||
STORE_INFO.id = res.data.id
|
||||
STORE_INFO.store_name = res.data.store_name
|
||||
getgoodClassList(0)
|
||||
getGoodList()
|
||||
getCartList();
|
||||
uni.setStorageSync('STORE_INFO', JSON.stringify(STORE_INFO))
|
||||
})
|
||||
|
||||
},
|
||||
})
|
||||
},
|
||||
fail(e) {
|
||||
userLocationfalse()
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
fail(e) {
|
||||
userLocationfalse()
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.authorize({
|
||||
scope: 'scope.userLocation',
|
||||
success() {
|
||||
uni.getLocation({
|
||||
type: "gcj02",
|
||||
success(res) {
|
||||
location.lat = res.latitude;
|
||||
location.long = res.longitude;
|
||||
uni.setStorageSync('location', JSON.stringify(location))
|
||||
getStoreInfo(location).then(res => {
|
||||
STORE_INFO.id = res.data.id
|
||||
STORE_INFO.store_name = res.data.store_name
|
||||
getgoodClassList(0)
|
||||
getGoodList()
|
||||
getCartList();
|
||||
uni.setStorageSync('STORE_INFO', JSON.stringify(STORE_INFO))
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
})
|
||||
},
|
||||
fail(e) {
|
||||
userLocationfalse()
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
//取消定位获取默认门店
|
||||
const userLocationfalse = () => {
|
||||
LocationShow.value = false;
|
||||
uni.$u.toast('获取位置失败,为你展示默认门店')
|
||||
getStoreInfoFn()
|
||||
}
|
||||
let instance; // 获取组件实例
|
||||
const getWXDom = () => {
|
||||
let query = uni.createSelectorQuery().in(instance).select("#drag_area");
|
||||
|
|
|
@ -1,69 +1,9 @@
|
|||
<template>
|
||||
<view class="">
|
||||
<!-- <view class="m-card m-address"> -->
|
||||
<!-- <view class="address-info" @click="showAddress = true">
|
||||
<view class="top">
|
||||
<up-icon name="account"></up-icon>
|
||||
<view class="t-name">{{ addressInfo.real_name }}</view>
|
||||
<view>{{ addressInfo.phone }}</view>
|
||||
</view>
|
||||
<view class="bottom u-line-2">
|
||||
{{ addressInfo.detail }}
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <view class="address-info">
|
||||
<view class="top">
|
||||
{{ STORE_INFO.name }}是的
|
||||
</view>
|
||||
<view class="bottom u-line-2">
|
||||
{{ STORE_INFO.detailed_address }}
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <view class="address-btn item-center">
|
||||
<view class='ship-type' style="">
|
||||
<view class="ship-type-item" :class='{ actShipItem: orderInfo.shipping_type == 2 }'
|
||||
@click='orderInfo.shipping_type = 2'>
|
||||
自提
|
||||
</view>
|
||||
<view class="ship-type-item" @click='orderInfo.shipping_type = 1'
|
||||
:class='{ actShipItem: orderInfo.shipping_type == 1 }' v-if='orderInfo.default_delivery == 1'>
|
||||
配送
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="m-card good-info">
|
||||
<view class="head-title">商品明细</view>
|
||||
|
||||
<view class="m-card m-address" style="margin-top: 20rpx;">
|
||||
<view class="address-info"
|
||||
style='display: flex;justify-content: space-between;width: 690rpx;align-items: center;'>
|
||||
<view class="top" style="align-items: flex-start;">
|
||||
<view style="color: #333;width: 200rpx;">
|
||||
<view style="margin: 0 10rpx;color:#20B128;width: 150rpx;">推荐自提点</view>
|
||||
<view class="isreser"> {{reservation?"次日可提":"当日可提" }}
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view style="color: #333;">
|
||||
{{shop_Info.name}}
|
||||
</view>
|
||||
<view style="font-size: 24rpx;color: #333;margin: 10rpx 0;">
|
||||
{{shop_Info.detailed_address}}
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
<text>{{shop_Info.phone}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="padding: 20rpx;background-color:#20B128;color: white;border-radius: 40rpx;flex-shrink: 0;"
|
||||
@click="navgo(`/multipleShop/index/index?event=settle&cart_id=${cartStore.cartList.join(',')}`)">
|
||||
切换门店
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- </view> -->
|
||||
<view class="m-card m-good" v-for="(item, index) in cartList" :key="index">
|
||||
<view class="m-good" v-for="(item, index) in cartList" :key="index">
|
||||
<view class="image">
|
||||
<up-image width="160rpx" height="160rpx" :src="item.imgs"></up-image>
|
||||
</view>
|
||||
|
@ -84,6 +24,8 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="m-card good-info">
|
||||
<view class="head-title">价格明细</view>
|
||||
<view class="row">
|
||||
|
@ -118,6 +60,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<up-alert v-if="timeContent!=''" type = "error" :description = "timeContent"></up-alert>
|
||||
<up-notice-bar text= "门店切换已移动到首页,若切换店铺,购物车商品将跟随门店一起切换"></up-notice-bar>
|
||||
|
||||
</view>
|
||||
|
||||
|
@ -222,20 +165,6 @@
|
|||
<up-modal :show="showModal" title="您还没设置密码" :closeOnClickOverlay="true" zoom confirmText='去设置' showCancelButton
|
||||
@close='showModal=false' @cancel='showModal=false' @confirm="navgo('/pagesOrder/setPayPassword/index')"
|
||||
confirmColor='#27B52F' cancelText='取消'></up-modal>
|
||||
<up-popup :show="LocationShow" mode="bottom" @open="LocationShowOpen()">
|
||||
<view style="margin: 40rpx 10rpx;">
|
||||
<up-row customStyle="margin-bottom: 10px" gutter="10">
|
||||
<up-col span="6">
|
||||
<up-button text="取消" @click="userLocationfalse()"></up-button>
|
||||
</up-col>
|
||||
<up-col span="6">
|
||||
<up-button type="primary" text="设置授权" color="#20B128" @click="opensettings()"></up-button>
|
||||
</up-col>
|
||||
</up-row>
|
||||
|
||||
</view>
|
||||
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -274,6 +203,8 @@
|
|||
let STORE_INFO = uni.getStorageSync('STORE_INFO');
|
||||
if (STORE_INFO) {
|
||||
shop_Info.value = JSON.parse(STORE_INFO)
|
||||
}else{
|
||||
uni.$u.toast('获取门店信息失败,请在首页选择门店')
|
||||
}
|
||||
|
||||
const cartStore = useCartStore();
|
||||
|
@ -439,24 +370,6 @@
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
uni.$on('settle', function(data) {
|
||||
let datas = JSON.parse(data)
|
||||
shop_Info.value = datas
|
||||
console.log(datas)
|
||||
checkInventoryApi({
|
||||
cart_id: cartStore.cartList,
|
||||
store_id: datas.id
|
||||
}).then(res => {
|
||||
reservation.value = res.data.reservation
|
||||
})
|
||||
checkOrder(datas.id)
|
||||
// formData.store_id = datas.id
|
||||
// formData.store_name = datas.name
|
||||
})
|
||||
|
||||
|
||||
|
||||
// const checkOrderA
|
||||
const pay_type = ref('7');
|
||||
|
||||
|
@ -574,95 +487,10 @@
|
|||
}
|
||||
|
||||
onLoad(options => {
|
||||
// if (uni.getStorageSync('location')) {
|
||||
// try {
|
||||
// location = JSON.parse(uni.getStorageSync('location'))
|
||||
// checkOrder();
|
||||
// } catch (e) {
|
||||
// getLocation()
|
||||
// }
|
||||
// } else {
|
||||
getLocation()
|
||||
// }
|
||||
})
|
||||
|
||||
const getLocation = () => {
|
||||
// #ifdef H5
|
||||
userLocationfalse()
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.getSetting({
|
||||
success(res) {
|
||||
if (res.authSetting["scope.userLocation"] == false) {
|
||||
LocationShowOpen()
|
||||
} else {
|
||||
opensettings(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
|
||||
}
|
||||
const LocationShowOpen = () => {
|
||||
LocationShow.value = true;
|
||||
}
|
||||
const userLocationfalse = () => {
|
||||
LocationShow.value = false;
|
||||
uni.$u.toast('获取位置当前失败,为你推荐当前门店')
|
||||
checkOrder(shop_Info.value.id);
|
||||
}
|
||||
const opensettings = (a = false) => {
|
||||
if (a == false) {
|
||||
uni.openSetting({
|
||||
success(res) {
|
||||
LocationShow.value = false;
|
||||
if (res.authSetting["scope.userLocation"] == true) {
|
||||
uni.authorize({
|
||||
scope: 'scope.userLocation',
|
||||
success() {
|
||||
uni.getLocation({
|
||||
type: "gcj02",
|
||||
success(res) {
|
||||
location.lat = res.latitude;
|
||||
location.long = res.longitude;
|
||||
uni.setStorageSync('location', JSON.stringify(
|
||||
location))
|
||||
checkOrder();
|
||||
},
|
||||
})
|
||||
},
|
||||
fail(e) {
|
||||
userLocationfalse()
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
fail(e) {
|
||||
userLocationfalse()
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.authorize({
|
||||
scope: 'scope.userLocation',
|
||||
success() {
|
||||
uni.getLocation({
|
||||
type: "gcj02",
|
||||
success(res) {
|
||||
location.lat = res.latitude;
|
||||
location.long = res.longitude;
|
||||
uni.setStorageSync('location', JSON.stringify(location))
|
||||
checkOrder();
|
||||
},
|
||||
})
|
||||
},
|
||||
fail(e) {
|
||||
userLocationfalse()
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
onShow(() => {
|
||||
getAddressList();
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue