From d5306c224a91b37869d2b96ba03d5a7152bd11e2 Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期一, 23 十二月 2024 21:20:26 +0800
Subject: [PATCH] feat(支持线上订单支付 ):
---
pay/scanpay.vue | 78 ++++++++++++++++++++++++++++++++++----
1 files changed, 69 insertions(+), 9 deletions(-)
diff --git a/pay/scanpay.vue b/pay/scanpay.vue
index bcffe02..afecb67 100644
--- a/pay/scanpay.vue
+++ b/pay/scanpay.vue
@@ -66,7 +66,6 @@
{{ $utils.accMul(couponInfo.discount, 10) }}鎶樺埜
</view>
</block>
-
<view v-else class="u-font-28 lh-1 u-tips-color">璇烽�夋嫨</view>
<u-icon class="u-m-l-10" name="arrow-right" color="#999" size="16"></u-icon>
</view>
@@ -159,6 +158,7 @@
import {
queryShopByCid,
queryShopByShopId,
+ getOnlineId,
userLogin,
queryUseSweepPayCoupon,
getWechatConfigInfo,
@@ -178,12 +178,12 @@
buyerNote: '',
showRemark: false,
UNIONID: null,
- payWay: this.$utils.getPlat(), //2 缁翠俊 5鏀粯瀹� 15浜戦棯浠�
+ payWay: this.$utils.getPlat(), //2 寰俊 5鏀粯瀹� 15浜戦棯浠�
cid: '', //鐮佺墝id C鎵獴闈欐�佺爜鏃舵湁
activityQrcodeId: '', //鍔ㄦ�佹敹娆剧爜 C鎵獴鍔ㄦ�佺爜鏃舵湁
shopId: '', //鍟嗘埛id C鎵獴鍔ㄦ�佺爜鏃舵湁
bordShow: false, // 鏄剧ず閿洏
- orderId: '',
+ orderId: '', //鍐�浼橀偖绾夸笂璁㈠崟id
shopInfo: {
cusid: '',
shopName: '',
@@ -248,6 +248,7 @@
onLoad(opt) {
uni.setStorageSync('CID', opt.cid)
uni.setStorageSync('SHOPID', opt.shopId)
+ uni.setStorageSync('ORDERID', opt.orderId)
uni.setStorageSync('SMONEY', opt.smoney)
uni.setStorageSync('AQCI', opt.activityQrcodeId)
this.UNIONID = uni.getStorageSync('UNIONID') || null
@@ -258,9 +259,12 @@
} else {
this.bordShow = true
}
+ if (opt.orderId) {
+ this.orderId = opt.orderId
+ this.init()
+ }
if (opt.activityQrcodeId) {
this.activityQrcodeId = opt.activityQrcodeId
- // this.getOrderInfo()
}
if (opt.shopId) {
this.shopId = opt.shopId
@@ -399,6 +403,12 @@
shopId: this.shopId
}
}
+ if (this.orderId) {
+ api = getOnlineId
+ params = {
+ onlineId: this.orderId
+ }
+ }
//鑾峰彇鍟嗛摵淇℃伅
api({
params
@@ -409,6 +419,17 @@
res.logoImage = config.baseURL + res.logoImage
}
this.shopInfo = res
+ if(this.orderId){
+ this.money = res.totaPrice
+ if(res.couponId){
+ this.couponInfo = {
+ id: res.couponId,
+ thresholdValue: res.thresholdValue,
+ discount: res.discount,
+ discountType: res.discountType,
+ }
+ }
+ }
}).catch((err) => {
clearTimeout(timer)
this.shopInfo.scanFlag = 0
@@ -433,11 +454,39 @@
wx.ready( ()=> {
wx.hideAllNonBaseMenuItem();
if(CHECK_LOCATION){
- this.wxGetLocation()
+ this.wxGetLocation(null)
}
})
})
}
+ if(this.payWay == 5){
+ ap.hideOptionButton();
+ this.apGetLocation(null)
+ }
+ },
+ apGetLocation(callback){
+ ap.getLocation((res)=> {
+ console.log('apGetLocation',res)
+ if(res.latitude){
+ this.lat = parseFloat(res.latitude).toFixed(6); // 绾害锛屾诞鐐规暟锛岃寖鍥翠负90 ~ -90
+ this.lng = parseFloat(res.longitude).toFixed(6); // 缁忓害锛屾诞鐐规暟锛岃寖鍥翠负180 ~ -180銆�
+ if(callback) callback()
+ }else{
+ uni.showModal({
+ title: '鎻愮ず',
+ content: "鑾峰彇鍦扮悊浣嶇疆澶辫触锛屾棤娉曡繘琛屾敮浠橈紒",
+ confirmText: '閲嶆柊鎺堟潈',
+ cancelText: '閫�鍑�',
+ success: ret=>{
+ if(ret.confirm){
+ this.apGetLocation(callback)
+ }else{
+ this.clickDone()
+ }
+ }
+ })
+ }
+ })
},
wxGetLocation(callback){
wx.getLocation({
@@ -455,19 +504,21 @@
cancelText: '閫�鍑�',
success: ret=>{
if(ret.confirm){
- this.wxGetLocation()
+ this.wxGetLocation(callback)
}else{
this.clickDone()
}
}
})
}
-
}
});
},
// 鑾峰彇浼氬憳鐩稿叧淇℃伅
showCoupon() {
+ if(this.orderId){
+ return
+ }
if (this.UNIONID||this.payWay==5) {
if (uni.$u.test.isEmpty(this.money)) {
uni.$u.toast('璇疯緭鍏ラ噾棰濓紒')
@@ -482,6 +533,7 @@
},
//鑾峰彇鐢ㄦ埛浼樻儬鍒�
queryUseSweepPayCoupon() {
+ //2 寰俊 5鏀粯瀹� 15浜戦棯浠�
const applyPayWayStr = {
2: 1,
5: 2,
@@ -528,7 +580,12 @@
return
}
if(!this.lat){
- this.wxGetLocation(this.pay)
+ if(this.payWay == 2){
+ this.wxGetLocation(this.pay)
+ }
+ if(this.payWay == 5){
+ this.apGetLocation(this.pay)
+ }
}else{
this.pay()
}
@@ -542,7 +599,7 @@
this.bordShow = false
// 閲戦 this.money
uni.showLoading()
- const params = {
+ let params = {
money: this.$utils.accMul(this.money,100),
shopId: this.shopInfo.id,
payWay: this.payWay,
@@ -558,6 +615,9 @@
if (this.cid) {
params.cid = this.cid
}
+ if (this.orderId) {
+ params = {onlineId: this.onlineId}
+ }
//鐢熸垚璁㈠崟
saveOrder(params).then(res => {
uni.hideLoading()
--
Gitblit v1.9.1