|
|
@ -234,7 +234,10 @@ |
|
|
</u-popup> |
|
|
</u-popup> |
|
|
<view class="tui-tabbar"> |
|
|
<view class="tui-tabbar"> |
|
|
<view class="tui-btn-mr" v-if="sales.status != 6 && sales.status != 2"> |
|
|
<view class="tui-btn-mr" v-if="sales.status != 6 && sales.status != 2"> |
|
|
<kk-printer ref="kkprinter" :bufferData="bufferData" @onPrint="onPrint"></kk-printer> |
|
|
<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> |
|
|
</view> |
|
|
</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 == 0 || sales.status == 1" @click="cancelOrder">取消订单</view> |
|
|
<view class="tui-btn-mr" v-if="sales.status == 4" @click="returnGoods">{{ !isReturn ? '退货' : '确认退货'}}</view> |
|
|
<view class="tui-btn-mr" v-if="sales.status == 4" @click="returnGoods">{{ !isReturn ? '退货' : '确认退货'}}</view> |
|
|
@ -264,6 +267,7 @@ |
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
|
|
|
defaultText:'贴包单', |
|
|
radio1: 0, |
|
|
radio1: 0, |
|
|
sex: [{ |
|
|
sex: [{ |
|
|
text: '是', |
|
|
text: '是', |
|
|
@ -402,6 +406,75 @@ |
|
|
this.collection = res.result |
|
|
this.collection = res.result |
|
|
}).catch(res => {}); |
|
|
}).catch(res => {}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
//打印小票 |
|
|
|
|
|
onPrintSmall(){ |
|
|
|
|
|
// 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 |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
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('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, |
|
|
|
|
|
'=========================================================') |
|
|
|
|
|
|
|
|
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, value.productName + '(' + |
|
|
|
|
|
value.productSn + ')') |
|
|
|
|
|
value.stockLogList.forEach(function(value1, key1) { |
|
|
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, (that.slicePrint( |
|
|
|
|
|
key1)) + '*' + value1) |
|
|
|
|
|
strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value.discountAmount) |
|
|
|
|
|
strCmd += blesdk.addCPCLText('440', that.yNum, '24', '0', 0, '总价:' + (value |
|
|
|
|
|
.discountAmount * value1)) |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, |
|
|
|
|
|
'===============================================================') |
|
|
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '总数量:' + this.totalAmount) |
|
|
|
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '总金额' + this.shouldPay) |
|
|
|
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.relPrice) |
|
|
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '实收:' + this.priceOk) |
|
|
|
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk)) |
|
|
|
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 : this.otherExpense)) |
|
|
|
|
|
if(this.remark.length >20){ |
|
|
|
|
|
let position = 20; |
|
|
|
|
|
let part1 = this.remark.substring(0, position); |
|
|
|
|
|
let part2 = this.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', 3000, '24', '0', 0, '备注:' + this.remark) |
|
|
|
|
|
} |
|
|
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
|
|
|
|
|
|
|
|
this.bufferData = strCmd; |
|
|
|
|
|
this.$nextTick(()=>{ |
|
|
|
|
|
uni.redirectTo({ |
|
|
|
|
|
url: "/pages/index/order" |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
//打印贴包单 |
|
|
onPrint(opt) { |
|
|
onPrint(opt) { |
|
|
let strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 1); |
|
|
let strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 1); |
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2) |
|
|
|