Selaa lähdekoodia

待出库页面完成

cz 2 vuotta sitten
vanhempi
commit
b15875e731

+ 21 - 0
src/api/inbound-outbound/treatOut.js

@@ -0,0 +1,21 @@
+import request from '@/router/axios'
+
+// 待出库列表 
+export function outList(data = {}) {
+  return request({
+    url: '/api/victoriatourist/orderInfo/issuePage',
+    method: 'post',
+    data: data,
+  })
+}
+
+
+
+// 采购退货出库
+export function cgOut(data = {}) {
+  return request({
+    url: '/api/victoriatourist/orderInfo/issue',
+    method: 'post',
+    data: data,
+  })
+}

+ 18 - 0
src/api/order-management/JDReturnGoods/index.js

@@ -94,3 +94,21 @@ export function JDtest(data = {}) {
     data: data,
   })
 }
+
+//添加物流数据
+export function addLogistics(data = {}) {
+  return request({
+    url: '/api/victoriatourist/logisticsInfo/addLogistics',
+    method: 'post',
+    data: data,
+  })
+}
+
+//添加物流记录
+export function addRecord(data = {}) {
+  return request({
+    url: '/api/victoriatourist/logisticsRecords/add',
+    method: 'post',
+    data: data,
+  })
+}

+ 8 - 2
src/api/purchase-management/deliver-goods/index.js

@@ -72,5 +72,11 @@ export function logisticsSelectData(data = {}) {
   })
 }
 
-
-
+//采购退货
+export function purchaseBack(data = {}) {
+  return request({
+    url: '/api/victoriatourist/purchaseBack/add',
+    method: 'post',
+    data: data,
+  })
+}

+ 22 - 0
src/router/page/index.js

@@ -498,6 +498,28 @@ export default [{
     }, ],
   },
   {
+    path: '/inbound-outbound/treatIn',
+    component: Layout,
+    redirect: '/inbound-outbound/treatIn/index',
+    children: [{
+      path: 'index',
+      name: '待入库',
+      component: () => import( /* webpackChunkName: "page" */ '@/views/inbound-outbound/treatIn/index'),
+      props: true,
+    }, ],
+  },
+  {
+    path: '/inbound-outbound/treatOut',
+    component: Layout,
+    redirect: '/inbound-outbound/treatOut/index',
+    children: [{
+      path: 'index',
+      name: '待出库',
+      component: () => import( /* webpackChunkName: "page" */ '@/views/inbound-outbound/treatOut/index'),
+      props: true,
+    }, ],
+  },
+  {
     path: '/inbound-outbound/transfer',
     component: Layout,
     redirect: '/inbound-outbound/transfer/index',

+ 24 - 10
src/views/inbound-outbound/abnormalManage/addFollow.vue

@@ -67,17 +67,17 @@
         </el-row>
         <el-row>
           <el-col :span="10">
-            <el-form-item label="处理方式">
+            <el-form-item label="处理方式" prop="processing">
               <el-select
-                v-model="form.handleTime"
+                v-model="form.processing"
                 allow-create
                 placeholder="请选择"
               >
                 <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
+                  v-for="item in handleWayList"
+                  :key="item.id"
+                  :label="item.dictValue"
+                  :value="item.dictKey"
                 >
                 </el-option>
               </el-select>
@@ -146,24 +146,38 @@ export default {
             trigger: "change",
           },
         ],
-        nextHandleUser: [
+        // nextHandleUser: [
+        //   {
+        //     required: true,
+        //     message: "请选择下一跟进人",
+        //     trigger: "change",
+        //   },
+        // ],
+        handleTime: [
           {
             required: true,
-            message: "请选择下一跟进人",
+            message: "请选择跟进时间",
             trigger: "change",
           },
         ],
-        handleTime: [
+        processing: [
           {
             required: true,
-            message: "请选择跟进时间",
+            message: "请选择处理方式",
             trigger: "change",
           },
         ],
       },
+      handleWayList: [],
     };
   },
   created() {
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+    this.handleWayList = businessDictData.find(
+      (item) => item.code === "handleWay"
+    ).children;
     getListByRole({ roleId: this.userInfo.role_id }).then((res) => {
       this.userList = res.data.data;
     });

+ 19 - 4
src/views/inbound-outbound/abnormalManage/index.vue

@@ -4,6 +4,7 @@
 import query from "@/components/query/index.vue";
 import * as API from "@/api/inbound-outbound/abnormalManage.js";
 import addFollow from "./addFollow.vue";
+import { dateFormat } from "@/util/date.js";
 
 export default {
   components: {
@@ -12,8 +13,10 @@ export default {
   },
   data() {
     return {
+      userInfo: {},
       abnormalSourceList: [],
       handleStatusList: [],
+      handleWayList: [],
       queryParams: {
         pageNum: 1,
         pageSize: 10,
@@ -49,6 +52,8 @@ export default {
     };
   },
   created() {
+    const userInfo = JSON.parse(window.localStorage.getItem("saber-userInfo"));
+    this.userInfo = userInfo.content;
     const businessDictData = JSON.parse(
       window.localStorage.getItem("businessDict")
     );
@@ -58,7 +63,9 @@ export default {
     this.handleStatusList = businessDictData.find(
       (item) => item.code === "handleStatus"
     ).children;
-
+    this.handleWayList = businessDictData.find(
+      (item) => item.code === "handleWay"
+    ).children;
     this.selectConfig[0].data = this.abnormalSourceList.map((item) => ({
       label: item.dictValue,
       value: item.dictKey,
@@ -108,10 +115,11 @@ export default {
       this.form = {
         abnormalInfoId: row.id,
         explain: "",
-        status: "",
-        handleUser: "",
-        handleTime: "",
+        status: "0",
+        handleUser: this.userInfo.user_id,
+        handleTime: dateFormat(new Date()),
         nextHandleUser: "",
+        processing: "",
       };
       this.open = true;
     },
@@ -157,6 +165,13 @@ export default {
           prop="handleUserName"
           width="120"
         />
+        <!-- <el-table-column
+          label="处理方式"
+          align="left"
+          prop="processing"
+          width="100"
+          :formatter="(row) => dictDataEcho(row.processing, handleWayList)"
+        /> -->
         <el-table-column
           label="最近操作时间"
           align="left"

+ 268 - 0
src/views/inbound-outbound/treatIn/index.vue

@@ -0,0 +1,268 @@
+
+
+<script>
+import test from "@/components/form-test/index.vue";
+import query from "@/components/query/index.vue";
+import purchaseInbound from "./purchaseInbound.vue";
+
+import * as API from "@/api/inbound-outbound/outbound/salesOutbound.js";
+import { warehouseSelectList } from "@/api/product-material/warehouse/index.js";
+
+export default {
+  components: {
+    test,
+    query,
+    purchaseInbound,
+  },
+  data() {
+    return {
+      orderTypeList: [],
+      warehouseTypeList: [],
+      warehouseSelectList: [],
+      outboundTypeList: [],
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        keyword: "",
+        type: "",
+        status: "",
+        code: "",
+        customerName: "",
+        minAmountMoney: "",
+        maxAmountMoney: "",
+        countryId: "",
+        provinceId: "",
+        cityId: "",
+      },
+      selectConfig: [
+        {
+          label: "类型",
+          prop: "type",
+          data: [
+            { label: "采购入库", value: "1" },
+            { label: "京东退货", value: "0" },
+          ],
+        },
+      ],
+      tableList: [],
+      total: 0,
+      loading: false,
+      titleText: "",
+      open: false,
+      form: {
+        orderId: "",
+        warehouseId: "",
+        logisticsCode: "",
+        logisticsCompanyCode: "",
+        orderDetailsList: [],
+      },
+      addType: "",
+    };
+  },
+  created() {
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+
+    this.warehouseTypeList = businessDictData.find(
+      (item) => item.code === "warehouseType"
+    ).children;
+    this.outboundTypeList = businessDictData.find(
+      (item) => item.code === "outboundType"
+    ).children;
+    warehouseSelectList().then((res) => {
+      this.warehouseSelectList = res.data.data;
+    });
+    this.getList();
+  },
+  methods: {
+    getList() {
+      this.loading = true;
+      API.salesOrderList(this.queryParams).then(
+        (res) => {
+          this.tableList = res.data.data.records;
+          this.total = res.data.data.total;
+          this.loading = false;
+        },
+        (err) => {
+          console.log("salesOrderList: " + err);
+          this.loading = false;
+        }
+      );
+    },
+    handleQuery() {
+      this.getList();
+    },
+    handleInbound(row, type = "") {
+      this.addType = type;
+      this.open = true;
+      this.$nextTick(() => {
+        this.$refs.addOutbound.loading = true;
+        API.getOrderDetails({ id: row.id }).then(
+          (res) => {
+            const productDetailsList = res.data.data.map((x) => ({
+              productCode: x.productCode,
+              productName: x.productName,
+              notIssuedQuantity: x.notIssuedQuantity,
+              specs: x.productSpecs,
+              changeQuantity: Number(x.notIssuedQuantity),
+              productId: x.productId,
+              orderDetailsId: x.id,
+            }));
+            this.form = {
+              customerName: row.customerName,
+              orderType: String(row.type),
+              orderCode: row.code,
+              type: "4",
+              orderId: row.id,
+              warehouseId: "",
+              logisticsCode: "",
+              logisticsCompanyCode: "",
+              orderDetailsList: productDetailsList,
+            };
+            this.$refs.addOutbound.loading = false;
+          },
+          (err) => {
+            console.log("getOrderDetails: " + err);
+            this.$refs.addOutbound.loading = false;
+          }
+        );
+      });
+    },
+    handleCancel() {
+      this.open = false;
+    },
+    handleSubmit() {
+      API.salesOutbound(this.form).then(
+        () => {
+          this.msgSuccess("添加成功");
+          this.$refs.addOutbound.loading = false;
+          this.open = false;
+          this.getList();
+        },
+        (err) => {
+          console.log("outboundAdd: " + err);
+          this.$refs.addOutbound.loading = false;
+        }
+      );
+    },
+
+    showAddress(row) {
+      return (
+        <div>
+          {row.countryName} , {row.provinceName} , {row.cityName} ,
+          {row.detailedAddress}
+        </div>
+      );
+    },
+    showOutboundStatus(row) {
+      if (row.issueStatus === 1) {
+        return "未出库";
+      } else if (row.issueStatus === 2) {
+        return "部分出库";
+      }
+    },
+  },
+};
+</script>
+
+
+<template>
+  <div class="box-card">
+    <el-card>
+      <query
+        :selectConfig="selectConfig"
+        :req="queryParams"
+        :isShowMore="true"
+        @handleQuery="handleQuery"
+        @handleMore="
+          () => {
+            queryDialog = true;
+          }
+        "
+      ></query>
+      <el-table :data="tableList" v-loading="loading">
+        <el-table-column
+          label="类型"
+          align="left"
+          prop="type"
+          width="120"
+          :formatter="(row) => dictDataEcho(row.type, orderTypeList)"
+        />
+        <el-table-column
+          label="仓库名称"
+          align="left"
+          prop="code"
+          width="150"
+        />
+        <el-table-column label="单号" align="left" prop="customerName" />
+        <el-table-column label="物流/快递公司" align="left" />
+        <el-table-column
+          label="物流/快递单号"
+          align="left"
+          prop="orderTime"
+          width="160"
+        />
+        <el-table-column
+          label="操作人"
+          align="left"
+          prop="issueStatus"
+          width="100"
+        />
+        <el-table-column
+          label="操作时间"
+          align="left"
+          prop="issueStatus"
+          width="100"
+        />
+        <el-table-column
+          label="状态"
+          align="left"
+          prop="issueStatus"
+          width="100"
+        />
+
+        <el-table-column label="操作" align="center" width="120">
+          <template slot-scope="scope">
+            <el-button type="text" @click="handleInbound(scope.row)"
+              >入库
+            </el-button>
+            <!-- <el-button type="text" @click="handleInbound(scope.row, '10')"
+              >补发货
+            </el-button> -->
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="getList"
+      />
+    </el-card>
+
+    <el-dialog
+      :title="titleText"
+      :visible.sync="open"
+      v-if="open"
+      width="80%"
+      top="60px"
+    >
+      <purchase-inbound
+        :form="form"
+        @submit="handleSubmit"
+        @cancel="handleCancel"
+        ref="addOutbound"
+      ></purchase-inbound>
+    </el-dialog>
+  </div>
+</template>
+
+
+<style lang="scss" scoped>
+.box-card {
+  height: calc(100vh - 110px);
+  overflow-y: auto;
+}
+</style>

+ 269 - 0
src/views/inbound-outbound/treatIn/purchaseInbound.vue

@@ -0,0 +1,269 @@
+<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="purchaseCode">
+              <el-input v-model="form.purchaseCode" disabled></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="供应商" prop="supplierName">
+              <el-input v-model="form.supplierName" disabled></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="10">
+          <el-col :span="4">
+            <el-form-item label="物流公司" prop="logisticsCompanyName">
+              <el-input v-model="form.logisticsCompanyName" disabled></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="物流/快递单号" prop="code">
+              <el-input v-model="form.code" disabled></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <div style="margin-bottom: 20px">
+          <labelTitle content="到货明细"></labelTitle>
+        </div>
+        <el-form-item>
+          <el-table :data="form.changeDetailsList">
+            <el-table-column label="物品编码" prop="goodsCode">
+            </el-table-column>
+            <el-table-column label="物品名称" prop="goodsName">
+            </el-table-column>
+            <el-table-column label="采购数量" prop="purchaseQuantity">
+            </el-table-column>
+            <el-table-column label="本次发货" prop="shipmentQuantity">
+            </el-table-column>
+            <el-table-column label="已入库数量" prop="receiptQuantity">
+            </el-table-column>
+            <el-table-column
+              label="本次入库"
+              prop="changeQuantity"
+              align="center"
+            >
+              <template slot-scope="scope">
+                <el-form-item
+                  :prop="
+                    'changeDetailsList.' + scope.$index + '.changeQuantity'
+                  "
+                  :rules="formRules1.changeQuantity"
+                  :inline-message="true"
+                  label-width="0"
+                >
+                  <el-input-number
+                    v-model="scope.row.changeQuantity"
+                    :controls="false"
+                    placeholder="请输入"
+                    size="mini"
+                    style="width: 100%"
+                  >
+                  </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 * as API from "@/api/inbound-outbound/inbound/index.js";
+
+export default {
+  name: "addInbound",
+  components: { labelTitle },
+  props: {
+    form: {
+      type: Object,
+      default: () => {},
+    },
+    warehouseSelectList: {
+      type: Array,
+      default: () => [],
+    },
+    warehouseTypeList: {
+      type: Array,
+      default: () => [],
+    },
+  },
+  data() {
+    return {
+      selectLit: [],
+      loading: false,
+      formRules: {
+        id: [
+          {
+            required: true,
+            message: "请选择物流单号",
+            trigger: "change",
+          },
+        ],
+        changeQuantity: [
+          {
+            required: true,
+            message: "请输入到货数量",
+            trigger: "blur",
+          },
+        ],
+      },
+      formRules1: {
+        id: [
+          {
+            required: true,
+            message: "请选择收货仓库",
+            trigger: "change",
+          },
+        ],
+        changeQuantity: [
+          {
+            required: true,
+            message: "请输入入库数量",
+            trigger: "blur",
+          },
+        ],
+      },
+      selectDialog: false,
+      warehouseName: "",
+    };
+  },
+  created() {
+    // this.getSelectList();
+  },
+  methods: {
+    getSelectList() {
+      this.loading = true;
+      API.saleOrdersList().then(
+        (res) => {
+          this.selectLit = res.data.data.records;
+          this.loading = false;
+        },
+        (err) => {
+          console.log("saleOrdersList: " + err);
+          this.loading = false;
+        }
+      );
+    },
+    handleSubmit() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          const sum = this.form.changeDetailsList.reduce((sum, x) => {
+            return sum + Number(x.changeQuantity);
+          }, 0);
+          if (sum < 1) {
+            return this.msgInfo("入库总数量不能小于1");
+          }
+          for (let i = 0; i < this.form.changeDetailsList.length; i++) {
+            if (
+              Number(this.form.changeDetailsList[i].receiptQuantity) +
+                Number(this.form.changeDetailsList[i].changeQuantity) >
+              Number(this.form.changeDetailsList[i].shipmentQuantity)
+            ) {
+              return this.msgInfo(
+                "已入库数量和本次入库数量总合不能大于本次发货数量"
+              );
+            }
+          }
+          this.loading = true;
+          this.form.changeDetailsList = this.form.changeDetailsList.map(
+            (x) => ({
+              businessId: x.id,
+              warehouseId: x.receiptWarehouseId,
+              goodsId: x.goodsId,
+              changeQuantity: x.changeQuantity,
+            })
+          );
+          this.$emit("submit");
+        }
+      });
+    },
+    handleCancel() {
+      this.$emit("cancel");
+    },
+    handleChange(id) {
+      this.loading = true;
+      API.inboundDetails({ id }).then(
+        (res) => {
+          this.form.changeDetailsList = res.data.data.map((x) => ({
+            ...x,
+            changeQuantity: "",
+          }));
+          this.loading = false;
+        },
+        (err) => {
+          console.log("inboundDetails: " + err);
+          this.loading = false;
+        }
+      );
+    },
+    handleChangeWarehouse(id) {
+      const current = this.warehouseSelectList.find((x) => x.id === id);
+      if (current) {
+        this.warehouseName = current.name;
+      }
+      this.form.changeDetailsList = [];
+    },
+    handleAddProduct() {
+      if (!this.form.id) return this.msgInfo("请先选择收获仓库");
+      this.selectDialog = true;
+    },
+    handleSelect(row) {
+      const flag = this.form.changeDetailsList.some(
+        (x) => x.goodsId === row.id
+      );
+      if (flag) return this.msgInfo("该物品已经选择");
+      const product = {
+        productCode: row.code,
+        productName: row.name,
+        productType: row.type,
+        warehouseName: this.warehouseName,
+        goodsId: row.id,
+        changeQuantity: "",
+      };
+      this.form.changeDetailsList.push(product);
+    },
+    deleteRow(index) {
+      this.form.changeDetailsList.splice(index, 1);
+      this.msgSuccess("删除成功");
+    },
+  },
+};
+</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>

+ 228 - 0
src/views/inbound-outbound/treatOut/cgOut.vue

@@ -0,0 +1,228 @@
+<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="6">
+            <el-form-item label="仓库名称" prop="warehouseId">
+              <el-select
+                v-model="form.warehouseId"
+                placeholder="请选择"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in warehouseSelectList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                >
+                  <span style="float: left">{{
+                    `${item.name}(${dictDataEcho(
+                      item.type,
+                      warehouseTypeList
+                    )})`
+                  }}</span>
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="4">
+            <el-form-item label="出库类型" prop="type">
+              <el-select
+                v-model="form.type"
+                placeholder="请选择"
+                style="width: 100%"
+                disabled
+              >
+                <el-option
+                  v-for="item in outboundTypeList"
+                  :key="item.id"
+                  :label="item.dictValue"
+                  :value="item.dictKey"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <div style="margin-bottom: 20px">
+          <labelTitle content="退货明细"></labelTitle>
+        </div>
+        <el-form-item>
+          <el-table :data="form.orderDetailsList">
+            <el-table-column label="产品编码" prop="productCode">
+            </el-table-column>
+            <el-table-column label="产品名称" prop="productName">
+            </el-table-column>
+            <el-table-column label="规格" prop="specs"> </el-table-column>
+            <el-table-column label="本次退货" prop="notIssuedQuantity">
+            </el-table-column>
+            <el-table-column label="本次出库" prop="changeQuantity">
+              <template slot-scope="scope">
+                <el-form-item
+                  :prop="'orderDetailsList.' + scope.$index + '.changeQuantity'"
+                  :rules="formRules.changeQuantity"
+                  :inline-message="true"
+                  label-width="0"
+                >
+                  <el-input
+                    v-model="scope.row.changeQuantity"
+                    placeholder="请输入"
+                    size="mini"
+                  >
+                  </el-input>
+                </el-form-item>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-form-item>
+        <div style="margin: 20px 0px">
+          <labelTitle content="物流信息"></labelTitle>
+        </div>
+        <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="logisticsCode">
+              <el-input
+                v-model="form.logisticsCode"
+                placeholder="请输入"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </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 selectProduct from "@/components/select-product/index.vue";
+
+import { getToken } from "@/util/auth";
+import { getLogisticsData } from "@/api/system/common.js";
+
+export default {
+  name: "addManualOutbound",
+  components: { labelTitle, selectProduct },
+  props: {
+    form: {
+      type: Object,
+      default: () => {},
+    },
+    warehouseSelectList: {
+      type: Array,
+      default: () => [],
+    },
+    warehouseTypeList: {
+      type: Array,
+      default: () => [],
+    },
+    outboundTypeList: {
+      type: Array,
+      default: () => [],
+    },
+  },
+  data() {
+    return {
+      uploadHeader: {
+        Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
+        "Blade-Auth": "bearer " + getToken(),
+      },
+      loading: false,
+      logisticsData: [],
+      formRules: {
+        changeQuantity: [
+          {
+            required: true,
+            message: "请输入本次出库数量",
+            trigger: "blur",
+          },
+        ],
+        warehouseId: [
+          {
+            required: true,
+            message: "请选择仓库",
+            trigger: "change",
+          },
+        ],
+        type: [
+          {
+            required: true,
+            message: "请选择出库类型",
+            trigger: "change",
+          },
+        ],
+      },
+    };
+  },
+  created() {
+    getLogisticsData({ keyword: "" }).then(
+      (res) => {
+        this.logisticsData = res.data.data;
+      },
+      (err) => {
+        console.log("getDeptData:" + err);
+      }
+    );
+  },
+  methods: {
+    handleSubmit() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          this.loading = true;
+          this.$emit("submit");
+        }
+      });
+    },
+    handleCancel() {
+      this.$emit("cancel");
+    },
+  },
+};
+</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>

+ 395 - 0
src/views/inbound-outbound/treatOut/index.vue

@@ -0,0 +1,395 @@
+
+
+<script>
+import test from "@/components/form-test/index.vue";
+import query from "@/components/query/index.vue";
+import addOutbound from "@/components/inbound-outbound/addOutbound.vue";
+import cgOut from "./cgOut.vue";
+
+import * as API from "@/api/inbound-outbound/treatOut.js";
+import { warehouseSelectList } from "@/api/product-material/warehouse/index.js";
+import {
+  getOrderDetails,
+  salesOutbound,
+} from "@/api/inbound-outbound/outbound/salesOutbound.js";
+import { JDorderOutbound } from "@/api/inbound-outbound/outbound/JDoutbound.js";
+
+export default {
+  components: {
+    test,
+    query,
+    addOutbound,
+    cgOut,
+  },
+  data() {
+    return {
+      orderTypeList: [
+        { dictValue: "销售订单", dictKey: "1" },
+        { dictValue: "京东订单", dictKey: "3" },
+        { dictValue: "采购退货", dictKey: "7" },
+      ],
+      orderTypeListData: [],
+      warehouseTypeList: [],
+      warehouseSelectList: [],
+      outboundTypeList: [],
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        keyword: "",
+        type: "",
+        status: "",
+      },
+      selectConfig: [
+        {
+          label: "类型",
+          prop: "type",
+          data: [],
+        },
+      ],
+      tableList: [],
+      total: 0,
+      loading: false,
+      titleText: "",
+      open: false,
+      form: {
+        orderId: "",
+        warehouseId: "",
+        logisticsCode: "",
+        logisticsCompanyCode: "",
+        orderDetailsList: [],
+      },
+      addType: "",
+
+      rowData: {}, //当前选中的数据
+    };
+  },
+  created() {
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+
+    this.warehouseTypeList = businessDictData.find(
+      (item) => item.code === "warehouseType"
+    ).children;
+
+    this.outboundTypeList = businessDictData.find(
+      (item) => item.code === "outboundType"
+    ).children;
+
+    this.selectConfig[0].data = this.orderTypeList.map((x) => ({
+      value: x.dictKey,
+      label: x.dictValue,
+    }));
+
+    warehouseSelectList().then((res) => {
+      this.warehouseSelectList = res.data.data;
+    });
+    this.getList();
+  },
+  methods: {
+    getList() {
+      this.loading = true;
+      API.outList(this.queryParams).then(
+        (res) => {
+          this.tableList = res.data.data.records;
+          this.total = res.data.data.total;
+          this.loading = false;
+        },
+        (err) => {
+          console.log("outList: " + err);
+          this.loading = false;
+        }
+      );
+    },
+    handleQuery() {
+      this.getList();
+    },
+    salesOut(row) {
+      this.titleText = "销售订单出库";
+      this.$nextTick(() => {
+        this.$refs.addOutbound.loading = true;
+        getOrderDetails({ id: row.id }).then(
+          (res) => {
+            const productDetailsList = res.data.data.map((x) => ({
+              productCode: x.productCode,
+              productName: x.productName,
+              notIssuedQuantity: x.notIssuedQuantity,
+              specs: x.productSpecs,
+              changeQuantity: Number(x.notIssuedQuantity),
+              productId: x.productId,
+              orderDetailsId: x.id,
+            }));
+            this.form = {
+              customerName: row.customerName,
+              orderType: String(row.type),
+              orderCode: row.code,
+              type: "4",
+              orderId: row.id,
+              warehouseId: "",
+              logisticsCode: "",
+              logisticsCompanyCode: "",
+              orderDetailsList: productDetailsList,
+            };
+            this.$refs.addOutbound.loading = false;
+          },
+          (err) => {
+            console.log("getOrderDetails: " + err);
+            this.$refs.addOutbound.loading = false;
+          }
+        );
+      });
+    },
+    JDout(row) {
+      this.titleText = "京东订单出库";
+      this.$nextTick(() => {
+        this.$refs.addOutbound.loading = true;
+        getOrderDetails({ id: row.id }).then(
+          (res) => {
+            const productDetailsList = res.data.data.map((x) => ({
+              productCode: x.productCode,
+              productName: x.productName,
+              notIssuedQuantity: x.notIssuedQuantity,
+              specs: x.productSpecs,
+              changeQuantity: Number(x.notIssuedQuantity),
+              productId: x.productId,
+              orderDetailsId: x.id,
+            }));
+            this.form = {
+              customerName: "京东",
+              orderType: "京东",
+              type: "京东订单",
+              orderId: row.id,
+              warehouseId: "",
+              logisticsCode: "",
+              logisticsCompanyCode: "",
+              orderDetailsList: productDetailsList,
+            };
+            this.$refs.addOutbound.loading = false;
+          },
+          (err) => {
+            console.log("getOrderDetails: " + err);
+            this.$refs.addOutbound.loading = false;
+          }
+        );
+      });
+    },
+    purchaseOut(row) {
+      this.titleText = "采购退货出库";
+      this.$nextTick(() => {
+        this.$refs.addOutbound.loading = true;
+        getOrderDetails({ id: row.id }).then(
+          (res) => {
+            const productDetailsList = res.data.data.map((x) => ({
+              productCode: x.productCode,
+              productName: x.productName,
+              notIssuedQuantity: x.notIssuedQuantity,
+              specs: x.productSpecs,
+              changeQuantity: Number(x.notIssuedQuantity),
+              productId: x.productId,
+              orderDetailsId: x.id,
+            }));
+            this.form = {
+              type: "5", //默认选择退货
+              orderId: row.id,
+              warehouseId: "",
+              logisticsCode: "",
+              logisticsCompanyCode: "",
+              orderDetailsList: productDetailsList,
+            };
+            this.$refs.addOutbound.loading = false;
+          },
+          (err) => {
+            console.log("getOrderDetails: " + err);
+            this.$refs.addOutbound.loading = false;
+          }
+        );
+      });
+    },
+    handleOutbound(row) {
+      this.rowData = { ...row };
+      this.open = true;
+      switch (row.type) {
+        case 1: {
+          this.salesOut(row);
+          break;
+        }
+        case 3: {
+          this.JDout(row);
+          break;
+        }
+        case 7: {
+          this.purchaseOut(row);
+          break;
+        }
+      }
+    },
+    handleCancel() {
+      this.open = false;
+    },
+    handleSubmit() {
+      switch (this.rowData.type) {
+        case 1: {
+          salesOutbound(this.form).then(
+            () => {
+              this.msgSuccess("出库成功");
+              this.$refs.addOutbound.loading = false;
+              this.open = false;
+              this.getList();
+            },
+            (err) => {
+              console.log("outboundAdd: " + err);
+              this.$refs.addOutbound.loading = false;
+            }
+          );
+          break;
+        }
+        case 3: {
+          JDorderOutbound(this.form).then(
+            () => {
+              this.msgSuccess("出库成功");
+              this.$refs.addOutbound.loading = false;
+              this.open = false;
+              this.getList();
+            },
+            (err) => {
+              console.log("JDorderOutbound: " + err);
+              this.$refs.addOutbound.loading = false;
+            }
+          );
+          break;
+        }
+        case 7: {
+          API.cgOut(this.form).then(
+            () => {
+              this.msgSuccess("出库成功");
+              this.$refs.addOutbound.loading = false;
+              this.open = false;
+              this.getList();
+            },
+            (err) => {
+              console.log("cgOut: " + err);
+              this.$refs.addOutbound.loading = false;
+            }
+          );
+          break;
+        }
+      }
+    },
+
+    showAddress(row) {
+      return (
+        <div>
+          {row.countryName} , {row.provinceName} , {row.cityName}
+        </div>
+      );
+    },
+    showOutboundStatus(row) {
+      if (row.status === 1) {
+        return "未出库";
+      } else if (row.status === 2) {
+        return "部分出库";
+      }
+    },
+  },
+};
+</script>
+
+
+<template>
+  <div class="box-card">
+    <el-card>
+      <query
+        :selectConfig="selectConfig"
+        :req="queryParams"
+        :isShowMore="true"
+        @handleQuery="handleQuery"
+        @handleMore="
+          () => {
+            queryDialog = true;
+          }
+        "
+      ></query>
+      <el-table :data="tableList" v-loading="loading">
+        <el-table-column
+          label="类型"
+          align="left"
+          prop="type"
+          width="120"
+          :formatter="(row) => dictDataEcho(row.type, orderTypeList)"
+        />
+        <el-table-column label="单号" align="left" prop="code" width="150" />
+        <el-table-column label="收件人" align="left" prop="contacts" />
+        <el-table-column label="联系电话" align="left" prop="phone" />
+        <el-table-column
+          label="所在城市"
+          align="left"
+          :formatter="showAddress"
+        />
+        <el-table-column label="收件地址" align="left" prop="detailedAddress" />
+        <el-table-column
+          label="状态"
+          align="left"
+          prop="status"
+          width="100"
+          :formatter="showOutboundStatus"
+        />
+        <el-table-column label="操作" align="center" width="120">
+          <template slot-scope="scope">
+            <el-button type="text" @click="handleOutbound(scope.row)"
+              >出库
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="getList"
+      />
+    </el-card>
+
+    <el-dialog
+      :title="titleText"
+      :visible.sync="open"
+      v-if="open"
+      width="80%"
+      top="60px"
+    >
+      <add-outbound
+        v-if="rowData.type === 1 || rowData.type === 3"
+        :form="form"
+        :addType="addType"
+        :orderTypeList="orderTypeListData"
+        :warehouseSelectList="warehouseSelectList"
+        :warehouseTypeList="warehouseTypeList"
+        :outboundTypeList="outboundTypeList"
+        @submit="handleSubmit"
+        @cancel="handleCancel"
+        ref="addOutbound"
+      ></add-outbound>
+
+      <cg-out
+        v-else
+        :form="form"
+        :addType="addType"
+        :orderTypeList="orderTypeListData"
+        :warehouseSelectList="warehouseSelectList"
+        :warehouseTypeList="warehouseTypeList"
+        :outboundTypeList="outboundTypeList"
+        @submit="handleSubmit"
+        @cancel="handleCancel"
+        ref="addOutbound"
+      ></cg-out>
+    </el-dialog>
+  </div>
+</template>
+
+
+<style lang="scss" scoped>
+.box-card {
+  height: calc(100vh - 110px);
+  overflow-y: auto;
+}
+</style>

+ 114 - 65
src/views/order-management/JDReturnGoods/logisticsList.vue

@@ -29,7 +29,7 @@ export default {
         otherButton: {
           list: [
             {
-              name: "添加物流",
+              name: "添加物流数据",
               methodsText: "add",
               type: "primary",
               add: () => {
@@ -107,11 +107,29 @@ export default {
       activeName: "first",
       allList: [],
       backlogList: [],
-      ws: null, //建立的webSocket连接
-      lockReconnect: false, //是否真正建立连接
-      timeout: 30 * 1000, //30秒一次心跳
-      timeoutObj: null, //心跳倒计时
-      timeoutnum: null, //断开 重连倒计时
+      addRecord: false,
+      recordForm: {
+        logisticsId: "",
+        addTime: "",
+        remark: "",
+      },
+      recordFormRules: {
+        addTime: [
+          {
+            required: true,
+            message: "请选择时间",
+            trigger: "change",
+          },
+        ],
+        remark: [
+          {
+            required: true,
+            message: "请输入物流数据",
+            trigger: "blur",
+          },
+        ],
+      },
+      selectRow: {},
     };
   },
   created() {
@@ -137,64 +155,8 @@ export default {
     this.getList();
     const userInfo = JSON.parse(window.localStorage.getItem("saber-userInfo"));
     this.userInfo = userInfo.content;
-    // this.initWebpack();
   },
   methods: {
-    initWebpack() {
-      // this.ws = new WebSocket(
-      //   `/cz/victoriatourist/webStock/userId=${this.userInfo.user_id}`
-      // );
-      // const url = `ws://36.134.91.96:10003/cz/api/victoriatourist/webStock/${this.userInfo.access_token}`;
-      const url =
-        "ws://36.134.91.96:10003/api/victoriatourist/webStock/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiI4NDUyMDYiLCJ1c2VyX25hbWUiOiJhZG1pbiIsInJlYWxfbmFtZSI6ImFkbeWnk-WQjSIsImF2YXRhciI6IiIsImF1dGhvcml0aWVzIjpbImFkbWluIl0sImNsaWVudF9pZCI6InNhYmVyIiwicm9sZV9uYW1lIjoiYWRtaW4iLCJsaWNlbnNlIjoicG93ZXJlZCBieSBibGFkZXgiLCJwb3N0X2lkIjoiMTYxOTYwOTExNzE1NDg4OTczMCIsInVzZXJfaWQiOiIxNjE5NjA5MTE3NTU3NTI2NTMwIiwicm9sZV9pZCI6IjE2MTk2MDkxMTU1Nzc4MzE0MjYiLCJzY29wZSI6WyJhbGwiXSwibmlja19uYW1lIjoiYWRtaW4iLCJvYXV0aF9pZCI6IiIsImRldGFpbCI6eyJ0eXBlIjoid2ViIn0sImV4cCI6MTY3ODMyOTA1OCwiZGVwdF9pZCI6IjE2MTk2MDkxMTcxMjk3MjM5MDYiLCJqdGkiOiI2OTE0YjY2Mi02OTVjLTQxNGYtYWU1ZC1mOTAxODgyOTJmZDkiLCJhY2NvdW50IjoiYWRtaW4ifQ.dUpl71ynDH06u_tpSqZGSHMmd0maXCGXZRrLUvTMqf4";
-      this.ws = new WebSocket(url);
-      console.log(this.ws);
-      this.ws.onopen = this.onopen;
-      this.ws.onmessage = this.onmessage;
-      this.ws.onclose = this.onclose;
-      this.ws.onerror = this.onerror;
-    },
-    start() {
-      //开启心跳
-      var self = this;
-      self.timeoutObj && clearTimeout(self.timeoutObj);
-      self.timeoutObj = setTimeout(() => {
-        //这里发送一个心跳,后端收到后,返回一个心跳消息,
-        if (self.ws.readyState == 1) {
-          //如果连接正常
-          self.ws.send("ping");
-        } else {
-          //否则重连
-          self.reconnect();
-        }
-      }, self.timeout);
-    },
-    reconnect() {
-      //重新连接
-      if (this.lockReconnect) {
-        return;
-      }
-      this.lockReconnect = true;
-      //没连接上会一直重连,设置延迟避免请求过多
-      this.timeoutnum && clearTimeout(this.timeoutnum);
-      this.timeoutnum = setTimeout(() => {
-        //新连接
-        this.initWebpack();
-        this.lockReconnect = false;
-      }, 5000);
-    },
-    onmessage(e) {
-      var msg = JSON.parse(e.data);
-      console.log(msg, "assw");
-    },
-    onclose() {
-      console.log("close");
-      this.reconnect();
-    },
-    onerror() {
-      console.log("error");
-      this.reconnect();
-    },
     getList() {
       this.loading = true;
       API.getLogisticsData(this.queryParams).then(
@@ -213,7 +175,7 @@ export default {
       this.getList();
     },
     async lookProgress(row) {
-      // this.showType = "20";
+      this.selectRow = { ...row }; //当前选中的物流数据
       this.msgSuccess("数据请求中,请稍后!");
       this.titleText = "查看物流";
       const { data } = await API.queryStatus({ id: row.id });
@@ -257,18 +219,21 @@ export default {
       }
     },
     handleAdd() {
+      this.showType = "add";
       this.titleTextOne = "添加物流数据";
       this.form = {
-        businessCode: "",
         logisticsCompanyCode: "",
         businessType: "",
         logisticsStatus: "",
         code: "",
+        isKd100: "1",
+        remark: "",
       };
       this.openOne = true;
     },
     handleUpdate(row) {
       this.titleTextOne = "编辑物流数据";
+      this.showType = "edit";
       this.form = {
         ...row,
         businessType: row.businessType + "",
@@ -324,7 +289,7 @@ export default {
           }
         );
       } else {
-        API.JDreGoodsAdd(this.form).then(
+        API.addLogistics(this.form).then(
           () => {
             this.msgSuccess("新建成功");
             this.$refs.addLogistics.loading = false;
@@ -354,6 +319,40 @@ export default {
     handleCancel1() {
       this.openArrive = false;
     },
+    handleAddRecord() {
+      this.addRecord = true;
+      this.recordForm.logisticsId = this.selectRow.id;
+    },
+    handleSubmit2() {
+      this.$refs.recordForm.validate((valid) => {
+        if (valid) {
+          API.addRecord(this.recordForm).then(
+            () => {
+              this.msgSuccess("添加成功!");
+              this.handleCancel2();
+              this.lookProgress1();
+            },
+            (err) => {
+              console.log("addRecord: " + err);
+            }
+          );
+        }
+      });
+    },
+    async lookProgress1() {
+      const { data } = await API.queryStatus({ id: this.selectRow.id });
+      if (data.data.data.length > 0) {
+        this.activities = data.data.data;
+      }
+    },
+    handleCancel2() {
+      this.addRecord = false;
+      this.recordForm = {
+        logisticsId: "",
+        addTime: "",
+        remark: "",
+      };
+    },
   },
 };
 </script>
@@ -452,6 +451,11 @@ export default {
       width="40%"
       top="50px"
     >
+      <div style="padding-left: 40px; margin-bottom: 20px">
+        <el-button size="mini" @click="handleAddRecord">
+          添加物流记录
+        </el-button>
+      </div>
       <div>
         <el-timeline :reverse="false">
           <el-timeline-item
@@ -474,6 +478,7 @@ export default {
     >
       <addLogistics
         :form="form"
+        :showType="showType"
         @submit="handleSubmit"
         @cancel="handleCancel"
         ref="addLogistics"
@@ -549,6 +554,50 @@ export default {
         >
       </div>
     </el-dialog>
+
+    <el-dialog
+      title="添加物流记录"
+      :visible.sync="addRecord"
+      v-if="addRecord"
+      width="30%"
+      top="60px"
+    >
+      <el-form
+        label-position="top"
+        :model="recordForm"
+        :rules="recordFormRules"
+        ref="recordForm"
+        label-width="100px"
+      >
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="时间" prop="addTime">
+              <el-date-picker
+                v-model="recordForm.addTime"
+                type="datetime"
+                placeholder="请选择"
+                value-format="yyyy-MM-dd HH:mm:ss"
+              >
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="物流记录" prop="remark">
+          <el-input
+            type="textarea"
+            v-model="recordForm.remark"
+            placeholder="请输入"
+            :rows="3"
+          ></el-input>
+        </el-form-item>
+        <div style="text-align: center; margin-top: 15px">
+          <el-button size="small" @click="handleCancel2">取消 </el-button>
+          <el-button type="primary" size="small" @click="handleSubmit2">
+            确定</el-button
+          >
+        </div>
+      </el-form>
+    </el-dialog>
   </div>
 </template>
 

+ 176 - 72
src/views/order-management/addLogistics.vue

@@ -8,74 +8,160 @@
         :rules="formRules"
         label-width="100px"
       >
-        <el-row :gutter="10">
-          <el-col :span="6">
-            <el-form-item label="单号" prop="businessCode">
-              <el-input v-model="form.businessCode"></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="6">
-            <el-form-item label="数据来源" prop="businessType">
-              <el-select
-                v-model="form.businessType"
-                placeholder="请选择"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in logisticsDataSourceList"
-                  :key="item.dictKey"
-                  :label="item.dictValue"
-                  :value="item.dictKey"
+        <div v-if="showType === 'add'">
+          <el-form-item label="快递100" prop="isKd100">
+            <el-radio-group v-model="form.isKd100">
+              <el-radio label="1">是</el-radio>
+              <el-radio label="0">否</el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-row :gutter="10">
+            <el-col :span="8">
+              <el-form-item label="数据来源" prop="businessType">
+                <el-select
+                  v-model="form.businessType"
+                  placeholder="请选择"
+                  style="width: 100%"
                 >
-                </el-option>
-              </el-select>
+                  <el-option
+                    v-for="item in logisticsDataSourceList"
+                    :key="item.dictKey"
+                    :label="item.dictValue"
+                    :value="item.dictKey"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="10" v-if="form.isKd100 === '1'">
+            <el-form-item label="物流信息" required>
+              <el-col :span="8">
+                <el-form-item label-width="0" 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="8">
+                <el-form-item prop="code">
+                  <el-input
+                    v-model="form.code"
+                    placeholder="物流/快递单号"
+                  ></el-input>
+                </el-form-item>
+              </el-col>
             </el-form-item>
-          </el-col>
-          <el-col :span="6">
-            <el-form-item label="物流状态" prop="logisticsStatus">
-              <el-select
-                v-model="form.logisticsStatus"
-                placeholder="请选择"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in logisticsStatusList"
-                  :key="item.dictKey"
-                  :label="item.dictValue"
-                  :value="item.dictKey"
-                >
-                </el-option>
-              </el-select>
+          </el-row>
+          <el-row :gutter="10" v-else>
+            <el-form-item label="物流信息" required>
+              <el-col :span="8">
+                <el-form-item prop="logisticsCompanyCode">
+                  <el-input
+                    v-model="form.logisticsCompanyCode"
+                    placeholder="物流/快递公司"
+                  ></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="8">
+                <el-form-item prop="code">
+                  <el-input
+                    v-model="form.code"
+                    placeholder="物流/快递单号"
+                  ></el-input>
+                </el-form-item>
+              </el-col>
             </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-row>
+          <el-form-item label="备注" prop="remark">
+            <el-input
+              type="textarea"
+              v-model="form.remark"
+              placeholder="请输入"
+              :rows="3"
+            ></el-input>
+          </el-form-item>
+        </div>
+        <div v-else>
+          <el-row :gutter="10">
+            <el-col :span="6">
+              <el-form-item label="单号" prop="businessCode">
+                <el-input v-model="form.businessCode"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="数据来源" prop="businessType">
+                <el-select
+                  v-model="form.businessType"
+                  placeholder="请选择"
+                  style="width: 100%"
                 >
-                </el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="物流/快递单" prop="code">
-              <el-input
-                v-model="form.code"
-                placeholder="物流/快递单号"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
+                  <el-option
+                    v-for="item in logisticsDataSourceList"
+                    :key="item.dictKey"
+                    :label="item.dictValue"
+                    :value="item.dictKey"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="物流状态" prop="logisticsStatus">
+                <el-select
+                  v-model="form.logisticsStatus"
+                  placeholder="请选择"
+                  style="width: 100%"
+                >
+                  <el-option
+                    v-for="item in logisticsStatusList"
+                    :key="item.dictKey"
+                    :label="item.dictValue"
+                    :value="item.dictKey"
+                  >
+                  </el-option>
+                </el-select>
+              </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="12">
+              <el-form-item label="物流/快递单" prop="code">
+                <el-input
+                  v-model="form.code"
+                  placeholder="物流/快递单号"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </div>
       </el-form>
     </div>
     <div style="text-align: center; margin-top: 15px">
@@ -99,6 +185,10 @@ export default {
       type: Object,
       default: () => {},
     },
+    showType: {
+      type: String,
+      default: "add",
+    },
   },
   data() {
     return {
@@ -107,7 +197,7 @@ export default {
         logisticsCompanyCode: [
           {
             required: true,
-            message: "请选择物流信息",
+            message: "请选择物流/快递公司",
             trigger: "change",
           },
         ],
@@ -118,18 +208,32 @@ export default {
             trigger: "blur",
           },
         ],
+        businessType: [
+          {
+            required: true,
+            message: "请选择数据来源",
+            trigger: "change",
+          },
+        ],
+        isKd100: [
+          {
+            required: true,
+            message: "请选择",
+            trigger: "change",
+          },
+        ],
+        remark: [
+          {
+            required: true,
+            message: "请输入备注",
+            trigger: "blur",
+          },
+        ],
       },
       selectDialog: false,
       logisticsData: [],
       logisticsDataSourceList: [],
       logisticsStatusList: [],
-      // form: {
-      //   businessCode: "",
-      //   logisticsCompanyCode: "",
-      //   businessType: "",
-      //   logisticsStatus: "",
-      //   code: "",
-      // },
     };
   },
   created() {

+ 53 - 2
src/views/order-management/afterSales/addAfterSales.vue

@@ -130,6 +130,21 @@
           >
           </el-input>
         </el-form-item>
+        <div style="margin-top: 20px">
+          <labelTitle content="售后明细"></labelTitle>
+        </div>
+        <el-form-item label-width="0px">
+          <el-button type="primary" size="mini" @click="selectDialog = true">
+            添加明细</el-button
+          >
+        </el-form-item>
+        <el-form-item>
+          <el-table :data="form.productList">
+            <el-table-column label="产品名称" prop="productName" />
+            <el-table-column label="产品编号" prop="applicationTime" />
+            <el-table-column label="备件条码" prop="spareParts" />
+          </el-table>
+        </el-form-item>
       </el-form>
     </div>
     <div style="text-align: center; margin-top: 15px">
@@ -139,6 +154,15 @@
       >
     </div>
     <el-dialog
+      title="产品选择"
+      v-if="selectDialog"
+      :visible.sync="selectDialog"
+      width="80%"
+      top="60px"
+    >
+      <selectProduct @select="handleSelect"></selectProduct>
+    </el-dialog>
+    <el-dialog
       title="订单详情"
       v-if="detailsDialog"
       :visible.sync="detailsDialog"
@@ -151,11 +175,11 @@
 </template>
 
 <script>
-import { getToken } from "@/util/auth";
-
 import labelTitle from "@/components/label-title/index.vue";
 import OrderDetails from "@/components/order/details.vue";
+import selectProduct from "@/components/select-product/index.vue";
 
+import { getToken } from "@/util/auth";
 import { getOrderCode } from "@/api/order-management/afterSales/index.js";
 
 export default {
@@ -163,6 +187,7 @@ export default {
   components: {
     labelTitle,
     OrderDetails,
+    selectProduct,
   },
   props: {
     form: {
@@ -234,6 +259,7 @@ export default {
         ],
       },
       orderList: [],
+      selectDialog: false,
       detailsDialog: false,
       selectOrderId: "",
     };
@@ -248,6 +274,11 @@ export default {
     handleSubmit() {
       this.$refs.form.validate((valid) => {
         if (valid) {
+          if (this.isAdd) {
+            if (!this.form.productList.length > 0) {
+              this.msgInfo("请添加售后明细!");
+            }
+          }
           this.loading = true;
           this.$emit("submit");
         }
@@ -266,6 +297,26 @@ export default {
     handleOrderChange(val) {
       this.selectOrderId = val;
     },
+    handleSelect(row) {
+      const flag = this.form.productList.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: "",
+        id: "",
+      };
+      this.form.productList.push(product);
+      this.msgSuccess("选择成功");
+    },
+    deleteRow(index) {
+      this.form.productList.splice(index, 1);
+      this.msgSuccess("删除成功");
+    },
   },
 };
 </script>

+ 4 - 2
src/views/order-management/afterSales/index.vue

@@ -118,12 +118,13 @@ export default {
     },
     handleAdd() {
       this.titleText = "添加售后记录";
+      this.isAdd = true;
       this.form = {
         id: "",
         type: "",
         remark: "",
+        productList: [],
       };
-      this.isAdd = true;
       this.open = true;
     },
     handleCancel() {
@@ -131,6 +132,7 @@ export default {
     },
     handleFollow(row) {
       this.titleText = "售后跟进";
+      this.isAdd = false;
       this.form = {
         customerInfoId: row.customerInfoId,
         id: row.code,
@@ -140,7 +142,7 @@ export default {
         afterSalesStatus: "",
         remark: "",
       };
-      this.isAdd = false;
+
       this.open = true;
     },
     handleSubmit() {

+ 358 - 0
src/views/purchase-management/deliver-goods/backGoods.vue

@@ -0,0 +1,358 @@
+<template>
+  <div>
+    <div class="form-box" v-loading="loading">
+      <el-form
+        label-position="top"
+        :model="form"
+        ref="form"
+        :rules="formRules"
+        label-width="100px"
+      >
+        <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="supplierName">
+                <span>{{ form.supplierName }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="采购单号" prop="code">
+                <span>
+                  {{ form.code }}
+                </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="code" />
+            <el-table-column
+              label="要求到货时间"
+              prop="planArrivalTime"
+              width="150"
+            />
+            <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" width="80" />
+            <el-table-column label="单价" prop="unitPrice" width="100" />
+            <el-table-column label="采购数量" prop="CGquantity" width="120" />
+            <el-table-column label="退货数量" prop="quantity" width="150">
+              <template slot-scope="scope">
+                <el-form-item
+                  :prop="'goodsList.' + scope.$index + '.quantity'"
+                  :rules="formRules.quantity"
+                  :inline-message="true"
+                  label-width="0"
+                >
+                  <el-input-number
+                    v-model="scope.row.quantity"
+                    label="请输入"
+                    style="width: 100%"
+                    size="mini"
+                    :controls="false"
+                    :min="1"
+                    :max="9999999"
+                  >
+                  </el-input-number>
+                </el-form-item>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+        <div style="margin-top: 20px">
+          <labelTitle content="收货信息"></labelTitle>
+        </div>
+
+        <el-form-item label="收件人" required>
+          <el-row :gutter="10">
+            <el-col :span="4">
+              <el-form-item label-width="0" prop="contacts">
+                <el-input v-model="form.contacts" placeholder="收件人">
+                </el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label-width="0" prop="phone">
+                <el-input v-model="form.phone" placeholder="联系电话">
+                  <template>
+                    <div slot="prepend">+ 86</div>
+                  </template>
+                </el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form-item>
+
+        <el-form-item label="收件地址" required>
+          <el-row :gutter="10">
+            <el-col :span="4">
+              <el-form-item label-width="0" prop="countryId">
+                <el-select
+                  v-model="form.countryId"
+                  placeholder="国家"
+                  style="width: 100%"
+                  @change="countryChange"
+                >
+                  <el-option
+                    v-for="item in countryData"
+                    :key="item.id"
+                    :label="item.chineseName"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="4">
+              <el-form-item label-width="0" prop="provinceId">
+                <el-select
+                  v-model="form.provinceId"
+                  placeholder="省/洲"
+                  style="width: 100%"
+                  @change="provinceChange"
+                  :disabled="!provinceData.length > 0"
+                >
+                  <el-option
+                    v-for="item in provinceData"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="4">
+              <el-form-item label-width="0" prop="cityId">
+                <el-select
+                  v-model="form.cityId"
+                  placeholder="城市"
+                  style="width: 100%"
+                  :disabled="!provinceData.length > 0 && !cityData.length > 0"
+                >
+                  <el-option
+                    v-for="item in cityData"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="10">
+              <el-form-item label-width="0" prop="detailedAddress">
+                <el-input
+                  v-model="form.detailedAddress"
+                  placeholder="详细地址"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </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 { purchaseDetails } from "@/api/purchase-management/purchase/index.js";
+import { supplySelect } from "@/api/product-material/supply/index.js";
+
+import { getRegionData } from "@/api/system/common.js";
+
+export default {
+  props: {
+    rowData: {
+      type: Object,
+    },
+    backForm: {
+      type: Object,
+    },
+  },
+  components: {
+    labelTitle,
+  },
+  data() {
+    return {
+      loading: true,
+      form: {},
+      supplySelectList: [],
+      productTypeList: [],
+      countryData: [],
+      provinceData: [],
+      cityData: [],
+      formRules: {
+        countryId: [
+          {
+            required: true,
+            message: "请选择国家",
+            trigger: "change",
+          },
+        ],
+        provinceId: [
+          {
+            required: true,
+            message: "请选择省/洲",
+            trigger: "change",
+          },
+        ],
+        cityId: [
+          {
+            required: true,
+            message: "请选择城市",
+            trigger: "change",
+          },
+        ],
+
+        contacts: [
+          {
+            required: true,
+            message: "请输入收件人",
+            trigger: "blur",
+          },
+        ],
+        phone: [
+          {
+            required: true,
+            message: "请输入联系电话",
+            trigger: "blur",
+          },
+        ],
+        detailedAddress: [
+          {
+            required: true,
+            message: "请输入详细地址",
+            trigger: "blur",
+          },
+        ],
+        quantity: [
+          {
+            required: true,
+            message: "请输入退货数量",
+            trigger: "blur",
+          },
+        ],
+      },
+      submitData: {},
+    };
+  },
+  created() {
+    getRegionData({ parentId: "", type: "1" }).then((res) => {
+      this.countryData = res.data.data;
+    });
+
+    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: {
+    handleSubmit() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          const quantity = this.form.goodsList[0].quantity;
+          this.submitData = {
+            purchaseId: this.backForm.purchaseId,
+            quantity,
+            contacts: this.form.contacts,
+            phone: this.form.phone,
+            cityId: this.form.cityId,
+            provinceId: this.form.provinceId,
+            countryId: this.form.countryId,
+            detailedAddress: this.form.detailedAddress,
+          };
+          this.loading = true;
+          this.$emit("submit", this.submitData);
+        }
+      });
+    },
+    handleCancel() {
+      this.$emit("cancel");
+    },
+    countryChange(val) {
+      getRegionData({ parentId: val, type: "2" }).then((res) => {
+        this.provinceData = res.data.data;
+      });
+    },
+    provinceChange(val) {
+      getRegionData({ parentId: val, type: "3" }).then((res) => {
+        this.cityData = res.data.data;
+      });
+    },
+    async getDetails() {
+      this.loading = true;
+      const { data } = await supplySelect({ name: "", code: "", type: "" });
+      this.supplySelectList = data.data;
+      purchaseDetails({ id: this.rowData.id }).then((res) => {
+        this.getSupplierName(res.data.data.supplierId, res.data.data);
+      });
+    },
+    getSupplierName(id, data) {
+      const current = this.supplySelectList.find((x) => x.id === id);
+      let goodsList = data.goodsList.map((x) => ({
+        ...x,
+        CGquantity: x.quantity,
+        quantity: undefined,
+      }));
+      if (current) {
+        this.form = {
+          ...data,
+          goodsList,
+          countryId: "China",
+          supplierName: current.name,
+        };
+        this.loading = false;
+      }
+      this.countryChange(this.form.countryId);
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+// ::v-deep {
+//   .el-form-item {
+//     margin-bottom: 5px;
+//   }
+// }
+
+.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>

+ 59 - 1
src/views/purchase-management/deliver-goods/index.vue

@@ -7,12 +7,15 @@ import sendGoods from "./sendGoods.vue";
 import * as API from "@/api/purchase-management/deliver-goods/index.js";
 import PurchaseDetails from "@/components/purchase/details.vue";
 
+import backGoods from "./backGoods.vue";
+
 export default {
   components: {
     query,
     sendGoods,
     test,
     PurchaseDetails,
+    backGoods,
   },
   data() {
     return {
@@ -71,6 +74,17 @@ export default {
       logisticsData: [],
       rowData: {},
       detailsDialog: false,
+      backDialog: false,
+      backForm: {
+        purchaseId: "",
+        quantity: "",
+        contacts: "",
+        phone: "",
+        cityId: "",
+        provinceId: "",
+        countryId: "",
+        detailedAddress: "",
+      },
     };
   },
   created() {
@@ -116,7 +130,18 @@ export default {
       this.selectData = arr;
     },
     handleReturn(row) {
-      console.log(row, "ass");
+      this.rowData = { ...row };
+      this.backForm = {
+        purchaseId: row.id,
+        quantity: "",
+        contacts: "",
+        phone: "",
+        cityId: "",
+        provinceId: "",
+        countryId: "China",
+        detailedAddress: "",
+      };
+      this.backDialog = true;
     },
     handleSend(row) {
       this.form = {
@@ -259,6 +284,23 @@ export default {
       this.rowData = { ...row };
       this.detailsDialog = true;
     },
+    handleSubmitBack(data) {
+      API.purchaseBack(data).then(
+        () => {
+          this.msgSuccess("提交成功");
+          this.$refs.backGoods.loading = false;
+          this.backDialog = false;
+          this.getList();
+        },
+        (err) => {
+          console.log("purchaseBack: " + err);
+          this.$refs.backGoods.loading = false;
+        }
+      );
+    },
+    handleCancelBack() {
+      this.backDialog = false;
+    },
   },
 };
 </script>
@@ -433,6 +475,22 @@ export default {
     >
       <PurchaseDetails :rowData="rowData"></PurchaseDetails>
     </el-dialog>
+
+    <el-dialog
+      title="采购退货"
+      v-if="backDialog"
+      :visible.sync="backDialog"
+      width="80%"
+      top="60px"
+    >
+      <back-goods
+        ref="backGoods"
+        :rowData="rowData"
+        :backForm="backForm"
+        @submit="handleSubmitBack"
+        @cancel="handleCancelBack"
+      ></back-goods>
+    </el-dialog>
   </div>
 </template>