Browse Source

订单流程

lxf 1 year ago
parent
commit
f4b60b258f

+ 1 - 1
src/components/byTable/index.vue

@@ -310,7 +310,7 @@ export default defineComponent({
       const propValue = prop && scope.row[prop];
       scope.row.$index = scope.$index;
       const args = propValue !== undefined ? propValue : scope.row;
-      return item[fn.name][fn.type](getParent.value, args);
+      return item[fn.name][fn.type](getParent.value, args, scope.row);
     };
     // 匹配 render 开头的函数
     const getMatchRenderFunction = (obj) => {

+ 68 - 54
src/components/process/order.vue

@@ -68,7 +68,7 @@
       </template>
       <template #orderSkuList>
         <div style="width: 100%; padding: 0 20px">
-          <div style="margin-bottom: 10px" v-if="!(route.query && route.query.detailId)">
+          <div style="margin-bottom: 10px" v-if="!formOption.disabled">
             <el-button type="primary" size="small" @click="clickAddProduct()">选择产品</el-button>
           </div>
           <el-collapse v-model="activeNames">
@@ -162,7 +162,7 @@
                             v-if="row.blueprint"
                             :src="row.blueprint"
                             @click="openFile(row.blueprint)" />
-                          <div style="display: flex" v-if="!(route.query && route.query.detailId)">
+                          <div style="display: flex" v-if="!formOption.disabled">
                             <el-button type="primary" @click="clickDrawingFile(index)" text>选择图稿</el-button>
                             <el-upload
                               :show-file-list="false"
@@ -190,7 +190,7 @@
                             v-if="row.productionDocument">
                             {{ row.productionDocument }}
                           </a>
-                          <div style="display: flex" v-if="!(route.query && route.query.detailId)">
+                          <div style="display: flex" v-if="!formOption.disabled">
                             <el-button type="primary" @click="clickDrawingFile(index)" text>选择图稿</el-button>
                             <el-upload
                               :show-file-list="false"
@@ -217,7 +217,7 @@
                             v-if="row.selfAdhesiveStickerFile && row.selfAdhesiveStickerFile.fileName">
                             {{ row.selfAdhesiveStickerFile.fileName }}
                           </a>
-                          <div style="display: flex" v-if="!(route.query && route.query.detailId)">
+                          <div style="display: flex" v-if="!formOption.disabled">
                             <el-upload
                               :show-file-list="false"
                               action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
@@ -239,11 +239,11 @@
                   <el-table-column label="包材配件/单品" min-width="400">
                     <template #default="{ row }">
                       <div style="width: 100%">
-                        <div style="margin-bottom: 10px" v-if="!(route.query && route.query.detailId)">
+                        <div style="margin-bottom: 10px" v-if="!formOption.disabled">
                           <el-button type="primary" @click="clickPackingFittings(index)">选择包材配件</el-button>
                         </div>
                         <el-table :data="row.orderSkuBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
-                          <el-table-column label="单价¥" width="120">
+                          <el-table-column label="单价¥" width="80">
                             <template #default="props">
                               <div>
                                 <span>{{ moneyFormat(props.row.unitPrice, 2) }}</span>
@@ -267,7 +267,7 @@
                               </el-form-item>
                             </template>
                           </el-table-column>
-                          <el-table-column label="名称" prop="bomSpecName" min-width="150" />
+                          <el-table-column label="名称" prop="bomSpecName" min-width="140" />
                           <el-table-column label="总量" width="80">
                             <template #default="props">
                               {{ computeQuantity(index, props.$index) }}
@@ -278,7 +278,7 @@
                               {{ moneyFormat(computeMoney(index, props.$index), 2) }}
                             </template>
                           </el-table-column>
-                          <el-table-column label="操作" align="center" fixed="right" width="60" v-if="!(route.query && route.query.detailId)">
+                          <el-table-column label="操作" align="center" fixed="right" width="60" v-if="!formOption.disabled">
                             <template #default="props">
                               <el-button type="danger" @click="clickDeletePackingFittings(index, props.$index)" text>删除</el-button>
                             </template>
@@ -287,7 +287,7 @@
                       </div>
                     </template>
                   </el-table-column>
-                  <el-table-column label="操作" align="center" fixed="right" width="60" v-if="!(route.query && route.query.detailId)">
+                  <el-table-column label="操作" align="center" fixed="right" width="60" v-if="!formOption.disabled">
                     <template #default="{}">
                       <el-button type="danger" @click="clickDelete(index)" text>删除</el-button>
                     </template>
@@ -300,7 +300,7 @@
                   <div style="display: flex; padding: 8px 10px 0px">
                     <div style="flex: 1; padding: 0px 10px">
                       <div>包装要求:</div>
-                      <div v-if="route.query && route.query.detailId">
+                      <div v-if="formOption.disabled">
                         <div v-html="getStyle(item.packageRemark)"></div>
                       </div>
                       <Editor
@@ -366,7 +366,7 @@
       </template>
       <template #remark>
         <div style="width: 100%">
-          <div style="margin: 0 2vw" v-if="route.query && route.query.detailId">
+          <div style="margin: 0 2vw" v-if="formOption.disabled">
             <div v-html="getStyle(formData.data.remark)"></div>
           </div>
           <Editor v-else :value="formData.data.remark" @updateValue="updateValue" ref="editor" />
@@ -472,21 +472,21 @@ const formConfig = computed(() => {
       prop: "orderSkuList",
       slotName: "orderSkuList",
     },
-    route.query && route.query.detailId
+    formOption.disabled
       ? {}
       : {
           type: "title",
           title: "地址",
           label: "",
         },
-    route.query && route.query.detailId
+    formOption.disabled
       ? {}
       : {
           type: "slot",
           slotName: "deliveryAddress",
           label: "收货地址",
         },
-    route.query && route.query.detailId
+    formOption.disabled
       ? {}
       : {
           type: "slot",
@@ -641,56 +641,66 @@ const typeList = ref([
     dictValue: "委外订单",
   },
 ]);
+const skuDetail = ref({});
 const selectProduct = (row, SKU) => {
   if (row.id) {
     let list = formData.data.orderSkuList.filter((item) => item.skuSpecId === row.id && item.bomSpecId === row.bomSpecId);
     if (list && list.length > 0) {
       return ElMessage("该产品已添加");
     }
-    proxy.post("/sku/detail", { id: SKU.id }).then((res) => {
-      let orderSkuBomList = [];
-      if (res.skuSpecList && res.skuSpecList.length > 0) {
-        let listTwo = res.skuSpecList.filter((item) => item.id === row.id);
-        if (listTwo && listTwo.length > 0) {
-          if (listTwo[0].packagingMaterialList && listTwo[0].packagingMaterialList.length > 0) {
-            orderSkuBomList = listTwo[0].packagingMaterialList.map((item) => {
-              return {
-                bomSpecId: item.bomSpecId,
-                unitPrice: item.internalSellingPrice,
-                quantity: item.quantity,
-                bomSpecName: item.name,
-              };
-            });
-          }
-        }
-      }
-      formData.data.orderSkuList.push({
-        wlnSkuName: SKU.name,
-        skuId: row.skuId,
-        code: row.code,
-        name: row.name,
-        skuSpecId: row.id,
-        bomSpecId: row.bomSpecId,
-        quantity: undefined,
-        customProcessingFee: "",
-        customProcessingType: "",
-        lssueFee: "",
-        deliveryMaterialsFee: "",
-        packingLabor: "",
-        managementFee: "",
-        unitPrice: "",
-        printType: 1,
-        packageRemark: "",
-        orderSkuBomList: orderSkuBomList,
-        blueprint: row.designImgUrl,
-        productionDocument: row.sharedFolder,
+    if (skuDetail.value && skuDetail.value.id === SKU.id) {
+      pushProduct(skuDetail.value, SKU, row);
+    } else {
+      proxy.post("/sku/detail", { id: SKU.id }).then((res) => {
+        skuDetail.value = res;
+        pushProduct(res, SKU, row);
       });
-      ElMessage({ message: "添加成功", type: "success" });
-    });
+    }
   } else {
     ElMessage("添加失败");
   }
 };
+const pushProduct = (res, SKU, row) => {
+  let data = proxy.deepClone(res);
+  let orderSkuBomList = [];
+  if (data.skuSpecList && data.skuSpecList.length > 0) {
+    let listTwo = data.skuSpecList.filter((item) => item.id === row.id);
+    if (listTwo && listTwo.length > 0) {
+      if (listTwo[0].packagingMaterialList && listTwo[0].packagingMaterialList.length > 0) {
+        orderSkuBomList = listTwo[0].packagingMaterialList.map((item) => {
+          return {
+            bomSpecId: item.bomSpecId,
+            unitPrice: item.internalSellingPrice,
+            quantity: item.quantity,
+            bomSpecName: item.name,
+          };
+        });
+      }
+    }
+  }
+  formData.data.orderSkuList.push({
+    wlnSkuName: SKU.name,
+    skuId: row.skuId,
+    code: row.code,
+    name: row.name,
+    skuSpecId: row.id,
+    bomSpecId: row.bomSpecId,
+    quantity: undefined,
+    customProcessingFee: "",
+    customProcessingType: "",
+    lssueFee: "",
+    deliveryMaterialsFee: "",
+    packingLabor: "",
+    managementFee: "",
+    unitPrice: "",
+    printType: 1,
+    packageRemark: "",
+    orderSkuBomList: orderSkuBomList,
+    blueprint: row.designImgUrl,
+    productionDocument: row.sharedFolder,
+  });
+  ElMessage({ message: "添加成功", type: "success" });
+};
 const rowIndex = ref(null);
 const openPackingFittings = ref(false);
 const clickPackingFittings = (index) => {
@@ -727,7 +737,11 @@ const selectPackingFittings = (data) => {
 const changeQuantity = (index) => {
   if (formData.data.orderSkuList[index].quantity) {
     proxy
-      .post("/orderInfo/getSkuSpecPrice", { skuSpecId: formData.data.orderSkuList[index].skuSpecId, quantity: formData.data.orderSkuList[index].quantity })
+      .post("/orderInfo/getSkuSpecPrice", {
+        skuSpecId: formData.data.orderSkuList[index].skuSpecId,
+        quantity: formData.data.orderSkuList[index].quantity,
+        random: proxy.random(),
+      })
       .then((res) => {
         if (formData.data.orderSkuList[index].printType == 2 && res.customProcessingFee) {
           formData.data.orderSkuList[index].customProcessingFee = Number(Math.round(res.customProcessingFee * 2 * 100) / 100);

+ 42 - 1
src/views/subsidiary/order/management/index.vue

@@ -38,6 +38,28 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import refreshStore from "/src/store/modules/refresh";
 
 const { proxy } = getCurrentInstance();
+const flowStatus = ref([
+  {
+    dictKey: 0,
+    dictValue: "未发起",
+  },
+  {
+    dictKey: 1,
+    dictValue: "进行中",
+  },
+  {
+    dictKey: 2,
+    dictValue: "已通过",
+  },
+  {
+    dictKey: 3,
+    dictValue: "已驳回",
+  },
+  {
+    dictKey: 4,
+    dictValue: "已作废",
+  },
+]);
 const sourceList = ref({
   data: [],
   pagination: {
@@ -67,6 +89,12 @@ const searchConfig = computed(() => {
     },
     {
       type: "select",
+      prop: "flowStatus",
+      label: "流程状态",
+      data: flowStatus.value,
+    },
+    {
+      type: "select",
       prop: "status",
       dictKey: "order_status",
       label: "订单状态",
@@ -111,11 +139,24 @@ const config = computed(() => {
     },
     {
       attrs: {
+        label: "流程状态",
+        prop: "flowStatus",
+        width: 120,
+      },
+      render(val) {
+        return proxy.dictKeyValue(val, flowStatus.value);
+      },
+    },
+    {
+      attrs: {
         label: "订单状态",
         prop: "status",
         width: 120,
       },
-      render(val) {
+      render(val, row) {
+        if (val == 0 && row.flowStatus !== 2) {
+          return "";
+        }
         return proxy.dictKeyValue(val, proxy.useUserStore().allDict["order_status"]);
       },
     },