|
|
|
@ -426,7 +426,10 @@ |
|
|
|
if (res.code == 200 && res.result != null && res.result != undefined) { |
|
|
|
this.sales = res.result.sale |
|
|
|
this.list = res.result.saleDetailDTOList |
|
|
|
for (var i = 0; i < this.list.length; i++) { |
|
|
|
for (var i = 0; i < this.list.length; i++) { |
|
|
|
if(this.list[i].realPrice != '' && this.list[i].discountAmount == null){ |
|
|
|
this.list[i].discountAmount = this.list[i].realPrice |
|
|
|
} |
|
|
|
for (var m = 0; m < this.list[i].stockLogList1.length; m++) { |
|
|
|
if (this.list[i].productCount == null) { |
|
|
|
this.list[i].productCount = this.list[i].stockLogList1[m].productCount |
|
|
|
@ -549,301 +552,178 @@ |
|
|
|
}, |
|
|
|
//打印小票 |
|
|
|
onPrintSmall() { |
|
|
|
let that = this; |
|
|
|
let strCmd = '' |
|
|
|
that.yNum = 150 |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLLocation(2); |
|
|
|
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, uni.getStorageSync('shopName')) |
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', '100', '24', '0', 0, '客户:' + this.order.name) |
|
|
|
strCmd += blesdk.addCPCLText('280', '100', '24', '0', 0, this.sales.id) |
|
|
|
strCmd += blesdk.addCPCLText('0', '130', '24', '0', 0, '销售:' + this.sales.createByName) |
|
|
|
strCmd += blesdk.addCPCLText('280', '130', '24', '0', 0, '日期:' + this.sales.createTime) |
|
|
|
strCmd += blesdk.addCPCLText('0', '150', '24', '0', 0, |
|
|
|
'=========================================================') |
|
|
|
for (var i = 0; i < this.list.length; i++) { |
|
|
|
if (that.countPrint() < that.printTotal) { |
|
|
|
strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, this.list[i].productName + '(' + |
|
|
|
this.list[i].productSn + ')') |
|
|
|
} else { |
|
|
|
that.yNum = 0 |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
that.bufferData.push(strCmd); |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, this.list[i].productName + '(' + |
|
|
|
this.list[i].productSn + ')') |
|
|
|
|
|
|
|
} |
|
|
|
for (var m = 0; m < this.list[i].stockLogList1.length; m++) { |
|
|
|
if (that.countPrint() < that.printTotal) { |
|
|
|
strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, '□ '+(that.slicePrint( |
|
|
|
this.list[i].stockLogList1[m].attributeList)) + '*' + this.list[i].stockLogList1[m] |
|
|
|
.productCount) |
|
|
|
strCmd += blesdk.addCPCLText('240', that.yNum, '24', '0', 0, '单价:' + this.list[i] |
|
|
|
.discountAmount) |
|
|
|
strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '总价:' + (this.list[i] |
|
|
|
.discountAmount * this.list[i].stockLogList1[m].productCount)) |
|
|
|
} else { |
|
|
|
that.yNum = 0 |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
that.bufferData.push(strCmd); |
|
|
|
strCmd = '' |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '□ '+(that.slicePrint( |
|
|
|
this.list[i].stockLogList1[m].attributeList)) + '*' + this.list[i].stockLogList1[m] |
|
|
|
.productCount) |
|
|
|
strCmd += blesdk.addCPCLText('240', that.yNum, '24', '0', 0, '单价:' + this.list[i] |
|
|
|
.discountAmount) |
|
|
|
strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '总价:' + (this.list[i] |
|
|
|
.discountAmount * this.list[i].stockLogList1[m].productCount)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (that.countPrint() < this.printTotal) { |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, |
|
|
|
'===============================================================') |
|
|
|
} else { |
|
|
|
this.yNum = 0 |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
this.bufferData.push(strCmd); |
|
|
|
strCmd = '' |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, |
|
|
|
'===============================================================') |
|
|
|
} |
|
|
|
if (that.countPrint() < this.printTotal) { |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '总数量:' + this.sales.productCount) |
|
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '总金额:' + this.sales.totalAmount) |
|
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.sales.realAmount) |
|
|
|
} else { |
|
|
|
this.yNum = 0 |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
this.bufferData.push(strCmd); |
|
|
|
strCmd = '' |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', (this.yNum += 30), '24', '0', 0, '总数量:' + this.sales.productCount) |
|
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '总金额' + this.sales.totalAmount) |
|
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.sales.realAmount) |
|
|
|
|
|
|
|
} |
|
|
|
if (that.countPrint() < this.printTotal) { |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '实收:' + this.sales.alreadyEarn) |
|
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.sales.noEarn)) |
|
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.sales.otherExpense)) |
|
|
|
} else { |
|
|
|
this.yNum = 0 |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
this.bufferData.push(strCmd); |
|
|
|
strCmd = '' |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', (this.yNum += 30), '24', '0', 0, '实收:' + this.sales.alreadyEarn) |
|
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.sales.noEarn)) |
|
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.sales.otherExpense)) |
|
|
|
|
|
|
|
} |
|
|
|
if (this.sales.remark) { |
|
|
|
// if (Math.ceil(Number(this.sales.remark.length) / 20) * 30 + this.yNum < this.printTotal) { |
|
|
|
// if (this.sales.remark.length > 20) { |
|
|
|
// let position = 20; |
|
|
|
// let part1 = this.sales.remark.substring(0, position); |
|
|
|
// let part2 = this.sales.remark.substring(position); |
|
|
|
// strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + part1) |
|
|
|
// strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, part2) |
|
|
|
// } else { |
|
|
|
// strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + this.sales.remark) |
|
|
|
// } |
|
|
|
// strCmd += blesdk.addCPCLLocation(0); |
|
|
|
// strCmd += blesdk.addCPCLPrint(); |
|
|
|
// this.bufferData.push(strCmd); |
|
|
|
// } else { |
|
|
|
// this.yNum = 0 |
|
|
|
// strCmd += blesdk.addCPCLLocation(0); |
|
|
|
// strCmd += blesdk.addCPCLPrint(); |
|
|
|
// this.bufferData.push(strCmd); |
|
|
|
// strCmd = '' |
|
|
|
// if (this.sales.remark.length > 20) { |
|
|
|
// let position = 20; |
|
|
|
// let part1 = this.sales.remark.substring(0, position); |
|
|
|
// let part2 = this.sales.remark.substring(position); |
|
|
|
// strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
// strCmd += blesdk.addCPCLLocation(0); |
|
|
|
// strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + part1) |
|
|
|
// strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, part2) |
|
|
|
// } else { |
|
|
|
// strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
// strCmd += blesdk.addCPCLLocation(0); |
|
|
|
// strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + this.sales.remark) |
|
|
|
// } |
|
|
|
// strCmd += blesdk.addCPCLLocation(0); |
|
|
|
// strCmd += blesdk.addCPCLPrint(); |
|
|
|
|
|
|
|
// this.bufferData.push(strCmd); |
|
|
|
|
|
|
|
// } |
|
|
|
if (Math.ceil(Number(this.sales.remark.length) / 20) * 30 + this.yNum < that.printTotal) { |
|
|
|
if (this.sales.remark.length > 20) { |
|
|
|
let position = 20; |
|
|
|
let part1 = this.sales.remark.substring(0, position); |
|
|
|
let part2 = this.sales.remark.substring(position); |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + part1) |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, part2) |
|
|
|
} else { |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + this.sales.remark) |
|
|
|
} |
|
|
|
let that = this; |
|
|
|
let printHeight = 800 |
|
|
|
for(let i=0;i<this.list.length;i++){ |
|
|
|
printHeight += 30 |
|
|
|
for(let m=0;m<this.list[i].stockLogList1.length;m++){ |
|
|
|
printHeight += 30 |
|
|
|
} |
|
|
|
} |
|
|
|
let strCmd = '' |
|
|
|
that.yNum = 300 |
|
|
|
strCmd = blesdk.CreatCPCLPage(1000, printHeight, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLLocation(2); |
|
|
|
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, '') |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLLocation(2); |
|
|
|
strCmd += blesdk.addCPCLText('0', '110', '24', '0', 0, uni.getStorageSync('shopName')) |
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLText('0', '190', '24', '0', 0, '客户:' + this.order.name) |
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('500', '190', '24', '0', 0,'单号:' + this.sales.id) |
|
|
|
strCmd += blesdk.addCPCLText('0', '240', '24', '0', 0, '销售员:' + this.sales.createByName) |
|
|
|
strCmd += blesdk.addCPCLText('500', '240', '24', '0', 0, '日期:' + this.sales.createTime) |
|
|
|
strCmd += blesdk.addCPCLText('0', '300', '24', '0', 0, |
|
|
|
'=================================================================================') |
|
|
|
for (var i = 0; i < this.list.length; i++) { |
|
|
|
|
|
|
|
} else { |
|
|
|
this.yNum = 0 |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
this.bufferData.push(strCmd); |
|
|
|
strCmd = '' |
|
|
|
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, this.list[i].productName + '(' + |
|
|
|
this.list[i].productSn + ')') |
|
|
|
|
|
|
|
for (var m = 0; m < this.list[i].stockLogList1.length; m++) { |
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '□ '+that.slicePrint( |
|
|
|
this.list[i].stockLogList1[m].attributeList)) |
|
|
|
strCmd += blesdk.addCPCLText('220', that.yNum, '24', '0', 0, '数量:'+ this.list[i].stockLogList1[m].productCount) |
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '单价:' + this.list[i] |
|
|
|
.discountAmount) |
|
|
|
strCmd += blesdk.addCPCLText('650', that.yNum, '24', '0', 0, '总价:' + (this.list[i] |
|
|
|
.discountAmount * this.list[i].stockLogList1[m].productCount)) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, |
|
|
|
'=======================================================================================') |
|
|
|
|
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '总数量:' + this.sales.productCount) |
|
|
|
strCmd += blesdk.addCPCLText('300', this.yNum, '24', '0', 0, '总金额:' + this.sales.totalAmount) |
|
|
|
strCmd += blesdk.addCPCLText('630', this.yNum, '24', '0', 0, '应收:' + this.sales.realAmount) |
|
|
|
|
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '实收:' + this.sales.alreadyEarn) |
|
|
|
strCmd += blesdk.addCPCLText('300', this.yNum, '24', '0', 0, '欠款:' + (this.sales.noEarn)) |
|
|
|
strCmd += blesdk.addCPCLText('630', this.yNum, '24', '0', 0, '其他费用:' + (this.sales.otherExpense)) |
|
|
|
|
|
|
|
if (this.sales.remark) { |
|
|
|
if (this.sales.remark.length > 20) { |
|
|
|
let position = 20; |
|
|
|
let part1 = this.sales.remark.substring(0, position); |
|
|
|
let part2 = this.sales.remark.substring(position); |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + part1) |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, part2) |
|
|
|
} else { |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + this.sales.remark) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (that.countPrint() < that.printTotal) { |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, |
|
|
|
'===============================================================') |
|
|
|
} else { |
|
|
|
this.yNum = 0 |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
this.bufferData.push(strCmd); |
|
|
|
strCmd = '' |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, |
|
|
|
'===============================================================') |
|
|
|
} |
|
|
|
'===============================================================================================') |
|
|
|
//店铺地址 |
|
|
|
if (that.countPrint() < that.printTotal) { |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '店铺地址:' + uni.getStorageSync( |
|
|
|
'shopAddress')) |
|
|
|
} else { |
|
|
|
this.yNum = 0 |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
this.bufferData.push(strCmd); |
|
|
|
strCmd = '' |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺地址:' + uni.getStorageSync( |
|
|
|
'shopAddress')) |
|
|
|
} |
|
|
|
|
|
|
|
//店铺电话 |
|
|
|
if (that.countPrint() < that.printTotal) { |
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + uni.getStorageSync( |
|
|
|
'username')) |
|
|
|
} else { |
|
|
|
that.yNum = 0 |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
that.bufferData.push(strCmd); |
|
|
|
strCmd = '' |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺电话:' + uni.getStorageSync( |
|
|
|
'username')) |
|
|
|
} |
|
|
|
|
|
|
|
if(this.qrArr.length != 0){ |
|
|
|
//店铺微信/微信收款/支付宝收款/收款码收款(店铺,微信,支付,收款) |
|
|
|
for (let i = 0; i < this.qrArr.length; i++) { |
|
|
|
//店铺二维码 |
|
|
|
if ((that.yNum + 200) < that.printTotal) { |
|
|
|
console.log('11111') |
|
|
|
strCmd += blesdk.addCPCLQRCode(that.countWidth(i,600/that.qrArr.length), (that.yNum + 50), that.qrArr[i].level, '2', 3, that.qrArr[i].path) //二维码 |
|
|
|
strCmd += blesdk.addCPCLText(that.countWidth(i,600/that.qrArr.length), (that.yNum + 180), '24', '0', 0, that.qrArr[i].name) |
|
|
|
strCmd += blesdk.addCPCLQRCode(that.countWidth(i,1000/that.qrArr.length), (that.yNum + 80), that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码 |
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLText(that.countWidth(i,1000/that.qrArr.length), (that.yNum + 240), '24', '0', 0, that.qrArr[i].name) |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
if(this.qrArr.length == (i+1)){ |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
that.bufferData.push(strCmd); |
|
|
|
} |
|
|
|
} else { |
|
|
|
console.log('2222') |
|
|
|
// that.yNum = 0 |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
that.bufferData.push(strCmd); |
|
|
|
strCmd = '' |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLQRCode(that.countWidth(i,600/that.qrArr.length) , 30, that.qrArr[i].level, '2', 3, that.qrArr[i].path) //二维码 |
|
|
|
strCmd += blesdk.addCPCLText(that.countWidth(i,600/that.qrArr.length), 180, '24', '0', 0, that.qrArr[i].name) |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
that.bufferData.push(strCmd); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
that.bufferData.push(strCmd); |
|
|
|
} |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
that.bufferData = [] |
|
|
|
uni.hideLoading(); |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
that.bufferData = [] |
|
|
|
uni.hideLoading(); |
|
|
|
}) |
|
|
|
|
|
|
|
setTimeout(res=>{ |
|
|
|
uni.closeBLEConnection({ |
|
|
|
deviceId:uni.getStorageSync('deviceId'), |
|
|
|
success(res) { |
|
|
|
console.log(res) |
|
|
|
},fail(err){ |
|
|
|
console.log(err) |
|
|
|
} |
|
|
|
}) |
|
|
|
},5000) |
|
|
|
}, |
|
|
|
countWidth(num,len){ |
|
|
|
return num*len + 20 |
|
|
|
}, |
|
|
|
goPrint(type){ |
|
|
|
let strCmd = '' |
|
|
|
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 1); |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLText('40', '30', '24', '0', 0, '沧州明珠商贸城--快衣店') |
|
|
|
strCmd = blesdk.CreatCPCLPage(1000, 1040, 1, 1); |
|
|
|
strCmd += blesdk.addCPCLSETMAG(3, 3) |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLText('50', '120', '24', '0', 0, '收:' + maskShopName(this.sales.userName)) |
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLText('50', '250', '24', '0', 0, maskPhone(this.order.phone)) |
|
|
|
strCmd += blesdk.addCPCLText('250', '250', '24', '0', 0, '编号:' + this.sales.id) |
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLLocation(2); |
|
|
|
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, '沧州明珠商贸城--快衣店') |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLText('50', '330', '24', '0', 0, this.sales.province + '/' + this.sales.city + '/' + |
|
|
|
strCmd += blesdk.addCPCLText('50', '150', '24', '0', 0, '收货人:' + maskShopName(this.sales.userName)) |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('50', '230', '24', '0', 0, '电话:' + maskPhone(this.order.phone)) |
|
|
|
strCmd += blesdk.addCPCLText('50', '310', '24', '0', 0, '编号:' + this.sales.id) |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('50', '390', '24', '0', 0, this.sales.province + '/' + this.sales.city + '/' + |
|
|
|
this.sales.area) |
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
if(type == 'confirm'){ |
|
|
|
strCmd += blesdk.addCPCLText('50', '410', '24', '0', 0, "*****") |
|
|
|
strCmd += blesdk.addCPCLText('50', '470', '24', '0', 0, "*****") |
|
|
|
}else{ |
|
|
|
if (this.sales.receiveAddress.length > 20) { |
|
|
|
let position = 20; |
|
|
|
let part1 = this.sales.receiveAddress.substring(0, position); |
|
|
|
let part2 = this.sales.receiveAddress.substring(position); |
|
|
|
strCmd += blesdk.addCPCLText('50', '410', '24', '0', 0, part1) |
|
|
|
strCmd += blesdk.addCPCLText('50', '440', '24', '0', 0, part2) |
|
|
|
strCmd += blesdk.addCPCLText('50', '470', '24', '0', 0, part1) |
|
|
|
strCmd += blesdk.addCPCLText('50', '550', '24', '0', 0, part2) |
|
|
|
} else { |
|
|
|
strCmd += blesdk.addCPCLText('50', '410', '24', '0', 0, this.sales.receiveAddress) |
|
|
|
} |
|
|
|
} |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLText('0', '490', '24', '0', 0, '——————————————————————————————') |
|
|
|
strCmd += blesdk.addCPCLText('50', '570', '24', '0', 0, '发货方式:' + (this.sales.companyName ? this.sales |
|
|
|
strCmd += blesdk.addCPCLText('0', '600', '24', '0', 0, '——————————————————————————————') |
|
|
|
strCmd += blesdk.addCPCLText('50', '680', '24', '0', 0, '发货方式:' + (this.sales.companyName ? this.sales |
|
|
|
.companyName : '暂无')) |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
strCmd += blesdk.addCPCLText('0', '650', '24', '0', 0, '——————————————————————————————') |
|
|
|
strCmd += blesdk.addCPCLText('50', '730', '24', '0', 0, '店铺:' + this.sales.shopName) |
|
|
|
strCmd += blesdk.addCPCLText('50', '810', '24', '0', 0, this.sales.createByPhone) |
|
|
|
strCmd += blesdk.addCPCLText('50', '890', '24', '0', 0, '地址:' + this.shopData.shopAddress) |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', '760', '24', '0', 0, '——————————————————————————————') |
|
|
|
strCmd += blesdk.addCPCLText('50', '840', '24', '0', 0, '店铺:' + this.sales.shopName) |
|
|
|
strCmd += blesdk.addCPCLText('50', '920', '24', '0', 0, this.sales.createByPhone) |
|
|
|
strCmd += blesdk.addCPCLText('50', '1000', '24', '0', 0, '地址:' + this.shopData.shopAddress) |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
this.bufferData.push(strCmd); |
|
|
|
@ -852,6 +732,16 @@ |
|
|
|
this.bufferData = [] |
|
|
|
uni.hideLoading(); |
|
|
|
}) |
|
|
|
setTimeout(res=>{ |
|
|
|
uni.closeBLEConnection({ |
|
|
|
deviceId:uni.getStorageSync('deviceId'), |
|
|
|
success(res) { |
|
|
|
console.log(res) |
|
|
|
},fail(err){ |
|
|
|
console.log(err) |
|
|
|
} |
|
|
|
}) |
|
|
|
},5000) |
|
|
|
}, |
|
|
|
xierushuju() { |
|
|
|
let that = this; |
|
|
|
@ -933,11 +823,11 @@ |
|
|
|
}, |
|
|
|
//计算打印机当前行高度 |
|
|
|
countPrint() { |
|
|
|
if ((this.yNum + 50) >= 1040) { |
|
|
|
return this.yNum += 50 |
|
|
|
} else { |
|
|
|
// if ((this.yNum + 50) >= 1040) { |
|
|
|
// return this.yNum += 50 |
|
|
|
// } else { |
|
|
|
return this.yNum += 30 |
|
|
|
} |
|
|
|
// } |
|
|
|
}, |
|
|
|
//截取 |
|
|
|
slicePrint(val) { |
|
|
|
|