浏览代码

维多利亚组合、分拆功能

cz 2 年之前
父节点
当前提交
870d960be0

+ 196 - 80
src/views/WDLY/salesMange/afterSale/index.vue

@@ -24,7 +24,7 @@
         <template #address="{ item }">
           <div>
             {{ item.countryName }}, {{ item.provinceName }} ,
-            {{ item.cityName }}, {{ item.areaDetail }}
+            {{ item.cityName }}, {{ item.detailedAddress }}
           </div>
         </template>
       </byTable>
@@ -43,7 +43,7 @@
         ref="byform"
       >
         <template #address>
-          <el-row :gutter="10" style="width: 100%">
+          <el-row style="width: 100%">
             <el-col :span="8">
               <el-form-item prop="countryId">
                 <el-select
@@ -91,8 +91,11 @@
           </el-row>
           <el-row style="margin-top: 20px; width: 100%">
             <el-col :span="24">
-              <el-form-item prop="areaDetail">
-                <el-input v-model="formData.data.areaDetail" type="textarea">
+              <el-form-item prop="detailedAddress">
+                <el-input
+                  v-model="formData.data.detailedAddress"
+                  type="textarea"
+                >
                 </el-input>
               </el-form-item>
             </el-col>
@@ -105,27 +108,39 @@
               @click="openProduct = true"
               style="margin-bottom: 10px"
             >
-              添加产品
+              添加
             </el-button>
-            <el-table :data="formData.data.stockWaitDetailsList">
-              <el-table-column prop="name" label="产品名称" />
-              <el-table-column prop="name" label="可拆分数量" />
-              <el-table-column prop="quantity" label="本次拆分" min-width="150">
+            <el-table :data="formData.data.afterSaleDetailList">
+              <el-table-column prop="productCode" label="商品编码" />
+              <el-table-column prop="productName" label="商品名称" />
+              <el-table-column prop="productSpec" label="规格型号" />
+              <el-table-column prop="quantity" label="数量" min-width="150">
                 <template #default="{ row, $index }">
                   <el-form-item
-                    :prop="'stockWaitDetailsList.' + $index + '.quantity'"
+                    :prop="'afterSaleDetailList.' + $index + '.quantity'"
                     :rules="rules.quantity"
                     :inline-message="true"
                   >
                     <el-input-number
                       v-model="row.quantity"
-                      :precision="4"
+                      :precision="2"
                       :controls="false"
                       :min="0"
                     />
                   </el-form-item>
                 </template>
               </el-table-column>
+              <el-table-column prop="remark" label="备注" min-width="150">
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="'afterSaleDetailList.' + $index + '.remark'"
+                    :rules="rules.remark"
+                    :inline-message="true"
+                  >
+                    <el-input v-model="row.remark" placeholder="请输入" />
+                  </el-form-item>
+                </template>
+              </el-table-column>
               <el-table-column prop="zip" label="操作" width="100">
                 <template #default="{ $index }">
                   <el-button type="primary" link @click="handleRemove($index)"
@@ -136,6 +151,7 @@
             </el-table>
           </div>
         </template>
+
         <template #fileSlot>
           <div>
             <el-upload
@@ -145,7 +161,6 @@
               action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
               :data="uploadData"
               :on-preview="handlePreview"
-              :on-remove="handleRemove"
               :on-success="handleSuccess"
               :before-upload="handleBeforeUpload"
             >
@@ -180,9 +195,9 @@
         </el-button>
       </template>
     </el-dialog>
-    <!-- <el-dialog
+    <el-dialog
       v-model="openProduct"
-      title="选择品"
+      title="选择品"
       width="70%"
       append-to-body
     >
@@ -192,17 +207,17 @@
           <el-button @click="openProduct = false">取消</el-button>
         </span>
       </template>
-    </el-dialog> -->
+    </el-dialog>
 
     <el-dialog
       v-model="dialogVisibleOne"
       title="跟进记录"
-      width="70%"
+      width="500"
       append-to-body
     >
       <div style="padding-left: 40px; margin-bottom: 20px">
         <el-button size="mini" @click="openModal('edit')">
-          添加物流记录
+          添加跟进记录
         </el-button>
       </div>
       <div>
@@ -215,9 +230,11 @@
           >
             <div>
               跟进人:{{ activity.handleUserName }}
-              <span>({{ activity.status ? "已完成" : "处理中" }})</span>
+              <span
+                >({{ dictDataEcho(activity.status, afterSalesStatus) }})</span
+              >
             </div>
-            <div style="margin-top: 5px">跟进记录: {{ activity.explain }}</div>
+            <div style="margin-top: 5px">跟进记录: {{ activity.remark }}</div>
           </el-timeline-item>
         </el-timeline>
       </div>
@@ -234,6 +251,7 @@ import FileUpload from "@/components/FileUpload/index";
 import { computed, defineComponent, ref } from "vue";
 import { getToken } from "@/utils/auth";
 import SelectProduct from "@/components/WDLY/product/SelectProduct";
+import useUserStore from "@/store/modules/user";
 
 const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
 const headers = ref({ Authorization: "Bearer " + getToken() });
@@ -268,47 +286,43 @@ const checkContactNumber = (rule, val, callback) => {
   // @input="(val) => val.replace(/[^\d]/g, '')"
 };
 let rules = ref({
-  name: [{ required: true, message: "请输入供应商名称", trigger: "blur" }],
-  type: [{ required: true, message: "请选择供应商类型", trigger: "change" }],
+  customerId: [
+    { required: true, message: "请选择客户名称", trigger: "change" },
+  ],
+  type: [{ required: true, message: "请选择售后类型", trigger: "change" }],
   countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
   provinceId: [{ required: true, message: "请选择省/洲", trigger: "change" }],
   cityId: [{ required: true, message: "请选择城市", trigger: "change" }],
-  areaDetail: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
+  detailedAddress: [
+    { required: true, message: "请输入详细地址", trigger: "blur" },
+  ],
   contactPerson: [{ required: true, message: "请输入联系人", trigger: "blur" }],
-  // contactNumber: [{ validator: checkContactNumber, trigger: "blur" }],
   contactNumber: [
     { required: true, message: "请输入联系电话", trigger: "blur" },
   ],
+  cause: [{ required: true, message: "请输入售后原因", trigger: "blur" }],
+  quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
+  remark: [{ required: true, message: "请输入备注", trigger: "blur" }],
+
+  status: [{ required: true, message: "请选择售后状态", trigger: "change" }],
+  handleTime: [
+    { required: true, message: "请选择跟进时间", trigger: "change" },
+  ],
+  handleUserId: [
+    { required: true, message: "请选择跟进人", trigger: "change" },
+  ],
 });
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
   {
     label: "售后类型",
     prop: "type",
-    data: [
-      {
-        label: "贸易商",
-        value: "1",
-      },
-      {
-        label: "工厂",
-        value: "2",
-      },
-    ],
+    data: [],
   },
   {
     label: "售后状态",
-    prop: "accountPeriodType",
-    data: [
-      {
-        label: "有",
-        value: "1",
-      },
-      {
-        label: "无",
-        value: "0",
-      },
-    ],
+    prop: "status",
+    data: [],
   },
 ]);
 const config = computed(() => {
@@ -319,39 +333,41 @@ const config = computed(() => {
         prop: "type",
       },
       render(type) {
-        return type === 1 ? "贸易商" : "工厂";
+        return proxy.dictDataEcho(type, afterSalesType.value);
       },
     },
     {
       attrs: {
         label: "客户名称",
-        prop: "name",
+        prop: "customerName",
       },
     },
     {
       attrs: {
         label: "售后时间",
-        prop: "name",
+        prop: "createTime",
       },
     },
     {
       attrs: {
         label: "所在城市",
-        prop: "remarks",
         slot: "address",
       },
     },
     {
       attrs: {
         label: "售后原因",
-        prop: "name",
+        prop: "cause",
       },
     },
 
     {
       attrs: {
         label: "售后状态",
-        prop: "returnPeriod",
+        prop: "status",
+      },
+      render(type) {
+        return proxy.dictDataEcho(type, afterSalesStatus.value);
       },
     },
 
@@ -397,17 +413,29 @@ const configData = [
   [
     {
       type: "select",
-      prop: "name",
+      prop: "type",
       label: "售后类型",
       required: true,
       itemWidth: 51,
+      data: [],
     },
     {
       type: "select",
-      prop: "name",
+      prop: "customerId",
       label: "客户名称",
       required: true,
       itemWidth: 51,
+      isLoad: {
+        url: "/customer/page",
+        req: {
+          pageNum: 1,
+          pageSize: 9999,
+        },
+        labelKey: "name",
+        labelVal: "id",
+        method: "post",
+        resUrl: "rows",
+      },
     },
     {
       type: "slot",
@@ -419,7 +447,7 @@ const configData = [
     {
       type: "input",
       label: "售后原因",
-      prop: "remark",
+      prop: "cause",
       itemType: "textarea",
     },
     {
@@ -431,32 +459,50 @@ const configData = [
   [
     {
       type: "select",
-      prop: "name",
+      prop: "status",
       label: "售后状态",
       required: true,
       itemWidth: 51,
     },
     {
       type: "select",
-      prop: "name",
+      prop: "handleUserId",
       label: "跟进人",
       required: true,
       itemWidth: 50,
+      isLoad: {
+        url: `/tenantUser/list?pageNum=1&pageSize=9999&tenantId=${
+          useUserStore().user.tenantId
+        }`,
+        labelKey: "nickName",
+        labelVal: "userId",
+        method: "get",
+        resUrl: "rows",
+      },
     },
     {
       type: "date",
-      prop: "name",
-      itemType: "date",
+      prop: "handleTime",
+      itemType: "datetime",
       label: "跟进时间",
       required: true,
       itemWidth: 50,
     },
     {
       type: "select",
-      prop: "name",
+      prop: "nextUserId",
       label: "下一跟进人",
       required: true,
       itemWidth: 51,
+      isLoad: {
+        url: `/tenantUser/list?pageNum=1&pageSize=9999&tenantId=${
+          useUserStore().user.tenantId
+        }`,
+        labelKey: "nickName",
+        labelVal: "userId",
+        method: "get",
+        resUrl: "rows",
+      },
     },
     {
       type: "input",
@@ -476,13 +522,10 @@ const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
   proxy
-    .post("/supplierInfo/pageByWdly", sourceList.value.pagination)
+    .post("/afterSaleRecord/page", sourceList.value.pagination)
     .then((message) => {
       console.log(message);
-      sourceList.value.data = message.rows.map((x) => ({
-        ...x,
-        ...JSON.parse(x.victoriatouristJson),
-      }));
+      sourceList.value.data = message.rows;
       sourceList.value.pagination.total = message.total;
       setTimeout(() => {
         loading.value = false;
@@ -494,37 +537,80 @@ const openModal = (type, row = {}) => {
   if (type == "add") {
     formConfig = configData[0];
     formData.data = {
-      type: "1",
       countryId: "China",
+      afterSaleDetailList: [],
     };
     getCityData(formData.data.countryId, "20");
   } else if (type == "edit") {
     formConfig = configData[1];
+    formData.data = {
+      afterSaleRecordId: "",
+    };
+    fileList.value = [];
+    fileListCopy.value = [];
   }
   dialogVisible.value = true;
 };
-
+const rowData = ref({});
 const openModalOne = (row) => {
-  dialogVisibleOne.value = true;
+  rowData.value = { ...row };
+  getRecordList();
 };
 
+const getRecordList = () => {
+  proxy
+    .post("/afterSaleHandle/page", { afterSaleRecordId: rowData.value.id })
+    .then((res) => {
+      activities.value = res.rows;
+      dialogVisibleOne.value = true;
+    });
+};
 const submitForm = () => {
   byform.value.handleSubmit((valid) => {
-    formData.data.fileList =
-      fileListCopy.value.map((x) => ({
-        id: x.id,
-        fileName: x.fileName,
-      })) || [];
+    if (modalType.value == "add") {
+      const list = formData.data.afterSaleDetailList;
+      if (!list.length > 0)
+        return ElMessage({
+          message: `请关联商品!`,
+          type: "info",
+        });
+      for (let i = 0; i < list.length; i++) {
+        const e = list[i];
+        if (e.quantity == 0) {
+          return ElMessage({
+            message: `数量不能为0!`,
+            type: "info",
+          });
+        }
+      }
+    } else {
+      formData.data.fileList =
+        fileListCopy.value.map((x) => ({
+          id: x.id,
+          fileName: x.fileName,
+        })) || [];
+      formData.data.afterSaleRecordId = rowData.value.id;
+    }
+    const requestUrl =
+      modalType.value == "add"
+        ? "/afterSaleRecord/add"
+        : "/afterSaleHandle/add";
     submitLoading.value = true;
-    proxy.post("/supplierInfo/" + modalType.value, formData.data).then(
+    proxy.post(requestUrl, formData.data).then(
       (res) => {
         ElMessage({
-          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          message: "添加成功",
           type: "success",
         });
         fileList.value = [];
+        fileListCopy.value = [];
         dialogVisible.value = false;
         submitLoading.value = false;
+        if (modalType.value == "add") {
+          getList();
+        } else {
+          getRecordList();
+        }
         getList();
       },
       (err) => {
@@ -610,16 +696,21 @@ const getCityData = (id, type, isChange) => {
   });
 };
 const handleSelect = (row) => {
-  const flag = formData.data.stockWaitDetailsList.some((x) => x.id === row.id);
+  const flag = formData.data.afterSaleDetailList.some(
+    (x) => x.productId === row.id
+  );
   if (flag)
     return ElMessage({
-      message: "该品已选择",
+      message: "该品已选择",
       type: "info",
     });
-  formData.data.stockWaitDetailsList.push({
-    name: row.name,
-    code: row.code,
-    id: row.id,
+  formData.data.afterSaleDetailList.push({
+    productName: row.name,
+    productCode: row.code,
+    productSpec: row.spec,
+    productId: row.id,
+    quantity: null,
+    remark: "",
   });
   return ElMessage({
     message: "选择成功",
@@ -628,15 +719,40 @@ const handleSelect = (row) => {
 };
 
 const handleRemove = (index) => {
-  formData.data.stockWaitDetailsList.splice(index, 1);
+  formData.data.afterSaleDetailList.splice(index, 1);
   return ElMessage({
     message: "删除成功",
     type: "success",
   });
 };
+const afterSalesType = ref([]);
+const afterSalesStatus = ref([]);
 
+const getDict = () => {
+  proxy.getDict(["after_sale_type", "after_sale_status"]).then((res) => {
+    afterSalesType.value = res["after_sale_type"];
+    configData[0][0].data = afterSalesType.value.map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    selectConfig[0].data = afterSalesType.value.map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    afterSalesStatus.value = res["after_sale_status"];
+    configData[1][0].data = afterSalesStatus.value.map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    selectConfig[1].data = afterSalesStatus.value.map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
 getCityData("0");
 getList();
+getDict();
 </script>
   
 <style lang="scss" scoped>

+ 662 - 0
src/views/WDLY/salesMange/jdReGoods/index.vue

@@ -0,0 +1,662 @@
+<template>
+  <div class="tenant">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+        }"
+        :action-list="[
+          {
+            text: 'Excel导入',
+            action: () => openExcel(),
+            disabled: false,
+          },
+          {
+            text: '添加退货',
+            action: () => openModal(),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #fileSlot="{ item }">
+          <div
+            style="cursor: pointer; color: #409eff"
+            @click="handleClickFile(item)"
+          >
+            {{ item.fileName }}
+          </div>
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType === 'add' ? '添加退货' : '到货通知'"
+      v-model="dialogVisible"
+      width="800"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+        <template #detailSlot>
+          <div style="width: 100%">
+            <el-button
+              type="primary"
+              @click="openProduct = true"
+              style="margin-bottom: 10px"
+              v-if="modalType != 'detail'"
+            >
+              添加物品
+            </el-button>
+            <el-table :data="formData.data.jdBackDetailsList">
+              <el-table-column prop="productCode" label="货品编码" />
+              <el-table-column prop="productName" label="货品名称" />
+              <el-table-column prop="quantity" label="退货数量" min-width="150">
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="'jdBackDetailsList.' + $index + '.quantity'"
+                    :rules="rules.quantity"
+                    :inline-message="true"
+                  >
+                    <el-input-number
+                      v-model="row.quantity"
+                      :precision="4"
+                      :controls="false"
+                      :min="0"
+                    />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="zip"
+                label="操作"
+                width="100"
+                v-if="modalType != 'detail'"
+              >
+                <template #default="{ $index }">
+                  <el-button type="primary" link @click="handleRemove($index)"
+                    >删除</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </template>
+      </byForm>
+
+      <template #footer v-if="modalType != 'detail'">
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm()"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+    <el-dialog
+      v-model="openProduct"
+      title="选择产品"
+      width="70%"
+      append-to-body
+    >
+      <SelectProduct @handleSelect="handleSelect"></SelectProduct>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="openProduct = false">取消</el-button>
+        </span>
+      </template>
+    </el-dialog>
+    <el-dialog
+      title="Excel导入"
+      v-model="openExcelDialog"
+      width="400"
+      v-loading="excelLoading"
+    >
+      <div style="margin-bottom: 10px">导入前请先选择仓库</div>
+      <el-select v-model="importData.warehouseId" placeholder="请选择仓库">
+        <el-option
+          v-for="item in warehouseList"
+          :key="item.id"
+          :label="item.name"
+          :value="item.id"
+        />
+      </el-select>
+      <div style="margin-top: 20px" v-show="importData.warehouseId">
+        <el-upload
+          action="/dev-api/jdBack/excelImport"
+          :data="importData"
+          :headers="headers"
+          :on-success="handleSuccess"
+          :on-progress="handleProgress"
+          :show-file-list="false"
+          :on-error="handleError"
+          accept=".xlsx"
+        >
+          <el-button type="primary">点击导入</el-button>
+        </el-upload>
+      </div>
+
+      <template #footer>
+        <el-button @click="openExcelDialog = false" size="large"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          @click="submitExcel()"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import { watch } from "vue";
+import SelectProduct from "@/components/WDLY/product/SelectProduct";
+import { getToken } from "@/utils/auth";
+
+const uploadData = ref({});
+const headers = ref({ Authorization: "Bearer " + getToken() });
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let openProduct = ref(false);
+let openExcelDialog = ref(false);
+let excelLoading = ref(false);
+
+let modalType = ref("add");
+let rules = ref({
+  warehouseId: [{ required: true, message: "请选择仓库", trigger: "change" }],
+  logisticsCompanyCode: [
+    { required: true, message: "请选择物流公司", trigger: "change" },
+  ],
+  logisticsCode: [
+    { required: true, message: "请输入物流/快递单号", trigger: "blur" },
+  ],
+  quantity: [{ required: true, message: "请输入退货数量", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  {
+    label: "数据来源",
+    prop: "type",
+    data: [
+      {
+        label: "手动创建",
+        value: "1",
+      },
+      {
+        label: "批量导入",
+        value: "2",
+      },
+    ],
+  },
+  {
+    label: "退货状态",
+    prop: "status",
+    data: [
+      {
+        label: "新建",
+        value: "1",
+      },
+      {
+        label: "运输中",
+        value: "2",
+      },
+      {
+        label: "待质检",
+        value: "3",
+      },
+    ],
+  },
+]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "数据来源",
+        prop: "type",
+      },
+      render(type) {
+        return type == 1 ? "手动创建" : "批量导入";
+      },
+    },
+    {
+      attrs: {
+        label: "仓库名称",
+        prop: "warehouseName",
+      },
+    },
+    {
+      attrs: {
+        label: "物流/快递公司",
+        prop: "logisticsCompanyName",
+      },
+    },
+    {
+      attrs: {
+        label: "物流/快递单号",
+        prop: "logisticsCode",
+      },
+    },
+    {
+      attrs: {
+        label: "创建时间",
+        prop: "createTime",
+      },
+    },
+
+    {
+      attrs: {
+        label: "退货状态",
+        prop: "status",
+      },
+      render(status) {
+        return status == 1 ? "新建" : status == 2 ? "运输中 " : "待质检";
+      },
+    },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "240",
+        align: "right",
+      },
+      renderHTML(row) {
+        return [
+          row.status < 2
+            ? {
+                attrs: {
+                  label: "修改",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  getDtl(row, "edit");
+                },
+              }
+            : {},
+          row.status < 2
+            ? {
+                attrs: {
+                  label: "删除",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  // 弹窗提示是否删除
+                  ElMessageBox.confirm(
+                    "此操作将永久删除该数据, 是否继续?",
+                    "提示",
+                    {
+                      confirmButtonText: "确定",
+                      cancelButtonText: "取消",
+                      type: "warning",
+                    }
+                  ).then(() => {
+                    // 删除
+                    proxy
+                      .post("/jdBack/delete", {
+                        id: row.id,
+                      })
+                      .then((res) => {
+                        ElMessage({
+                          message: "删除成功",
+                          type: "success",
+                        });
+                        getList();
+                      });
+                  });
+                },
+              }
+            : {},
+          {
+            attrs: {
+              label: "查看",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row, "detail");
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {},
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+});
+const byform = ref(null);
+let formConfig = reactive([
+  {
+    type: "title",
+    title: "退货信息",
+  },
+  {
+    type: "select",
+    prop: "warehouseId",
+    label: "仓库名称",
+    itemWidth: 100,
+    disabled: false,
+    data: [],
+  },
+  {
+    type: "select",
+    label: "物流信息",
+    prop: "logisticsCompanyCode",
+    itemWidth: 50,
+    style: {
+      width: "100%",
+    },
+  },
+  {
+    type: "input",
+    label: " ",
+    prop: "logisticsCode",
+    itemWidth: 50,
+  },
+  {
+    type: "slot",
+    slotName: "detailSlot",
+    label: "发货明细",
+  },
+]);
+const configData = [
+  [
+    {
+      type: "input",
+      prop: "supplyName",
+      label: "供应商",
+      disabled: true,
+      itemWidth: 50,
+    },
+    {
+      type: "input",
+      prop: "purchaseCode",
+      label: "采购单号",
+      disabled: true,
+      itemWidth: 50,
+    },
+    {
+      type: "select",
+      label: "物流信息",
+      prop: "logisticsCompanyCode",
+      itemWidth: 50,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "input",
+      label: " ",
+      prop: "code",
+      itemWidth: 50,
+    },
+    {
+      type: "slot",
+      slotName: "detailSlot",
+      label: "发货明细",
+    },
+  ],
+  [
+    {
+      type: "input",
+      prop: "supplyName",
+      label: "供应商",
+      disabled: true,
+      itemWidth: 50,
+    },
+    {
+      type: "input",
+      prop: "purchaseCode",
+      label: "采购单号",
+      disabled: true,
+      itemWidth: 50,
+    },
+    {
+      type: "select",
+      label: "物流/快递单号",
+      prop: "deliverGoodsId",
+      itemWidth: 50,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "slot",
+      slotName: "detailSlot",
+      label: "发货明细",
+    },
+  ],
+];
+
+const deliverData = ref([]);
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/jdBack/page", sourceList.value.pagination).then((message) => {
+    console.log(message);
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+
+const submitForm = () => {
+  byform.value.handleSubmit((valid) => {
+    const list = formData.data.jdBackDetailsList;
+    if (!list.length > 0) {
+      return ElMessage({
+        message: `请添加退货明细`,
+        type: "info",
+      });
+    }
+    for (let i = 0; i < list.length; i++) {
+      const e = list[i];
+      if (e.quantity == 0) {
+        return ElMessage({
+          message: `退货数量不能为0!`,
+          type: "info",
+        });
+      }
+    }
+    loading.value = true;
+    submitLoading.value = true;
+    proxy.post("/jdBack/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: `操作成功!`,
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        loading.value = false;
+        getList();
+      },
+      (err) => (submitLoading.value = false)
+    );
+  });
+};
+
+const getDtl = (row, type) => {
+  modalType.value = type;
+  proxy.post("/jdBack/detail", { id: row.id }).then((res) => {
+    formData.data = res;
+    dialogVisible.value = true;
+  });
+};
+
+const importData = reactive({});
+
+const handleEdit = (row, status) => {
+  let purchaseStatusName = status == 88 ? "作废" : "终止";
+  const data = { ...row, purchaseStatus: status };
+  // 弹窗提示是否删除
+  ElMessageBox.confirm(
+    `此操作将${purchaseStatusName}该数据, 是否继续?`,
+    "提示",
+    {
+      confirmButtonText: "确定",
+      cancelButtonText: "取消",
+      type: "warning",
+    }
+  ).then(() => {
+    // 删除
+    proxy.post("/purchase/edit", data).then((res) => {
+      ElMessage({
+        message: `${purchaseStatusName}成功`,
+        type: "success",
+      });
+      getList();
+    });
+  });
+};
+
+const logisticsData = ref([]);
+const getLogisticsData = (row) => {
+  proxy.post("/companyInfo/list", { pageNum: 1, pageSize: 999 }).then((res) => {
+    logisticsData.value = res.reverse().slice(0, 100); //截取前100
+    formConfig[2].data = logisticsData.value.map((x) => ({
+      label: x.name,
+      value: x.code,
+    }));
+  });
+};
+
+watch(modalType, (val) => {
+  if (val) {
+    formConfig[1].disabled = val == "detail" ? true : false;
+    formConfig[2].disabled = val == "detail" ? true : false;
+    formConfig[3].disabled = val == "detail" ? true : false;
+  }
+});
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {
+    type: "1",
+    status: "1",
+    jdBackDetailsList: [],
+  };
+};
+
+const warehouseList = ref([]);
+const warehouseListData = () => {
+  // // 币种数据
+  proxy
+    .post("/warehouse/page", {
+      pageNum: 1,
+      pageSize: 10,
+    })
+    .then((message) => {
+      warehouseList.value = message.rows;
+      formConfig[1].data = message.rows.map((x) => ({
+        label: x.name,
+        value: x.id,
+      }));
+    });
+};
+
+getList();
+getLogisticsData();
+warehouseListData();
+
+const handleSelect = (row) => {
+  const flag = formData.data.jdBackDetailsList.some(
+    (x) => x.productId === row.id
+  );
+  if (flag)
+    return ElMessage({
+      message: "该物品已选择",
+      type: "info",
+    });
+  formData.data.jdBackDetailsList.push({
+    quantity: null,
+    productName: row.name,
+    productCode: row.code,
+    productId: row.id,
+  });
+  return ElMessage({
+    message: "选择成功",
+    type: "success",
+  });
+};
+
+const handleRemove = (index) => {
+  formData.data.jdBackDetailsList.splice(index, 1);
+  return ElMessage({
+    message: "删除成功",
+    type: "success",
+  });
+};
+const openExcel = () => {
+  openExcelDialog.value = true;
+};
+
+const handleProgress = () => {
+  excelLoading.value = true;
+};
+const handleError = (err) => {
+  ElMessage({
+    message: `${err},请重试!`,
+    type: "info",
+  });
+  openExcelDialog.value = false;
+  excelLoading.value = false;
+};
+const handleSuccess = () => {
+  ElMessage({
+    message: "导入成功!",
+    type: "success",
+  });
+  openExcelDialog.value = false;
+  excelLoading.value = false;
+  getList();
+};
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 713 - 0
src/views/WDLY/salesMange/jdReGoodsInspection/index.vue

@@ -0,0 +1,713 @@
+<template>
+  <div class="tenant">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+        }"
+        :action-list="[
+          {
+            text: '添加订单',
+            action: () => openModal('add'),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #code="{ item }">
+          <div
+            style="cursor: pointer; color: #409eff"
+            @click="handleClickCode(item)"
+          >
+            {{ item.code }}
+          </div>
+        </template>
+        <template #address="{ item }">
+          <div>
+            {{ item.countryName }}, {{ item.provinceName }} ,
+            {{ item.cityName }}, {{ item.detailedAddress }}
+          </div>
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '添加订单' : '调仓接收'"
+      v-model="dialogVisible"
+      width="800"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+        <template #address>
+          <el-row style="width: 100%">
+            <el-col :span="8">
+              <el-form-item prop="countryId">
+                <el-select
+                  v-model="formData.data.countryId"
+                  placeholder="国家"
+                  @change="(val) => getCityData(val, '20', true)"
+                >
+                  <el-option
+                    v-for="item in countryData"
+                    :label="item.chineseName"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item prop="provinceId">
+                <el-select
+                  v-model="formData.data.provinceId"
+                  placeholder="省/洲"
+                  @change="(val) => getCityData(val, '30', true)"
+                >
+                  <el-option
+                    v-for="item in provinceData"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item prop="cityId">
+                <el-select v-model="formData.data.cityId" placeholder="城市">
+                  <el-option
+                    v-for="item in cityData"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row style="margin-top: 20px; width: 100%">
+            <el-col :span="24">
+              <el-form-item prop="detailedAddress">
+                <el-input
+                  v-model="formData.data.detailedAddress"
+                  type="textarea"
+                >
+                </el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </template>
+        <template #products>
+          <div style="width: 100%">
+            <el-button
+              type="primary"
+              @click="openProduct = true"
+              style="margin-bottom: 10px"
+            >
+              添加物品
+            </el-button>
+            <el-table :data="formData.data.orderDetailsList">
+              <el-table-column prop="productCode" label="产品编码" />
+              <el-table-column prop="productName" label="产品名称" />
+              <el-table-column prop="price" label="单价" min-width="150">
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="'orderDetailsList.' + $index + '.price'"
+                    :rules="rules.price"
+                    :inline-message="true"
+                  >
+                    <el-input-number
+                      v-model="row.price"
+                      :precision="4"
+                      :controls="false"
+                      :min="0"
+                      @change="totalAmount"
+                    />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column prop="quantity" label="数量" min-width="150">
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="'orderDetailsList.' + $index + '.quantity'"
+                    :rules="rules.quantity"
+                    :inline-message="true"
+                  >
+                    <el-input-number
+                      v-model="row.quantity"
+                      :precision="4"
+                      :controls="false"
+                      :min="0"
+                      @change="totalAmount"
+                    />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column prop="total" label="小计" />
+              <el-table-column prop="remark" label="备注" min-width="200">
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="'orderDetailsList.' + $index + '.remark'"
+                    :rules="rules.remark"
+                    :inline-message="true"
+                  >
+                    <el-input v-model="row.remark" placeholder="请输入" />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="zip"
+                label="操作"
+                width="60"
+                fixed="right"
+                align="center"
+              >
+                <template #default="{ $index }">
+                  <el-button type="primary" link @click="handleRemove($index)"
+                    >删除</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+    <el-dialog
+      v-model="openProduct"
+      title="选择产品"
+      width="70%"
+      append-to-body
+    >
+      <SelectProduct @handleSelect="handleSelect"></SelectProduct>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="openProduct = false">取消</el-button>
+        </span>
+      </template>
+    </el-dialog>
+
+    <el-dialog
+      v-model="openDetails"
+      title="订单详情"
+      width="40%"
+      append-to-body
+    >
+      <OrderDetails
+        :orderData="formData.orderData"
+        :key="formData.orderData.id"
+      ></OrderDetails>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="openDetails = false">取消</el-button>
+        </span>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+/* eslint-disable vue/no-unused-components */
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import { computed, defineComponent, ref } from "vue";
+import useUserStore from "@/store/modules/user";
+import SelectProduct from "@/components/WDLY/product/SelectProduct";
+import OrderDetails from "@/components/WDLY/order/details";
+
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let openProduct = ref(false);
+let openDetails = ref(false);
+
+let roomDialogVisible = ref(false);
+let modalType = ref("add");
+let rules = ref({
+  customerInfoId: [
+    {
+      required: true,
+      message: "请选择客户",
+      trigger: "change",
+    },
+  ],
+  type: [
+    {
+      required: true,
+      message: "请选择订单类型",
+      trigger: "change",
+    },
+  ],
+  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",
+    },
+  ],
+  price: [
+    {
+      required: true,
+      message: "请输入单价",
+      trigger: "blur",
+    },
+  ],
+  quantity: [
+    {
+      required: true,
+      message: "请输入数量",
+      trigger: "blur",
+    },
+  ],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  {
+    label: "订单类型",
+    prop: "type",
+    data: [],
+  },
+  {
+    label: "订单状态",
+    prop: "status",
+    data: [
+      {
+        label: "进行中",
+        value: "1",
+      },
+      {
+        label: "已完成",
+        value: "2",
+      },
+      {
+        label: "已取消",
+        value: "3",
+      },
+    ],
+  },
+]);
+
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "订单类型",
+        prop: "type",
+      },
+      render(type) {
+        return proxy.dictDataEcho(type, salesType.value);
+      },
+    },
+    {
+      attrs: {
+        label: "订单编号",
+        prop: "code",
+        slot: "code",
+      },
+    },
+    {
+      attrs: {
+        label: "客户名称",
+        prop: "customerName",
+      },
+    },
+    {
+      attrs: {
+        label: "订单金额",
+        prop: "amountMoney",
+      },
+      render(money) {
+        return proxy.moneyFormat(money, 4);
+      },
+    },
+    {
+      attrs: {
+        label: "收件人",
+        prop: "contacts",
+      },
+    },
+    {
+      attrs: {
+        label: "联系电话",
+        prop: "phone",
+      },
+    },
+    {
+      attrs: {
+        label: "收件城市",
+        prop: "address",
+        slot: "address",
+      },
+    },
+    {
+      attrs: {
+        label: "下单时间",
+        prop: "createTime",
+      },
+    },
+    {
+      attrs: {
+        label: "订单状态",
+        prop: "status",
+      },
+      render(status) {
+        return status == 1 ? "进行中" : status == 2 ? "已完成" : "已取消";
+      },
+    },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          row.status == 1
+            ? {
+                attrs: {
+                  label: "结束",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  getDtl(row, 2);
+                },
+              }
+            : {},
+          row.status == 1
+            ? {
+                attrs: {
+                  label: "取消",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  getDtl(row, 3);
+                },
+              }
+            : {},
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {},
+  treeData: [],
+  orderData: {},
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const treeData = ref([]);
+const formConfig = reactive([
+  {
+    type: "select",
+    prop: "customerInfoId",
+    label: "客户名称",
+    isLoad: {
+      url: "/customer/page",
+      req: {
+        pageNum: 1,
+        pageSize: 9999,
+      },
+      labelKey: "name",
+      labelVal: "id",
+      method: "post",
+      resUrl: "rows",
+    },
+  },
+  {
+    type: "select",
+    prop: "type",
+    label: "订单类型",
+    itemWidth: 100,
+    data: [],
+  },
+  {
+    type: "input",
+    prop: "contacts",
+    label: "收件人",
+    itemWidth: 20,
+  },
+  {
+    type: "input",
+    prop: "phone",
+    label: " ",
+    itemWidth: 30,
+  },
+  {
+    type: "slot",
+    slotName: "address",
+    prop: "countryId",
+    label: "收件地址",
+    required: true,
+  },
+  {
+    type: "title",
+    title: "订单明细",
+  },
+  {
+    type: "slot",
+    slotName: "products",
+  },
+  {
+    type: "input",
+    prop: "amountMoney",
+    label: "订单金额",
+    disabled: true,
+    itemWidth: 20,
+  },
+]);
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/orderInfo/page", sourceList.value.pagination).then((message) => {
+    console.log(message);
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {
+    orderDetailsList: [],
+    countryId: "China",
+  };
+  getCityData(formData.data.countryId, "20");
+};
+
+const submitForm = () => {
+  console.log(byform.value);
+  byform.value.handleSubmit((valid) => {
+    const list = formData.data.orderDetailsList;
+    if (!list.length > 0)
+      return ElMessage({
+        message: `请添加订单明细!`,
+        type: "info",
+      });
+    for (let i = 0; i < list.length; i++) {
+      const e = list[i];
+      if (e.quantity == 0) {
+        return ElMessage({
+          message: `数量不能为0!`,
+          type: "info",
+        });
+      }
+    }
+    submitLoading.value = true;
+    proxy.post("/orderInfo/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => (submitLoading.value = false)
+    );
+  });
+};
+
+const getDtl = (row, status) => {
+  const statusNmae = status == 2 ? "结束" : "取消";
+  // 弹窗提示是否删除
+  ElMessageBox.confirm(`您确定执行${statusNmae}操作吗?`, "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  }).then(() => {
+    // 删除
+    proxy
+      .post("/orderInfo/edit", {
+        id: row.id,
+        status,
+      })
+      .then((res) => {
+        ElMessage({
+          message: "操作成功",
+          type: "success",
+        });
+        getList();
+      });
+  });
+};
+
+const warehouseList = ref([]);
+const salesType = ref([]);
+
+const getDict = () => {
+  proxy.getDict(["order_sales_type"]).then((res) => {
+    salesType.value = res["order_sales_type"];
+    formConfig[1].data = salesType.value.map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    selectConfig[0].data = salesType.value.map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+const countryData = ref([]);
+const provinceData = ref([]);
+const cityData = ref([]);
+
+const getCityData = (id, type, isChange) => {
+  proxy.post("/areaInfo/list", { parentId: id }).then((res) => {
+    if (type === "20") {
+      provinceData.value = res;
+      if (isChange) {
+        formData.data.provinceId = "";
+        formData.data.cityId = "";
+      }
+    } else if (type === "30") {
+      cityData.value = res;
+      if (isChange) {
+        formData.data.cityId = "";
+      }
+    } else {
+      countryData.value = res;
+    }
+  });
+};
+getCityData("0");
+getList();
+getDict();
+
+const totalAmount = () => {
+  let sum = 0;
+  for (let i = 0; i < formData.data.orderDetailsList.length; i++) {
+    const e = formData.data.orderDetailsList[i];
+    e.total = (e.price * 1000000 * e.quantity) / 1000000;
+    sum += e.total;
+  }
+  formData.data.amountMoney = sum;
+};
+
+const handleSelect = (row) => {
+  const flag = formData.data.orderDetailsList.some(
+    (x) => x.productId === row.id
+  );
+  if (flag)
+    return ElMessage({
+      message: "该物品已选择",
+      type: "info",
+    });
+  formData.data.orderDetailsList.push({
+    productName: row.name,
+    productCode: row.code,
+    productId: row.id,
+    total: "",
+    quantity: null,
+    price: null,
+  });
+  return ElMessage({
+    message: "选择成功",
+    type: "success",
+  });
+};
+
+const handleRemove = (index) => {
+  formData.data.orderDetailsList.splice(index, 1);
+  totalAmount();
+  return ElMessage({
+    message: "删除成功",
+    type: "success",
+  });
+};
+
+const handleClickCode = (row) => {
+  formData.orderData = row;
+  openDetails.value = true;
+};
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 30 - 2
src/views/WDLY/stockManage/productSplit/index.vue

@@ -306,9 +306,9 @@ const submitForm = () => {
           type: "info",
         });
       }
-      if (e.groupNum > e.canSum) {
+      if (e.groupNum > Number(e.canSum)) {
         return ElMessage({
-          message: "组合数量不可大于可组合数量!",
+          message: "拆分数量不可大于库存数量!",
           type: "info",
         });
       }
@@ -404,6 +404,34 @@ const handleRemove = (index) => {
     type: "success",
   });
 };
+
+watchEffect(() => {
+  const list = formData.data.groupRecordDetailsList;
+  if (
+    formData.data.groupWarehouseId &&
+    list.length > 0 &&
+    modalType.value == "add"
+  ) {
+    proxy
+      .post("/stock/pageByWarehouse", {
+        id: formData.data.groupWarehouseId,
+        productIds: list.map((x) => x.productId),
+      })
+      .then((res) => {
+        const productList = res.rows;
+        for (let i = 0; i < list.length; i++) {
+          const e = list[i];
+          e.canSum = 0;
+          for (let j = 0; j < productList.length; j++) {
+            const x = productList[j];
+            if (e.productId == x.productId) {
+              e.canSum = x.quantity;
+            }
+          }
+        }
+      });
+  }
+});
 </script>
   
 <style lang="scss" scoped>

+ 154 - 53
src/views/purchaseSales/stockManage/inventory/index.vue

@@ -21,8 +21,13 @@
         ]"
         @get-list="getList"
       >
-        <template #slotName="{ item }">
-          {{ item.createTime }}
+        <template #code="{ item }">
+          <div
+            style="cursor: pointer; color: #409eff"
+            @click="handleClickCode(item)"
+          >
+            {{ item.code }}aa
+          </div>
         </template>
       </byTable>
     </div>
@@ -45,15 +50,16 @@
               type="primary"
               @click="openProduct = true"
               style="margin-bottom: 10px"
+              v-if="modalType == 'add'"
             >
               添加物品
             </el-button>
-            <el-table :data="formData.data.list">
-              <el-table-column prop="name" label="物品编码" />
+            <el-table :data="formData.data.list" :row-class-name="changeClass">
+              <el-table-column prop="productCode" label="物品编码" />
               <el-table-column prop="productName" label="物品名称" />
-              <el-table-column prop="name" label="规格型号" />
-              <el-table-column prop="name" label="单位" />
-              <el-table-column prop="name" label="库存数量" />
+              <el-table-column prop="productUnit" label="单位" />
+
+              <el-table-column prop="quantity" label="库存数量" />
               <el-table-column
                 prop="checkQuantity"
                 label="盘点数量"
@@ -70,12 +76,18 @@
                       :precision="4"
                       :controls="false"
                       :min="0"
+                      @change="() => handleChange($index)"
                     />
                   </el-form-item>
                 </template>
               </el-table-column>
-              <el-table-column prop="name" label="盘点结果" />
-              <el-table-column prop="zip" label="操作" width="100">
+              <el-table-column prop="result" label="盘点结果" />
+              <el-table-column
+                prop="zip"
+                label="操作"
+                width="100"
+                v-if="modalType == 'add'"
+              >
                 <template #default="{ $index }">
                   <el-button type="primary" link @click="handleRemove($index)"
                     >删除</el-button
@@ -86,7 +98,7 @@
           </div>
         </template>
       </byForm>
-      <template #footer>
+      <template #footer v-if="modalType == 'add'">
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
         <el-button
           type="primary"
@@ -169,84 +181,85 @@ const config = computed(() => {
       attrs: {
         label: "盘点单号",
         prop: "code",
+        slot: "code",
       },
     },
     {
       attrs: {
         label: "仓库名称",
-        prop: "name",
+        prop: "warehouseName",
       },
     },
     {
       attrs: {
         label: "盘点时间",
-        prop: "remark",
+        prop: "createTime",
       },
     },
     {
       attrs: {
         label: "盘点人",
-        prop: "remark",
+        prop: "userName",
       },
     },
     {
       attrs: {
         label: "盘点结论",
-        prop: "remark",
+        prop: "result",
       },
     },
     {
       attrs: {
         label: "盘点物品数",
-        prop: "remark",
+        prop: "totalNum",
       },
     },
     {
       attrs: {
         label: "正常物品数",
-        prop: "remark",
+        prop: "normalNum",
       },
     },
     {
       attrs: {
         label: "异常物品数",
-        prop: "remark",
-      },
-    },
-    {
-      attrs: {
-        label: "操作",
-        width: "200",
-        align: "right",
-      },
-      // 渲染 el-button,一般用在最后一列。
-      renderHTML(row) {
-        return [
-          {
-            attrs: {
-              label: "接收",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              getDtl(row);
-            },
-          },
-          {
-            attrs: {
-              label: "打印",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              getDtl(row);
-            },
-          },
-        ];
+        prop: "anomalyNum",
       },
     },
+    // {
+    //   attrs: {
+    //     label: "操作",
+    //     width: "200",
+    //     align: "right",
+    //   },
+    //   // 渲染 el-button,一般用在最后一列。
+    //   renderHTML(row) {
+    //     return [
+    //       {
+    //         attrs: {
+    //           label: "接收",
+    //           type: "primary",
+    //           text: true,
+    //         },
+    //         el: "button",
+    //         click() {
+    //           getDtl(row);
+    //         },
+    //       },
+    //       {
+    //         attrs: {
+    //           label: "打印",
+    //           type: "primary",
+    //           text: true,
+    //         },
+    //         el: "button",
+    //         click() {
+    //           getDtl(row);
+    //         },
+    //       },
+    //     ];
+    //   },
+    // },
   ];
 });
 
@@ -307,6 +320,7 @@ const getList = async (req) => {
 const openModal = () => {
   dialogVisible.value = true;
   modalType.value = "add";
+  formConfig[0].disabled = false;
   formData.data = {
     list: [],
   };
@@ -315,6 +329,17 @@ const openModal = () => {
 const submitForm = () => {
   console.log(byform.value);
   byform.value.handleSubmit((valid) => {
+    //    const list = formData.data.list;
+    // for (let i = 0; i < list.length; i++) {
+    //   const e = list[i];
+
+    //   if (e.groupNum > e.canSum) {
+    //     return ElMessage({
+    //       message: "组合数量不可大于可组合数量!",
+    //       type: "info",
+    //     });
+    //   }
+    // }
     submitLoading.value = true;
     proxy.post("/stockCheck/" + modalType.value, formData.data).then(
       (res) => {
@@ -363,10 +388,11 @@ const handleSelect = (row) => {
 const pushGoods = (goods) => {
   const arr = goods.map((x) => ({
     productId: x.id,
-    checkQuantity: "",
+    quantity: "",
     checkQuantity: "",
     productName: x.name,
-    code: x.code,
+    productCode: x.code,
+    productUnit: x.unit,
   }));
   formData.data.list = formData.data.list.concat(arr);
   return ElMessage({
@@ -382,10 +408,85 @@ const handleRemove = (index) => {
     type: "success",
   });
 };
+
+watchEffect(() => {
+  const list = formData.data.list;
+  if (
+    formData.data.warehouseId &&
+    list.length > 0 &&
+    modalType.value == "add"
+  ) {
+    proxy
+      .post("/stock/pageByWarehouse", {
+        id: formData.data.warehouseId,
+        productIds: list.map((x) => x.productId),
+      })
+      .then((res) => {
+        const productList = res.rows;
+        for (let i = 0; i < list.length; i++) {
+          const e = list[i];
+          e.quantity = 0;
+          for (let j = 0; j < productList.length; j++) {
+            const x = productList[j];
+            if (e.productId == x.productId) {
+              e.quantity = x.quantity;
+            }
+          }
+        }
+        handleChange();
+      });
+  }
+});
+
+const handleChange = (index) => {
+  if (!formData.data.list[index].quantity) return;
+  if (
+    formData.data.list[index].quantity > formData.data.list[index].checkQuantity
+  ) {
+    formData.data.list[index].result = "盘亏";
+  }
+  if (
+    formData.data.list[index].quantity ==
+    formData.data.list[index].checkQuantity
+  ) {
+    formData.data.list[index].result = "正常";
+  }
+  if (
+    formData.data.list[index].quantity < formData.data.list[index].checkQuantity
+  ) {
+    formData.data.list[index].result = "盘盈";
+  }
+};
+
+const changeClass = ({ row }) => {
+  if (row.result == "盘亏") {
+    return "redClass";
+  } else if (row.result == "盘盈") {
+    return "greenClass";
+  }
+};
+
+const handleClickCode = (row) => {
+  modalType.value = "edit";
+  proxy.post("/stockCheck/detail", { id: row.id }).then((res) => {
+    formConfig[0].disabled = true;
+    formData.data = {
+      warehouseId: row.warehouseId,
+      list: res.list,
+    };
+    dialogVisible.value = true;
+  });
+};
 </script>
   
 <style lang="scss" scoped>
 .tenant {
   padding: 20px;
 }
+.redClass {
+  color: red !important;
+}
+.greenClass {
+  color: green !important;
+}
 </style>

+ 47 - 36
src/views/salesMange/saleContract/claim/index.vue

@@ -22,9 +22,9 @@
       </byTable>
     </div>
     <el-dialog
-      title="入库"
+      title="认领"
       v-model="dialogVisible"
-      width="800"
+      width="500"
       v-loading="loading"
     >
       <byForm
@@ -39,12 +39,12 @@
             <el-button type="primary" style="margin-bottom: 10px"
               >选择合同</el-button
             >
-            <el-table :data="formData.data.stockWaitDetailsList">
+            <el-table :data="formData.data.claimContractList">
               <el-table-column prop="productCode" label="合同编码" />
               <el-table-column prop="quantity" label="关联金额" min-width="150">
                 <template #default="{ row, $index }">
                   <el-form-item
-                    :prop="'stockWaitDetailsList.' + $index + '.quantity'"
+                    :prop="'claimContractList.' + $index + '.quantity'"
                     :rules="rules.quantity"
                     :inline-message="true"
                   >
@@ -249,7 +249,7 @@ const config = computed(() => {
                   }).then(() => {
                     // 删除
                     proxy
-                      .post("/productInfo/delete", {
+                      .post("/claim/delete", {
                         id: row.id,
                       })
                       .then((res) => {
@@ -288,7 +288,7 @@ const formConfig = reactive([
   },
   {
     type: "select",
-    prop: "businessType",
+    prop: "accountManagementName",
     label: "选择账户",
     required: true,
     disabled: true,
@@ -300,24 +300,33 @@ const formConfig = reactive([
   {
     type: "date",
     itemType: "datetime",
-    prop: "businessType",
+    prop: "claimTime",
     label: "交易时间",
     disabled: true,
   },
   {
     type: "select",
-    // itemType: "datetime",
-    prop: "businessType",
+    prop: "status",
     label: "交易金额",
-    itemWidth: 20,
+    itemWidth: 30,
     disabled: true,
+    data: [
+      {
+        label: "收入",
+        value: "10",
+      },
+      {
+        label: "支出",
+        value: "20",
+      },
+    ],
   },
   {
     type: "selectInput",
-    // itemType: "datetime",
-    prop: "businessType",
+    prop: "amount",
+    selectProp: "currency",
     label: " ",
-    itemWidth: 80,
+    itemWidth: 70,
     disabled: true,
   },
 
@@ -374,25 +383,32 @@ const openModal = () => {
 
 const submitForm = () => {
   byform.value.handleSubmit((valid) => {
-    const list = formData.data.stockWaitDetailsList;
-    const total = list.reduce((total, x) => (total += Number(x.quantity)), 0);
-    if (!(total > 0)) {
+    const list = formData.data.claimContractList;
+
+    if (!(list.length > 0)) {
       return ElMessage({
-        message: `本次入库不能为0!`,
+        message: `请添加认领信息!`,
         type: "info",
       });
     }
     for (let i = 0; i < list.length; i++) {
       const e = list[i];
-      if (Number(e.receiptQuantity) + e.quantity > Number(e.purchaseQuantity)) {
+      if (!(e.quantity > 0)) {
         return ElMessage({
-          message: "本次入库加已入库数量不可大于到货数量!",
+          message: "关联金额不能为0!",
           type: "info",
         });
       }
     }
+    const total = list.reduce((total, x) => (total += Number(x.quantity)), 0);
+    if (formData.data.amount !== total) {
+      return ElMessage({
+        message: "认领金额总合和交易金额需一致!",
+        type: "info",
+      });
+    }
     submitLoading.value = true;
-    proxy.post("/stockWait/addByWdly", formData.data).then(
+    proxy.post("/claim/add", formData.data).then(
       (res) => {
         ElMessage({
           message: "操作成功",
@@ -410,22 +426,17 @@ const submitForm = () => {
 const getDtl = (row) => {
   modalType.value = "edit";
   dialogVisible.value = true;
-
-  // proxy.post("/stockWait/detailByWdly", { id: row.id }).then((res) => {
-  //   const json = JSON.parse(res.victoriatouristJson);
-  //   formData.data = {
-  //     type: "1",
-  //     businessType: res.businessType,
-  //     warehouseId: "",
-  //     code: json.code,
-  //     stockWaitDetailsList: res.stockWaitDetailsList.map((x) => ({
-  //       ...x,
-  //       arrivalQuantity: x.quantity,
-  //       quantity: 0,
-  //     })),
-  //   };
-  //   dialogVisible.value = true;
-  // });
+  formData.data = {
+    businessId: row.id,
+    status: row.status + "",
+    currency: row.currency,
+    amount: row.amount,
+    accountManagementId: row.accountManagementId,
+    accountManagementName: row.accountManagementName,
+    claimTime: proxy.parseTime(new Date()),
+    claimContractList: [],
+  };
+  dialogVisible.value = true;
 };
 
 const warehouseType = ref([]);

+ 15 - 15
src/views/salesMange/shipmentMange/packing/index.vue

@@ -312,15 +312,15 @@ const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
   {
     label: "出货状态",
-    prop: "productType",
+    prop: "shipmentStatus",
     data: [
       {
-        label: "产品",
-        value: "1",
+        label: "未出货",
+        value: "0",
       },
       {
-        label: "物料",
-        value: "2",
+        label: "出货",
+        value: "1",
       },
     ],
   },
@@ -349,54 +349,54 @@ const config = computed(() => {
     {
       attrs: {
         label: "总箱数",
-        prop: "productCategory",
+        prop: "packQuantity",
       },
     },
     {
       attrs: {
         label: "净重",
-        prop: "productCode",
+        prop: "netWeight",
       },
     },
     {
       attrs: {
         label: "毛重",
-        prop: "productName",
+        prop: "roughWeight",
       },
     },
     {
       attrs: {
         label: "长",
-        prop: "productUnit",
+        prop: "boxLong",
       },
     },
 
     {
       attrs: {
         label: "宽",
-        prop: "count",
+        prop: "boxWide",
       },
     },
     {
       attrs: {
         label: "高",
-        prop: "receiptWarehouseName",
+        prop: "boxHigh",
       },
     },
     {
       attrs: {
         label: "总体积",
-        prop: "planArrivalTime",
+        prop: "bomVolume",
       },
     },
 
     {
       attrs: {
         label: "出货状态",
-        prop: "status",
+        prop: "shipmentStatus",
       },
       render(status) {
-        return statusData.value.find((x) => x.value == status).label;
+        return status == 1 ? "出货" : "未出货";
       },
     },
 
@@ -521,7 +521,7 @@ const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
   proxy
-    .post("/subscribeDetail/pageByWdly  ", sourceList.value.pagination)
+    .post("/packDetail/page", sourceList.value.pagination)
     .then((message) => {
       console.log(message);
       sourceList.value.data = message.rows.map((x) => ({