修正日行一善
This commit is contained in:
@@ -69,7 +69,8 @@
|
||||
</div>
|
||||
<ul class="spec">
|
||||
<li class="random">
|
||||
<span class="border-circle" @click="showRandom = true">随喜</span>
|
||||
<!-- <span class="border-circle" @click="showRandom = true">随喜</span>-->
|
||||
<span class="border-circle" @click="onCustomeBrike">随喜</span>
|
||||
</li>
|
||||
<li v-for="(spec, index) in data.spec" :key="index">
|
||||
<span class="border-circle" :class="[Number(spec.money) === priceUnit && 'active', isDisabled(spec)]" @click="onPriceUnit(spec)">{{spec.money}}元</span>
|
||||
@@ -86,7 +87,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>
|
||||
@@ -143,9 +144,10 @@
|
||||
</safe-area>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</van-popup>
|
||||
<random-money :value.sync="showRandom"></random-money>
|
||||
|
||||
<!-- 随喜金额 -->
|
||||
<random-money :value.sync="showRandom" @change="onRandomNext"></random-money>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -172,7 +174,6 @@ export default {
|
||||
for(let i in query){
|
||||
query[i] = query[i].toString()
|
||||
}
|
||||
console.log(query)
|
||||
let onlySpecs = query.spec_ids ? query.spec_ids.split(',').map(v => Number(v)) : null;
|
||||
|
||||
return {
|
||||
@@ -222,21 +223,29 @@ export default {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
isDisabled(spec){
|
||||
const { id } = spec;
|
||||
if(!this.onlySpecs) return false;
|
||||
return !this.onlySpecs.includes(id) ? 'spec-disabled': ''
|
||||
},
|
||||
getSelectedSpec() {
|
||||
if(this.query.goods_type === '2'){
|
||||
const { goods_type } = this.query;
|
||||
if(goods_type === '2' || goods_type === '1'){
|
||||
// 随喜
|
||||
if(this.is_assign){
|
||||
return {
|
||||
specId: '',
|
||||
specName: this.data.rule_btn
|
||||
specName: goods_type === '1' ? '随喜': this.data.rule_btn
|
||||
}
|
||||
}
|
||||
const spec = this.data.spec.find(item => item.id === this.priceUnitId);
|
||||
if(!spec){
|
||||
return {
|
||||
specId: '',
|
||||
specName: ''
|
||||
}
|
||||
}
|
||||
return {
|
||||
specId: spec.id,
|
||||
specName: spec.spec_name,
|
||||
@@ -258,12 +267,14 @@ export default {
|
||||
await this.getDynamicDataByGoodsId(goods_id);
|
||||
this.data = response;
|
||||
if(!this.onlySpecs){
|
||||
this.priceUnit = this.data.spec[0].donate_number * Number(this.data.price)
|
||||
this.priceUnitId = this.data.spec[0].id;
|
||||
const { donate_number, money, id } = this.data.spec[0];
|
||||
const priceUnit = donate_number || money;
|
||||
this.priceUnit = Number(priceUnit) * Number(this.data.price)
|
||||
this.priceUnitId = id;
|
||||
}
|
||||
},
|
||||
async getDynamicDataByGoodsId(goods_id){
|
||||
const res = await getDynamicData(1, goods_id);
|
||||
const res = await getDynamicData(1, 1, goods_id);
|
||||
this.goodsDynamicList = res.results;
|
||||
},
|
||||
onMoreProcess() {
|
||||
@@ -278,14 +289,19 @@ export default {
|
||||
},
|
||||
// 设置行善单价
|
||||
onPriceUnit({id, money}){
|
||||
this.is_assign = false;
|
||||
this.priceUnit = Number(money);
|
||||
this.priceUnitId = id;
|
||||
this.buy_quantity = 1;
|
||||
if(this.query.goods_type === '2'){
|
||||
this.is_assign = false;
|
||||
}
|
||||
this.spec_id = '';
|
||||
},
|
||||
onRandomNext({ money}){
|
||||
this.anyPrice = money;
|
||||
this.priceUnit = money;
|
||||
this.onToPay();
|
||||
},
|
||||
onToPay(){
|
||||
// 不需要跳转到功德芳名
|
||||
if(this.query.goods_type === '1'){
|
||||
this.$router.push({
|
||||
name: 'pay',
|
||||
@@ -294,10 +310,12 @@ export default {
|
||||
is_auto: this.is_auto ? 1 : 0,
|
||||
spec_id: this.priceUnitId,
|
||||
friendly_time: this.monthQuantity,
|
||||
title: this.title,
|
||||
subTitle: this.data.spec.find(item => item.id === this.priceUnitId).spec_name,
|
||||
title: this.data.name,
|
||||
subTitle: '日行一善捐赠',
|
||||
quantity: 1,
|
||||
amount: this.priceTotal,
|
||||
is_customized: 0,
|
||||
is_customized: this.is_assign ? 1 : 0,
|
||||
price: this.priceUnit,
|
||||
from: 'friendly_day', // 标识为日行一善
|
||||
}
|
||||
})
|
||||
@@ -315,7 +333,8 @@ export default {
|
||||
title: this.data.name,
|
||||
subTitle: this.getSelectedSpec().specName,
|
||||
amount: this.priceTotal,
|
||||
is_customized: 0,
|
||||
is_customized: this.is_assign ? 1 : 0,
|
||||
price: this.priceUnit,
|
||||
buy_quantity: this.buy_quantity,
|
||||
from: 'brike', // 标识为填砖加瓦
|
||||
}
|
||||
@@ -327,8 +346,10 @@ export default {
|
||||
},
|
||||
// 自定义砖数
|
||||
onCustomeBrike(){
|
||||
this.priceUnit = Number(this.data.price);
|
||||
this.priceUnit = Number(this.data.price) || 0;
|
||||
this.buy_quantity = 1;
|
||||
this.is_assign = true;
|
||||
this.showRandom = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user