develop
xiaozhiyong 10 months ago
parent d3c8010b61
commit 4fd0b3eed1
  1. 2
      src/App.vue
  2. 2
      src/manifest.json
  3. 84
      src/subPackages/site/details/index.vue

@ -6,7 +6,7 @@ export default {
latitude: 39.5426,
longitude: 116.23292,
},
appId: "wxed3e2914d6aa4d52",
appId: "wx9995c9f495efa82e",
hasLocationAuth: true,
},
onLaunch: function () {

@ -57,7 +57,7 @@
/* */
},
"mp-weixin": {
/* */ "appid": "wxed3e2914d6aa4d52",
/* */ "appid": "wx9995c9f495efa82e",
"setting": {
"urlCheck": false
},

@ -201,39 +201,16 @@ export default {
},
},
methods: {
hasLocationAuthHandle(callback = () => {}) {
const appInstance = getApp();
let { hasLocationAuth } = appInstance.globalData;
if (!hasLocationAuth) {
uni.showModal({
title: "未打开小程序定位",
content: "需获取您的地理位置才可以继续加油",
confirmText: "开启定位",
success: (res) => {
if (res.confirm) {
uni.openSetting({
success: (res) => {
if (res.authSetting["scope.userLocation"]) {
callback();
}
},
});
}
},
});
return false;
}
return true;
},
serviceIllustrate() {
this.$refs.popupIllustrate.open("bottom");
},
createCOrder() {
async createCOrder() {
let isHas = this.hasLocationAuthHandle(() => {
this.getById(this.siteInfo);
});
if (!isHas) return;
if (!this.beyondDistance()) return;
let isBeyond = await this.beyondDistance();
if (!isBeyond) return;
if (!this.checkParams()) return;
serve
.createCOrder({
@ -251,17 +228,24 @@ export default {
this.wxPay(res.data);
});
},
beyondDistance() {
let { juli, siteName } = this.siteInfo;
if (juli > 10000) {
//
hasLocationAuthHandle(callback = () => {}) {
const appInstance = getApp();
let { hasLocationAuth } = appInstance.globalData;
if (!hasLocationAuth) {
uni.showModal({
title: siteName,
content: "您与加油站距离较远,请到达加油站与加油员确认金额后付款",
confirmText: "导航到站",
cancelText: "我知道了",
title: "未打开小程序定位",
content: "需获取您的地理位置才可以继续加油",
confirmText: "开启定位",
success: (res) => {
if (res.confirm) {
this.openMap();
uni.openSetting({
success: (res) => {
if (res.authSetting["scope.userLocation"]) {
callback();
}
},
});
}
},
});
@ -269,6 +253,36 @@ export default {
}
return true;
},
//
async beyondDistance() {
let { juli, siteName, siteId, id } = this.siteInfo;
if (juli > 10000) {
let firstRes = await this.$utils.obtainLocationHandle();
let { latitude, longitude } = firstRes;
let secondRes = await serve.getById({
id: siteId || id,
latitude,
longitude,
});
if (secondRes.code !== 20000) return false;
if (secondRes.data.juli > 10000) {
uni.showModal({
title: siteName,
content: "您与加油站距离较远,请到达加油站与加油员确认金额后付款",
confirmText: "导航到站",
cancelText: "我知道了",
success: (res) => {
if (res.confirm) {
this.openMap();
}
},
});
return false;
}
return true;
}
return true;
},
checkParams() {
if (!this.params.oilsBar) {
uni.showToast({
@ -385,7 +399,7 @@ export default {
marketPrice: item.marketPrice,
sitePriceId: item.priceId,
});
// item.oilsBars['','',''] [{},{},{}]
// item.oilsBars['','',''] [{},{},{}]
spear[item.oilProductCode] = item.oilsBars.reduce((prev, item) => {
prev.push({
label: item,

Loading…
Cancel
Save