1.修改话费充值

master
杨杰 3 years ago
parent 105b307fa4
commit 92f206495f
  1. 6
      high-unionPay/Utils/Api.js
  2. 4
      high-unionPay/manifest.json
  3. 170
      high-unionPay/pages/pay/payment/payment.vue
  4. 6
      high-unionPay/pages/tabBar/user/user.vue
  5. 90
      high-unionPay/pages/unionPay/recharge-centre/recharge-centre.vue
  6. 46
      high-unionPay/pages/unionPay/unionPay.vue

@ -169,12 +169,14 @@ export const getListOutRechargePrice = params => {
export const orderToUNionPay = params => { export const orderToUNionPay = params => {
return POST('POST', `${base}/outRechargeOrder/orderToPay`, params).then(res => res.data); return POST('POST', `${base}/outRechargeOrder/orderToPay`, params).then(res => res.data);
} }
//银联提交订单 //银联提交订单
export const unionPay = params => { export const unionPay = params => {
return POST('POST', `${base}/order/unionPay`, params).then(res => res.data); 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);
}
/** /**

@ -80,7 +80,7 @@
} }
} }
}, },
"title" : "嗨森逛", "title" : "嗨加油",
"router" : { "router" : {
"mode" : "hash", "mode" : "hash",
"base" : "/unionPay" "base" : "/unionPay"
@ -89,7 +89,7 @@
"port" : "", "port" : "",
"https" : false "https" : false
}, },
"domain" : "https://hsg.dctpay.com", "domain" : "https://hsgcs.dctpay.com",
"template" : "index.html" "template" : "index.html"
} }
} }

@ -18,9 +18,9 @@
</view> </view>
<view class="content"> <view class="content">
<view class="pay-list"> <view class="pay-list">
<view class="row" @tap="paytype='jinbi'" v-if="pryType == 2 || pryType==3 "> <view class="row" @tap="paytype='jinbi'">
<view class="left"> <view class="left">
<image src="../../../static/img/jfx.png"></image> <image src="../../../static/img/jfx.png"></image>
</view> </view>
<view class="center"> <view class="center">
积分支付(积分:{{user.gold}}) 积分支付(积分:{{user.gold}})
@ -34,13 +34,13 @@
<image style="border-radius: 50%;" src="../../../static/img/ghkpay.png"></image> <image style="border-radius: 50%;" src="../../../static/img/ghkpay.png"></image>
</view> </view>
<view class="center"> <view class="center">
汇联通工会卡(余额:{{tongCardPrice}}) 银联支付
</view> </view>
<view class="right"> <view class="right">
<radio :checked="paytype=='gonghuika'" @click="changeRiado()" color="#0083f5" /> <radio :checked="paytype=='gonghuika'" color="#0083f5" />
</view> </view>
</view> </view>
<view class="row" @tap="paytype='wxpay'" v-if="pryType == 1 || pryType==3 "> <!-- <view class="row" @tap="paytype='wxpay'" v-if="pryType == 1 || pryType==3 ">
<view class="left"> <view class="left">
<image :src="imagewxUrl+imgadres"></image> <image :src="imagewxUrl+imgadres"></image>
</view> </view>
@ -50,7 +50,7 @@
<view class="right"> <view class="right">
<radio :checked="paytype=='wxpay'" color="#0083f5" /> <radio :checked="paytype=='wxpay'" color="#0083f5" />
</view> </view>
</view> </view> -->
</view> </view>
</view> </view>
</view> </view>
@ -71,8 +71,8 @@
import { import {
orderToPay, orderToPay,
orderToGoldPay, orderToGoldPay,
getHuiLianTongCardBalance, hltUnionCardPay,
hltUnionCardPay unionPay
} from '../../../Utils/Api.js' } from '../../../Utils/Api.js'
import ssPaymentPassword from '../../../components/sanshui-payment-password' import ssPaymentPassword from '../../../components/sanshui-payment-password'
let app = getApp(); let app = getApp();
@ -113,100 +113,15 @@
this.amount = parseFloat(e.amount).toFixed(2); this.amount = parseFloat(e.amount).toFixed(2);
}, },
onShow() { onShow() {
let that = this; let that = this;
that.user = app.globalData.userInfo; that.user = app.globalData.userInfo;
that.getHuiLianTongCardBalance();
}, },
methods: { 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() { orderToPay() {
let that = this; let that = this;
if (that.paytype == 'wxpay') { if (that.paytype == 'jinbi') {
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.user.isSetPayPwd) { if (!that.user.isSetPayPwd) {
uni.navigateTo({ uni.navigateTo({
url: '../../login/updatePas/updatePas' url: '../../login/updatePas/updatePas'
@ -215,28 +130,7 @@
} }
that.$refs.paymentPassword.modalFun('show'); that.$refs.paymentPassword.modalFun('show');
} else if (that.paytype == 'gonghuika') { } else if (that.paytype == 'gonghuika') {
if (!that.user.isSetPayPwd) { that.unionPay();
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');
} else { } else {
uni.showToast({ uni.showToast({
title: '请选择支付方式', 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) { submitHandle(e) {
this.PaymentPassword = e.value; this.PaymentPassword = e.value;
uni.showLoading({ uni.showLoading({

@ -63,9 +63,9 @@
<uni-badge text="1" type="error" /> <uni-badge text="1" type="error" />
</view> --> </view> -->
<uni-badge style="width: 20px;position: absolute; right: 30%;" v-if="row.text == '我的卡券' && textnum " <uni-badge style="width: 20px;position: absolute; right: 53%;" v-if="row.text == '我的卡券' && textnum "
:text="textnum" type="error" size="normal"></uni-badge> :text="textnum" type="error" size="normal"></uni-badge>
<uni-badge style="width: 20px;position: absolute; right: 53%;" <uni-badge style="width: 20px;position: absolute; right: 30%;"
v-if="row.text == '我的优惠券' && textSend " :text="textSend" type="error" size="normal"></uni-badge> v-if="row.text == '我的优惠券' && textSend " :text="textSend" type="error" size="normal"></uni-badge>
<view class="img"> <view class="img">
<image :src="imagewxUrl+row.img"></image> <image :src="imagewxUrl+row.img"></image>
@ -492,7 +492,7 @@
padding-left: 20px; padding-left: 20px;
padding-right: 20px; padding-right: 20px;
text-align: right; text-align: right;
height: 100upx; height: 50upx;
/* #ifdef APP-PLUS */ /* #ifdef APP-PLUS */
margin-top: var(--status-bar-height); margin-top: var(--status-bar-height);

@ -61,14 +61,11 @@
</template> </template>
<script> <script>
// #ifdef H5
var jweixin = require('jweixin-module');
// #endif
let app = getApp(); let app = getApp();
import { import {
getListOutRechargePrice, getListOutRechargePrice,
addOrderPay, addOrderPay,
orderToUNionPay orderToUnionPayphone
} from '../../../Utils/Api.js'; } from '../../../Utils/Api.js';
export default { export default {
data() { data() {
@ -167,11 +164,8 @@
addOrderPay(params).then(res => { addOrderPay(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.return_code == '000000') { if (res.return_code == '000000') {
let params = { this.orderToUnionPayphone(res.return_data.id);
"orderId": res.return_data.id,
"openId": app.globalData.openId
}
this.orderToUNionPay(params);
} else { } else {
uni.showToast({ uni.showToast({
title: res.return_msg, title: res.return_msg,
@ -179,17 +173,15 @@
}) })
} }
}) })
}, },
// //
orderToUNionPay(item) { orderToUnionPayphone(item) {
orderToUNionPay(item).then(res => { let params = {
"orderId" : item
}
orderToUnionPayphone(params).then(res => {
if (res.return_code == '000000') { if (res.return_code == '000000') {
// this.uniontopay(res.return_data.prepayid);
// #ifdef H5
//
this.payRequest(res);
// #endif
} else { } else {
uni.showToast({ uni.showToast({
title: res.return_msg, title: res.return_msg,
@ -198,63 +190,29 @@
} }
}) })
}, },
// //
payRequest: function(self) { uniontopay(item) {
uni.showLoading({ let that = this;
title: '支付中...' upsdk.pluginReady(function() {
}) upsdk.pay({
jweixin.config({ tn: item,
// debug: false, // ,apialertpclogpc
appId: self.return_data.appId, //
timestamp: self.return_data.timeStamp, //
nonceStr: self.return_data.nonceStr, //
signature: self.return_data.sign, // 1
jsApiList: ['chooseWXPay'] // 使JSJS2
});
uni.hideLoading();
jweixin.ready(function() {
jweixin.checkJsApi({
jsApiList: ['chooseWXPay'], // JSJS2,
success: function(res) {},
fail: function(res) {}
});
jweixin.chooseWXPay({
appId: self.return_data.appId,
timestamp: self.return_data
.timeStamp, // jssdk使timestamp使timeStampS
nonceStr: self.return_data.nonceStr, // 32
package: self.return_data
.package, // prepay_idprepay_id=***
signType: 'MD5', // 'SHA1'使'MD5'
paySign: self.return_data.sign, //
success: function(res) { success: function(res) {
//
uni.showToast({ uni.showToast({
title: '支付成功' title: '支付成功'
}) })
if (that.jumpType == 4) {
uni.reLaunch({
url: '/pages/tabBar/user/user'
});
return;
}
uni.reLaunch({ uni.reLaunch({
url: '../success/success?id=' + that.couponId url: '/pages/tabBar/user/user'
}); });
}, },
cancel: function(r) {}, fail: function(err) {
fail: function(res) {} uni.showToast({
}); title: err.msg,
}); icon: 'none',
duration: 2000
jweixin.error(function(res) { })
uni.showToast({ // , err.msg , TN,
icon: 'none', }
title: '支付失败了',
duration: 4000
}); });
// configerrorconfigdebugresSPA
/*alert("config信息验证失败");*/
}); });
}, },
} }

@ -1,43 +1,33 @@
<template> <template>
<view> <view>
<image class="width90" mode="widthFix" src="../../static/img/unionimg/union1.jpg" @click="jumpunionpay"></image> <image class="width90" mode="widthFix" src="../../static/img/unionimg/union1.jpg" @click="jumpunionpay"></image>
<image class="width90" mode="widthFix" src="../../static/img/unionimg/union2.jpg" @click="topay"></image> <image class="width90" mode="widthFix" src="../../static/img/unionimg/union2.jpg"></image>
<view class="mart15 font16 fcor333">{{arr3}}</view>
<view class="mart15 font16 fcor333">{{arr4}}</view>
<view class="mart15 font16 fcor333">{{arr5}}</view>
<view class="mart15 font16 fcor333">支付信息{{arr6}}</view>
</view> </view>
</template> </template>
<script> <script>
let app = getApp()
export default { export default {
data() { data() {
return { return {
arr3: '',
arr4: '',
arr5: [],
arr6:''
} }
}, },
onLoad(options) { onLoad(options) {
uni.getStorage({
key: "user",
success(e) {
app.globalData.userInfo = e.data //token
// if (JSON.stringify(options) != "{}") { uni.getStorage({
// this.arr3 = decodeURIComponent(options) key: 'token',
// this.arr4 = options; success(e) {
// let arr = []; app.globalData.token = e.data;
// for (let s of options) { }
// const item = { })
// key: s, },
// value: options[s] fail: res => {}
// } })
// arr.push(item);
// }
// this.arr5 = arr;
// }
}, },
methods: { methods: {
// //
@ -47,13 +37,9 @@
tn: '554191640461075760517', tn: '554191640461075760517',
mode:'00', mode:'00',
success: function(res) { success: function(res) {
console.log('======='+res)
this.arr6 = JSON.stringify(res);
// , // ,
}, },
fail: function(err) { fail: function(err) {
console.log('======='+err)
this.arr6 = JSON.stringify(err.msg);
// , err.msg , TN, // , err.msg , TN,
} }
}); });

Loading…
Cancel
Save