Bläddra i källkod

五楼数据增加到货通知功能

cz 2 år sedan
förälder
incheckning
983547bc07

+ 230 - 0
src/components/purchase/sendGoods.vue

@@ -0,0 +1,230 @@
+<template>
+  <div v-loading="loading">
+    <div class="form-box">
+      <el-form
+        label-position="top"
+        :model="form"
+        ref="form"
+        :rules="formRules"
+        label-width="100px"
+      >
+        <el-row :gutter="10">
+          <el-col :span="4">
+            <el-form-item label="采购单号" prop="puCode">
+              <el-input
+                v-model="form.puCode"
+                placeholder="请输入"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="供应商" prop="supplierName">
+              <el-input
+                v-model="form.supplierName"
+                placeholder="请输入"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="10">
+          <el-col :span="6">
+            <el-form-item label="物流信息" prop="logisticsCompanyCode">
+              <el-select
+                v-model="form.logisticsCompanyCode"
+                placeholder="请选择"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in logisticsData"
+                  :key="item.code"
+                  :label="item.name"
+                  :value="item.code"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="物流/快递单" prop="code">
+              <el-input
+                v-model="form.code"
+                placeholder="物流/快递单号"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <div style="margin-bottom: 20px">
+          <labelTitle content="发货明细"></labelTitle>
+        </div>
+        <!-- <el-form-item label="上传附件">
+          <el-upload
+            class="upload-demo"
+            action="http://36.134.91.96:10001/api/service-file/uploadFile"
+            :headers="uploadHeader"
+            :on-preview="handlePreview"
+            :on-remove="handleRemove"
+            :on-success="handleSuccess"
+            multiple
+            :file-list="fileList"
+          >
+            <el-button size="small" type="primary">点击上传</el-button>
+          </el-upload>
+        </el-form-item> -->
+
+        <el-form-item>
+          <el-table :data="form.details">
+            <el-table-column label="物品编码" prop="goodsCode">
+            </el-table-column>
+            <el-table-column label="物品名称" prop="goodsName">
+            </el-table-column>
+            <el-table-column label="采购数量" prop="quantity">
+            </el-table-column>
+            <el-table-column label="已发货数量" prop="deliverQuantity">
+            </el-table-column>
+
+            <el-table-column
+              label="发货数量"
+              prop="shipmentQuantity"
+              align="center"
+            >
+              <template slot-scope="scope">
+                <el-form-item
+                  :prop="'details.' + scope.$index + '.shipmentQuantity'"
+                  :rules="formRules.shipmentQuantity"
+                  :inline-message="true"
+                  label-width="0"
+                >
+                  <el-input-number
+                    v-model="scope.row.shipmentQuantity"
+                    :controls="false"
+                    style="width: 100%"
+                    placeholder="请输入"
+                    size="mini"
+                  >
+                  </el-input-number>
+                </el-form-item>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-form-item>
+      </el-form>
+    </div>
+    <div style="text-align: center; margin-top: 15px">
+      <el-button size="small" @click="handleCancel">取消 </el-button>
+      <el-button type="primary" size="small" @click="handleSubmit">
+        确定</el-button
+      >
+    </div>
+  </div>
+</template>
+
+<script>
+import labelTitle from "@/components/label-title/index.vue";
+
+import { getToken } from "@/util/auth";
+import { getLogisticsData } from "@/api/system/common.js";
+
+export default {
+  name: "addPurchase",
+  components: { labelTitle },
+  props: {
+    form: {
+      type: Object,
+      default: () => {},
+    },
+  },
+  data() {
+    return {
+      uploadHeader: {
+        Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
+        "Blade-Auth": "bearer " + getToken(),
+      },
+      fileList: [],
+      loading: false,
+      formRules: {
+        code: [
+          {
+            required: true,
+            message: "请输入物流单号",
+            trigger: "blur",
+          },
+        ],
+        logisticsCompanyCode: [
+          {
+            required: true,
+            message: "请选择物流信息",
+            trigger: "change",
+          },
+        ],
+        shipmentQuantity: [
+          {
+            required: true,
+            message: "请输入发货数量",
+            trigger: "blur",
+          },
+        ],
+      },
+      logisticsData: [],
+    };
+  },
+  created() {
+    getLogisticsData({ keyword: "" }).then((res) => {
+      this.logisticsData = res.data.data;
+    });
+  },
+  methods: {
+    handleSubmit() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          for (let i = 0; i < this.form.details.length; i++) {
+            const x = this.form.details[i];
+            if (
+              Number(x.deliverQuantity) + Number(x.shipmentQuantity) >
+              Number(x.quantity)
+            ) {
+              return this.msgInfo("已发货数量加发货数量不能大于采购数量!");
+            }
+          }
+          const sum = this.form.details.reduce((sum, x) => {
+            return sum + Number(x.shipmentQuantity);
+          }, 0);
+          if (sum < 1) {
+            return this.msgInfo("发货总数量不能小于0");
+          }
+          this.loading = true;
+          this.$emit("submit");
+        }
+      });
+    },
+    handleCancel() {
+      this.$emit("cancel");
+    },
+    handleSuccess(response, file, fileList) {
+      this.form.fileInfoList = fileList;
+    },
+    handleRemove(response, file, fileList) {
+      this.form.fileInfoList = fileList;
+    },
+    handlePreview() {},
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.form-box {
+  height: calc(100vh - 280px);
+  overflow: auto;
+  box-sizing: border-box;
+  padding: 10px;
+}
+::v-deep {
+  .el-form-item {
+    margin-bottom: 3px;
+  }
+  .el-form--label-top .el-form-item__label {
+    padding: 8px 0 0 0;
+  }
+}
+</style>

+ 135 - 6
src/views/order-management/JDReturnGoods/logisticsList.vue

@@ -3,14 +3,20 @@
 import query from "@/components/query/index.vue";
 import OrderDetails from "@/components/order/details.vue";
 import PurchaseDetails from "@/components/purchase/details.vue";
+import sendGoods from "@/components/purchase/sendGoods.vue";
 
 import * as API from "@/api/order-management/JDReturnGoods/index.js";
+import {
+  logisticsSelectData,
+  arrivalNotice,
+} from "@/api/purchase-management/deliver-goods/index.js";
 
 export default {
   components: {
     query,
     OrderDetails,
     PurchaseDetails,
+    sendGoods,
   },
   data() {
     return {
@@ -40,6 +46,18 @@ export default {
       detailsText: "",
       selectOrderId: "",
       rowData: {},
+      openArrive: false,
+      arriveForm: {},
+      arriveFormRules: {
+        id: [
+          {
+            required: true,
+            message: "请选择物流/快递单号",
+            trigger: "change",
+          },
+        ],
+      },
+      logisticsData: [],
     };
   },
   created() {
@@ -52,6 +70,7 @@ export default {
     this.logisticsStatusList = businessDictData.find(
       (item) => item.code === "logisticsStatus"
     ).children;
+    console.log(this.logisticsStatusList, "assss");
     this.selectConfig[0].data = this.logisticsDataSourceList.map((item) => ({
       label: item.dictValue,
       value: item.dictKey,
@@ -77,13 +96,14 @@ export default {
       this.getList();
     },
     async lookProgress(row) {
+      this.msgSuccess("数据请求中,请稍后!");
       this.titleText = "查看物流";
       const { data } = await API.queryStatus({ id: row.id });
-      if (data.data.length > 0) {
-        this.activities = data.data;
+      if (data.data.data.length > 0) {
+        this.activities = data.data.data;
         this.open = true;
       } else {
-        this.msgInfo(data.message);
+        this.msgInfo("查询无结果,请隔段时间再查");
       }
     },
     lookDetails(row) {
@@ -105,10 +125,17 @@ export default {
       this.detailsDialog = true;
     },
     showStatus(row) {
+      // 有此判断原因:业务字典键值无法设置为 -1
       if (row.logisticsStatus === -1) {
         return "异常";
       } else {
-        return this.dictDataEcho(row.logisticsStatus, logisticsStatusList);
+        const current = this.logisticsStatusList.find(
+          (x) => x.dictKey == row.logisticsStatus
+        );
+
+        if (current) {
+          return current.dictValue;
+        }
       }
     },
     handleUpdate(row) {
@@ -123,6 +150,39 @@ export default {
         });
       });
     },
+    handleArrive(row) {
+      this.openArrive = true;
+      this.arriveForm = {
+        code: row.businessCode,
+        supplierName: row.supplierName,
+        purchaseId: row.businessId,
+        id: "",
+      };
+      logisticsSelectData({ businessId: row.businessId }).then(
+        (res) => {
+          this.logisticsData = res.data.data;
+        },
+        (err) => {
+          console.log("logisticsSelectData: " + err);
+        }
+      );
+    },
+    handleSubmit1() {
+      this.$refs.arriveForm.validate((valid) => {
+        if (valid) {
+          delete this.arriveForm.code;
+          delete this.arriveForm.supplierName;
+          arrivalNotice(this.arriveForm).then(() => {
+            this.msgSuccess("操作成功");
+            this.getList();
+            this.handleCancel1();
+          });
+        }
+      });
+    },
+    handleCancel1() {
+      this.openArrive = false;
+    },
   },
 };
 </script>
@@ -173,7 +233,7 @@ export default {
           </div>
         </template></el-table-column
       >
-      <el-table-column label="操作" align="center" width="100">
+      <el-table-column label="操作" align="center" width="160">
         <template slot-scope="scope">
           <el-button
             type="text"
@@ -182,6 +242,13 @@ export default {
           >
             更新状态
           </el-button>
+          <el-button
+            type="text"
+            @click="handleArrive(scope.row)"
+            v-if="scope.row.businessType === 1"
+          >
+            到货通知
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -207,7 +274,7 @@ export default {
           :key="index"
           :timestamp="activity.ftime"
         >
-          {{ activity.content }}
+          {{ activity.context }}
         </el-timeline-item>
       </el-timeline>
     </el-dialog>
@@ -225,6 +292,68 @@ export default {
       ></OrderDetails>
       <PurchaseDetails :rowData="rowData" v-if="rowData.id"></PurchaseDetails>
     </el-dialog>
+
+    <el-dialog
+      title="到货通知"
+      :visible.sync="openArrive"
+      v-if="openArrive"
+      width="30%"
+      top="60px"
+    >
+      <el-form
+        label-position="top"
+        :model="arriveForm"
+        ref="arriveForm"
+        :rules="arriveFormRules"
+        label-width="100px"
+      >
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="采购单号" prop="code">
+              <el-input
+                v-model="arriveForm.code"
+                placeholder="请输入"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <!-- <el-form-item label="供应商" prop="supplierName">
+          <el-input
+            v-model="arriveForm.supplierName"
+            placeholder="请输入"
+            disabled
+          ></el-input>
+        </el-form-item> -->
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="物流/快递单号" prop="id">
+              <el-select
+                v-model="arriveForm.id"
+                placeholder="请选择"
+                style="width: 100%"
+              >
+                <!-- :disabled="logisticsData.length === 0" -->
+                <el-option
+                  v-for="item in logisticsData"
+                  :key="item.id"
+                  :label="item.code"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+
+      <div style="text-align: center; margin-top: 15px">
+        <el-button size="small" @click="handleCancel1">取消 </el-button>
+        <el-button type="primary" size="small" @click="handleSubmit1">
+          确定</el-button
+        >
+      </div>
+    </el-dialog>
   </el-card>
 </template>