|
@@ -3,7 +3,9 @@
|
|
|
<view class="mall-recharge">
|
|
|
<view class="white-box">
|
|
|
<view class="account-text">充值账号</view>
|
|
|
- <u-input class="account-name" v-model="phone" type="text" maxlength="11" placeholder="请输入手机号" placeholder-style="font-size:32rpx;font-weight:400" fontSize="56rpx" :customStyle="{ padding: '0'}" clearable></u-input>
|
|
|
+ <u-input class="account-name" v-model="phone" type="text" maxlength="11" placeholder="请输入手机号"
|
|
|
+ placeholder-style="font-size:32rpx;font-weight:400" fontSize="56rpx" :customStyle="{ padding: '0'}"
|
|
|
+ clearable></u-input>
|
|
|
</view>
|
|
|
<view v-if="phone" class="tip flex aic">
|
|
|
<re-image imgSrc="/retail/mall/ic_tip.png" width="28" height="28"></re-image>
|
|
@@ -22,13 +24,14 @@
|
|
|
</view>
|
|
|
<view>
|
|
|
<span class="price-text">¥</span>
|
|
|
- <span class="price-num">{{data.discountPrice}}</span>
|
|
|
+ <span class="price-num">{{data.price}}</span>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="info-msg flex jcsb aic">
|
|
|
<view class="msg-left">
|
|
|
- <span class="zeng" v-if="data.additionalGameCurrency || data.grabTimes">赠</span>
|
|
|
- <span class="game-num" v-if="data.additionalGameCurrency">{{data.additionalGameCurrency}}游戏币</span>
|
|
|
+ <span class="zeng" v-if="data.additionalGameCurrency || data.grabTimes">赠</span>
|
|
|
+ <span class="game-num"
|
|
|
+ v-if="data.additionalGameCurrency">{{data.additionalGameCurrency}}游戏币</span>
|
|
|
<!-- <span class="og">
|
|
|
<span class="${additionalGameCurrency && trafficSize ? 'show' : 'hide'}">+</span>
|
|
|
<span class="bold ${trafficSize ? 'show' : 'hide'}">2M</span>
|
|
@@ -87,41 +90,84 @@
|
|
|
<!-- 支付按钮 -->
|
|
|
<view class="btn-wrapper">
|
|
|
<view id="checkBox" class="margin-bottom-17">
|
|
|
- <view class="check-text text-center">点击“确认支付”,即代表您已阅读并同意<span id="agreeEl" class="red">《用户购买协议》</span></view>
|
|
|
+ <view class="check-text text-center">点击“确认支付”,即代表您已阅读并同意<span id="agreeEl" class="red">《用户购买协议》</span>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class="btns flex jcsb aic safe-area-inset-bottom">
|
|
|
<view>
|
|
|
<span class="btn-price-text1">应付款:</span>
|
|
|
<span class="btn-price-text2">¥</span>
|
|
|
- <span class="price-num btn-price-num">{{data.discountPrice}}</span>
|
|
|
+ <span class="price-num btn-price-num">{{data.price}}</span>
|
|
|
</view>
|
|
|
<u-button class="primary-btn" id="buyBtn" @click="confirm()">确认支付</u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <!-- <u-popup :show="isPay" mode="center" :round="10">
|
|
|
+ <view class="white-box-pay">
|
|
|
+ <view class="title bold text-center">提示</view>
|
|
|
+ <view class="text">未完成支付请点击<span class="red">“继续支付”</span></view>
|
|
|
+ <view class="text">更换金额或支付方式请点击<span class="red">“取消支付”</span></view>
|
|
|
+ <view class="text">完成支付请点击<span class="red">“完成支付”</span></view>
|
|
|
+ <view class="btn flex jcc" @click="contPay">
|
|
|
+ <view class="primary-btn width100" id="payCon">继续支付</view>
|
|
|
+ </view>
|
|
|
+ <view class="btn flex jcc" @click="cancel">
|
|
|
+ <view class="normal-btn width100" id="cancelBtn">取消支付</view>
|
|
|
+ </view>
|
|
|
+ <view class="btn flex jcc" @click="enterPayRes">
|
|
|
+ <span class="line" id="enterPayRes">完成支付</span>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </u-popup> -->
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import { doPay,getPackageDetail } from '@/apis/main'
|
|
|
- import { wxPay } from '@/utils/pay.js'
|
|
|
+ import {
|
|
|
+ doPay,
|
|
|
+ getPackageDetail,
|
|
|
+ orderPolling
|
|
|
+ } from '@/apis/main'
|
|
|
+ import {
|
|
|
+ wxPay
|
|
|
+ } from '@/utils/pay.js'
|
|
|
+ import config from "@/config"
|
|
|
export default {
|
|
|
// components:{
|
|
|
// 'u-input': () => import('@/plugins/uview-ui/components/u-input')
|
|
|
// }
|
|
|
- data(){
|
|
|
- return{
|
|
|
- phone:'',
|
|
|
- id:'',
|
|
|
- data:'',
|
|
|
- date: ''
|
|
|
- }
|
|
|
-
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ phone: '',
|
|
|
+ id: '',
|
|
|
+ data: {},
|
|
|
+ date: '',
|
|
|
+ timer: null,
|
|
|
+ time: 1,
|
|
|
+ orderNo: '',
|
|
|
+ isPay:false,
|
|
|
+ wxOpenid:uni.getStorageSync('wxOpenid'),
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
- onLoad(params){
|
|
|
+ onLoad(params) {
|
|
|
this.id = params.id
|
|
|
+ this.orderNo = params.orderNo
|
|
|
this.getData()
|
|
|
this.getDate()
|
|
|
+ // if (params.orderNo) {
|
|
|
+ // this.orderNo = params.orderNo
|
|
|
+ // this.polling(params.id)
|
|
|
+ // }
|
|
|
},
|
|
|
methods: {
|
|
|
+ // getOrder(){
|
|
|
+ // let orderNo = uni.getStorageSync('orderNo')
|
|
|
+ // if(orderNo){
|
|
|
+ // this.polling(orderNo)
|
|
|
+ // removeStorageSync('orderNo')
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+
|
|
|
// 获取日期
|
|
|
getDate() {
|
|
|
let today = new Date();
|
|
@@ -133,42 +179,107 @@
|
|
|
},
|
|
|
async getData() {
|
|
|
uni.showLoading()
|
|
|
- const res = await getPackageDetail({id:this.id})
|
|
|
- if(res){
|
|
|
+ const res = await getPackageDetail({
|
|
|
+ id: this.id
|
|
|
+ })
|
|
|
+ if (res) {
|
|
|
this.data = res
|
|
|
}
|
|
|
uni.hideLoading();
|
|
|
|
|
|
},
|
|
|
// 确认支付
|
|
|
- async confirm(){
|
|
|
+ async confirm() {
|
|
|
+ if (!this.phone) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '手机号不能为空',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
uni.showLoading();
|
|
|
let params = {
|
|
|
- orderNo: '',
|
|
|
- packageId: '',
|
|
|
- payChannel: 1,
|
|
|
+ orderNo: this.orderNo,
|
|
|
+ packageId: this.id,
|
|
|
+ payChannel: 2,
|
|
|
payType: 1,
|
|
|
phone: this.phone,
|
|
|
+ wxOpenid: this.wxOpenid
|
|
|
}
|
|
|
const res = await doPay(params)
|
|
|
+ // let redirect_url = encodeURIComponent(
|
|
|
+ // `${config.wapUrl}pages/mall/mallRecharge/index?orderNo=${res.orderNo}`)
|
|
|
uni.hideLoading();
|
|
|
const payRes = await wxPay(res)
|
|
|
if (payRes) {
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pages/mall/mallSuccess/index`
|
|
|
+ this.polling(res.orderNo)
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: `/pages/mall/mallPay/index?mwebUrl=${res.mwebUrl}`
|
|
|
+ // })
|
|
|
+ }
|
|
|
+
|
|
|
+ // location.href = `${res.mwebUrl}&redirect_url=${redirect_url}`
|
|
|
+ },
|
|
|
+ // contPay(){
|
|
|
+ // confirm()
|
|
|
+ // },
|
|
|
+ // // 取消支付
|
|
|
+ // cancel(){
|
|
|
+ // this.isPay = false
|
|
|
+ // },
|
|
|
+ // // 完成支付
|
|
|
+ // async enterPayRes(no){
|
|
|
+ // const res = await orderPolling({
|
|
|
+ // orderNo: no
|
|
|
+ // })
|
|
|
+ // clearTimeout(timer)
|
|
|
+ // if(res.status === 1){
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: `/pages/mall/mallSuccess/index?gameCurrency=${this.data.gameCurrency}&price=${this.data.price}`
|
|
|
+ // })
|
|
|
+ // }else{
|
|
|
+ // uni.showToast({
|
|
|
+ // title:'还未支付成功'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // 获取支付状态
|
|
|
+ async polling(no) {
|
|
|
+ if (no) {
|
|
|
+ clearTimeout(this.timer)
|
|
|
+ const res = await orderPolling({
|
|
|
+ orderNo: no
|
|
|
})
|
|
|
+ if (res) {
|
|
|
+ if (res.status === 1) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/mall/mallSuccess/index?gameCurrency=${this.data.gameCurrency}&price=${this.data.price}`
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ clearTimeout(this.timer)
|
|
|
+ if (this.times <= 10) {
|
|
|
+ this.times++
|
|
|
+ this.timer = setTimeout(() => {
|
|
|
+ this.polling(no)
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.times = 1
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
// const data = reactive({
|
|
|
-
|
|
|
+
|
|
|
// })
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
.mall-recharge {
|
|
|
padding: 32rpx;
|
|
|
+
|
|
|
.white-box {
|
|
|
padding: 48rpx 48rpx 56rpx;
|
|
|
background-color: #fff;
|
|
@@ -189,28 +300,31 @@
|
|
|
line-height: 32rpx;
|
|
|
}
|
|
|
}
|
|
|
- .tip{
|
|
|
+
|
|
|
+ .tip {
|
|
|
font-size: 24rpx;
|
|
|
color: #8B8B8B;
|
|
|
margin-top: 16rpx;
|
|
|
margin-left: 46rpx;
|
|
|
- text{
|
|
|
+
|
|
|
+ text {
|
|
|
margin-left: 6rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.list-title {
|
|
|
- color: #363531;
|
|
|
- font-weight: bold;
|
|
|
- font-size: 36rpx;
|
|
|
- line-height: 36rpx;
|
|
|
- margin: 48rpx 0 32rpx;
|
|
|
-
|
|
|
- .title-line {
|
|
|
- width: 8rpx;
|
|
|
- height: 32rpx;
|
|
|
- background-color: #FF8800;
|
|
|
- margin-right: 10rpx;
|
|
|
- }
|
|
|
+ color: #363531;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 36rpx;
|
|
|
+ line-height: 36rpx;
|
|
|
+ margin: 48rpx 0 32rpx;
|
|
|
+
|
|
|
+ .title-line {
|
|
|
+ width: 8rpx;
|
|
|
+ height: 32rpx;
|
|
|
+ background-color: #FF8800;
|
|
|
+ margin-right: 10rpx;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.order-info {
|
|
@@ -259,7 +373,7 @@
|
|
|
font-weight: bold;
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
- .game-num{
|
|
|
+ .game-num {
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
}
|
|
@@ -374,16 +488,17 @@
|
|
|
color: #2C2B28;
|
|
|
font-weight: 500;
|
|
|
|
|
|
- .date-wrapper{
|
|
|
-
|
|
|
- }
|
|
|
- .wx-ctrl{
|
|
|
+ .date-wrapper {}
|
|
|
+
|
|
|
+ .wx-ctrl {
|
|
|
margin-top: 78rpx;
|
|
|
- .check-icon1-i{
|
|
|
+
|
|
|
+ .check-icon1-i {
|
|
|
width: 48rpx;
|
|
|
height: 48rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.margin-top-40 {
|
|
|
margin-top: 40rpx;
|
|
|
}
|
|
@@ -458,7 +573,7 @@
|
|
|
z-index: 200;
|
|
|
background-color: rgb(252, 252, 252);
|
|
|
border-top: 1rpx solid #eee;
|
|
|
- box-shadow: 0rpx -4rpx 8rpx 0rpx rgba(109,84,52,0.19);
|
|
|
+ box-shadow: 0rpx -4rpx 8rpx 0rpx rgba(109, 84, 52, 0.19);
|
|
|
|
|
|
.btn-price-text1 {
|
|
|
color: #2C2B28;
|
|
@@ -503,9 +618,11 @@
|
|
|
color: #FF6400;
|
|
|
}
|
|
|
}
|
|
|
- .btns{
|
|
|
+
|
|
|
+ .btns {
|
|
|
margin: 24rpx 0 8rpx;
|
|
|
}
|
|
|
+
|
|
|
.primary-btn {
|
|
|
width: 296rpx;
|
|
|
height: 96rpx;
|
|
@@ -517,5 +634,59 @@
|
|
|
margin: 0;
|
|
|
}
|
|
|
}
|
|
|
+ .white-box-pay {
|
|
|
+ width: 600rpx;
|
|
|
+ background-color: #fff;
|
|
|
+ padding: 60rpx;
|
|
|
+ // border-radius: 32rpx;
|
|
|
+
|
|
|
+ .red {
|
|
|
+ color: #FF591C;
|
|
|
+ }
|
|
|
+
|
|
|
+ .line {
|
|
|
+ text-decoration: underline;
|
|
|
+ font-size: 28rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .title {
|
|
|
+ font-size: 36rpx;
|
|
|
+ color: #333;
|
|
|
+ margin-bottom: 40rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .text {
|
|
|
+ margin-bottom: 20rpx;
|
|
|
+ font-size: 28rpx;
|
|
|
+ color: #666;
|
|
|
+ line-height: 40rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn {
|
|
|
+ margin-bottom: 20rpx;
|
|
|
+
|
|
|
+ }
|
|
|
+ .primary-btn {
|
|
|
+ font-size: 28rpx;
|
|
|
+ padding: 28rpx 60rpx;
|
|
|
+ background-color: #1890ff;
|
|
|
+ color: #fff;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ border-radius: 48rpx;
|
|
|
+ }
|
|
|
+ .normal-btn{
|
|
|
+ font-size: 28rpx;
|
|
|
+ padding: 28rpx 60rpx;
|
|
|
+ background-color: #fff;
|
|
|
+ color: #1890ff;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ border-radius: 48rpx;
|
|
|
+ border: 1px solid #1890ff;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|