From 2ef38978565724bc582de1f900e494335e7d5341 Mon Sep 17 00:00:00 2001 From: zpc Date: Thu, 6 Mar 2025 18:44:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=9F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/mall/index.vue | 131 +++++++++++++++++++++++++++++--------- pages/sangdai/sangdai.vue | 4 +- 2 files changed, 104 insertions(+), 31 deletions(-) diff --git a/pages/mall/index.vue b/pages/mall/index.vue index 6582e62..cdd6298 100644 --- a/pages/mall/index.vue +++ b/pages/mall/index.vue @@ -82,17 +82,29 @@ 选择支付方式 - + 微信支付 - + - + + + + 吧唧币¥ + {{ orderData.goods.price*100 }} (剩余:{{ orderData.use_integral }}) + + + + + + + + @@ -132,14 +144,16 @@ - - 立即支付 + {{ ` ¥${orderData.price}` }} + + {{orderData.price*100}}吧唧币 + @@ -161,8 +175,9 @@ orderData: null, isAgree: true, isWXPay: true, - useMoney: true, - + useMoney: false, + integral: true, + zhifu: 0, } }, onLoad() { @@ -232,25 +247,17 @@ this.goodsId = data.id; var that = this; this.req({ - url: 'ordermoney', + url: 'mall_ordermoney', data: { prize_num: 1, goods_id: data.id, goods_num: 1, - use_money_is: this.useMoney ? 1 : 2, - use_integral_is: this.isWXPay ? 1 : 2, - // coupon_id: (that.couponData && that.couponData.id) || '' }, success(res) { if (res.status == 1) { - // that.pay_news = res.data - // if (res.data.coupon_id) { - // that.couponData = { - // id: res.data.coupon_id, - // price: res.data.coupon_price - // } - // } + that.orderData = res.data + that.zhifu = 0; that.$refs.pop.open() } } @@ -262,9 +269,15 @@ }, changePay(e) { - this[e] = !this[e] + if (this.zhifu != e) { + this.zhifu = e; + } + if (this.zhifu == 1) { - this.confirmSubmit(0) + } + // this[e] = !this[e] + + // this.confirmSubmit(0) }, confirmSubmit(type) { @@ -281,16 +294,11 @@ var that = this; - let url = 'infinite_ordermoney' + let url = 'mall_ordermoney' let data = { goods_id: this.goodsId, prize_num: 1, - use_money_is: this.useMoney ? 1 : 2, - use_integral_is: this.isWXPay ? 1 : 2, - // coupon_id: (this.couponData && this.couponData.id) || '', - // is_mibao: this.pageTabCur - // ad_id: uni.getStorageSync('_ad_id') } if (type == 1) { @@ -320,8 +328,6 @@ if (type == 0) { console.log("res.data", res.data); this.orderData = res.data; - - // that.open('pop'); } if (type == 1) { @@ -356,6 +362,73 @@ }, + + pay(type) { + //orderData.price + //{{ orderData.goods.price*100 }} (剩余:{{ orderData.use_integral }}) + var pri = this.orderData.goods.price * 100; + if (this.orderData.use_integral < pri) { + uni.showToast({ + title: '吧唧币不足', + icon: 'none', + }); + return; + } + + console.log("type", type); + + var that = this; + + let url = 'mall_orderbuy' + + let data = { + goods_id: this.goodsId, + prize_num: 1, + } + + this.req({ + url, + data, + success: async res => { + if (res.status == 1) { + if (type == 0) { + console.log("res.data", res.data); + this.orderData = res.data; + } + + if (type == 1) { + that.close('pop') + if (res.data.status == 1) { + + const status = await that.$c.wxMpPay({ + data: res.data.res + }) + if (status == 'success') { + // that.getPrize(res.data.order_num) + that.getData(); + } + + + + + } else { + that.$c.toast({ + title: res.msg, + duration: 500, + success: () => { + // that.getPrize(res.data.order_num) + that.getData(); + } + }) + } + } + } + } + }) + + }, + + }, } diff --git a/pages/sangdai/sangdai.vue b/pages/sangdai/sangdai.vue index 6a8f148..93728a6 100644 --- a/pages/sangdai/sangdai.vue +++ b/pages/sangdai/sangdai.vue @@ -163,7 +163,7 @@ {{nowChooseNum}} - 件物品,合计兑换 + 件物品,合计兑换吧唧币 {{totalChangeMoney}} @@ -298,7 +298,7 @@ - 恭喜您兑换成功获得¥{{zhanshiMoney}} + 成功获得{{zhanshiMoney}}吧唧币