待支付订单支付

This commit is contained in:
2021-11-30 16:54:05 +08:00
parent 00677377ca
commit bb9f67d3f8
26 changed files with 879 additions and 598 deletions
+42 -15
View File
@@ -105,14 +105,14 @@
<ul class="spec brick-spec">
<li class="random">
<span class="border-circle" :class="[is_assign && 'active']" @click="onCustomeBrike">{{data.rule_btn}}</span>
<van-stepper v-model="buy_quantity" step="1" />
<van-stepper v-model="buy_quantity" step="1" v-if="is_assign" />
</li>
<li v-for="(spec, index) in data.spec" :key="index">
<span
class="border-circle"
:class="[Number(spec.money) === priceUnit && !is_assign && 'active']"
@click="onPriceUnit(spec)"
>认捐{{spec.donate_number}}块砖 {{spec.money}}元</span>
>{{spec.spec_name}} {{spec.donate_number * Number(data.price)}}元</span>
</li>
</ul>
<div class="auto-donate">
@@ -126,7 +126,7 @@
<div class="donate">
<span class="label">行善时间</span>
<span class="time-cycle">
<van-stepper v-model="number" step="1" />
<van-stepper v-model="monthQuantity" step="1" />
<span class="unit">个月</span>
</span>
</div>
@@ -134,7 +134,7 @@
<div class="next-group-wrapper">
<safe-area>
<div class='next-group'>
<span class="total">合计:¥{{priceTotal}}</span>
<span class="total">合计:<em>¥{{priceTotal}}</em></span>
<button class="next" @click="onToPay">下一步</button>
</div>
</safe-area>
@@ -179,7 +179,7 @@ export default {
showSpec: false,
priceUnit: 0,
priceUnitId: '',
number: 1,
monthQuantity: 1,
is_assign: false, // 是否为自动认捐砖块数
buy_quantity: 1, // 自定义认捐砖块数
goodsDynamicList: [], // 商品动态列表
@@ -195,14 +195,17 @@ export default {
},
computed: {
priceTotal(){
if(this.is_auto){
return (parseInt(this.priceUnit * 100, 10) * this.number * 30) / 100
const { priceUnit, is_assign, is_auto, buy_quantity, monthQuantity } = this;
if(is_assign){
return (priceUnit * 100 * buy_quantity) / 100;
}
return (parseInt(this.priceUnit * 100, 10) * this.number) / 100;
if(is_auto){
return (priceUnit * 100 * monthQuantity * 30) / 100
}
return (priceUnit * 100 ) / 100;
}
},
mounted(){
console.log('query', this.query)
if(this.query.goods_type === '1'){
return this.getGoodsDetail('friendly');
}
@@ -212,6 +215,22 @@ export default {
},
methods: {
getSelectedSpec() {
if(this.query.goods_type === '2'){
// 随喜
if(this.is_assign){
return {
specId: '',
specName: this.data.rule_btn
}
}
const spec = this.data.spec.find(item => item.id === this.priceUnitId);
return {
specId: spec.id,
specName: spec.spec_name,
}
}
},
// 获取商品详情
/*
type = friendly: 获取日行一善商品
@@ -226,6 +245,7 @@ export default {
}
await this.getDynamicDataByGoodsId(goods_id);
this.data = response;
this.priceUnit = this.data.spec[0].donate_number * Number(this.data.price)
},
async getDynamicDataByGoodsId(goods_id){
const res = await getDynamicData(1, goods_id);
@@ -245,6 +265,7 @@ export default {
onPriceUnit({id, money}){
this.priceUnit = Number(money);
this.priceUnitId = id;
this.buy_quantity = 1;
if(this.query.goods_type === '2'){
this.is_assign = false;
}
@@ -257,9 +278,9 @@ export default {
...this.$route.query,
is_auto: this.is_auto ? 1 : 0,
spec_id: this.priceUnitId,
friendly_time: this.number,
friendly_time: this.monthQuantity,
title: this.title,
subTitle: this.data.name,
subTitle: this.data.spec.find(item => item.id === this.priceUnitId).spec_name,
amount: this.priceTotal,
is_customized: 0,
from: 'friendly_day', // 标识为日行一善
@@ -273,10 +294,11 @@ export default {
...this.$route.query,
is_auto: this.is_auto ? 1 : 0,
is_assign: this.is_assign ? 1 : 0,
spec_id: this.priceUnitId,
friendly_time: this.number,
title: this.title,
subTitle: this.data.name,
spec_id: this.getSelectedSpec().specId,
friendly_time: this.monthQuantity,
quantity: this.buy_quantity,
title: this.data.name,
subTitle: this.getSelectedSpec().specName,
amount: this.priceTotal,
is_customized: 0,
buy_quantity: this.buy_quantity,
@@ -425,6 +447,11 @@ export default {
.total{
font-size: .4rem;
em{
color: $primary-color;
font-size: .4rem;
font-weight: bold;
}
}
.next{
font-size: .4rem;