|
@@ -1,80 +1,5 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
- <!-- <div v-for="(item) in datasource" style="margin-bottom: 10px">
|
|
|
|
|
- <div>
|
|
|
|
|
- <div style="margin-bottom: 10px;font-weight: bold;">
|
|
|
|
|
- <div>
|
|
|
|
|
- <el-divider direction="vertical"></el-divider>
|
|
|
|
|
- <span><span>{{ index + 1 }}</span> 销售订单:</span>
|
|
|
|
|
- <span>{{ item.orderNo }}</span>
|
|
|
|
|
- <el-divider direction="vertical"></el-divider> -->
|
|
|
|
|
- <!-- <span>计价方式:</span>
|
|
|
|
|
- <span> {{ item.pricingWay == 1 ? '按数量计费' : '按重量计费' }}</span> -->
|
|
|
|
|
- <!-- <el-divider direction="vertical"></el-divider> -->
|
|
|
|
|
- <!-- <span>总金额:</span>
|
|
|
|
|
- <span>{{item.amountTotalPrice}}</span>
|
|
|
|
|
- <el-divider direction="vertical"></el-divider>
|
|
|
|
|
- <span>应收金额:</span>
|
|
|
|
|
- <span>{{item.amountReceivablePrice}}</span>
|
|
|
|
|
- <el-divider direction="vertical"></el-divider>
|
|
|
|
|
- <span>应付金额:</span>
|
|
|
|
|
- <span>{{item.amountPayablePrice}}</span>
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <template v-if="item.orderType!=6">
|
|
|
|
|
- <div v-for="(j,i) in item.subList" :key="i">
|
|
|
|
|
- <ele-pro-table :show-summary="true" :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
|
|
|
|
|
- :columns="getColumns(j)" max-height="500px" style="margin-bottom: 10px"
|
|
|
|
|
- :sub-title="getTitle(j)" :toolkit="[]" :datasource="j.detailList"
|
|
|
|
|
- cache-key="systemRoleTable17-11121" class="time-form">
|
|
|
|
|
- <template v-slot:action="{ row,$index }">
|
|
|
|
|
- <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(index,$index,'line')">
|
|
|
|
|
- <template v-slot:reference>
|
|
|
|
|
- <el-link type="danger" v-if="dialogType!=='view'" :underline="false" icon="el-icon-delete">
|
|
|
|
|
- 删除
|
|
|
|
|
- </el-link>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-popconfirm>
|
|
|
|
|
- </template>
|
|
|
|
|
- </ele-pro-table>
|
|
|
|
|
- </div>
|
|
|
|
|
- </template>
|
|
|
|
|
- <div v-else>
|
|
|
|
|
- <ele-pro-table :show-summary="true" :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
|
|
|
|
|
- :columns="getColumns({subType:10})" sub-title="赔付订单" max-height="500px" style="margin-bottom: 10px"
|
|
|
|
|
- :toolkit="[]" :datasource="item.detailList"
|
|
|
|
|
- cache-key="systemRoleTable17-11121" class="time-form">
|
|
|
|
|
- <template v-slot:action="{ row,$index }">
|
|
|
|
|
- <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(index,$index,'line')">
|
|
|
|
|
- <template v-slot:reference>
|
|
|
|
|
- <el-link type="danger" v-if="dialogType!=='view'" :underline="false" icon="el-icon-delete">
|
|
|
|
|
- 删除
|
|
|
|
|
- </el-link>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-popconfirm>
|
|
|
|
|
- </template> -->
|
|
|
|
|
- <!-- <template v-slot:productName="{ row,$index }">-->
|
|
|
|
|
- <!-- <el-popover-->
|
|
|
|
|
- <!-- placement="right"-->
|
|
|
|
|
- <!-- width="60%"-->
|
|
|
|
|
- <!-- trigger="hover">-->
|
|
|
|
|
- <!-- <ele-pro-table ref="childrenTable"-->
|
|
|
|
|
- <!-- row-key="id"-->
|
|
|
|
|
- <!-- max-height="300px"-->
|
|
|
|
|
- <!-- :needPage="false" :columns="childrenColumns" :toolkit="[]"-->
|
|
|
|
|
- <!-- :datasource="row.productList"-->
|
|
|
|
|
- <!-- cache-key="systemRoleTable17-222" class="time-form">-->
|
|
|
|
|
- <!-- </ele-pro-table>-->
|
|
|
|
|
- <!-- <el-button type="text" slot="reference">{{ row.productName }}</el-button>-->
|
|
|
|
|
- <!-- </el-popover>-->
|
|
|
|
|
- <!-- </template>-->
|
|
|
|
|
- <!-- </ele-pro-table>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div> -->
|
|
|
|
|
-
|
|
|
|
|
<el-collapse v-model="activeNames">
|
|
<el-collapse v-model="activeNames">
|
|
|
<el-collapse-item v-for="(item, index) in datasource" :key="index" :name="index">
|
|
<el-collapse-item v-for="(item, index) in datasource" :key="index" :name="index">
|
|
|
<template slot="title">
|
|
<template slot="title">
|
|
@@ -125,6 +50,27 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
+ <template v-slot:totalCount="scope">
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ style="margin-bottom: 20px"
|
|
|
|
|
+ :prop="'deliveryProducts.' + scope.$index + '.totalCount'"
|
|
|
|
|
+ :rules="[
|
|
|
|
|
+ { required: true, message: '请输入正确的数量', trigger: 'change' },
|
|
|
|
|
+ { validator: (rule, value, callback) => validateTotalCount(rule, value, callback, scope.row), trigger: 'change' }
|
|
|
|
|
+ ]"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="scope.row.totalCount"
|
|
|
|
|
+ placeholder="请输入"
|
|
|
|
|
+ :min="0"
|
|
|
|
|
+ @input="changeCount(scope.row, scope.$index, item, index)"
|
|
|
|
|
+ :disabled="item.orderCategory != 4 || dialogType === 'view'"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
<template v-slot:taxRate="scope">
|
|
<template v-slot:taxRate="scope">
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
:prop="'deliveryProducts.' + scope.$index + '.taxRate'"
|
|
:prop="'deliveryProducts.' + scope.$index + '.taxRate'"
|
|
@@ -169,10 +115,10 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
- <template v-slot:action="{ row,$index }">
|
|
|
|
|
- <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(index,$index,'line')">
|
|
|
|
|
|
|
+ <template v-slot:action="scope">
|
|
|
|
|
+ <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(scope.row, scope.$index, item, index)">
|
|
|
<template v-slot:reference>
|
|
<template v-slot:reference>
|
|
|
- <el-link type="danger" v-if="dialogType!=='view'" :underline="false" icon="el-icon-delete">
|
|
|
|
|
|
|
+ <el-link type="danger" v-if="item.orderCategory == 4 && dialogType!=='view'" :underline="false" icon="el-icon-delete">
|
|
|
删除
|
|
删除
|
|
|
</el-link>
|
|
</el-link>
|
|
|
</template>
|
|
</template>
|
|
@@ -192,10 +138,10 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
- <template v-slot:action="{ row,$index }">
|
|
|
|
|
- <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(index,$index,'line')">
|
|
|
|
|
|
|
+ <template v-slot:action="scope">
|
|
|
|
|
+ <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(scope.row, scope.$index, item, index)">
|
|
|
<template v-slot:reference>
|
|
<template v-slot:reference>
|
|
|
- <el-link type="danger" v-if="dialogType!=='view'" :underline="false" icon="el-icon-delete">
|
|
|
|
|
|
|
+ <el-link type="danger" v-if="item.orderCategory == 4 && dialogType!=='view'" :underline="false" icon="el-icon-delete">
|
|
|
删除
|
|
删除
|
|
|
</el-link>
|
|
</el-link>
|
|
|
</template>
|
|
</template>
|
|
@@ -424,7 +370,13 @@ export default {
|
|
|
slot: 'discountTotalPrice',
|
|
slot: 'discountTotalPrice',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ minWidth: 120,
|
|
|
|
|
+ prop: 'action',
|
|
|
|
|
+ label: '操作',
|
|
|
|
|
+ slot: 'action',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
]
|
|
]
|
|
|
let permissionType = {
|
|
let permissionType = {
|
|
@@ -715,13 +667,9 @@ export default {
|
|
|
}, 0)
|
|
}, 0)
|
|
|
this.$emit('changeDiscountPrice', row.statementAmount, tableIndex)
|
|
this.$emit('changeDiscountPrice', row.statementAmount, tableIndex)
|
|
|
},
|
|
},
|
|
|
- remove(tableIndex, lineIndex, delType) {
|
|
|
|
|
- let params = {
|
|
|
|
|
- tableIndex,
|
|
|
|
|
- lineIndex,
|
|
|
|
|
- delType
|
|
|
|
|
- }
|
|
|
|
|
- this.$emit('handleRemove', params)
|
|
|
|
|
|
|
+ remove(row, dindex, item, index) {
|
|
|
|
|
+ console.log('remove~~~', row, dindex, item, index)
|
|
|
|
|
+ item.deliveryProducts.splice(dindex, 1)
|
|
|
},
|
|
},
|
|
|
getSummaries(param) {
|
|
getSummaries(param) {
|
|
|
const {columns, data} = param;
|
|
const {columns, data} = param;
|
|
@@ -757,6 +705,19 @@ export default {
|
|
|
},
|
|
},
|
|
|
getValidForm() {
|
|
getValidForm() {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
+ // 校验:所有订单的deliveryProducts和returnProducts都为空则不能保存
|
|
|
|
|
+ const allEmpty = this.datasource.every(item => {
|
|
|
|
|
+ const deliveryEmpty = !item.deliveryProducts || item.deliveryProducts.length === 0;
|
|
|
|
|
+ const returnEmpty = !item.returnProducts || item.returnProducts.length === 0;
|
|
|
|
|
+ return deliveryEmpty && returnEmpty;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (allEmpty && this.datasource.length > 0) {
|
|
|
|
|
+ this.$message.error('至少有一个发货单或退货单产品');
|
|
|
|
|
+ reject(false);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const validationPromises = [];
|
|
const validationPromises = [];
|
|
|
|
|
|
|
|
this.datasource.forEach((item, index) => {
|
|
this.datasource.forEach((item, index) => {
|
|
@@ -802,6 +763,16 @@ export default {
|
|
|
reject(false);
|
|
reject(false);
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+ },
|
|
|
|
|
+ // 校验数量不能超过原始值且不能小于0
|
|
|
|
|
+ validateTotalCount(rule, value, callback, row) {
|
|
|
|
|
+ if (value && Number(value) < 0) {
|
|
|
|
|
+ callback(new Error('数量不能小于0'));
|
|
|
|
|
+ } else if (value && row.originalTotalCount && Number(value) > Number(row.originalTotalCount)) {
|
|
|
|
|
+ callback(new Error(`数量不能超过${row.originalTotalCount}`));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ callback();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|