1.对接话费支付接口

master
杨杰 3 years ago
parent f86c251edb
commit 3203383262
  1. 16
      high-unionPay/App.vue
  2. 15
      high-unionPay/Utils/Api.js
  3. 2
      high-unionPay/pages/login/register.vue
  4. 194
      high-unionPay/pages/unionPay/recharge-centre/recharge-centre.vue
  5. BIN
      high-unionPay/static/img/unionimg/upay3.jpg

@ -5,15 +5,15 @@
// brestUrl: 'http://192.168.3.4:9302/brest',
// imgUrl: 'https://192.168.3.4:9301/filesystem/',
//
url: 'https://hsg.dctpay.com/crest',
imgUrl: 'https://hsg.dctpay.com/filesystem/',
brestUrl : 'https://hsg.dctpay.com/brest',
imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/',
// url: 'https://hsg.dctpay.com/crest',
// imgUrl: 'https://hsg.dctpay.com/filesystem/',
// brestUrl : 'https://hsg.dctpay.com/brest',
// imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/',
//
// url: 'https://hsgcs.dctpay.com/crest',
// brestUrl : 'https://hsgcs.dctpay.com/brest',
// imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
// imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/',
url: 'https://hsgcs.dctpay.com/crest',
brestUrl : 'https://hsgcs.dctpay.com/brest',
imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/',
userInfo: "",
brestUserInfo : '',
openId: '',

@ -157,6 +157,21 @@ export const getCmsContent = params => {
return POST('GET', `${base}/cmsContent/getCmsContent`, params).then(res => res.data);
}
//提交订单
export const addOrderPay = params => {
return POST('POST', `${base}/outRechargeOrder/addOrder`, params).then(res => res.data);
}
//话费充值查询
export const getListOutRechargePrice = params => {
return POST('GET', `${base}/outRechargePrice/getListOutRechargePrice`, params).then(res => res.data);
}
//提交订单
export const orderToUNionPay = params => {
return POST('POST', `${base}/outRechargeOrder/orderToPay`, params).then(res => res.data);
}
/**
* 工会卡
*/

@ -153,7 +153,7 @@
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsgcs.dctpay.com%2FH5%2Findex.html%23%2F&response_type=code&scope=snsapi_base&state=1#wechat_redirect'
} else {
uni.reLaunch({
url: '/pages/tabBar/home/home'
url: '../unionPay/unionPay-entrance/unionPay-entrance'
})
}

@ -12,32 +12,38 @@
选择金额
</view>
<view class="list">
<view class="box" :class="{'on':100 == inputAmount}" @click="select(100)">
<view class="heTitle">100</view>
</view>
<view class="box" :class="{'on':200 == inputAmount}" @click="select(200)">
<view class="heTitle">200</view>
</view>
<view class="box" :class="{'on':300 == inputAmount}" @click="select(300)">
<view class="heTitle">300</view>
<view class="box" :class="{'on':item.realPrice == inputAmount}" v-for="(item,index) in amountList"
@click="select(item)">
<view class="heTitle">{{item.realPrice}}</view>
</view>
</view>
<view class="bombtn width94 font16">
<view class="width50 flleft payem">应付: {{inputAmount}}</view>
<view class="width50 flright paybtn">立即购买</view>
<view class="width50 flright paybtn" @click="addOrderPay">立即购买</view>
</view>
</view>
</template>
<script>
// #ifdef H5
var jweixin = require('jweixin-module');
// #endif
let app = getApp();
import {
getListOutRechargePrice,
addOrderPay,
orderToUNionPay
} from '../../../Utils/Api.js';
export default {
data() {
return {
typeId: '',
inputAmountId: '',
inputAmount: '',
inputPhone:''
inputPhone: '',
amoutType: '',
codesVlues: '',
amountList: []
}
},
onLoad(options) {
@ -46,24 +52,174 @@
uni.setNavigationBarTitle({
title: '中国移动'
})
this.amoutType = 2;
this.getListOutRechargePrice(2);
return;
}
if (this.typeId == 2) {
uni.setNavigationBarTitle({
title: '中国联通'
title: '中国电信'
})
this.amoutType = 1;
this.getListOutRechargePrice(1);
return;
}
if (this.typeId == 3) {
uni.setNavigationBarTitle({
title: '中国电信'
title: '中国联通'
})
this.amoutType = 3;
this.getListOutRechargePrice(3);
return;
}
},
methods: {
select(amoutinfos) {
this.inputAmount = amoutinfos;
this.inputAmount = amoutinfos.realPrice;
this.inputAmountId = amoutinfos.id;
},
/**
* 查询价格
*/
getListOutRechargePrice(item) {
uni.showLoading({
title: '加载中...'
})
let params = {
type: item
}
getListOutRechargePrice(params).then(res => {
uni.hideLoading()
if (res.return_code == '000000') {
this.amountList = res.return_data;
}
})
},
/**
* 提交订单
*/
addOrderPay() {
if (this.inputPhone == '') {
uni.showToast({
title: '请输入充值号码',
icon: "none"
});
return;
}
if (this.inputAmount == '') {
uni.showToast({
title: '请选择价格',
icon: "none"
});
return false;
}
let params = {
"orderPrice": this.inputAmount,
"payPrice": this.inputAmount,
"rechargeContent": this.inputPhone,
"rechargeModel": this.amoutType,
"agentKey": this.codesVlues,
"objectId": this.inputAmountId,
}
uni.showLoading({
title: '加载中...'
})
addOrderPay(params).then(res => {
uni.hideLoading()
if (res.return_code == '000000') {
let params = {
"orderId": res.return_data.id,
"openId": app.globalData.openId
}
this.orderToUNionPay(params);
} else {
uni.showToast({
title: res.return_msg,
icon: "none"
})
}
})
},
//
orderToUNionPay(item) {
orderToUNionPay(item).then(res => {
if (res.return_code == '000000') {
//
// #ifdef H5
//
this.payRequest(res);
// #endif
} else {
uni.showToast({
title: res.return_msg,
icon: 'none'
})
}
})
},
//
payRequest: function(self) {
uni.showLoading({
title: '支付中...'
})
jweixin.config({
// 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) {
//
uni.showToast({
title: '支付成功'
})
if (that.jumpType == 4) {
uni.reLaunch({
url: '/pages/tabBar/user/user'
});
return;
}
uni.reLaunch({
url: '../success/success?id=' + that.couponId
});
},
cancel: function(r) {},
fail: function(res) {}
});
});
jweixin.error(function(res) {
uni.showToast({
icon: 'none',
title: '支付失败了',
duration: 4000
});
// configerrorconfigdebugresSPA
/*alert("config信息验证失败");*/
});
},
}
}
@ -119,12 +275,14 @@
font-size: 15px;
}
}
.bombtn{
.bombtn {
position: fixed;
height: 45px;
bottom: 20px;
border-radius: 6px;
.payem{
.payem {
height: 45px;
line-height: 45px;
text-align: center;
@ -133,7 +291,7 @@
border-radius: 6px 0 0 6px;
}
.paybtn{
.paybtn {
height: 45px;
line-height: 45px;
text-align: center;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 KiB

After

Width:  |  Height:  |  Size: 405 KiB

Loading…
Cancel
Save