diff --git a/src/api/distribution/CreateOrder.js b/src/api/distribution/CreateOrder.js
index 5db57102..5966cb36 100644
--- a/src/api/distribution/CreateOrder.js
+++ b/src/api/distribution/CreateOrder.js
@@ -88,3 +88,25 @@ export const postFindWaybillDetail = data => {
data,
});
};
+
+/**
+ * 改单
+ */
+export const postUpdateWaybill = data => {
+ return request({
+ url: '/api/logpm-trunkline/openOrder/updateWaybill',
+ method: 'post',
+ data,
+ });
+};
+
+/**
+ * 改单验证
+ */
+export const postUpdateWaybillVerify = data => {
+ return request({
+ url: '/api/logpm-trunkline/openOrder/updateWaybillVerify',
+ method: 'post',
+ data,
+ });
+};
diff --git a/src/option/waybill/TemporaryStorageList.js b/src/option/waybill/TemporaryStorageList.js
index 2e32a959..f0290c7a 100644
--- a/src/option/waybill/TemporaryStorageList.js
+++ b/src/option/waybill/TemporaryStorageList.js
@@ -17,7 +17,7 @@ export const columnList = [
{
prop: 'orderCode',
label: '订单自编号',
- type: 1,
+ type: 2,
values: '',
width: '150',
checkarr: [],
@@ -38,7 +38,7 @@ export const columnList = [
{
prop: 'dealerName',
label: '商场名称',
- type: 1,
+ type: 2,
values: '',
width: '130',
checkarr: [],
@@ -48,7 +48,7 @@ export const columnList = [
{
prop: 'storeName',
label: '门店名称',
- type: 1,
+ type: 2,
values: '',
width: '130',
checkarr: [],
@@ -58,7 +58,17 @@ export const columnList = [
{
prop: 'siteName',
label: '基地',
- type: 1,
+ type: 2,
+ values: '',
+ width: '130',
+ checkarr: [],
+ fixed: false,
+ sortable: true,
+ },
+ {
+ prop: 'brand',
+ label: '品牌',
+ type: 2,
values: '',
width: '130',
checkarr: [],
@@ -88,7 +98,7 @@ export const columnList = [
{
prop: 'trainNumber',
label: '客户车次',
- type: 1,
+ type: 2,
values: '',
width: '130',
checkarr: [],
@@ -108,7 +118,7 @@ export const columnList = [
{
prop: 'customerName',
label: '顾客姓名',
- type: 1,
+ type: 2,
values: '',
width: '130',
checkarr: [],
@@ -118,7 +128,7 @@ export const columnList = [
{
prop: 'customerPhone',
label: '顾客电话',
- type: 1,
+ type: 2,
values: '',
width: '130',
checkarr: [],
@@ -128,7 +138,7 @@ export const columnList = [
{
prop: 'customerAddress',
label: '顾客地址',
- type: 1,
+ type: 2,
values: '',
width: '180',
checkarr: [],
@@ -208,7 +218,7 @@ export const columnList = [
{
prop: 'serviceNum',
label: '服务号',
- type: 1,
+ type: 2,
values: '',
width: '130',
checkarr: [],
diff --git a/src/views/distribution/inventory/CreateOrder.vue b/src/views/distribution/inventory/CreateOrder.vue
index 1a40cfc4..f1302505 100644
--- a/src/views/distribution/inventory/CreateOrder.vue
+++ b/src/views/distribution/inventory/CreateOrder.vue
@@ -130,7 +130,7 @@
({
listNode: '',
// 页面请求的问题
form: {},
- /** 修改 -- goodsList里的id, 区别:新增 / 删除 */
- goodsListIds: [],
+ /** 修改 -- 深拷贝goodsList, 区别:新增 / 删除 / 修改 */
+ deepCloneGoodsList: [],
/** 提交数据 */
submitData: {},
});
@@ -1423,7 +1425,7 @@ const initPageInfo = async () => {
else {
console.log('111 :>> ', 111);
info.value.maxNum = 0;
- details.goodsListIds = [];
+ details.deepCloneGoodsList = [];
details.goodsList = data.warehouseWaybill.detailList.map(val => {
val.num = Number(val.num);
val.volume = Number(val.volume);
@@ -1431,7 +1433,6 @@ const initPageInfo = async () => {
val.price = Number(val.price);
val.subtotalFreight = Number(val.subtotalFreight);
- details.goodsListIds.push(val.id);
val.goodsName = val.productName;
// 计算运费小计
@@ -1440,9 +1441,10 @@ const initPageInfo = async () => {
// 计算件数最大值
info.value.maxNum += val.num;
console.log('val :>> ', val);
+ details.deepCloneGoodsList.push({ ...val });
return val;
});
- console.log('details.goodsListIds :>> ', details.goodsListIds);
+ console.log('details.deepCloneGoodsList :>> ', details.deepCloneGoodsList);
}
}
};
@@ -1682,24 +1684,40 @@ const handleComputed = (row: any) => {
let _ant = null;
/** 查询客户信息 */
-const handleFindClientInfo = (value, type) => {
+const handleFindClientInfo = type => {
if (_ant) clearTimeout(_ant);
_ant = setTimeout(async () => {
- if (value) {
- try {
- details.loadingObj.consignerLoading = true;
- const res = await postOpenOrderFindClientInfo({ clientName: value });
- const { code, data } = res.data;
- if (code !== 200) return;
- if (type === 'consignee') {
- details.consignerOptions = data || [];
- } else {
- details.shipperOptions = data || [];
- }
- } catch (error) {
- } finally {
- details.loadingObj.consignerLoading = false;
+ try {
+ details.loadingObj.consignerLoading = true;
+
+ console.log('details.query :>> ', details.query);
+
+ /** 发货人搜索信息 */
+ let shipperQuery = {
+ clientName: details.query.shipper,
+ linkMan: details.query.shipperName,
+ linkPhone: details.query.shipperMobile,
+ };
+ /** 寄货人搜索信息 */
+ let consignerQuery = {
+ clientName: details.query.consignee,
+ linkMan: details.query.consigneeName,
+ linkPhone: details.query.consigneeMobile,
+ };
+
+ const submitData = type === 'consignee' ? consignerQuery : shipperQuery;
+
+ const res = await postOpenOrderFindClientInfo(submitData);
+ const { code, data } = res.data;
+ if (code !== 200) return;
+ if (type === 'consignee') {
+ details.consignerOptions = data || [];
+ } else {
+ details.shipperOptions = data || [];
}
+ } catch (error) {
+ } finally {
+ details.loadingObj.consignerLoading = false;
}
clearTimeout(_ant);
}, 1000);
@@ -1824,6 +1842,8 @@ const handleSubmit = (formEl: FormInstance | undefined) => {
advanceIds: info.value.advanceIds,
...details.totalObj,
huilaiPay: 1,
+ addList: [],
+ removeList: [],
};
const { destination } = submitData;
@@ -1845,7 +1865,7 @@ const handleSubmit = (formEl: FormInstance | undefined) => {
let numFlag = false;
- for (const iterator of submitData.goodsList) {
+ for (const iterator of details.goodsList) {
if (iterator.subtotalFreight <= 0 || !iterator.subtotalFreight) {
numFlag = true;
break;
@@ -1876,15 +1896,37 @@ const handleSubmit = (formEl: FormInstance | undefined) => {
res = await postOpenOrderOpenWaybill(submitData);
} else {
- for (let iterator of submitData.goodsList) {
- // 查看每一项是否存在Id
+ submitData.waybillId = details.pageInfo.id;
+
+ const oldGoodsList = [...details.deepCloneGoodsList];
+
+ for (let iterator of details.goodsList) {
+ // 查看每一项是否存在Id updateType: 1新增; 2修改
if (iterator.id) {
// 存在则证明为老数据
+
+ // 根据存在的数据, 筛选被删除的数据
+ const _item = oldGoodsList.splice(
+ oldGoodsList.findIndex(val => val.id === iterator.id),
+ 1
+ );
+
+ // 检测是否被修改
+ let _flag = false;
+
+ for (const key in iterator) {
+ _flag = iterator[key] !== _item[key];
+ // 检测到不一致则退出循环
+ if (_flag) break;
+ }
+
+ if (_flag) submitData.addList.push({ ...iterator, updateType: 2 });
+ } else {
+ submitData.addList.push({ ...iterator, updateType: 1 });
}
}
- submitData.addList = submitData.goodsList;
- submitData.removeList = [];
+ submitData.removeList = oldGoodsList;
delete submitData.goodsList;
@@ -1895,6 +1937,7 @@ const handleSubmit = (formEl: FormInstance | undefined) => {
// 记录提交参数
details.submitData = submitData;
+ res = await postUpdateWaybill(submitData);
}
const { code, msg } = res.data;
if (code !== 200) return;
diff --git a/src/views/waybill/TemporaryStorageList.vue b/src/views/waybill/TemporaryStorageList.vue
index 1b6c8760..b6b160c9 100644
--- a/src/views/waybill/TemporaryStorageList.vue
+++ b/src/views/waybill/TemporaryStorageList.vue
@@ -78,27 +78,25 @@
-
-
-
-
-
-
- 包明细
-
-
+
+
+
+
+
+ 包明细
+
-
-
+
+
@@ -867,7 +865,7 @@ const searchHide = () => {
/** 表格表头输入框搜索 */
const inputsc = (index, row) => {
- details.query[row.prop] = index;
+ index === '' ? delete details.query[row.prop] : (details.query[row.prop] = index);
initOnLoad();
};
@@ -889,12 +887,10 @@ const btnsc = () => {};
/** 表格表头下拉框选择 */
const selectsc = (index, row) => {
- details.query[row.prop] = index;
- if (!index) delete details.query[row.prop];
- if (row.prop === 'certificateTypeName') {
- details.query['certificateType'] = index;
- if (!index) delete details.query['certificateType'];
- }
+ index === ''
+ ? delete details.query[row.prop.replace('Name', '')]
+ : (details.query[row.prop.replace('Name', '')] = index);
+
initOnLoad();
};