|
|
|
@ -11,7 +11,7 @@ |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view>{{ siteInfo.address }}</view> |
|
|
|
|
<view>距您{{ siteInfo.juli }}km</view> |
|
|
|
|
<view>距您{{ siteInfo.juli | distanceFilter }}km</view> |
|
|
|
|
<view class="nav" @click="openMap"> |
|
|
|
|
<image src="../static/details/nav.png" mode="" /> |
|
|
|
|
<view>导航</view> |
|
|
|
@ -27,8 +27,8 @@ |
|
|
|
|
>/L |
|
|
|
|
</view> |
|
|
|
|
<view> |
|
|
|
|
<view>油站价 ¥{{ params.oilSitePrice }}/L</view> |
|
|
|
|
<view>指导价 ¥{{ params.marketPrice }}/L</view> |
|
|
|
|
<view>油站价 ¥{{ params.oilSitePrice || "--" }}/L</view> |
|
|
|
|
<view>指导价 ¥{{ params.marketPrice || "--" }}/L</view> |
|
|
|
|
</view> |
|
|
|
|
<view |
|
|
|
|
>享油站价<text>直降¥{{ priceDiff }}/L</text></view |
|
|
|
@ -54,7 +54,7 @@ |
|
|
|
|
<text>¥</text> |
|
|
|
|
<input |
|
|
|
|
v-model="params.sitePriceAmount" |
|
|
|
|
type="numeric" |
|
|
|
|
type="number" |
|
|
|
|
maxlength="4" |
|
|
|
|
placeholder="输入金额,实时计算优惠" |
|
|
|
|
placeholder-class="placeholder-class" |
|
|
|
@ -170,11 +170,25 @@ export default { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.getById(JSON.parse(siteInfo)); |
|
|
|
|
this.hasLocationAuthHandle(() => { |
|
|
|
|
this.$utils.obtainLocationHandle(appInstance).then(() => { |
|
|
|
|
this.getById(JSON.parse(siteInfo)); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
filters: { |
|
|
|
|
preferential(discountAmount, serviceCharge) { |
|
|
|
|
if (!discountAmount) return "0.00"; |
|
|
|
|
return (discountAmount * 10000 - serviceCharge * 10000) / 10000; |
|
|
|
|
return ( |
|
|
|
|
(discountAmount * 100000 - serviceCharge * 100000) / |
|
|
|
|
100000 |
|
|
|
|
).toFixed(2); |
|
|
|
|
}, |
|
|
|
|
distanceFilter(value) { |
|
|
|
|
if (value) { |
|
|
|
|
return (value / 1000).toFixed(2); |
|
|
|
|
} |
|
|
|
|
return "0.00"; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
@ -183,14 +197,43 @@ export default { |
|
|
|
|
if (oilSitePrice && sitePrice) { |
|
|
|
|
return (oilSitePrice - sitePrice).toFixed(2); |
|
|
|
|
} |
|
|
|
|
return "0.00"; |
|
|
|
|
return "--"; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
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() { |
|
|
|
|
let isHas = this.hasLocationAuthHandle(() => { |
|
|
|
|
this.getById(this.siteInfo); |
|
|
|
|
}); |
|
|
|
|
if (!isHas) return; |
|
|
|
|
if (!this.beyondDistance()) return; |
|
|
|
|
if (!this.checkParams()) return; |
|
|
|
|
serve |
|
|
|
|
.createCOrder({ |
|
|
|
@ -208,6 +251,24 @@ export default { |
|
|
|
|
this.wxPay(res.data); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
beyondDistance() { |
|
|
|
|
let { juli, siteName } = this.siteInfo; |
|
|
|
|
if (juli > 10000) { |
|
|
|
|
uni.showModal({ |
|
|
|
|
title: siteName, |
|
|
|
|
content: "您与加油站距离较远,请到达加油站与加油员确认金额后付款", |
|
|
|
|
confirmText: "导航到站", |
|
|
|
|
cancelText: "我知道了", |
|
|
|
|
success: (res) => { |
|
|
|
|
if (res.confirm) { |
|
|
|
|
this.openMap(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
}, |
|
|
|
|
checkParams() { |
|
|
|
|
if (!this.params.oilsBar) { |
|
|
|
|
uni.showToast({ |
|
|
|
@ -297,10 +358,12 @@ export default { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
getById(siteInfo) { |
|
|
|
|
const appInstance = getApp(); |
|
|
|
|
let { latitude, longitude } = appInstance.globalData.location; |
|
|
|
|
let params = { |
|
|
|
|
id: siteInfo.siteId, |
|
|
|
|
latitude: siteInfo.latitude, |
|
|
|
|
longitude: siteInfo.longitude, |
|
|
|
|
id: siteInfo.siteId || siteInfo.id, |
|
|
|
|
latitude: latitude, |
|
|
|
|
longitude: longitude, |
|
|
|
|
}; |
|
|
|
|
serve.getById(params).then((res) => { |
|
|
|
|
if (res.code !== 20000) return; |
|
|
|
@ -585,7 +648,7 @@ export default { |
|
|
|
|
// line-height: 100rpx; |
|
|
|
|
} |
|
|
|
|
> view { |
|
|
|
|
width: 170rpx; |
|
|
|
|
width: 200rpx; |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
color: #999; |
|
|
|
|
} |
|
|
|
|