CreateAuctionOrder.vue
3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<template>
<a-alert class="mt-16" message="请从以下已出价的竞拍者中选择一位作为新的成交人。确认后,当前订单将被作废,
并为新的成交人生成新订单。" type="info" show-icon/>
<a-table class="mt-16" :columns="columns" :data-source="bids" :bordered="false" @resizeColumn="this.$filters.tableResizeColumn"
size="small" :pagination="false" :row-key="record => record.bidId" :scroll="{y: '500px)'}"
:row-selection="{ selectedRowKeys: selectIds, onChange: onSelectChange, type: 'radio', preserveSelectedRowKeys:true }">
<template #bodyCell="{column,record}">
<template v-if="column.key === 'action'">
</template>
</template>
<!--拍卖订单列表end-->
</a-table>
</template>
<script lang="ts">
import {Component, Prop, Vue} from "vue-facing-decorator";
import AuctionOrderStateTag from "@/views/auction/order/AuctionOrderStateTag.vue";
import {message, Modal, TableColumnsType} from "ant-design-vue";
import {Bid} from "lib/src/entity/auction/entity/Bid";
import {BidController} from "@/api/BidController";
import {AuctionOrder} from "lib/src/entity/auction/entity/AuctionOrder";
import {AuctionOrderController} from "@/api/AuctionOrderController";
import {BidOrder} from "lib/src/entity/auction/domain/BidOrder";
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
import {createVNode} from "vue";
@Component({
components: {AuctionOrderStateTag}
})
export default class CreateAuctionOrder extends Vue {
@Prop({required: true, type: Object})
auctionOrder: AuctionOrder;
bids: Bid[] = [];
selectIds: number[] = [];
selectedItem: Bid;
columns: TableColumnsType = [
{title: '姓名', dataIndex: ['account', 'accountName'], key: 'accountName', resizable: true, ellipsis: true, sorter: true},
{title: '账号', dataIndex: ['account', 'mobile'], key: 'mobile', resizable: true, ellipsis: true, sorter: true},
{title: '出价金额', dataIndex: 'bidPrice', key: 'bidPrice', width: 180, resizable: true, ellipsis: true, sorter: true},
{title: '出价时间', dataIndex: 'createTime', key: 'createTime', width: 170, align: 'center', resizable: true, ellipsis: true, sorter: true},
{
title: '是否成交', dataIndex: 'deal', key: 'deal', width: 100, resizable: true, ellipsis: true, sorter: true,
customRender: ({text, record, index, column}) => {
return text ? '成交' : '未成交';
}
},
];
created(): void {
BidController.getLastBidsByOrderId(this.axios, this.auctionOrder.orderId).then(response => {
this.bids = response.data;
});
}
onSelectChange(selectedRowKeys: number[], selectedRows: Bid[]): void {
this.selectIds = selectedRowKeys;
this.selectedItem = selectedRows[0];
}
submitForm(): void {
if (this.selectIds.length === 0) {
message.warning('请选择一个出价者');
return;
}
const that = this;
const accountName = that.selectedItem.account.accountName;
const orderPrice = that.selectedItem.bidPrice;
const bidOrder = new BidOrder();
bidOrder.bidId = that.selectedItem.bidId;
bidOrder.orderId = that.auctionOrder.orderId;
Modal.confirm({
title: '提示',
icon: createVNode(ExclamationCircleOutlined),
content: `您确定将成交人修改为「${accountName}」吗?原订单将被作废,新订单成交价为 ¥${orderPrice}。`,
onOk() {
AuctionOrderController.addAuctionOrder(that.axios, bidOrder).then(response => {
message.success('新合同创建成功');
that.$emit('handleOk', response.data);
});
},
onCancel() {
console.log('Cancel');
},
});
}
}
</script>
<style lang="less" scoped>
</style>