diff --git a/config/app.js b/config/app.js
index 5657b7c..f1f7802 100644
--- a/config/app.js
+++ b/config/app.js
@@ -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':
diff --git a/pages/cart/cart.vue b/pages/cart/cart.vue
index 7c8e85f..b12151d 100644
--- a/pages/cart/cart.vue
+++ b/pages/cart/cart.vue
@@ -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;
diff --git a/pages/index/index.vue b/pages/index/index.vue
index e766778..dcc439a 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -23,21 +23,16 @@
-
{{shareInfo.real_name}}
{{
+ style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
+ @click="navgo('/multipleShop/index/index?event=store_info')">{{
STORE_INFO.store_name }}
-
+
@@ -258,6 +253,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -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"
})
- } else {
- getCartList();
}
});
}
+
});
+ //获取定位
+ 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");
diff --git a/pagesOrder/settle/settle.vue b/pagesOrder/settle/settle.vue
index ed3e262..1e2ba70 100644
--- a/pagesOrder/settle/settle.vue
+++ b/pagesOrder/settle/settle.vue
@@ -1,87 +1,29 @@
-
-
-
-
-
-
-
-
-
-
- 推荐自提点
- {{reservation?"次日可提":"当日可提" }}
-
-
+
-
- {{shop_Info.name}}
+
+ {{ item.name }}
+ ¥{{ item.price }}
-
- {{shop_Info.detailed_address}}
-
-
-
- {{shop_Info.phone}}
-
+
+ {{ item.unit_name }}
+ x{{ item.cart_num }}
+
+ {{ orderInfo.delivery_msg }}
+
-
- 切换门店
-
-
-
-
-
-
-
-
-
-
- {{ item.name }}
- ¥{{ item.price }}
-
-
- {{ item.unit_name }}
- x{{ item.cart_num }}
-
-
-
- {{ orderInfo.delivery_msg }}
-
-
@@ -118,6 +60,7 @@
+
@@ -222,20 +165,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -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()
- // }
+ checkOrder(shop_Info.value.id);
+
})
- 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();
})