From 3c7546e0025709d331bd4fa77c6d3750da4031d0 Mon Sep 17 00:00:00 2001 From: Wayne Date: Thu, 6 Jul 2023 09:41:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=AB=E5=85=A5=E8=AE=80=E5=8D=A1=E6=A9=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 + .env.h888 | 2 + .env.production | 2 + .env.slash | 2 + src/pages/order/Add/index.vue | 814 +++++++++++++++++++ src/pages/order/Info/index.vue | 208 ++--- src/pages/order/components/GoodsSelecter.vue | 72 ++ src/pages/order/index.vue | 3 +- src/pages/order/router/index.js | 7 +- 9 files changed, 1017 insertions(+), 95 deletions(-) create mode 100644 src/pages/order/Add/index.vue create mode 100644 src/pages/order/components/GoodsSelecter.vue diff --git a/.env.development b/.env.development index b0603de..64acd0e 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,5 @@ +VITE_APP_BASE_URL = 'https://shop.h888.fun/' + VITE_APP_IMG_URL = 'https://shop.h888.fun/' VITE_APP_API_URL = 'https://shop.h888.fun/adminapi/v1' diff --git a/.env.h888 b/.env.h888 index b0603de..64acd0e 100644 --- a/.env.h888 +++ b/.env.h888 @@ -1,3 +1,5 @@ +VITE_APP_BASE_URL = 'https://shop.h888.fun/' + VITE_APP_IMG_URL = 'https://shop.h888.fun/' VITE_APP_API_URL = 'https://shop.h888.fun/adminapi/v1' diff --git a/.env.production b/.env.production index dda4167..79b4ff0 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,5 @@ +VITE_APP_BASE_URL = 'https://shop.slash1000.com/' + VITE_APP_IMG_URL = 'https://shop.slash1000.com/' VITE_APP_API_URL = 'https://shop.slash1000.com/adminapi/v1' diff --git a/.env.slash b/.env.slash index dda4167..79b4ff0 100644 --- a/.env.slash +++ b/.env.slash @@ -1,3 +1,5 @@ +VITE_APP_BASE_URL = 'https://shop.slash1000.com/' + VITE_APP_IMG_URL = 'https://shop.slash1000.com/' VITE_APP_API_URL = 'https://shop.slash1000.com/adminapi/v1' diff --git a/src/pages/order/Add/index.vue b/src/pages/order/Add/index.vue new file mode 100644 index 0000000..fad356a --- /dev/null +++ b/src/pages/order/Add/index.vue @@ -0,0 +1,814 @@ + + + + + diff --git a/src/pages/order/Info/index.vue b/src/pages/order/Info/index.vue index 56a8936..2768a66 100644 --- a/src/pages/order/Info/index.vue +++ b/src/pages/order/Info/index.vue @@ -4,41 +4,22 @@
- 前一個訂單 - 後一個訂單 - 打印訂單 + 前一個訂單 + 後一個訂單 + 打印訂單
- + @@ -376,11 +352,7 @@
操作備註:
- + @@ -388,13 +360,8 @@
當前可執行操作:
- {{ opName[v] }} + {{ opName[v] + }} @@ -419,11 +386,10 @@
- + +
+ {{ dialogMessage }} +
@@ -436,7 +402,7 @@
{{ cardInfo.cname }}
{{ cardInfo.ename }}
- +
@@ -453,29 +419,16 @@ 列印卡片 列印標籤 複製Nfc網址 + 製卡 完成
- - 列印 - +
@@ -505,6 +458,7 @@ import { getCardInfo, updateOrder } from "@/api/order"; import { getOrderInfo, getOrderAction, updateOrderAction } from "@/api/order"; import defaultImg from "@/assets/images/logo.png"; +import { ElMessage } from "element-plus"; const route = useRoute(); const router = useRouter(); @@ -540,6 +494,8 @@ const orderInfo = ref({ address: {}, }); +const dialogMessage = ref(""); + const orderAction = ref([]); onMounted(async () => { @@ -633,9 +589,9 @@ const dialogPrintAddrVisible = ref(false); const handleOp = async (op) => { if (op === "prepare") { // if (op === "prepare") { - // router.push({ path: "/printcard", query: { order_sn: orderInfo.value.order_sn } }); - // openPrintCard(orderInfo.value.order_sn); - dialogPrintCardVisible.value = true; + // router.push({ path: "/printcard", query: { order_sn: orderInfo.value.order_sn } }); + // openPrintCard(orderInfo.value.order_sn); + dialogPrintCardVisible.value = true; // } let res = await updateOrderAction({ @@ -651,7 +607,7 @@ const handleOp = async (op) => { } } } else { - console.log('op',op) + console.log('op', op) ElMessageBox.confirm("確認" + opName[op] + "?", "訂單操作", {}) .then(async () => { let res = await updateOrderAction({ @@ -706,7 +662,7 @@ const handleClick = (tab, event) => { const printObj = ref({ id: "printMe", popTitle: "card print", - beforeOpenCallback(vue) {}, + beforeOpenCallback(vue) { }, clickMounted() { size.value = 300; }, @@ -720,7 +676,7 @@ const printObj = ref({ }); const handleFinish = async () => { - + let res = await updateOrderAction({ op: "printcard", order_id: orderInfo.value.order_id, @@ -752,27 +708,28 @@ const printLabel = async () => { let iTop = (window.screen.availHeight - 30 - iHeight) / 2; //視窗的垂直位置; let iLeft = (window.screen.availWidth - 10 - iWidth) / 2; //視窗的水平位置; window.open( - `https://shop.slash1000.com/adminapi/v1/order/printlabel?order_id=${order_id}`, + `${import.meta.env.VITE_APP_BASE_URL}adminapi/v1/order/printlabel?order_id=${order_id}`, "Print Label", "height=" + - iHeight + - ",,innerHeight=" + - iHeight + - ",width=" + - iWidth + - ",innerWidth=" + - iWidth + - ",top=" + - iTop + - ",left=" + - iLeft + - ",status=no,location=no,status=no,menubar=no,toolbar=no,resizable=no,scrollbars=no" + iHeight + + ",,innerHeight=" + + iHeight + + ",width=" + + iWidth + + ",innerWidth=" + + iWidth + + ",top=" + + iTop + + ",left=" + + iLeft + + ",status=no,location=no,status=no,menubar=no,toolbar=no,resizable=no,scrollbars=no" ); } else { changePrintPage("10cm 15cm"); //列印超商標籤 dialogPrintVisible.value = true; - printUrl.value = `https://shop.slash1000.com/adminapi/v1/order/printlabel?order_id=${order_id}`; + printUrl.value = `${import.meta.env.VITE_APP_BASE_URL}adminapi/v1/order/printlabel?order_id=${order_id}`; + } break; } @@ -805,13 +762,55 @@ const changePrintPage = (page) => { head.appendChild(style); }; +const makeNfcCard = async () => { + let nfcReaderUrl = 'http://localhost:8088' + const data = new URLSearchParams(); + //將cardInfo去除掉https:// + let cardInfoUrl = cardInfo.value.nfcurl.replace('https://', '') + data.append('data', cardInfoUrl); + + try { + let res = await fetch(nfcReaderUrl + '/writenfc', { + method: 'POST', + body: data, + }) + + res = await res.json() + + if (res.code !== 200) { + dialogMessage.value = res.error + setTimeout(() => { + dialogMessage.value = "" + }, 3000); + return + } + dialogMessage.value = "製卡成功" + setTimeout(() => { + dialogMessage.value = "" + }, 3000); + return + } catch (e) { + dialogMessage.value = "請確認NFCCard程式是否開啟" + setTimeout(() => { + dialogMessage.value = "" + }, 3000); + } +} + const handleNfcCard = async () => { const { toClipboard } = useClipboard(); try { await toClipboard(cardInfo.value.nfcurl); - return ElMessage.success("複製成功"); + dialogMessage.value = "複製成功" + setTimeout(() => { + dialogMessage.value = "" + }, 2000); + return; } catch (e) { - return ElMessage.error("複製失敗"); + dialogMessage.value = "複製失敗" + setTimeout(() => { + dialogMessage.value = "" + }, 2000); } }; @@ -825,8 +824,7 @@ const handleNfcCard = async () => { margin-bottom: 10px; } -.el-card { -} +.el-card {} table { width: 100%; @@ -834,6 +832,7 @@ table { .nav { display: flex; + .nav-item { margin-right: 10px; // border: 1px solid #666; @@ -846,6 +845,7 @@ table { // border: 1px solid #000; margin: 0px; position: relative; + img { width: 100%; height: 100%; @@ -853,10 +853,12 @@ table { top: 0; left: 0; } + .front { width: 100%; height: 100%; position: absolute; + .front-logo { position: absolute; width: 100px; @@ -889,9 +891,11 @@ table { display: flex; align-items: center; justify-content: center; + .nfcimg { width: 100px; height: 100px; + canvas { width: 100px !important; height: 100px !important; @@ -903,18 +907,21 @@ table { #printAddr { width: 600px; height: 400px; + .addr { .address { font-size: 20px; font-weight: bold; line-height: 100px; } + .name { font-size: 20px; font-weight: bold; line-height: 100px; padding-left: 100px; } + .sender { text-align: right; font-size: 20px; @@ -935,6 +942,7 @@ table { // border: 1px solid #000; margin: 0px; position: relative; + img { width: 100%; height: 100%; @@ -942,10 +950,12 @@ table { top: 0; left: 0; } + .front { width: 100%; height: 100%; position: absolute; + .front-logo { position: absolute; width: 300px; @@ -978,6 +988,7 @@ table { display: flex; align-items: center; justify-content: center; + .nfcimg { width: 300px; height: 300px; @@ -985,8 +996,7 @@ table { } } - #printIframe { - } + #printIframe {} #printAddr { width: 1020px; @@ -997,4 +1007,16 @@ table { .action { margin-top: 10px; } + +.message-override { + z-index: 9999 !important; +} + +.dialog-message { + padding: 10px 5px; + margin-top: -40px; + margin-bottom: 10px; + color: #FF7575; + border: 1px solid #ccc; +} diff --git a/src/pages/order/components/GoodsSelecter.vue b/src/pages/order/components/GoodsSelecter.vue new file mode 100644 index 0000000..c02d4e4 --- /dev/null +++ b/src/pages/order/components/GoodsSelecter.vue @@ -0,0 +1,72 @@ + + + \ No newline at end of file diff --git a/src/pages/order/index.vue b/src/pages/order/index.vue index d1d0cc3..908d600 100644 --- a/src/pages/order/index.vue +++ b/src/pages/order/index.vue @@ -34,7 +34,8 @@ 查詢
- + + diff --git a/src/pages/order/router/index.js b/src/pages/order/router/index.js index 4e7a506..a1e265a 100644 --- a/src/pages/order/router/index.js +++ b/src/pages/order/router/index.js @@ -19,9 +19,14 @@ let routes = [ }, { path: '/info', - name: 'Info', + name: 'OrderInfo', component: ()=> import("../Info/index.vue") }, + { + path: '/add', + name: 'OrderAdd', + component: ()=> import("../Add/index.vue") + }, { path: '/printcard', name: 'PrintCard',