|
|
@@ -3,14 +3,14 @@
|
|
|
<cus-header title='PERILL评估' bgColor="transparent"></cus-header>
|
|
|
<view class="info adfac">
|
|
|
<view class="info-left">
|
|
|
- <image :src="avatar"></image>
|
|
|
+ <image :src="userInfo.headUrl||avatar"></image>
|
|
|
</view>
|
|
|
<view class="info-right">
|
|
|
<view class="info-right-name adfac">
|
|
|
- <view class="text">{{'龙傲天'}}</view>
|
|
|
- <view class="version">{{'基础版'}}</view>
|
|
|
+ <view class="text">{{userInfo.realName||'游客'}}</view>
|
|
|
+ <view class="version">{{typeCfg[headData.type]||'基础版'}}</view>
|
|
|
</view>
|
|
|
- <view class="info-right-tip">可用次数:基础版{{0}}次,专业版{{0}}次</view>
|
|
|
+ <view class="info-right-tip">可用次数:基础版{{headData.basicCount||0}}次,专业版{{headData.proCount||0}}次</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="box adffc">
|
|
|
@@ -23,15 +23,17 @@
|
|
|
<view class="box-price-pre adffcac" :class="{'active':pindex===index}"
|
|
|
v-for="(item,index) in priceList" :key="index" @click="changePrice(item,index)">
|
|
|
<view class="box-price-pre-once" v-if="index===0">限时优惠</view>
|
|
|
- <view class="box-price-pre-times">{{item.times}}</view>
|
|
|
- <view class="box-price-pre-money"><span>¥</span>{{item.money}}<span v-if="index===priceList.length-1">/次</span></view>
|
|
|
- <view class="box-price-pre-bottom">{{item.tip}}</view>
|
|
|
+ <view class="box-price-pre-times">{{item.frequency<11?(item.frequency+'次'):'超过10次'}}</view>
|
|
|
+ <view class="box-price-pre-money"><span>¥</span>{{item.price}}<span v-if="item.frequency>10">/次</span></view>
|
|
|
+ <view class="box-price-pre-bottom">
|
|
|
+ {{item.frequency==1?'首次登录赠送1次':(item.frequency>10?('超过10次,¥'+item.price+'/次'):('¥'+(item.price/item.frequency)+'/次'))}}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="box-other adfacjb" v-if="pindex===priceList.length-1">
|
|
|
+ <view class="box-other adfacjb" v-if="frequency>10">
|
|
|
<view class="box-other-left">其他次数</view>
|
|
|
<view class="box-other-right">
|
|
|
- <cus-number-box :min="otherTimes" :number="otherTimes" @valueChange="valueChange"></cus-number-box>
|
|
|
+ <cus-number-box :min="min" :number="otherTimes" @valChange="valueChange"></cus-number-box>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -39,16 +41,17 @@
|
|
|
<view class="box-price adf">
|
|
|
<view class="box-price-pre adffcac" :class="{'active':pindex===index}"
|
|
|
v-for="(item,index) in priceList2" :key="index" @click="changePrice(item,index)">
|
|
|
- <view class="box-price-pre-once" v-if="index===0">限时优惠</view>
|
|
|
- <view class="box-price-pre-times">{{item.times}}</view>
|
|
|
- <view class="box-price-pre-money"><span>¥</span>{{item.money}}<span v-if="index===priceList2.length-1">/次</span></view>
|
|
|
- <view class="box-price-pre-bottom">{{item.tip}}</view>
|
|
|
+ <view class="box-price-pre-times">{{item.frequency<11?(item.frequency+'次'):'超过10次'}}</view>
|
|
|
+ <view class="box-price-pre-money"><span>¥</span>{{item.price}}<span v-if="item.frequency>10">/次</span></view>
|
|
|
+ <view class="box-price-pre-bottom">
|
|
|
+ {{item.frequency==1?'首次登录赠送1次':(item.frequency>10?('超过10次,¥'+item.price+'/次'):('¥'+(item.price/item.frequency)+'/次'))}}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="box-other adfacjb" v-if="pindex===priceList2.length-1">
|
|
|
+ <view class="box-other adfacjb" v-if="frequency>10">
|
|
|
<view class="box-other-left">其他次数</view>
|
|
|
<view class="box-other-right">
|
|
|
- <cus-number-box :min="otherTimes" :number="otherTimes" @valueChange="valueChange"></cus-number-box>
|
|
|
+ <cus-number-box :min="min" :number="otherTimes" @valChange="valueChange"></cus-number-box>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -64,7 +67,7 @@
|
|
|
<view class="box-btn adfacjb">
|
|
|
<view class="box-btn-left adfac">
|
|
|
<view class="box-btn-left-text">实付</view>
|
|
|
- <view class="box-btn-left-money adfac"><span>¥</span>{{590}}<span style="margin-left: 9rpx;">/{{10}}次</span></view>
|
|
|
+ <view class="box-btn-left-money adfac"><span>¥</span>{{sumPrice}}<span style="margin-left: 9rpx;">/{{times}}次</span></view>
|
|
|
</view>
|
|
|
<view class="box-btn-right" @click="confirmBuy">确认协议并购买</view>
|
|
|
</view>
|
|
|
@@ -77,49 +80,112 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
</view>
|
|
|
+ <WechatPay ref="wxPay" @confirmPay="toPay" @cancelPay="cancelPay"></WechatPay>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import CusNumberBox from '@/components/CusNumberBox/index.vue'
|
|
|
+ import WechatPay from '@/components/wechatPay/index.vue'
|
|
|
export default {
|
|
|
- components:{ CusNumberBox },
|
|
|
+ components:{ CusNumberBox, WechatPay },
|
|
|
data(){
|
|
|
return {
|
|
|
+ userInfo:null,
|
|
|
+ headData:null,
|
|
|
avatar:this.$imgBase+'avatar.png',
|
|
|
tabList:['基础版','专业版','专家版'],
|
|
|
+ typeCfg:{
|
|
|
+ 1:'基础版',
|
|
|
+ 2:'专业版',
|
|
|
+ 3:'专家版',
|
|
|
+ },
|
|
|
tindex:0,
|
|
|
- pindex:0,
|
|
|
- priceList:[
|
|
|
- {times:'1次',money:99,tip:'首次登录赠送1次'},
|
|
|
- {times:'5次',money:395,tip:'¥79/次'},
|
|
|
- {times:'10次',money:590,tip:'¥59/次'},
|
|
|
- {times:'超过10次',money:39,tip:'超过10次,¥39/次'}
|
|
|
- ],
|
|
|
- priceList2:[
|
|
|
- {times:'1次',money:199,tip:'首次登录赠送1次'},
|
|
|
- {times:'5次',money:795,tip:'¥155/次'},
|
|
|
- {times:'10次',money:1090,tip:'¥109/次'},
|
|
|
- {times:'超过10次',money:89,tip:'超过10次,¥89/次'}
|
|
|
- ],
|
|
|
- otherTimes:11
|
|
|
+ pindex:'',
|
|
|
+ frequency:0,
|
|
|
+ priceList:[],
|
|
|
+ priceList2:[],
|
|
|
+ min:11,
|
|
|
+ otherTimes:11,
|
|
|
+ price:0,
|
|
|
+ times:0,
|
|
|
+ sumPrice:0,
|
|
|
+ productId:'',
|
|
|
+ orderNo:'',
|
|
|
}
|
|
|
},
|
|
|
+ onLoad(options) {
|
|
|
+ if(uni.getStorageSync('userInfo')){
|
|
|
+ this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
|
|
|
+ this.getMyInfo(this.userInfo.id);
|
|
|
+ this.getList(this.tindex+1)
|
|
|
+ }
|
|
|
+ },
|
|
|
methods:{
|
|
|
+ getMyInfo(userId){
|
|
|
+ this.$api.get(`/wx/myCount/${userId}`,this.params).then(({data:res})=>{
|
|
|
+ if(res.code!==0) return this.$showToast(res.msg)
|
|
|
+ this.headData = res.data;
|
|
|
+ })
|
|
|
+ },
|
|
|
changeTab(index){
|
|
|
this.tindex = index;
|
|
|
- this.pindex = 0;
|
|
|
+ this.pindex = '';
|
|
|
this.otherTimes = 11;
|
|
|
+ this.price = 0;
|
|
|
+ this.times = 0;
|
|
|
+ this.sumPrice = 0;
|
|
|
+ this.getList(this.tindex+1)
|
|
|
+ },
|
|
|
+ getList(type){
|
|
|
+ this.$api.get(`/core/v2/queproduct/listByType/${type}`).then(({data:res})=>{
|
|
|
+ if(res.code!==0) return this.$showToast(res.msg)
|
|
|
+ if(type==1) this.priceList = res.data
|
|
|
+ else if(type==2) this.priceList2 = res.data
|
|
|
+ })
|
|
|
},
|
|
|
changePrice(item,index){
|
|
|
+ this.productId = item.id;
|
|
|
this.pindex = index;
|
|
|
+ this.frequency = item.frequency;
|
|
|
+ this.price = item.price;
|
|
|
+ this.times = item.frequency;
|
|
|
+ if(this.frequency>10){
|
|
|
+ this.otherTimes = 11;
|
|
|
+ this.sumPrice = this.price*this.otherTimes;
|
|
|
+ } else this.sumPrice = this.price;
|
|
|
},
|
|
|
valueChange(val){
|
|
|
this.otherTimes = val;
|
|
|
+ this.times = this.otherTimes;
|
|
|
+ this.sumPrice = this.price*this.otherTimes;
|
|
|
},
|
|
|
confirmBuy(){
|
|
|
- uni.navigateTo({
|
|
|
- url:'/pagesPublish/payResult'
|
|
|
+ this.$api.post('/que/order/createOrder',{
|
|
|
+ payAmount:this.sumPrice,
|
|
|
+ productId:this.productId,
|
|
|
+ totalAmount:this.sumPrice,
|
|
|
+ totalFrequency:this.times,
|
|
|
+ type:this.tindex+1,
|
|
|
+ userId:this.userInfo.id
|
|
|
+ }).then(({data:res})=>{
|
|
|
+ if(res.code!==0) return this.$showToast(res.msg)
|
|
|
+ this.orderNo = res.data;
|
|
|
+ this.$refs.wxPay.payShow = true;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toPay(){
|
|
|
+ this.$api.post('/pay/createOrder',{
|
|
|
+ orderNo:this.orderNo,
|
|
|
+ openId:this.userInfo.openId
|
|
|
+ }).then(({data:res})=>{
|
|
|
+ if(!res.hasOwnProperty('paySign')) return this.$showToast('支付失败')
|
|
|
+ this.$refs.wxPay.payShow = false;
|
|
|
+ this.$wxPay(res).then(result => {
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'/pagesPublish/payResult'
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
}
|