xiaodai2022 2 jaren geleden
bovenliggende
commit
af2504a030
1 gewijzigde bestanden met toevoegingen van 52 en 17 verwijderingen
  1. 52 17
      src/views/sellOut/sellReturn/components/addModel.vue

+ 52 - 17
src/views/sellOut/sellReturn/components/addModel.vue

@@ -83,6 +83,25 @@
                     }}{{ scope.row.addr }}
                   </template></el-table-column
                 >
+                <el-table-column
+                  label="对应发货申请状态"
+                  prop="send_status"
+                  width="125px"
+                >
+                  <template slot-scope="scope">
+                    <el-tag
+                      :size="'mini'"
+                      :type="scope.row.send_status == '0' ? 'warning' : ''"
+                      v-text="
+                        (
+                          statusOptions.find(
+                            (item) => item.id == scope.row.send_status
+                          ) || {}
+                        ).label || '--'
+                      "
+                    ></el-tag> </template
+                ></el-table-column>
+
                 <el-table-column
                   label="收货总数量"
                   prop="receipt_quantity"
@@ -117,7 +136,11 @@
                     <el-tooltip
                       effect="dark"
                       content="编辑"
-                      v-if="!scope.row.edit"
+                      v-if="
+                        !scope.row.edit &&
+                        (scope.row.send_status === '0' ||
+                          scope.row.send_status === '1')
+                      "
                       placement="top"
                     >
                       <i
@@ -129,7 +152,11 @@
                     <el-tooltip
                       effect="dark"
                       content="保存"
-                      v-if="scope.row.edit"
+                      v-if="
+                        scope.row.edit &&
+                        (scope.row.send_status === '0' ||
+                          scope.row.send_status === '1')
+                      "
                       placement="top"
                     >
                       <i
@@ -154,7 +181,7 @@
                   ></el-input>
                 </el-form-item>
               </el-col>
-              <el-col :span="6">
+              <el-col :span="6" v-show="ruleForm.return_type === '1'">
                 <el-form-item label="可退数量" prop="returnT">
                   <el-input
                     v-model="ruleForm.returnT"
@@ -182,7 +209,7 @@
                 </el-form-item>
               </el-col>
               <el-col
-                :span="ruleForm.return_type === '1' ? 6 : 12"
+                :span="ruleForm.return_type === '1' ? 6 : 18"
                 style="text-align: right"
               >
                 <el-button type="primary" @click="submitForm" :size="'mini'"
@@ -214,7 +241,13 @@ export default {
     return {
       loading: false,
       showModelThis: this.showModel,
-
+      statusOptions: [
+        { id: "0", label: "待公司采购" },
+        { id: "1", label: "待库管发货" },
+        { id: "2", label: "已发货待收货" },
+        { id: "3", label: "已收货" },
+        { id: "4", label: "已全部退货" },
+      ],
       ruleForm: {
         good_num: "",
         thnum: "",
@@ -333,8 +366,8 @@ export default {
           let l_list = [];
           addrs.forEach((a) => {
             this.hasAddrT += a.receipt_quantity * 1;
+            l_list.push(a);
             if (a.send_status === "0" || a.send_status === "1") {
-              l_list.push(a);
             } else {
               numed += a.receipt_quantity * 1;
             }
@@ -350,19 +383,20 @@ export default {
           } else {
             this.type_change = false;
           }
-
+          let return_type =
+            this.noAddrT !== 0 && this.hasAddrT !== 0
+              ? "1"
+              : this.noAddrT !== 0
+              ? "1"
+              : "2";
+          console.log(this.noAddrT, this.hasAddrT);
           this.ruleForm = {
             good_num: good_num || "0",
             orderCode: orderCode || "",
-            return_type:
-              this.noAddrT !== 0 && this.hasAddrT !== 0
-                ? "1"
-                : this.noAddrT !== 0
-                ? "1"
-                : "2",
+            return_type: return_type,
             remark: "", //退货备注
             errorCode: "", //退货原因
-            thnum: good_num || "0",
+            thnum: return_type === "1" ? this.noAddrT : "0" || "0",
             returnT: "0",
           };
           (this.get_product_go = [].concat(...l_list)),
@@ -374,9 +408,10 @@ export default {
     async submitForm() {
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
-          this.loading = true;
+          // this.loading = true;
           const { thnum, return_type, orderCode, remark, errorCode } =
             this.ruleForm;
+          console.log(this.ruleForm);
           let model = {
             orderCode,
             errorCode,
@@ -413,10 +448,10 @@ export default {
               this.loading = false;
               return;
             }
+            console.log(addr_total)
             model.thnum = addr_total;
           }
-          // JSON.parse(JSON.stringify(this.ruleForm));
-
+          console.log(model);
           let res = await asyncRequest.add(model);
           this.loading = false;
           if (res && res.code === 0) {