Эх сурвалжийг харах

管理员 订单详情调整, 修改价格

lxf 1 жил өмнө
parent
commit
ae46a153e4

+ 14 - 0
src/router/index.js

@@ -119,6 +119,20 @@ export const constantRoutes = [
     ],
   },
   {
+    path: "/order-detail",
+    component: Layout,
+    redirect: "/order-detail",
+    children: [
+      {
+        path: "/order-detail",
+        name: "order-detail",
+        component: () => import(/* webpackChunkName: "page" */ "@/views/group/order/management/detail.vue"),
+        props: true,
+        meta: { title: "订单详情" },
+      },
+    ],
+  },
+  {
     path: "/charging-standard/addOrModify",
     component: Layout,
     redirect: "/charging-standard/addOrModify",

+ 3 - 171
src/views/group/order/management/add.vue → src/views/group/order/management/detail.vue

@@ -62,9 +62,6 @@
         </template>
         <template #orderSkuList>
           <div style="width: 100%; padding: 0 20px">
-            <div style="margin-bottom: 10px" v-if="!(route.query && route.query.detailId)">
-              <el-button type="primary" size="small" @click="clickAddProduct()">选择产品</el-button>
-            </div>
             <el-collapse v-model="activeNames">
               <div v-for="(item, index) in formData.data.orderSkuList" :key="index" style="margin-bottom: 20px">
                 <div style="border: 1px solid #edf0f5">
@@ -209,9 +206,6 @@
                     <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)">
-                            <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">
                               <template #default="props">
@@ -253,20 +247,10 @@
                                 {{ moneyFormat(props.row.allUnitPrice, 2) }}
                               </template>
                             </el-table-column>
-                            <el-table-column label="操作" align="center" fixed="right" width="60" v-if="!(route.query && route.query.detailId)">
-                              <template #default="props">
-                                <el-button type="danger" @click="clickDeletePackingFittings(index, props.$index)" text>删除</el-button>
-                              </template>
-                            </el-table-column>
                           </el-table>
                         </div>
                       </template>
                     </el-table-column>
-                    <el-table-column label="操作" align="center" fixed="right" width="60" v-if="!(route.query && route.query.detailId)">
-                      <template #default="{}">
-                        <el-button type="primary" @click="clickDelete(index)" text>删除</el-button>
-                      </template>
-                    </el-table-column>
                   </el-table>
                   <el-collapse-item :name="index">
                     <template #title>
@@ -275,18 +259,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-html="getStyle(item.packageRemark)"></div>
-                        </div>
-                        <Editor
-                          v-else
-                          :value="item.packageRemark"
-                          @updateValue="
-                            (val) => {
-                              return updatePackageRemark(val, index);
-                            }
-                          "
-                          :ref="'editor_' + index" />
+                        <div v-html="getStyle(item.packageRemark)"></div>
                       </div>
                     </div>
                   </el-collapse-item>
@@ -336,35 +309,15 @@
         </template>
         <template #remark>
           <div style="width: 100%">
-            <div v-if="route.query && route.query.detailId">
-              <div v-html="getStyle(formData.data.remark)"></div>
-            </div>
-            <Editor v-else :value="formData.data.remark" @updateValue="updateValue" ref="editor" />
+            <div v-html="getStyle(formData.data.remark)"></div>
           </div>
         </template>
       </byForm>
       <div style="width: 100%; text-align: center; margin: 10px">
-        <el-button @click="clickCancel()" v-if="route.query && route.query.detailId" size="large">关 闭</el-button>
-        <el-button @click="clickCancel()" v-if="!(route.query && route.query.detailId)" size="large">取 消</el-button>
-        <el-button @click="submitForm('0')" v-if="!(route.query && route.query.detailId)" size="large" v-preReClick>暂 存</el-button>
-        <el-button type="primary" @click="submitForm('10')" v-if="!(route.query && route.query.detailId)" size="large" v-preReClick>确 定</el-button>
+        <el-button @click="clickCancel()" size="large">关 闭</el-button>
       </div>
     </el-card>
 
-    <el-dialog title="选择产品" v-if="openProduct" v-model="openProduct" width="90%">
-      <SelectProduct :selectStatus="true" @selectProduct="selectProduct"></SelectProduct>
-      <template #footer>
-        <el-button @click="openProduct = false" size="large">关 闭</el-button>
-      </template>
-    </el-dialog>
-
-    <el-dialog title="选择包材配件" v-if="openPackingFittings" v-model="openPackingFittings" width="90%">
-      <SelectBOM :selectStatus="true" :bomClassifyIdList="[2, 3]" @selectBOM="selectPackingFittings"></SelectBOM>
-      <template #footer>
-        <el-button @click="openPackingFittings = false" size="large">关 闭</el-button>
-      </template>
-    </el-dialog>
-
     <el-dialog :title="'修改' + textPrice" v-if="openChangePrice" v-model="openChangePrice" width="500">
       <el-form :model="changePrice.data" label-width="120px" ref="price">
         <el-form-item :label="textPrice" :prop="labelPrice" :rules="[{ required: true, message: '请输入' + textPrice, trigger: 'blur' }]">
@@ -389,10 +342,7 @@
 <script setup>
 import byForm from "@/components/byForm/index";
 import { ElMessage } from "element-plus";
-import Editor from "@/components/Editor/index.vue";
 import { useRouter, useRoute } from "vue-router";
-import SelectProduct from "@/views/group/product/management/index";
-import SelectBOM from "@/views/group/BOM/management/index";
 import useTagsViewStore from "@/store/modules/tagsView";
 
 const { proxy } = getCurrentInstance();
@@ -559,52 +509,6 @@ const handleSuccess = (any, UploadFile) => {
 const onPreviewFile = (file) => {
   window.open(file.raw.fileUrl, "_blank");
 };
-const updatePackageRemark = (val, index) => {
-  formData.data.orderSkuList[index].packageRemark = val;
-};
-const clickDelete = (index) => {
-  formData.data.orderSkuList.splice(index, 1);
-  calculatedAmount();
-};
-const updateValue = (val) => {
-  formData.data.remark = val;
-};
-const submitForm = (status) => {
-  submit.value.handleSubmit(() => {
-    if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
-      if (fileList.value && fileList.value.length > 0) {
-        for (let i = 0; i < fileList.value.length; i++) {
-          if (fileList.value[i].raw.uploadState) {
-            return ElMessage("文件上传中,请稍后提交");
-          }
-        }
-        formData.data.fileList = fileList.value.map((item) => {
-          return {
-            id: item.raw.id,
-            fileName: item.raw.fileName,
-            fileUrl: item.raw.fileUrl,
-          };
-        });
-      } else {
-        formData.data.fileList = [];
-      }
-      let type = "add";
-      if (formData.data.id) {
-        type = "edit";
-      }
-      formData.data.status = status;
-      proxy.post("/orderInfo/" + type, formData.data).then(() => {
-        ElMessage({
-          message: type == "add" ? "添加成功" : "编辑成功",
-          type: "success",
-        });
-        clickCancel();
-      });
-    } else {
-      return ElMessage("请添加产品");
-    }
-  });
-};
 const clickCancel = () => {
   const useTagsStore = useTagsViewStore();
   useTagsStore.delVisitedView(router.currentRoute.value);
@@ -734,10 +638,6 @@ const getStyle = (text) => {
     return "";
   }
 };
-const openProduct = ref(false);
-const clickAddProduct = () => {
-  openProduct.value = true;
-};
 const printType = ref([
   {
     dictKey: "1",
@@ -748,74 +648,6 @@ const printType = ref([
     dictValue: "双面",
   },
 ]);
-const selectProduct = (row, bom) => {
-  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("该产品已添加");
-    }
-    formData.data.orderSkuList.push({
-      wlnSkuName: bom.name,
-      skuId: row.skuId,
-      code: row.code,
-      name: row.name,
-      skuSpecId: row.id,
-      bomSpecId: row.bomSpecId,
-      quantity: undefined,
-      customProcessingFee: "",
-      customProcessingType: "",
-      lssueFee: "",
-      deliveryMaterialsFee: "",
-      packingLabor: "",
-      unitPrice: "",
-      printType: "1",
-      packageRemark: "",
-      subtotal: "",
-      orderSkuBomList: [],
-    });
-    ElMessage({ message: "添加成功", type: "success" });
-  } else {
-    ElMessage("添加失败");
-  }
-};
-const rowIndex = ref(null);
-const openPackingFittings = ref(false);
-const clickPackingFittings = (index) => {
-  rowIndex.value = index;
-  openPackingFittings.value = true;
-};
-const clickDeletePackingFittings = (index, indexTwo) => {
-  formData.data.orderSkuList[index].orderSkuBomList.splice(indexTwo, 1);
-  calculatedAmount();
-};
-const selectPackingFittings = (data) => {
-  if (formData.data.orderSkuList[rowIndex.value].orderSkuBomList && formData.data.orderSkuList[rowIndex.value].orderSkuBomList.length > 0) {
-    let list = formData.data.orderSkuList[rowIndex.value].orderSkuBomList.filter((item) => item.bomSpecId === data.id);
-    if (list && list.length > 0) {
-      return ElMessage("包材配件已添加");
-    }
-    formData.data.orderSkuList[rowIndex.value].orderSkuBomList.push({
-      bomSpecId: data.id,
-      unitPrice: data.costPrice,
-      quantity: undefined,
-      name: data.name,
-      allQuantity: 0,
-      allUnitPrice: 0,
-    });
-  } else {
-    formData.data.orderSkuList[rowIndex.value].orderSkuBomList = [
-      {
-        bomSpecId: data.id,
-        unitPrice: data.costPrice,
-        quantity: undefined,
-        name: data.name,
-        allQuantity: 0,
-        allUnitPrice: 0,
-      },
-    ];
-  }
-  ElMessage({ message: "添加成功", type: "success" });
-};
 const changeQuantity = (index) => {
   if (formData.data.orderSkuList[index].quantity) {
     proxy

+ 36 - 52
src/views/group/order/management/index.vue

@@ -10,10 +10,6 @@
         highlight-current-row
         :action-list="[
           {
-            text: '新建订单',
-            action: () => clickAddOrder(),
-          },
-          {
             text: '操作日志',
             action: () => viewLogs(),
           },
@@ -55,13 +51,14 @@ import byTable from "@/components/byTable/index";
 import { ElMessage, ElMessageBox } from "element-plus";
 
 const { proxy } = getCurrentInstance();
+const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
 const sourceList = ref({
   data: [],
   pagination: {
     total: 0,
     pageNum: 1,
     pageSize: 10,
-    departmentName: "",
+    departmentId: "",
     code: "",
     wlnCode: "",
     status: "",
@@ -82,9 +79,10 @@ const searchConfig = computed(() => {
       label: "万里牛单号",
     },
     {
-      type: "input",
-      prop: "departmentName",
-      label: "事业部名称",
+      type: "select",
+      prop: "departmentId",
+      data: departmentList.value,
+      label: "事业部",
     },
     {
       type: "select",
@@ -274,25 +272,12 @@ const config = computed(() => {
     {
       attrs: {
         label: "操作",
-        width: 180,
+        width: 120,
         align: "center",
         fixed: "right",
       },
       renderHTML(row) {
         return [
-          row.status == 0
-            ? {
-                attrs: {
-                  label: "编辑",
-                  type: "primary",
-                  text: true,
-                },
-                el: "button",
-                click() {
-                  clickUpdate(row);
-                },
-              }
-            : {},
           {
             attrs: {
               label: "税率",
@@ -304,22 +289,39 @@ const config = computed(() => {
               ElMessage("暂无税率功能");
             },
           },
-          {
-            attrs: {
-              label: "删除",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              clickDelete(row);
-            },
-          },
+          row.status == 0 || row.status == 10 || row.status == 20
+            ? {
+                attrs: {
+                  label: "删除",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  clickDelete(row);
+                },
+              }
+            : {},
         ];
       },
     },
   ];
 });
+const getDemandData = () => {
+  proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      departmentList.value = departmentList.value.concat(
+        res.rows.map((item) => {
+          return {
+            dictKey: item.id,
+            dictValue: item.name,
+          };
+        })
+      );
+    }
+  });
+};
+getDemandData();
 const getList = async (req, status) => {
   if (status) {
     sourceList.value.pagination = {
@@ -342,17 +344,9 @@ getList();
 const clickReset = () => {
   getList("", true);
 };
-const clickAddOrder = () => {
-  proxy.$router.replace({
-    path: "/addOrder",
-    query: {
-      random: proxy.random(),
-    },
-  });
-};
 const clickCode = (row) => {
   proxy.$router.replace({
-    path: "/addOrder",
+    path: "/order-detail",
     query: {
       detailId: row.id,
       text: "订单详情",
@@ -443,16 +437,6 @@ const getLogsList = async (req) => {
     }, 200);
   });
 };
-const clickUpdate = (row) => {
-  proxy.$router.replace({
-    path: "/addOrder",
-    query: {
-      id: row.id,
-      text: "编辑订单",
-      random: proxy.random(),
-    },
-  });
-};
 </script>
 
 <style lang="scss" scoped>

+ 24 - 1
src/views/group/order/product-management/index.vue

@@ -33,12 +33,14 @@
 import byTable from "@/components/byTable/index";
 
 const { proxy } = getCurrentInstance();
+const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
 const sourceList = ref({
   data: [],
   pagination: {
     total: 0,
     pageNum: 1,
     pageSize: 10,
+    departmentId: "",
     skuSpecCode: "",
     skuSpecName: "",
     bomSpecCode: "",
@@ -54,6 +56,12 @@ const loading = ref(false);
 const searchConfig = computed(() => {
   return [
     {
+      type: "select",
+      prop: "departmentId",
+      data: departmentList.value,
+      label: "事业部",
+    },
+    {
       type: "input",
       prop: "skuSpecCode",
       label: "SKU规格编码",
@@ -264,6 +272,21 @@ const config = computed(() => {
     },
   ];
 });
+const getDemandData = () => {
+  proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      departmentList.value = departmentList.value.concat(
+        res.rows.map((item) => {
+          return {
+            dictKey: item.id,
+            dictValue: item.name,
+          };
+        })
+      );
+    }
+  });
+};
+getDemandData();
 const getList = async (req, status) => {
   if (status) {
     sourceList.value.pagination = {
@@ -288,7 +311,7 @@ const clickReset = () => {
 };
 const clickCode = (row) => {
   proxy.$router.replace({
-    path: "/addOrder",
+    path: "/order-detail",
     query: {
       detailId: row.orderId,
       text: "订单详情",