Browse Source

Merge branch '打单' into 测试

lxf 1 year ago
parent
commit
57215fa56a

+ 17 - 3
src/views/production/shipment/print-order/index.vue

@@ -68,6 +68,10 @@
       </template>
     </byTable>
 
+    <el-dialog title="包裹规格数据" v-if="openTotal" v-model="openTotal" width="90%">
+      <PackTotal :rowData="rowData" @clickCancel="clickCancel"></PackTotal>
+    </el-dialog>
+
     <el-dialog title="包裹图片" v-if="openPackagePicture" v-model="openPackagePicture" width="70%">
       <div v-loading="loadingPackagePicture">
         <el-upload
@@ -164,6 +168,7 @@
 <script setup>
 import byTable from "/src/components/byTable/index";
 import { ElMessage } from "element-plus";
+import PackTotal from "/src/views/production/shipment/print-order/packTotal.vue";
 
 const { proxy } = getCurrentInstance();
 const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
@@ -440,11 +445,16 @@ const clickCode = (row) => {
     },
   });
 };
-const clickTotal = (row) => {
-  console.log(row);
+const openTotal = ref(false);
+const rowData = ref({});
+const clickTotal = (item) => {
+  rowData.value = item;
+  openTotal.value = true;
+};
+const clickCancel = () => {
+  openTotal.value = false;
 };
 const openPackagePicture = ref(false);
-const rowData = ref({});
 const loadingPackagePicture = ref(false);
 const fileList = ref([]);
 const clickPackagePicture = (item) => {
@@ -714,4 +724,8 @@ const submitExpressCode = () => {
     margin-block-end: 0 !important;
   }
 }
+:deep(.el-dialog) {
+  margin-top: 10px !important;
+  margin-bottom: 10px !important;
+}
 </style>

+ 144 - 0
src/views/production/shipment/print-order/packTotal.vue

@@ -0,0 +1,144 @@
+<template>
+  <div>
+    <div
+      style="max-height: calc(100vh - 174px); overflow-x: hidden; overflow-y: auto"
+      v-if="formData.data.orderEncasementList && formData.data.orderEncasementList.length > 0">
+      <div style="box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1); margin-bottom: 20px" v-for="(item, index) in formData.data.orderEncasementList" :key="index">
+        <div style="background-color: #edf0f5; padding: 4px">
+          <el-row :gutter="4" class="row-top">
+            <el-col :span="5">单包裹规格格(cm)</el-col>
+            <el-col :span="4">单包裹净重(kg)</el-col>
+            <el-col :span="4">单包裹体积(m³)</el-col>
+            <el-col :span="3">总包裹数</el-col>
+            <el-col :span="4">总净重(kg)</el-col>
+            <el-col :span="4">总体积(m³)</el-col>
+          </el-row>
+          <el-row :gutter="4" class="row-bottom">
+            <el-col :span="5">{{ `${item.length}*${item.width}*${item.height}` }}</el-col>
+            <el-col :span="4">{{ item.netWeight / 1000 }}</el-col>
+            <el-col :span="4">{{ (item.length * item.width * item.height) / 1000000 }}</el-col>
+            <el-col :span="3">{{ item.total }}</el-col>
+            <el-col :span="4">{{ (item.netWeight / 1000) * item.total }}</el-col>
+            <el-col :span="4">{{ ((item.length * item.width * item.height) / 1000000) * item.total }}</el-col>
+          </el-row>
+        </div>
+        <div style="background-color: white; border: 1px solid #ebeef5">
+          <el-table
+            border
+            :data="item.orderEncasementDetailList"
+            :row-style="{ height: '35px' }"
+            :cell-style="{ padding: '0' }"
+            header-row-class-name="tableHeaderTwo"
+            :span-method="arraySpanMethod">
+            <el-table-column label="产品品号" prop="skuSpecCode" width="150" />
+            <el-table-column label="产品品名" prop="skuSpecName" />
+            <el-table-column label="打包数量" align="center" width="120">
+              <template #default="{ row }">
+                <div>
+                  {{ row.quantity ? row.quantity : 0 }}
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="总包裹数" align="center" width="120">
+              <template #default="{ row }">
+                <div>x {{ item.total }}</div>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </div>
+    </div>
+    <div style="text-align: center; margin: 10px">
+      <el-button @click="clickCancel()" size="large">关 闭</el-button>
+    </div>
+  </div>
+</template>
+
+<script setup>
+const { proxy } = getCurrentInstance();
+const props = defineProps({
+  rowData: Object,
+});
+const loading = ref(false);
+const formData = reactive({
+  data: {
+    skuInfoList: [],
+    orderEncasementList: [],
+  },
+});
+onMounted(() => {
+  if (props.rowData && props.rowData.id) {
+    getDetails();
+  }
+});
+const getDetails = () => {
+  loading.value = true;
+  proxy.post("/issueBill/assemblyDetail", { id: props.rowData.id }).then(
+    (res) => {
+      if (res.orderEncasementList && res.orderEncasementList.length > 0) {
+        res.orderEncasementList = res.orderEncasementList.map((item) => {
+          if (item.orderEncasementDetailList && item.orderEncasementDetailList.length > 0) {
+            item.orderEncasementDetailList = item.orderEncasementDetailList.map((itemTwo, index) => {
+              return {
+                ...itemTwo,
+                rowspan: item.orderEncasementDetailList.length,
+                rowIndex: index,
+              };
+            });
+          }
+          return {
+            ...item,
+          };
+        });
+      }
+      formData.data = res;
+      loading.value = false;
+    },
+    (err) => {
+      console.log(err);
+      loading.value = false;
+    }
+  );
+};
+const arraySpanMethod = ({ row, columnIndex }) => {
+  if (columnIndex === 3) {
+    if (row.rowIndex === 0) {
+      return {
+        rowspan: row.rowspan,
+        colspan: 1,
+      };
+    } else {
+      return {
+        rowspan: 0,
+        colspan: 0,
+      };
+    }
+  }
+};
+const emit = defineEmits(["clickCancel"]);
+const clickCancel = () => {
+  emit("clickCancel", false);
+};
+</script>
+
+<style lang="scss" scoped>
+.row-top .el-col {
+  text-align: center;
+  height: 32px;
+  line-height: 32px;
+}
+.row-bottom .el-col {
+  text-align: center;
+  color: red;
+  font-weight: 700;
+  height: 32px;
+  line-height: 32px;
+}
+::v-deep(.tableHeaderTwo) {
+  th {
+    background-color: white !important;
+    height: 35px;
+    padding: 0;
+  }
+}
+</style>

+ 237 - 112
src/views/production/shipment/print-order/unpack.vue

@@ -1,116 +1,164 @@
 <template>
-  <el-row :gutter="10">
-    <el-col :span="7">
-      <el-card class="box-card">
-        <div style="font-size: 16px; font-weight: 700; margin-bottom: 10px">产品清单</div>
-        <el-table :data="formData.data.skuInfoList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader" height="calc(100vh - 315px)">
-          <el-table-column label="产品规格">
-            <template #default="{ row }">
-              <div>{{ row.skuSpecCode }}</div>
-              <div>{{ row.skuSpecName }}</div>
-            </template>
-          </el-table-column>
-          <el-table-column label="剩余可装箱数" prop="surplusQuantity" align="center" width="110" />
-          <el-table-column label="净重(g)" width="120">
-            <template #default="{ row }">
-              <el-input-number
-                onmousewheel="return false;"
-                v-model="row.quantity"
-                placeholder="净重"
-                style="width: 100%"
-                :controls="false"
-                :min="0"
-                :precision="0"
-                :max="row.surplusQuantity" />
-            </template>
-          </el-table-column>
-        </el-table>
-        <div style="font-size: 16px; font-weight: 700; margin: 10px 0">包裹规格信息</div>
-        <el-form :model="formData.data" :rules="rules" label-width="120px" ref="refForm">
-          <el-form-item label="尺寸(cm)" required>
-            <el-row>
-              <el-col :span="8">
-                <el-form-item label="" prop="length">
-                  <el-input-number
-                    onmousewheel="return false;"
-                    v-model="formData.data.length"
-                    placeholder="长"
-                    style="width: 100%"
-                    :controls="false"
-                    :min="0"
-                    :precision="2" />
-                </el-form-item>
-              </el-col>
-              <el-col :span="8">
-                <el-form-item label="" prop="width">
-                  <el-input-number
-                    onmousewheel="return false;"
-                    v-model="formData.data.width"
-                    placeholder="宽"
-                    style="width: 100%"
-                    :controls="false"
-                    :min="0"
-                    :precision="2" />
-                </el-form-item>
-              </el-col>
-              <el-col :span="8">
-                <el-form-item label="" prop="height">
-                  <el-input-number
-                    onmousewheel="return false;"
-                    v-model="formData.data.height"
-                    placeholder="高"
-                    style="width: 100%"
-                    :controls="false"
-                    :min="0"
-                    :precision="2" />
-                </el-form-item>
-              </el-col>
-            </el-row>
-          </el-form-item>
-          <el-button type="primary" style="width: 100%" @click="submitPack()" v-preReClick>装包裹</el-button>
-        </el-form>
-      </el-card>
-    </el-col>
-    <el-col :span="17">
-      <el-card class="box-card">
-        <div style="font-size: 16px; font-weight: 700; margin-bottom: 10px">包裹规格数据</div>
-        <div
-          style="max-height: calc(100vh - 190px); overflow-x: hidden; overflow-y: auto"
-          v-if="formData.data.orderEncasementList && formData.data.orderEncasementList.length > 0">
-          <div style="box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1); margin-bottom: 20px" v-for="(item, index) in formData.data.orderEncasementList" :key="index">
-            <div style="background-color: #edf0f5; padding: 4px">
-              <el-row :gutter="4" class="row-top">
-                <el-col :span="5">单包裹规格格(cm)</el-col>
-                <el-col :span="4">单包裹净重(kg)</el-col>
-                <el-col :span="4">单包裹体积(m³)</el-col>
-                <el-col :span="2">总包裹数</el-col>
-                <el-col :span="3">总净重(kg)</el-col>
-                <el-col :span="3">总体积(m³)</el-col>
-                <el-col :span="3">操作</el-col>
-              </el-row>
-              <el-row :gutter="4" class="row-bottom">
-                <el-col :span="5">{{ `${item.length}*${item.width}*${item.height}` }}</el-col>
-                <el-col :span="4">{{ item.netWeight / 1000 }}</el-col>
-                <el-col :span="4">单包裹体积(m³)</el-col>
-                <el-col :span="2">{{ item.total }}</el-col>
-                <el-col :span="3">总净重(kg)</el-col>
-                <el-col :span="3">总体积(m³)</el-col>
-                <el-col :span="3">
-                  <el-button type="primary" @click="copyBox(item.id)" text>复制包裹</el-button>
-                  <el-button type="danger" @click="handleDel(item.id)" text>删除</el-button>
+  <div>
+    <el-row :gutter="10">
+      <el-col :span="7">
+        <el-card class="box-card">
+          <div style="font-size: 16px; font-weight: 700; margin-bottom: 10px">产品清单</div>
+          <el-table :data="formData.data.skuInfoList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader" height="calc(100vh - 315px)">
+            <el-table-column label="产品规格">
+              <template #default="{ row }">
+                <div>{{ row.skuSpecCode }}</div>
+                <div>{{ row.skuSpecName }}</div>
+              </template>
+            </el-table-column>
+            <el-table-column label="剩余可装箱数" prop="surplusQuantity" align="center" width="110" />
+            <el-table-column label="净重(g)" width="120">
+              <template #default="{ row }">
+                <el-input-number
+                  onmousewheel="return false;"
+                  v-model="row.quantity"
+                  placeholder="净重"
+                  style="width: 100%"
+                  :controls="false"
+                  :min="0"
+                  :precision="0"
+                  :max="row.surplusQuantity" />
+              </template>
+            </el-table-column>
+          </el-table>
+          <div style="font-size: 16px; font-weight: 700; margin: 10px 0">包裹规格信息</div>
+          <el-form :model="formData.data" :rules="rules" label-width="120px" ref="refForm">
+            <el-form-item label="尺寸(cm)" required>
+              <el-row>
+                <el-col :span="8">
+                  <el-form-item label="" prop="length">
+                    <el-input-number
+                      onmousewheel="return false;"
+                      v-model="formData.data.length"
+                      placeholder="长"
+                      style="width: 100%"
+                      :controls="false"
+                      :min="0"
+                      :precision="2" />
+                  </el-form-item>
+                </el-col>
+                <el-col :span="8">
+                  <el-form-item label="" prop="width">
+                    <el-input-number
+                      onmousewheel="return false;"
+                      v-model="formData.data.width"
+                      placeholder="宽"
+                      style="width: 100%"
+                      :controls="false"
+                      :min="0"
+                      :precision="2" />
+                  </el-form-item>
+                </el-col>
+                <el-col :span="8">
+                  <el-form-item label="" prop="height">
+                    <el-input-number
+                      onmousewheel="return false;"
+                      v-model="formData.data.height"
+                      placeholder="高"
+                      style="width: 100%"
+                      :controls="false"
+                      :min="0"
+                      :precision="2" />
+                  </el-form-item>
                 </el-col>
               </el-row>
+            </el-form-item>
+            <el-button type="primary" style="width: 100%" @click="submitPack()" v-preReClick>装包裹</el-button>
+          </el-form>
+        </el-card>
+      </el-col>
+      <el-col :span="17">
+        <el-card class="box-card">
+          <div style="font-size: 16px; font-weight: 700; margin-bottom: 10px">包裹规格数据</div>
+          <div
+            style="max-height: calc(100vh - 190px); overflow-x: hidden; overflow-y: auto"
+            v-if="formData.data.orderEncasementList && formData.data.orderEncasementList.length > 0">
+            <div
+              style="box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1); margin-bottom: 20px"
+              v-for="(item, index) in formData.data.orderEncasementList"
+              :key="index">
+              <div style="background-color: #edf0f5; padding: 4px">
+                <el-row :gutter="4" class="row-top">
+                  <el-col :span="5">单包裹规格格(cm)</el-col>
+                  <el-col :span="4">单包裹净重(kg)</el-col>
+                  <el-col :span="4">单包裹体积(m³)</el-col>
+                  <el-col :span="2">总包裹数</el-col>
+                  <el-col :span="3">总净重(kg)</el-col>
+                  <el-col :span="3">总体积(m³)</el-col>
+                  <el-col :span="3">操作</el-col>
+                </el-row>
+                <el-row :gutter="4" class="row-bottom">
+                  <el-col :span="5">{{ `${item.length}*${item.width}*${item.height}` }}</el-col>
+                  <el-col :span="4">{{ item.netWeight / 1000 }}</el-col>
+                  <el-col :span="4">{{ (item.length * item.width * item.height) / 1000000 }}</el-col>
+                  <el-col :span="2">{{ item.total }}</el-col>
+                  <el-col :span="3">{{ (item.netWeight / 1000) * item.total }}</el-col>
+                  <el-col :span="3">{{ ((item.length * item.width * item.height) / 1000000) * item.total }}</el-col>
+                  <el-col :span="3">
+                    <el-button type="primary" @click="copyPack(item)" text>复制包裹</el-button>
+                    <el-button type="danger" @click="deletePack(item)" text>删除</el-button>
+                  </el-col>
+                </el-row>
+              </div>
+              <div style="background-color: white; border: 1px solid #ebeef5">
+                <el-table
+                  border
+                  :data="item.orderEncasementDetailList"
+                  :row-style="{ height: '35px' }"
+                  :cell-style="{ padding: '0' }"
+                  header-row-class-name="tableHeaderTwo"
+                  :span-method="arraySpanMethod">
+                  <el-table-column label="产品品号" prop="skuSpecCode" width="150" />
+                  <el-table-column label="产品品名" prop="skuSpecName" />
+                  <el-table-column label="打包数量" align="center" width="120">
+                    <template #default="{ row }">
+                      <div>
+                        {{ row.quantity ? row.quantity : 0 }}
+                      </div>
+                    </template>
+                  </el-table-column>
+                  <el-table-column label="总包裹数" align="center" width="120">
+                    <template #default="{ row }">
+                      <div>x {{ item.total }}</div>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </div>
             </div>
           </div>
-        </div>
-      </el-card>
-    </el-col>
-  </el-row>
+        </el-card>
+      </el-col>
+    </el-row>
+
+    <el-dialog title="复制包裹" v-if="openCopy" v-model="openCopy" width="500">
+      <el-form :model="formCopy.data" :rules="rulesCopy" label-width="100px" ref="refCopy">
+        <el-form-item label="复制数量" prop="total">
+          <el-input-number
+            onmousewheel="return false;"
+            v-model="formCopy.data.total"
+            placeholder="请输入复制数量"
+            style="width: 100%"
+            :controls="false"
+            :min="0"
+            :precision="0" />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button @click="openCopy = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitCopy()" size="large" v-preReClick>提 交</el-button>
+      </template>
+    </el-dialog>
+  </div>
 </template>
 
 <script setup>
 import { useRoute } from "vue-router";
-import { ElMessage } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 
 const { proxy } = getCurrentInstance();
 const route = useRoute();
@@ -135,6 +183,22 @@ const getDetails = () => {
   loading.value = true;
   proxy.post("/issueBill/assemblyDetail", { id: route.query.id }).then(
     (res) => {
+      if (res.orderEncasementList && res.orderEncasementList.length > 0) {
+        res.orderEncasementList = res.orderEncasementList.map((item) => {
+          if (item.orderEncasementDetailList && item.orderEncasementDetailList.length > 0) {
+            item.orderEncasementDetailList = item.orderEncasementDetailList.map((itemTwo, index) => {
+              return {
+                ...itemTwo,
+                rowspan: item.orderEncasementDetailList.length,
+                rowIndex: index,
+              };
+            });
+          }
+          return {
+            ...item,
+          };
+        });
+      }
       formData.data = res;
       loading.value = false;
     },
@@ -174,6 +238,63 @@ const submitPack = () => {
     }
   });
 };
+const arraySpanMethod = ({ row, columnIndex }) => {
+  if (columnIndex === 3) {
+    if (row.rowIndex === 0) {
+      return {
+        rowspan: row.rowspan,
+        colspan: 1,
+      };
+    } else {
+      return {
+        rowspan: 0,
+        colspan: 0,
+      };
+    }
+  }
+};
+const openCopy = ref(false);
+const formCopy = reactive({
+  data: {
+    id: "",
+    total: undefined,
+  },
+});
+const rulesCopy = ref({
+  total: [{ required: true, message: "请输入复制数量", trigger: "blur" }],
+});
+const copyPack = (item) => {
+  formCopy.data = {
+    id: item.id,
+    total: undefined,
+  };
+  openCopy.value = true;
+};
+const submitCopy = () => {
+  proxy.$refs.refCopy.validate((valid) => {
+    if (valid) {
+      proxy.post("/issueBill/copyAllowance", formCopy.data).then(() => {
+        openCopy.value = false;
+        ElMessage({ message: "复制成功", type: "success" });
+        getDetails();
+      });
+    }
+  });
+};
+const deletePack = (row) => {
+  ElMessageBox.confirm("你是否确认此操作", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  })
+    .then(() => {
+      proxy.post("/issueBill/deleteAllowance", { id: row.id }).then(() => {
+        ElMessage({ message: "删除成功", type: "success" });
+        getDetails();
+      });
+    })
+    .catch(() => {});
+};
 </script>
 
 <style lang="scss" scoped>
@@ -185,14 +306,18 @@ const submitPack = () => {
   height: 32px;
   line-height: 32px;
 }
-.row-bottom {
-  margin-top: 10px;
-  .el-col {
-    text-align: center;
-    color: red;
-    font-weight: 700;
-    height: 32px;
-    line-height: 32px;
+.row-bottom .el-col {
+  text-align: center;
+  color: red;
+  font-weight: 700;
+  height: 32px;
+  line-height: 32px;
+}
+::v-deep(.tableHeaderTwo) {
+  th {
+    background-color: white !important;
+    height: 35px;
+    padding: 0;
   }
 }
 </style>