|
|
|
@ -910,6 +910,7 @@ let useStores = useStore();
|
|
|
|
|
const details = reactive<any>({ |
|
|
|
|
/** 页面数据 */ |
|
|
|
|
pageInfo: {}, |
|
|
|
|
deepQuery: {}, |
|
|
|
|
/** 表格搜索条件 */ |
|
|
|
|
query: { |
|
|
|
|
/** 品牌 */ |
|
|
|
@ -1479,173 +1480,148 @@ getLazyTreeAll().then(res => {
|
|
|
|
|
|
|
|
|
|
/** 初始化获取暂存单转运单信息 */ |
|
|
|
|
const onLoad = async (idsArr = []) => { |
|
|
|
|
console.log('JSON.parse(details.pageInfo.ids) :>> ', JSON.parse(details.pageInfo.ids)); |
|
|
|
|
let ids = []; |
|
|
|
|
if (idsArr.length === 0) ids = JSON.parse(details.pageInfo.ids); |
|
|
|
|
else ids = idsArr; |
|
|
|
|
const res = await getOpenOrderAdvanceToWaybillInfo({ advanceIds: ids }); |
|
|
|
|
const { code, data } = res.data; |
|
|
|
|
console.log('data :>> ', data); |
|
|
|
|
if (code !== 200) return; |
|
|
|
|
// 存储请求的数据 |
|
|
|
|
info.value = deepClone(data); |
|
|
|
|
console.log('info.value :>> ', info.value === data); |
|
|
|
|
for (let key in data) { |
|
|
|
|
details.query[key] = data[key] || ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let _maxNum = 0; |
|
|
|
|
|
|
|
|
|
// const _arr = []; |
|
|
|
|
|
|
|
|
|
// for (const iterator of data.goodsList) { |
|
|
|
|
// const _item = { ...iterator }; |
|
|
|
|
// _item.num = isNumber(_item.num) ? Number(_item.num) : 0; |
|
|
|
|
// _item.price = isNumber(_item.price) ? Number(_item.price) : 0; |
|
|
|
|
// _item.volume = isNumber(_item.volume) ? Number(_item.volume) : 0; |
|
|
|
|
// _item.weight = isNumber(_item.weight) ? Number(_item.weight) : 0; |
|
|
|
|
|
|
|
|
|
// _item.chargeType = _item.chargeType || 1; |
|
|
|
|
// // 计算运费小计 |
|
|
|
|
// if (!_item.subtotalFreight) handleComputed(_item); |
|
|
|
|
// // 计算件数最大值 |
|
|
|
|
// _maxNum += _item.num; |
|
|
|
|
|
|
|
|
|
// _arr.push(_item); |
|
|
|
|
// } |
|
|
|
|
try { |
|
|
|
|
details.query = deepClone(details.deepQuery); |
|
|
|
|
console.log('details.query :>> ', details.deepQuery); |
|
|
|
|
|
|
|
|
|
console.log('JSON.parse(details.pageInfo.ids) :>> ', JSON.parse(details.pageInfo.ids)); |
|
|
|
|
let ids = []; |
|
|
|
|
if (idsArr.length === 0) ids = JSON.parse(details.pageInfo.ids); |
|
|
|
|
else ids = idsArr; |
|
|
|
|
const res = await getOpenOrderAdvanceToWaybillInfo({ advanceIds: ids }); |
|
|
|
|
const { code, data } = res.data; |
|
|
|
|
console.log('data :>> ', data); |
|
|
|
|
if (code !== 200) return; |
|
|
|
|
// 存储请求的数据 |
|
|
|
|
info.value = deepClone(data); |
|
|
|
|
console.log('info.value :>> ', info.value === data); |
|
|
|
|
for (let key in data) { |
|
|
|
|
details.query[key] = data[key] || ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// details.goodsList = _arr; |
|
|
|
|
|
|
|
|
|
// details.goodsList = data.goodsList.map(val => { |
|
|
|
|
// val.num = isNumber(val.num) ? Number(val.num) : 0; |
|
|
|
|
// val.price = isNumber(val.price) ? Number(val.price) : 0; |
|
|
|
|
// val.volume = isNumber(val.volume) ? Number(val.volume) : 0; |
|
|
|
|
// val.weight = isNumber(val.weight) ? Number(val.weight) : 0; |
|
|
|
|
|
|
|
|
|
// val.chargeType = val.chargeType || 1; |
|
|
|
|
// // 计算运费小计 |
|
|
|
|
// handleComputed(val); |
|
|
|
|
// // 计算件数最大值 |
|
|
|
|
// _maxNum += val.num; |
|
|
|
|
// console.log('val :>> ', val); |
|
|
|
|
// return val; |
|
|
|
|
// }); |
|
|
|
|
details.goodsList = [ |
|
|
|
|
{ |
|
|
|
|
index: 0, |
|
|
|
|
/** 货物名称 */ |
|
|
|
|
goodsName: '', |
|
|
|
|
/** 品类Id */ |
|
|
|
|
goodsId: '', |
|
|
|
|
/** 计费方式 */ |
|
|
|
|
chargeType: 1, |
|
|
|
|
/** 件数 */ |
|
|
|
|
num: 0, |
|
|
|
|
/** 重量(kg) */ |
|
|
|
|
weight: 0, |
|
|
|
|
/** 体积(方) */ |
|
|
|
|
volume: 0, |
|
|
|
|
/** 单价 */ |
|
|
|
|
price: 0, |
|
|
|
|
/** 运费小计 */ |
|
|
|
|
subtotalFreight: 0, |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
console.log('details.goodsList :>> ', details.goodsList); |
|
|
|
|
let _maxNum = 0; |
|
|
|
|
|
|
|
|
|
details.goodsList = data.goodsList.map(val => { |
|
|
|
|
val.num = isNumber(val.num) ? Number(val.num) : 0; |
|
|
|
|
val.price = isNumber(val.price) ? Number(val.price) : 0; |
|
|
|
|
val.volume = isNumber(val.volume) ? Number(val.volume) : 0; |
|
|
|
|
val.weight = isNumber(val.weight) ? Number(val.weight) : 0; |
|
|
|
|
|
|
|
|
|
val.chargeType = val.chargeType || 1; |
|
|
|
|
// 计算运费小计 |
|
|
|
|
handleComputed(val); |
|
|
|
|
// 计算件数最大值 |
|
|
|
|
_maxNum += val.num; |
|
|
|
|
console.log('val :>> ', val); |
|
|
|
|
return val; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
info.value.maxNum = 20; |
|
|
|
|
if (data.defaultPayWay) { |
|
|
|
|
data.payWay = data.defaultPayWay; |
|
|
|
|
} else { |
|
|
|
|
details.query.payWay = data.payWayList.find(val => val.dictValue === '到付').dictKey || '2'; |
|
|
|
|
info.value.maxNum = _maxNum; |
|
|
|
|
if (data.defaultPayWay) { |
|
|
|
|
data.payWay = data.defaultPayWay; |
|
|
|
|
} else { |
|
|
|
|
details.query.payWay = data.payWayList.find(val => val.dictValue === '到付').dictKey || '2'; |
|
|
|
|
} |
|
|
|
|
details.query.transportType = '1'; |
|
|
|
|
details.goodsCode = data['totalNum']; |
|
|
|
|
console.log('details.query', details.query); |
|
|
|
|
// // instance.proxy.$forceUpdate(); |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log('error :>> ', error); |
|
|
|
|
} finally { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
details.query.transportType = '1'; |
|
|
|
|
details.goodsCode = data['totalNum']; |
|
|
|
|
console.log('details.query', details.query); |
|
|
|
|
// // instance.proxy.$forceUpdate(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 获取页面信息 */ |
|
|
|
|
const initPageInfo = async () => { |
|
|
|
|
details.pageInfo = { ...$route.query }; |
|
|
|
|
console.log('details.pageInfo :>> ', details.pageInfo); |
|
|
|
|
if (details.pageInfo.type !== 'edit') onLoad(); |
|
|
|
|
else { |
|
|
|
|
const res = await postFindWaybillDetail({ waybillId: details.pageInfo.id }); |
|
|
|
|
const { code, data } = res.data; |
|
|
|
|
if (code !== 200) return; |
|
|
|
|
const initPageInfo = async (idsArr = []) => { |
|
|
|
|
try { |
|
|
|
|
details.loadingObj.submitLoadingBtn = true; |
|
|
|
|
|
|
|
|
|
details.query = { ...data, ...data.warehouseWaybill }; |
|
|
|
|
delete details.query.warehouseWaybill; |
|
|
|
|
details.query.queryDestinationWarehouseName = details.query.destinationWarehouseName; |
|
|
|
|
console.log('data :>> ', data); |
|
|
|
|
details.query.openOrderDate = data.warehouseWaybill.createTime; |
|
|
|
|
details.query.orderCode = data.warehouseWaybill.orderNo; |
|
|
|
|
details.query.transportType = '1'; |
|
|
|
|
details.query.receipt = data.warehouseWaybill.receipt |
|
|
|
|
? data.warehouseWaybill.receipt.split(',') |
|
|
|
|
: []; |
|
|
|
|
|
|
|
|
|
details.query.xianPay = isNumber(data.warehouseWaybill.xpay) |
|
|
|
|
? Number(data.warehouseWaybill.xpay) |
|
|
|
|
: data.warehouseWaybill.xpay; |
|
|
|
|
details.query.huiPay = isNumber(data.warehouseWaybill.hpay) |
|
|
|
|
? Number(data.warehouseWaybill.hpay) |
|
|
|
|
: data.warehouseWaybill.hpay; |
|
|
|
|
details.query.yuePay = isNumber(data.warehouseWaybill.ypay) |
|
|
|
|
? Number(data.warehouseWaybill.ypay) |
|
|
|
|
: data.warehouseWaybill.ypay; |
|
|
|
|
details.query.daoPay = isNumber(data.warehouseWaybill.dpay) |
|
|
|
|
? Number(data.warehouseWaybill.dpay) |
|
|
|
|
: data.warehouseWaybill.dpay; |
|
|
|
|
// 转译到站 |
|
|
|
|
if (details.regionOptione.length !== 0) handleTranslationLocation(); |
|
|
|
|
console.log('details.query :>> ', details.query); |
|
|
|
|
|
|
|
|
|
// 初始化goodsList |
|
|
|
|
if (data.warehouseWaybill.detailList.length === 0) |
|
|
|
|
details.goodsList = [ |
|
|
|
|
{ |
|
|
|
|
index: 0, |
|
|
|
|
/** 货物名称 */ |
|
|
|
|
goodsName: '', |
|
|
|
|
/** 品类Id */ |
|
|
|
|
goodsId: '', |
|
|
|
|
/** 计费方式 */ |
|
|
|
|
chargeType: 1, |
|
|
|
|
/** 件数 */ |
|
|
|
|
num: 0, |
|
|
|
|
/** 重量(kg) */ |
|
|
|
|
weight: 0, |
|
|
|
|
/** 体积(方) */ |
|
|
|
|
volume: 0, |
|
|
|
|
/** 单价 */ |
|
|
|
|
price: 0, |
|
|
|
|
/** 运费小计 */ |
|
|
|
|
subtotalFreight: 0, |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
details.pageInfo = { ...$route.query }; |
|
|
|
|
console.log('details.pageInfo :>> ', details.pageInfo); |
|
|
|
|
if (details.pageInfo.type !== 'edit') await onLoad(idsArr); |
|
|
|
|
else { |
|
|
|
|
info.value.maxNum = 0; |
|
|
|
|
details.deepCloneGoodsList = []; |
|
|
|
|
details.goodsList = data.warehouseWaybill.detailList.map(val => { |
|
|
|
|
val.num = Number(val.num); |
|
|
|
|
val.volume = Number(val.volume); |
|
|
|
|
val.weight = Number(val.weight); |
|
|
|
|
val.price = Number(val.price); |
|
|
|
|
val.subtotalFreight = Number(val.subtotalFreight); |
|
|
|
|
|
|
|
|
|
val.goodsName = val.productName; |
|
|
|
|
|
|
|
|
|
// 计算运费小计 |
|
|
|
|
if (!val.subtotalFreight) handleComputed(val); |
|
|
|
|
|
|
|
|
|
// 计算件数最大值 |
|
|
|
|
info.value.maxNum += val.num; |
|
|
|
|
details.deepCloneGoodsList.push({ ...val }); |
|
|
|
|
return val; |
|
|
|
|
}); |
|
|
|
|
const res = await postFindWaybillDetail({ waybillId: details.pageInfo.id }); |
|
|
|
|
const { code, data } = res.data; |
|
|
|
|
if (code !== 200) return; |
|
|
|
|
|
|
|
|
|
details.query = { ...data, ...data.warehouseWaybill }; |
|
|
|
|
delete details.query.warehouseWaybill; |
|
|
|
|
details.query.queryDestinationWarehouseName = details.query.destinationWarehouseName; |
|
|
|
|
console.log('data :>> ', data); |
|
|
|
|
details.query.openOrderDate = data.warehouseWaybill.createTime; |
|
|
|
|
details.query.orderCode = data.warehouseWaybill.orderNo; |
|
|
|
|
details.query.transportType = '1'; |
|
|
|
|
details.query.receipt = data.warehouseWaybill.receipt |
|
|
|
|
? data.warehouseWaybill.receipt.split(',') |
|
|
|
|
: []; |
|
|
|
|
|
|
|
|
|
details.query.xianPay = isNumber(data.warehouseWaybill.xpay) |
|
|
|
|
? Number(data.warehouseWaybill.xpay) |
|
|
|
|
: data.warehouseWaybill.xpay; |
|
|
|
|
details.query.huiPay = isNumber(data.warehouseWaybill.hpay) |
|
|
|
|
? Number(data.warehouseWaybill.hpay) |
|
|
|
|
: data.warehouseWaybill.hpay; |
|
|
|
|
details.query.yuePay = isNumber(data.warehouseWaybill.ypay) |
|
|
|
|
? Number(data.warehouseWaybill.ypay) |
|
|
|
|
: data.warehouseWaybill.ypay; |
|
|
|
|
details.query.daoPay = isNumber(data.warehouseWaybill.dpay) |
|
|
|
|
? Number(data.warehouseWaybill.dpay) |
|
|
|
|
: data.warehouseWaybill.dpay; |
|
|
|
|
// 转译到站 |
|
|
|
|
if (details.regionOptione.length !== 0) handleTranslationLocation(); |
|
|
|
|
console.log('details.query :>> ', details.query); |
|
|
|
|
|
|
|
|
|
// 初始化goodsList |
|
|
|
|
if (data.warehouseWaybill.detailList.length === 0) |
|
|
|
|
details.goodsList = [ |
|
|
|
|
{ |
|
|
|
|
index: 0, |
|
|
|
|
/** 货物名称 */ |
|
|
|
|
goodsName: '', |
|
|
|
|
/** 品类Id */ |
|
|
|
|
goodsId: '', |
|
|
|
|
/** 计费方式 */ |
|
|
|
|
chargeType: 1, |
|
|
|
|
/** 件数 */ |
|
|
|
|
num: 0, |
|
|
|
|
/** 重量(kg) */ |
|
|
|
|
weight: 0, |
|
|
|
|
/** 体积(方) */ |
|
|
|
|
volume: 0, |
|
|
|
|
/** 单价 */ |
|
|
|
|
price: 0, |
|
|
|
|
/** 运费小计 */ |
|
|
|
|
subtotalFreight: 0, |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
else { |
|
|
|
|
info.value.maxNum = 0; |
|
|
|
|
details.deepCloneGoodsList = []; |
|
|
|
|
details.goodsList = data.warehouseWaybill.detailList.map(val => { |
|
|
|
|
val.num = Number(val.num); |
|
|
|
|
val.volume = Number(val.volume); |
|
|
|
|
val.weight = Number(val.weight); |
|
|
|
|
val.price = Number(val.price); |
|
|
|
|
val.subtotalFreight = Number(val.subtotalFreight); |
|
|
|
|
|
|
|
|
|
val.goodsName = val.productName; |
|
|
|
|
|
|
|
|
|
// 计算运费小计 |
|
|
|
|
if (!val.subtotalFreight) handleComputed(val); |
|
|
|
|
|
|
|
|
|
// 计算件数最大值 |
|
|
|
|
info.value.maxNum += val.num; |
|
|
|
|
details.deepCloneGoodsList.push({ ...val }); |
|
|
|
|
return val; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log('error :>> ', error); |
|
|
|
|
} finally { |
|
|
|
|
details.loadingObj.submitLoadingBtn = false; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -1791,7 +1767,7 @@ const handleChoose = () => {
|
|
|
|
|
|
|
|
|
|
const ids = details.selectionList.map(val => val.id); |
|
|
|
|
// 请求页面数据 |
|
|
|
|
onLoad(ids); |
|
|
|
|
initPageInfo(ids); |
|
|
|
|
details.popUpShow.columnListVisited = false; |
|
|
|
|
details.popUpShow.titleVisited = false; |
|
|
|
|
} catch (error) { |
|
|
|
@ -2031,7 +2007,7 @@ const handlePayWay = (number?: number) => {
|
|
|
|
|
const _item = enumPayType[payType]; |
|
|
|
|
|
|
|
|
|
if (_item) { |
|
|
|
|
details.query[_item] = number ? number : totalCost.value; |
|
|
|
|
details.query[_item] = isNumber(number) ? number : totalCost.value; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -2258,6 +2234,9 @@ watch(
|
|
|
|
|
$route, |
|
|
|
|
async () => { |
|
|
|
|
if ($route.path !== '/distribution/inventory/CreateOrder') return; |
|
|
|
|
// 深拷贝基础数据 |
|
|
|
|
details.deepQuery = deepClone(details.query); |
|
|
|
|
|
|
|
|
|
initPageInfo(); |
|
|
|
|
}, |
|
|
|
|
{ immediate: true } |
|
|
|
|