Authored by lea guo

订单详情求购调价

/* eslint-disable operator-linebreak */
/* eslint-disable space-before-function-paren */
import { createNamespacedHelpers } from 'vuex';
const { mapActions } = createNamespacedHelpers('order/orderList');
const { mapActions, mapState } = createNamespacedHelpers('order/orderList');
import { orderActionsMap, ownType } from 'constants/order-constants';
import DialogConfirmInfo from '../../components/dialog-confirm-info';
import DialogChangeBidPrice from '../../components/dialog-change-bid-price';
export default {
data() {
... ... @@ -12,8 +13,17 @@ export default {
isMixin: true,
};
},
computed: {
...mapState(['changePrice']),
},
methods: {
...mapActions(['cancelTradeConfirmInfo', 'cancelTrade', 'deleteOrder']),
...mapActions([
'cancelTradeConfirmInfo',
'cancelTrade',
'deleteOrder',
'computeChangePrice',
'confirmChangePrice',
]),
async onSellerOrderAction({ action, order }) {
const { owner = ownType.SELL } = this.$route.params;
const { orderCode, earnestMoney } = order;
... ... @@ -89,7 +99,12 @@ export default {
},
async onBuyerOrderAction({ action, order }) {
const { owner = ownType.SELL } = this.$route.params;
const { orderCode, priceInfo = {}, bidDepositInfo = {} } = order;
const {
orderCode,
priceInfo = {},
bidDepositInfo = {},
goodsInfo,
} = order;
switch (action.name) {
case orderActionsMap.DEL_ORDER.name: {
... ... @@ -112,6 +127,57 @@ export default {
}).show();
break;
}
case orderActionsMap.CHANGE_BID_PRICE.name: {
const { goodPrice } = goodsInfo;
const computePriceInfo = await this.computeChangePrice({
orderCode,
price: goodPrice,
});
if (typeof computePriceInfo === 'string') {
this.$createToast({
type: 'alert',
txt: computePriceInfo,
mask: true,
}).show();
return;
}
this.$createDialog(
{
type: 'prompt',
confirmBtn: { text: '调整求购价' },
cancelBtn: { active: true },
onConfirm: async () => {
if (!this.changePrice) {
return;
}
const isOk = await this.confirmChangePrice({
price: this.changePrice,
orderCode,
});
if (isOk) {
this.fetchOrderDetail(this.$route.params);
}
},
},
createElement => {
return [
createElement(DialogChangeBidPrice, {
props: {
computePriceInfo,
goodsInfo,
orderCode,
},
slot: 'content',
}),
];
},
).show();
break;
}
case orderActionsMap.CANCEL_ORDER.name: {
let confirmInfo = await this.cancelTradeConfirmInfo({
orderCode,
... ...
... ... @@ -35,7 +35,11 @@
</ul>
</scroll>
<empty-list class="empty-wrapper" tip="这里什么都没有..." v-show="isShowEmpty" />
<empty-list
class="empty-wrapper"
tip="这里什么都没有..."
v-show="isShowEmpty"
/>
</div>
</layout-app>
</template>
... ...