From 80763662ffaefa7e49cf541201c689f61f5a3caa Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期日, 30 十一月 2025 19:28:49 +0800
Subject: [PATCH] feat(pay): 充值页面增加积分显示

---
 pages/pay/discountpay.vue |  123 ++++++++++++++++++++--------------------
 1 files changed, 62 insertions(+), 61 deletions(-)

diff --git a/pages/pay/discountpay.vue b/pages/pay/discountpay.vue
index 59773f7..a531920 100644
--- a/pages/pay/discountpay.vue
+++ b/pages/pay/discountpay.vue
@@ -1,6 +1,7 @@
 <!-- 鎵爜鏀粯 -->
 <template>
 	<view class="page">
+		<u-alert type="warning" closable description="瀹夊叏鎻愰啋锛氳璋ㄦ厧鏍稿鍟嗗銆佽鍗曚俊鎭紝淇濇姢鑷繁璧勯噾瀹夊叏!"></u-alert>
 		<view class="pay-box">
 			<view class="u-font-26 color-666">搴斾粯閲戦</view>
 			<view class="u-m-t-14">
@@ -10,18 +11,16 @@
 			</view>
 		</view>
 
-    <!--		<view v-if="discountInfo.shopDiscount!=1&&money*(1-discountInfo.shopDiscount)>=0.01"
-			class="bg-fff u-m-h-32 u-m-t-20 u-p-h-32 u-br-10">
+		<view v-if="discountInfo.shopDiscount!=1&&money*(1-discountInfo.shopDiscount)>=0.01" class="bg-fff u-m-h-32 u-m-t-20 u-p-h-32 u-br-10">
 			<view class="u-p-v-32 u-flex u-row-between u-border-bottom u-font-30 color-333">
 				<view>{{discountInfo.memberGradeName}}涓撳睘鎶樻墸</view>
 				<view>-{{ money*(1-discountInfo.shopDiscount).toFixed(2) }}</view>
 			</view>
-		</view>-->
+		</view>
 		<view v-if="canUseIntegral||canUseCoupon" class="u-p-h-32 bg-fff u-m-h-32 u-br-10">
-<!--			<view class="u-font-28 u-m-t-32">閫夋嫨浼樻儬鏂瑰紡</view>
+			<view class="u-font-28 u-m-t-32">閫夋嫨浼樻儬鏂瑰紡</view>
 			<view v-if="canUseIntegral" class="u-p-v-24 u-border-bottom u-flex u-m-t-10">
-				<image class="item-icon" style="align-self: flex-start;position: relative;top: -3rpx;"
-					src="/static/integral.png" mode=""></image>
+				<image class="item-icon" style="align-self: flex-start;position: relative;top: -3rpx;" src="/static/integral.png" mode=""></image>
 				<view class="u-flex-1 u-m-h-16">
 					<view class="u-font-30">绉垎鎶垫墸</view>
 					<view class="u-font-24 color-999 u-m-t-20">鍙敤<text style="color: #D31F28;">{{integral}}</text>绉垎
@@ -29,7 +28,7 @@
 				</view>
 				<input-number @handleCount="changeInt" :value="canUseInt" :min="0" :max="maxIntegral">
 				</input-number>
-			</view>-->
+			</view>
 			<view v-if="canUseCoupon" class="u-flex u-p-v-32">
 				<image class="item-icon" src="/static/coupon-icon.png" mode=""></image>
 				<view class="u-font-30 u-flex-1 u-m-h-16">浼樻儬鍒�</view>
@@ -64,8 +63,7 @@
 				宸查�夋嫨浼樻儬鍒�1寮狅紝鍏辨姷鎵o骏{{parseFloat((checkCoupon.discount/100).toFixed(2))}}</view>
 			<!-- <view class="choose-coupon">閫夋嫨浼樻儬鍒�</view> -->
 			<scroll-view scroll-y class="u-p-30 coupon-list">
-				<view @click="clickCoupon(item)" class="u-m-b-24 u-flex coupon" v-for="(item, index) in couponList"
-					:key="index">
+				<view @click="clickCoupon(item)" class="u-m-b-24 u-flex coupon" v-for="(item, index) in couponList" :key="index">
 					<view style="color: #D31F28;" class="u-p-h-28">
 						<view class="font-bold">
 							<text class="u-font-36">锟�</text>
@@ -94,39 +92,31 @@
 			<key-bord @changeMoney="changeMoney" :num.sync="money" @close="bordShow = false" @pay="pay"></key-bord>
 		</u-popup>
 		<!-- 鏀粯楠岃瘉鐮� -->
-<!--		<u-popup :show="codeShow" closeable mode="center" @close="codeShow = false">
+		<u-popup :show="codeShow" closeable mode="center" @close="codeShow = false">
 			<view class="u-p-h-40 u-p-b-40">
 				<view class="u-text-center u-p-t-20 u-m-b-30 u-font-34">璇疯緭鍏ユ墜鏈洪獙璇佺爜</view>
 				<view class="u-text-center u-m-b-20 color-666">{{ shopInfo.shop_name }}</view>
-				<view class="u-flex u-row-center font-bold u-m-b-40"><text class="u-font-42">锟�</text><text
-						class="u-font-money">{{ price }}</text>
+				<view class="u-flex u-row-center font-bold u-m-b-40"><text class="u-font-42">锟�</text><text class="u-font-money">{{ price }}</text>
 				</view>
 				<u-code-input @finish="bankPay" v-model="smscode" mode="box" :focus="true"></u-code-input>
 			</view>
 
-		</u-popup>-->
+		</u-popup>
 	</view>
 </template>
 
 <script>
 	import {
-		config,
 		ACCESSTOKEN
 	} from '@/common/config.js';
 	import {
 		queryMyUseSweepPayMaxCoupon,
-		getScoreWorth,
-		queryScore,
 		queryUseSweepPayCoupon,
 		getWechatConfigInfo,
 		saveWxOrder,
-    saveOrder,
 		tlPay
 	} from '@/common/api/index'
 	import wx from 'weixin-js-sdk'; // 浣跨敤js-sdk
-	import {
-		nextTick
-	} from "vue";
 	export default {
 		data() {
 			return {
@@ -245,14 +235,11 @@
 		onLoad(opt) {
 			this.isNew = uni.getStorageSync('IS_NEW')
 			this.cid = uni.getStorageSync('CID')
-      if(uni.getStorageSync('DISCOUNT_INFO')){
-        this.discountInfo = uni.getStorageSync('DISCOUNT_INFO')
-      }
-
-			const token = uni.getStorageSync(ACCESSTOKEN) || null
-			if (opt.shopInfo) {
-				this.shopInfo = JSON.parse(decodeURIComponent(opt.shopInfo))
+			this.discountInfo = uni.getStorageSync('DISCOUNT_INFO') || {
+				shopDiscount: 1
 			}
+			const token = uni.getStorageSync(ACCESSTOKEN) || null
+			this.shopInfo = uni.getStorageSync('SHOP_INFO')
 			if (opt.scoreWorth) {
 				this.scoreWorth = Number(opt.scoreWorth)
 			}
@@ -261,9 +248,9 @@
 			}
 			if (opt.money) {
 				this.money = parseFloat(opt.money).toFixed(2)
-				let dis = this.money * 100 * (1 - this.discountInfo.shopDiscount)
-        console.log('dis',dis)
-				let money = parseInt((this.money * 100 * this.discountInfo.shopDiscount))
+				let ds = parseFloat(this.discountInfo.shopDiscount)
+				let dis = this.money * 100 * (1 - ds)
+				let money = parseInt((this.money * 100 * ds))
 				if (dis < 1) {
 					money = parseInt((this.money * 100))
 				}
@@ -273,9 +260,9 @@
 						money: money < 1 ? 1 : money
 					}
 				}).then(res => {
-					if (res&&this.canUseCoupon) {
-							this.couponInfo = res
-							this.checkCoupon = res
+					if (res && this.canUseCoupon) {
+						this.couponInfo = res
+						this.checkCoupon = res
 					}
 
 				})
@@ -337,7 +324,7 @@
 				if (this.payWay == 3) {
 					params.bankCardId = this.bankCardId
 				}
-        saveOrder(params).then(res => {
+				saveWxOrder(params).then(res => {
 					uni.hideLoading()
 					try {
 						this.orderId = res.orderId
@@ -362,9 +349,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) {
@@ -378,39 +363,55 @@
 				})
 			},
 			// 寰俊鏀粯
-      wxPay(res) {
-        setTimeout(() => {
-          WeixinJSBridge.invoke(
-              'getBrandWCPayRequest', {
-                "appId": res.appId, //鍏紬鍙稩D锛岀敱鍟嗘埛浼犲叆
-                "timeStamp": res.timeStamp, //鏃堕棿鎴筹紝鑷�1970骞翠互鏉ョ殑绉掓暟
-                "nonceStr": res.nonceStr, //闅忔満涓�
-                "package": res.package,
-                "signType": res.signType, //寰俊绛惧悕鏂瑰紡锛�
-                "paySign": res.paySign //寰俊绛惧悕
-              },
-              (res) => {
-                if (res.err_msg == "get_brand_wcpay_request:ok") {
-                  // 浣跨敤浠ヤ笂鏂瑰紡鍒ゆ柇鍓嶇杩斿洖,寰俊鍥㈤槦閮戦噸鎻愮ず锛�
-                  //res.err_msg灏嗗湪鐢ㄦ埛鏀粯鎴愬姛鍚庤繑鍥瀘k锛屼絾骞朵笉淇濊瘉瀹冪粷瀵瑰彲闈犮��
-                  uni.navigateTo({
-                    url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
+			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', {
+							"appId": res.appId, //鍏紬鍙稩D锛岀敱鍟嗘埛浼犲叆
+							"timeStamp": res.timeStamp, //鏃堕棿鎴筹紝鑷�1970骞翠互鏉ョ殑绉掓暟
+							"nonceStr": res.nonceStr, //闅忔満涓�
+							"package": res.package,
+							"signType": res.signType, //寰俊绛惧悕鏂瑰紡锛�
+							"paySign": res.paySign //寰俊绛惧悕
+						},
+						(res) => {
+							if (res.err_msg == "get_brand_wcpay_request:ok") {
+								// 浣跨敤浠ヤ笂鏂瑰紡鍒ゆ柇鍓嶇杩斿洖,寰俊鍥㈤槦閮戦噸鎻愮ず锛�
+								//res.err_msg灏嗗湪鐢ㄦ埛鏀粯鎴愬姛鍚庤繑鍥瀘k锛屼絾骞朵笉淇濊瘉瀹冪粷瀵瑰彲闈犮��
+								/*uni.navigateTo({
+									url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
                         .stringify(this.youHuiInfo)}`
-                  })
-                }
-              });
-        }, 200)
-      },
+								})*/
+							}
+						});
+				}, 200)
+			},
 			//鏀粯瀹濇敮浠�
 			aliPay(res) {
 				ap.tradePay({
 					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湪澶勭悊涓� || 鍙栨秷

--
Gitblit v1.9.1