From 599dd44fb0f114b2608035b8fab6d27f3acc28d2 Mon Sep 17 00:00:00 2001
From: wangfukang <15630117759@163.com>
Date: Sun, 20 Sep 2026 11:04:07 +0800
Subject: [PATCH] 1
---
App.vue | 10 +-
components/worker/delivery.vue | 31 +++++
pages/login/login.vue | 3 +
pages/myCenter/setPrint.vue | 134 ++++++++++++++++++++-
pages/shop/orderDetail.vue | 25 +++-
pages/shop/transferDeliveryOrderList.vue | 143 +++++++++++++++++++++--
6 files changed, 329 insertions(+), 17 deletions(-)
diff --git a/App.vue b/App.vue
index f1bb507..04b1661 100644
--- a/App.vue
+++ b/App.vue
@@ -218,8 +218,10 @@
this.globalData.GaoDeKey_amapkey = '52de86da47be2ea547c37dd382025a0c'
// #endif
if(uni.getStorageSync('peisongyuan')) return;
- this.autoConnectPrinter()
- if (!uni.getStorageSync('bluetoothDeviceId')) {
+ if (uni.getStorageSync('printingMethod') != 'cloud') {
+ this.autoConnectPrinter()
+ }
+ if (uni.getStorageSync('printingMethod') != 'cloud' && !uni.getStorageSync('bluetoothDeviceId')) {
uni.showModal({
title: '提示',
content: '您还没有连接打印机,将无法为您打印小票!',
@@ -279,6 +281,10 @@
console.log('JPush print skipped, missing order_id:', JSON.stringify(printData));
return;
}
+ if (uni.getStorageSync('printingMethod') == 'cloud') {
+ console.log('JPush print skipped, cloud print mode:', printData.order_id);
+ return;
+ }
this.globalData.printData.push(printData)
if (!this.globalData.isPrinting) {
this.processPrintQueue()
diff --git a/components/worker/delivery.vue b/components/worker/delivery.vue
index 3839fd5..e5d3f08 100644
--- a/components/worker/delivery.vue
+++ b/components/worker/delivery.vue
@@ -63,6 +63,9 @@
跑腿
+
+ 中转单
+
配送排行
@@ -572,6 +575,10 @@
return '已上线,但还没有勾选参与派单的路线'
}
return '已准备好接收符合范围和佣金的订单'
+ },
+ canTransferOrder() {
+ const worker = uni.getStorageSync('worker')
+ return !!(worker && worker.canTransferOrder == 1)
}
},
filters: {
@@ -764,6 +771,12 @@
url: '/pages/worker/ranking'
})
},
+ goTransferDeliveryOrders() {
+ if (!this.ensureWorkerRegistered()) return
+ uni.navigateTo({
+ url: '/pages/shop/transferDeliveryOrderList?role=worker'
+ })
+ },
goPartTimeRegister() {
if (uni.getStorageSync('worker')) {
uni.navigateTo({
@@ -1533,6 +1546,24 @@
flex-shrink: 0;
}
+ .transfer-delivery-btn {
+ height: 58rpx;
+ line-height: 58rpx;
+ padding: 0 22rpx;
+ border-radius: 999rpx;
+ background: linear-gradient(135deg, #fff2e9 0%, #ffd0a8 100%);
+ box-shadow: 0 10rpx 22rpx rgba(255, 128, 64, 0.14);
+ color: #9a4b13;
+ font-size: 22rpx;
+ font-weight: 900;
+ text-align: center;
+ flex-shrink: 0;
+ }
+
+ .transfer-delivery-btn:active {
+ transform: scale(0.96);
+ }
+
.delivery-ranking-btn:active {
transform: scale(0.96);
}
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 9d0be12..d8a35bf 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -388,6 +388,9 @@
uni.setStorageSync("shopOwnerPhone", item.shopOwnerPhone)
uni.setStorageSync('schoolShop', res.result.shop)
uni.setStorageSync('shopTakeaway', item.shopTakeaway)
+ uni.setStorageSync('printingMethod', item.printingMethod || (res.result.shop && res.result.shop.printingMethod) || 'bluetooth')
+ uni.setStorageSync('cloudPrinterSn', (res.result.shop && res.result.shop.printerSn) || '')
+ uni.setStorageSync('cloudPrinterName', (res.result.shop && res.result.shop.printerName) || '')
uni.setStorageSync('attrId', item.attrId)
uni.setStorageSync('area', JSON.stringify(item))
uni.setStorageSync("isShop", true)
diff --git a/pages/myCenter/setPrint.vue b/pages/myCenter/setPrint.vue
index 9706b79..ce1d597 100644
--- a/pages/myCenter/setPrint.vue
+++ b/pages/myCenter/setPrint.vue
@@ -1,23 +1,36 @@
-
+
+ 打印方式
+
+ 蓝牙打印
+ 云打印
+
+
+
+ {{cloudPrinterSn ? '已绑定云打印机' : '未绑定云打印机'}}
+ {{cloudPrinterName || cloudPrinterSn || '请到后台绑定'}}
+
+
+
{{okAddress ? '已连接设备' : (linkAddress == savedDeviceId ? '正在自动连接' : '已保存设备')}}
{{connectedDeviceName || savedDeviceId}}
-
-
-
+
新设备
{
+ if (res.code == 200 && res.result) {
+ this.printingMethod = res.result.printingMethod || 'bluetooth';
+ this.cloudPrinterSn = res.result.printerSn || '';
+ this.cloudPrinterName = res.result.printerName || '';
+ uni.setStorageSync('printingMethod', this.printingMethod);
+ uni.setStorageSync('cloudPrinterSn', this.cloudPrinterSn);
+ uni.setStorageSync('cloudPrinterName', this.cloudPrinterName);
+ }
+ }).catch(() => {});
+ },
+ changePrintMethod(method) {
+ if (method == this.printingMethod) return;
+ const shopId = uni.getStorageSync('shopId');
+ if (!shopId) {
+ uni.showToast({
+ title: '请先选择店铺',
+ icon: 'none'
+ });
+ return;
+ }
+ this.NB.sendRequest('/app/shop/printConfig', {
+ shopId,
+ printingMethod: method
+ }, false, 'POST', 'application/x-www-form-urlencoded').then(res => {
+ if (res.code == 200 && res.result) {
+ this.printingMethod = res.result.printingMethod || method;
+ this.cloudPrinterSn = res.result.printerSn || '';
+ this.cloudPrinterName = res.result.printerName || '';
+ uni.setStorageSync('printingMethod', this.printingMethod);
+ uni.setStorageSync('cloudPrinterSn', this.cloudPrinterSn);
+ uni.setStorageSync('cloudPrinterName', this.cloudPrinterName);
+ uni.showToast({
+ title: '保存成功',
+ icon: 'none'
+ });
+ } else {
+ uni.showToast({
+ title: res.message || '保存失败',
+ icon: 'none'
+ });
+ }
+ }).catch(() => {});
+ },
+ cloudPrintTest() {
+ const shopId = uni.getStorageSync('shopId');
+ if (!shopId) return;
+ if (this.isCloudPrint) return;
+ this.isCloudPrint = true;
+ this.NB.sendRequest('/app/shop/printTest', {
+ shopId
+ }, false, 'POST', 'application/x-www-form-urlencoded').then(res => {
+ this.isCloudPrint = false;
+ uni.showToast({
+ title: res.message || (res.code == 200 ? '测试打印已发送' : '测试打印失败'),
+ icon: 'none'
+ });
+ }).catch(() => {
+ this.isCloudPrint = false;
+ });
+ },
getData() {
var that = this;
that.startSearch(false);
@@ -282,6 +366,44 @@
padding: 40rpx;
}
+ .print-mode-card {
+ margin-bottom: 30rpx;
+ padding: 24rpx 30rpx;
+ border-radius: 16rpx;
+ background: #fff;
+ }
+
+ .print-mode-title {
+ margin-bottom: 20rpx;
+ font-size: 30rpx;
+ font-weight: 700;
+ color: #333;
+ }
+
+ .print-mode-options {
+ display: flex;
+ }
+
+ .print-mode-option {
+ flex: 1;
+ height: 72rpx;
+ line-height: 72rpx;
+ text-align: center;
+ border-radius: 12rpx;
+ background: #f5f6f7;
+ color: #333;
+ font-size: 28rpx;
+ }
+
+ .print-mode-option.active {
+ background: #3769FF;
+ color: #fff;
+ }
+
+ .print-mode-option+.print-mode-option {
+ margin-left: 20rpx;
+ }
+
.connected-printer {
display: flex;
align-items: center;
diff --git a/pages/shop/orderDetail.vue b/pages/shop/orderDetail.vue
index a00c3ed..431d7aa 100644
--- a/pages/shop/orderDetail.vue
+++ b/pages/shop/orderDetail.vue
@@ -422,7 +422,8 @@
userCoupon: [],
mallRefundRecord: []
},
- mealServingLoading: false
+ mealServingLoading: false,
+ cloudPrintLoading: false
}
},
filters:{
@@ -800,6 +801,10 @@
this.$refs.groupPopup.open()
},
printData(){
+ if (uni.getStorageSync('printingMethod') == 'cloud') {
+ this.cloudPrintData();
+ return;
+ }
// 将消息数据推入打印队列1
let data = {
order_id: this.shopId,
@@ -816,6 +821,24 @@
this.processPrintQueue()
}
},
+ cloudPrintData() {
+ if (this.cloudPrintLoading) return;
+ this.cloudPrintLoading = true;
+ uni.showLoading({
+ title: '云打印发送中...'
+ });
+ this.NB.sendRequest("/mall/order/cloudPrint/" + this.shopId, {}, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
+ uni.hideLoading();
+ this.cloudPrintLoading = false;
+ uni.showToast({
+ title: res.message || (res.code == 200 ? '云打印任务已发送' : '云打印失败'),
+ icon: 'none'
+ });
+ }).catch(() => {
+ uni.hideLoading();
+ this.cloudPrintLoading = false;
+ });
+ },
/**
* 打印队列处理器:取队头数据打印,打印完成后删除队头,继续处理下一条
* 保证同一时间只有一条消息在打印,按接收顺序依次执行
diff --git a/pages/shop/transferDeliveryOrderList.vue b/pages/shop/transferDeliveryOrderList.vue
index fdd0311..809e306 100644
--- a/pages/shop/transferDeliveryOrderList.vue
+++ b/pages/shop/transferDeliveryOrderList.vue
@@ -6,11 +6,13 @@
size="26">
- 中转配送
+ {{isWorkerMode ? '中转单' : '中转配送'}}
- 待送达
- 已送达
+ 待接单
+ 待送达中转点({{transferTodoCount}})
+ 待送达
+ 已送达
@@ -20,6 +22,13 @@
预约配送
#{{item.numberCode}}
+
+ 商家
+
+ {{item.shopName || '-'}}
+ {{item.shopPhone}}
+
+
中转点
{{item.transferAddressName || item.shopName}}
@@ -40,13 +49,20 @@
取餐码
{{item.transferPickupCode || '配送员接单后生成'}}
-
+
配送员
{{item.workerName || '未分配'}}
{{item.workerPhone}}
+
+ 中转员
+
+ {{item.transferWorkerName || '未分配'}}
+ {{item.transferWorkerMobile}}
+
+
用户
@@ -61,12 +77,18 @@
已送达中转点:{{formatTime(item.transferArriveTime)}}
+
+
+ {{item.transferAccepting ? '接单中...' : '接单'}}
+
+
拍照
送达中转点
- 暂无中转配送单
+
+ {{isWorkerMode ? (tab === 'accepted' ? '暂无待送达中转点订单' : '暂无待接中转单') : '暂无中转配送单'}}