Browse Source

修改转运单爆栈问题

dev-xx
qb 1 year ago
parent
commit
f493b53aef
  1. 99
      src/views/distribution/inventory/CreateOrder.vue
  2. 18
      src/views/waybill/CreateZeroOrder.vue

99
src/views/distribution/inventory/CreateOrder.vue

@ -910,6 +910,7 @@ let useStores = useStore();
const details = reactive<any>({
/** 页面数据 */
pageInfo: {},
deepQuery: {},
/** 表格搜索条件 */
query: {
/** 品牌 */
@ -1479,6 +1480,10 @@ getLazyTreeAll().then(res => {
/** 初始化获取暂存单转运单信息 */
const onLoad = async (idsArr = []) => {
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);
@ -1496,64 +1501,22 @@ const onLoad = async (idsArr = []) => {
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);
// }
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;
// 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);
val.chargeType = val.chargeType || 1;
//
handleComputed(val);
//
_maxNum += val.num;
console.log('val :>> ', val);
return val;
});
info.value.maxNum = 20;
info.value.maxNum = _maxNum;
if (data.defaultPayWay) {
data.payWay = data.defaultPayWay;
} else {
@ -1563,13 +1526,21 @@ const onLoad = async (idsArr = []) => {
details.goodsCode = data['totalNum'];
console.log('details.query', details.query);
// // instance.proxy.$forceUpdate();
} catch (error) {
console.log('error :>> ', error);
} finally {
return null;
}
};
/** 获取页面信息 */
const initPageInfo = async () => {
const initPageInfo = async (idsArr = []) => {
try {
details.loadingObj.submitLoadingBtn = true;
details.pageInfo = { ...$route.query };
console.log('details.pageInfo :>> ', details.pageInfo);
if (details.pageInfo.type !== 'edit') onLoad();
if (details.pageInfo.type !== 'edit') await onLoad(idsArr);
else {
const res = await postFindWaybillDetail({ waybillId: details.pageInfo.id });
const { code, data } = res.data;
@ -1647,6 +1618,11 @@ const initPageInfo = async () => {
});
}
}
} 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 }

18
src/views/waybill/CreateZeroOrder.vue

@ -1378,8 +1378,11 @@ onMounted(() => {});
const initPageInfo = async () => {
details.pageInfo = $route.query;
try {
details.loadingObj.submitLoadingBtn = true;
console.log('$route :>> ', $route);
if ($route.query.type !== 'edit') onLoad();
if ($route.query.type !== 'edit') await onLoad();
else {
const res = await postFindWaybillDetail({ waybillId: details.pageInfo.id });
const { code, data } = res.data;
@ -1459,6 +1462,11 @@ const initPageInfo = async () => {
});
}
}
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.submitLoadingBtn = false;
}
};
getLazyTreeAll().then(res => {
@ -1471,6 +1479,7 @@ getLazyTreeAll().then(res => {
/** 初始化获取暂存单转运单信息 */
const onLoad = async () => {
try {
details.query = deepClone(details.deepQuery);
const res = await postOpenOrderOpenZeroWaybillInfo();
@ -1494,6 +1503,11 @@ const onLoad = async () => {
details.query.deliveryWay = '1';
details.query.urgency = '1';
details.query.destination = '';
} catch (error) {
console.log('error :>> ', error);
} finally {
return null;
}
};
/** 新增 */
@ -1711,7 +1725,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;
}
};

Loading…
Cancel
Save