|
|
|
@ -110,8 +110,7 @@ |
|
|
|
库存 |
|
|
|
</text> |
|
|
|
</view> |
|
|
|
<view |
|
|
|
style="font-size: 30rpx;color: #000;font-weight: bold;width: 152rpx;display: inline-block;text-align: right;"> |
|
|
|
<view style="font-size: 30rpx;color: #000;font-weight: bold;width: 152rpx;display: inline-block;text-align: right;"> |
|
|
|
数量 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -127,12 +126,12 @@ |
|
|
|
<text @tap="checkSpec('尺码',value[0],values[0],numData(values[0])[1])"> |
|
|
|
{{numData(values[0])[1]}} |
|
|
|
</text> |
|
|
|
<text |
|
|
|
style="width: 25%;font-size: 22rpx;">{{values[1].productNum == null ?'无库存':values[1].productNum}}</text> |
|
|
|
<text style="width: 25%;font-size: 22rpx;"> |
|
|
|
{{values[1].productNum == null ?'无库存':values[1].productNum}} |
|
|
|
</text> |
|
|
|
<view style="text-align: left;padding-left: 5px;width:50%;display: flex;"> |
|
|
|
<uni-number-box min="-10000" max="100000" style="margin-top:9rpx;border-right:0;" |
|
|
|
v-model="values[1].productCount" |
|
|
|
@change="GoodsNumChange($event,value,values[0])" /> |
|
|
|
v-model="values[1].productCount" @change="GoodsNumChange($event,value,values[0])"/> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -187,10 +186,16 @@ |
|
|
|
</uni-data-select> |
|
|
|
</view> |
|
|
|
<view class="content-list"> |
|
|
|
<view class="list-name" id="idss">总金额</view> |
|
|
|
<view class="list-name" id="idss">销售总额</view> |
|
|
|
<view class="list-val"> |
|
|
|
<input type="digit" v-model="shouldPay" disabled> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="content-list"> |
|
|
|
<view class="list-name" id="idss">退货金额</view> |
|
|
|
<view class="list-val"> |
|
|
|
<input type="digit" v-model="returnPay"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="content-list"> |
|
|
|
<view class="list-name">实收金额</view> |
|
|
|
@ -326,18 +331,27 @@ |
|
|
|
<view class="popup-pay-title"> |
|
|
|
<text>选择商品价格</text> |
|
|
|
</view> |
|
|
|
<view class="popup-pay-container" @tap.stop="checkPay(lsprice)"> |
|
|
|
<view class="popup-pay-container" @tap.stop="checkPay(lsprice,'')"> |
|
|
|
<text style="display: inline-block">零售价:¥{{lsprice}}</text> |
|
|
|
</view> |
|
|
|
<view class="popup-pay-container" @tap.stop="checkPay(wholesalePrice)"> |
|
|
|
<view class="popup-pay-container" @tap.stop="checkPay(wholesalePrice,'')"> |
|
|
|
<text style="display: inline-block">批发价:¥{{wholesalePrice}}</text> |
|
|
|
</view> |
|
|
|
<view class="popup-pay-title" style="font-size: 18px;margin-top: 10px;border-top: 1px solid #eee;padding: 10px;border-bottom: 1px solid #eee;"> |
|
|
|
<text>自定义价格</text> |
|
|
|
</view> |
|
|
|
<view class="popup-pay-container" style="background: #fff;display: flex;width: 100%;"> |
|
|
|
<input type="digit" style="height: 100rpx;line-height: 100rpx;color:#000;width: 296rpx;" |
|
|
|
placeholder="请输入价格" @input="changePay"> |
|
|
|
<view style="flex: 1;color: #fff;background: #088FEB;border-radius: 10px;width: 144rpx;" |
|
|
|
@tap.stop="checkPay(customPrice)">确定</view> |
|
|
|
</view> |
|
|
|
<view class="popup-pay-container" style="background: #fff;display: flex;width: 100%;height: 70rpx;color: #000;border: none;line-height: 70rpx;"> |
|
|
|
<view style="width:120rpx;text-align: left;">售价:</view> |
|
|
|
<input type="digit" style="height: 70rpx;line-height: 70rpx;color: #000;width: 296rpx;border-bottom: 1px solid #eee;" |
|
|
|
placeholder="请输入售价" @input="changePay"> |
|
|
|
</view> |
|
|
|
<view class="popup-pay-container" style="background: #fff;display: flex;width: 100%;height: 70rpx;color: #000;border: none;line-height: 70rpx;"> |
|
|
|
<view style="width:120rpx;">退货价:</view> |
|
|
|
<input type="digit" style="height: 70rpx;line-height: 70rpx;color: #000;width: 296rpx;border-bottom: 1px solid #eee;" |
|
|
|
placeholder="请输入退货价" @input="changeReturnPay"> |
|
|
|
</view> |
|
|
|
<view style="width: 100%;color: #fff;height: 70rpx;background: #088FEB;border-radius: 5px;font-size: 30rpx;text-align: center;line-height: 70rpx;margin-top: 20rpx;" |
|
|
|
@tap.stop="checkPay(customPrice,returnPrice)">确定</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
<!-- <canvas canvas-id="myCanvas"></canvas> --> |
|
|
|
@ -446,7 +460,7 @@ |
|
|
|
<view style="height: 150rpx;line-height: 150rpx;text-align: center;">暂无拿货历史</view> |
|
|
|
</view> |
|
|
|
<view class="popup-bottom" v-if="historyList != null"> |
|
|
|
<view class="popup-btn" @tap="checkPay(historyList.discountAmount)">一键使用历史价格</view> |
|
|
|
<view class="popup-btn" @tap="checkPay(historyList.discountAmount,'')">一键使用历史价格</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
@ -685,9 +699,11 @@ |
|
|
|
lbgName: [], //拉包工姓名 |
|
|
|
carList: new Map(), //添加商品页传回来的商品信息 |
|
|
|
xsyId: '', |
|
|
|
shouldPay: 0, |
|
|
|
shouldPay: 0, |
|
|
|
returnPay:0, |
|
|
|
totalAmount: 0, |
|
|
|
customPrice: 0, //选择自定义金额 |
|
|
|
customPrice: 0, //选择自定义金额 |
|
|
|
returnPrice:0, |
|
|
|
remark: '', |
|
|
|
pbAddress: '', |
|
|
|
yanseList: new Map(), |
|
|
|
@ -727,11 +743,21 @@ |
|
|
|
kkPrinter |
|
|
|
}, |
|
|
|
onHide(){ |
|
|
|
console.log('1加载了啊') |
|
|
|
console.log("1111") |
|
|
|
this.recordState = false |
|
|
|
setTimeout(res=>{ |
|
|
|
uni.closeBLEConnection({ |
|
|
|
deviceId:uni.getStorageSync('deviceId'), |
|
|
|
success(res) { |
|
|
|
console.log(res) |
|
|
|
},fail(err){ |
|
|
|
console.log(err) |
|
|
|
} |
|
|
|
}) |
|
|
|
},5000) |
|
|
|
|
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
console.log('加载了啊') |
|
|
|
this.recordState = false |
|
|
|
// 初始化蓝牙模块 |
|
|
|
wx.openBluetoothAdapter({ |
|
|
|
@ -870,23 +896,22 @@ |
|
|
|
}, |
|
|
|
handleData() { |
|
|
|
let that = this; |
|
|
|
|
|
|
|
for (let i = 0; i < this.carList1.length; i++) { |
|
|
|
|
|
|
|
if (this.carList1[i].saleDetailQueryDTO) { |
|
|
|
if (this.carList.size == 0) { //当前页没有数据 |
|
|
|
|
|
|
|
let obj = { |
|
|
|
purchasePrice: this.carList1[i].price, //采购价 |
|
|
|
price: 0, //总价 |
|
|
|
discount: 10, //折扣 |
|
|
|
categoryId: this.carList1[i].categoryId, |
|
|
|
unitPrice: this.carList1[i].unitPrice || 0, //单价 |
|
|
|
discountAmount: this.carList1[i].wholesalePrice || 0, //折后价 |
|
|
|
discountAmount: this.carList1[i].wholesalePrice || 0, //折后价 |
|
|
|
returnPrice:this.carList1[i].wholesalePrice || 0, |
|
|
|
disNoAmount: 0, //折前价,用于计算整体折扣 |
|
|
|
wholesalePrice: this.carList1[i].wholesalePrice, //批发价 |
|
|
|
lsprice: this.carList1[i].lsprice, //零售价 |
|
|
|
productCount: 0, //总数量 |
|
|
|
productCount: 0, //总数量 |
|
|
|
returnCount:0, //退货数量 |
|
|
|
productId: this.carList1[i].id, |
|
|
|
productName: this.carList1[i].productName, |
|
|
|
productPicture: this.carList1[i].productPicture, |
|
|
|
@ -904,8 +929,13 @@ |
|
|
|
.saleDetailQueryDTO[m].stockCount |
|
|
|
} |
|
|
|
|
|
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1) |
|
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount |
|
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1) |
|
|
|
if(this.carList1[i].saleDetailQueryDTO[m].productCount < 0){ //退货数量 |
|
|
|
obj.returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount) |
|
|
|
}else{ |
|
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
this.carList.set(this.carList1[i].id, obj) |
|
|
|
} else { //当前页有数据 |
|
|
|
@ -952,10 +982,13 @@ |
|
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i] |
|
|
|
.saleDetailQueryDTO[ |
|
|
|
m].attributeList, data1) |
|
|
|
} |
|
|
|
if(this.carList1[i].saleDetailQueryDTO[m].productCount < 0){ //退货数量 |
|
|
|
this.carList.get(this.carList1[i].id).returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount) |
|
|
|
}else{ |
|
|
|
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[m].productCount |
|
|
|
} |
|
|
|
this.carList.get(this.carList1[i].id).productCount += this.carList1[i] |
|
|
|
.saleDetailQueryDTO[ |
|
|
|
m].productCount |
|
|
|
|
|
|
|
} |
|
|
|
} else { //商品不同 |
|
|
|
let obj = { |
|
|
|
@ -963,12 +996,14 @@ |
|
|
|
price: 0, |
|
|
|
discount: 10, |
|
|
|
categoryId: this.carList1[i].categoryId, |
|
|
|
discountAmount: this.carList1[i].wholesalePrice || 0, |
|
|
|
discountAmount: this.carList1[i].wholesalePrice || 0, |
|
|
|
returnPrice: this.carList1[i].wholesalePrice || 0, |
|
|
|
disNoAmount: 0, //折前价,用于计算整体折扣 |
|
|
|
unitPrice: this.carList1[i].unitPrice || 0, //单价 |
|
|
|
wholesalePrice: this.carList1[i].wholesalePrice, //批发价 |
|
|
|
lsprice: this.carList1[i].lsprice, //零售价 |
|
|
|
productCount: 0, |
|
|
|
productCount: 0, |
|
|
|
returnCount:0, |
|
|
|
productId: this.carList1[i].id, |
|
|
|
productName: this.carList1[i].productName, |
|
|
|
productPicture: this.carList1[i].productPicture, |
|
|
|
@ -990,8 +1025,12 @@ |
|
|
|
} |
|
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1) |
|
|
|
|
|
|
|
obj.name = this.carList1[i].saleDetailQueryDTO[m].name |
|
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount |
|
|
|
obj.name = this.carList1[i].saleDetailQueryDTO[m].name |
|
|
|
if(this.carList1[i].saleDetailQueryDTO[m].productCount < 0){ //退货数量 |
|
|
|
obj.returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount) |
|
|
|
}else{ |
|
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount |
|
|
|
} |
|
|
|
} |
|
|
|
this.carList.set(this.carList1[i].id, obj) |
|
|
|
} |
|
|
|
@ -1032,7 +1071,8 @@ |
|
|
|
setTimeout(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
}, 300) |
|
|
|
} |
|
|
|
} |
|
|
|
console.log('退货金额',this.carList) |
|
|
|
}, |
|
|
|
invenRadio() { |
|
|
|
|
|
|
|
@ -1053,7 +1093,8 @@ |
|
|
|
productId: this.carList1[i].productId, |
|
|
|
categoryId: this.carList1[i].categoryId, |
|
|
|
unitPrice: this.carList1[i].wholesalePrice || 0, //单价 |
|
|
|
discountAmount: this.carList1[i].wholesalePrice || 0, //折后价 |
|
|
|
discountAmount: this.carList1[i].wholesalePrice || 0, //折后价 |
|
|
|
returnPrice: this.carList1[i].wholesalePrice || 0, |
|
|
|
disNoAmount: 0, //折前价,用于计算整体折扣 |
|
|
|
wholesalePrice: this.carList1[i].wholesalePrice, //批发价 |
|
|
|
lsprice: this.carList1[i].price, //零售价 |
|
|
|
@ -1117,7 +1158,8 @@ |
|
|
|
categoryId: this.carList1[i].categoryId, |
|
|
|
productId: this.carList1[i].productId, |
|
|
|
unitPrice: this.carList1[i].wholesalePrice || 0, //单价 |
|
|
|
discountAmount: this.carList1[i].wholesalePrice || 0, //折后价 |
|
|
|
discountAmount: this.carList1[i].wholesalePrice || 0, //折后价 |
|
|
|
returnPrice: this.carList1[i].wholesalePrice || 0, |
|
|
|
disNoAmount: 0, //折前价,用于计算整体折扣 |
|
|
|
wholesalePrice: this.carList1[i].wholesalePrice, //批发价 |
|
|
|
lsprice: this.carList1[i].price, //零售价 |
|
|
|
@ -1676,9 +1718,10 @@ |
|
|
|
'实件': '10件', |
|
|
|
'景': '#', |
|
|
|
'警': '#', |
|
|
|
'颈': '#', |
|
|
|
'颈': '#', |
|
|
|
'括号':'货号' |
|
|
|
}; |
|
|
|
const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色|叉|金色|井|时间|事件|世间|实践|实件|景|警|颈)/g; |
|
|
|
const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色|叉|金色|井|时间|事件|世间|实践|实件|景|警|颈|括号)/g; |
|
|
|
return str.replace(regex, match => chineseNumToArabic[match]); |
|
|
|
}, |
|
|
|
//编辑挂单信息 |
|
|
|
@ -1711,6 +1754,9 @@ |
|
|
|
if(convertedStr.indexOf(',') == 0){ |
|
|
|
console.log('位置',convertedStr.indexOf(',')) |
|
|
|
convertedStr = convertedStr.substr(1) |
|
|
|
} |
|
|
|
if (convertedStr.startsWith("号")) { |
|
|
|
convertedStr = "货号" + convertedStr.substr(1); |
|
|
|
} |
|
|
|
this.getMsg = convertedStr |
|
|
|
this.tui.request("/app/sale/buyAi", "POST", { |
|
|
|
@ -1841,9 +1887,11 @@ |
|
|
|
await this.carList.forEach(function(value, key) { |
|
|
|
that.index = value.productId || value.id |
|
|
|
if (e == '0') { //零售 |
|
|
|
value.discountAmount = value.lsprice |
|
|
|
value.discountAmount = value.lsprice |
|
|
|
value.returnPrice= value.lsprice |
|
|
|
} else { //批发 |
|
|
|
value.discountAmount = value.wholesalePrice |
|
|
|
value.discountAmount = value.wholesalePrice |
|
|
|
value.returnPrice= value.wholesalePrice |
|
|
|
} |
|
|
|
}) |
|
|
|
await this.getAllPrice() |
|
|
|
@ -1854,7 +1902,7 @@ |
|
|
|
this.$forceUpdate() |
|
|
|
}, |
|
|
|
//商品上选择是零售价还是批发价 |
|
|
|
checkPay(price) { |
|
|
|
checkPay(price,returnPrice) { |
|
|
|
|
|
|
|
if (price == undefined || price == null) { |
|
|
|
this.tui.toast("暂无拿货记录") |
|
|
|
@ -1863,7 +1911,10 @@ |
|
|
|
let that = this; |
|
|
|
let num = this.carList.get(this.index) |
|
|
|
|
|
|
|
num.discountAmount = price |
|
|
|
num.discountAmount = price |
|
|
|
if(returnPrice != ''){ |
|
|
|
num.returnPrice = returnPrice |
|
|
|
} |
|
|
|
num.unitPrice = price; |
|
|
|
num.price = price * num.productCount; |
|
|
|
this.$refs.inputDialog.close() |
|
|
|
@ -2239,7 +2290,8 @@ |
|
|
|
discount: 10, //折扣 |
|
|
|
unitPrice: 0, //单价 |
|
|
|
categoryId: carList1[i].categoryId, |
|
|
|
discountAmount: carList1[i].wholesalePrice || 0, //折后价 |
|
|
|
discountAmount: carList1[i].wholesalePrice || 0, //折后价 |
|
|
|
returnPrice: carList1[i].wholesalePrice || 0, |
|
|
|
disNoAmount: 0, //折前价,用于计算整体折扣 |
|
|
|
wholesalePrice: carList1[i].wholesalePrice, //批发价 |
|
|
|
lsprice: carList1[i].lsprice, //零售价 |
|
|
|
@ -2304,7 +2356,8 @@ |
|
|
|
purchasePrice: carList1[i].price, //采购价 |
|
|
|
price: 0, |
|
|
|
discount: 10, |
|
|
|
discountAmount: carList1[i].wholesalePrice || 0, |
|
|
|
discountAmount: carList1[i].wholesalePrice || 0, |
|
|
|
returnPrice: carList1[i].wholesalePrice || 0, |
|
|
|
disNoAmount: 0, //折前价,用于计算整体折扣 |
|
|
|
unitPrice: 0, //单价 |
|
|
|
categoryId: carList1[i].categoryId, |
|
|
|
@ -2424,6 +2477,9 @@ |
|
|
|
} |
|
|
|
if(convertedStr.indexOf(',') == 0){ |
|
|
|
convertedStr = convertedStr.substr(1) |
|
|
|
} |
|
|
|
if (convertedStr.startsWith("号")) { |
|
|
|
convertedStr = "货号" + convertedStr.substr(1); |
|
|
|
} |
|
|
|
if (that.voiceText == '' || that.voiceText == null) { |
|
|
|
that.voiceText = convertedStr |
|
|
|
@ -2457,7 +2513,8 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
showPrice() { |
|
|
|
showPrice() { |
|
|
|
let that = this; |
|
|
|
if (this.khName == '') { |
|
|
|
this.tui.toast('请选择客户!') |
|
|
|
return |
|
|
|
@ -2496,11 +2553,23 @@ |
|
|
|
} else { |
|
|
|
this.tui.toast('请选择发货方式!') |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
let printHeight = 800 |
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
printHeight += 30 |
|
|
|
value.stockLogList.forEach(function(value1, key1) { |
|
|
|
printHeight += 30 |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.printTotal = printHeight |
|
|
|
this.bufferData = [] |
|
|
|
let strCmd = this.getPrintData() |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
this.bufferData.push(strCmd); |
|
|
|
this.$refs.showPopup.open() |
|
|
|
}, |
|
|
|
//点击底部开单按钮 |
|
|
|
goSell(print) { |
|
|
|
async goSell(print) { |
|
|
|
let that = this; |
|
|
|
uni.showLoading({ |
|
|
|
title: '加载中...' |
|
|
|
@ -2535,51 +2604,121 @@ |
|
|
|
companyName: this.wlName.shippingMethod || this.wlName.companyName, |
|
|
|
companyPhone: this.wlName.mobile |
|
|
|
}, |
|
|
|
saleDetailList: [] |
|
|
|
saleDetailList: [], |
|
|
|
saleReturnDTO:[] |
|
|
|
} |
|
|
|
let purchaseDetails = []; |
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
let purchaseDetails = []; |
|
|
|
let returnList = []; |
|
|
|
|
|
|
|
console.log('carList',this.carList) |
|
|
|
await this.carList.forEach(function(value, key) { |
|
|
|
let returnGoods = [] |
|
|
|
let goodsList = [] |
|
|
|
value.stockLogList.forEach(function(values, keys) { |
|
|
|
if (values <= 0) { |
|
|
|
if (values.productCount == 0) { |
|
|
|
that.tui.toast("商品数量不能为零!") |
|
|
|
return; |
|
|
|
} |
|
|
|
console.log('values',values) |
|
|
|
if(values.productCount < 0){ |
|
|
|
console.log() |
|
|
|
let obj1 = { |
|
|
|
productCount: values.productCount, |
|
|
|
attributeList: keys |
|
|
|
} |
|
|
|
returnGoods.push(obj1) |
|
|
|
}else{ |
|
|
|
let obj1 = { |
|
|
|
productCount: values.productCount, |
|
|
|
attributeList: keys |
|
|
|
} |
|
|
|
goodsList.push(obj1) |
|
|
|
} |
|
|
|
let obj = { |
|
|
|
productCount: values.productCount, |
|
|
|
attributeList: keys |
|
|
|
} |
|
|
|
value.stockLogList1.push(obj) |
|
|
|
|
|
|
|
}) |
|
|
|
that.$nextTick(()=>{ |
|
|
|
if(returnGoods.length > 0){ |
|
|
|
let data = { |
|
|
|
categoryId: value.categoryId, |
|
|
|
disNoAmount: value.disNoAmount, |
|
|
|
discount: value.discount, |
|
|
|
discountAmount: value.discountAmount, |
|
|
|
lsprice: value.lsprice, |
|
|
|
price: value.price, |
|
|
|
productCount: value.productCount, |
|
|
|
productId: value.productId, |
|
|
|
productName: value.productName, |
|
|
|
productPicture: value.productPicture, |
|
|
|
productSn: value.productSn, |
|
|
|
purchasePrice: value.purchasePrice, |
|
|
|
returnCount: value.returnCount, |
|
|
|
returnPrice: value.returnPrice, |
|
|
|
stockLogList: value.stockLogList, |
|
|
|
stockLogList1: returnGoods, |
|
|
|
supplierName: value.supplierName, |
|
|
|
unitPrice: value.unitPrice, |
|
|
|
wholesalePrice: value.wholesalePrice |
|
|
|
} |
|
|
|
returnList.push(data) |
|
|
|
} |
|
|
|
if(goodsList.length > 0){ |
|
|
|
let data = { |
|
|
|
categoryId: value.categoryId, |
|
|
|
disNoAmount: value.disNoAmount, |
|
|
|
discount: value.discount, |
|
|
|
discountAmount: value.discountAmount, |
|
|
|
lsprice: value.lsprice, |
|
|
|
price: value.price, |
|
|
|
productCount: value.productCount, |
|
|
|
productId: value.productId, |
|
|
|
productName: value.productName, |
|
|
|
productPicture: value.productPicture, |
|
|
|
productSn: value.productSn, |
|
|
|
purchasePrice: value.purchasePrice, |
|
|
|
returnCount: value.returnCount, |
|
|
|
returnPrice: value.returnPrice, |
|
|
|
stockLogList: value.stockLogList, |
|
|
|
stockLogList1: goodsList, |
|
|
|
supplierName: value.supplierName, |
|
|
|
unitPrice: value.unitPrice, |
|
|
|
wholesalePrice: value.wholesalePrice |
|
|
|
} |
|
|
|
purchaseDetails.push(data) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
purchaseDetails.push(value) |
|
|
|
}) |
|
|
|
this.saleDetailList = purchaseDetails; |
|
|
|
obj.saleDetailList = purchaseDetails; |
|
|
|
let url = '' |
|
|
|
if (this.saleId != '') { |
|
|
|
url = '/app/sale/shareToBuyNew' |
|
|
|
} else { |
|
|
|
url = '/app/sale/buyNew' |
|
|
|
} |
|
|
|
this.tui.request(url, "post", obj, false, false).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
uni.showToast({ |
|
|
|
title: "开单成功", |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
if (print != 'print') { |
|
|
|
setTimeout(res => { |
|
|
|
this.$refs.showPopup.close() |
|
|
|
that.clearAll1() |
|
|
|
uni.switchTab({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}); |
|
|
|
}, 1000) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.tui.toast(res.message) |
|
|
|
} |
|
|
|
}) |
|
|
|
await that.$nextTick(()=>{ |
|
|
|
setTimeout(res=>{ |
|
|
|
obj.saleDetailList = purchaseDetails; |
|
|
|
obj.saleReturnDTO = returnList; |
|
|
|
let url = '' |
|
|
|
if (this.saleId != '') { |
|
|
|
url = '/app/sale/shareToBuyNew' |
|
|
|
} else { |
|
|
|
url = '/app/sale/buyNew' |
|
|
|
} |
|
|
|
this.tui.request(url, "post", obj, false, false).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
uni.showToast({ |
|
|
|
title: "开单成功", |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
if (print != 'print') { |
|
|
|
setTimeout(res => { |
|
|
|
this.$refs.showPopup.close() |
|
|
|
that.clearAll1() |
|
|
|
uni.switchTab({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}); |
|
|
|
}, 1000) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.tui.toast(res.message) |
|
|
|
} |
|
|
|
}) |
|
|
|
},500) |
|
|
|
}) |
|
|
|
|
|
|
|
setTimeout(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
}, 1000) |
|
|
|
@ -2591,236 +2730,111 @@ |
|
|
|
// url: '/pages/index/index' |
|
|
|
// }); |
|
|
|
// }, |
|
|
|
//打印小票 |
|
|
|
onPrint(opt) { |
|
|
|
let that = this; |
|
|
|
this.goSell('print') |
|
|
|
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.khName.name) |
|
|
|
// strCmd += blesdk.addCPCLText('280', '100', '24', '0', 0, this.sales.id) |
|
|
|
strCmd += blesdk.addCPCLText('0', '130', '24', '0', 0, '销售:' + this.createByName) |
|
|
|
strCmd += blesdk.addCPCLText('280', '130', '24', '0', 0, '日期:' + this.formatDate(new Date(), |
|
|
|
'YYYY-MM-DD')) //+ |
|
|
|
strCmd += blesdk.addCPCLText('0', '150', '24', '0', 0, |
|
|
|
'=========================================================') |
|
|
|
|
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
if (that.countPrint() < that.printTotal) { |
|
|
|
strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, value.productName + '(' + |
|
|
|
value.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, value.productName + |
|
|
|
'(' + |
|
|
|
value.productSn + ')') |
|
|
|
|
|
|
|
} |
|
|
|
value.stockLogList.forEach(function(value1, key1) { |
|
|
|
if (that.countPrint() < that.printTotal) { |
|
|
|
strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, '□ ' + (that |
|
|
|
.slicePrint( |
|
|
|
key1)) + '*' + value1.productCount) |
|
|
|
strCmd += blesdk.addCPCLText('240', that.yNum, '24', '0', 0, '单价:' + value |
|
|
|
.discountAmount) |
|
|
|
strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '总价:' + (value |
|
|
|
.discountAmount * value1.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(key1)) + '*' + value1.productCount) |
|
|
|
strCmd += blesdk.addCPCLText('240', that.yNum, '24', '0', 0, '单价:' + value |
|
|
|
.discountAmount) |
|
|
|
strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '总价:' + (value |
|
|
|
.discountAmount * value1.productCount)) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
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, '总数量:' + this.totalAmount) |
|
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '总金额:' + this.shouldPay) |
|
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.relPrice) |
|
|
|
} 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.totalAmount) |
|
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '总金额:' + this.shouldPay) |
|
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.relPrice) |
|
|
|
|
|
|
|
} |
|
|
|
if (that.countPrint() < that.printTotal) { |
|
|
|
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '实收:' + this.priceOk) |
|
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk) |
|
|
|
.toFixed(2)) |
|
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 : |
|
|
|
this.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.priceOk) |
|
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk) |
|
|
|
.toFixed(2)) |
|
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 : |
|
|
|
this.otherExpense)) |
|
|
|
|
|
|
|
} |
|
|
|
if (Math.ceil(Number(this.remark.length) / 20) * 30 + this.yNum < that.printTotal) { |
|
|
|
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', this.countPrint(), '24', '0', 0, '备注:' + this.remark) |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
this.yNum = 0 |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
this.bufferData.push(strCmd); |
|
|
|
strCmd = '' |
|
|
|
if (this.remark.length > 20) { |
|
|
|
let position = 20; |
|
|
|
let part1 = this.remark.substring(0, position); |
|
|
|
let part2 = this.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.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.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺地址:' + uni.getStorageSync( |
|
|
|
'shopAddress')) |
|
|
|
} |
|
|
|
//店铺电话 |
|
|
|
if (that.countPrint() < that.printTotal) { |
|
|
|
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')) |
|
|
|
//打印小票 |
|
|
|
async onPrint(opt) { |
|
|
|
let that = this; |
|
|
|
await this.goSell('print') |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
uni.hideLoading(); |
|
|
|
that.$refs.showPopup.close() |
|
|
|
that.bufferData = [] |
|
|
|
that.clearAll1() |
|
|
|
uni.switchTab({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
getPrintData(){ |
|
|
|
let that = this; |
|
|
|
let strCmd = '' |
|
|
|
that.yNum = 300 |
|
|
|
strCmd = blesdk.CreatCPCLPage(1000, this.printTotal, 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, '客户:' + that.khName.name) |
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLLocation(0); |
|
|
|
strCmd += blesdk.addCPCLText('0', '240', '24', '0', 0, '销售员:' + that.createByName) |
|
|
|
strCmd += blesdk.addCPCLText('500', '240', '24', '0', 0, '日期:' + that.formatDate(new Date(), |
|
|
|
'YYYY-MM-DD')) //+ |
|
|
|
strCmd += blesdk.addCPCLText('0', '300', '24', '0', 0, |
|
|
|
'=====================================================================================') |
|
|
|
|
|
|
|
that.carList.forEach(function(value, key) { |
|
|
|
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, value.productName + '(' + |
|
|
|
value.productSn + ')') |
|
|
|
value.stockLogList.forEach(function(value1, key1) { |
|
|
|
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '□ ' + (that |
|
|
|
.slicePrint(key1))) |
|
|
|
strCmd += blesdk.addCPCLText('220', that.yNum, '24', '0', 0, '数量:'+ value1.productCount) |
|
|
|
strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '单价:' + value |
|
|
|
.discountAmount) |
|
|
|
strCmd += blesdk.addCPCLText('650', that.yNum, '24', '0', 0, '总价:' + (value |
|
|
|
.discountAmount * value1.productCount)) |
|
|
|
}) |
|
|
|
}) |
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, |
|
|
|
'==========================================================================================') |
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '总数量:' + that.totalAmount) |
|
|
|
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '总金额:' + that.shouldPay) |
|
|
|
strCmd += blesdk.addCPCLText('630', that.yNum, '24', '0', 0, '应收:' + that.relPrice) |
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '实收:' + that.priceOk) |
|
|
|
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '欠款:' + (that.relPrice - that.priceOk) |
|
|
|
.toFixed(2)) |
|
|
|
strCmd += blesdk.addCPCLText('630', that.yNum, '24', '0', 0, '其他费用:' + (that.otherExpense == '' ? 0 : |
|
|
|
that.otherExpense)) |
|
|
|
if(that.remark != ''){ |
|
|
|
if (that.remark.length > 20) { |
|
|
|
let position = 20; |
|
|
|
let part1 = that.remark.substring(0, position); |
|
|
|
let part2 = that.remark.substring(position); |
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '备注:' + part1) |
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, part2) |
|
|
|
} else { |
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '备注:' + that.remark) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if(this.qrArr.length != 0){ |
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, |
|
|
|
'=========================================================================================') |
|
|
|
//店铺地址 |
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺地址:' + uni.getStorageSync( |
|
|
|
'shopAddress')) |
|
|
|
|
|
|
|
//店铺电话 |
|
|
|
|
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1) |
|
|
|
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + uni.getStorageSync( |
|
|
|
'username')) |
|
|
|
|
|
|
|
if(that.qrArr.length != 0){ |
|
|
|
//店铺微信/微信收款/支付宝收款/收款码收款(店铺,微信,支付,收款) |
|
|
|
for (let i = 0; i < this.qrArr.length; i++) { |
|
|
|
for (let i = 0; i < that.qrArr.length; i++) { |
|
|
|
|
|
|
|
//店铺二维码 |
|
|
|
console.log(that.qrArr[i]) |
|
|
|
console.log(that.yNum) |
|
|
|
console.log(that.countWidth(i,600/that.qrArr.length)) |
|
|
|
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.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); |
|
|
|
} |
|
|
|
console.log('11111') |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
}else{ |
|
|
|
strCmd += blesdk.addCPCLPrint(); |
|
|
|
that.bufferData.push(strCmd); |
|
|
|
} |
|
|
|
|
|
|
|
uni.hideLoading(); |
|
|
|
this.$nextTick(() => { |
|
|
|
console.log('bufferData',that.bufferData) |
|
|
|
that.$refs.showPopup.close() |
|
|
|
that.bufferData = [] |
|
|
|
that.clearAll1() |
|
|
|
uni.switchTab({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}); |
|
|
|
}) |
|
|
|
return strCmd; |
|
|
|
}, |
|
|
|
countWidth(num,len){ |
|
|
|
// if(num == 0){ |
|
|
|
@ -2831,11 +2845,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) { |
|
|
|
@ -2871,6 +2885,10 @@ |
|
|
|
this.wholesalePrice = this.carList.get(this.index).wholesalePrice |
|
|
|
this.lsprice = this.carList.get(this.index).lsprice |
|
|
|
this.$refs.inputDialog.open() |
|
|
|
}, |
|
|
|
//输入商品自定义退货金额 |
|
|
|
changeReturnPay(e) { |
|
|
|
this.returnPrice = e.detail.value |
|
|
|
}, |
|
|
|
//输入商品自定义金额 |
|
|
|
changePay(e) { |
|
|
|
@ -2959,27 +2977,40 @@ |
|
|
|
let that = this; |
|
|
|
this.shouldPay = 0 |
|
|
|
this.totalAmount = 0 |
|
|
|
|
|
|
|
that.returnPay = 0 |
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
that.shouldPay = Number(that.shouldPay) + Number(value.price) |
|
|
|
|
|
|
|
that.totalAmount = that.totalAmount + value.productCount |
|
|
|
that.returnPay = Number(that.returnPay) + (Number(value.returnPrice) * Math.abs(Number(value.returnCount))) |
|
|
|
if(value.productCount > 0){ |
|
|
|
that.totalAmount = that.totalAmount + value.productCount |
|
|
|
} |
|
|
|
}) |
|
|
|
that.shouldPay = that.shouldPay.toFixed(2) |
|
|
|
that.shouldPay = that.shouldPay.toFixed(2) |
|
|
|
that.returnPay = that.returnPay.toFixed(2) |
|
|
|
this.relPrice = this.shouldPay |
|
|
|
this.priceOk = this.shouldPay |
|
|
|
this.priceOk = this.shouldPay - that.returnPay |
|
|
|
this.$forceUpdate() |
|
|
|
that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk) |
|
|
|
that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk) - this.returnPay |
|
|
|
that.noPay = that.noPay.toFixed(2) |
|
|
|
}, |
|
|
|
//修改已选规格的数量 |
|
|
|
GoodsNumChange(e, index, index1) { |
|
|
|
let that = this; |
|
|
|
this.carList.get(index[0]).stockLogList.get(index1).productCount = e |
|
|
|
this.carList.get(index[0]).productCount = 0 |
|
|
|
let that = this; |
|
|
|
if(e < 0){ |
|
|
|
|
|
|
|
this.carList.get(index[0]).stockLogList.get(index1).productCount = e |
|
|
|
}else{ |
|
|
|
this.carList.get(index[0]).stockLogList.get(index1).productCount = e |
|
|
|
} |
|
|
|
|
|
|
|
this.carList.get(index[0]).productCount = 0 |
|
|
|
this.carList.get(index[0]).returnCount = 0 |
|
|
|
this.carList.get(index[0]).stockLogList.forEach(function(value, key) { |
|
|
|
that.carList.get(index[0]).productCount = that.carList.get(index[0]).productCount + value |
|
|
|
.productCount |
|
|
|
if(value.productCount < 0){ |
|
|
|
that.carList.get(index[0]).returnCount = that.carList.get(index[0]).returnCount + Math.abs(value.productCount) |
|
|
|
}else{ |
|
|
|
that.carList.get(index[0]).productCount = that.carList.get(index[0]).productCount + value.productCount |
|
|
|
} |
|
|
|
if (that.discountType == 0) { //单品折扣 |
|
|
|
// that.carList.get(index[0]).price = that.carList.get(index[0]).productCount * (that.carList.get( |
|
|
|
// index[0]).discountAmount * (that.carList.get(index[0]).discount / 10)) |
|
|
|
|