1.新增话费充值参数

yj-dev
杨杰 3 years ago
parent 26eb855536
commit 60efa27c21
  1. 17
      pages.json
  2. 11
      subPages/recharge-centre/recharge-centre.vue
  3. 442
      subPages/trade-union-recharge/trade-union-recharge.vue

@ -473,15 +473,12 @@
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
} }
} }
], ],
"subpackages": [{ "subpackages": [{
"root": "subPages", "root": "subPages",
"pages": [ "pages": [{
{
"path": "coupon-comfirmation-success/coupon-comfirmation-success", "path": "coupon-comfirmation-success/coupon-comfirmation-success",
"style" : "style": {
{
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationBarTitleText": "支付成功", "navigationBarTitleText": "支付成功",
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
@ -633,6 +630,16 @@
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
} }
}, {
"path": "trade-union-recharge/trade-union-recharge",
"style": {
"navigationBarTitleText": "工会卡充值",
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#0083f5",
"backgroundColorTop": "#0083f5",
"navigationBarTextStyle": "white"
}
} }
] ]
}], }],

@ -133,8 +133,17 @@
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}) })
let showType;
// #ifdef H5
showType = 2;
// #endif
// #ifdef MP
showType = 1;
// #endif
let params = { let params = {
type: item type: item,
regionId: app.globalData.cityId,
showType: showType
} }
getListOutRechargePrice(params).then(res => { getListOutRechargePrice(params).then(res => {
uni.hideLoading() uni.hideLoading()

@ -0,0 +1,442 @@
<template>
<view>
<view class="block">
<view class="content">
<view class="my">
我的账户余额 {{tongCardPrice}} ( 1:100)
</view>
</view>
</view>
<view class="block">
<view class="title">
充值金额
</view>
<view class="content">
<view class="amount">
<view class="list">
<view class="box" v-for="(amount,index) in amountList" :key="index" @tap="select(amount)"
:class="{'on':amount == inputAmount}">
{{amount}}
</view>
</view>
<view class="num">
<view class="text">
自定义充值金额
</view>
<view class="input">
<input type="number" v-model="inputAmount" />
</view>
</view>
</view>
</view>
</view>
<view class="block">
<view class="title">
选择支付方式
</view>
<view class="content">
<view class="pay-list">
<!-- <view class="row" @tap="paytype='alipay'">
<view class="left">
<image src="/static/img/alipay.png"></image>
</view>
<view class="center">
支付宝支付
</view>
<view class="right">
<radio :checked="paytype=='alipay'" color="#0083f5" />
</view>
</view> -->
<view class="row" @tap="paytype='wxpay'">
<view class="left">
<image :src="imagewxUrl+imgadres"></image>
</view>
<view class="center">
微信支付
</view>
<view class="right">
<radio :checked="paytype=='wxpay'" color="#0083f5" />
</view>
</view>
</view>
</view>
</view>
<view class="pay">
<button class="btn" @tap="doDeposit">立即充值</button>
<view class="tis">
点击立即充值即代表您同意<view class="terms">
条款协议
</view>
</view>
</view>
</view>
</template>
<script>
let app = getApp()
import {
addOrder,
orderToPay,
getHuiLianTongCardBalance
} from "../../Utils/Api.js";
// #ifdef H5
var jweixin = require('jweixin-module');
// #endif
export default {
data() {
return {
inputAmount: '', //
amountList: [10, 50, 100], //3
paytype: 'wxpay', //
user: "",
imagewxUrl: app.globalData.imageWxImg,
imgadres: 'wxpay.png',
tongCardPrice: 0
};
},
onLoad() {
this.user = app.globalData.userInfo;
},
onShow() {
if (this.user.isSetHltCard) {
this.getHuiLianTongCardBalance();
}
},
methods: {
//
getHuiLianTongCardBalance() {
let params = {
cardNo: this.user.hltCardNo.cardNo
}
getHuiLianTongCardBalance(params).then(res => {
if (res.return_code == '000000') {
this.tongCardPrice = res.return_data.balance;
}
});
},
select(amount) {
this.inputAmount = amount;
},
doDeposit() {
if (!this.user.isSetHltCard) {
uni.showToast({
icon: 'none',
title: '当前账号还未绑定,前往绑定',
duration: 2000,
success() {
setTimeout(() => {
uni.navigateTo({
url: '../../pages/user/bindingCard/bindingCard'
})
}, 1000)
}
});
return;
}
if (parseFloat(this.inputAmount).toString() == "NaN") {
uni.showToast({
title: '请输入正确金额',
icon: 'none'
});
return;
}
if (this.inputAmount <= 0) {
uni.showToast({
title: '请输入大于0的金额',
icon: 'none'
});
return;
}
if (parseFloat(this.inputAmount).toFixed(2) != parseFloat(this.inputAmount)) {
uni.showToast({
title: '最多只能输入两位小数哦~',
icon: 'none'
});
return;
}
uni.showLoading({
title: '正在提交订单...'
})
let goods = {
"identificationCode": app.globalData.identificationCode,
"highChildOrderList": [{
"goodsType": 2,
"goodsId": app.globalData.userInfo.id,
"saleCount": 1,
"goodsPrice": this.inputAmount
}]
}
addOrder(goods).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
///
let params = {
"orderId": res.return_data.id,
"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({
icon: 'none',
title: '支付成功',
duration: 2000,
success() {
setTimeout(() => {
uni.navigateBack({
})
}, 1000)
}
});
},
fail: function(err) {
uni.hideLoading();
console.log('fail:' + JSON.stringify(err));
}
});
// #endif
//
// #ifdef H5
//
this.payRequest(res);
// #endif
} else {
uni.showToast({
title: '支付失败'
})
}
})
} else {
uni.showToast({
title: res.return_msg
});
}
})
},
payRequest: function(self) {
uni.showLoading({
title: '支付中...'
})
jweixin.config({
// debug: true, // ,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({
icon: 'none',
title: '支付成功',
duration: 2000,
success() {
setTimeout(() => {
uni.navigateBack({
})
}, 1000)
}
});
},
cancel: function(r) {},
fail: function(res) {}
});
});
jweixin.error(function(res) {
uni.showToast({
icon: 'none',
title: '支付失败了',
duration: 4000
});
});
},
},
}
</script>
<style lang="scss">
.block {
width: 94%;
padding: 20upx 3%;
.title {
width: 100%;
font-size: 34upx;
}
.content {
.my {
width: 100%;
height: 120upx;
display: flex;
align-items: center;
font-size: 30upx;
border-bottom: solid 1upx #eee;
}
.amount {
width: 100%;
.list {
display: flex;
justify-content: space-between;
padding: 20upx 0;
.box {
width: 30%;
height: 120upx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 10upx;
box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.05);
font-size: 36upx;
background-color: #f1f1f1;
color: 333;
&.on {
background-color: #0083f5;
color: #fff;
}
}
}
.num {
margin-top: 10upx;
display: flex;
justify-content: flex-end;
align-items: center;
.text {
padding-right: 10upx;
font-size: 30upx;
}
.input {
width: 28.2vw;
border-bottom: solid 2upx #999;
justify-content: flex-end;
align-items: center;
input {
margin: 0 20upx;
height: 60upx;
font-size: 30upx;
color: #0083f5;
justify-content: flex-end;
align-items: center;
}
}
}
}
.pay-list {
width: 100%;
border-bottom: solid 1upx #eee;
.row {
width: 100%;
height: 120upx;
display: flex;
align-items: center;
.left {
width: 100upx;
flex-shrink: 0;
display: flex;
align-items: center;
image {
width: 80upx;
height: 80upx;
}
}
.center {
width: 100%;
font-size: 30upx;
}
.right {
width: 100upx;
flex-shrink: 0;
display: flex;
justify-content: flex-end;
}
}
}
}
}
.pay {
margin-top: 20upx;
width: 100%;
display: flex;
justify-content: center;
flex-wrap: wrap;
.btn {
width: 70%;
height: 80upx;
border-radius: 80upx;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
background-color: #0083f5;
box-shadow: 0upx 5upx 10upx rgba(0, 0, 0, 0.2);
}
.tis {
margin-top: 10upx;
width: 100%;
font-size: 24upx;
display: flex;
justify-content: center;
align-items: baseline;
color: #999;
.terms {
color: #5a9ef7;
}
}
}
</style>
Loading…
Cancel
Save