Răsfoiți Sursa

申购详情,京东退货新增bug解决

cz 2 ani în urmă
părinte
comite
c1284cf741

+ 1 - 1
src/api/order-management/JDReturnGoods/index.js

@@ -14,7 +14,7 @@ export function JDreGoodsList(data = {}) {
 // 添加
 export function JDreGoodsAdd(data = {}) {
   return request({
-    url: '/api/victoriatourist/jdBack/add',
+    url: '/api/victoriatourist/newJdBack/addBack',
     method: 'post',
     data: data,
   })

+ 118 - 0
src/components/purchase/subscribeDetails.vue

@@ -0,0 +1,118 @@
+<template>
+  <div>
+    <el-form :model="form" label-position="left" v-loading="loading">
+      <div style="margin-bottom: 20px">
+        <labelTitle content="基本信息"></labelTitle>
+      </div>
+      <div style="padding: 0px 20px">
+        <el-row :gutter="10">
+          <el-col :span="12">
+            <el-form-item label="收货仓库:" prop="warehouseName">
+              <span>{{ form.warehouseName }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="要求到货时间:" prop="planArrivalTime">
+              <span>
+                {{ form.planArrivalTime }}
+              </span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </div>
+
+      <div style="margin-bottom: 20px">
+        <labelTitle content="申购明细"></labelTitle>
+      </div>
+      <div style="padding: 0px 20px">
+        <el-table :data="form.goodsList">
+          <el-table-column label="物品类型" prop="goodsType" :formatter="(row)
+          => dictDataEcho(row.goodsType, productTypeList)" / >
+          <el-table-column label="物品编码" prop="goodsCode" />
+          <el-table-column label="物品名称" prop="goodsName" />
+          <el-table-column label="物品单位" prop="goodsUnit" />
+          <el-table-column label="单价" prop="unitPrice" />
+          <el-table-column label="申购数量" prop="quantity" />
+        </el-table>
+      </div>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import labelTitle from "@/components/label-title/index.vue";
+import { subscribeDetails } from "@/api/purchase-management/subscribe/index.js";
+import { warehouseSelectList } from "@/api/product-material/warehouse/index.js";
+
+export default {
+  props: {
+    rowData: {
+      type: Object,
+    },
+  },
+  components: {
+    labelTitle,
+  },
+  data() {
+    return {
+      loading: false,
+      form: {},
+      warehouseSelectList: [],
+      productTypeList: [],
+    };
+  },
+  created() {
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+    this.productTypeList = businessDictData.find(
+      (item) => item.code === "productType"
+    ).children;
+  },
+  mounted() {
+    if (this.rowData.id) {
+      this.getDetails();
+    }
+  },
+  methods: {
+    async getDetails() {
+      this.loading = true;
+      const { data } = await warehouseSelectList();
+      this.warehouseSelectList = data.data;
+      subscribeDetails({ id: this.rowData.id }).then((res) => {
+        this.getWarehouseName(res.data.data.receiptWarehouseId, res.data.data);
+      });
+    },
+    getWarehouseName(id, data) {
+      const current = this.warehouseSelectList.find((x) => x.id === id);
+      if (current) {
+        this.form = {
+          ...data,
+          warehouseName: current.name,
+          goodsList: [
+            {
+              goodsType: data.goodsType,
+              goodsCode: data.goodsCode,
+              goodsName: data.goodsName,
+              goodsUnit: data.goodsUnit,
+              unitPrice: data.unitPrice,
+              quantity: data.quantity,
+            },
+          ],
+        };
+      } else {
+        this.msgInfo("找不到对应仓库!");
+      }
+      this.loading = false;
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+::v-deep {
+  .el-form-item {
+    margin-bottom: 5px;
+  }
+}
+</style>

+ 9 - 1
src/views/inbound-outbound/treatIn/index.vue

@@ -12,6 +12,7 @@ import {
   purchaseAdd,
 } from "@/api/inbound-outbound/inbound/purchaseInbound.js";
 import { JDreGoodsDetails } from "@/api/order-management/JDReturnGoods/index.js";
+import { mapGetters } from "vuex";
 
 export default {
   components: {
@@ -53,6 +54,8 @@ export default {
       rowData: {},
     };
   },
+  computed: mapGetters(["userInfo"]),
+
   created() {
     const businessDictData = JSON.parse(
       window.localStorage.getItem("businessDict")
@@ -243,10 +246,15 @@ export default {
         />
         <el-table-column label="操作" align="center" width="120">
           <template slot-scope="scope">
+            <!-- 只有当前用户的角色id是管理员或者仓管员才显示按钮 -->
             <el-button
               type="text"
               @click="handleInbound(scope.row)"
-              v-if="scope.row.status < 30"
+              v-if="
+                (userInfo.role_id === '1619609115577831426' ||
+                  userInfo.role_id === '1620698154897735682') &&
+                scope.row.status < 30
+              "
               >入库
             </el-button>
           </template>

+ 14 - 1
src/views/inbound-outbound/treatOut/index.vue

@@ -14,6 +14,8 @@ import {
 } from "@/api/inbound-outbound/outbound/salesOutbound.js";
 import { JDorderOutbound } from "@/api/inbound-outbound/outbound/JDoutbound.js";
 
+import { mapGetters } from "vuex";
+
 export default {
   components: {
     test,
@@ -63,6 +65,7 @@ export default {
       rowData: {}, //当前选中的数据
     };
   },
+  computed: mapGetters(["userInfo"]),
   created() {
     const businessDictData = JSON.parse(
       window.localStorage.getItem("businessDict")
@@ -86,6 +89,9 @@ export default {
     });
     this.getList();
   },
+  mounted() {
+    console.log(this.userInfo, "www");
+  },
   methods: {
     getList() {
       this.loading = true;
@@ -335,7 +341,14 @@ export default {
         />
         <el-table-column label="操作" align="center" width="120">
           <template slot-scope="scope">
-            <el-button type="text" @click="handleOutbound(scope.row)"
+            <!-- 只有当前用户的角色id是管理员或者仓管员才显示按钮 -->
+            <el-button
+              type="text"
+              v-if="
+                userInfo.role_id === '1619609115577831426' ||
+                userInfo.role_id === '1620698154897735682'
+              "
+              @click="handleOutbound(scope.row)"
               >出库
             </el-button>
           </template>

+ 4 - 6
src/views/order-management/JDReturnGoods/index.vue

@@ -73,7 +73,7 @@ export default {
         jdBackOrderCode: "",
         code: "",
         logisticsCompanyCode: "",
-        logisticsDetailsList: [],
+        list: [],
       },
       showType: "",
       openExcel: false,
@@ -131,11 +131,9 @@ export default {
       this.titleText = "新建退货";
       this.form = {
         warehouseId: "",
-        jdBackOrderId: "",
-        jdBackOrderCode: "",
-        code: "",
+        waybill: "",
         logisticsCompanyCode: "",
-        logisticsDetailsList: [],
+        list: [],
       };
       this.open = true;
     },
@@ -215,7 +213,7 @@ export default {
           this.form = {
             warehouseId: row.warehouseId,
             code: row.waybill,
-            logisticsDetailsList: res.data.data,
+            list: res.data.data,
           };
           this.$refs.addReturnGoods.loading = false;
         });

+ 25 - 31
src/views/order-management/addReturnGoods.vue

@@ -72,9 +72,9 @@
             </el-form-item>
           </el-col>
           <el-col :span="6">
-            <el-form-item label="物流/快递单" prop="code">
+            <el-form-item label="物流/快递单" prop="waybill">
               <el-input
-                v-model="form.code"
+                v-model="form.waybill"
                 placeholder="物流/快递单号"
                 :disabled="showType === 'details'"
               ></el-input>
@@ -91,28 +91,23 @@
           >
         </el-form-item>
         <el-form-item>
-          <el-table
-            :data="form.logisticsDetailsList"
-            v-if="showType !== 'details'"
-          >
+          <el-table :data="form.list" v-if="showType !== 'details'">
             <el-table-column label="产品类型" prop="classifyName">
             </el-table-column>
             <el-table-column label="产品编码" prop="productCode">
             </el-table-column>
             <el-table-column label="产品名称" prop="productName">
             </el-table-column>
-            <el-table-column label="退货数量" prop="shipmentQuantity">
+            <el-table-column label="退货数量" prop="quantity">
               <template slot-scope="scope">
                 <el-form-item
-                  :prop="
-                    'logisticsDetailsList.' + scope.$index + '.shipmentQuantity'
-                  "
-                  :rules="formRules.shipmentQuantity"
+                  :prop="'list.' + scope.$index + '.quantity'"
+                  :rules="formRules.quantity"
                   :inline-message="true"
                   label-width="0"
                 >
                   <el-input
-                    v-model="scope.row.shipmentQuantity"
+                    v-model="scope.row.quantity"
                     placeholder="请输入"
                     size="mini"
                     :disabled="showType === 'details'"
@@ -130,10 +125,7 @@
               </template>
             </el-table-column>
           </el-table>
-          <el-table
-            :data="form.logisticsDetailsList"
-            v-if="showType === 'details'"
-          >
+          <el-table :data="form.list" v-if="showType === 'details'">
             <el-table-column label="退货单号" prop="backCode" />
             <el-table-column label="申请时间" prop="applicationTime" />
             <el-table-column label="备件条码" prop="spareParts" />
@@ -228,7 +220,14 @@ export default {
             trigger: "blur",
           },
         ],
-        shipmentQuantity: [
+        waybill: [
+          {
+            required: true,
+            message: "请输入物流/快递单号",
+            trigger: "blur",
+          },
+        ],
+        quantity: [
           {
             required: true,
             message: "请输入退货数量",
@@ -282,17 +281,14 @@ export default {
       this.$refs.form.validate((valid) => {
         if (valid) {
           if (this.showType !== "details") {
-            if (this.form.logisticsDetailsList.length < 1) {
+            if (this.form.list.length < 1) {
               return this.msgInfo("请添加退货明细!");
             }
             this.loading = true;
-            this.form.logisticsDetailsList = this.form.logisticsDetailsList.map(
-              (x) => ({
-                jdBackProductId: x.jdBackProductId,
-                shipmentQuantity: x.shipmentQuantity,
-                id: x.id,
-              })
-            );
+            this.form.list = this.form.list.map((x) => ({
+              id: x.jdBackProductId,
+              quantity: x.quantity,
+            }));
           }
           this.$emit("submit");
         }
@@ -313,23 +309,21 @@ export default {
       this.selectDialog = true;
     },
     handleSelect(row) {
-      const flag = this.form.logisticsDetailsList.some(
-        (x) => x.jdBackProductId === row.id
-      );
+      const flag = this.form.list.some((x) => x.jdBackProductId === row.id);
       if (flag) return this.msgInfo("该产品已经选择");
       const product = {
         classifyName: row.classifyName || "",
         productCode: row.code,
         productName: row.name,
         jdBackProductId: row.id,
-        shipmentQuantity: "",
+        quantity: "",
         id: "",
       };
-      this.form.logisticsDetailsList.push(product);
+      this.form.list.push(product);
       this.msgSuccess("选择成功");
     },
     deleteRow(index) {
-      this.form.logisticsDetailsList.splice(index, 1);
+      this.form.list.splice(index, 1);
       this.msgSuccess("删除成功");
     },
   },

+ 4 - 5
src/views/purchase-management/subscribe/index.vue

@@ -6,7 +6,7 @@ import query from "@/components/query/index.vue";
 
 import byTable from "@/components/by-table/index.js";
 import sendSubscribe from "./sendSubscribe.vue";
-import PurchaseDetails from "@/components/purchase/details.vue";
+import subscribeDetails from "@/components/purchase/subscribeDetails.vue";
 
 import * as API from "@/api/purchase-management/subscribe/index.js";
 import { warehouseSelectList } from "@/api/product-material/warehouse/index.js";
@@ -17,7 +17,7 @@ export default {
     byTable,
     query,
     sendSubscribe,
-    PurchaseDetails,
+    subscribeDetails,
   },
   data() {
     return {
@@ -256,8 +256,7 @@ export default {
       <el-table :data="tableList" v-loading="loading">
         <el-table-column label="申购单号" align="left" prop="code" width="140">
           <template slot-scope="scope">
-            <div class="show_underline">
-              <!-- @click="handleLookDetails(scope.row)" -->
+            <div class="show_underline" @click="handleLookDetails(scope.row)">
               {{ scope.row.code }}
             </div>
           </template>
@@ -391,7 +390,7 @@ export default {
       width="50%"
       top="60px"
     >
-      <PurchaseDetails :rowData="rowData"></PurchaseDetails>
+      <subscribeDetails :rowData="rowData"></subscribeDetails>
     </el-dialog>
   </div>
 </template>