...
|
...
|
@@ -2,15 +2,12 @@ |
|
|
/* eslint-disable space-before-function-paren */
|
|
|
import { orderActionsMap, ownType } from 'constants/order-constants';
|
|
|
import { createNamespacedHelpers } from 'vuex';
|
|
|
import DialogConfirmInfo from '../../components/dialog-confirm-info';
|
|
|
import DialogChangeBidPrice from '../../components/dialog-change-bid-price';
|
|
|
import DialogConfirmInfo from '../components/dialog-confirm-info';
|
|
|
import DialogChangeBidPrice from '../components/dialog-change-bid-price';
|
|
|
|
|
|
const { mapActions, mapMutations, mapState } = createNamespacedHelpers(
|
|
|
'order/orderList',
|
|
|
);
|
|
|
const { mapMutations: inSaleMapMutations } = createNamespacedHelpers(
|
|
|
'order/inSaleOrderList',
|
|
|
);
|
|
|
|
|
|
export default {
|
|
|
computed: {
|
...
|
...
|
@@ -25,16 +22,15 @@ export default { |
|
|
'confirmChangePrice',
|
|
|
]),
|
|
|
...mapMutations(['filterOrderList', 'resetData']),
|
|
|
...inSaleMapMutations(['filterInSaleOrderList']),
|
|
|
|
|
|
// 订单列表
|
|
|
async onAction({ action, order }) {
|
|
|
async onAction({ action, order, isDetail = false } = {}) {
|
|
|
const { owner = ownType.SELL } = this.$route.params;
|
|
|
const {
|
|
|
orderCode,
|
|
|
realPrice = '',
|
|
|
bidDepositInfo = {},
|
|
|
goodsInfo = {},
|
|
|
priceInfo = {},
|
|
|
} = order;
|
|
|
|
|
|
switch (action.name) {
|
...
|
...
|
@@ -50,8 +46,12 @@ export default { |
|
|
});
|
|
|
|
|
|
if (isOk) {
|
|
|
if (isDetail) {
|
|
|
this.$router.back();
|
|
|
} else {
|
|
|
this.filterOrderList(orderCode);
|
|
|
}
|
|
|
}
|
|
|
const txt = isOk ? '删除成功' : '删除失败';
|
|
|
|
|
|
this.$createToast({ txt, type: 'txt' }).show();
|
...
|
...
|
@@ -68,9 +68,14 @@ export default { |
|
|
if (Array.isArray(confirmInfo)) {
|
|
|
confirmInfo = { confirmDesc: '确定取消求购' };
|
|
|
}
|
|
|
|
|
|
const confirmBtnText = confirmInfo.needPenalty
|
|
|
? '赔付并取消订单'
|
|
|
: '取消订单';
|
|
|
|
|
|
this.$createConfirmDialog(
|
|
|
{
|
|
|
confirmBtn: { text: '取消订单', style: { color: '#D0021B' } },
|
|
|
confirmBtn: { text: confirmBtnText, style: { color: '#D0021B' } },
|
|
|
cancelBtn: { text: '保留订单', active: true },
|
|
|
onConfirm: async () => {
|
|
|
const isOk = await this.cancelTrade({
|
...
|
...
|
@@ -79,9 +84,13 @@ export default { |
|
|
});
|
|
|
|
|
|
if (isOk) {
|
|
|
if (isDetail) {
|
|
|
this.fetchOrderDetail(this.$route.params);
|
|
|
} else {
|
|
|
this.resetData();
|
|
|
this.fetchData(this.$route.params);
|
|
|
}
|
|
|
}
|
|
|
const txt = isOk ? '取消成功' : '取消失败';
|
|
|
|
|
|
this.$createToast({ txt, type: 'txt' }).show();
|
...
|
...
|
@@ -100,15 +109,23 @@ export default { |
|
|
}
|
|
|
|
|
|
case orderActionsMap.NOW_BUY.name: {
|
|
|
let price = realPrice,
|
|
|
pageBackName = 'OrderList';
|
|
|
|
|
|
if (isDetail) {
|
|
|
price = priceInfo.realPayPrice;
|
|
|
pageBackName = 'buyOrderDetail';
|
|
|
}
|
|
|
this.$createOrderPayType({
|
|
|
orderCode,
|
|
|
price: parseFloat(realPrice),
|
|
|
price: parseFloat(price || ''),
|
|
|
desc: '',
|
|
|
extra: JSON.stringify({
|
|
|
forward: {
|
|
|
name: 'OrderList',
|
|
|
back: {
|
|
|
name: pageBackName,
|
|
|
params: {
|
|
|
owner: 'buy',
|
|
|
owner,
|
|
|
orderCode,
|
|
|
},
|
|
|
},
|
|
|
}),
|
...
|
...
|
@@ -145,12 +162,13 @@ export default { |
|
|
});
|
|
|
|
|
|
if (isOk) {
|
|
|
if (isDetail) {
|
|
|
this.fetchOrderDetail(this.$route.params);
|
|
|
} else {
|
|
|
this.resetData();
|
|
|
this.fetchData(this.$route.params);
|
|
|
}
|
|
|
|
|
|
// const txt = isOk ? "收货成功" : "收货失败";
|
|
|
// this.$createToast({ txt, type: "txt" }).show();
|
|
|
}
|
|
|
},
|
|
|
}).show();
|
|
|
break;
|
...
|
...
|
@@ -187,9 +205,13 @@ export default { |
|
|
});
|
|
|
|
|
|
if (isOk) {
|
|
|
if (isDetail) {
|
|
|
this.fetchOrderDetail(this.$route.params);
|
|
|
} else {
|
|
|
this.resetData();
|
|
|
this.fetchData(this.$route.params);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
createElement => {
|
...
|
...
|
@@ -207,111 +229,6 @@ export default { |
|
|
).show();
|
|
|
break;
|
|
|
}
|
|
|
case orderActionsMap.NOT_SOLD.name: {
|
|
|
const confirmInfo = await this.cancelTradeConfirmInfo({
|
|
|
orderCode,
|
|
|
owner,
|
|
|
});
|
|
|
|
|
|
const confirmBtnText = confirmInfo.needPenalty
|
|
|
? '赔付并取消订单'
|
|
|
: '不卖了';
|
|
|
|
|
|
this.$createConfirmDialog(
|
|
|
{
|
|
|
confirmBtn: { text: confirmBtnText, style: { color: '#D0021B' } },
|
|
|
cancelBtn: { text: '继续出售', active: true },
|
|
|
onConfirm: async () => {
|
|
|
const isOk = await this.cancelTrade({
|
|
|
orderCode,
|
|
|
owner,
|
|
|
});
|
|
|
|
|
|
if (isOk) {
|
|
|
this.resetData();
|
|
|
this.fetchData(this.$route.params);
|
|
|
}
|
|
|
|
|
|
// const txt = isOk ? "取消成功" : "取消失败";
|
|
|
// this.$createToast({ txt, type: "txt" }).show();
|
|
|
},
|
|
|
},
|
|
|
createElement => {
|
|
|
return [
|
|
|
createElement(DialogConfirmInfo, {
|
|
|
props: { info: confirmInfo },
|
|
|
slot: 'content',
|
|
|
}),
|
|
|
];
|
|
|
},
|
|
|
).show();
|
|
|
break;
|
|
|
}
|
|
|
default:
|
|
|
return;
|
|
|
}
|
|
|
},
|
|
|
|
|
|
// 出售中订单列表
|
|
|
async onInsaleOrderAction({ action, order }) {
|
|
|
const { owner = ownType.SELL } = this.$route.params;
|
|
|
const { orderCode, earnestMoney = 0 } = order;
|
|
|
|
|
|
switch (action.name) {
|
|
|
case orderActionsMap.NOT_SOLD.name: {
|
|
|
const confirmInfo = await this.cancelTradeConfirmInfo({
|
|
|
orderCode,
|
|
|
owner,
|
|
|
});
|
|
|
|
|
|
const confirmBtnText = confirmInfo.needPenalty
|
|
|
? '赔付并取消订单'
|
|
|
: '不卖了';
|
|
|
|
|
|
this.$createConfirmDialog(
|
|
|
{
|
|
|
confirmBtn: { text: confirmBtnText, style: { color: '#D0021B' } },
|
|
|
cancelBtn: { text: '继续出售', active: true },
|
|
|
onConfirm: async () => {
|
|
|
const isOk = await this.cancelTrade({
|
|
|
orderCode,
|
|
|
owner,
|
|
|
});
|
|
|
|
|
|
if (isOk) {
|
|
|
this.filterInSaleOrderList(orderCode);
|
|
|
}
|
|
|
|
|
|
// const txt = isOk ? "取消成功" : "取消失败";
|
|
|
// this.$createToast({ txt, type: "txt" }).show();
|
|
|
},
|
|
|
},
|
|
|
createElement => {
|
|
|
return [
|
|
|
createElement(DialogConfirmInfo, {
|
|
|
props: { info: confirmInfo },
|
|
|
slot: 'content',
|
|
|
}),
|
|
|
];
|
|
|
},
|
|
|
).show();
|
|
|
break;
|
|
|
}
|
|
|
case orderActionsMap.PAY_EARNESTMONEY.name: {
|
|
|
this.$createOrderPayType({
|
|
|
orderCode,
|
|
|
price: earnestMoney,
|
|
|
desc: '保证金',
|
|
|
|
|
|
// 支付成功会跳route
|
|
|
extra: JSON.stringify({
|
|
|
forward: {
|
|
|
name: 'InSaleOrderList',
|
|
|
},
|
|
|
}),
|
|
|
}).show();
|
|
|
break;
|
|
|
}
|
|
|
default:
|
|
|
return;
|
|
|
}
|
...
|
...
|
|