Browse Source

积分商城

hmp 4 years ago
parent
commit
879bb05592

+ 3 - 1
pages/activityList/activity/doAwards.vue

@@ -100,7 +100,9 @@
 				this.$u.api.user.withdraw(this.withdrawList).then(res=>{
 					if (res) {
 						this.$dialog.showModal("兑换成功,请耐心等待1~3个工作日",false).then(res=>{
-							this.fetchList()
+							uni.navigateBack({
+								delta:1
+							})
 						})
 					}
 				})

+ 70 - 2
pages/activityList/goods/detail.vue

@@ -48,7 +48,7 @@
 			
 				<view class="flex padding-xs">
 					<text class="flex justify-center align-center">热力值:</text>
-					<u-number-box :step="10" @change="hotValueChange" :input-width="200" :min="0" :max="+proportion.usableHot"  v-model="data.hotValue">
+					<u-number-box :disabled="$u.test.isEmpty(proportion.usableHot)" :step="10" @change="hotValueChange" :input-width="200" :min="0" :max="+proportion.usableHot"  v-model="data.hotValue">
 					</u-number-box>
 					<view v-if="changeCash.hotCash!=0" class="padding-left-sm text-red flex justify-center align-center">
 						=
@@ -58,7 +58,7 @@
 			
 				<view class="flex padding-xs">
 					<text class="flex justify-center align-center">积分值:</text>
-					<u-number-box @change="pointsValueChange" :input-width="200" :min="0" :max="+proportion.usablePoints" v-model="data.pointsValue">
+					<u-number-box :disabled="$u.test.isEmpty(proportion.usablePoints)" @change="pointsValueChange" :input-width="200" :min="0" :max="+proportion.usablePoints" v-model="data.pointsValue">
 					</u-number-box>
 					<view v-if="changeCash.pointsCash!=0" class="padding-left-sm text-red flex justify-center align-center">
 						=
@@ -100,6 +100,7 @@
 </template>
 
 <script>
+	import {appId} from	'@/common/conf/config.js';
 	import {authUrl} from '@/common/conf/config.js';
 	import {getUrlParams} from '@/common/utils/utils.js';
 	export default {
@@ -185,6 +186,73 @@
 					})
 					return;
 				}
+				if (!this.$u.test.isEmpty(this.data.cashValue)) {
+					//去支付,支付成功后
+					let orderInfo  = (await this.$u.api.yeePay.initOrder(
+						{
+						  "appId": appId,
+						  "channel": "WECHAT",
+							"channelPromotionInfo": "",
+							"channelSpecifiedInfo": "",
+							"csUrl": "",
+							"expiredTime": "",
+							"fundProcessType": "",
+							"goodsName": this.detail.name,
+							"memo": "",
+							"notifyUrl": "https://yyzs.nanyue6688.com/vote-h5/index.html",
+							"orderAmount": this.data.cashValue,
+							"orderId": new Date().getTime(),
+							"payWay": "WECHAT_OFFIACCOUNT",
+							"redirectUrl": "",
+							"scene": "OFFLINE",
+							"uniqueOrderNo": "",
+							"userId": uni.getStorageSync("openid"),
+							"userIp": "127.0.0.1"
+						}
+					));
+					if(typeof orderInfo.prePayTn != 'undefined' ){
+						//调起支付
+						this.toPay(JSON.parse(orderInfo.prePayTn));
+					}				
+				}else{
+					this.doConfirm()
+				}
+				
+			},
+			toPay() {
+				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.data.cashValue,
+							presentId: '',
+							presentCount: '',
+							relationId: this.id,
+							type: 3,
+							payStatus: 1,
+						}).then(res => {
+							this.doConfirm();
+						})	
+					} 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.data.cashValue,
+							presentId: '',
+							presentCount: '',
+							relationId: this.id,
+							type: 3,
+							payStatus: 2,
+						})
+					} else {
+						console.log(res.err_msg);
+					}
+				});
+			},
+			async doConfirm(){
 				this.data.pointsGoodsId = this.id
 				this.data.userId = this.userId
 				let res = await this.$u.api.pointsGoods.exchange(this.data)

+ 6 - 0
pages/activityList/index.vue

@@ -71,8 +71,14 @@
 		onLoad() {
 			this.getAdsList();
 			this.getActivityList();
+			
+			this.setData()
 		},
 		methods: {
+			setData(){
+				uni.setStorageSync("userId","1410904179811045377")
+				uni.setStorageSync("openid","o19581JoLz7p2SjLLoQ6jBBLN7Ws")
+			},
 			navWithParm(id) {
 				uni.navigateTo({
 					url: "/pages/activityList/home/home?activityId=" + id