|
|
|
@ -15,7 +15,8 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="vip-box"> |
|
|
|
<view class="vip-box__item" :class="{'item-active':active == index}" @click="change(index)" v-for="(item,index) in vipList" :key="index"> |
|
|
|
<view class="vip-box__item" :class="{'item-active':active == index}" @click="change(index)" |
|
|
|
v-for="(item,index) in vipList" :key="index"> |
|
|
|
<view class="title"> |
|
|
|
{{item.vipName}} |
|
|
|
</view> |
|
|
|
@ -31,7 +32,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<button class="sumbit-btn"> |
|
|
|
<button class="sumbit-btn" @click="openVip" :disabled="disabled"> |
|
|
|
立即开通 |
|
|
|
</button> |
|
|
|
</view> |
|
|
|
@ -39,24 +40,69 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { |
|
|
|
queryUserVipList |
|
|
|
queryUserVipList, |
|
|
|
addVipOrder, |
|
|
|
unifiedOrder |
|
|
|
} from '@/api/userInfo.js' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
userInfo: null, |
|
|
|
vipList:[], |
|
|
|
active:0 |
|
|
|
vipList: [], |
|
|
|
active: 0, |
|
|
|
disabled: false |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
async getVipList() { |
|
|
|
const {data} = await queryUserVipList(); |
|
|
|
const { |
|
|
|
data |
|
|
|
} = await queryUserVipList(); |
|
|
|
this.vipList = data.data |
|
|
|
console.log(this.vipList) |
|
|
|
}, |
|
|
|
change(index){ |
|
|
|
change(index) { |
|
|
|
this.active = index |
|
|
|
}, |
|
|
|
async openVip() { |
|
|
|
let data = this.vipList[this.active]; |
|
|
|
let phone = this.userInfo |
|
|
|
if (!Object.keys(data).length) return |
|
|
|
this.disabled = true |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中..." |
|
|
|
}); |
|
|
|
const res_add = await addVipOrder({ |
|
|
|
vipId: data.id |
|
|
|
}) |
|
|
|
let orderNo = res_add.data.data; |
|
|
|
const res_uni = await unifiedOrder({ |
|
|
|
orderNo, |
|
|
|
sceneCode: 1, |
|
|
|
payType: 'dypay', |
|
|
|
}) |
|
|
|
let {orderId,orderToken} = res_uni.data.data.dyThirdInOrderVo |
|
|
|
this.tikPay(orderId,orderToken) |
|
|
|
|
|
|
|
}, |
|
|
|
tikPay(order_id, order_token) { |
|
|
|
tt.pay({ |
|
|
|
orderInfo: { |
|
|
|
order_id, |
|
|
|
order_token |
|
|
|
}, |
|
|
|
service: 5, |
|
|
|
success(res) { |
|
|
|
if (res.code == 0) { |
|
|
|
|
|
|
|
} |
|
|
|
uni.hideLoading(); |
|
|
|
this.disabled = false |
|
|
|
}, |
|
|
|
fail(res) { |
|
|
|
uni.hideLoading(); |
|
|
|
this.disabled = false |
|
|
|
}, |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
@ -127,7 +173,7 @@ |
|
|
|
|
|
|
|
.save-box { |
|
|
|
border-radius: 30rpx; |
|
|
|
width: 140rpx; |
|
|
|
width: 150rpx; |
|
|
|
height: 50rpx; |
|
|
|
background-color: #e8f4ff; |
|
|
|
font-size: 24rpx; |
|
|
|
@ -147,7 +193,7 @@ |
|
|
|
color: #fff; |
|
|
|
} |
|
|
|
|
|
|
|
.o-price{ |
|
|
|
.o-price { |
|
|
|
color: #eee; |
|
|
|
} |
|
|
|
|
|
|
|
|