yusheng 1 سال پیش
والد
کامیت
b619403ced

+ 52 - 50
src/BIZComponents/inventoryTable.vue

@@ -33,11 +33,10 @@
             >
               新增
             </el-button>
-     
           </div>
           <div class="pricebox">
             <span class="amount">总计:{{ allPrice }}元</span>
-        
+
             <el-form-item
               style="width: 300px"
               v-if="isDiscountTotalPrice"
@@ -93,10 +92,7 @@
         <span class="is-required">{{ column.label }}</span>
       </template>
       <template v-slot:customerMark="{ row, $index }">
-        <el-form-item
-          :prop="'datasource.' + $index + '.customerMark'"
-      
-        >
+        <el-form-item :prop="'datasource.' + $index + '.customerMark'">
           <el-input v-model="row.customerMark" placeholder="请输入"></el-input>
         </el-form-item>
       </template>
@@ -125,11 +121,10 @@
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.totalCount'"
           :rules="{
-            required: isTotalCount?true:false,
+            required: isTotalCount ? true : false,
             message: '请输入单价',
             trigger: 'change'
           }"
-          
         >
           <el-input
             :disabled="isContractId"
@@ -140,11 +135,8 @@
           ></el-input>
         </el-form-item>
       </template>
-      <template
-        v-slot:headerTotalCount="{ column }"
-
-      >
-        <span :class="{'is-required':isTotalCount}">{{ column.label }}</span>
+      <template v-slot:headerTotalCount="{ column }">
+        <span :class="{ 'is-required': isTotalCount }">{{ column.label }}</span>
       </template>
       <template v-slot:totalPrice="scope">
         <el-form-item
@@ -257,7 +249,7 @@
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.singlePrice'"
           :rules="{
-            required: isSinglePrice?true:false,
+            required: isSinglePrice ? true : false,
             message: '请输入单价',
             trigger: 'change'
           }"
@@ -283,18 +275,16 @@
             v-model="scope.row.taxRate"
             placeholder="请输入"
             type="number"
-            
           >
             <template slot="append">%</template>
           </el-input>
         </el-form-item>
       </template>
-      
-      <template
-        v-slot:headerSinglePrice="{ column }"
-       
-      >
-        <span :class="isSinglePrice?'is-required':''">{{ column.label }}</span>
+
+      <template v-slot:headerSinglePrice="{ column }">
+        <span :class="isSinglePrice ? 'is-required' : ''">{{
+          column.label
+        }}</span>
       </template>
       <template v-slot:headerCustomerExpectDeliveryDeadline="{ column }">
         <span :class="contractBookType == 1 ? 'is-required' : ''">{{
@@ -402,7 +392,7 @@
       </template>
       <template v-slot:customerExpectDeliveryDeadline="scope">
         <el-form-item
-        :rules="{
+          :rules="{
             required: true,
             message:
               contractBookType == 1 ? '请选择客户期望交期' : '请选择交付日期',
@@ -440,7 +430,6 @@
       <template v-slot:singleWeight="scope">
         <el-form-item
           style="margin-bottom: 20px"
-         
           :prop="'datasource.' + scope.$index + '.singleWeight'"
         >
           <el-input
@@ -470,7 +459,15 @@
       </template>
       <template v-slot:pricingWay="scope">
         <el-form-item :prop="'datasource.' + scope.$index + '.pricingWay'">
-          <el-select v-model="scope.row.pricingWay" placeholder="请选择">
+          <el-select
+            v-model="scope.row.pricingWay"
+            placeholder="请选择"
+            :rules="{
+              required: true,
+              message: '请选择计价方式',
+              trigger: 'change'
+            }"
+          >
             <el-option
               v-for="item in pricingWayList"
               :key="item.id"
@@ -482,7 +479,9 @@
           </el-select>
         </el-form-item>
       </template>
-
+      <template v-slot:headerPricingWay="{ column }">
+        <span class="is-required">{{ column.label }}</span>
+      </template>
       <!-- 操作列 -->
       <template v-slot:action="scope">
         <el-popconfirm
@@ -543,7 +542,7 @@
         default: false,
         type: Boolean
       },
-  
+
       isGuaranteePeriod: {
         default: true,
         type: Boolean
@@ -563,16 +562,18 @@
         type: Boolean,
         default: false
       },
-      
-      isSinglePrice: { //单价必填
+
+      isSinglePrice: {
+        //单价必填
         type: Boolean,
         default: true
       },
-      isTotalCount: { //数量必填
+      isTotalCount: {
+        //数量必填
         type: Boolean,
         default: true
       },
-      
+
       isDrawer: {
         type: Boolean,
         default: false
@@ -596,12 +597,12 @@
         //临时
         type: Boolean,
         default: false
-      }
-      ,   isDiscount: {
+      },
+      isDiscount: {
         //折让
         type: Boolean,
         default: true
-      },
+      }
     },
     data() {
       const defaultForm = {
@@ -619,7 +620,7 @@
         numberReg,
         defaultForm,
         form: {
-        discountTotalPrice: 0,
+          discountTotalPrice: 0,
 
           datasource: []
         },
@@ -768,6 +769,7 @@
             width: 160,
             prop: 'pricingWay',
             label: '计价方式',
+            headerSlot: 'headerPricingWay',
             slot: 'pricingWay',
             align: 'center'
           },
@@ -1031,21 +1033,20 @@
       //改变数量
       changeCount(row, index) {
         const { allPrice, arr } = changeCount(row, index, this.form.datasource);
-        this.form.datasource=arr
-        this.allPrice=allPrice||0
+        this.form.datasource = arr;
+        this.allPrice = allPrice || 0;
         if (this.isDiscountTotalPrice) {
           this.form.discountTotalPrice = allPrice;
         }
         this.$emit('setCountAmount', this.allPrice);
-      
       },
       setCustomerMark(customerMark) {
         this.form.datasource.forEach((item) => {
-         item['customerMark'] = customerMark;
+          item['customerMark'] = customerMark;
           this.$forceUpdate();
         });
       },
-     
+
       //修改回显
       async putTableValue(data) {
         let productList =
@@ -1077,7 +1078,8 @@
           }
 
           if (this.isDiscountTotalPrice) {
-            this.form.discountTotalPrice = data.payAmount||data?.contractVO?.discountTotalPrice;
+            this.form.discountTotalPrice =
+              data.payAmount || data?.contractVO?.discountTotalPrice;
           }
 
           let codeList = this.form.datasource.map((item) => item.productCode);
@@ -1134,7 +1136,7 @@
           this.$set(parasm, 'specification', item.specification);
           this.$set(parasm, 'weightUnit', item.weightUnit);
           this.$set(parasm, 'singleWeight', item.roughWeight);
-          this.$set(parasm, 'pricingWay',item.pricingWay||1);
+          this.$set(parasm, 'pricingWay', item.pricingWay || 1);
 
           this.$set(parasm, 'imgCode', item.imgCode);
           this.$set(parasm, 'produceType', item.produceType);
@@ -1173,16 +1175,16 @@
       },
 
       validateForm(callback) {
-        let singleWeightData={}
-        this.form.datasource.forEach(item=>{
-
-          if(item.pricingWay==2&&!item.singleWeight){
-            singleWeightData['name']=item.productName
+        let singleWeightData = {};
+        this.form.datasource.forEach((item) => {
+          if (item.pricingWay == 2 && !item.singleWeight) {
+            singleWeightData['name'] = item.productName;
           }
-
-        })
-        if(singleWeightData.name){
-          this.$message.warning(singleWeightData.name+'计价方式为重量,单重不能为空');
+        });
+        if (singleWeightData.name) {
+          this.$message.warning(
+            singleWeightData.name + '计价方式为重量,单重不能为空'
+          );
           callback(false);
         }
         //开始表单校验

+ 2 - 3
src/views/bpm/handleTask/components/saleOrder/returnGoods/addReturnGoodsDialog.vue

@@ -122,7 +122,6 @@
       <inventoryTable
         v-show="!['40', '50'].includes(form.type) || form.returnSourceType != 1"
         ref="inventoryTableref"
-        :pricingWay="form.pricingWay"
         :entrustedCode="form.sendNo"
         :sendId="form.sendId"
         :type="form.type"
@@ -558,7 +557,7 @@
         this.loading = false;
         if (data) {
           this.form = data;
-          this.form.pricingWay = data?.saleOrder?.pricingWay;
+          // this.form.pricingWay = data?.saleOrder?.pricingWay;
           this.form.entrustedCode = data?.entrustedReceiveCode;
           this.form.entrustedId = data?.entrustedReceiveId;
           if (data.contactId) {
@@ -695,7 +694,7 @@
             if (item.productCode == val.productCode) {
               item['singlePrice'] = val.singlePrice;
               item['clientCode'] = item.clientCode || val.customerMark;
-              item['pricingWay'] = item.pricingWay || this.form.pricingWay || 1;
+              item['pricingWay'] = item.pricingWay || val.pricingWay;
             }
           });
         });

+ 12 - 16
src/views/bpm/handleTask/components/saleOrder/returnGoods/inventoryTable.vue

@@ -79,13 +79,7 @@
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.sendTotalWeight'"
-          :rules="[
-            {
-              required: entrustedCode && pricingWay == 2,
-              message: '请输入数字',
-              trigger: 'blur'
-            }
-          ]"
+
         >
           <el-input
             v-model="scope.row.sendTotalWeight"
@@ -461,16 +455,18 @@
     computed: {
       totalAmount() {
         let num = 0;
-        this.form.datasource.forEach((item) => {
+        this.form.datasource.forEach((item, index) => {
           if (item.pricingWay == 1) {
-            item.totalPrice = item.singlePrice * item.totalCount;
+            this.$set(
+              this.form.datasource[index],
+              'totalPrice',
+              item.singlePrice * item.totalCount || 0
+            );
           }
-          if (item.pricingWay == 2) {
-            item.totalPrice =
-              item.singlePrice * item.totalCount * receiveTotalWeight;
+      
+          if (item.totalPrice) {
+            num += Number(item.totalPrice);
           }
-
-          num += item.totalPrice;
         });
         return num;
       }
@@ -551,7 +547,7 @@
           this.form.datasource[this.curIndex].receiveTotalWeight
         );
         // if (this.entrustedCode) {
-        if (this.pricingWay == 2) {
+        if (this.form.datasource[this.curIndex].pricingWay == 2) {
           if (isNaN(receiveTotalWeight) || isNaN(sendTotalWeight)) {
             return this.$set(
               this.form.datasource[this.curIndex],
@@ -575,7 +571,7 @@
         // } else {
         //   this.$set(this.form.datasource[this.curIndex], 'increaseTotalWeight', sendTotalWeight);
         // }
-        if (this.pricingWay == 2) {
+        if (this.form.datasource[this.curIndex].pricingWay == 2) {
           this.getWeightPrice();
         }
         this.$refs.table.reload();