|
@@ -38,10 +38,10 @@
|
|
|
action: () => clickPrint(),
|
|
|
type: 'warning',
|
|
|
},
|
|
|
- {
|
|
|
- text: '填写线下快递单号',
|
|
|
- action: () => clickFillInExpressCode(),
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // text: '填写线下快递单号',
|
|
|
+ // action: () => clickFillInExpressCode(),
|
|
|
+ // },
|
|
|
]"
|
|
|
@get-list="getList"
|
|
|
@clickReset="clickReset">
|
|
@@ -141,7 +141,7 @@
|
|
|
<el-form :model="formExpress.data" :rules="rulesExpress" label-width="100px" ref="refExpress">
|
|
|
<el-form-item label="快递" prop="expressDeliveryId">
|
|
|
<el-select v-model="formExpress.data.expressDeliveryId" placeholder="请选择快递" style="width: 100%">
|
|
|
- <el-option v-for="item in useUserStore().allDict['express_delivery']" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
|
|
|
+ <el-option v-for="item in expressDeliveryList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -151,10 +151,10 @@
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <el-dialog title="修改快递" v-if="openExpressCode" v-model="openExpressCode" width="500">
|
|
|
+ <el-dialog title="修改快递单号" v-if="openExpressCode" v-model="openExpressCode" width="500">
|
|
|
<el-form :model="formExpressCode.data" :rules="rulesExpressCode" label-width="100px" ref="refExpressCode">
|
|
|
- <el-form-item label="快递单号" prop="expressDeliveryCode">
|
|
|
- <el-input v-model="formExpressCode.data.expressDeliveryCode" placeholder="请输入快递单号" />
|
|
|
+ <el-form-item label="快递单号" prop="trackingNumber">
|
|
|
+ <el-input v-model="formExpressCode.data.trackingNumber" placeholder="请输入快递单号" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
@@ -162,6 +162,61 @@
|
|
|
<el-button type="primary" @click="submitExpressCode()" size="large" v-preReClick>保 存</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="打印快递面单" v-if="openPrint" v-model="openPrint" width="80%">
|
|
|
+ <el-table :data="orderEncasementList" :row-style="{ height: '35px' }" :cell-style="{ padding: '0' }" header-row-class-name="tableHeader">
|
|
|
+ <el-table-column label="订单号" align="center">
|
|
|
+ <template #default="{}">
|
|
|
+ <div>
|
|
|
+ {{ selectData[0].code }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="包裹单号" prop="number" align="center" />
|
|
|
+ <el-table-column label="快递单号" prop="trackingNumber" align="center" />
|
|
|
+ <el-table-column label="商品总数" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div>
|
|
|
+ <span v-if="row.orderEncasementDetailList && row.orderEncasementDetailList.length > 0">
|
|
|
+ {{
|
|
|
+ row.orderEncasementDetailList
|
|
|
+ .map((item) => item.quantity)
|
|
|
+ .reduce(function (prev, cur) {
|
|
|
+ return prev + cur;
|
|
|
+ }, 0)
|
|
|
+ }}
|
|
|
+ </span>
|
|
|
+ <span v-else>0</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="净重(kg)" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div>
|
|
|
+ {{ row.netWeight / 1000 }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="体积(m³)" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div>
|
|
|
+ {{ (row.length * row.width * row.height) / 1000000 }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" width="220">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div>
|
|
|
+ <el-button type="primary" @click="clickNewbiePrint(row)" text v-preReClick>打印面单</el-button>
|
|
|
+ <el-button type="primary" @click="clickFillInExpressCode(row)" text v-preReClick>填写线下快递单号</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openPrint = false" size="large">关 闭</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</el-card>
|
|
|
</template>
|
|
|
|
|
@@ -172,6 +227,7 @@ import PackTotal from "/src/views/production/shipment/print-order/packTotal.vue"
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
|
|
|
+const expressDeliveryList = ref([]);
|
|
|
const sourceList = ref({
|
|
|
data: [],
|
|
|
pagination: {
|
|
@@ -180,7 +236,6 @@ const sourceList = ref({
|
|
|
pageSize: 10,
|
|
|
code: "",
|
|
|
departmentId: "",
|
|
|
- expressDeliveryCode: "",
|
|
|
printStatus: "",
|
|
|
beginTime: "",
|
|
|
endTime: "",
|
|
@@ -201,11 +256,6 @@ const searchConfig = computed(() => {
|
|
|
label: "事业部",
|
|
|
},
|
|
|
{
|
|
|
- type: "input",
|
|
|
- prop: "expressDeliveryCode",
|
|
|
- label: "快递单号",
|
|
|
- },
|
|
|
- {
|
|
|
type: "select",
|
|
|
prop: "printStatus",
|
|
|
data: [
|
|
@@ -288,13 +338,6 @@ const config = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
- label: "快递单号",
|
|
|
- prop: "expressDeliveryCode",
|
|
|
- width: 130,
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- attrs: {
|
|
|
label: "店铺来源",
|
|
|
prop: "sourcePlatform",
|
|
|
width: 120,
|
|
@@ -398,6 +441,17 @@ const getDemandData = () => {
|
|
|
);
|
|
|
}
|
|
|
});
|
|
|
+ proxy.post("/expressDelivery/page", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
|
+ if (res.rows && res.rows.length > 0) {
|
|
|
+ expressDeliveryList.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ dictKey: item.id,
|
|
|
+ dictValue: item.expressage,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
getDemandData();
|
|
|
const getList = async (req, status) => {
|
|
@@ -676,32 +730,137 @@ const submitExpress = () => {
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
+const openPrint = ref(false);
|
|
|
+const orderEncasementList = ref([]);
|
|
|
const clickPrint = () => {
|
|
|
- console.log("打印快递单");
|
|
|
+ if (selectData.value && selectData.value.length > 0) {
|
|
|
+ if (selectData.value.length > 1) {
|
|
|
+ return ElMessage("每次只能选一个");
|
|
|
+ }
|
|
|
+ getAssemblyDetail();
|
|
|
+ openPrint.value = true;
|
|
|
+ } else {
|
|
|
+ return ElMessage("请先选择需要打印快递单的订单");
|
|
|
+ }
|
|
|
+};
|
|
|
+const getAssemblyDetail = () => {
|
|
|
+ orderEncasementList.value = [];
|
|
|
+ proxy.post("/issueBill/assemblyDetail", { id: selectData.value[0].id }).then((res) => {
|
|
|
+ orderEncasementList.value = res.orderEncasementList;
|
|
|
+ });
|
|
|
+};
|
|
|
+const ws = ref("");
|
|
|
+const initWebSocket = (status, request) => {
|
|
|
+ ws.value = new WebSocket("ws://localhost:13528");
|
|
|
+ ws.value.onopen = (e) => {
|
|
|
+ console.log("建立连接", e);
|
|
|
+ if (status) {
|
|
|
+ send(request);
|
|
|
+ }
|
|
|
+ };
|
|
|
+};
|
|
|
+initWebSocket();
|
|
|
+const send = (request) => {
|
|
|
+ ws.value.send(JSON.stringify(request));
|
|
|
+};
|
|
|
+const getUUID = (len, radix) => {
|
|
|
+ var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
|
|
|
+ var uuid = [],
|
|
|
+ i;
|
|
|
+ radix = radix || chars.length;
|
|
|
+ if (len) {
|
|
|
+ for (i = 0; i < len; i++) uuid[i] = chars[0 | (Math.random() * radix)];
|
|
|
+ } else {
|
|
|
+ var r;
|
|
|
+ uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
|
|
|
+ uuid[14] = "4";
|
|
|
+ for (i = 0; i < 36; i++) {
|
|
|
+ if (!uuid[i]) {
|
|
|
+ r = 0 | (Math.random() * 16);
|
|
|
+ uuid[i] = chars[i == 19 ? (r & 0x3) | 0x8 : r];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return uuid.join("");
|
|
|
+};
|
|
|
+const getRequestObject = (cmd = "print") => {
|
|
|
+ var request = new Object();
|
|
|
+ request.requestID = getUUID(8, 16);
|
|
|
+ request.version = "1.0";
|
|
|
+ request.cmd = cmd;
|
|
|
+ return request;
|
|
|
+};
|
|
|
+const clickNewbiePrint = (row) => {
|
|
|
+ if (selectData.value[0].expressDeliveryId) {
|
|
|
+ let printer = "";
|
|
|
+ let list = expressDeliveryList.value.filter((item) => item.id === selectData.value[0].expressDeliveryId);
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ if (list[0].printer) {
|
|
|
+ printer = list[0].printer;
|
|
|
+ } else {
|
|
|
+ return ElMessage("该快递网点暂未设置打印机");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return ElMessage("请先设置快递");
|
|
|
+ }
|
|
|
+ proxy.post("/cainiao/takeNum", { id: row.id }).then((res) => {
|
|
|
+ let request = getRequestObject();
|
|
|
+ request.task = new Object();
|
|
|
+ request.task.taskID = getUUID(8, 10);
|
|
|
+ request.task.preview = false;
|
|
|
+ request.task.printer = printer;
|
|
|
+ let documents = [];
|
|
|
+ let list = res;
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ if (list[i].packingList && list[i].packingList.length > 0) {
|
|
|
+ for (let j = 0; j < list[i].packingList.length; j++) {
|
|
|
+ if (list[i].packingList[j].detail || list[i].packingList[j].customTemplateUrl) {
|
|
|
+ documents.push({
|
|
|
+ documentID: list[i].packingList[j].data.waybillCode,
|
|
|
+ contents: [
|
|
|
+ list[i].packingList[j],
|
|
|
+ {
|
|
|
+ data: {
|
|
|
+ detail: list[i].packingList[j].detail,
|
|
|
+ },
|
|
|
+ templateURL: list[i].packingList[j].customTemplateUrl,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ documents.push({
|
|
|
+ documentID: list[i].packingList[j].data.waybillCode,
|
|
|
+ contents: [list[i].packingList[j]],
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ request.task.documents = documents;
|
|
|
+ if (ws.value.readyState !== 1) {
|
|
|
+ initWebSocket(true, request);
|
|
|
+ } else {
|
|
|
+ send(request);
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
const openExpressCode = ref(false);
|
|
|
const formExpressCode = reactive({
|
|
|
data: {
|
|
|
id: "",
|
|
|
- expressDeliveryCode: "",
|
|
|
+ trackingNumber: "",
|
|
|
},
|
|
|
});
|
|
|
const rulesExpressCode = ref({
|
|
|
- expressDeliveryCode: [{ required: true, message: "请输入快递单号", trigger: "blur" }],
|
|
|
+ trackingNumber: [{ required: true, message: "请输入快递单号", trigger: "blur" }],
|
|
|
});
|
|
|
-const clickFillInExpressCode = () => {
|
|
|
- if (selectData.value && selectData.value.length > 0) {
|
|
|
- if (selectData.value.length > 1) {
|
|
|
- return ElMessage("每次只能选一个");
|
|
|
- }
|
|
|
- formExpressCode.data = {
|
|
|
- id: selectData.value[0].id,
|
|
|
- expressDeliveryCode: selectData.value[0].expressDeliveryCode,
|
|
|
- };
|
|
|
- openExpressCode.value = true;
|
|
|
- } else {
|
|
|
- return ElMessage("请先选择需要填写快递单号的订单");
|
|
|
- }
|
|
|
+const clickFillInExpressCode = (row) => {
|
|
|
+ formExpressCode.data = {
|
|
|
+ id: row.id,
|
|
|
+ trackingNumber: row.trackingNumber,
|
|
|
+ };
|
|
|
+ openExpressCode.value = true;
|
|
|
};
|
|
|
const submitExpressCode = () => {
|
|
|
proxy.$refs.refExpressCode.validate((valid) => {
|
|
@@ -709,7 +868,7 @@ const submitExpressCode = () => {
|
|
|
proxy.post("/issueBill/editExpressDeliveryCode", formExpressCode.data).then(() => {
|
|
|
openExpressCode.value = false;
|
|
|
ElMessage({ message: "保存成功", type: "success" });
|
|
|
- getList();
|
|
|
+ getAssemblyDetail();
|
|
|
});
|
|
|
}
|
|
|
});
|