Przeglądaj źródła

积分商城-支付

hmp 4 lat temu
rodzic
commit
808ec1192d

+ 2 - 2
components/homeViews/mine-view.vue

@@ -9,12 +9,12 @@
 					</view>
 					<view class="flex align-center padding-top-sm">
 						<view>
-							<view class="text-black text-bold">{{+userData.totalHot}}</view>
+							<view class="text-black text-bold">{{+userData.usableHot}}</view>
 							<view class="text-gray text-sm margin-top-xs">热力</view>
 						</view>
 						<view style="height: 60upx;border: #dadada 1px solid; margin: 0 30upx;"></view>
 						<view>
-							<view class="text-black text-bold">{{+userData.totalPoints}}</view>
+							<view class="text-black text-bold">{{+userData.usablePoints}}</view>
 							<view class="text-gray text-sm margin-top-xs">积分</view>
 						</view>
 						<view class="padding-left">

+ 23 - 27
pages/activityList/activity/authorBoost.vue

@@ -193,6 +193,7 @@
 								title: res.msg
 							})
 						} else {
+							this.$u.toast('打榜成功')
 							this.getBoostDetail(this.activityId, this.receiverId);
 						}
 					})
@@ -200,10 +201,12 @@
 			},
 			//礼物支付
 			async pay() {
+				let _this = this;
 				if (this.$u.test.isEmpty(this.senderId)) {
 					let path = 'pages/activityList/activity/authorBoost?activityId=' + this.activityId + '&receiverId=' + this.receiverId;
 					window.location.href = authUrl(path);
 				} else {
+					let orderId=new Date().getTime()
 					let orderInfo  = (await this.$u.api.yeePay.initOrder(
 						{
 						  "appId": appId,
@@ -217,7 +220,7 @@
 							"memo": "",
 							"notifyUrl": "https://yyzs.nanyue6688.com/ldt/api/yeePay/notify",
 							"orderAmount": this.count * this.currentPresentSum,
-							"orderId": new Date().getTime(),
+							"orderId": orderId,
 							"payWay": "WECHAT_OFFIACCOUNT",
 							"redirectUrl": "",
 							"scene": "OFFLINE",
@@ -226,10 +229,24 @@
 							"userIp": "127.0.0.1"
 						}
 					));
-					if(typeof orderInfo.prePayTn != 'undefined' ){
-						//调起支付
-						this.toPay(JSON.parse(orderInfo.prePayTn));
-					}
+					 _this.$u.api.boost.billRecord({
+						userId: _this.senderId,
+						orderId:orderId,
+						payPath: window.location.href,
+						openId: uni.getStorageSync("openid"),
+						activityId: _this.activityId,
+						price: _this.count * _this.currentPresentSum,
+						presentId: _this.boostDetail.presentList[_this.current].id,
+						presentCount: _this.count,
+						relationId: _this.receiverId,
+						type: 2,
+						payStatus: 0,
+					}).then(res=>{
+						if(typeof orderInfo.prePayTn != 'undefined' ){
+							//调起支付
+							this.toPay(JSON.parse(orderInfo.prePayTn));
+						}
+					})
 				}
 			},
 			//获取助力详情
@@ -309,17 +326,6 @@
 				let _this = this;
 				WeixinJSBridge.invoke('getBrandWCPayRequest', info, (res) => {
 					if (res.err_msg == "get_brand_wcpay_request:ok" ) {
-						_this.$u.api.boost.billRecord({
-							userId: _this.senderId,
-							openId: uni.getStorageSync("openid"),
-							activityId: _this.activityId,
-							price: _this.count * _this.currentPresentSum,
-							presentId: _this.boostDetail.presentList[_this.current].id,
-							presentCount: _this.count,
-							relationId: _this.receiverId,
-							type: 2,
-							payStatus: 1,
-						})
 						_this.$u.api.boost.doReward({
 							activityId: _this.activityId,
 							presentId: _this.boostDetail.presentList[_this.current].id,
@@ -331,17 +337,7 @@
 							_this.successShow = true;
 						})
 					} else if (res.err_msg == "get_brand_wcpay_request:cancel") {
-						_this.$u.api.boost.billRecord({
-							userId: _this.senderId,
-							openId: uni.getStorageSync("openid"),
-							activityId: _this.activityId,
-							price: _this.count * _this.currentPresentSum,
-							presentId: _this.boostDetail.presentList[_this.current].id,
-							presentCount: _this.count,
-							relationId: _this.receiverId,
-							type: 2,
-							payStatus: 2,
-						})
+						console.log("cancel");
 					} else {
 						console.log(res.err_msg);
 					}

+ 22 - 27
pages/activityList/activity/musicBoost.vue

@@ -210,10 +210,12 @@
 			},
 			//礼物支付
 			async pay() {
+				let _this = this;
 				if (this.$u.test.isEmpty(this.userId)) {
 					let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
 					window.location.href = authUrl(path);
 				} else {
+					let orderId=new Date().getTime()
 					let orderInfo  = (await this.$u.api.yeePay.initOrder(
 						{
 						  "appId": appId,
@@ -227,7 +229,7 @@
 							"memo": "",
 							"notifyUrl": "https://yyzs.nanyue6688.com/ldt/api/yeePay/notify",
 							"orderAmount": this.count * this.currentPresentSum,
-							"orderId": new Date().getTime(),
+							"orderId": orderId,
 							"payWay": "WECHAT_OFFIACCOUNT",
 							"redirectUrl": "",
 							"scene": "OFFLINE",
@@ -236,10 +238,24 @@
 							"userIp": "127.0.0.1"
 						}
 					));
-					if(typeof orderInfo.prePayTn != 'undefined' ){
-						//调起支付
-						this.toPay(JSON.parse(orderInfo.prePayTn));
-					}
+					_this.$u.api.boost.billRecord({
+						userId: _this.userId,
+						orderId:orderId,
+						openId: uni.getStorageSync("openid"),
+						payPath: window.location.href,
+						activityId: _this.boostDetail.activityId,
+						price: _this.count * _this.currentPresentSum,
+						presentId: _this.boostDetail.presentList[_this.current].id,
+						presentCount:  _this.count,
+						relationId: _this.productId,
+						type: 1,
+						payStatus: 0,
+					}).then(res=>{
+						if(typeof orderInfo.prePayTn != 'undefined' ){
+							//调起支付
+							this.toPay(JSON.parse(orderInfo.prePayTn));
+						}
+					})
 				}
 			},
 			//获取助力详情
@@ -321,17 +337,6 @@
 				let _this = this;
 				WeixinJSBridge.invoke('getBrandWCPayRequest', info, (res) => {
 					if (res.err_msg == "get_brand_wcpay_request:ok" ) {
-						_this.$u.api.boost.billRecord({
-							userId: _this.userId,
-							openId: uni.getStorageSync("openid"),
-							activityId: _this.boostDetail.activityId,
-							price: _this.count * _this.currentPresentSum,
-							presentId: _this.boostDetail.presentList[_this.current].id,
-							presentCount:  _this.count,
-							relationId: _this.productId,
-							type: 1,
-							payStatus: 1,
-						})
 						_this.$u.api.boost.doReward({
 							activityId: _this.boostDetail.activityId,
 							productId:_this.productId,
@@ -344,17 +349,7 @@
 							_this.successShow = true;
 						})
 					} else if (res.err_msg == "get_brand_wcpay_request:cancel") {
-						_this.$u.api.boost.billRecord({
-							userId: _this.userId,
-							openId: uni.getStorageSync("openid"),
-							activityId: _this.boostDetail.activityId,
-							price: _this.count * _this.currentPresentSum,
-							presentId: _this.boostDetail.presentList[_this.current].id,
-							presentCount:  _this.count,
-							relationId: _this.productId,
-							type: 1,
-							payStatus: 2,
-						})
+						console.log("cancel");
 					} else {
 						console.log(res.err_msg);
 					}