|
@@ -175,9 +175,6 @@
|
|
|
<script>
|
|
|
import { queryStoreDetail,queryCalPrice,queryNewOrder,queryOrderPromotionList } from '@/api/refuel.js';
|
|
|
import {debounce} from '@/utils/tool.js'
|
|
|
- // 腾讯地图
|
|
|
- var QQMapWX = require('@/libs/qqmap-wx-jssdk.min.js');
|
|
|
- var qqmapsdk = new QQMapWX({key:'KX5BZ-B64RC-RO62W-AMWAZ-VVTC3-YAFXF'});
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -465,10 +462,12 @@
|
|
|
},
|
|
|
getDistance(){
|
|
|
let location = JSON.parse(uni.getStorageSync('location'))
|
|
|
- qqmapsdk.calculateDistance({from:{latitude:location.latitude,longitude:location.longitude},to:[{latitude:this.info.location[1],longitude:this.info.location[0]}],success:(res)=>{
|
|
|
- console.log(res);
|
|
|
- this.distance = res.result.elements[0].distance
|
|
|
- }})
|
|
|
+ this.distance =this.getFlatternDistance(location.latitude,location.longitude,this.info.lat,this.info.lon)
|
|
|
+ //驾车距离
|
|
|
+ // qqmapsdk.calculateDistance({from:{latitude:location.latitude,longitude:location.longitude},to:[{latitude:this.info.location[1],longitude:this.info.location[0]}],success:(res)=>{
|
|
|
+ // console.log(res);
|
|
|
+ // this.distance = res.result.elements[0].distance
|
|
|
+ // }})
|
|
|
|
|
|
},
|
|
|
getRad(d) {
|
|
@@ -488,61 +487,80 @@
|
|
|
return s
|
|
|
},
|
|
|
handlePay(){
|
|
|
- let that = this
|
|
|
- let location = JSON.parse(uni.getStorageSync('location'))
|
|
|
- console.log('不能超过(米):',this.amount*1000,'距离加油站(米):',this.getFlatternDistance(location.latitude,location.longitude,this.info.lat,this.info.lon))
|
|
|
- // if(this.getFlatternDistance(location.latitude,location.longitude,this.info.lat,this.info.lon)>100000000){
|
|
|
- if(this.getFlatternDistance(location.latitude,location.longitude,this.info.lat,this.info.lon)>1000){
|
|
|
- return uni.showModal({
|
|
|
- title:'提示',
|
|
|
- content:'您当前距离加油站较远,请到达加油站后与加油员确定信息',
|
|
|
- confirmText:'刷新位置',
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- uni.showLoading({
|
|
|
- title:'刷新中'
|
|
|
- })
|
|
|
- uni.getLocation({
|
|
|
- type: 'gcj02',
|
|
|
- success: (res) => {
|
|
|
- // 存储经纬度
|
|
|
- uni.setStorageSync('location',JSON.stringify({latitude:res.latitude,longitude:res.longitude}))
|
|
|
- uni.hideLoading()
|
|
|
- that.getDistance()
|
|
|
- }
|
|
|
+
|
|
|
+ if(JSON.parse(uni.getStorageSync('userInfo')).setMealCode != 0){
|
|
|
+ let that = this
|
|
|
+ let location = JSON.parse(uni.getStorageSync('location'))
|
|
|
+
|
|
|
+ // if(this.getFlatternDistance(location.latitude,location.longitude,this.info.lat,this.info.lon)>100000000){
|
|
|
+ if(this.getFlatternDistance(location.latitude,location.longitude,this.info.lat,this.info.lon)>1000){
|
|
|
+ return uni.showModal({
|
|
|
+ title:'提示',
|
|
|
+ content:'您当前距离加油站较远,请到达加油站后与加油员确定信息',
|
|
|
+ confirmText:'刷新位置',
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.showLoading({
|
|
|
+ title:'刷新中'
|
|
|
+ })
|
|
|
+ uni.getLocation({
|
|
|
+ type: 'gcj02',
|
|
|
+ success: (res) => {
|
|
|
+ // 存储经纬度
|
|
|
+ uni.setStorageSync('location',JSON.stringify({latitude:res.latitude,longitude:res.longitude}))
|
|
|
+ uni.hideLoading()
|
|
|
+ that.getDistance()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.loading = true
|
|
|
+ let query = {
|
|
|
+ "channel":'ZhongShu',
|
|
|
+ "epId": this.epId,
|
|
|
+ "itemName":this.num,
|
|
|
+ "gunNo": this.gun,
|
|
|
+ "itemId": this.itemId,
|
|
|
+ "litre": this.payInfo.litre,
|
|
|
+ "openExtra": "",
|
|
|
+ "originalAmount": this.payInfo.totalPrice,
|
|
|
+ "outNewUserFlag": "",
|
|
|
+ "paymentAmount": this.payInfo.realPrice,
|
|
|
+ "promotionInfo": this.query.allowanceinfo,
|
|
|
+ "serviceFee": this.payInfo.serviceFee,
|
|
|
+ "storeId":this.storeId,
|
|
|
+ "storePrice": this.price.storePrice,
|
|
|
+ "vipPrice": this.price.vipPrice
|
|
|
+ }
|
|
|
+ queryNewOrder(query).then(res=>{
|
|
|
+ this.loading = false
|
|
|
+ if(res.state == 'Success'){
|
|
|
+ uni.navigateToMiniProgram({
|
|
|
+ appId:"wx0d252f6ed9755862", // 滴滴加油小程序appId
|
|
|
+ path: `packageA/pages/open-energy-pay/index?orderId=${res.content.xjOrderId}&tradeId=${res.content.tradeId}`, // 滴滴加油收银台页面地址,需要拼接orderId和tradeId
|
|
|
+ envVersion: 'release' // 固定release
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }else{
|
|
|
+ uni.showModal({
|
|
|
+ title:'此商品需要开通会员才能购买',
|
|
|
+ cancelText:'下次再说',
|
|
|
+ confirmText:'立即开通',
|
|
|
+ success(res) {
|
|
|
+ if(res.confirm){
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'/my/memberCenter/index'
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- this.loading = true
|
|
|
- let query = {
|
|
|
- "channel":'ZhongShu',
|
|
|
- "epId": this.epId,
|
|
|
- "itemName":this.num,
|
|
|
- "gunNo": this.gun,
|
|
|
- "itemId": this.itemId,
|
|
|
- "litre": this.payInfo.litre,
|
|
|
- "openExtra": "",
|
|
|
- "originalAmount": this.payInfo.totalPrice,
|
|
|
- "outNewUserFlag": "",
|
|
|
- "paymentAmount": this.payInfo.realPrice,
|
|
|
- "promotionInfo": this.query.allowanceinfo,
|
|
|
- "serviceFee": this.payInfo.serviceFee,
|
|
|
- "storeId":this.storeId,
|
|
|
- "storePrice": this.price.storePrice,
|
|
|
- "vipPrice": this.price.vipPrice
|
|
|
- }
|
|
|
- queryNewOrder(query).then(res=>{
|
|
|
- this.loading = false
|
|
|
- if(res.state == 'Success'){
|
|
|
- uni.navigateToMiniProgram({
|
|
|
- appId:"wx0d252f6ed9755862", // 滴滴加油小程序appId
|
|
|
- path: `packageA/pages/open-energy-pay/index?orderId=${res.content.xjOrderId}&tradeId=${res.content.tradeId}`, // 滴滴加油收银台页面地址,需要拼接orderId和tradeId
|
|
|
- envVersion: 'release' // 固定release
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
onReady() {
|