diff --git a/src/pagesShipment/form/settlementForm.vue b/src/pagesShipment/form/settlementForm.vue index c2e0e18..e951743 100644 --- a/src/pagesShipment/form/settlementForm.vue +++ b/src/pagesShipment/form/settlementForm.vue @@ -43,7 +43,9 @@ {{ model1.order.buttonType === 0 - ? (!isKg() ? item.unit1 : item.unit) + ? !isKg() + ? item.unit1 + : item.unit : "%" }} @@ -68,6 +70,7 @@ v-if="item.type === 'radio'" v-model="(model1.order as any)[item.key]" placement="row" + @change="item.changeRadio" > { } } }; + const model1 = reactive<{ scaleStatusBtnType: number; - order: Shipment; + order: any; }>({ scaleStatusBtnType: 2, order: { @@ -213,6 +217,8 @@ const model1 = reactive<{ settlementUnit: 1, }, }); + +const recordSettlementUnit = ref(1); const isKg = () => { if (model1.order.settlementUnit === 1) { return false; @@ -304,6 +310,25 @@ const formAttrList = reactive([ name: "吨", }, ], + changeRadio: (v: any) => { + if (recordSettlementUnit.value !== model1.order.settlementUnit) { + model1.order.settlementGross = null; + model1.order.settlementTare = null; + model1.order.settlementNet = null; + model1.order.unitPrice = null; + model1.order.buttonType = 0; + model1.order.subtractNum = null; + model1.order.settlementWeight = null; + model1.order.estimatePrice = null; + model1.order.totalPrice = null; + model1.order.freight = null; + model1.order.incidentals = null; + model1.order.realIncome = null; + model1.order.paymentMethodName = null; + model1.order.settlementNotes = ''; + } + recordSettlementUnit.value = v; + }, }, { name: "毛重", @@ -346,13 +371,6 @@ const formAttrList = reactive([ fn: () => {}, isNumber: true, }, - // { - // name: "验货净重", - // key: "number", - // type: "input", - // required: true, - // unit: "件", - // }, { name: "扣杂", key: "buttonType", @@ -409,16 +427,6 @@ const formAttrList = reactive([ type: "input", unit: "", disabled: true, - // child: [ - // { - // id: 0, - // name: "送货", - // }, - // { - // id: 1, - // name: "自提", - // }, - // ], }, { name: "运费", @@ -491,25 +499,39 @@ watch( 预估总价: 结算单价*结算重量 实际收入:实际结算金额-运费-杂费 */ - model1.order.settlementNet = num_subtract( - settlementGrossNew || 0, - settlementTareNew || 0 - ).toFixed(2); + model1.order.settlementNet = ( + num_subtract(settlementGrossNew || 0, settlementTareNew || 0).toFixed(2) + ); if (model1.order.buttonType === 0) { if (model1.order.subtractNum) { - model1.order.settlementWeight = num_subtract(model1.order.settlementNet, model1.order.subtractNum).toFixed(2) - // model1.order.settlementNet - model1.order.subtractNum; + model1.order.settlementWeight = ( + num_subtract( + model1.order.settlementNet, + model1.order.subtractNum + ).toFixed(2) + ); + // model1.order.settlementNet - model1.order.subtractNum; } else { model1.order.settlementWeight = model1.order.settlementNet; } } else if (model1.order.buttonType === 1) { if (model1.order.subtractNum) { - model1.order.settlementWeight = num_multiply(model1.order.settlementNet, ((100 - model1.order.subtractNum) / 100)).toFixed(2) + model1.order.settlementWeight = ( + num_multiply( + model1.order.settlementNet, + (100 - model1.order.subtractNum) / 100 + ).toFixed(2) + ); } else { model1.order.settlementWeight = model1.order.settlementNet; } } - model1.order.estimatePrice = num_multiply((model1.order.unitPrice || 0),(model1.order.settlementWeight || 0)).toFixed(2) + model1.order.estimatePrice = ( + num_multiply( + model1.order.unitPrice || 0, + model1.order.settlementWeight || 0 + ).toFixed(2) + ); // if (!model1.order.totalPrice) { // model1.order.totalPrice = model1.order.estimatePrice; // } @@ -754,8 +776,11 @@ onLoad((option) => { fileLists: model1.order.fileLists.map((item: any) => { return { ...item, fileID: item.id }; }), - settlementUnit: 1, + settlementUnit: + res.data.settlementUnit !== null ? res.data.settlementUnit : 1, }; + + recordSettlementUnit.value = model1.order.settlementUnit; } });