feat(crm/order): 添加合同号字段并创建订单绑定功能

- 在订单编辑、详情和表格中添加合同号字段
- 创建新的OrderTable组件用于订单选择
- 添加发货单与订单的绑定功能
- 在运单详情中显示合同号信息
- 调整表格列宽和字体大小
This commit is contained in:
砂糖
2026-02-03 13:53:10 +08:00
parent 81d278a16e
commit d847436357
6 changed files with 267 additions and 23 deletions

View File

@@ -0,0 +1,157 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="发货单名称" prop="waybillName">
<el-input v-model="queryParams.waybillName" placeholder="请输入发货单名称" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="收货单位" prop="consigneeUnit">
<el-input v-model="queryParams.consigneeUnit" placeholder="请输入收货单位" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<!-- <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" :disabled="!selectedPlan"
title="请先选择发货计划">新增</el-button> -->
<el-button type="success" plain icon="el-icon-refresh" size="mini" @click="handleQuery">刷新</el-button>
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button> -->
</el-form-item>
</el-form>
<el-table v-loading="loading" border :data="deliveryWaybillList" highlight-current-row>
<el-table-column label="发货单唯一ID" align="center" prop="waybillId" v-if="false" />
<el-table-column label="发货单名称" align="center" prop="waybillName" />
<el-table-column label="车牌" align="center" prop="licensePlate" width="100" />
<el-table-column label="发货单位" align="center" prop="senderUnit" />
<el-table-column label="发货时间" align="center" prop="deliveryTime" width="100">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.deliveryTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="负责人" align="center" prop="principal" />
<el-table-column label="负责人电话" align="center" prop="principalPhone" width="100" />
<el-table-column label="完成状态" align="center" prop="status" width="120">
<template slot-scope="scope">
<el-tag size="mini" type="success" v-if="scope.row.status === 1">已发货</el-tag>
<el-tag size="mini" type="info" v-else>未发货</el-tag>
<!-- <el-select v-model="scope.row.status" placeholder="请选择完成状态" @change="handleStatusChange(scope.row)">
<el-option label="已发货" :value="1" />
<el-option label="未发货" :value="0" />
</el-select> -->
</template>
</el-table-column>
<el-table-column label="订单合同号" align="center" prop="contractCode" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-paperclip" @click.stop="handleBind(scope.row)">绑定订单</el-button>
<!-- <el-button size="mini" type="text" icon="el-icon-edit" :disabled="scope.row.status === 1" title="已发货的发货单不能修改"
@click.stop="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" :disabled="scope.row.status === 1"
title="已发货的发货单不能删除" @click.stop="handleDelete(scope.row)">删除</el-button> -->
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<el-dialog title="选择订单" :visible.sync="dialogVisible" width="80%">
<order-table ref="orderTable" @row-click="submitBind" />
</el-dialog>
</div>
</template>
<script>
import { listDeliveryWaybill, updateDeliveryWaybill } from "@/api/wms/deliveryWaybill";
import OrderTable from "../components/OrderTable.vue";
export default {
data() {
return {
deliveryWaybillList: [],
total: 0,
queryParams: {
pageNum: 1,
pageSize: 10,
waybillName: '',
consigneeUnit: ''
},
dialogVisible: false,
currentWaybill: {},
currentWaybillDetails: [],
loading: false,
showSearch: true,
}
},
components: {
OrderTable,
},
mounted() {
this.getList();
},
methods: {
/** 完成状态改变时的处理 */
handleStatusChange(row) {
// 确保在更新状态时包含waybillId
updateDeliveryWaybillStatus({
waybillId: row.waybillId,
status: row.status
}).then(() => {
this.$modal.msgSuccess("状态更新成功");
this.getList(); // 刷新列表
});
},
/** 查询发货单列表 */
getList() {
this.loading = true;
// 确保查询参数包含planId
const params = {
...this.queryParams,
// 如果选中了计划传递planId否则不传递该参数
planId: this.selectedPlan ? this.selectedPlan.planId : undefined
};
listDeliveryWaybill(params).then(response => {
this.deliveryWaybillList = response.rows;
this.total = response.total;
this.loading = false;
});
},
handleBind(row) {
this.dialogVisible = true;
this.currentWaybill = row;
},
submitBind(order) {
this.loading = true;
this.dialogVisible = false;
updateDeliveryWaybill({
...this.currentWaybill,
orderId: order.orderId,
}).then(() => {
this.loading = false;
this.$modal.msgSuccess("绑定成功");
this.getList();
}).catch(() => {
this.$modal.msgError("绑定失败");
this.dialogVisible = true;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 导出按钮操作 */
handleExport() {
this.download('wms/deliveryWaybill/export', {
...this.queryParams
}, `deliveryWaybill_${new Date().getTime()}.xlsx`)
},
}
}
</script>

View File

@@ -48,6 +48,12 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同号" prop="contractCode">
<el-input v-model="form.contractCode" placeholder="请输入合同号"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" type="textarea" :rows="4" />

View File

@@ -0,0 +1,64 @@
<template>
<div>
<el-table v-loading="loading" :data="orderList" height="400px" highlight-current-row @row-click="handleRowClick">
<el-table-column label="订单编号" align="center" prop="orderCode" />
<el-table-column label="客户" align="center" prop="companyName" />
<el-table-column label="总金额" align="center" prop="orderAmount" />
<el-table-column label="销售员" align="center" prop="salesman" />
<el-table-column label="合同号" align="center" prop="contractCode" />
<el-table-column label="交货日期" align="center" prop="deliveryDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.deliveryDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="orderType">
<template slot-scope="scope">
<span v-if="scope.row.orderType === 0" class="text-primary">未审核</span>
<span v-else-if="scope.row.orderType === 1">已审核</span>
<span v-else>未知状态</span>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
</div>
</template>
<script>
import { listOrder } from "@/api/crm/order";
export default {
name: 'OrderTable',
data() {
return {
orderList: [],
total: 0,
queryParams: {
pageNum: 1,
pageSize: 10,
orderNo: '',
customerName: '',
},
loading: false,
}
},
mounted() {
this.getList();
},
methods: {
getList() {
this.loading = true
listOrder(this.queryParams).then(res => {
this.orderList = res.rows
this.total = res.total
this.loading = false
})
},
handleRowClick(row) {
this.$emit('row-click', row)
}
}
}
</script>

View File

@@ -50,7 +50,7 @@
<el-descriptions-item label="订单编号">{{ form.orderCode }}</el-descriptions-item>
<el-descriptions-item label="销售员">{{ form.salesman }}</el-descriptions-item>
<el-descriptions-item label="交货日期">{{ form.deliveryDate }}</el-descriptions-item>
<el-descriptions-item label="合同号">{{ form.contractCode }}</el-descriptions-item>
<el-descriptions-item label="客户公司">{{ form.companyName }}</el-descriptions-item>
<el-descriptions-item label="联系人">{{ form.contactPerson }}</el-descriptions-item>
<el-descriptions-item label="联系电话">{{ form.contactWay }}</el-descriptions-item>
@@ -113,6 +113,9 @@
<el-form-item label="销售员" prop="salesman">
<el-input v-model="form.salesman" placeholder="请输入销售员" />
</el-form-item>
<el-form-item label="合同号" prop="contractCode">
<el-input v-model="form.contractCode" placeholder="请输入合同号" />
</el-form-item>
<el-form-item label="交货日期" prop="deliveryDate">
<el-date-picker clearable v-model="form.deliveryDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择交货日期">

View File

@@ -33,7 +33,7 @@
<el-table-column label="数量" align="center" prop="quantity" />
<el-table-column label="重量" align="center" prop="weight" />
<!-- <el-table-column label="单价" align="center" prop="unitPrice" /> -->
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
@@ -106,7 +106,7 @@
<el-form-item label="单价" prop="unitPrice">
<el-input v-model="form.unitPrice" placeholder="请输入单价" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-form-item label="备注" prop="remark" >
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>

View File

@@ -34,6 +34,10 @@
<span class="label">电话</span>
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.principalPhone }}</div>
</div>
<div class="header-right">
<span class="label">合同号</span>
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.contractCode }}</div>
</div>
<div class="header-center">
<span class="label">车牌</span>
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.licensePlate }}</div>
@@ -54,9 +58,9 @@
<th>规格</th>
<th>材质</th>
<!-- <th>数量</th> -->
<th>重量T</th>
<!-- <th>单价</th> -->
<th>重量(t)</th>
<th>单价</th>
<th>备注</th>
</tr>
</thead>
<tbody>
@@ -83,7 +87,8 @@
placeholder="0" /></td> -->
<td><input type="number" class="table-input transparent-input" v-model.number="item.weight"
placeholder="0.00" /></td>
<!-- <td><input type="text" class="table-input transparent-input" v-model="item.unitPrice" /></td> -->
<td><div class="table-input transparent-input" contenteditable>{{ item.unitPrice }}</div></td>
<td><div class="table-input transparent-input" contenteditable>{{ item.remark }}</div></td>
</tr>
<!-- 加粗最后一行的线 -->
<tr style="height: 0;">
@@ -99,6 +104,8 @@
<!-- <td><input type="number" class="table-input transparent-input" v-model.number="item.quantity"
placeholder="0" /></td> -->
<td style="height: 0;"></td>
<td style="height: 0;"></td>
<td style="height: 0;"></td>
</tr>
</tbody>
</table>
@@ -207,7 +214,8 @@ export default {
principal: newVal.principal || '',
principalPhone: newVal.principalPhone || '',
licensePlate: newVal.licensePlate || '',
pickupLocation: newVal.pickupLocation || ''
pickupLocation: newVal.pickupLocation || '',
contractCode: newVal.contractCode || ''
};
}
},
@@ -551,7 +559,7 @@ export default {
line-height: 6mm;
text-align: center;
vertical-align: middle;
font-size: 18px;
font-size: 16px;
font-weight: 900;
padding: 0;
overflow: hidden;
@@ -561,7 +569,7 @@ export default {
/* 表格列宽设置 */
.waybill-table th:nth-child(1),
.waybill-table td:nth-child(1) {
width: 60px;
width: 70px;
/* 品名 */
}
@@ -573,37 +581,37 @@ export default {
.waybill-table th:nth-child(3),
.waybill-table td:nth-child(3) {
width: 40px;
width: 50px;
/* 包装 */
}
.waybill-table th:nth-child(4),
.waybill-table td:nth-child(4) {
width: 80px;
width: 90px;
/* 仓库位置 */
}
.waybill-table th:nth-child(5),
.waybill-table td:nth-child(5) {
width: 40px;
width: 60px;
/* 结算 */
}
.waybill-table th:nth-child(6),
.waybill-table td:nth-child(6) {
width: 80px;
width: 70px;
/* 原料厂家 */
}
.waybill-table th:nth-child(7),
.waybill-table td:nth-child(7) {
width: 100px;
width: 110px;
/* 卷号 */
}
.waybill-table th:nth-child(8),
.waybill-table td:nth-child(8) {
width: 80px;
width: 90px;
/* 规格 */
}
@@ -620,18 +628,24 @@ export default {
} */
/* 重量kg */
.waybill-table th:nth-child(10),
.waybill-table td:nth-child(10) {
width: 80px;
/* 重量kg */
width: 70px;
}
/* 单价 */
/* .waybill-table th:nth-child(12),
.waybill-table td:nth-child(12) {
width: 40px;
.waybill-table th:nth-child(11),
.waybill-table td:nth-child(11) {
width: 50px;
}
} */
/* 备注 */
.waybill-table th:nth-child(12),
.waybill-table td:nth-child(12) {
/* width: 40px; */
}
.waybill-table th {
@@ -654,7 +668,7 @@ export default {
outline: none;
background: transparent;
/* font-family: inherit; */
font-size: 18px;
font-size: 16px;
line-height: 6mm;
text-align: center;
vertical-align: middle;