|
|
|
@ -244,7 +244,7 @@ |
|
|
|
<kk-printer ref="kkprinter" :bufferData="bufferData" :defaultText="'贴包单'" @onPrint="onPrint"></kk-printer> |
|
|
|
</view> |
|
|
|
<view class="tui-btn-mr" v-if="sales.status != 6 && sales.status != 2"> |
|
|
|
<kk-printer ref="kkprinter" :bufferData="bufferData" :defaultText="'打印小票'" @onPrint="onPrintSmall"></kk-printer> |
|
|
|
<kk-printer ref="kkprinter" :bufferData="bufferData" :defaultText="'打印小票'" @onPrintSmall="onPrintSmall"></kk-printer> |
|
|
|
</view> |
|
|
|
<view class="tui-btn-mr" v-if="sales.status == 0 || sales.status == 1" @click="cancelOrder">取消订单</view> |
|
|
|
<view class="tui-btn-mr" v-if="sales.status == 4" @click="returnGoods">{{ !isReturn ? '退货' : '确认退货'}}</view> |
|
|
|
@ -285,7 +285,7 @@ |
|
|
|
}], |
|
|
|
orderByWorkerCandidates: [], |
|
|
|
orderByWorker: '', |
|
|
|
bufferData: '', |
|
|
|
bufferData: [], |
|
|
|
show: false, |
|
|
|
popupShow: false, |
|
|
|
sales: {}, |
|
|
|
@ -308,7 +308,9 @@ |
|
|
|
returnAmount: 0, |
|
|
|
shopData: [], |
|
|
|
changeA: '', |
|
|
|
sAmout: 0 |
|
|
|
sAmout: 0, |
|
|
|
yNum: 150, |
|
|
|
printTotal:1040, |
|
|
|
} |
|
|
|
}, |
|
|
|
components: { |
|
|
|
@ -417,13 +419,7 @@ |
|
|
|
onPrintSmall(){ |
|
|
|
let that = this; |
|
|
|
that.yNum = 150 |
|
|
|
let heightNum = 300 |
|
|
|
heightNum += this.carList.length * 40 |
|
|
|
for(var i=0;i<this.list.length;i++){ |
|
|
|
heightNum += this.list[i].stockLogList.length * 30 |
|
|
|
} |
|
|
|
|
|
|
|
let strCmd = blesdk.CreatCPCLPage(600, heightNum, 1, 0); |
|
|
|
let strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLLocation(2); |
|
|
|
@ -433,47 +429,129 @@ |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', '100', '24', '0', 0, '客户:' + this.order.name) |
|
|
|
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('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++){ |
|
|
|
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].stockLogList.length;m++){ |
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, (that.slicePrint( |
|
|
|
key1)) + '*' + this.list[i].stockLogList[m].attributeList) |
|
|
|
strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value.discountAmount) |
|
|
|
strCmd += blesdk.addCPCLText('440', that.yNum, '24', '0', 0, '总价:' + (value |
|
|
|
.discountAmount * this.list[i].stockLogList[m].productCount)) |
|
|
|
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('280', that.yNum, '24', '0', 0, '单价:' + this.list[i].discountAmount) |
|
|
|
strCmd += blesdk.addCPCLText('440', 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('280', that.yNum, '24', '0', 0, '单价:' + this.list[i].discountAmount) |
|
|
|
strCmd += blesdk.addCPCLText('440', 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('200', this.yNum, '24', '0', 0, '总金额' + this.sales.totalAmount) |
|
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.sales.realAmount) |
|
|
|
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) |
|
|
|
// this.sales = res.result.sale |
|
|
|
// this.list = res.result.saleDetailDTOList |
|
|
|
// this.order = res.result.customer |
|
|
|
// this.orderXd = res.result.orderXd |
|
|
|
// this.shopData = res.result.shop |
|
|
|
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) |
|
|
|
if(that.countPrint() < this.printTotal){ |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, |
|
|
|
'===============================================================') |
|
|
|
}else{ |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + this.sales.remark) |
|
|
|
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, |
|
|
|
'===============================================================') |
|
|
|
} |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
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(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); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.bufferData = strCmd; |
|
|
|
this.$nextTick(()=>{ |
|
|
|
uni.redirectTo({ |
|
|
|
url: "/pages/index/order" |
|
|
|
@ -495,12 +573,20 @@ |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLText('50', '330', '24', '0', 0, this.sales.province + '/' + this.sales.city + '/' + |
|
|
|
this.sales.area) |
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLText('50', '410', '24', '0', 0, this.sales.receiveAddress) |
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
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) |
|
|
|
}else{ |
|
|
|
strCmd += blesdk.addCPCLText('50', '410', '24', '0', 0, this.sales.receiveAddress) |
|
|
|
} |
|
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|
blesdk.addCPCLSETBOLD('bold') |
|
|
|
strCmd += blesdk.addCPCLText('0', '490', '24', '0', 0, '——————————————————————————————') |
|
|
|
strCmd += blesdk.addCPCLText('50', '570', '24', '0', 0, '发货方式:' + this.sales.companyName?this.sales.companyName:'') |
|
|
|
strCmd += blesdk.addCPCLText('50', '570', '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, '店铺:' + maskShopName(this.sales.shopName)) |
|
|
|
@ -509,6 +595,25 @@ |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
this.bufferData = strCmd; |
|
|
|
}, |
|
|
|
//计算打印机当前行高度 |
|
|
|
countPrint(){ |
|
|
|
if((this.yNum + 50) >= 1040){ |
|
|
|
return this.yNum +=50 |
|
|
|
}else{ |
|
|
|
return this.yNum += 30 |
|
|
|
} |
|
|
|
}, |
|
|
|
//截取 |
|
|
|
slicePrint(val) { |
|
|
|
var name = '' |
|
|
|
if (typeof(val) == 'string') { |
|
|
|
let newObj = JSON.parse(val) |
|
|
|
for (let as in newObj) { |
|
|
|
name += newObj[as] + '/' |
|
|
|
} |
|
|
|
} |
|
|
|
return name; |
|
|
|
}, |
|
|
|
makeCall(phone) { |
|
|
|
uni.makePhoneCall({ |
|
|
|
|