Browse Source

充值小票

DESKTOP-T5C0CIA\lhch 1 month ago
parent
commit
3e8c0eb8d6

+ 22 - 4
admin-ui/src/components/payStatusPopup/index.vue

@@ -11,9 +11,15 @@
           <div class="btn" @click="confirm">确认</div>
           <div class="btn" @click="confirm">确认</div>
         </div>
         </div>
         <div class="btn_box" v-else>
         <div class="btn_box" v-else>
-          <div class="btn" @click="setPointer(0)">打印小票</div>
-          <div class="line"></div>
-          <div class="btn" @click="setPointer(1)">打印条码</div>
+          <template v-if="isRecharge">
+            <div class="btn" @click="setPointer(0)">打印小票</div>
+          </template>
+          <template v-else>
+            <div class="btn" @click="setPointer(0)">打印小票</div>
+            <div class="line"></div>
+            <div class="btn" @click="setPointer(1)">打印条码</div>
+          </template>
+        
           <div class="line"></div>
           <div class="line"></div>
           <div class="btn" @click="close">关闭</div>
           <div class="btn" @click="close">关闭</div>
         </div>
         </div>
@@ -133,6 +139,10 @@ export default {
     hideUser: {
     hideUser: {
       type: Boolean,
       type: Boolean,
       default: false
       default: false
+    },
+    isRecharge: {
+      type: Boolean,
+      default: false
     }
     }
   },
   },
   data() {
   data() {
@@ -191,7 +201,6 @@ export default {
       this.type = type
       this.type = type
       this.showPaySuccessBtn = false
       this.showPaySuccessBtn = false
       // this.pointerInfo = info
       // this.pointerInfo = info
-      console.log('aaaaa',info.id)
       if (info.id && !this.hidePointer) {
       if (info.id && !this.hidePointer) {
         this.getClothItemInfo(info)
         this.getClothItemInfo(info)
       }
       }
@@ -308,6 +317,15 @@ export default {
           p_name = pointer.printName
           p_name = pointer.printName
         }
         }
       })
       })
+      if (this.isRecharge) {
+        this.$emit('pointer', {
+          id: this.orderInfo.orderId,
+          appUserInfo: this.appUserInfo,
+          LODOP: this.LODOP,
+          p_name: p_name
+        })
+        return 
+      }
       console.log(this.pointerList, p_name)
       console.log(this.pointerList, p_name)
       getStore(this.orderInfo.orgId).then(res => {
       getStore(this.orderInfo.orgId).then(res => {
         console.log("AAA", res,  this.pointerInfo)
         console.log("AAA", res,  this.pointerInfo)

+ 2 - 0
admin-ui/src/main.js

@@ -51,6 +51,7 @@ import {getUserInfo} from "@/utils/auth";
 import {
 import {
   getUrlParam,
   getUrlParam,
   isEmpty,
   isEmpty,
+  exchangeClothPrinter,
   collectClothPrinter,
   collectClothPrinter,
   sendClothPrinter,
   sendClothPrinter,
   labelPrinter,
   labelPrinter,
@@ -76,6 +77,7 @@ Vue.prototype.handleTree = handleTree
 Vue.prototype.getUrlParam = getUrlParam
 Vue.prototype.getUrlParam = getUrlParam
 Vue.prototype.isEmpty = isEmpty
 Vue.prototype.isEmpty = isEmpty
 Vue.prototype.collectClothPrinter = collectClothPrinter
 Vue.prototype.collectClothPrinter = collectClothPrinter
+Vue.prototype.exchangeClothPrinter = exchangeClothPrinter
 Vue.prototype.sendClothPrinter = sendClothPrinter
 Vue.prototype.sendClothPrinter = sendClothPrinter
 Vue.prototype.labelPrinter = labelPrinter
 Vue.prototype.labelPrinter = labelPrinter
 Vue.prototype.barCodePrinter = barCodePrinter
 Vue.prototype.barCodePrinter = barCodePrinter

+ 78 - 4
admin-ui/src/utils/index.js

@@ -426,6 +426,72 @@ function addDynamicText(width, content) {
   return height
   return height
 }
 }
 
 
+// 充值收据
+export function exchangeClothPrinter(LODOP, data, lodopName) {
+  LODOP.PRINT_INIT(`充值收据`);
+  // 设置打印模板
+  LODOP.SET_PRINT_PAGESIZE(3, 800, 45, '');
+  // 设置打印内容
+  LODOP.ADD_PRINT_TEXT(30, 95, 150, 20, `一七生活 ${data.storeName}`);
+  LODOP.ADD_PRINT_TEXT(55, 135, 50, 20, '充值单');
+   // 开始绘制虚线
+  LODOP.ADD_PRINT_LINE(80, 10, 80, 295, 1, 1);
+  LODOP.ADD_PRINT_TEXT(90, 10, 200, 20, `订单号:${data.orderNo}`);
+  let date = formatDate(new Date().getTime(), 1)
+  LODOP.ADD_PRINT_TEXT(110, 10, 300, 20, `打印日期:${date}`);
+  LODOP.ADD_PRINT_LINE(130, 10, 130, 295, 1, 1);
+  let type = ''
+  if (data.rechargeType == '3') {
+    type = '自定义'
+  }
+  if (data.rechargeType == '0') {
+    type = '套餐'
+  }
+  if (data.rechargeType == '1') {
+    type = '福利金'
+  }
+  LODOP.ADD_PRINT_TEXT(140, 10, 300, 20, `充值类型:${type}`);
+  LODOP.ADD_PRINT_TEXT(160, 10, 300, 20, `充值金额:${data.rechargeAmount || 0};赠送:${data.giveAmount || 0};福利:${data.welfareAmount || 0};`);
+  LODOP.ADD_PRINT_TEXT(180, 10, 300, 20, `支付金额:${data.payAmount}`);
+  let payType = ''
+  if (data.rechargeType == '1') {
+    type = `(福利)${data.welfareAmount}`
+  }else if(data.payType == '0'){
+    payType = '微信 '
+  }else if(data.payType == '1'){
+    payType = '支付宝 '
+  }else if(data.payType == '2'){
+    payType = '现金'
+  }else if(data.payType == '9'){
+     payType = `(现金)${data.cashPayAmount} `
+    if (data.aliPayAmount) {
+      payType += `(支付宝)${data.aliPayAmount}`
+    }
+    if (data.wxPayAmount) {
+      payType += `(微信)${data.wxPayAmount}`
+    }
+  }
+  LODOP.ADD_PRINT_TEXT(200, 10, 300, 20, `支付方式:${payType}`);
+  LODOP.ADD_PRINT_TEXT(220, 10, 300, 20, `订单备注:${data.remark?data.remark:''}`);
+  LODOP.ADD_PRINT_LINE(240, 10, 240, 295, 1, 1);
+  LODOP.ADD_PRINT_TEXT(250, 10, 300, 20, `会员余额:${data.memberPrice || 0}`);
+  LODOP.ADD_PRINT_TEXT(270, 10, 300, 20, `本次充值:${data.rechargeAmount + data.giveAmount + data.welfareAmount}元`);
+  LODOP.ADD_PRINT_TEXT(290, 10, 300, 20, `会员余额:${(data.memberPrice || 0) + data.rechargeAmount + data.giveAmount + data.welfareAmount}元`);
+  LODOP.ADD_PRINT_LINE(310, 10, 310, 295, 1, 1);
+  LODOP.ADD_PRINT_TEXT(320, 10, 300, 20, `会员电话:${data.contactPhone || ''}`);
+  LODOP.ADD_PRINT_TEXT(340, 10, 300, 20, `会员姓名:${data.contactName || ''}`);
+  LODOP.ADD_PRINT_TEXT(360, 10, 300, 20, `会员地址:${data.contactAddress}`);
+
+  LODOP.ADD_PRINT_TEXT(400, 10, 300, 20, `联系电话:${data.sysOrg.contactPhone}`);
+  LODOP.ADD_PRINT_TEXT(420, 10, 300, 20, `本店地址:${data.sysOrg.address || ''}`);
+  LODOP.ADD_PRINT_TEXT(460, 10, 300, 20, `客户签名:`);
+  LODOP.ADD_PRINT_LINE(500, 10, 500, 295, 1, 1);
+  LODOP.ADD_PRINT_TEXT(510, 50, 300, 20, `请仔细阅读店内张贴的取衣凭证注意事项`);
+  LODOP.ADD_PRINT_LINE(530, 10, 530, 295, 1, 1);
+  if (LODOP.SET_PRINTER_INDEXA(lodopName))
+  LODOP.PRINT(); //直接打印
+}
+
 //收衣明细收据
 //收衣明细收据
 export function collectClothPrinter(LODOP, data, lodopName) {
 export function collectClothPrinter(LODOP, data, lodopName) {
   // 创建Lodop打印对象
   // 创建Lodop打印对象
@@ -536,9 +602,10 @@ export function collectClothPrinter(LODOP, data, lodopName) {
   var remarkHeight = addDynamicText(90, `订单备注:${data.remark?data.remark:''}`)
   var remarkHeight = addDynamicText(90, `订单备注:${data.remark?data.remark:''}`)
   height += remarkHeight
   height += remarkHeight
   LODOP.ADD_PRINT_TEXT(height + 210, 10, 300, 50, `客户签名:`);
   LODOP.ADD_PRINT_TEXT(height + 210, 10, 300, 50, `客户签名:`);
-  console.log('aaa', this.LODOP.SET_PRINTER_INDEXA(lodopName))
+  LODOP.ADD_PRINT_LINE(height + 250, 10, height + 250, 295, 1, 1);
+  LODOP.ADD_PRINT_TEXT(height + 260, 50, 300, 20, `请仔细阅读店内张贴的取衣凭证注意事项`);
+  LODOP.ADD_PRINT_LINE(height + 280, 10, height + 280, 295, 1, 1);
   if (this.LODOP.SET_PRINTER_INDEXA(lodopName))
   if (this.LODOP.SET_PRINTER_INDEXA(lodopName))
-    console.log('aaa22')
 
 
   // this.LODOP.PREVIEW(); //打印预览
   // this.LODOP.PREVIEW(); //打印预览
   this.LODOP.PRINT(); //直接打印
   this.LODOP.PRINT(); //直接打印
@@ -708,9 +775,16 @@ export function barCodePrinter(LODOP, data, lodopName){
     })
     })
     _name = item.clothItemName+_name
     _name = item.clothItemName+_name
     let _flaws = ''
     let _flaws = ''
+    let n = 0
     item.orderClothFlaws.forEach(item_n=>{
     item.orderClothFlaws.forEach(item_n=>{
-      _flaws += item_n.clothFlawName+';'
+      if (n < 10) {
+        _flaws += item_n.clothFlawName+';'
+      } 
+      n++
     })
     })
+    if (n >= 10) {
+      _flaws += '...'
+    }
     let junInfo = ''
     let junInfo = ''
     if (item.orderClothAdjunct) {
     if (item.orderClothAdjunct) {
       item.orderClothAdjuncts.forEach(item_n=>{
       item.orderClothAdjuncts.forEach(item_n=>{
@@ -729,7 +803,7 @@ export function barCodePrinter(LODOP, data, lodopName){
 
 
     LODOP.ADD_PRINT_TEXT(top + 30 + i * 110, 280, 400, 15, `附件:${junInfo}`);
     LODOP.ADD_PRINT_TEXT(top + 30 + i * 110, 280, 400, 15, `附件:${junInfo}`);
     LODOP.ADD_PRINT_TEXT(top + 30 + i * 110, 650, 100, 15, `${data.id}-${i+1}`);
     LODOP.ADD_PRINT_TEXT(top + 30 + i * 110, 650, 100, 15, `${data.id}-${i+1}`);
-    LODOP.ADD_PRINT_TEXT(top + 50 + i * 110, 280, 400, 15, `备注:${item.remark}`);
+    LODOP.ADD_PRINT_TEXT(top + 50 + i * 110, 280, 400, 15, `备注:${item.remark}  | ${item.clothSpeedName}`);
     LODOP.ADD_PRINT_TEXT(top + 50 + i * 110, 650, 100, 20, data.sysOrg.name);
     LODOP.ADD_PRINT_TEXT(top + 50 + i * 110, 650, 100, 20, data.sysOrg.name);
   }
   }
 
 

+ 68 - 6
admin-ui/src/views/workbench/workRecharge/index.vue

@@ -320,16 +320,17 @@
                 <el-button @click="cancel">取 消</el-button>
                 <el-button @click="cancel">取 消</el-button>
             </div>
             </div>
         </el-dialog>
         </el-dialog>
-        <pay-status-popup ref="payStatusPopup" hidePointer hideUser @paySuccess="checkIsAllPay"></pay-status-popup>
+        <pay-status-popup ref="payStatusPopup" hideUser isRecharge @paySuccess="checkIsAllPay" @pointer="setPointer"></pay-status-popup>
     </div>
     </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import { listType } from '@/api/recharge/type'
 import { listType } from '@/api/recharge/type'
 import { addUser, findUserByPhoneNumber, getMemberCouponInfoByRecharge, updateUser } from '@/api/app/user'
 import { addUser, findUserByPhoneNumber, getMemberCouponInfoByRecharge, updateUser } from '@/api/app/user'
-import { addOrder, getOrderIsAllPayByOrderNo, getOrderStatusByOrderNo, morePay } from '@/api/recharge/order'
+import { addOrder, getOrderIsAllPayByOrderNo, getOrderStatusByOrderNo, morePay, getOrder } from '@/api/recharge/order'
 import { getRechargeTypeRelationActivityInfo } from '@/api/activity/rechargeItem'
 import { getRechargeTypeRelationActivityInfo } from '@/api/activity/rechargeItem'
 import payStatusPopup from '@/components/payStatusPopup'
 import payStatusPopup from '@/components/payStatusPopup'
+import { getLodop } from '@/utils/lodopUtils'
 
 
 export default {
 export default {
     name: 'workRecharge',
     name: 'workRecharge',
@@ -474,13 +475,32 @@ export default {
                 { label: '微信/支付宝', value: '0', icon: 'el-icon-mobile-phone' },
                 { label: '微信/支付宝', value: '0', icon: 'el-icon-mobile-phone' },
                 { label: '组合支付', value: '9', icon: 'el-icon-wallet' }
                 { label: '组合支付', value: '9', icon: 'el-icon-wallet' }
             ],
             ],
-            quickAmounts: ['100', '200', '500', '1000']
+            quickAmounts: ['100', '200', '500', '1000'],
+            LODOP: null,
+            number: 1,
+            pointerList: [],
         }
         }
     },
     },
     created() {
     created() {
         this.handleUser()
         this.handleUser()
         this.getRechargeList()
         this.getRechargeList()
     },
     },
+    // mounted() {
+    //     this.number = 1
+    //     const printerTime = setInterval(() => {
+    //         this.LODOP = getLodop()
+    //         console.log(this.LODOP )
+    //         this.number++
+    //         if (this.number == 25) {
+    //             clearInterval(printerTime)
+    //         }
+    //         if (this.LODOP) {
+    //             clearInterval(printerTime)
+    //         }
+    //     }, 200)
+
+    //     this.pointerList = JSON.parse(this.$cache.local.get('printerSeting'))
+    // },
     computed: {
     computed: {
         getRechargeTypeInfo() {
         getRechargeTypeInfo() {
             if (this.rechargeFrom.rechargeMealId != null) {
             if (this.rechargeFrom.rechargeMealId != null) {
@@ -617,6 +637,8 @@ export default {
         },
         },
         // 收银
         // 收银
         submitCash() {
         submitCash() {
+            // this.setPrinter(6)
+            // return 
             if (this.appUserInfo == null) {
             if (this.appUserInfo == null) {
                 this.$message.error('请选择客户')
                 this.$message.error('请选择客户')
                 return
                 return
@@ -701,6 +723,44 @@ export default {
             this.openRecharge = true
             this.openRecharge = true
             this.orderNo = null
             this.orderNo = null
         },
         },
+        setPointer(data) {
+            // if (!data.LODOP) {
+            //     this.$modal.msgError('请安装打印机软件')
+            //     return
+            // }
+
+            // let p_name = ''
+
+            // this.pointerList.forEach((pointer) => {
+            //     console.log(pointer)
+            //     if (pointer.printType == 0) {
+            //         p_name = pointer.printName
+            //     }
+            // })
+
+            let sysOrg = {}
+            if (this.userInfoVO.userType == '02') {
+                sysOrg = {
+                    name: this.userInfoVO.storeName,
+                    contactPhone: this.userInfoVO.phonenumber,
+                    user: this.userInfoVO.nickName,
+                }
+            }
+
+            getOrder(data.id).then((response) => {
+                response.data.sysOrg = sysOrg
+                response.data.contactPhone = data.appUserInfo.phoneNumber
+                response.data.contactName = data.appUserInfo.realName
+                response.data.contactAddress = ''
+                if (data.appUserInfo.defaultAddress) {
+                    let defaultAddress = data.appUserInfo.defaultAddress
+                    response.data.contactAddress = `${defaultAddress.province || ''}${ defaultAddress.city|| ''}${ defaultAddress.area|| ''}${ defaultAddress.address|| ''}${ defaultAddress.addressDetail|| ''}`
+                }
+                this.exchangeClothPrinter(data.LODOP, response.data, data.p_name)
+
+            })
+
+        },
         // 结算
         // 结算
         submitSettlement() {
         submitSettlement() {
             const orderRechargePayDTO = {
             const orderRechargePayDTO = {
@@ -777,7 +837,7 @@ export default {
                                 }, 4000)
                                 }, 4000)
                             }
                             }
                             if (response.data.payResult == 200) {
                             if (response.data.payResult == 200) {
-                                this.$refs.payStatusPopup.open(1, response.data)
+                                this.$refs.payStatusPopup.open(1, response.data, this.appUserInfo)
                                 this.checkIsAllPay(this.orderNo)
                                 this.checkIsAllPay(this.orderNo)
                             }
                             }
                             if (response.data.payResult == 101 || response.data.payResult == 0) {
                             if (response.data.payResult == 101 || response.data.payResult == 0) {
@@ -802,7 +862,7 @@ export default {
                         clearInterval(intervalId)
                         clearInterval(intervalId)
                         return
                         return
                     }
                     }
-                    this.$refs.payStatusPopup.open(1, response.data)
+                    this.$refs.payStatusPopup.open(1, response.data, this.appUserInfo)
                     this.checkIsAllPay(this.orderNo)
                     this.checkIsAllPay(this.orderNo)
                     clearInterval(intervalId)
                     clearInterval(intervalId)
                 })
                 })
@@ -840,6 +900,7 @@ export default {
             this.payFrom.thisPayMoney = null
             this.payFrom.thisPayMoney = null
             this.payFrom.aliPayBarcode = null
             this.payFrom.aliPayBarcode = null
             this.payFrom.wxBarcode = null
             this.payFrom.wxBarcode = null
+            this.payFrom.cashPayAmount = ''
         },
         },
         // 取消按钮
         // 取消按钮
         cancel() {
         cancel() {
@@ -877,7 +938,8 @@ export default {
                 wxBarcode: null,
                 wxBarcode: null,
                 aliPayBarcode: null,
                 aliPayBarcode: null,
                 thisPayMoney: 0,
                 thisPayMoney: 0,
-                isUsedCoupon: false
+                isUsedCoupon: false,
+                cashPayAmount: ''
             }
             }
             this.alreadyPayInfo = {
             this.alreadyPayInfo = {
                 alreadyPayWX: 0,
                 alreadyPayWX: 0,