|
|
@@ -91,72 +91,95 @@
|
|
|
<div>
|
|
|
<el-tabs type="border-card">
|
|
|
<el-tab-pane :label="type === 'purchase' ? '收货单' : '发货单'">
|
|
|
- <ele-pro-table :show-summary="false" :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
|
|
|
- :columns="getColumns(item, 'deliveryProducts')" max-height="500px" style="margin-bottom: 10px" :datasource="item.deliveryProducts || []"
|
|
|
- cache-key="systemRoleTable17-11121" class="time-form">
|
|
|
- <template v-slot:toolbar>
|
|
|
- <div class="headbox">
|
|
|
- <div>
|
|
|
- <span class="amount">对账金额合计:{{ getSummariesA(item.deliveryProducts || []) }}元</span>
|
|
|
+ <el-form :ref="'form' + index" :model="item">
|
|
|
+ <ele-pro-table :show-summary="false" :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
|
|
|
+ :columns="getColumns(item, 'deliveryProducts')" max-height="500px" style="margin-bottom: 10px" :datasource="item.deliveryProducts || []"
|
|
|
+ cache-key="systemRoleTable17-11121" class="time-form">
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <div class="headbox">
|
|
|
+ <div>
|
|
|
+ <span class="amount">对账金额合计:{{ getSummariesA(item.deliveryProducts || []) }}元</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ </template>
|
|
|
|
|
|
- <template v-slot:singlePrice="scope">
|
|
|
- <el-form-item
|
|
|
- style="margin-bottom: 20px"
|
|
|
- :prop="'datasource.' + scope.$index + '.singlePrice'"
|
|
|
- :rules="{
|
|
|
- required: true,
|
|
|
- message: '请输入正确的单价',
|
|
|
- trigger: 'change'
|
|
|
- }"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- v-model="scope.row.singlePrice"
|
|
|
- placeholder="请输入"
|
|
|
- @input="changeCount(scope.row, scope.$index)"
|
|
|
- type="number"
|
|
|
+ <template v-slot:singlePrice="scope">
|
|
|
+ <el-form-item
|
|
|
+ style="margin-bottom: 20px"
|
|
|
+ :prop="'deliveryProducts.' + scope.$index + '.singlePrice'"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请输入正确的单价',
|
|
|
+ trigger: 'change'
|
|
|
+ }"
|
|
|
>
|
|
|
- <template slot="append">元</template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.singlePrice"
|
|
|
+ placeholder="请输入"
|
|
|
+ @input="changeCount(scope.row, scope.$index)"
|
|
|
+ :disabled="scope.row.orderCategory != 4"
|
|
|
+ type="number"
|
|
|
+ >
|
|
|
+ <template slot="append">元</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
|
|
|
- <template v-slot:singleWeight="scope">
|
|
|
- <el-form-item
|
|
|
- style="margin-bottom: 20px"
|
|
|
- :rules="{
|
|
|
- required: false,
|
|
|
+ <template v-slot:taxRate="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'deliveryProducts.' + scope.$index + '.taxRate'"
|
|
|
+ :rules="{
|
|
|
+ required: isTaxRate == 1 ? true : false,
|
|
|
+ message: '请输入税率',
|
|
|
+ trigger: 'change'
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.taxRate"
|
|
|
+ placeholder="请输入"
|
|
|
+ type="number"
|
|
|
+ @input="getNotaxSinglePrice(scope.row, scope.$index)"
|
|
|
+ :disabled="scope.row.orderCategory != 4"
|
|
|
+ >
|
|
|
+ <template slot="append">%</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
|
|
|
- trigger: 'change'
|
|
|
- }"
|
|
|
- :prop="'datasource.' + scope.$index + '.singleWeight'"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- v-model="scope.row.singleWeight"
|
|
|
- type="number"
|
|
|
- placeholder="请输入"
|
|
|
- :disabled="needProduce == 4"
|
|
|
- @input="changeCount(scope.row, scope.$index)"
|
|
|
+ <template v-slot:discountRatio="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'deliveryProducts.' + scope.$index + '.discountRatio'"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请输入折让比例',
|
|
|
+ trigger: 'change'
|
|
|
+ }"
|
|
|
>
|
|
|
- <template slot="append">
|
|
|
- {{ scope.row.weightUnit }}
|
|
|
- </template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.discountRatio"
|
|
|
+ placeholder="请输入"
|
|
|
+ type="number"
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
+ :disabled="scope.row.orderCategory != 4"
|
|
|
+ @input="getDiscountRatioPrice(scope.row, scope.$index)"
|
|
|
+ >
|
|
|
+ <template slot="append">%</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
|
|
|
- <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>
|
|
|
+ <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>
|
|
|
+ </el-form>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="退货单">
|
|
|
<ele-pro-table :show-summary="false" :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
|
|
|
@@ -202,6 +225,8 @@
|
|
|
<script>
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
import { pricingWayList } from '@/enum/dict';
|
|
|
+import { parameterGetByCode } from '@/api/main/index.js';
|
|
|
+import { changeCount } from '@/BIZComponents/setProduct.js';
|
|
|
|
|
|
export default {
|
|
|
mixins: [dictMixins],
|
|
|
@@ -353,20 +378,21 @@ export default {
|
|
|
align: "center"
|
|
|
},
|
|
|
{
|
|
|
- minWidth: 90,
|
|
|
+ minWidth: 160,
|
|
|
prop: 'singlePrice',
|
|
|
label: '单价',
|
|
|
align: 'center',
|
|
|
- // slot: 'singlePrice',
|
|
|
+ slot: 'singlePrice',
|
|
|
},
|
|
|
{
|
|
|
- minWidth: 100,
|
|
|
+ minWidth: 160,
|
|
|
prop: 'taxRate',
|
|
|
label: '税率',
|
|
|
align: 'center',
|
|
|
+ slot: 'taxRate',
|
|
|
},
|
|
|
{
|
|
|
- width: 150,
|
|
|
+ width: 140,
|
|
|
prop: 'notTaxSinglePrice',
|
|
|
label: '不含税单价',
|
|
|
align: 'center'
|
|
|
@@ -379,10 +405,11 @@ export default {
|
|
|
align: 'center',
|
|
|
},
|
|
|
{
|
|
|
- minWidth: 100,
|
|
|
+ minWidth: 160,
|
|
|
prop: 'discountRatio',
|
|
|
label: '折让比例',
|
|
|
align: 'center',
|
|
|
+ slot: 'discountRatio',
|
|
|
},
|
|
|
{
|
|
|
minWidth: 100,
|
|
|
@@ -552,10 +579,14 @@ export default {
|
|
|
return (item)=>{
|
|
|
return item.subList?.detailList
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ clientEnvironmentId() {
|
|
|
+ return this.$store.state.user.info.clientEnvironmentId;
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ isTaxRate: 0,
|
|
|
activeNames: [],
|
|
|
rules: {},
|
|
|
form: {},
|
|
|
@@ -585,12 +616,93 @@ export default {
|
|
|
},
|
|
|
created(){
|
|
|
this.requestDict('产地');
|
|
|
+ // 税率是否必填//0否 1是
|
|
|
+ parameterGetByCode({
|
|
|
+ code: 'eom_saleOrder_order-taxRate'
|
|
|
+ }).then((res) => {
|
|
|
+ this.isTaxRate = res.value;
|
|
|
+ });
|
|
|
},
|
|
|
mounted() {
|
|
|
// this.activeNames = this.datasource.map((item, index) => index.toString());
|
|
|
// console.log('activeNames~~~', this.activeNames)
|
|
|
},
|
|
|
methods: {
|
|
|
+ //改变数量
|
|
|
+ changeCount(item, index) {
|
|
|
+ console.log('changeCount~~~', item)
|
|
|
+ console.log('this.datasource[index]~~~', this.datasource[index])
|
|
|
+ // row.totalPrice = parseFloat((item.totalCount * item.singlePrice).toFixed(2))
|
|
|
+ if (item.singlePrice && item.taxRate) {
|
|
|
+ // this.$set(
|
|
|
+ // this.datasource[index],
|
|
|
+ // 'totalPrice',
|
|
|
+ // parseFloat((item.totalCount * item.singlePrice).toFixed(2))
|
|
|
+ // );
|
|
|
+ item.totalPrice = parseFloat((item.totalCount * item.singlePrice).toFixed(2))
|
|
|
+ } else {
|
|
|
+ // this.$set(this.form.datasource[index], 'totalPrice', '');
|
|
|
+ item.totalPrice = ''
|
|
|
+ }
|
|
|
+ this.getNotaxSinglePrice(item, index);
|
|
|
+ this.getDiscountRatioPrice(item, index);
|
|
|
+ this.$forceUpdate();
|
|
|
+ // if (this.clientEnvironmentId == 4 && !isBlockCount) {
|
|
|
+ // this.tableHandleKeyUp(row, index, 'sum');
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ //计算不含税单价
|
|
|
+ getNotaxSinglePrice(item, index) {
|
|
|
+ if (item.singlePrice && item.taxRate) {
|
|
|
+ // this.$set(
|
|
|
+ // this.datasource[index],
|
|
|
+ // 'notTaxSinglePrice',
|
|
|
+ // parseFloat(
|
|
|
+ // (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
|
|
|
+ // )
|
|
|
+ // );
|
|
|
+ item.notTaxSinglePrice = parseFloat(
|
|
|
+ (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ // this.$set(this.form.datasource[index], 'notTaxSinglePrice', '');
|
|
|
+ item.notTaxSinglePrice = ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 计算折让单价,折让总价
|
|
|
+ getDiscountRatioPrice(item, index) {
|
|
|
+
|
|
|
+ if (item.singlePrice && item.discountRatio) {
|
|
|
+ // this.$set(
|
|
|
+ // this.datasource[index],
|
|
|
+ // 'discountSinglePrice',
|
|
|
+ // parseFloat(
|
|
|
+ // (item.singlePrice * (item.discountRatio / 100)).toFixed(2)
|
|
|
+ // )
|
|
|
+ // );
|
|
|
+ item.discountSinglePrice = parseFloat(
|
|
|
+ (item.singlePrice * (item.discountRatio / 100)).toFixed(2)
|
|
|
+ )
|
|
|
+
|
|
|
+ // this.$set(
|
|
|
+ // this.datasource[index],
|
|
|
+ // 'discountTotalPrice',
|
|
|
+ // parseFloat(
|
|
|
+ // (item.totalPrice * (item.discountRatio / 100)).toFixed(2)
|
|
|
+ // )
|
|
|
+ // );
|
|
|
+ item.discountTotalPrice = parseFloat(
|
|
|
+ (item.totalPrice * (item.discountRatio / 100)).toFixed(2)
|
|
|
+ )
|
|
|
+
|
|
|
+ } else {
|
|
|
+ // this.$set(this.datasource[index], 'discountSinglePrice', 0);
|
|
|
+ // this.$set(this.datasource[index], 'discountTotalPrice', 0);
|
|
|
+ item.discountSinglePrice = ''
|
|
|
+ item.discountTotalPrice = ''
|
|
|
+ }
|
|
|
+ },
|
|
|
remove(tableIndex, lineIndex, delType) {
|
|
|
let params = {
|
|
|
tableIndex,
|
|
|
@@ -630,6 +742,49 @@ export default {
|
|
|
return table.reduce((prev, curr) => {
|
|
|
return prev + Number(curr.discountTotalPrice || 0)
|
|
|
}, 0)
|
|
|
+ },
|
|
|
+ getValidForm() {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ const validationPromises = [];
|
|
|
+
|
|
|
+ this.datasource.forEach((item, index) => {
|
|
|
+ validationPromises.push(
|
|
|
+ new Promise((formResolve, formReject) => {
|
|
|
+ const formRef = this.$refs['form' + index];
|
|
|
+ if (formRef) {
|
|
|
+ formRef.validate((valid, errors) => {
|
|
|
+ if (!valid) {
|
|
|
+ formReject({ index, errors });
|
|
|
+ } else {
|
|
|
+ formResolve(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 如果表单引用不存在,检查数据直接验证
|
|
|
+ if (!item.singlePrice || !item.taxRate || !item.discountRatio) {
|
|
|
+ formReject({ index, message: `第${index + 1}项缺少必填字段` });
|
|
|
+ } else {
|
|
|
+ formResolve(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
+ Promise.all(validationPromises)
|
|
|
+ .then(() => {
|
|
|
+ resolve(true);
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('表单验证失败:', error);
|
|
|
+ if (error.message) {
|
|
|
+ this.$message.error(error.message);
|
|
|
+ } else {
|
|
|
+ this.$message.error(`第${error.index + 1}项表单验证失败`);
|
|
|
+ }
|
|
|
+ reject(false);
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|