Browse Source

新增订单 删除按钮居中

lxf 1 year ago
parent
commit
990d14a5c5

+ 11 - 15
src/views/subsidiary/order/management/add.vue

@@ -68,7 +68,7 @@
             <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">
-                  <el-table :data="[item]" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
+                  <el-table :data="[item]" :row-style="{ height: '35px' }" header-row-class-name="tableHeader" :cell-class-name="cellStyleName">
                     <el-table-column label="产品" width="300">
                       <template #default="{ row }">
                         <div style="width: 100%">
@@ -289,7 +289,7 @@
       <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) && !route.query.status" size="large" v-preReClick>暂 存</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>
       </div>
     </el-card>
@@ -498,19 +498,7 @@ const updateValue = (val) => {
 const submitForm = (status) => {
   submit.value.handleSubmit(() => {
     if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
-      if (route.query.status) {
-        for (let i = 0; i < formData.data.orderSkuList.length; i++) {
-          if (!formData.data.orderSkuList[i].blueprint) {
-            return ElMessage("请选择设计图");
-          }
-          if (!formData.data.orderSkuList[i].productionDocument) {
-            return ElMessage("请选择生产文件");
-          }
-        }
-        formData.data.status = route.query.status;
-      } else {
-        formData.data.status = status;
-      }
+      formData.data.status = status;
       let type = "add";
       if (formData.data.id) {
         type = "edit";
@@ -838,6 +826,11 @@ const calculatedAmount = () => {
   );
   formData.data.totalAmount = totalAmount;
 };
+const cellStyleName = ({ row, column, rowIndex, columnIndex }) => {
+  if (column.label === "操作" && columnIndex === 3) {
+    return "vertical-align";
+  }
+};
 </script>
 
 <style lang="scss" scoped>
@@ -860,4 +853,7 @@ const calculatedAmount = () => {
 :deep(.el-table__cell) {
   vertical-align: top;
 }
+:deep(.vertical-align) {
+  vertical-align: middle;
+}
 </style>

+ 0 - 218
src/views/subsidiary/order/management/design.vue

@@ -243,20 +243,6 @@
       </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="选择图稿文件" v-if="openDrawingFile" v-model="openDrawingFile" width="70%">
       <SelectPicture @selectPic="selectPic"></SelectPicture>
       <template #footer>
@@ -270,8 +256,6 @@
 import byForm from "@/components/byForm/index";
 import { ElMessage } from "element-plus";
 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";
 import SelectPicture from "@/components/select-picture/index.vue";
 
@@ -410,16 +394,6 @@ const selectPic = (row) => {
 const openFile = (path) => {
   window.open(path);
 };
-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) {
@@ -535,10 +509,6 @@ const getStyle = (text) => {
     return "";
   }
 };
-const openProduct = ref(false);
-const clickAddProduct = () => {
-  openProduct.value = true;
-};
 const printType = ref([
   {
     dictKey: 1,
@@ -549,194 +519,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,
-      bomSpecName: data.name,
-      allQuantity: 0,
-      allUnitPrice: 0,
-    });
-  } else {
-    formData.data.orderSkuList[rowIndex.value].orderSkuBomList = [
-      {
-        bomSpecId: data.id,
-        unitPrice: data.costPrice,
-        quantity: undefined,
-        bomSpecName: data.name,
-        allQuantity: 0,
-        allUnitPrice: 0,
-      },
-    ];
-  }
-  ElMessage({ message: "添加成功", type: "success" });
-};
-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 })
-      .then((res) => {
-        formData.data.orderSkuList[index].customProcessingFee = res.customProcessingFee;
-        formData.data.orderSkuList[index].customProcessingType = res.customProcessingType;
-        formData.data.orderSkuList[index].deliveryMaterialsFee = res.deliveryMaterialsFee;
-        formData.data.orderSkuList[index].lssueFee = res.lssueFee;
-        formData.data.orderSkuList[index].packingLabor = res.packingLabor;
-        formData.data.orderSkuList[index].unitPrice = res.unitPrice;
-        formData.data.orderSkuList[index].subtotal = Number(
-          Math.round(
-            (res.customProcessingFee + res.deliveryMaterialsFee + res.lssueFee + res.packingLabor + res.unitPrice) *
-              formData.data.orderSkuList[index].quantity *
-              100
-          ) / 100
-        );
-        changeBOMQuantity(index);
-      });
-  }
-};
-const changeBOMQuantity = (index) => {
-  if (formData.data.orderSkuList[index].orderSkuBomList && formData.data.orderSkuList[index].orderSkuBomList.length > 0) {
-    if (formData.data.orderSkuList[index].quantity) {
-      formData.data.orderSkuList[index].orderSkuBomList = formData.data.orderSkuList[index].orderSkuBomList.map((item) => {
-        let allQuantity = 0;
-        let allUnitPrice = 0;
-        if (item.quantity) {
-          allQuantity = Number(Math.round(Number(item.quantity) * Number(formData.data.orderSkuList[index].quantity)));
-        }
-        if (item.unitPrice) {
-          allUnitPrice = Number(Math.round(Number(item.unitPrice) * Number(allQuantity) * 100) / 100);
-        }
-        return {
-          ...item,
-          allQuantity: allQuantity,
-          allUnitPrice: allUnitPrice,
-        };
-      });
-    } else {
-      formData.data.orderSkuList[index].orderSkuBomList = formData.data.orderSkuList[index].orderSkuBomList.map((item) => {
-        return {
-          ...item,
-          allQuantity: 0,
-          allUnitPrice: 0,
-        };
-      });
-    }
-  }
-  calculatedAmount();
-};
-const calculatedAmount = () => {
-  let productTotalAmount = 0;
-  let customProcessingFee = 0;
-  let lssueFee = 0;
-  let deliveryMaterialsFee = 0;
-  let packingLabor = 0;
-  let packagingMaterialCost = 0;
-  let totalAmount = 0;
-  if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
-    for (let i = 0; i < formData.data.orderSkuList.length; i++) {
-      if (formData.data.orderSkuList[i].quantity) {
-        if (formData.data.orderSkuList[i].customProcessingFee) {
-          customProcessingFee = Number(
-            Math.round((customProcessingFee + formData.data.orderSkuList[i].customProcessingFee * formData.data.orderSkuList[i].quantity) * 100) / 100
-          );
-        }
-        if (formData.data.orderSkuList[i].lssueFee) {
-          lssueFee = Number(Math.round((lssueFee + formData.data.orderSkuList[i].lssueFee * formData.data.orderSkuList[i].quantity) * 100) / 100);
-        }
-        if (formData.data.orderSkuList[i].deliveryMaterialsFee) {
-          deliveryMaterialsFee = Number(
-            Math.round((deliveryMaterialsFee + formData.data.orderSkuList[i].deliveryMaterialsFee * formData.data.orderSkuList[i].quantity) * 100) / 100
-          );
-        }
-        if (formData.data.orderSkuList[i].packingLabor) {
-          packingLabor = Number(Math.round((packingLabor + formData.data.orderSkuList[i].packingLabor * formData.data.orderSkuList[i].quantity) * 100) / 100);
-        }
-        if (formData.data.orderSkuList[i].unitPrice) {
-          productTotalAmount = Number(
-            Math.round((productTotalAmount + formData.data.orderSkuList[i].unitPrice * formData.data.orderSkuList[i].quantity) * 100) / 100
-          );
-        }
-        let money = 0;
-        if (formData.data.orderSkuList[i].orderSkuBomList && formData.data.orderSkuList[i].orderSkuBomList.length > 0) {
-          for (let j = 0; j < formData.data.orderSkuList[i].orderSkuBomList.length; j++) {
-            if (formData.data.orderSkuList[i].orderSkuBomList[j].quantity && formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) {
-              packagingMaterialCost = Number(
-                Math.round(
-                  (packagingMaterialCost +
-                    formData.data.orderSkuList[i].orderSkuBomList[j].quantity *
-                      formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice *
-                      formData.data.orderSkuList[i].quantity) *
-                    100
-                ) / 100
-              );
-              money = Number(
-                Math.round(
-                  (money + formData.data.orderSkuList[i].orderSkuBomList[j].quantity * formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) * 100
-                ) / 100
-              );
-            }
-          }
-        }
-        formData.data.orderSkuList[i].packagingMaterialCost = money;
-      }
-    }
-  }
-  formData.data.productTotalAmount = productTotalAmount;
-  formData.data.customProcessingFee = customProcessingFee;
-  formData.data.lssueFee = lssueFee;
-  formData.data.deliveryMaterialsFee = deliveryMaterialsFee;
-  formData.data.packingLabor = packingLabor;
-  formData.data.packagingMaterialCost = packagingMaterialCost;
-  totalAmount = Number(
-    Math.round((productTotalAmount + customProcessingFee + lssueFee + deliveryMaterialsFee + packingLabor + packagingMaterialCost) * 100) / 100
-  );
-  formData.data.totalAmount = totalAmount;
-};
 </script>
 
 <style lang="scss" scoped>