|
|
@@ -656,29 +656,44 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- saveDate(data) {
|
|
|
+ saveDate(data, closeDialog) {
|
|
|
+ const priceSources = data.map((item) =>
|
|
|
+ this.form.returnSourceType == 2
|
|
|
+ ? this.productList.filter((val) => item.productCode == val.productCode).pop()
|
|
|
+ : item.deliveryDetailId
|
|
|
+ ? this.productList.find(
|
|
|
+ (val) => String(val.sendProductId || val.id) === String(item.deliveryDetailId)
|
|
|
+ )
|
|
|
+ : null
|
|
|
+ );
|
|
|
+ if (this.form.returnSourceType != 2 && priceSources.some((source) => !source)) {
|
|
|
+ this.$message.error('未找到对应的发货明细,无法确定退货单价');
|
|
|
+ return;
|
|
|
+ }
|
|
|
data.forEach((item, index) => {
|
|
|
// item['totalCount'] = item.measureQuantity;
|
|
|
this.$set(data[index], 'totalCount', item.measureQuantity);
|
|
|
item['orderId'] = this.orderOption[0]?.orderId;
|
|
|
item['orderNo'] = this.orderOption[0]?.orderNo;
|
|
|
|
|
|
- this.productList.forEach((val) => {
|
|
|
- if (item.productCode == val.productCode) {
|
|
|
- item['singlePrice'] = val.singlePrice;
|
|
|
- item['pricingWay'] = val.pricingWay || 1;
|
|
|
- item['clientCode'] = item.clientCode || val.customerMark;
|
|
|
- item['notaxSinglePrice'] = val.notaxSinglePrice;
|
|
|
- item['taxRate'] = val.taxRate;
|
|
|
- item['goodsLevel'] = val.goodsLevel;
|
|
|
- item['goodsId'] = val.goodsId;
|
|
|
- item['goodsPriceId'] = val.goodsPriceId;
|
|
|
- item['goodsPriceType'] = val.goodsPriceType;
|
|
|
- }
|
|
|
- });
|
|
|
+ const priceSource = priceSources[index];
|
|
|
+ if (!priceSource) return;
|
|
|
+ if (this.form.returnSourceType != 2) {
|
|
|
+ item['sendProductId'] = priceSource.sendProductId || priceSource.id;
|
|
|
+ }
|
|
|
+ item['singlePrice'] = priceSource.singlePrice;
|
|
|
+ item['pricingWay'] = priceSource.pricingWay || 1;
|
|
|
+ item['clientCode'] = item.clientCode || priceSource.customerMark;
|
|
|
+ item['notaxSinglePrice'] = priceSource.notaxSinglePrice;
|
|
|
+ item['taxRate'] = priceSource.taxRate;
|
|
|
+ item['goodsLevel'] = priceSource.goodsLevel;
|
|
|
+ item['goodsId'] = priceSource.goodsId;
|
|
|
+ item['goodsPriceId'] = priceSource.goodsPriceId;
|
|
|
+ item['goodsPriceType'] = priceSource.goodsPriceType;
|
|
|
});
|
|
|
this.$refs.inventoryTableref &&
|
|
|
this.$refs.inventoryTableref.putTableValue(data);
|
|
|
+ if (closeDialog) closeDialog();
|
|
|
},
|
|
|
//发货单详情
|
|
|
async getSendSaleOrderDetail(id, type) {
|