|
|
@@ -1,7 +1,7 @@ |
|
|
|
<!-- |
|
|
|
* @Date: 2022-03-29 16:57:58 |
|
|
|
* @LastEditors: JinxChen |
|
|
|
* @LastEditTime: 2023-02-25 18:14:46 |
|
|
|
* @LastEditTime: 2023-02-26 10:37:08 |
|
|
|
* @FilePath: \TelpoH5FrontendWeb\src\views\package-list\index.vue |
|
|
|
* @description: TODO 小台风充值h5 |
|
|
|
--> |
|
|
@@ -15,10 +15,10 @@ |
|
|
|
<!-- 灰色线条 --> |
|
|
|
<div class="gray-line"></div> |
|
|
|
<!-- 套餐说明 --> |
|
|
|
<div class="order-description" v-show="packageOrderList.length"> |
|
|
|
<!-- <div class="order-description" v-show="packageOrderList.length"> |
|
|
|
<h5>套餐说明:</h5> |
|
|
|
<h5>每月200分钟通话时长,1G流量。</h5> |
|
|
|
</div> |
|
|
|
</div> --> |
|
|
|
<!-- 套餐列表 --> |
|
|
|
<div class="topup-container"> |
|
|
|
<div class="main"> |
|
|
@@ -39,7 +39,7 @@ |
|
|
|
:key="index" |
|
|
|
> |
|
|
|
<!-- 推荐 --> |
|
|
|
<div class="recom" v-show="index === 0"> |
|
|
|
<div class="recom" v-show="false"> |
|
|
|
<div class="shape"></div> |
|
|
|
<div class="square"> |
|
|
|
<p>推荐</p> |
|
|
@@ -63,11 +63,40 @@ |
|
|
|
<div class="buy-btn" @click="onBuy(item)"> |
|
|
|
<p>话费充值</p> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div class="remark"> |
|
|
|
<p>每月200分钟通话时长,1G流量。</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- 底部支付类型选择 --> |
|
|
|
<div class="pay-radios"> |
|
|
|
<div class="radios-con"> |
|
|
|
<van-radio-group v-model="radio" direction="horizontal" @change="onRaidoChange"> |
|
|
|
<van-radio name="1"> |
|
|
|
<template #default> |
|
|
|
<span>微信支付</span> |
|
|
|
<!-- <img src="../../assets/wx_pay_icon.png"/> --> |
|
|
|
</template> |
|
|
|
</van-radio> |
|
|
|
<van-radio name="2"> |
|
|
|
<template #default> |
|
|
|
<span>支付宝</span> |
|
|
|
<!-- <img src="../../assets/alipay.png"/> --> |
|
|
|
</template> |
|
|
|
</van-radio> |
|
|
|
<van-radio name="3"> |
|
|
|
<template #default> |
|
|
|
<span>花呗</span> |
|
|
|
<!-- <img src="../../assets/antpay.png"/> --> |
|
|
|
</template> |
|
|
|
</van-radio> |
|
|
|
</van-radio-group> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
@@ -84,7 +113,17 @@ export default { |
|
|
|
return { |
|
|
|
topupTitle: "请选择套餐充值激活电话卡", |
|
|
|
wxItem: "", |
|
|
|
packageOrderList: [], |
|
|
|
packageOrderList: [ |
|
|
|
{ |
|
|
|
packageName: '移动语音卡套餐(1年)', |
|
|
|
packagePayType: 1, |
|
|
|
packagePrice: 240, |
|
|
|
packageIssue: 12, |
|
|
|
payWxPayProductId: process.env.NODE_ENV === "production" ? '1629407413618294784' : '1629405716684029952', //微信支付 |
|
|
|
payAliPayProductId: process.env.NODE_ENV === "production" ? '1629407413618294784' : '1629405716684029952', //支付宝全额支付 |
|
|
|
payAntPayProductId: process.env.NODE_ENV === "production" ? '1629407705558630400': '1629405558344859648', //支付宝花呗支付 |
|
|
|
} |
|
|
|
], |
|
|
|
outTradeNo: "", //订单号 |
|
|
|
price: "", //价格, |
|
|
|
isShowNoData: false, //是否显示无套餐内容, 默认false |
|
|
@@ -95,6 +134,10 @@ export default { |
|
|
|
appId: '', |
|
|
|
|
|
|
|
}, |
|
|
|
radio: '1', |
|
|
|
payProductId: null, |
|
|
|
packageIssue: null, |
|
|
|
payType: '1', |
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: { |
|
|
@@ -108,7 +151,7 @@ export default { |
|
|
|
created() { |
|
|
|
this.getParams(); |
|
|
|
this.getWxAutograph(); |
|
|
|
this.getLiveBasePackage(); |
|
|
|
/* this.getLiveBasePackage(); */ |
|
|
|
}, |
|
|
|
/* mounted() { |
|
|
|
this.getParams(); |
|
|
@@ -197,7 +240,8 @@ export default { |
|
|
|
.catch(error => { |
|
|
|
this.$dialog.confirm({ |
|
|
|
title: "获取套餐数据失败", |
|
|
|
message: error |
|
|
|
message: error, |
|
|
|
showCancelButton: false, |
|
|
|
}); |
|
|
|
}) |
|
|
|
.finally(() => { |
|
|
@@ -243,18 +287,26 @@ export default { |
|
|
|
}, |
|
|
|
// 话费充值 |
|
|
|
onBuy(data) { |
|
|
|
let payType = data.packagePayType; |
|
|
|
this.price = data.packagePrice; |
|
|
|
// 需要区分是要用微信支付还是支付宝花呗支付 |
|
|
|
if (payType === 2) { |
|
|
|
if (this.payType === '2') { |
|
|
|
this.payProductId = process.env.NODE_ENV === "production" ? '1629407413618294784' : '1629405716684029952', //支付宝全额支付 |
|
|
|
this.packageIssue = 1; |
|
|
|
this.aliPay(data); |
|
|
|
} else if (this.payType === '3') { |
|
|
|
this.payProductId = process.env.NODE_ENV === "production" ? '1629407705558630400': '1629405558344859648', //支付宝花呗支付 |
|
|
|
this.packageIssue = 12; |
|
|
|
this.payType = '2' |
|
|
|
this.aliPay(data); |
|
|
|
} else { |
|
|
|
let openId = this.$store.getters.openId; |
|
|
|
if(openId === null || openId === 'null') { |
|
|
|
this.$dialog.confirm({ |
|
|
|
message: '微信支付在调整中,请选择其它支付方式' |
|
|
|
message: '微信支付在调整中,请选择其它支付方式', |
|
|
|
showCancelButton: false, |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.packageIssue = 1; |
|
|
|
this.wxPay(data); |
|
|
|
console.log("openid为空"); |
|
|
|
} |
|
|
@@ -270,10 +322,10 @@ export default { |
|
|
|
let reqBody = { |
|
|
|
openId: this.$store.getters.openId, //openId |
|
|
|
imei: this.params.imei, //imei |
|
|
|
productId: data.pechargeUrl, //套餐id |
|
|
|
packageName: data.productModel + ',' + data.packageName, //套餐名字 |
|
|
|
packagePayType: data.packagePayType, //支付类型 |
|
|
|
packageIssue: data.packageIssue, //分期 |
|
|
|
productId: this.payProductId, //套餐id |
|
|
|
packageName: /* data.productModel */ + ',' + data.packageName, //套餐名字 |
|
|
|
packagePayType: Number(this.payType), //支付类型 |
|
|
|
packageIssue: this.packageIssue, //分期 |
|
|
|
packagePrice: process.env.NODE_ENV === "production" ? data.packagePrice * 100 : 1 //总金额单位为分,测试环境写死 |
|
|
|
}; |
|
|
|
APICore.payLiveBaseDevice(reqBody) |
|
|
@@ -320,7 +372,7 @@ export default { |
|
|
|
iccid: that.params.iccid, |
|
|
|
isAdmin: that.$route.query.isAdmin || false, |
|
|
|
serialNo: that.params.imei, |
|
|
|
issue: data.packageIssue |
|
|
|
issue: that.packageIssue |
|
|
|
} |
|
|
|
}); |
|
|
|
console.log("微信支付成功::", res); |
|
|
@@ -358,10 +410,10 @@ export default { |
|
|
|
let reqBody = { |
|
|
|
openId: this.$store.getters.openId, //openId |
|
|
|
imei: this.params.imei, //imei |
|
|
|
productId: data.pechargeUrl, //套餐id |
|
|
|
packageName: data.productModel + ',' + data.packageName, //套餐名字 |
|
|
|
packagePayType: data.packagePayType, //支付类型 |
|
|
|
packageIssue: data.packageIssue, //分期 |
|
|
|
productId: this.payProductId, //套餐id |
|
|
|
packageName: /* data.productModel + ',' + */data.packageName, //套餐名字 |
|
|
|
packagePayType: Number(this.payType), //支付类型 |
|
|
|
packageIssue: this.packageIssue, //分期 |
|
|
|
packagePrice: process.env.NODE_ENV === "production" ? data.packagePrice * 100 : 1 //总金额单位为分,测试环境写死 |
|
|
|
}; |
|
|
|
this.$toast.clear(); |
|
|
@@ -379,7 +431,7 @@ export default { |
|
|
|
let alipayForm = decodeURI(alipayData.payXmlStr); |
|
|
|
that.$store.commit("isFromWx", true); |
|
|
|
let alipayUserId = process.env.NODE_ENV === "production" ? 42 : 18 |
|
|
|
this.$router.push({ |
|
|
|
this.$router.replace({ |
|
|
|
name: "payResult", |
|
|
|
query: { |
|
|
|
rechargeUrl: |
|
|
@@ -392,7 +444,7 @@ export default { |
|
|
|
isAdmin: that.$route.query.isAdmin || false, |
|
|
|
serialNo: that.params.imei, |
|
|
|
alipayUserId: alipayUserId, |
|
|
|
productId: data.pechargeUrl |
|
|
|
productId: this.payProductId |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
@@ -413,6 +465,10 @@ export default { |
|
|
|
return "2" |
|
|
|
/* break; */ |
|
|
|
} |
|
|
|
}, |
|
|
|
onRaidoChange(value) { |
|
|
|
console.log("选择的支付类型是", value); |
|
|
|
this.payType = value; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
@@ -476,7 +532,7 @@ export default { |
|
|
|
} |
|
|
|
.package-order-container { |
|
|
|
position: relative; |
|
|
|
height: 120px; |
|
|
|
height: 140px; |
|
|
|
width: 300px; |
|
|
|
padding: 5px 20px; |
|
|
|
margin: 10px 0; |
|
|
@@ -555,6 +611,14 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.remark { |
|
|
|
display: flex; |
|
|
|
justify-content: flex-start; |
|
|
|
p { |
|
|
|
font-size: 14px; |
|
|
|
/* font-weight: bold; */ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.content { |
|
|
|
font-size: 14px; |
|
|
@@ -580,5 +644,23 @@ export default { |
|
|
|
padding: 10px 0 0 0; |
|
|
|
} |
|
|
|
} |
|
|
|
.pay-radios { |
|
|
|
position: absolute; |
|
|
|
bottom: 0; |
|
|
|
width: 100%; |
|
|
|
/* background-color: red; */ |
|
|
|
/* padding: 0 15px; */ |
|
|
|
.radios-con { |
|
|
|
padding: 20px 10px; |
|
|
|
@include center(); |
|
|
|
font-size: 18px; |
|
|
|
box-shadow: rgba(14, 30, 37, 0.12) 0 3px 5px 0, |
|
|
|
rgba(14, 30, 37, 0.32) 0 2px 16px 0; |
|
|
|
img { |
|
|
|
height: 35px; |
|
|
|
width: auto; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |