完成下单

This commit is contained in:
2021-11-26 14:00:23 +08:00
parent 29da9c7746
commit 84380ef55a
10 changed files with 673 additions and 31 deletions
+31 -8
View File
@@ -60,6 +60,9 @@
</div>
</div>
</van-popup>
<!-- 随喜金额-->
<random-money :value.sync="showAnyAmount" @change="onReceiveAnyAmount"></random-money>
</div>
</template>
@@ -78,8 +81,8 @@ export default {
FillInformation
},
data(){
return {
showAnyAmount: false,
paddingBottom: 0,
fixedBottomHeight: 0,
query: this.$route.query,
@@ -92,6 +95,7 @@ export default {
step: 0,
quantity: 1,
dreamInfo: null,
anyPrice: 0, // 随喜金额
swiperOption: {
autoplay: 8000,
initialSlide: 1,
@@ -112,6 +116,9 @@ export default {
},
computed: {
priceUnit(){
if(this.spec_id === 'is_customized'){
return this.anyPrice;
}
const spec = this.data.spec.find(item => item.id === this.spec_id);
if(!spec){
return 0;
@@ -129,24 +136,41 @@ export default {
this.getGoodsDetail('common');
},
methods: {
// 接收随喜金额
onReceiveAnyAmount(anyObj){
this.anyPrice = anyObj.money;
this.onNextStep();
},
// dreamInfo: 心愿信息
onDreamInfoChange(dreamInfo){
this.dreamInfo = dreamInfo;
},
getSelectedSpec(){
const spec = this.data.spec.find(spec => spec.id === this.spec_id);
return spec;
return spec || {
id: '',
spec_name: this.data.rule_btn || '随喜'
};
},
onNextStep(){
if(!this.spec_id){
this.$toast.fail('请选择类型')
return;
}
this.current += 1;
if(this.current === 1 && this.spec_id === 'is_customized'){
this.showAnyAmount = true;
return ;
}
const selectedSpec = this.getSelectedSpec();
if(this.current > 1){
const { merit_name_id, dream } = this.dreamInfo;
if(this.current > 0){
this.$router.push({
name: 'pay',
name: 'fill-name',
query: {
...this.$route.query,
...this.query,
is_auto: this.is_auto ? 1 : 0,
spec_id: selectedSpec.id,
friendly_time: this.number,
@@ -155,12 +179,11 @@ export default {
subTitle: selectedSpec.spec_name,
amount: this.priceTotal,
// merit_name_id: ,
dream,
merit_name_id,
is_customized: 0,
from: 'common_goods', // 标识为通用商品
}
})
}
},
async getGoodsDetail(type){