From 55ee7bd313c7d8030ce8c547b18ad5f19507afd2 Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期日, 30 十一月 2025 16:12:37 +0800
Subject: [PATCH] feat(pay): 新增会员充值和次卡购买页面

---
 pages/pay/scanpay.vue |  145 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 102 insertions(+), 43 deletions(-)

diff --git a/pages/pay/scanpay.vue b/pages/pay/scanpay.vue
index e4d5af6..ff25ff5 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,8 +23,26 @@
 			</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>
+					<image src="@/static/imgs/pay-zfb.png" class="pay-icon" mode="widthFix"></image>
 					<view class="flex-1">
 						<view class="u-font-30 color-333">鏀粯瀹�</view>
 						<text v-if="isNew" class="tag u-m-t-10">浼氬憳浜紭鎯�</text>
@@ -41,7 +60,7 @@
 					<u-radio @change="radioChange($event,5)" :name="5" activeColor="#D41F28" :customStyle="{ marginLeft: '10rpx' }"></u-radio>
 				</view>
 				<view v-if="platform == 2" class="u-border-bottom u-p-v-20 u-flex u-row-between">
-					<image src="@/static/imgs/pay-wx.png" class="pay-icon"></image>
+					<image src="@/static/imgs/pay-wx.png" class="pay-icon" mode="widthFix"></image>
 					<view class="flex-1">
 						<view class="u-font-30 color-333">寰俊</view>
 						<text v-if="isNew" class="tag u-m-t-10">浼氬憳浜紭鎯�</text>
@@ -59,9 +78,21 @@
 					<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">
+				<view  class="u-border-bottom u-p-v-20 u-flex u-row-between">
+					<image src="@/static/zjjg/yue.png" class="pay-icon" mode="widthFix"></image>
+					<view class="flex-1">
+						<view class="u-font-30 color-333">鍌ㄥ�煎崱</view>
+						<text class="u-font-24 color-999 u-m-t-10">
+							鍙敤浣欓
+							<text class="color-red">锟{ integral }}</text>
+						</text>
+					</view>
+					<u-radio @change="radioChange($event,14)" :name="14" activeColor="#D41F28" :customStyle="{ marginLeft: '10rpx' }">
+					</u-radio>
+				</view>
+<!--				<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>
@@ -71,7 +102,7 @@
 								<u-icon name="arrow-right" color="#000">
 								</u-icon>
 							</view>
-							<!-- <text v-if="isNew" class="tag u-m-t-10">浼氬憳浜紭鎯�</text> -->
+							&lt;!&ndash; <text v-if="isNew" class="tag u-m-t-10">浼氬憳浜紭鎯�</text> &ndash;&gt;
 							<text v-if="!isNew&&shopInfo.use_score_flag&&shopInfo.bank_pay_use_score_flag" class="u-font-24 color-999 u-m-t-10">
 								鍙敤
 								<text class="color-red">{{ integral }}</text>
@@ -84,11 +115,21 @@
               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>
+				</view>-->
 			</u-radio-group>
-			<!-- <navigator v-if="bankCard==-1&&bindCard&&token&&!isNew" class="shuka" url="/pages/pay/bindCard/bindCard">
+      <navigator :url="`/pages/pay/vipEwm?cardInfo=${encodeURIComponent(JSON.stringify(cardInfo))}`" class="u-border-bottom u-p-v-20 u-flex u-row-between">
+          <image src="@/static/zjjg/cika.png" class="pay-icon" mode="widthFix"></image>
+          <view class="flex-1 u-m-l-20">
+            <view class="u-font-30 color-333">娆″崱鏀粯</view>
+            <text class="u-font-24 color-999 u-m-t-10">
+              鍙敤娆℃暟
+              <text class="color-red">{{ cardInfo.times }}娆�</text>
+            </text>
+          </view>
+      </navigator>
+<!--			<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 +142,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>
@@ -116,7 +157,7 @@
 				<block v-for="(item,i) in bankCardList" :key="i">
 					<view @click="chooseBankCard(item)" class="u-border-bottom u-p-v-30 u-flex">
 						<view class="flex-1 u-flex">
-							<image :src="bankCardStyle.logo" class="pay-icon"></image>
+							<image :src="bankCardStyle.logo" class="pay-icon" mode="widthFix"></image>
 							<view>
 								<view class="u-font-26 color-333">{{ item.bankName }}</view>
 								<view class="u-m-t-10 u-font-28 color-333">{{ cardType[item.cardType] }}({{ item.cardNo }})
@@ -179,10 +220,16 @@
 	import {
 		activityInfo
 	} from '@/common/api/shuaka'
-
 	export default {
 		data() {
 			return {
+        cardInfo:{
+          type: 1,
+          name: '',
+          amount: 0,
+          score: 0,
+          times: 12
+        },
 				platform: this.$utils.getPlat(),
 				cardType: cardType,
 				cid: '',
@@ -201,7 +248,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 +283,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 +302,7 @@
 				}).catch(() => {
 					uni.hideLoading()
 				})
+
 			} else {
 				if (process.env.NODE_ENV === 'development') {
 					console.log('寮�鍙戠幆澧�');
@@ -289,20 +340,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 +361,7 @@
 				this.bordShow = true;
 			},
 			init() {
-				this.end += 1
+				this.end += 5
 				//鑾峰彇鍟嗛摵淇℃伅
 				queryShop({
 					params: {
@@ -333,14 +381,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 +460,11 @@
 						uni.hideLoading()
 					})
 				}
+
 			},
 			// 鑾峰彇浼氬憳鐩稿叧淇℃伅
 			getUserInfo() {
-				this.end += 2
+				this.end += 4
 
 				queryMyDiscount({
 					shopId: this.shopInfo.id
@@ -436,7 +482,7 @@
 						uni.hideLoading()
 					}
 				})
-				/* //鑾峰彇鐢ㄦ埛閾惰鍗�
+				//鑾峰彇鐢ㄦ埛閾惰鍗�
 				myBankCard().then(res => {
 					this.count++
 					if (this.count >= this.end) {
@@ -469,7 +515,7 @@
 					if (this.count >= this.end) {
 						uni.hideLoading()
 					}
-				}) */
+				})
 				//鑾峰彇鐢ㄦ埛浼樻儬鍒�
 				queryMyUseSweepPayMaxCoupon({
 					params: {
@@ -500,26 +546,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 +572,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 +589,7 @@
 					return
 				}
 				this.bordShow = false
-				// return this.toDiscount() //鍒ゆ柇鏄惁闇�瑕佽烦杞惀閿�椤甸潰
+				//鍒ゆ柇鏄惁闇�瑕佽烦杞惀閿�椤甸潰
 				if (this.toDiscount()) {
 					// 閲戦 this.money
 					uni.showLoading()
@@ -579,9 +624,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 +638,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 +669,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 +683,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湪澶勭悊涓� || 鍙栨秷
@@ -720,7 +780,6 @@
 	.pay-icon {
 		align-self: flex-start;
 		width: 48rpx;
-		height: 48rpx;
 		margin-right: 20rpx;
 	}
 
@@ -842,4 +901,4 @@
 		width: 680rpx;
 		height: 100rpx;
 	}
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.1