From 8771da2ccf6f7c3fd2a8c89a1a0e230c6386db7f Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期一, 17 十一月 2025 15:40:48 +0800
Subject: [PATCH] feat(api): 新增多个API接口并优化配置
---
pages/pay/scanpay.vue | 105 ++++++++++++++++++++++++++++++++++------------------
1 files changed, 68 insertions(+), 37 deletions(-)
diff --git a/pages/pay/scanpay.vue b/pages/pay/scanpay.vue
index e4d5af6..e0bf538 100644
--- a/pages/pay/scanpay.vue
+++ b/pages/pay/scanpay.vue
@@ -1,10 +1,11 @@
<!-- 鎵爜鏀粯 -->
<template>
<view class="page">
+ <u-alert type="warning" closable description="瀹夊叏鎻愰啋锛氳璋ㄦ厧鏍稿鍟嗗銆佽鍗曚俊鎭紝淇濇姢鑷繁璧勯噾瀹夊叏!"></u-alert>
<view class="shop u-flex u-row-between">
<view class="u-m-r-30">
<view class="u-font-28 color-666 u-m-b-10">浠樻缁�</view>
- <view class="u-font-34 font-bold color-333">{{ shopInfo.shop_name }}</view>
+ <view class="u-font-44 font-bold color-333">{{ shopInfo.shop_name }}</view>
</view>
<image :src="shopInfo.logo_image||'/static/imgs/store-logo.png'" class="avg-img"></image>
</view>
@@ -22,6 +23,24 @@
</view>
<view class="u-font-28 color-666 u-m-t-60">閫夋嫨鏀粯鏂瑰紡</view>
<u-radio-group v-model="payWay" placement="column">
+ <view v-if="platform == 15" class="u-border-bottom u-p-v-20 u-flex u-row-between">
+ <image src="@/static/imgs/pay-union.png" class="pay-icon"></image>
+ <view class="flex-1">
+ <view class="u-font-30 color-333">浜戦棯浠�</view>
+ <text v-if="isNew" class="tag u-m-t-10">浼氬憳浜紭鎯�</text>
+ <text v-if="!isNew&&token&&shopInfo.use_score_flag&&shopInfo.app_pay_use_score_flag" class="u-font-24 color-999 u-m-t-10">
+ 鍙敤
+ <text class="color-red">{{ integral }}</text>
+ 绉垎
+ </text>
+ </view>
+ <view v-if="token&&couponInfo&&shopInfo.user_coupon_flag&&shopInfo.app_pay_use_coupon_flag" class="tag-pain">
+ 婊{
+ parseFloat((couponInfo.thresholdValue / 100).toFixed(2))
+ }}鍏冨噺{{ parseFloat((couponInfo.discount / 100).toFixed(2)) }}鍏�
+ </view>
+ <u-radio @change="radioChange($event,15)" :name="15" activeColor="#D41F28" :customStyle="{ marginLeft: '10rpx' }"></u-radio>
+ </view>
<view v-if="platform == 5" class="u-border-bottom u-p-v-20 u-flex u-row-between">
<image src="@/static/imgs/pay-zfb.png" class="pay-icon"></image>
<view class="flex-1">
@@ -59,9 +78,9 @@
<u-radio @change="radioChange($event,2)" :name="2" activeColor="#D41F28" :customStyle="{ marginLeft: '10rpx' }">
</u-radio>
</view>
- <!-- <navigator v-if="shuaka&&token&&bankCard!=-1" class="shuka" url="/pages/pay/shuaKa/shuaKa">
+ <navigator v-if="shuaka&&token&&bankCard!=-1" class="shuka" url="/pages/pay/shuaKa/shuaKa">
<image src="/static/shuaka/shuaka.png" mode=""></image>
- </navigator> -->
+ </navigator>
<view v-if="bankCard.id" class="u-border-bottom u-p-v-20 u-flex">
<view @click="bordShow=false;bankCardOpen=true" class="flex-1 u-flex">
<image :src="bankCardStyle.logo" class="pay-icon"></image>
@@ -84,11 +103,11 @@
parseFloat((couponInfo.thresholdValue / 100).toFixed(2))
}}鍏冨噺{{ parseFloat((couponInfo.discount / 100).toFixed(2)) }}鍏�
</view>
- <u-radio @change="radioChange($event,3, bankCard.id)" :name="3" activeColor="#D41F28" :customStyle="{ marginLeft: '10rpx' }">
+ <u-radio @change="radioChange($event,3)" :name="bankCard.id" activeColor="#D41F28" :customStyle="{ marginLeft: '10rpx' }">
</u-radio>
</view>
</u-radio-group>
- <!-- <navigator v-if="bankCard==-1&&bindCard&&token&&!isNew" class="shuka" url="/pages/pay/bindCard/bindCard">
+ <navigator v-if="bankCard==-1&&bindCard&&token&&!isNew" class="shuka" url="/pages/pay/bindCard/bindCard">
<image src="/static/bangka.png" mode=""></image>
</navigator>
<navigator v-if="bankCard==-1&&!isNew" url="/pages/pay/bindCard/bindCard" class="u-border-bottom u-p-v-20 u-flex u-row-between">
@@ -101,7 +120,7 @@
</view>
<u-radio disabled activeColor="#D41F28" :customStyle="{ marginLeft: '30rpx' }">
</u-radio>
- </navigator> -->
+ </navigator>
<navigator v-if="isNew" class="reg-btn" :url="'/pages/pay/register?cid='+cid">
<image src="/static/register-btn.png" mode=""></image>
</navigator>
@@ -179,7 +198,6 @@
import {
activityInfo
} from '@/common/api/shuaka'
-
export default {
data() {
return {
@@ -201,7 +219,7 @@
money: '', // 閲戦
integral: 0, // 浣跨敤绉垎
couponInfo: null, // 浼樻儬鍒稿唴瀹�
- payWay: 3, //鏀粯鏂瑰紡 5 鏀粯瀹� 2 寰俊 3閾惰鍗�
+ payWay: 3, //鏀粯鏂瑰紡 5 鏀粯瀹� 2 寰俊 3閾惰鍗� 15浜戦棯浠�
token: null,
isNew: false, // 鏄惁鏂扮敤鎴凤紝鏂扮敤鎴锋煡璇笉鍒扮Н鍒嗗拰閾惰鍗�
codeShow: false, // 閾惰鍗℃敮浠橀獙璇佺爜杈撳叆寮圭獥
@@ -236,10 +254,13 @@
uni.setStorageSync('CID', opt.cid)
this.init()
}
- if (opt.code || opt.auth_code) {
+ if (opt.code || opt.auth_code || opt.userAuthCode) {
let code = opt.code
if (this.platform == 5) {
code = opt.auth_code
+ }
+ if (this.platform == 15) {
+ code = opt.userAuthCode
}
this.end++
userLogin({
@@ -252,6 +273,7 @@
}).catch(() => {
uni.hideLoading()
})
+
} else {
if (process.env.NODE_ENV === 'development') {
console.log('寮�鍙戠幆澧�');
@@ -289,20 +311,17 @@
if (this.count >= this.end) {
uni.hideLoading()
}
- this.token = res.token
- uni.setStorageSync(ACCESSTOKEN, res.token)
+ this.token = res.token.accessToken
+ uni.setStorageSync(ACCESSTOKEN, res.token.accessToken)
uni.setStorageSync('IS_NEW', res.isNew)
this.isNew = res.isNew
if (!res.isNew) {
this.getUserInfo()
}
},
- radioChange(e, item, bankCardId) {
+ radioChange(e, item) {
this.bordShow = false
this.payWay = item
- if (bankCardId) {
- this.bankCardId = bankCardId
- }
},
// 鏇存柊閲戦
changeMoney(str) {
@@ -313,7 +332,7 @@
this.bordShow = true;
},
init() {
- this.end += 1
+ this.end += 5
//鑾峰彇鍟嗛摵淇℃伅
queryShop({
params: {
@@ -333,14 +352,11 @@
res.logo_image = ''
}
}
+ uni.setStorageSync('SHOP_INFO', res)
this.shopInfo = res
}).catch(() => {
uni.hideLoading()
})
- },
- //鏌ヨ钀ラ攢淇℃伅
- getMarketing(){
- this.end += 4
// 鍒峰崱鏈夌ぜ
activityInfo().then(res => {
this.count++
@@ -415,10 +431,11 @@
uni.hideLoading()
})
}
+
},
// 鑾峰彇浼氬憳鐩稿叧淇℃伅
getUserInfo() {
- this.end += 2
+ this.end += 4
queryMyDiscount({
shopId: this.shopInfo.id
@@ -436,7 +453,7 @@
uni.hideLoading()
}
})
- /* //鑾峰彇鐢ㄦ埛閾惰鍗�
+ //鑾峰彇鐢ㄦ埛閾惰鍗�
myBankCard().then(res => {
this.count++
if (this.count >= this.end) {
@@ -469,7 +486,7 @@
if (this.count >= this.end) {
uni.hideLoading()
}
- }) */
+ })
//鑾峰彇鐢ㄦ埛浼樻儬鍒�
queryMyUseSweepPayMaxCoupon({
params: {
@@ -500,26 +517,25 @@
},
//璺宠浆钀ラ攢椤甸潰
toDiscount() {
- const shopInfo = encodeURIComponent(JSON.stringify(this.shopInfo))
if (!this.isNew) { //鏄細鍛�
if (this.integral > 0 || this.couponInfo) { //鏈変紭鎯犲埜鎴栫Н鍒�
if (this.payWay == 3 && (this.shopInfo.bank_pay_use_score_flag || this.shopInfo
.bank_pay_use_coupon_flag)) { //閾惰鍗℃敮浠�
uni.navigateTo({
- url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
+ url: `/pages/pay/discountpay?integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
})
return false
} else if ((this.shopInfo.use_score_flag && this.shopInfo.app_pay_use_score_flag) || (this
.shopInfo
.user_coupon_flag && this.shopInfo.app_pay_use_coupon_flag)) {
uni.navigateTo({
- url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
+ url: `/pages/pay/discountpay?integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
})
return false
} else if (this.discount.shopDiscount != 1) {
uni.navigateTo({
- url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
+ url: `/pages/pay/discountpay?integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
})
return false
} else {
@@ -527,7 +543,7 @@
}
} else if (this.discount.shopDiscount != 1) {
uni.navigateTo({
- url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
+ url: `/pages/pay/discountpay?integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
})
return false
} else {
@@ -544,7 +560,7 @@
return
}
this.bordShow = false
- // return this.toDiscount() //鍒ゆ柇鏄惁闇�瑕佽烦杞惀閿�椤甸潰
+ //鍒ゆ柇鏄惁闇�瑕佽烦杞惀閿�椤甸潰
if (this.toDiscount()) {
// 閲戦 this.money
uni.showLoading()
@@ -579,9 +595,7 @@
this.aliPay(res.paymentData)
}
} else if (res.toPayMethod == 3) {
- // window.location.href = res.paymentUrl
- this.smscode = ''
- this.codeShow = true
+ window.location.href = res.paymentUrl
}
} catch (e) {
//TODO handle the exception
@@ -595,6 +609,23 @@
},
// 寰俊鏀粯
wxPay(res) {
+ /*setTimeout(() => {
+ wx.chooseWXPay({
+ timestamp: res.timeStamp, // 鏀粯绛惧悕鏃堕棿鎴�
+ nonceStr: res.nonceStr, // 鏀粯绛惧悕闅忔満涓诧紝涓嶉暱浜� 32 浣�
+ package: res.package, // 缁熶竴鏀粯鎺ュ彛杩斿洖鐨刾repay_id鍙傛暟鍊硷紝鎻愪氦鏍煎紡濡傦細prepay_id=\*\*\*锛�
+ signType: res.signType, // 寰俊鏀粯V3鐨勪紶鍏� RSA ,寰俊鏀粯V2鐨勪紶鍏ユ牸寮忎笌V2缁熶竴涓嬪崟鐨勭鍚嶆牸寮忎繚鎸佷竴鑷�
+ paySign: res.paySign, // 鏀粯绛惧悕
+ success: function (res) {
+ // 鏀粯鎴愬姛鍚庣殑鍥炶皟鍑芥暟
+ uni.navigateTo({
+ url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
+ .stringify(this.youHuiInfo)}`
+ })
+ }
+ });
+ }, 200)*/
+
setTimeout(() => {
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
@@ -609,10 +640,10 @@
if (res.err_msg == "get_brand_wcpay_request:ok") {
// 浣跨敤浠ヤ笂鏂瑰紡鍒ゆ柇鍓嶇杩斿洖,寰俊鍥㈤槦閮戦噸鎻愮ず锛�
//res.err_msg灏嗗湪鐢ㄦ埛鏀粯鎴愬姛鍚庤繑鍥瀘k锛屼絾骞朵笉淇濊瘉瀹冪粷瀵瑰彲闈犮��
- uni.navigateTo({
+ /*uni.navigateTo({
url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
.stringify(this.youHuiInfo)}`
- })
+ })*/
}
});
}, 200)
@@ -623,10 +654,10 @@
tradeNO: res.tradeNO
}, (res) => {
if (res.resultCode == 9000) {
- uni.navigateTo({
+ /*uni.navigateTo({
url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
.stringify(this.youHuiInfo)}`
- })
+ })*/
// 鏀粯鎴愬姛
} else if (res.resultCode == 8000 || res.resultCode == 6001) {
// 姝e湪澶勭悊涓� || 鍙栨秷
@@ -842,4 +873,4 @@
width: 680rpx;
height: 100rpx;
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.1