...
|
...
|
@@ -66,16 +66,14 @@ export default { |
|
|
...mapState(['productDetail', 'address', 'fee', 'price', 'agree'])
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['fetchOrderAddress', 'fetchUserStatus', 'fetchOrderPrice']),
|
|
|
...mapActions(['fetchOrderAddress', 'fetchUserStatus', 'fetchOrderPrice', 'submitOrder', 'fetchPayList']),
|
|
|
...mapMutations([Types.CHANGE_PRICE, Types.CHANGE_AGREE]),
|
|
|
|
|
|
onClick() {
|
|
|
if (!this.error) {
|
|
|
this.$createOrderPayType().show();
|
|
|
}
|
|
|
this.submit();
|
|
|
},
|
|
|
compute() {
|
|
|
this.fetchOrderPrice({
|
|
|
return this.fetchOrderPrice({
|
|
|
address_id: this.address.address_id,
|
|
|
num: 1,
|
|
|
price: this.price,
|
...
|
...
|
@@ -89,6 +87,7 @@ export default { |
|
|
type: 'txt'
|
|
|
}).show();
|
|
|
}
|
|
|
this.error = false;
|
|
|
});
|
|
|
},
|
|
|
changePrice(val) {
|
...
|
...
|
@@ -97,10 +96,40 @@ export default { |
|
|
changeAgree(val) {
|
|
|
this[Types.CHANGE_AGREE](val);
|
|
|
},
|
|
|
submit() {
|
|
|
this.compute().then(result => {
|
|
|
async submit() {
|
|
|
await this.compute();
|
|
|
|
|
|
if (this.error) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
const orderResult = await this.submitOrder({
|
|
|
address_id: this.address.address_id,
|
|
|
num: 1,
|
|
|
price: this.price,
|
|
|
storage_id: 10000128,
|
|
|
});
|
|
|
|
|
|
if (orderResult.code !== 200) {
|
|
|
this.$createToast({
|
|
|
time: 1500,
|
|
|
txt: '创建订单失败',
|
|
|
type: 'txt'
|
|
|
}).show();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
const { orderCode } = orderResult.data;
|
|
|
|
|
|
const payListResult = await this.fetchPayList({
|
|
|
order_code: orderCode
|
|
|
});
|
|
|
|
|
|
this.$createOrderPayType({
|
|
|
data: payListResult.data,
|
|
|
price: this.fee.earnestMoneyStr,
|
|
|
desc: '保证金'
|
|
|
}).show();
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
|