1.手机扫码下单打印标签

2.PC桌面端下单打印标签
3.无需打开叫号窗口扫码叫号取餐
This commit is contained in:
gyq
2024-06-22 17:29:34 +08:00
parent 44495c3ee7
commit 328b512411
13 changed files with 212 additions and 50 deletions

View File

@@ -27,9 +27,9 @@
</div>
<div class="search_wrap">
<div class="input">
<el-input placeholder="请输入商品名称查询" prefix-icon="Search" v-model="commdityName" clearable
@input="inputChange"></el-input>
<el-input placeholder="请输入商品名称查询" v-model="commdityName" clearable @input="inputChange"></el-input>
</div>
<el-button :loading="searchLoading" :icon="Search" @click="searchHandle">搜索</el-button>
<!-- <el-button :icon="shopListType == 'text' ? 'PictureRounded' : 'PriceTag'"
@click="changeShopListType"></el-button> -->
</div>
@@ -41,7 +41,8 @@
<div class="item">
<div class="dot" v-if="item.orderCount">{{ item.orderCount }}</div>
<div class="cover" v-if="shopListType == 'img'">
<el-image :src="`${item.coverImg}?x-oss-process=image/resize,m_lfit,w_150,h_150`" class="el_img" fit="cover"></el-image>
<el-image :src="`${item.coverImg}?x-oss-process=image/resize,m_lfit,w_150,h_150`"
class="el_img" fit="cover"></el-image>
</div>
<div class="name"><el-text line-clamp="1">{{ item.name }}</el-text></div>
<div class="item_empty" v-if="shopListType == 'text'"></div>
@@ -52,7 +53,7 @@
</div>
</swiper-slide>
</swiper>
</div>
</div>
<div class="empty">
<el-empty description="空空如也~" v-if="!goodsList.length" />
</div>
@@ -61,6 +62,7 @@
</template>
<script setup>
import { Search } from '@element-plus/icons-vue'
import { ref } from 'vue'
import _ from 'lodash'
import useStorage from "@/utils/useStorage";
@@ -106,6 +108,13 @@ const loopTimer = ref(null)
const showPopover = ref(false)
const inputChange = _.debounce(function () {
searchHandle()
}, 500)
// 搜索
const searchLoading = ref(false)
function searchHandle() {
searchLoading.value = true
goodsList.value = []
goodsPage.value = 1
finish.value = false
@@ -114,7 +123,7 @@ const inputChange = _.debounce(function () {
loopTimer.value = null
updataGoods()
}, 500)
}
// 确认选择规格回调
function skuConfirm(params) {
@@ -279,9 +288,11 @@ async function updataGoods() {
const res2 = await productqueryCommodityInfoAjax()
goodsList.value.push(res2)
}
searchLoading.value = false
} else {
goodsPage.value = currentGoodsIndex.value + 1
goodsList.value[currentGoodsIndex.value] = await productqueryCommodityInfoAjax()
searchLoading.value = false
}
}

View File

@@ -179,8 +179,10 @@ function checkLabelPrint(props) {
let sum = 0
props.carts.map(item => {
for (let i = 0; i < item.number; i++) {
sum++
if (pids.some(el => el == item.categoryId)) {
for (let i = 0; i < item.number; i++) {
sum++
}
}
})
@@ -212,9 +214,11 @@ const printLabel = (list) => {
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
} else {
list.map(item => {
ipcRenderer.send('printerTagSync', JSON.stringify(item))
})
for (let i = 0; i <= list.length - 1; i++) {
setTimeout(() => {
ipcRenderer.send('printerTagSync', JSON.stringify(list[i]))
}, i * 1000)
}
}
}
@@ -236,11 +240,11 @@ async function printHandle() {
printTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
};
checkLabelPrint(data)
if (!checkLocalPrint(printList.value[0].config.deviceName)) {
ElMessage.error("本地打印机无法使用请检查打印机是否正确连接3");
} else {
ipcRenderer.send("printerInfoSync", JSON.stringify(data));
}
// if (!checkLocalPrint(printList.value[0].config.deviceName)) {
// ElMessage.error("本地小票打印机无法使用请检查打印机是否正确连接3");
// } else {
// ipcRenderer.send("printerInfoSync", JSON.stringify(data));
// }
} else {
// ElMessage.error("您还没有添加本地打印设备,将使用网络打印");
try {

View File

@@ -318,8 +318,10 @@ function checkLabelPrint(props) {
let sum = 0
props.skuInfos.map(item => {
for (let i = 0; i < item.num; i++) {
sum++
if (pids.some(el => el == item.categoryId)) {
for (let i = 0; i < item.num; i++) {
sum++
}
}
})
@@ -350,9 +352,11 @@ const printLabel = lodash.throttle(function (list) {
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
} else {
list.map(item => {
ipcRenderer.send('printerTagSync', JSON.stringify(item))
})
for (let i = 0; i <= list.length - 1; i++) {
setTimeout(() => {
ipcRenderer.send('printerTagSync', JSON.stringify(list[i]))
}, i * 1000)
}
}
}, 1500, { leading: true, trailing: false })