|
|
@@ -12,12 +12,12 @@
|
|
|
@close="handleClose"
|
|
|
>
|
|
|
<div style="margin-bottom: 20px;">
|
|
|
- <el-alert
|
|
|
+ <!-- <el-alert
|
|
|
title="目前冲差功能仅适用于销售订单已审核,未执行发货的情况"
|
|
|
type="warning"
|
|
|
center
|
|
|
show-icon>
|
|
|
- </el-alert>
|
|
|
+ </el-alert> -->
|
|
|
</div>
|
|
|
<el-form
|
|
|
ref="form"
|
|
|
@@ -27,9 +27,9 @@
|
|
|
label-width="160px"
|
|
|
>
|
|
|
<headerTitle title="基本信息"></headerTitle>
|
|
|
- <el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="冲差单编码" prop="returnSourceType">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item labelWidth="100px" label="冲差单编码" prop="orderNo">
|
|
|
<el-input
|
|
|
clearable
|
|
|
v-model="form.orderNo"
|
|
|
@@ -38,8 +38,9 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="8">
|
|
|
<el-form-item
|
|
|
+ labelWidth="100px"
|
|
|
label="冲差类型"
|
|
|
prop="type"
|
|
|
>
|
|
|
@@ -53,8 +54,9 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="8">
|
|
|
<el-form-item
|
|
|
+ labelWidth="100px"
|
|
|
label="冲差原因"
|
|
|
prop="reason"
|
|
|
>
|
|
|
@@ -62,27 +64,26 @@
|
|
|
dictName="冲差原因"
|
|
|
clearable
|
|
|
v-model="form.reason"
|
|
|
- @change="handleSetReturnSourceType"
|
|
|
>
|
|
|
</DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="冲差方式" prop="method">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item labelWidth="100px" label="冲差方式" prop="method">
|
|
|
<DictSelection
|
|
|
dictName="冲差方式"
|
|
|
disabled
|
|
|
clearable
|
|
|
v-model="form.method"
|
|
|
- @change="handleSetReturnSourceType"
|
|
|
>
|
|
|
</DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="8">
|
|
|
<el-form-item
|
|
|
+ labelWidth="100px"
|
|
|
label="调整类型"
|
|
|
prop="adjustType"
|
|
|
>
|
|
|
@@ -94,31 +95,32 @@
|
|
|
</DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="冲差范围" prop="range">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item labelWidth="100px" label="冲差范围" prop="rangeType">
|
|
|
<DictSelection
|
|
|
dictName="冲差范围"
|
|
|
clearable
|
|
|
- v-model="form.range"
|
|
|
+ v-model="form.rangeType"
|
|
|
>
|
|
|
</DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="调整说明" prop="remark">
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-form-item labelWidth="100px" label="调整说明" prop="remark">
|
|
|
<el-input
|
|
|
clearable
|
|
|
v-model="form.remark"
|
|
|
type="textarea"
|
|
|
+ rows="1"
|
|
|
placeholder="请输入"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item prop="files" label="附件">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item labelWidth="100px" prop="files" label="附件">
|
|
|
<fileMain v-model="form.files"></fileMain>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -128,6 +130,7 @@
|
|
|
ref="inventoryTableDetailsRef"
|
|
|
:isDiscountTotalPrice="true"
|
|
|
:isSelected="true"
|
|
|
+ :selectedList="adjustData"
|
|
|
@selection-change="handleSelectionChange"
|
|
|
></inventoryTableDetails>
|
|
|
<headerTitle
|
|
|
@@ -135,42 +138,40 @@
|
|
|
style="margin-top: 30px"
|
|
|
></headerTitle>
|
|
|
<inventoryTable
|
|
|
- :returnType="form.returnType"
|
|
|
- :returnSourceType="form.returnSourceType"
|
|
|
- :entrustedCode="form.entrustedCode"
|
|
|
ref="inventoryTableRef"
|
|
|
- :sendId="form.sendId"
|
|
|
- :sendNo="form.sendNo"
|
|
|
- :type="form.type"
|
|
|
- @handleSelectGoods="handleSelectGoods"
|
|
|
- :orderOption="orderOption"
|
|
|
+ @changePrice="handleChangePrice"
|
|
|
+ @setCountAmount="setCountAmount"
|
|
|
></inventoryTable>
|
|
|
<div style="margin-top: 20px;">
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label-width="100px" label="总差异金额:" prop="redressAmount">
|
|
|
+ <el-form-item label-width="100px" label="总差异金额:" prop="differenceAmount">
|
|
|
<el-input
|
|
|
clearable
|
|
|
- v-model="form.redressAmount"
|
|
|
+ v-model="form.differenceAmount"
|
|
|
+ disabled
|
|
|
placeholder="请输入"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label-width="100px" label="总金额:" prop="redressAmount">
|
|
|
+ <el-form-item label-width="100px" label="总金额:" prop="adjustAmount">
|
|
|
<el-input
|
|
|
clearable
|
|
|
- v-model="form.redressAmount"
|
|
|
+ disabled
|
|
|
+ v-model="form.adjustAmount"
|
|
|
placeholder="请输入"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label-width="100px" label="优惠后总金额:" prop="redressAmount">
|
|
|
+ <el-form-item label-width="100px" label="优惠后总金额:" prop="adjustDiscountAmount">
|
|
|
<el-input
|
|
|
clearable
|
|
|
- v-model="form.redressAmount"
|
|
|
+ type="number"
|
|
|
+ v-model="form.adjustDiscountAmount"
|
|
|
placeholder="请输入"
|
|
|
+ @input="discountInput"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -207,28 +208,18 @@
|
|
|
import deptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
import personSelect from '@/components/CommomSelect/person-select.vue';
|
|
|
import parentList from '@/views/saleManage/contact/components/parentList.vue';
|
|
|
- import {
|
|
|
- addReturnInformation,
|
|
|
- getReturnSaleOrderrecordDetail,
|
|
|
- UpdateReturnInformation
|
|
|
- } from '@/api/saleManage/returnGoods';
|
|
|
- import {
|
|
|
- getSendSaleOrderrecordDetailSplit
|
|
|
- } from '@/api/saleManage/saleordersendrecord';
|
|
|
import inventoryTable from './inventoryTable.vue';
|
|
|
import { copyObj } from '@/utils/util';
|
|
|
- import { getPSaleEntrustedReceiveDetailAPI } from '@/api/saleManage/entrustedReceive';
|
|
|
import { getWarehouseListByIds } from '@/api/purchasingManage/returnGoods';
|
|
|
import fileMain from '@/components/addDoc/index.vue';
|
|
|
import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
|
|
|
import orderListDialog from '@/views/saleManage/saleOrder/invoice/components/orderListDialog.vue';
|
|
|
import inventoryTable1 from '@/BIZComponents/inventoryTable.vue';
|
|
|
import inventoryTableDetails from '@/BIZComponents/inventoryTableDetails.vue';
|
|
|
- import { getSendSaleOrderConfirmDetail } from '@/api/saleManage/invoiceConfirm';
|
|
|
- import { contactDetail } from '@/api/saleManage/contact';
|
|
|
import {
|
|
|
- getSaleOrderDetail
|
|
|
+ getSaleOrderDetail,
|
|
|
} from '@/api/saleManage/saleorder';
|
|
|
+ import { addCreate, getInfo, updateInfo } from '@/api/saleManage/adjustmentNote';
|
|
|
|
|
|
export default {
|
|
|
mixins: [dictMixins],
|
|
|
@@ -259,44 +250,32 @@
|
|
|
},
|
|
|
data() {
|
|
|
let formDef = {
|
|
|
+ orderNo: '',
|
|
|
type: '1',
|
|
|
method: '1',
|
|
|
reason: '1',
|
|
|
- range: '',
|
|
|
+ rangeType: '',
|
|
|
adjustType: '1',
|
|
|
+ sourceType: '1',
|
|
|
+ sourceNo: '',
|
|
|
+ sourceId: '',
|
|
|
files: [],
|
|
|
- repliedFiles: [],
|
|
|
- remark: '',
|
|
|
- payAmount: 0,
|
|
|
- sendId: '',
|
|
|
- sendNo: '',
|
|
|
- orderId: '',
|
|
|
- orderIds: '',
|
|
|
- orderNo: '',
|
|
|
- totalAmount: '',
|
|
|
- returnType: '',
|
|
|
- pricingWay: '',
|
|
|
- returnSourceType: 3,
|
|
|
- isOrderAll: 0,
|
|
|
- entrustedCode: '',
|
|
|
- entrustedId: '',
|
|
|
- entrustedReceiveId: '',
|
|
|
- entrustedReceiveCode: ''
|
|
|
+ differenceAmount: '',
|
|
|
+ amount: '',
|
|
|
+ discountAmount: '',
|
|
|
+ sourceNo: '',
|
|
|
+ sourceId: '',
|
|
|
+ adjustAmount: '',
|
|
|
+ adjustDiscountAmount: ''
|
|
|
};
|
|
|
|
|
|
return {
|
|
|
orderOption: [],
|
|
|
- fullscreen: false, //全屏
|
|
|
- customerMark: '',
|
|
|
oldProductList: [],
|
|
|
detailData: {},
|
|
|
- payWayOptions: [],
|
|
|
- delDetailIds: [],
|
|
|
- linkNameOptions: [],
|
|
|
acceptUnpackoptions,
|
|
|
visible: false,
|
|
|
processSubmitDialogFlag: false,
|
|
|
- outboundDetailsDialogFlag1: false,
|
|
|
title: '',
|
|
|
row: {},
|
|
|
activeName: 'base',
|
|
|
@@ -305,8 +284,6 @@
|
|
|
orderForm: {},
|
|
|
tableBankData: [],
|
|
|
tableLinkData: [],
|
|
|
- // 组织机构树形结构数据
|
|
|
- groupTreeData: [],
|
|
|
groupData: [],
|
|
|
rules: {
|
|
|
type: [
|
|
|
@@ -314,24 +291,23 @@
|
|
|
],
|
|
|
method: [{ required: true, message: '请选择', trigger: 'change' }],
|
|
|
reason: [{ required: true, message: '请选择', trigger: 'change' }],
|
|
|
- range: [{ required: true, message: '请选择', trigger: 'change' }],
|
|
|
+ rangeType: [{ required: true, message: '请选择', trigger: 'change' }],
|
|
|
adjustType: [{ required: true, message: '请选择', trigger: 'change' }],
|
|
|
// files: [{ required: true, message: '请上传附件', trigger: 'change' }],
|
|
|
+ adjustDiscountAmount: [{ required: true, message: '请输入', trigger: 'change' }],
|
|
|
},
|
|
|
// 提交状态
|
|
|
loading: false,
|
|
|
// 是否是修改
|
|
|
isUpdate: false,
|
|
|
- entrustedReceiveDialogFlag: false,
|
|
|
businessId: '',
|
|
|
orderId: '',
|
|
|
- outboundDetailsDialogFlag: false,
|
|
|
productList: [],
|
|
|
adjustData: [],
|
|
|
};
|
|
|
},
|
|
|
- created() {
|
|
|
- this.requestDict('产地');
|
|
|
+ async created() {
|
|
|
+
|
|
|
},
|
|
|
computed: {
|
|
|
totalAmount() {
|
|
|
@@ -373,11 +349,23 @@
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ // 选择需要冲差的产品
|
|
|
handleSelectionChange(list) {
|
|
|
// this.form.productList = val;
|
|
|
console.log('select------list', list);
|
|
|
// 创建深拷贝避免引用关系
|
|
|
- this.adjustData = JSON.parse(JSON.stringify(list));
|
|
|
+ this.adjustData = JSON.parse(JSON.stringify(list))?.map(item => ({
|
|
|
+ ...item,
|
|
|
+ price: item.singlePrice,
|
|
|
+ adjustPrice: item.singlePrice,
|
|
|
+ quantity: item.saleCount,
|
|
|
+ adjustDiscountPrice: item.discountSinglePrice,
|
|
|
+ adjustDiscountAmount: item.discountTotalPrice,
|
|
|
+ adjustAmount: item.totalPrice,
|
|
|
+ sourceDetailId: item.id,
|
|
|
+ discountPrice: item.discountSinglePrice,
|
|
|
+ unTaxPrice: item.notaxSinglePrice,
|
|
|
+ }));
|
|
|
|
|
|
if (this.$refs.inventoryTableRef) {
|
|
|
// 获取当前inventoryTable中已有的数据
|
|
|
@@ -396,9 +384,13 @@
|
|
|
if (existingItemsMap[item.productCode]) {
|
|
|
// 保留已编辑的字段
|
|
|
const existingItem = existingItemsMap[item.productCode];
|
|
|
- item.singlePriceDiff = existingItem.singlePriceDiff !== undefined ? existingItem.singlePriceDiff : item.singlePriceDiff;
|
|
|
- item.totalCount = existingItem.totalCount !== undefined ? existingItem.totalCount : item.totalCount;
|
|
|
- item.totalPrice = existingItem.totalPrice !== undefined ? existingItem.totalPrice : item.totalPrice;
|
|
|
+ item.priceDifference = existingItem.priceDifference !== undefined ? existingItem.priceDifference : item.priceDifference;
|
|
|
+ item.adjustPrice = existingItem.adjustPrice !== undefined ? existingItem.adjustPrice : item.adjustPrice;
|
|
|
+ item.quantity = existingItem.quantity !== undefined ? existingItem.quantity : item.quantity;
|
|
|
+ item.adjustDiscountPrice = existingItem.adjustDiscountPrice !== undefined ? existingItem.adjustDiscountPrice : item.adjustDiscountPrice;
|
|
|
+ item.adjustDiscountAmount = existingItem.adjustDiscountAmount !== undefined ? existingItem.adjustDiscountAmount : item.adjustDiscountAmount;
|
|
|
+ item.adjustAmount = existingItem.adjustAmount !== undefined ? existingItem.adjustAmount : item.adjustAmount;
|
|
|
+ item.unTaxPrice = existingItem.unTaxPrice !== undefined ? existingItem.unTaxPrice : item.unTaxPrice;
|
|
|
|
|
|
// 移除已处理的项
|
|
|
delete existingItemsMap[item.productCode];
|
|
|
@@ -409,6 +401,16 @@
|
|
|
this.$refs.inventoryTableRef.putTableValue(this.adjustData);
|
|
|
}
|
|
|
},
|
|
|
+ // 计算总金额和优惠总金额
|
|
|
+ setCountAmount(allPrice, diffPriceTotal) {
|
|
|
+ this.form.adjustAmount = this.orderForm.totalAmount + Number(diffPriceTotal);
|
|
|
+ this.form.adjustDiscountAmount = this.orderForm.payAmount + Number(diffPriceTotal);
|
|
|
+ this.form.differenceAmount = diffPriceTotal;
|
|
|
+ },
|
|
|
+ // 优惠后总金额修改产品折让单价
|
|
|
+ discountInput() {
|
|
|
+ this.$refs.inventoryTableRef.discountInputByOrder(this.form.adjustDiscountAmount, this.form.amount);
|
|
|
+ },
|
|
|
//删除产品
|
|
|
remove(row) {
|
|
|
if (this.form.productList.length === 1)
|
|
|
@@ -419,365 +421,60 @@
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- async contactDetail(id) {
|
|
|
- const { base } = await contactDetail(id);
|
|
|
- this.customerMark = base.serialNo;
|
|
|
- this.$refs.inventoryTableref1.setCustomerMark(base.serialNo);
|
|
|
- },
|
|
|
- //设置退货类型
|
|
|
- handleSetReturnSourceType(val) {
|
|
|
- this.form = Object.assign({}, this.form, {
|
|
|
- orderId: '',
|
|
|
- orderIds: '',
|
|
|
- sendNo: '',
|
|
|
- orderNo: '',
|
|
|
- sendId: '',
|
|
|
- contactName: '',
|
|
|
- contactId: '',
|
|
|
- pricingWay: '',
|
|
|
- entrustedCode: '',
|
|
|
- entrustedId: '',
|
|
|
- entrustedReceiveId: '',
|
|
|
- entrustedReceiveCode: ''
|
|
|
- });
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.inventoryTableRef &&
|
|
|
- this.$refs.inventoryTableRef.putTableValue([]);
|
|
|
- this.$refs.inventoryTableDetailsRef &&
|
|
|
- this.$refs.inventoryTableDetailsRef.putTableValue([]);
|
|
|
- });
|
|
|
- },
|
|
|
- //选择受托收货单弹框
|
|
|
- handleEntrustedReceive(e) {
|
|
|
- if (e.target.nodeName == 'I') {
|
|
|
- this.form = Object.assign({}, this.form, {
|
|
|
- carNo: '',
|
|
|
- carId: '',
|
|
|
- linkName: '',
|
|
|
- linkPhone: '',
|
|
|
- orderNo: '',
|
|
|
- orderId: '',
|
|
|
- contactId: '',
|
|
|
- contactName: '',
|
|
|
- entrustedCode: '',
|
|
|
- entrustedId: '',
|
|
|
- sendNoteNo: '',
|
|
|
- pricingWay: '',
|
|
|
- entrustedReceiveId: '',
|
|
|
- entrustedReceiveCode: ''
|
|
|
- });
|
|
|
- this.$refs.inventoryTableRef &&
|
|
|
- this.$refs.inventoryTableRef.putTableValue([]);
|
|
|
- return;
|
|
|
- }
|
|
|
- this.entrustedReceiveDialogFlag = true;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.entrustedReceiveDialogRef.init();
|
|
|
- });
|
|
|
- },
|
|
|
- //获取受托收货单数据回调
|
|
|
- async getInfo(row, type) {
|
|
|
- if (!row.id) {
|
|
|
- return;
|
|
|
- }
|
|
|
- const data = await getPSaleEntrustedReceiveDetailAPI(row.id);
|
|
|
- if (data) {
|
|
|
- this.productList = data.productList;
|
|
|
- if (type) {
|
|
|
- this.$refs.inventoryTableDetailsRef &&
|
|
|
- this.$refs.inventoryTableDetailsRef.putTableValue(
|
|
|
- data.productList.map((item) => {
|
|
|
- item['extField'] = item.extField || [];
|
|
|
- return item;
|
|
|
- })
|
|
|
- );
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- this.getOrderOption(data);
|
|
|
- this.$nextTick(() => {
|
|
|
- let { code, id, productList, contactId, contactName } = data;
|
|
|
- if (productList && productList.length > 0) {
|
|
|
- productList.forEach((v) => {
|
|
|
- v.orderTotalCount = v.orderTotalCount || v.totalCount;
|
|
|
- });
|
|
|
- }
|
|
|
- this.form = Object.assign({}, this.form, {
|
|
|
- orderId: data.orderId,
|
|
|
- orderIds: data.orderIds,
|
|
|
- sendNo: '',
|
|
|
- sendId: '',
|
|
|
- contactName,
|
|
|
- contactId,
|
|
|
- entrustedCode: code,
|
|
|
- entrustedId: id,
|
|
|
- entrustedReceiveId: id,
|
|
|
- entrustedReceiveCode: code
|
|
|
- });
|
|
|
- this.handleSelectGoods();
|
|
|
-
|
|
|
- this.$refs.inventoryTableDetailsRef &&
|
|
|
- this.$refs.inventoryTableDetailsRef.putTableValue(
|
|
|
- data.productList.map((item) => {
|
|
|
- item['extField'] = item.extField || [];
|
|
|
- return item;
|
|
|
- })
|
|
|
- );
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- //选择发货单回调
|
|
|
- changeOrder(obj = {}) {
|
|
|
- this.getSendSaleOrderMultipleDetail(obj);
|
|
|
- },
|
|
|
- //多发货单详情
|
|
|
- async getSendSaleOrderMultipleDetail(params) {
|
|
|
- this.loading = true;
|
|
|
- this.productList = [];
|
|
|
- let data = {},
|
|
|
- res = {};
|
|
|
- this.$refs.inventoryTableRef &&
|
|
|
- this.$refs.inventoryTableRef.putTableValue([]);
|
|
|
- this.$refs.inventoryTableref1 &&
|
|
|
- this.$refs.inventoryTableref1.putTableValue({
|
|
|
- productList: []
|
|
|
- });
|
|
|
- if (params.activeName == 1) {
|
|
|
- data = await getSendSaleOrderrecordDetailSplit(params.id);
|
|
|
- } else {
|
|
|
- res = await getSendSaleOrderConfirmDetail(params.id);
|
|
|
- data = await getSendSaleOrderrecordDetailSplit(res.sendId);
|
|
|
- }
|
|
|
- this.loading = false;
|
|
|
- if (data) {
|
|
|
- this.getOrderOption(data);
|
|
|
-
|
|
|
- this.$nextTick(() => {
|
|
|
- this.setForm(data);
|
|
|
- if (params.activeName == 2) {
|
|
|
- this.productList = data.productList;
|
|
|
- res.productList.forEach((item) => {
|
|
|
- item['orderId'] = this.orderOption[0]?.orderId;
|
|
|
- item['orderNo'] = this.orderOption[0]?.orderNo;
|
|
|
- });
|
|
|
-
|
|
|
- this.$refs.inventoryTableRef &&
|
|
|
- this.$refs.inventoryTableRef.putTableValue(res.productList);
|
|
|
- this.$refs.inventoryTableDetailsRef &&
|
|
|
- this.$refs.inventoryTableDetailsRef.putTableValue(
|
|
|
- data.productList
|
|
|
- );
|
|
|
- return;
|
|
|
- }
|
|
|
- this.productList = data.productList;
|
|
|
- if (
|
|
|
- !['40', '50'].includes(this.form.type) ||
|
|
|
- this.form.returnSourceType != 1
|
|
|
- ) {
|
|
|
- this.handleSelectGoods();
|
|
|
- }
|
|
|
-
|
|
|
- this.$refs.inventoryTableDetailsRef &&
|
|
|
- this.$refs.inventoryTableDetailsRef.putTableValue(
|
|
|
- data.productList
|
|
|
- );
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- setForm(data) {
|
|
|
- data.productList.forEach((item) => {
|
|
|
- item.sendProductId = item.id;
|
|
|
- item.id = '';
|
|
|
- });
|
|
|
- if (data.contactId) {
|
|
|
- this.contactDetail(data.contactId);
|
|
|
- }
|
|
|
- this.form = Object.assign({}, this.form, {
|
|
|
- orderIds: data.orderIds || data.orderId,
|
|
|
- sendNo: data.docNo,
|
|
|
- orderNo: data.orderNo,
|
|
|
- sendId: data.id,
|
|
|
- contactName: data.contactName,
|
|
|
- contactId: data.contactId,
|
|
|
- entrustedCode: data.entrustedCode,
|
|
|
- entrustedId: data.entrustedCode,
|
|
|
- entrustedReceiveId: '',
|
|
|
- entrustedReceiveCode: ''
|
|
|
- });
|
|
|
- },
|
|
|
- getOrderOption(data) {
|
|
|
- if (data.orderIds) {
|
|
|
- this.orderOption = data.orderIds.split(',').map((item, index) => {
|
|
|
- return {
|
|
|
- orderId: item,
|
|
|
- orderNo: data.orderNo.split(',')[index]
|
|
|
- };
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.orderOption = [
|
|
|
- {
|
|
|
- orderId: data.orderId,
|
|
|
- orderNo: data.orderNo
|
|
|
- }
|
|
|
- ];
|
|
|
- }
|
|
|
- },
|
|
|
- //选择退货明细
|
|
|
- handleSelectGoods(list) {
|
|
|
- if (this.form.returnSourceType != 2) {
|
|
|
- this.outboundDetailsDialogFlag = true;
|
|
|
- } else {
|
|
|
- this.outboundDetailsDialogFlag1 = true;
|
|
|
- }
|
|
|
- this.$nextTick(() => {
|
|
|
- if (this.form.returnSourceType != 2) {
|
|
|
- this.$refs.outboundDetailsDialogRef.init(this.form, list);
|
|
|
- } else {
|
|
|
- this.$refs.outboundDetailsDialogRef1.init(this.form, list);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- saveDate(data) {
|
|
|
- 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['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;
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- this.$refs.inventoryTableRef &&
|
|
|
- this.$refs.inventoryTableRef.putTableValue(data);
|
|
|
- },
|
|
|
- //发货单详情
|
|
|
- async getSendSaleOrderDetail(id, type) {
|
|
|
- this.loading = true;
|
|
|
- const data = await getSendSaleOrderrecordDetailSplit(id);
|
|
|
-
|
|
|
- this.getOrderOption(data);
|
|
|
-
|
|
|
- this.productList = data.productList;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.inventoryTableDetailsRef &&
|
|
|
- this.$refs.inventoryTableDetailsRef.putTableValue(data.productList);
|
|
|
- });
|
|
|
-
|
|
|
- if (type) return;
|
|
|
- // if (data.entrustedCode) {
|
|
|
- // this.form.returnSourceType = 2;
|
|
|
- // await this.getInfo({ id: data.entrustedId });
|
|
|
-
|
|
|
- // this.loading = false;
|
|
|
- // return;
|
|
|
- // }
|
|
|
- this.loading = false;
|
|
|
- if (data) {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.setForm(data);
|
|
|
- this.handleSelectGoods();
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- //获取退货单详情
|
|
|
- async getReturnSaleOrderrecordDetail(id) {
|
|
|
- this.businessId = id;
|
|
|
-
|
|
|
- this.loading = true;
|
|
|
- const data = await getReturnSaleOrderrecordDetail(id);
|
|
|
- this.loading = false;
|
|
|
- if (data) {
|
|
|
- this.form = data;
|
|
|
- this.orderOption = data.returnOrderList;
|
|
|
- this.form.entrustedCode = data?.entrustedReceiveCode;
|
|
|
- this.form.entrustedId = data?.entrustedReceiveId;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.inventoryTableRef &&
|
|
|
- this.$refs.inventoryTableRef.putTableValue(data.productList);
|
|
|
- this.$refs.inventoryTableref1 &&
|
|
|
- this.$refs.inventoryTableref1.putTableValue({
|
|
|
- productList: data.redressProductList
|
|
|
- });
|
|
|
- if (this.form.returnSourceType != 2) {
|
|
|
- this.getSendSaleOrderDetail(data.sendId, 1);
|
|
|
- } else {
|
|
|
- this.getInfo({ id: data.entrustedReceiveId }, 1);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- //选择订单弹框
|
|
|
- handleOrderBtn() {
|
|
|
- let item = {
|
|
|
- id: this.form.sendId
|
|
|
- };
|
|
|
- this.$refs.sendListDialogRef.open(item);
|
|
|
- },
|
|
|
- handleSaleOrderBtn() {
|
|
|
- let item = {
|
|
|
- id: this.form.orderId
|
|
|
- };
|
|
|
- this.$refs.orderListDialogRef.open(item);
|
|
|
+ // 处理单价差异变化,更新单价
|
|
|
+ handleChangePrice(obj) {
|
|
|
+ this.form.differenceAmount = obj.total;
|
|
|
},
|
|
|
+
|
|
|
|
|
|
//打开新增编辑弹框
|
|
|
async open(type, row) {
|
|
|
this.title = type === 'add' ? '新增' : '修改';
|
|
|
+ this.isUpdate = type != 'add';
|
|
|
this.row = row;
|
|
|
this.visible = true;
|
|
|
-
|
|
|
- if (row && row?.id) {
|
|
|
+ console.log('row~~~~~~~~~~', row);
|
|
|
+ if (row && row?.id && !this.isUpdate) {
|
|
|
await this.getSaleOrderDetail(row?.id);
|
|
|
+ } else {
|
|
|
+ const data = await getInfo(row?.id);
|
|
|
+ if (data) {
|
|
|
+ const tempdata = {
|
|
|
+ // ...data,
|
|
|
+ totalPrice: data.amount,
|
|
|
+ discountTotalPrice: data.discountAmount,
|
|
|
+ productList: data.originalList
|
|
|
+ }
|
|
|
+ this.businessId = data.id;
|
|
|
+ this.adjustData = data.detailList;
|
|
|
+ this.form = data;
|
|
|
+ this.$refs.inventoryTableDetailsRef &&
|
|
|
+ this.$refs.inventoryTableDetailsRef.putTableValue(tempdata);
|
|
|
+ this.$refs.inventoryTableRef && this.$refs.inventoryTableRef.putTableValue(data.detailList);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- this.isUpdate = type != 'add';
|
|
|
+
|
|
|
},
|
|
|
|
|
|
- //获取订单详情
|
|
|
+ //获取销售订单详情
|
|
|
async getSaleOrderDetail(id) {
|
|
|
- this.businessId = id;
|
|
|
+ // this.businessId = id;
|
|
|
this.loading = true;
|
|
|
const data = await getSaleOrderDetail(id);
|
|
|
this.loading = false;
|
|
|
this.orderForm = data;
|
|
|
- // if (data.partaId) {
|
|
|
- // await this.changeParent({ id: data.partaId }, true);
|
|
|
- // }
|
|
|
+
|
|
|
console.log('data~~~订单详情', data);
|
|
|
if (data) {
|
|
|
+ this.form.sourceNo = data.orderNo;
|
|
|
+ this.form.sourceId = data.id;
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.inventoryTableDetailsRef &&
|
|
|
this.$refs.inventoryTableDetailsRef.putTableValue(data);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
- salesmanChange(val, info) {
|
|
|
- this.otherForm.salesmanName = info.name;
|
|
|
- },
|
|
|
- settlementModeChange(info) {
|
|
|
- this.form.settlementModeName = info.dictValue;
|
|
|
- },
|
|
|
- ifChiefChange(value, idx) {
|
|
|
- if (value === 1) {
|
|
|
- this.tableLinkData.forEach((e) => (e.ifChief = 0));
|
|
|
- this.tableLinkData[idx].ifChief = 1;
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- getValidate() {
|
|
|
+ getValidate() {
|
|
|
let proAll = [
|
|
|
new Promise((resolve, reject) => {
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
@@ -789,22 +486,19 @@
|
|
|
});
|
|
|
})
|
|
|
];
|
|
|
- if (
|
|
|
- !['40', '50'].includes(this.form.type) ||
|
|
|
- this.form.returnSourceType != 1
|
|
|
- ) {
|
|
|
- proAll.push(
|
|
|
- new Promise((resolve, reject) => {
|
|
|
- this.$refs.inventoryTableRef.validateForm((valid) => {
|
|
|
- if (!valid) {
|
|
|
- reject(false);
|
|
|
- } else {
|
|
|
- resolve(true);
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
- );
|
|
|
- }
|
|
|
+
|
|
|
+ proAll.push(
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ this.$refs.inventoryTableRef.validateForm((valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ reject(false);
|
|
|
+ } else {
|
|
|
+ resolve(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ );
|
|
|
+
|
|
|
return Promise.all(proAll);
|
|
|
},
|
|
|
async save(type) {
|
|
|
@@ -817,68 +511,59 @@
|
|
|
delete this.form.id;
|
|
|
}
|
|
|
let data = this.$refs.inventoryTableRef.getTableValue();
|
|
|
- let redressProductList =
|
|
|
- (this.$refs.inventoryTableref1 &&
|
|
|
- this.$refs.inventoryTableref1.getTableValue()) ||
|
|
|
- [];
|
|
|
-
|
|
|
+ // let redressProductList =
|
|
|
+ // (this.$refs.inventoryTableref1 &&
|
|
|
+ // this.$refs.inventoryTableref1.getTableValue()) ||
|
|
|
+ // [];
|
|
|
+ console.log('data!!!!!!', data);
|
|
|
if (
|
|
|
- data.productList.length === 0 &&
|
|
|
- (!['40', '50'].includes(this.form.type) ||
|
|
|
- this.form.returnSourceType != 1)
|
|
|
+ data.productList.length === 0
|
|
|
) {
|
|
|
- return this.$message.error('至少选择一个退货产品');
|
|
|
+ return this.$message.error('至少选择一个冲差产品');
|
|
|
}
|
|
|
- let orderIds = [...data.productList, ...redressProductList].map(
|
|
|
- (item) => item.orderId
|
|
|
- );
|
|
|
- let orderNos = [...data.productList, ...redressProductList].map(
|
|
|
- (item) => item.orderNo
|
|
|
- );
|
|
|
-
|
|
|
- this.form.repliedFiles = this.form.repliedFiles || [];
|
|
|
- this.form.replied = this.form.repliedFiles.length > 0 ? 1 : 0;
|
|
|
- this.form.typeName = this.getDictValue('退货类型', this.form.type);
|
|
|
+ // let orderIds = [...data.productList, ...redressProductList].map(
|
|
|
+ // (item) => item.orderId
|
|
|
+ // );
|
|
|
+ // let orderNos = [...data.productList, ...redressProductList].map(
|
|
|
+ // (item) => item.orderNo
|
|
|
+ // );
|
|
|
+
|
|
|
+ // this.form.repliedFiles = this.form.repliedFiles || [];
|
|
|
+ // this.form.replied = this.form.repliedFiles.length > 0 ? 1 : 0;
|
|
|
+ // this.form.typeName = this.getDictValue('退货类型', this.form.type);
|
|
|
let commitData = Object.assign({}, this.form, {
|
|
|
- totalAmount: this.totalAmount,
|
|
|
- productList: data.productList,
|
|
|
- payAmount: this.totalAmount,
|
|
|
- redressProductList,
|
|
|
- returnOrderList: this.orderOption
|
|
|
- });
|
|
|
- let productListData = [];
|
|
|
- data.productList.forEach((item) => {
|
|
|
- if (!item.totalCount) {
|
|
|
- productListData.push(item.productName);
|
|
|
- }
|
|
|
+
|
|
|
+ detailList: data.productList,
|
|
|
+ originalList: this.orderForm.productList,
|
|
|
+
|
|
|
});
|
|
|
- console.log(productListData);
|
|
|
- if (productListData.length) {
|
|
|
- return this.$message.error(
|
|
|
- productListData.toString() + ' 退货数量不能为空!'
|
|
|
- );
|
|
|
- }
|
|
|
- if (orderIds?.length) {
|
|
|
- commitData.orderIds = Array.from(new Set(orderIds)).toString();
|
|
|
- }
|
|
|
- if (orderNos?.length) {
|
|
|
- commitData.orderNo = Array.from(new Set(orderNos)).toString();
|
|
|
- }
|
|
|
- // return;
|
|
|
+ // let productListData = [];
|
|
|
+ // data.productList.forEach((item) => {
|
|
|
+ // if (!item.totalCount) {
|
|
|
+ // productListData.push(item.productName);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // console.log(productListData);
|
|
|
+ // if (productListData.length) {
|
|
|
+ // return this.$message.error(
|
|
|
+ // productListData.toString() + ' 退货数量不能为空!'
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+
|
|
|
if (this.isUpdate) {
|
|
|
- UpdateReturnInformation(commitData)
|
|
|
+ updateInfo(commitData)
|
|
|
.then(async (res) => {
|
|
|
this.loading = false;
|
|
|
|
|
|
this.$message.success('修改成功');
|
|
|
if (type === 'sub') {
|
|
|
let storemanIds = '';
|
|
|
- let ids = commitData.productList.map(
|
|
|
+ let ids = commitData.detailList.map(
|
|
|
(item) => item.warehouseId
|
|
|
);
|
|
|
let warehouseList = await getWarehouseListByIds(ids || []);
|
|
|
storemanIds = warehouseList.map((item) => item.ownerId);
|
|
|
- await this.returnSubmit(res, storemanIds.toString());
|
|
|
+ await this.adjustSubmit(res, storemanIds.toString());
|
|
|
return;
|
|
|
}
|
|
|
this.cancel();
|
|
|
@@ -888,18 +573,18 @@
|
|
|
//this.loading = false;
|
|
|
});
|
|
|
} else {
|
|
|
- addReturnInformation(commitData)
|
|
|
+ addCreate(commitData)
|
|
|
.then(async (res) => {
|
|
|
this.loading = false;
|
|
|
this.$message.success('新增成功');
|
|
|
if (type === 'sub') {
|
|
|
- let storemanIds = '';
|
|
|
- let ids = commitData.productList.map(
|
|
|
- (item) => item.warehouseId
|
|
|
- );
|
|
|
- let warehouseList = await getWarehouseListByIds(ids || []);
|
|
|
- storemanIds = warehouseList.map((item) => item.ownerId);
|
|
|
- this.returnSubmit(res, storemanIds.toString());
|
|
|
+ // let storemanIds = '';
|
|
|
+ // let ids = commitData.detailList.map(
|
|
|
+ // (item) => item.warehouseId
|
|
|
+ // );
|
|
|
+ // let warehouseList = await getWarehouseListByIds(ids || []);
|
|
|
+ // storemanIds = warehouseList.map((item) => item.ownerId);
|
|
|
+ this.adjustSubmit(res);
|
|
|
this.$emit('done');
|
|
|
return;
|
|
|
}
|
|
|
@@ -915,8 +600,8 @@
|
|
|
// 表单验证未通过,不执行保存操作
|
|
|
}
|
|
|
},
|
|
|
- async returnSubmit(res, storemanIds) {
|
|
|
- const data = await getReturnSaleOrderrecordDetail(
|
|
|
+ async adjustSubmit(res) {
|
|
|
+ const data = await getInfo(
|
|
|
this.businessId || res
|
|
|
);
|
|
|
this.processSubmitDialogFlag = true;
|
|
|
@@ -924,26 +609,14 @@
|
|
|
this.$nextTick(() => {
|
|
|
let params = {
|
|
|
businessId: this.businessId || res,
|
|
|
- businessKey:
|
|
|
- this.form.returnSourceType == 1
|
|
|
- ? 'sale_return_approve1'
|
|
|
- : this.form.returnSourceType == 2
|
|
|
- ? 'sale_entrusted_receive_return_approve'
|
|
|
- : 'sales_return_approve',
|
|
|
+ businessKey: 'punch_slip_order_approve',
|
|
|
formCreateUserId: data.createUserId,
|
|
|
variables: {
|
|
|
- returnSourceType: data.returnSourceType,
|
|
|
- storemanIds: storemanIds.toString(),
|
|
|
- businessCode: data.returnNo,
|
|
|
- businessName: data.contactName,
|
|
|
- businessType:
|
|
|
- data.returnSourceType == 1
|
|
|
- ? '售后退货'
|
|
|
- : data.returnSourceType == 3
|
|
|
- ? '销售发货退货'
|
|
|
- : data.returnSourceType == 2
|
|
|
- ? '受托收货退货'
|
|
|
- : '销售订单退货'
|
|
|
+ // returnSourceType: data.returnSourceType,
|
|
|
+ // storemanIds: storemanIds.toString(),
|
|
|
+ businessCode: data.orderNo,
|
|
|
+ businessName: data.createUserName,
|
|
|
+ businessType: '冲差单'
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -960,11 +633,10 @@
|
|
|
},
|
|
|
cancel() {
|
|
|
this.$nextTick(() => {
|
|
|
- this.activeName = 'base';
|
|
|
// 关闭后,销毁所有的表单数据
|
|
|
- this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
|
|
|
- this.$refs['formRef'] && this.$refs['formRef'].resetFields();
|
|
|
- this.$store.commit('order/clearUserData');
|
|
|
+ // this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
|
|
|
+ this.$refs['form'] && this.$refs['form'].resetFields();
|
|
|
+ // this.$store.commit('order/clearUserData');
|
|
|
this.form = copyObj(this.formDef);
|
|
|
// 通过$emit更新父组件中的addAdjustDialogFlag值,避免直接修改prop
|
|
|
this.$emit('update:addAdjustDialogFlag', false);
|