cz 1 жил өмнө
parent
commit
1eda523eef

+ 219 - 163
src/views/WDLY/outInBound/waitOutBound/index.vue

@@ -2,52 +2,23 @@
   <div class="tenant">
     <!-- <Banner /> -->
     <div class="content">
-      <byTable
-        :source="sourceList.data"
-        :pagination="sourceList.pagination"
-        :config="config"
-        :loading="loading"
-        highlight-current-row
-        :selectConfig="selectConfig"
-        :table-events="{
+      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
+               :selectConfig="selectConfig" :table-events="{
           //element talbe事件都能传
           select: select,
-        }"
-        :action-list="[]"
-        @get-list="getList"
-      >
+        }" :action-list="[]" @get-list="getList">
         <template #slotName="{ item }">
           {{ item.createTime }}
         </template>
       </byTable>
     </div>
-    <el-dialog
-      title="出库"
-      v-model="dialogVisible"
-      width="800"
-      v-loading="submitLoading"
-      destroy-on-close
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="submitType == 5 ? rulesOne : submitType == 4 ? rulesTwo : rules"
-        ref="byform"
-      >
+    <el-dialog title="出库" v-model="dialogVisible" width="800" v-loading="submitLoading" destroy-on-close>
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="submitType == 4 ?rulesTwo :rulesOne " ref="byform">
         <template #countryId>
           <div>
-            <el-select
-              v-model="formData.data.countryId"
-              placeholder="国家"
-              @change="(val) => getCityData(val, '20', true)"
-              :disabled="submitType == 4"
-            >
-              <el-option
-                v-for="item in countryData"
-                :label="item.chineseName"
-                :value="item.id"
-              >
+            <el-select v-model="formData.data.countryId" placeholder="国家" @change="(val) => getCityData(val, '20', true)"
+                       :disabled="submitType == 4 ||submitType == 5 ">
+              <el-option v-for="item in countryData" :label="item.chineseName" :value="item.id">
               </el-option>
             </el-select>
           </div>
@@ -55,93 +26,42 @@
 
         <template #provinceId>
           <div>
-            <selectCity
-              placeholder="省/洲"
-              @change="(val) => getCityData(val, '30', true)"
-              addressId="provinceId"
-              addressName="provinceName"
-              v-model="formData.data"
-              :data="provinceData"
-              :disabled="submitType == 4"
-            >
+            <selectCity placeholder="省/洲" @change="(val) => getCityData(val, '30', true)" addressId="provinceId" addressName="provinceName"
+                        v-model="formData.data" :data="provinceData" :disabled="submitType == 4 ||submitType == 5 ">
             </selectCity>
           </div>
         </template>
 
         <template #cityId>
           <div>
-            <selectCity
-              placeholder="城市"
-              addressId="cityId"
-              addressName="cityName"
-              v-model="formData.data"
-              :data="cityData"
-              :disabled="submitType == 4"
-            >
+            <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="formData.data" :data="cityData"
+                        :disabled="submitType == 4 ||submitType == 5 ">
             </selectCity>
           </div>
         </template>
 
         <template #products>
           <div style="width: 100%">
-            <el-table
-              :data="formData.data.jdOrderDetailsList"
-              show-summary
-              :summary-method="getSummaries"
-            >
+            <el-table :data="formData.data.jdOrderDetailsList" show-summary :summary-method="getSummaries">
               <el-table-column prop="productCustomCode" label="物品编码" />
               <el-table-column prop="productName" label="物品名称" />
               <el-table-column prop="productSpec" label="规格" />
               <el-table-column prop="waitQuantity" label="应出库" />
-              <el-table-column
-                prop="receiptQuantity"
-                label="已出库"
-                v-if="submitType != 5"
-              />
-              <el-table-column
-                prop="quantity"
-                label="本次出库"
-                min-width="150"
-                v-if="submitType != 5"
-              >
+              <el-table-column prop="receiptQuantity" label="已出库" />
+              <el-table-column prop="quantity" label="本次出库" min-width="150">
                 <template #default="{ row, $index }">
-                  <el-form-item
-                    :prop="'jdOrderDetailsList.' + $index + '.quantity'"
-                    :rules="rules.quantity"
-                    :inline-message="true"
-                  >
-                    <el-input-number
-                      v-model="row.quantity"
-                      :precision="2"
-                      :controls="false"
-                      :min="0"
-                      onmousewheel="return false;"
-                    />
+                  <el-form-item :prop="'jdOrderDetailsList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
+                    <el-input-number v-model="row.quantity" :precision="2" :controls="false" :min="0" onmousewheel="return false;" />
                   </el-form-item>
                 </template>
               </el-table-column>
-              <el-table-column
-                prop="quantity"
-                label="调仓数量"
-                min-width="150"
-                v-if="submitType == 5"
-              >
+              <!-- <el-table-column prop="quantity" label="调仓数量" min-width="150" v-if="submitType == 5">
                 <template #default="{ row, $index }">
-                  <el-form-item
-                    :prop="'jdOrderDetailsList.' + $index + '.quantity'"
-                    :rules="rules.quantity"
-                    :inline-message="true"
-                  >
-                    <el-input-number
-                      v-model="row.quantity"
-                      :precision="2"
-                      :controls="false"
-                      :min="0"
-                      onmousewheel="return false;"
-                    />
+                  <el-form-item :prop="'jdOrderDetailsList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
+                    <el-input-number v-model="row.quantity" :precision="2" :controls="false" :min="0" onmousewheel="return false;" />
                   </el-form-item>
                 </template>
-              </el-table-column>
+              </el-table-column> -->
             </el-table>
           </div>
         </template>
@@ -161,30 +81,15 @@
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button
-          type="primary"
-          @click="submitForm('byform')"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
     </el-dialog>
 
-    <el-dialog
-      v-model="openProduct"
-      title="选择产品"
-      width="70%"
-      append-to-body
-    >
-      <InventoryInquiry
-        :selectStatus="true"
-        :warehouseId="formData.data.outWarehouseId"
-        @cancel="openProduct = false"
-        @select="select"
-        :key="formData.data.outWarehouseId"
-      ></InventoryInquiry>
+    <el-dialog v-model="openProduct" title="选择产品" width="70%" append-to-body>
+      <InventoryInquiry :selectStatus="true" :warehouseId="formData.data.outWarehouseId" @cancel="openProduct = false" @select="select"
+                        :key="formData.data.outWarehouseId"></InventoryInquiry>
 
       <!-- <template #footer>
         <span class="dialog-footer">
@@ -282,6 +187,12 @@ let rulesOne = ref({
     { required: true, message: "请选择调入仓库", trigger: "change" },
   ],
   quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
+  // logisticsCompanyCode: [
+  //   { required: true, message: "请选择物流/快递公司", trigger: "change" },
+  // ],
+  // logisticsCode: [
+  //   { required: true, message: "请输入物流/快递单号", trigger: "blur" },
+  // ],
 });
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
@@ -501,11 +412,11 @@ const configData = computed(() => [
       type: "input",
       prop: "phone",
       label: "联系电话",
-      itemWidth: 60,
+      itemWidth: 75,
       placeholder: "联系电话",
       disabled: true,
       style: {
-        width: "46%",
+        width: "100%",
       },
     },
     {
@@ -545,15 +456,15 @@ const configData = computed(() => [
       type: "slot",
       slotName: "products",
     },
-    {
-      type: "title",
-      title: "出库统计",
-    },
-    {
-      type: "slot",
-      slotName: "statisticsSlot",
-      label: "",
-    },
+    // {
+    //   type: "title",
+    //   title: "出库统计",
+    // },
+    // {
+    //   type: "slot",
+    //   slotName: "statisticsSlot",
+    //   label: "",
+    // },
   ],
   [
     {
@@ -642,15 +553,136 @@ const configData = computed(() => [
       type: "slot",
       slotName: "products",
     },
+    // {
+    //   type: "title",
+    //   title: "出库统计",
+    // },
+    // {
+    //   type: "slot",
+    //   slotName: "statisticsSlot",
+    //   label: "",
+    // },
+  ],
+  [
+    {
+      type: "title",
+      title: "基础信息",
+    },
+    {
+      type: "select",
+      prop: "businessType",
+      label: "数据来源",
+      required: true,
+      disabled: true,
+      itemWidth: 25,
+      data: businessType,
+    },
+    {
+      type: "input",
+      prop: "businessCode",
+      label: "关联单号",
+      required: true,
+      disabled: true,
+      itemWidth: 30,
+    },
+    {
+      type: "select",
+      prop: "warehouseId",
+      label: "仓库名称",
+      itemWidth: 100,
+      data: warehouseList.value,
+      style: {
+        width: "53%",
+      },
+    },
+    {
+      type: "select",
+      prop: "logisticsCompanyCode",
+      label: "物流/快递信息",
+      placeholder: "物流/快递公司",
+      itemWidth: 25,
+      style: {
+        width: "100%",
+      },
+      data: logisticsData.value,
+      filterable: true,
+    },
+    {
+      type: "input",
+      prop: "logisticsCode",
+      label: " ",
+      placeholder: "物流/快递单号",
+      itemWidth: 60,
+      style: {
+        width: "46%",
+      },
+    },
+    {
+      type: "input",
+      prop: "contacts",
+      label: "收件人",
+      itemWidth: 25,
+      placeholder: "收件人",
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "phone",
+      label: "联系电话",
+      itemWidth: 75,
+      placeholder: "联系电话",
+      disabled: true,
+      style: {
+        width: "100%",
+      },
+    },
+    // {
+    //   type: "slot",
+    //   slotName: "countryId",
+    //   prop: "countryId",
+    //   label: "收货信息",
+    //   itemWidth: 33.33,
+    //   disabled: true,
+    // },
+    // {
+    //   type: "slot",
+    //   slotName: "provinceId",
+    //   label: " ",
+    //   itemWidth: 33.33,
+    //   disabled: true,
+    // },
+    // {
+    //   type: "slot",
+    //   slotName: "cityId",
+    //   prop: "cityId",
+    //   label: " ",
+    //   itemWidth: 33.33,
+    //   disabled: true,
+    // },
+    {
+      type: "input",
+      label: "详细地址",
+      itemType: "textarea",
+      prop: "areaDetail",
+      disabled: true,
+    },
     {
       type: "title",
-      title: "出库统计",
+      title: "出库明细",
     },
     {
       type: "slot",
-      slotName: "statisticsSlot",
-      label: "",
+      slotName: "products",
     },
+    // {
+    //   type: "title",
+    //   title: "出库统计",
+    // },
+    // {
+    //   type: "slot",
+    //   slotName: "statisticsSlot",
+    //   label: "",
+    // },
   ],
   [
     {
@@ -736,7 +768,6 @@ const getList = async (req) => {
 
 const openModal = () => {
   dialogVisible.value = true;
-  modalType.value = "add";
   formData.data = {};
 };
 
@@ -782,30 +813,42 @@ const submitForm = () => {
         });
       }
     } else if (submitType.value == 5) {
-      if (formData.data.inWarehouseId === formData.data.outWarehouseId) {
-        return ElMessage({
-          message: "调出和调入仓库不可一致",
-          type: "info",
-        });
-      }
+      // if (formData.data.inWarehouseId === formData.data.outWarehouseId) {
+      //   return ElMessage({
+      //     message: "调出和调入仓库不可一致",
+      //     type: "info",
+      //   });
+      // }
       const list = formData.data.jdOrderDetailsList;
       for (let i = 0; i < list.length; i++) {
         const e = list[i];
         if (!(e.quantity > 0)) {
           return ElMessage({
-            message: "调仓数量不能为0!",
+            message: "出库数量不能为0!",
             type: "info",
           });
         }
         if (e.quantity > e.waitQuantity) {
           return ElMessage({
-            message: "调仓数量不能大于应出库数量!",
+            message: "出库数量不能大于应出库数量!",
             type: "info",
           });
         }
       }
+      formData.data.jdOrderDetailsList = formData.data.jdOrderDetailsList.map(
+        (x) => ({ ...x, originalNum: x.quantity })
+      );
+      formData.data.stockWaitDetailsList = formData.data.jdOrderDetailsList.map(
+        (x) => ({
+          id: x.id,
+          businessDetailsId: x.businessDetailsId,
+          quantity: x.quantity,
+          originalNum: x.originalNum,
+          productId: x.productId,
+        })
+      );
       submitLoading.value = true;
-      proxy.post("/jdOrder/outbound", formData.data).then(
+      proxy.post("/stockWait/addByWdly", formData.data).then(
         (res) => {
           ElMessage({
             message: "操作成功",
@@ -865,7 +908,6 @@ const submitType = ref("-1");
 const outBound = (row) => {
   submitType.value = row.businessType;
   if (row.businessType == 4) {
-    modalType.value = "other";
     formConfig.value = configData.value[0];
     proxy.post("/stockWait/detailByWdly", { id: row.id }).then((res) => {
       res.jdOrderDetailsList = res.stockWaitDetailsList.map((x) => ({
@@ -902,28 +944,42 @@ const outBound = (row) => {
       dialogVisible.value = true;
     });
   } else if (row.businessType == 5) {
-    modalType.value = "add";
     formConfig.value = configData.value[2];
     proxy.post("/jdOrder/detail", { id: row.businessId }).then((res) => {
-      res.jdOrderDetailsList = res.jdOrderDetailsList.map((x) => ({
-        waitQuantity: x.quantity,
-        quantity: null,
-        productId: x.productId,
-        id: x.id,
-        productCustomCode: x.productCustomCode,
-        productName: x.productName,
-        productSpec: x.productSpec,
-      }));
-      formData.data = {
-        id: row.businessId,
-        outWarehouseId: "",
-        inWarehouseId: "",
-        jdOrderDetailsList: res.jdOrderDetailsList,
-      };
-      dialogVisible.value = true;
+      // res.jdOrderDetailsList = res.jdOrderDetailsList.map((x) => ({
+      //   waitQuantity: x.originalNum,
+      //   quantity: null,
+      //   productId: x.productId,
+      //   id: x.id,
+      //   productCustomCode: x.productCustomCode,
+      //   productName: x.productName,
+      //   productSpec: x.productSpec,
+      //   businessDetailsId: x.id,
+      // }));
+      proxy.post("/stockWait/detailByWdly", { id: row.id }).then((resOne) => {
+        let jdOrderDetailsList = resOne.stockWaitDetailsList.map((x) => ({
+          ...x,
+          waitQuantity: x.quantity,
+          quantity: null,
+          businessDetailsId: x.id,
+          id: x.id,
+        }));
+        formData.data = {
+          id: row.id,
+          type: 2,
+          warehouseId: "",
+          businessId: res.id,
+          businessType: row.businessType + "",
+          businessCode: row.businessCode,
+          contacts: res.receiverName,
+          phone: res.warehousePhone,
+          areaDetail: res.address,
+          jdOrderDetailsList: jdOrderDetailsList,
+        };
+        dialogVisible.value = true;
+      });
     });
   } else if (row.businessType == 6) {
-    modalType.value = "edit";
     formConfig.value = configData.value[1];
     proxy.post("/stockWait/detailByWdly", { id: row.id }).then((res) => {
       res.jdOrderDetailsList = res.stockWaitDetailsList.map((x) => ({