浏览代码

洗衣打印

DESKTOP-T5C0CIA\lhch 1 月之前
父节点
当前提交
d0b609e9b8

+ 4 - 4
admin-ui/.env.development

@@ -7,10 +7,10 @@ ENV = 'development'
 
 # VUE_APP_BASE_API_HOST = 'http://127.0.0.1:9801'
 # VUE_APP_BASE_API = 'http://127.0.0.1:9801'
-# VUE_APP_BASE_API_HOST = 'http://139.224.65.227:8091/prod-api'
-# VUE_APP_BASE_API = 'http://139.224.65.227:8091/prod-api'
-VUE_APP_BASE_API_HOST = 'http://192.168.5.247:9801/'
-VUE_APP_BASE_API = 'http://192.168.5.247:9801/'
+VUE_APP_BASE_API_HOST = 'http://139.224.65.227:8091/prod-api'
+VUE_APP_BASE_API = 'http://139.224.65.227:8091/prod-api'
+# VUE_APP_BASE_API_HOST = 'http://192.168.5.247:9801/'
+# VUE_APP_BASE_API = 'http://192.168.5.247:9801/'
 
 
 # 路由懒加载

+ 1 - 0
admin-ui/src/components/Page/index.vue

@@ -132,6 +132,7 @@ export default {
                     if (this.renderFun) {
                         this.renderFun(data.rows, data)
                     } else {
+                        console.log(data)
                         this.data = data.rows
                     }
                 } else {

+ 3 - 1
admin-ui/src/components/payStatusPopup/index.vue

@@ -191,6 +191,7 @@ export default {
       this.type = type
       this.showPaySuccessBtn = false
       // this.pointerInfo = info
+      console.log('aaaaa',info.id)
       if (info.id && !this.hidePointer) {
         this.getClothItemInfo(info)
       }
@@ -309,7 +310,7 @@ export default {
       })
       console.log(this.pointerList, p_name)
       getStore(this.orderInfo.orgId).then(res => {
-        console.log("AAA", res)
+        console.log("AAA", res,  this.pointerInfo)
         this.pointerInfo.sysOrg = res.data
         // this.pointerInfo.orgName = res.data.name
         this.pointerInfo.memberPrice = this.appUserInfo.rechargeBalance
@@ -319,6 +320,7 @@ export default {
         this.pointerInfo.contactPhone = this.orderInfo.contactPhone
         this.pointerInfo.payType = this.orderInfo.payType
         this.pointerInfo.payTimeType = this.orderInfo.payTimeType
+        this.pointerInfo.payAmount = this.orderInfo.payAmount
         console.log(this.appUserInfo)
         if (this.appUserInfo.defaultAddress) {
           this.pointerInfo.province = this.appUserInfo.defaultAddress.province

+ 67 - 28
admin-ui/src/utils/index.js

@@ -405,6 +405,27 @@ export function getUrlParam(name) {
   return null; //返回参数值
 }
 
+function addDynamicText(width, content) {
+  // 创建一个临时元素来计算文本高度
+  var tempDiv = document.createElement("div");
+  tempDiv.style.position = "absolute";
+  tempDiv.style.left = "-1000px";
+  tempDiv.style.top = "-1000px";
+  tempDiv.style.width = width + "mm"; // 使用与LODOP相同的单位
+  tempDiv.style.fontFamily = "Arial"; // 使用与打印相同的字体
+  tempDiv.style.fontSize = "14px"; // 使用与打印相同的字号
+  tempDiv.style.lineHeight = "1.2"; // 使用与打印相同的行高
+  tempDiv.innerHTML = content;
+  
+  document.body.appendChild(tempDiv);
+  var height = tempDiv.offsetHeight;
+  document.body.removeChild(tempDiv);
+  
+  // 转换为毫米(假设LODOP使用毫米为单位)
+  var heightInMM = height * 0.264583; // 1px ≈ 0.264583mm
+  return height
+}
+
 //收衣明细收据
 export function collectClothPrinter(LODOP, data, lodopName) {
   // 创建Lodop打印对象
@@ -416,7 +437,7 @@ export function collectClothPrinter(LODOP, data, lodopName) {
   //这里3表示纵向打印且纸高“按内容的高度”;800表示纸宽80mm;45表示页底空白4.5mm
 
   // 设置打印内容
-  LODOP.ADD_PRINT_TEXT(30, 95, 150, 20, `一七生活 ${data.orgName}`);
+  LODOP.ADD_PRINT_TEXT(30, 95, 150, 20, `一七生活 ${data.orgName || data.sysOrg.name}`);
   LODOP.ADD_PRINT_TEXT(55, 135, 50, 20, '收衣单');
 
   // 开始绘制虚线
@@ -429,8 +450,9 @@ export function collectClothPrinter(LODOP, data, lodopName) {
   LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
 
   LODOP.ADD_PRINT_TEXT(200, 50, 300, 20, `收衣日期:${data.createTime?data.createTime:'--'}`);
-
-  LODOP.ADD_PRINT_TEXT(230, 50, 300, 20, `预计取衣时间:${data.planSendClothTime?data.planSendClothTime:'--'}`);
+  let planTime = data.planSendClothTime ? data.planSendClothTime : (data.planSendToUserTime || '--')
+  
+  LODOP.ADD_PRINT_TEXT(230, 50, 300, 20, `预计取衣时间:${planTime}`);
 
   LODOP.ADD_PRINT_LINE(255, 10, 255, 295, 1, 1);
 
@@ -439,6 +461,7 @@ export function collectClothPrinter(LODOP, data, lodopName) {
   LODOP.ADD_PRINT_LINE(285, 10, 285, 295, 1, 1);
 
   const top = 305;
+  let height = top
   for(var i = 0; i < data.orderClothDetails.length; i++) {
     let item = data.orderClothDetails[i];
     let _name = ''
@@ -450,16 +473,22 @@ export function collectClothPrinter(LODOP, data, lodopName) {
     item.orderClothFlaws.forEach(item_n=>{
       _flaws += item_n.clothFlawName+';'
     })
-    LODOP.ADD_PRINT_TEXT(top + i * 30, 20, 50, 20, i+1);
-    LODOP.ADD_PRINT_TEXT(top + i * 30, 45, 110, 20, _name);
-    LODOP.ADD_PRINT_TEXT(top + i * 30, 165, 40, 20, `${item.totalPrice}元`);
-    LODOP.ADD_PRINT_TEXT(top + i * 30, 200, 110, 20, _flaws);
+    LODOP.ADD_PRINT_TEXT(height, 20, 50, 20, i+1);
+    LODOP.ADD_PRINT_TEXT(height, 45, 110, 20, _name);
+    LODOP.ADD_PRINT_TEXT(height, 165, 40, 20, `${item.totalPrice}元`);
+    LODOP.ADD_PRINT_TEXT(height, 200, 110, "100%", _flaws);
+    LODOP.SET_PRINT_STYLEA(0, "Autowrap", 1);
+    let h1 = addDynamicText(30, _name)
+    let h2 = addDynamicText(30, _flaws)
+    var actualHeight = h1 > h2 ? h1 : h2
+    height += actualHeight
   }
 
-  const height = top + (data.orderClothDetails.length+1)*20;
+  // const height = top + (data.orderClothDetails.length+1)*20;
   // 合计
   LODOP.ADD_PRINT_TEXT(height + 15, 10, 150, 20, `合计:${data.orderClothDetails.length}件`);
-  LODOP.ADD_PRINT_TEXT(height + 15, 160, 150, 20, `总金额:${data.totalPrice}元`);
+  let totalPrice = data.totalPrice || data.orderAmount
+  LODOP.ADD_PRINT_TEXT(height + 15, 160, 150, 20, `总金额:${totalPrice}元`);
 
   LODOP.ADD_PRINT_LINE(height + 35, 10, height + 35, 295, 1, 1);
 
@@ -483,23 +512,30 @@ export function collectClothPrinter(LODOP, data, lodopName) {
 
   LODOP.ADD_PRINT_TEXT(height + 45, 10, 150, 20, `付款方式:${payTypename}`);
   LODOP.ADD_PRINT_TEXT(height + 45, 160, 150, 20, `会员金额:${data.memberPrice?data.memberPrice+'元':''}`);
-  LODOP.ADD_PRINT_TEXT(height + 75, 10, 150, 20, `本次扣款:${thisPrice?thisPrice+'元':''}`);
+  LODOP.ADD_PRINT_TEXT(height + 75, 10, 150, 20, `本次扣款:${thisPrice?thisPrice+'元':'0'}`);
   LODOP.ADD_PRINT_TEXT(height + 75, 160, 150, 20, `会员余额:${data.memberPrice?data.memberPrice-thisPrice?thisPrice:0 +'元':''}`);
 
-  LODOP.ADD_PRINT_TEXT(height + 105, 10, 150, 20, `客户:${data.contactName}`);
-  LODOP.ADD_PRINT_TEXT(height + 105, 160, 180, 20, `客户电话:${data.contactPhone}`);
-  LODOP.ADD_PRINT_TEXT(height + 135, 10, 300, 20, `客户地址:${data.province+data.city+data.area+data.address+data.addressDetail}`);
-
-  LODOP.ADD_PRINT_LINE(height + 160, 10, height + 160, 295, 1, 1);
-  LODOP.ADD_PRINT_TEXT(height + 170, 10, 300, 20, `本店地址:${data.sysOrg.address?data.sysOrg.address:''}${data.sysOrg.addressDetail?data.sysOrg.addressDetail:''}`);
-  LODOP.ADD_PRINT_TEXT(height + 200, 10, 300, 20, `联系电话:${data.sysOrg.contactPhone}`);
-
-  LODOP.ADD_PRINT_TEXT(height + 230, 10, 180, 20, `营业时间:${data.sysOrg.businessStartTime?data.sysOrg.businessStartTime:''}-${data.sysOrg.businessEndTime?data.sysOrg.businessEndTime:''}`);
-  LODOP.ADD_PRINT_TEXT(height + 230, 200, 120, 20, `员工:${data.createBy?data.createBy:''}`);
-
-  LODOP.ADD_PRINT_LINE(height + 255, 10, height + 255, 295, 1, 1);
-  LODOP.ADD_PRINT_TEXT(height + 265, 10, 300, 20, `订单备注:${data.remark?data.remark:''}`);
-  LODOP.ADD_PRINT_TEXT(height + 300, 10, 300, 50, `客户签名:`);
+  LODOP.ADD_PRINT_TEXT(height + 105, 10, 150, 20, `客户:${data.contactName || data.appUserName}`);
+  LODOP.ADD_PRINT_TEXT(height + 105, 160, 180, 20, `客户电话:${data.contactPhone || data.appUserPhoneNumber}`);
+  LODOP.ADD_PRINT_TEXT(height + 135, 10, 300, 20, `客户地址:${data.province || ''}${ data.city|| ''}${ data.area|| ''}${ data.address|| ''}${ data.addressDetail|| ''}`);
+  var userHeight = addDynamicText(90, `客户地址:${data.province || ''}${ data.city|| ''}${ data.area|| ''}${ data.address|| ''}${ data.addressDetail|| ''}`)
+  height += userHeight
+
+  LODOP.ADD_PRINT_LINE(height + 140, 10, height + 140, 295, 1, 1);
+  console.log(data.sysOrg)
+  LODOP.ADD_PRINT_TEXT(height + 150, 10, 300, 20, `本店地址:${data.sysOrg.address || ''}`);
+  var sysHeight = addDynamicText(90, `本店地址:${data.sysOrg.address || ''}`)
+  height += sysHeight
+  LODOP.ADD_PRINT_TEXT(height + 160, 10, 300, 20, `联系电话:${data.sysOrg.contactPhone}`);
+
+  // LODOP.ADD_PRINT_TEXT(height + 210, 10, 180, 20, `营业时间:${data.sysOrg.businessStartTime?data.sysOrg.businessStartTime:''}-${data.sysOrg.businessEndTime?data.sysOrg.businessEndTime:''}`);
+  // LODOP.ADD_PRINT_TEXT(height + 210, 200, 120, 20, `员工:${data.createBy?data.createBy:''}`);
+
+  LODOP.ADD_PRINT_LINE(height + 185, 10, height + 185, 295, 1, 1);
+  LODOP.ADD_PRINT_TEXT(height + 195, 10, 300, 20, `订单备注:${data.remark?data.remark:''}`);
+  var remarkHeight = addDynamicText(90, `订单备注:${data.remark?data.remark:''}`)
+  height += remarkHeight
+  LODOP.ADD_PRINT_TEXT(height + 210, 10, 300, 50, `客户签名:`);
   console.log('aaa', this.LODOP.SET_PRINTER_INDEXA(lodopName))
   if (this.LODOP.SET_PRINTER_INDEXA(lodopName))
     console.log('aaa22')
@@ -673,12 +709,15 @@ export function barCodePrinter(LODOP, data, lodopName){
     _name = item.clothItemName+_name
     let _flaws = ''
     item.orderClothFlaws.forEach(item_n=>{
-      _flaws += item_n.clothFlawTypeName+';'
+      _flaws += item_n.clothFlawName+';'
     })
     let junInfo = ''
-    item.orderClothAdjuncts.forEach(item_n=>{
-      junInfo += `${item_n.adjunctName}*${item_n.num}`+';'
-    })
+    if (item.orderClothAdjunct) {
+      item.orderClothAdjuncts.forEach(item_n=>{
+        junInfo += `${item_n.adjunctName}*${item_n.num}`+';'
+      })
+    }
+    
 
     //  绘制条码
     LODOP.ADD_PRINT_BARCODE(top + i * 110, 10, 260, 40, '128B', item.washCode);

+ 1 - 1
admin-ui/src/views/order/cloth/collectCloth.vue

@@ -1477,7 +1477,7 @@ export default {
         },
 
         async handleConfirmPay() {
-            // let obj = {"isSpecial":"Y","isAppointment":"N","authCode":"","payType":"2","appUserId":"82034","orderClothItemDTOS":[{"orderClothCraftDTOS":[{"clothCraftId":7,"clothCraftName":"毛毛领","price":20,"isSelect":true}],"orderClothAdjunctDTOS":[{"adjunctId":7,"num":1,"adjunctName":"毛领"}],"orderClothTypeDTOS":[],"clothTypeKeys":[],"specialPrice":0,"clothSpeedMultiple":1,"picNum":0,"isCustomPrice":"N","remark":"","defaultPrice":0,"clothWashModeId":2,"clothWashModeName":"水洗","clothItemId":7168,"id":7168,"name":"文胸","typeId":14,"washId":2,"washName":"水洗","unit":"件","isChangePrice":"N","isCalArea":"N","isSpecial":"N","plusPrice":0,"silkPrice":0,"sheepPrice":0,"childPrice":0,"orderClothColorDTOS":[{"clothColorId":1205,"clothColorName":"银色"}],"clothBrandId":16,"clothBrandName":"耐克","orderClothFlawDTOS":[{"clothFlawId":724,"clothFlawName":"油斑油迹"}],"isHedging":"N","clothSpeedId":1,"index":0,"deductAmount":0,"totalPrice":20,"clothItemName":"文胸"}],"orderCouponDTOS":[],"payTimeType":"0","createById":"105","createBy":"storeAdmin","createTime":"2025-04-10 23:09:18","id":"349","orderNo":"CL1107846939908640768","orderType":"0","orgId":"4","sourceType":"02","factoryId":"1","contactName":"赵策","contactPhone":"13312341234","orderAmount":20,"orderClothPrice":20,"orderClothCount":1,"payAmount":20,"payStatus":"0","orderSource":"OFFLINE","orderStatus":"4","setPriceTime":"2025-04-10 23:09:18","planSendToUserTime":"2025-04-15 23:09:18","takeClothWay":"0","cashDeductAmount":0,"clothSpeedId":"1","clothSpeedName":"普洗","deliveryAmount":0}
+            // let obj = {"isSpecial":"Y","isAppointment":"N","authCode":"","payType":"2","appUserId":"82034","orderClothItemDTOS":[{"orderClothCraftDTOS":[{"clothCraftId":7,"clothCraftName":"毛毛领","price":20,"isSelect":true}],"orderClothAdjunctDTOS":[{"adjunctId":7,"num":1,"adjunctName":"毛领"}],"orderClothTypeDTOS":[],"clothTypeKeys":[],"specialPrice":0,"clothSpeedMultiple":1,"picNum":0,"isCustomPrice":"N","remark":"","defaultPrice":0,"clothWashModeId":2,"clothWashModeName":"水洗","clothItemId":7168,"id":7168,"name":"文胸","typeId":14,"washId":2,"washName":"水洗","unit":"件","isChangePrice":"N","isCalArea":"N","isSpecial":"N","plusPrice":0,"silkPrice":0,"sheepPrice":0,"childPrice":0,"orderClothColorDTOS":[{"clothColorId":1205,"clothColorName":"银色"}],"clothBrandId":16,"clothBrandName":"耐克","orderClothFlawDTOS":[{"clothFlawId":724,"clothFlawName":"油斑油迹"}],"isHedging":"N","clothSpeedId":1,"index":0,"deductAmount":0,"totalPrice":20,"clothItemName":"文胸"}],"orderCouponDTOS":[],"payTimeType":"0","createById":"105","createBy":"storeAdmin","createTime":"2025-04-10 23:09:18","id":"12","orderNo":"CL1107846939908640768","orderType":"0","orgId":"4","sourceType":"02","factoryId":"1","contactName":"赵策","contactPhone":"13312341234","orderAmount":20,"orderClothPrice":20,"orderClothCount":1,"payAmount":20,"payStatus":"0","orderSource":"OFFLINE","orderStatus":"4","setPriceTime":"2025-04-10 23:09:18","planSendToUserTime":"2025-04-15 23:09:18","takeClothWay":"0","cashDeductAmount":0,"clothSpeedId":"1","clothSpeedName":"普洗","deliveryAmount":0}
             // this.$refs.payStatusPopup.open(1, obj, this.appUserInfo);
             // return
             if (this.orderClothItemDTOS.length == 0) {

+ 11 - 10
admin-ui/src/views/order/cloth/orderList.vue

@@ -494,17 +494,17 @@ export default {
                 .catch(() => {})
         },
         btn_lodop(row) {
-            if (this.userInfoVO.userType == '02') {
-                const obj = {
-                    name: this.userInfoVO.storeName,
-                    contactPhone: this.userInfoVO.phonenumber,
-                    user: this.userInfoVO.nickName
-                }
-                row.sysOrg = obj
-            }
+            // if (this.userInfoVO.userType == '02') {
+            //     const obj = {
+            //         name: this.userInfoVO.storeName,
+            //         contactPhone: this.userInfoVO.phonenumber,
+            //         user: this.userInfoVO.nickName,
+            //     }
+            //     row.sysOrg = obj
+            // }
 
             this.pointerInfo = row
-            console.log()
+            console.log(row)
             const _ = this
             listOrderClothItem({ pageSize: 99999, pageNum: 1, orderNo: row.orderNo }).then((res) => {
                 console.log("AAAAA", res)
@@ -531,7 +531,8 @@ export default {
             // console.log(this.pointerList, p_name)
 
             if (type == 0) {
-                this.laundryPrinter(this.LODOP, this.pointerInfo, p_name)
+                this.collectClothPrinter(this.LODOP, this.pointerInfo, p_name)
+                // this.laundryPrinter(this.LODOP, this.pointerInfo, p_name)
             } else {
                 this.barCodePrinter(this.LODOP, this.pointerInfo, p_name)
             }

+ 1 - 1
admin-ui/src/views/order/cloth/searchCloth.vue

@@ -129,7 +129,7 @@
                 <template slot-scope="scope">
                     <el-button type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">详情</el-button>
                     <el-button type="text" icon="el-icon-camera" @click="handphotograph(scope.row)">拍照</el-button>
-                    <el-button type="text" icon="el-icon-printer" v-if="userInfoVO.userType != '00'" @click="btn_pointer_label(scope.row)">标签打印</el-button>
+                    <el-button type="text" icon="el-icon-printer" v-if="userInfoVO.userType == '02'" @click="btn_pointer_label(scope.row)">标签打印</el-button>
                 </template>
             </el-table-column>
         </Page>