diff --git a/high-unionPay/Utils/Api.js b/high-unionPay/Utils/Api.js index 77dc6a9..8b3ed67 100644 --- a/high-unionPay/Utils/Api.js +++ b/high-unionPay/Utils/Api.js @@ -169,12 +169,14 @@ export const getListOutRechargePrice = params => { export const orderToUNionPay = params => { return POST('POST', `${base}/outRechargeOrder/orderToPay`, params).then(res => res.data); } - //银联提交订单 export const unionPay = params => { return POST('POST', `${base}/order/unionPay`, params).then(res => res.data); } - +// 银联话费充值 +export const orderToUnionPayphone = params => { + return POST('POST', `${base}/outRechargeOrder/orderToUnionPay`, params).then(res => res.data); +} /** diff --git a/high-unionPay/manifest.json b/high-unionPay/manifest.json index 9d1cd41..8cfd75a 100644 --- a/high-unionPay/manifest.json +++ b/high-unionPay/manifest.json @@ -80,7 +80,7 @@ } } }, - "title" : "嗨森逛", + "title" : "嗨加油", "router" : { "mode" : "hash", "base" : "/unionPay" @@ -89,7 +89,7 @@ "port" : "", "https" : false }, - "domain" : "https://hsg.dctpay.com", + "domain" : "https://hsgcs.dctpay.com", "template" : "index.html" } } diff --git a/high-unionPay/pages/pay/payment/payment.vue b/high-unionPay/pages/pay/payment/payment.vue index d609f46..494bab3 100644 --- a/high-unionPay/pages/pay/payment/payment.vue +++ b/high-unionPay/pages/pay/payment/payment.vue @@ -18,9 +18,9 @@ - + - + 积分支付(积分:{{user.gold}}) @@ -34,13 +34,13 @@ - 汇联通工会卡(余额:{{tongCardPrice}}元) + 银联支付 - + - + @@ -71,8 +71,8 @@ import { orderToPay, orderToGoldPay, - getHuiLianTongCardBalance, - hltUnionCardPay + hltUnionCardPay, + unionPay } from '../../../Utils/Api.js' import ssPaymentPassword from '../../../components/sanshui-payment-password' let app = getApp(); @@ -113,100 +113,15 @@ this.amount = parseFloat(e.amount).toFixed(2); }, onShow() { - let that = this; + let that = this; that.user = app.globalData.userInfo; - that.getHuiLianTongCardBalance(); }, methods: { - //获取选择支付方式 - changeRiado() { - if (!this.user.isSetHltCard) { - uni.showToast({ - icon: 'none', - title: '当前账号还未绑定,前往绑定', - duration: 2000, - success() { - setTimeout(() => { - uni.navigateTo({ - url: '../../user/bindingCard/bindingCard' - }) - }, 1000) - } - }); - return; - } - }, - //查询工会卡余额 - //查询详情 - getHuiLianTongCardBalance() { - let params = { - cardNo: this.user.hltCardNo.cardNo - } - getHuiLianTongCardBalance(params).then(res => { - if (res.return_code == '000000') { - this.tongCardPrice = res.return_data.balance; - } - }); - }, //获取订单数据 orderToPay() { let that = this; - if (that.paytype == 'wxpay') { - - let params = { - "orderId": that.orderNo, - "openId": app.globalData.openId, - "orderScene": "GOODS_ORDER" - } - orderToPay(params).then(res => { - if (res.return_code == '000000') { - // #ifdef MP - uni.showLoading({ - title: '支付中...' - }) - uni.requestPayment({ - "appId": res.return_data.appId, - "nonceStr": res.return_data.nonceStr, - "package": res.return_data.package, - "paySign": res.return_data.sign, - "signType": "MD5", - "timeStamp": res.return_data.timeStamp, - success: function(res) { - uni.hideLoading(); - uni.showToast({ - title: '支付成功' - }) - if (that.jumpType == 4) { - uni.reLaunch({ - url: '/pages/tabBar/user/user' - }); - return; - } - uni.reLaunch({ - url: '../success/success?id=' + that.couponId - }); - }, - fail: function(err) { - uni.hideLoading(); - }, - }); - // #endif - - //判断是否是公众号 - // #ifdef H5 - //判断微信浏览器 - that.payRequest(res); - // #endif - - } else { - uni.showToast({ - title: res.return_msg, - icon: 'none' - }) - } - }) - } else if (that.paytype == 'jinbi') { + if (that.paytype == 'jinbi') { if (!that.user.isSetPayPwd) { uni.navigateTo({ url: '../../login/updatePas/updatePas' @@ -215,28 +130,7 @@ } that.$refs.paymentPassword.modalFun('show'); } else if (that.paytype == 'gonghuika') { - if (!that.user.isSetPayPwd) { - uni.navigateTo({ - url: '../../login/updatePas/updatePas' - }) - return; - } - if (!that.user.isSetHltCard) { - uni.showToast({ - icon: 'none', - title: '当前账号还未绑定,前往绑定', - duration: 2000, - success() { - setTimeout(() => { - uni.navigateTo({ - url: '../../user/bindingCard/bindingCard' - }) - }, 1000) - } - }); - return; - } - that.$refs.paymentPassword.modalFun('show'); + that.unionPay(); } else { uni.showToast({ title: '请选择支付方式', @@ -245,6 +139,48 @@ }) } }, + //银联获取信息 + unionPay() { + let goods = { + "orderId": this.orderNo + } + unionPay(goods).then(res => { + if (res.return_code == '000000') { + this.uniontopay(res.return_data.prepayid); + } else { + uni.showToast({ + title: res.return_msg, + icon: 'none', + duration: 2000 + }); + } + }) + }, + //银联支付 + uniontopay(item) { + let that = this; + upsdk.pluginReady(function() { + upsdk.pay({ + tn: item, + success: function(res) { + uni.showToast({ + title: '支付成功' + }) + uni.reLaunch({ + url: '../success/success?id=' + this.couponId + }); + }, + fail: function(err) { + uni.showToast({ + title: err.msg, + icon: 'none', + duration: 2000 + }) + // 支付失败, err.msg 是失败原因描述, 比如TN号不合法, 或者用户取消了交易 等等。 + } + }); + }); + }, submitHandle(e) { this.PaymentPassword = e.value; uni.showLoading({ diff --git a/high-unionPay/pages/tabBar/user/user.vue b/high-unionPay/pages/tabBar/user/user.vue index 7e4f74c..2984c9e 100644 --- a/high-unionPay/pages/tabBar/user/user.vue +++ b/high-unionPay/pages/tabBar/user/user.vue @@ -63,9 +63,9 @@ --> - - @@ -492,7 +492,7 @@ padding-left: 20px; padding-right: 20px; text-align: right; - height: 100upx; + height: 50upx; /* #ifdef APP-PLUS */ margin-top: var(--status-bar-height); diff --git a/high-unionPay/pages/unionPay/recharge-centre/recharge-centre.vue b/high-unionPay/pages/unionPay/recharge-centre/recharge-centre.vue index 6ba0ae3..41457cb 100644 --- a/high-unionPay/pages/unionPay/recharge-centre/recharge-centre.vue +++ b/high-unionPay/pages/unionPay/recharge-centre/recharge-centre.vue @@ -61,14 +61,11 @@