From 6e4b859a05e29eb75ff39c340e015265c3be85e9 Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期日, 04 八月 2024 11:51:43 +0800
Subject: [PATCH] update 合伙人、花店端

---
 sub_pages/supplier/print/print-list.vue        |  167 ++++++++++++++++++++-------------
 sub_pages/partner/delivery/delivery-detail.vue |   29 ++++-
 pages.json                                     |   66 +++++++------
 pages/home/components/home-top-flow.vue        |    4 
 4 files changed, 161 insertions(+), 105 deletions(-)

diff --git a/pages.json b/pages.json
index 3b2fb96..7ba042c 100644
--- a/pages.json
+++ b/pages.json
@@ -129,20 +129,18 @@
 			"style": {
 				"navigationBarTitleText": "理赔单详情"
 			}
-		},
-		{
-			"path" : "pages/user/user-bind-wx/user-bind-wx",
-			"style" : 
-			{
-				"navigationBarTitleText" : "绑定微信"
-			}
-		},
-		{
-			"path" : "pages/home/components/home-search",
-			"style" : 
-			{
-				"navigationBarTitleText" : "搜鲜花"
-			}
+		},
+		{
+			"path": "pages/user/user-bind-wx/user-bind-wx",
+			"style": {
+				"navigationBarTitleText": "绑定微信"
+			}
+		},
+		{
+			"path": "pages/home/components/home-search",
+			"style": {
+				"navigationBarTitleText": "搜鲜花"
+			}
 		}
 	],
 	"subPackages": [{
@@ -155,13 +153,13 @@
 					}
 				}
 				// #ifdef PUB_SUPPLIER
-				,{
+				, {
 					"path": "supplier-info/supplier-info",
 					"style": {
 						"navigationBarTitleText": "店铺信息维护",
 						"enablePullDownRefresh": false
 					}
-				},{
+				}, {
 					"path": "supplier-info/supplier-info-update",
 					"style": {
 						"navigationBarTitleText": "信息维护",
@@ -214,14 +212,21 @@
 				}
 				// #endif				
 				// #ifdef PUB_PARTNER
-				,{
+				, {
 					"path": "order-settlement/order-settlement",
 					"style": {
 						"navigationBarTitleText": "账单结算",
 						"enablePullDownRefresh": true
 					}
 				},
+				{
+					"path": "print/print-list",
+					"style": {
+						"navigationBarTitleText": "打印",
+						"enablePullDownRefresh": false
+					}
 
+				},
 				{
 					"path": "order-settlement/order-settlement-detail",
 					"style": {
@@ -248,13 +253,13 @@
 						"navigationBarTitleText": "合伙人推广二维码",
 						"enablePullDownRefresh": false
 					}
-				},
-				{
-					"path": "partner-info/partner-code-v2",
-					"style": {
-						"navigationBarTitleText": "合伙人推广二维码",
-						"enablePullDownRefresh": false
-					}
+				},
+				{
+					"path": "partner-info/partner-code-v2",
+					"style": {
+						"navigationBarTitleText": "合伙人推广二维码",
+						"enablePullDownRefresh": false
+					}
 				},
 
 				{
@@ -291,13 +296,12 @@
 						"navigationBarTitleText": "",
 						"navigationStyle": "custom"
 					}
-				},
-				{
-					"path" : "delivery/station-delivery",
-					"style" : 
-					{
-						"navigationBarTitleText" : "集货站"
-					}
+				},
+				{
+					"path": "delivery/station-delivery",
+					"style": {
+						"navigationBarTitleText": "集货站"
+					}
 				}
 				// #endif
 			]
diff --git a/pages/home/components/home-top-flow.vue b/pages/home/components/home-top-flow.vue
index 3da4952..bd446c6 100644
--- a/pages/home/components/home-top-flow.vue
+++ b/pages/home/components/home-top-flow.vue
@@ -2,7 +2,7 @@
 	<view class="home-top-flow">
 		<view class="item flex" v-for="(item,index) of list" :key="index" @click="toDetail(item)">
 			<view class="img">
-				<image class="img img100" :class="[!item.stock?'':'']" :src="item.cover">
+				<image class="img img100" :class="[!item.stock?'':'']" :src="item.cover" :lazy-load="true">
 				</image>
 				<view class="level">
 					{{ item.levelStr}}
@@ -59,7 +59,7 @@
 		},
 		mounted() {
 			this.listApi = '/api/customer/flower/list'
-			this.page.size = 4
+			this.page.size = 20
 			this.page.current = 1
 			this.getList('post')
 		},
diff --git a/sub_pages/partner/delivery/delivery-detail.vue b/sub_pages/partner/delivery/delivery-detail.vue
index efb714a..59850de 100644
--- a/sub_pages/partner/delivery/delivery-detail.vue
+++ b/sub_pages/partner/delivery/delivery-detail.vue
@@ -140,7 +140,15 @@
 						}
 					}
 				})
+			},
+			printDeliveryOrder(item) {
+				// this.$message.showToast('敬请期待')
+				this.$storage.setItem('cache_delivery_order_print', JSON.stringify(item))
+				uni.navigateTo({
+					url: '/sub_pages/supplier/print/print-list'
+				})
 			}
+			
 		}
 	}
 </script>
@@ -149,9 +157,9 @@
 		<view v-if="dto.id">
 			<view class="delivery-info flex">
 				<view class="flex1 desc">
-					<view>供货商名称:{{ dto.stationName }}</view>
-					<view>订单号:{{ dto.orderNo }}</view>
-					<view>供货商备注:{{ dto.arriveRemarks }}</view>
+					<view>供货商名称:{{ dto.stationName  ||''}}</view>
+					<view>订单号:{{ dto.orderNo  ||''}}</view>
+					<view>供货商备注:{{ dto.arriveRemarks ||''}}</view>
 				</view>
 				<view class="m-l-15 m-r-0 station">
 					<view>{{ dto.stationName }}</view>
@@ -182,10 +190,10 @@
 								<view class="value">{{ item.num || 0 }}</view>
 
 							</view>
-							<view class="each-item">
+						<!-- 	<view class="each-item">
 								<view class="label">价格</view>
 								<view class="value">{{ item.price || '-' }}</view>
-							</view>
+							</view> -->
 						</view>
 					</view>
 				</view>
@@ -196,6 +204,12 @@
 					<view class="button text-center" v-for="button of check_status" :key="button.value"
 						@click.stop="clickCheck(item,button.value)">{{ button.label }}
 					</view>
+				</view>
+				<view class="line-gray">
+				
+				</view>
+				<view class="buttons">
+					<view class="button button-0 m-r-0" @click="printDeliveryOrder(item)">打印</view>
 				</view>
 			</view>
 		</view>
@@ -280,6 +294,11 @@
 					color: #666666;
 					line-height: 34rpx;
 				}
+				.button-0 {
+					color: #fff;
+					border: 2rpx solid #20613D;
+					background: #20613D;					
+				}
 			}
 
 			.flower-img {
diff --git a/sub_pages/supplier/print/print-list.vue b/sub_pages/supplier/print/print-list.vue
index 431f6a0..37e68f7 100644
--- a/sub_pages/supplier/print/print-list.vue
+++ b/sub_pages/supplier/print/print-list.vue
@@ -114,6 +114,7 @@
 				notifyCharaterId: {},
 				notifyServiceId: '',
 				BserviceId: '',
+				buffs: [],
 			}
 		},
 		/**
@@ -476,67 +477,92 @@
 					}
 				})
 			},
-			openControl() {
+			async openControl() {
 				//打印
+
 				var that = this;
+				if (that.item.num < 0) {
+					that.$message.showToast('打印数目不能小于0')
+					return
+				}
+				if (that.item.num > 3) {
+					await that.$message.confirm(`打印数目为${that.item.num}张,确定打印吗`)
+				}
+				that.buffs = []
+				for (var i = 0; i < that.item.num; i++) {
 
-				var command = tsc.jpPrinter.createNew()
-				command.setSize(48, 60)
-				command.setGap(0)
-				command.setCls()
-				// command.setText(0, 30, "TSS24.BF2", 1, 1, "图片")
-				// command.setQR(40, 120, "L", 5, "A", "www.smarnet.cc佳博智汇")
-				// command.setText(60, 20, "TSS24.BF2", 1, 1, "单号:" + (that.item.orderNo || '-'))
-				if (that.item.warehouseName)
-					command.setText(10, 20, "TSS24.BF2", 1, 1, "仓库: " + that.item.warehouseName)
-				if (that.item.warehouseLocationCode)
-					command.setText(200, 20, "TSS24.BF2", 1, 1, "库位: " + that.item.warehouseLocationCode)
 
-				// command.setText(170, 50, "TSS24.BF2", 1, 1, "小程序测试")
-				// command.setText(170, 90, "TSS24.BF2", 1, 1, "测试数字12345678")
-				// command.setText(170, 120, "TSS24.BF2", 1, 1, "测试英文abcdefg")
-				// command.setText(170, 150, "TSS24.BF2", 1, 1, "测试符号/*-+!@#$")
-				command.setText(10, 60, "TSS24.BF2", 1, 1, "供应商: " + (that.item.supplierName || '-'))
-				command.setText(10, 100, "TSS24.BF2", 1, 1, "商品名称: " + (that.item.flowerName || '-'))
-				command.setText(10, 140, "TSS24.BF2", 1, 1, "等级: " + (that.item.flowerLevelStr || '-'))
-				command.setText(200, 140, "TSS24.BF2", 1, 1, "颜色: " + (that.item.flowerColor || '-'))
-				// command.setText(10, 220, "TSS24.BF2", 1, 1, "价格: ¥ " + (that.item.price || '-'))
-				command.setText(10, 180, "TSS24.BF2", 1, 1, "规格: " + (that.item.flowerUnit || '-'))
-				command.setText(200, 180, "TSS24.BF2", 1, 1, "数目: x " + (that.item.num || '0'))
-				// command.setText(10, 300, "TSS24.BF2", 1, 1, "花满芫")
-				command.setText(100, 220, "TSS24.BF2", 1, 1, that.$util.toDateMin(new Date()))
-				if (that.item.params) {
-					var addnum = 0
-					var hlen = 220
-					for (var p of that.item.params) {
-						if (p.name !== '枝长' && p.name !== '成熟度') {
-							continue
-						}
-						if (p.value) {
-							var lef = 10
-							if (addnum % 2 == 1) {
-								lef = 190
-							} else {
-								lef = 10
-								hlen += 40
+
+					var command = tsc.jpPrinter.createNew()
+
+					//根据数目不同,打印不同数目
+
+					command.setSize(48, 60)
+					command.setGap(0)
+					command.setCls()
+					// command.setText(0, 30, "TSS24.BF2", 1, 1, "图片")
+					// command.setQR(40, 120, "L", 5, "A", "www.smarnet.cc佳博智汇")
+					// command.setText(60, 20, "TSS24.BF2", 1, 1, "单号:" + (that.item.orderNo || '-'))
+					// 仓库:
+					if (that.item.warehouseName)
+						command.setText(20, 20, "TSS24.BF2", 1, 1, "" + that.item.warehouseName)
+					// 库位: 
+					if (that.item.warehouseLocationCode)
+						command.setText(200, 20, "TSS24.BF2", 1, 1, "" + that.item.warehouseLocationCode)
+
+					// command.setText(170, 50, "TSS24.BF2", 1, 1, "小程序测试")
+					// command.setText(170, 90, "TSS24.BF2", 1, 1, "测试数字12345678")
+					// command.setText(170, 120, "TSS24.BF2", 1, 1, "测试英文abcdefg")
+					// command.setText(170, 150, "TSS24.BF2", 1, 1, "测试符号/*-+!@#$")
+
+					// 供应商: 
+					command.setText(20, 60, "TSS24.BF2", 1, 1, "" + (that.item.supplierName || '-'))
+					// 商品名称: 
+					command.setText(20, 100, "TSS24.BF2", 1, 1, "" + (that.item.flowerName || '-'))
+					command.setText(20)
+					// 颜色: 
+					command.setText(200, 140, "TSS24.BF2", 1, 1, "" + (that.item.flowerColor || '-'))
+					// command.setText(10, 220, "TSS24.BF2", 1, 1, "价格: ¥ " + (that.item.price || '-'))
+					command.setText(20, 180, "TSS24.BF2", 1, 1, "规格: " + (that.item.flowerUnit || '-'))
+					command.setText(200, 180, "TSS24.BF2", 1, 1, `数目: ${i+1}/${that.item.num}`)
+					// command.setText(10, 300, "TSS24.BF2", 1, 1, "花满芫")
+					command.setText(100, 220, "TSS24.BF2", 1, 1, that.$util.toDateMin(new Date()))
+					if (that.item.params) {
+						var addnum = 0
+						var hlen = 220
+						for (var p of that.item.params) {
+							if (p.name !== '枝长' && p.name !== '成熟度') {
+								continue
 							}
-							command.setText(lef, hlen, "TSS24.BF2", 1, 1, "" + (p.name || '') + ':' + p.value)
-							addnum += 1
+							if (p.value) {
+								var lef = 20
+								if (addnum % 2 == 1) {
+									lef = 190
+								} else {
+									lef = 20
+									hlen += 40
+								}
+								command.setText(lef, hlen, "TSS24.BF2", 1, 1, "" + (p.name || '') + ':' + p.value)
+								addnum += 1
+							}
 						}
 					}
+					// <view class="delivery-form" v-if="item.params">
+					// 	<view class="form-item" v-for="(p,k) of item.params" :key="k">
+					// 		<view class="label">{{p.name||'-'}}:</view>
+					// 		<view class="value red">{{p.value}}</view>
+					// 	</view>
+					// </view>
+					// command.setBar(170, 180, "EAN8", 64, 1, 3, 3, "1234567")
+
+					command.setPagePrint()
+
+					that.buffs.push(command.getData())
 				}
-				// <view class="delivery-form" v-if="item.params">
-				// 	<view class="form-item" v-for="(p,k) of item.params" :key="k">
-				// 		<view class="label">{{p.name||'-'}}:</view>
-				// 		<view class="value red">{{p.value}}</view>
-				// 	</view>
-				// </view>
-				// command.setBar(170, 180, "EAN8", 64, 1, 3, 3, "1234567")
-
-				command.setPagePrint()
-
 				that.isLabelSend = true
-				that.prepareSend(command.getData())
+				// that.prepareSend(command.getData())
+
+				that.prepareSend(that.buffs[0])
 
 				// wx.canvasGetImageData({
 				//   canvasId: 'edit_area_canvas',
@@ -610,22 +636,29 @@
 							wx.showToast({
 								title: '已打印第' + currentPrint + '张',
 							})
-							// if (currentPrint == printNum) {
-							that.looptime = 0
-							that.lastData = 0
-							that.currentTime = 1
-							that.isReceiptSend = false
-							that.isLabelSend = false
-							that.currentPrint = 1
-							try {
-								wx.closeBLEConnection({
-									deviceId: that.deviceId,
-									success: function(res) {
-										console.log("关闭蓝牙成功")
-									},
-								})
-							} catch (e) {
+							if (currentPrint == buffs.length) {
 
+								that.looptime = 0
+								that.lastData = 0
+								that.currentTime = 1
+								that.isReceiptSend = false
+								that.isLabelSend = false
+								that.currentPrint = 1
+								try {
+									wx.closeBLEConnection({
+										deviceId: that.deviceId,
+										success: function(res) {
+											console.log("关闭蓝牙成功")
+										},
+									})
+								} catch (e) {
+
+								}
+							} else {
+								currentPrint++
+								that.currentPrint = currentPrint
+								that.currentTime = 1
+								that.Send(that.buffs[that.currentPrint - 1])
 							}
 
 							// } else {

--
Gitblit v1.9.3