使用优惠券购买权证流程调整新增支付成功提示页面

This commit is contained in:
唐明明
2021-09-18 15:17:31 +08:00
parent bab69de284
commit 7ebb45e5ab
8 changed files with 754 additions and 194 deletions

View File

@@ -148,7 +148,7 @@
<image @click="serveClose" class="close" src="../../static/icons/goods_close.png" mode=""></image>
</view>
<view class="serve-cont">
<view class="serve-label" v-for="(item, index) in goodsObj.services">
<view class="serve-label" v-for="(item, index) in goodsObj.services" :key="index">
<view class="serve-label-name">
{{item.name}}
</view>
@@ -180,7 +180,7 @@
};
},
created() {
goods(this.$Route.query.id || 16).then(res=>{
goods(this.$Route.query.id || 9).then(res=>{
this.loding = false
this.goodsObj = res
this.identity = res.identity.id || ''
@@ -236,10 +236,20 @@
// 领取优惠券
drawCoupons(id){
console.log(id)
let token = this.$store.getters.getToken
if(token == ''){
let userLogin = new userAuth()
userLogin.Login()
return
}
managesCoupons(id).then(res=>{
console.log(res)
})
}).catch(err => {
uni.showToast({
icon : 'none',
title: err.message
})
})
},
// 选择优惠券-显示

View File

@@ -23,9 +23,9 @@
<block v-if="coupons.length > 0">
<view class="item">
<label>使用优惠券</label>
<picker>
<picker mode="selector" :range="coupons" range-key="title" :value="couponIndex" @change="couponsChange">
<view class="picker-text nowrap">
优惠券
{{couponIndex == 0 ? '选择优惠券' : coupons[couponIndex].title}}
<uni-icons type="arrowright" color="#ddd"></uni-icons>
</view>
</picker>
@@ -35,6 +35,10 @@
<view class="price nowrap">-{{couponPrice}}</view>
</view>
</block>
<view class="item">
<label>实际支付金额</label>
<view class="price nowrap">{{total}}</view>
</view>
</view>
<!-- 支付方式 -->
<radio-group class="pay-group" @change="payType">
@@ -71,6 +75,8 @@
amount : 0,
total : 0,
coupons : [],
couponIndex : 0,
couponId : '',
account : {},
payValue : 'eb',
}
@@ -78,16 +84,15 @@
created(){
buy({
goods_sku_id: this.$Route.query.skuId,
qty : this.$Route.query.qty,
qty : this.qty,
type : 1
}, 'GET').then(res=>{
this.loding = true
this.qty = this.$Route.query.qty,
this.payValue = this.$Route.query.type === 1 ? 'wx' : 'eb'
this.detail = res.detail
this.couponPrice = res.coupon_price
this.amount = res.amount
this.total = res.total
this.couponPrice = res.coupon_price.toFixed(2)
this.amount = res.amount.toFixed(2)
this.total = res.total.toFixed(2)
this.coupons = res.coupons
this.account = res.account
}).catch(err =>{
@@ -98,6 +103,35 @@
})
},
methods: {
// 获取可用优惠券
getCoupons(){
buy({
goods_sku_id : this.$Route.query.skuId,
qty : this.qty,
type : 1,
coupon_grant_id : this.couponId
}, 'GET').then(res=>{
this.couponPrice = res.coupon_price.toFixed(2)
this.amount = res.amount.toFixed(2)
this.total = res.total.toFixed(2)
this.coupons = [{
title : '不使用',
coupon_grant_id : ''
}, ...res.coupons]
}).catch(err =>{
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 选择优惠券
couponsChange(e){
this.couponIndex = e.detail.value
this.couponId = this.coupons[e.detail.value].coupon_grant_id
this.getCoupons()
},
// 选择支付类型
payType(e){
this.payValue = e.detail.value
},
@@ -105,17 +139,20 @@
//数量变化
numberChange(e){
this.qty = e
this.amount = this.detail[0].items[0].price * e
this.getCoupons()
},
// 提交订单
buyOrder(){
buy({
goods_sku_id: this.$Route.query.skuId || 23,
qty : this.qty,
type : this.payValue == 'eb' ? 1 : 2,
remark : 'app订单'
goods_sku_id : this.$Route.query.skuId,
qty : this.qty,
coupon_grant_id : this.couponId,
type : 1,
remark : 'app订单易货产品',
channel : 'app'
}, 'POST').then(res=>{
console.log(res)
switch (this.payValue){
case 'eb':
this.ebPay(res.order_no)
@@ -131,6 +168,7 @@
break;
}
}).catch(err =>{
console.log(err)
uni.showToast({
title: err.message,
icon : 'none'
@@ -147,14 +185,20 @@
// 易币支付
ebPay(orderNo){
eb(orderNo).then(res => {
uni.showModal({
title: '提示',
content: '支付成功,后续优化支付成功后直接转跳我的权证'
this.$Router.replace({
name : 'payResults',
params : {
index: 1,
price: this.total,
type : 'eb',
total: '可在我的资产下我的权证中查看购买的数字权证'
}
})
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
uni.showModal({
title : '支付提示',
content : err.message,
showCancel : false,
})
})
}

76
pages/pay/results.vue Normal file
View File

@@ -0,0 +1,76 @@
<template>
<view class="total vertical">
<uni-icons type="checkbox-filled" size="60" color="#e93340"></uni-icons>
<view class="title">支付成功</view>
<view class="price">支付金额<text>{{type}}10.00</text></view>
<view class="text">{{total}}</view>
<button class="btn" type="default" @click="onBack">确定</button>
</view>
</template>
<script>
export default {
data() {
return {
index: 1, // 返回层级
price: 0, // 支付金额
type : '¥', // 支付币种
total: '' // 支付提示语
};
},
created() {
this.index = this.$Route.query.index
this.price = this.$Route.query.price
this.type = this.$Route.query.type === 'eb' ? 'EB': '¥'
this.total = this.$Route.query.total
},
methods:{
onBack(){
this.$Router.back(this.index)
}
}
}
</script>
<style lang="scss" scoped>
.total{
text-align: center;
height: 100vh;
width: 100vw;
padding-left: 10vw;
padding-right: 10vw;
padding-bottom: 20vh;
box-sizing: border-box;
.title{
font-weight: bold;
font-size: $title-size + 10;
padding: 20rpx 0
}
.price{
font-size: $title-size-lg;
color: $text-gray;
text{
color: $text-price;
padding-left: 10rpx;
}
}
.text{
font-size: $title-size-lg;
color: $text-gray;
padding-top: $padding;
}
.btn{
height: 90rpx;
line-height: 90rpx;
border-radius: 0;
background: $text-price;
font-size: $title-size;
color: white;
font-weight: bold;
margin-top: 10vh;
&::after{
border: none;
}
}
}
</style>

View File

@@ -64,6 +64,7 @@
page:this.page
}
mallWarrants(data).then(res=>{
console.log(res)
this.lists = this.lists.concat(res.data)
this.total = res.total
}).catch(err=>{