wangfukang 3 years ago
parent
commit
183f3da1f4
  1. 2
      pages/index/customAndSupplierProductDetail.vue
  2. 49
      pages/index/dataStatistics.vue
  3. 4
      pages/index/index.vue
  4. 197
      pages/index/orderDetail.vue
  5. 46
      pages/index/peopleList.vue
  6. 56
      pages/inventory/addinventory.vue
  7. 104
      pages/inventory/batchPrint.vue
  8. 239
      pages/inventory/goodsList1.vue
  9. 2
      pages/inventory/inventory.vue

2
pages/index/customAndSupplierProductDetail.vue

@ -6,7 +6,7 @@
<view v-for="(data,index2) in item.customerBuySaleVoList" style="padding-bottom: 20rpx;margin-bottom: 20rpx;border-bottom: 1px solid #eee;">
<view class="uni-body" style="text-align: center;display: flex;flex-direction: column;">
<text v-if="userType==0">{{data.createTime}} </text>
<text style="color:red;">采购价:{{data.customerBuyProductDetailLogVos[0].realPrice}}</text>
<text style="color:red;">实际售价:{{data.customerBuyProductDetailLogVos[0].realPrice}}</text>
</view>
<view style="margin: 5px 0;height: 1px;background: #eee;"></view>
<view style="display: flex;border-bottom: 1px solid #eee;height: 50rpx;line-height: 50rpx;">

49
pages/index/dataStatistics.vue

@ -1,16 +1,15 @@
<template>
<view>
<view style="position: fixed;top: 0;z-index: 99;">
<view style="position: fixed;top: 0;z-index: 99;width:100%;">
<uni-datetime-picker style="margin-bottom:10px;" v-model="range" type="daterange" @change="searchList" />
<view class="IndexContent">
<view class="contentPadding">
<u-grid :col="2">
<u-grid :col="3">
<u-grid-item>
<u-count-to :start-val="0" :end-val="shopInfo.totalAmount"></u-count-to>
<text class="grid-text">销售总金额</text>
</u-grid-item>
<u-grid-item>
<u-count-to :start-val="0" :end-val="shopInfo.totalAlreadyEarn + shopInfo.totalPayAmount"></u-count-to>
<uni-tooltip :content="'订单实收:' + shopInfo.totalAlreadyEarn +'回款:'+ shopInfo.totalPayAmount" placement="left">
<view class="grid-text" style="display: flex;">
@ -23,18 +22,24 @@
<u-count-to :start-val="0" :end-val="type==0?shopInfo.totalProfit:0" :decimals="2"></u-count-to>
<view class="grid-text">利润</view>
</u-grid-item>
<u-grid-item>
</u-grid>
<u-grid :col="5">
<view class="u-zidingyi">
<u-count-to :start-val="0" :end-val="shopInfo.totalCCount"></u-count-to>
<view class="grid-text">下单客户数</view>
</u-grid-item>
<u-grid-item>
<view class="grid-text">下单客户</view>
</view>
<view class="u-zidingyi">
<u-count-to :start-val="0" :end-val="shopInfo.purchasingCost"></u-count-to>
<view class="grid-text">总成本</view>
</view>
<view class="u-zidingyi">
<u-count-to :start-val="0" :end-val="shopInfo.returnTotalAmount"></u-count-to>
<view class="grid-text">退货金额</view>
</u-grid-item>
<u-grid-item>
</view>
<view class="u-zidingyi">
<u-count-to :start-val="0" :end-val="shopInfo.returnTotalCount"></u-count-to>
<view class="grid-text">退货数量</view>
</u-grid-item>
</view>
</u-grid>
</view>
</view>
@ -157,6 +162,7 @@
.grid-text {
font-size: 28rpx;
margin-bottom: 26rpx;
text-align: center;
}
}
.u-grid-item {
@ -195,7 +201,8 @@
background: linear-gradient(#84C1FF, #C4E1FF) !important;
}
.u-count-num {
color: #FFF !important
color: #FFF !important;
text-align:center;
}
.uni-date{
background: #fff;
@ -206,4 +213,24 @@
.u-icon{
padding: 0 0 0 8px !important;
}
.u-zidingyi{
width: 22% !important;
height: 160rpx;
background: linear-gradient(#84C1FF, #C4E1FF) !important;
margin-left: 3%;
border-radius: 30rpx;
margin-top: 20rpx !important;
color: #fff !important;
text-align: center;
padding-top: 20rpx;
}
.u-zidingyi:nth-child(2) {
background: linear-gradient(#FFBB77, #C4E1FF) !important;
}
.u-zidingyi:nth-child(3) {
background: linear-gradient(#84C1FF, #7AFEC6) !important;
}
.u-zidingyi:nth-child(4) {
background: linear-gradient(#84C1FF, #C4E1FF) !important;
}
</style>

4
pages/index/index.vue

@ -114,7 +114,7 @@
<u-cell icon="grid-fill" url="/pages/index/checkShop" title="切换当前店铺" clickable isLink
arrow-direction="left"></u-cell>
<view class="border-line"></view>
<u-cell icon="man-add-fill" url="/pages/index/peopleList?popleType=gysName" title="供货商管理"
<u-cell icon="man-add-fill" url="/pages/index/peopleList?popleType=gysName&noClick=1" title="供货商管理"
clickable isLink arrow-direction="left"></u-cell>
<u-cell icon="man-add-fill" url="/pages/index/upstream" v-if="type==0" title="供货商欠款"
clickable isLink arrow-direction="left"></u-cell>
@ -123,7 +123,7 @@
<u-cell icon="man-add-fill" url="/pages/index/goodsStock" title="盘点管理" clickable isLink
arrow-direction="left"></u-cell>
<view class="border-line"></view>
<u-cell icon="account-fill" url="/pages/index/peopleList?popleType=khName" title="客户管理"
<u-cell icon="account-fill" url="/pages/index/peopleList?popleType=khName&noClick=1" title="客户管理"
clickable isLink arrow-direction="left"></u-cell>
<u-cell icon="account-fill" url="/pages/index/downstream" v-if="type==0" title="客户欠款"
clickable isLink arrow-direction="left"></u-cell>

197
pages/index/orderDetail.vue

@ -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({

46
pages/index/peopleList.vue

@ -145,7 +145,8 @@
khName:{},
searchName:'',
pages: 1,
totalPages: 0,
totalPages: 0,
noClick:0
}
},
onReachBottom() {
@ -161,7 +162,8 @@
}
},
onLoad(options) {
this.popleType = options.popleType
this.popleType = options.popleType
this.noClick = options.noClick || 0
this.companyType = options.companyType || ''
if(options.khName){
this.khName = JSON.parse(options.khName) || ''
@ -193,7 +195,7 @@
if(this.popleType == 'gysName'){ //供应商
this.tui.request("/app/supplier/getByCondition", "post", {
searchStr:this.searchName,
pageNum: this.pages,
pageNumber: this.pages,
pageSize: 10
}, false, true).then((res) => {
this.status = 'nomore';
@ -211,7 +213,7 @@
}else{ //客户
this.tui.request("/app/customer/list", "post", {
searchStr:this.searchName,
pageNum: this.pages,
pageNum: this.pages,
pageSize: 10
}, false, false).then((res) => {
this.status = 'nomore';
@ -300,23 +302,25 @@
})
},
//点击选择列表,带参数 返回上一页
clickList(item) {
let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
let prevPage = pages[pages.length - 2]; //上一页页面实例
//客户和供应商用一个名字
if (this.popleType == 'khName' || this.popleType == 'gysName') {
prevPage.$vm.khName = item
} else if (this.popleType == 'kdName' || this.popleType == 'wlName' || this.popleType == 'fcName' ||this.popleType == 'dbName') {
prevPage.$vm.wlName = item
} else if (this.popleType == 'lbgName') {
prevPage.$vm.lbgName = item
} else if (this.popleType == 'kdyName') {
prevPage.$vm.kdyName = item
}
prevPage.$vm.clearMsg = '1'
uni.navigateBack({
delta: 1
})
clickList(item) {
if(this.noClick == 0){
let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
let prevPage = pages[pages.length - 2]; //上一页页面实例
//客户和供应商用一个名字
if (this.popleType == 'khName' || this.popleType == 'gysName') {
prevPage.$vm.khName = item
} else if (this.popleType == 'kdName' || this.popleType == 'wlName' || this.popleType == 'fcName' ||this.popleType == 'dbName') {
prevPage.$vm.wlName = item
} else if (this.popleType == 'lbgName') {
prevPage.$vm.lbgName = item
} else if (this.popleType == 'kdyName') {
prevPage.$vm.kdyName = item
}
prevPage.$vm.clearMsg = '1'
uni.navigateBack({
delta: 1
})
}
},
//拨打电话
clickPhone(phone) {

56
pages/inventory/addinventory.vue

@ -64,13 +64,13 @@
<view class="content-list" v-if='storageType==0'>
<view class="list-name">应付金额</view>
<view class="list-val">
<input type="text" placeholder="请输入应付金额" v-model="shouldPay">
<input type="text" placeholder="请输入应付金额" v-model="shouldPay" @blur="changessPrice($event)">
</view>
</view>
<view class="content-list" v-if='storageType==0'>
<view class="list-name">已付金额</view>
<view class="list-val">
<input type="text" placeholder="请输入已付金额" v-model="alreadyPay" @blur="changePay">
<input type="text" placeholder="请输入已付金额" v-model="alreadyPay" @blur="changePay($event)">
</view>
</view>
<view class="content-list" v-if='storageType==0'>
@ -290,18 +290,46 @@
//扫一扫功能
scanCodeAdd() {
uni.scanCode({
// scanType: ['barCode'],
onlyFromCamera: true,
success: (res) => {
// this.productId = res.result
// this.toggle('bottom', res.result);
let shopId = res.result.split(',')[1]
if(shopId == uni.getStorageSync('shopId')){
this.productId = res.result.split(',')[0]
this.toggle('bottom', res.result.split(',')[0]);
if(res.scanType == "QR_CODE"){ //二维码
let shopId = res.result.split(',')[1]
if(shopId == uni.getStorageSync('shopId')){
this.productId = res.result.split(',')[0]
this.toggle('bottom', res.result.split(',')[0]);
if (item.saleDetailDTOList) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
this.carList.push(item.saleDetailDTOList[i])
}
}
}else{
this.tui.toast('您的店铺中暂无该商品!')
}
}else{
this.tui.toast('您的店铺中暂无该商品!')
this.productId = res.result
this.tui.request("/app/product/getByBarcode", "POST", {
barcode:res.result
}, false, true).then((res1) => {
if (res1.code == 200) {
if(res1.result == ''){
this.tui.toast('您的店铺中暂无该商品!')
}else{
this.toggle('bottom', res1.result[0].id);
if (item.saleDetailDTOList) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
this.carList.push(item.saleDetailDTOList[i])
}
}
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {
this.tui.toast(res)
})
}
},
fail: (res) => {
uni.showToast({
@ -543,9 +571,13 @@
this.getAllPrice()
this.$refs.shopPopup.close()
},
changessPrice(){
this.noPay = this.shouldPay - this.alreadyPay;
},
//计算欠款
changePay() {
changePay(e) {
this.alreadyPay = e.target.value >this.shouldPay ?this.shouldPay :e.target.value
this.noPay = this.shouldPay - this.alreadyPay
},
//跳转选择供应商

104
pages/inventory/batchPrint.vue

@ -64,10 +64,7 @@
@tap.stop="addMultipleType(item1)" :class="item1.checked?'checked':''">{{item1.type}}</view>
</view>
<view class="popup-pay-container" >
<view class="" @tap="goPrint">
确认打印
</view>
<!-- <kk-printer ref="kkprinter" :bufferData="bufferData" @onPrint="goPrint" :defaultText="'确认打印'"></kk-printer> -->
<kk-printer ref="kkprinter" :bufferData="bufferData" @goPrint="goPrint" :defaultText="'确认打印'"></kk-printer>
</view>
</view>
</uni-popup>
@ -75,14 +72,10 @@
</template>
<script>
import gbk from '@/components/kk-printer/utils/printUtil-GBK.js';
import util from '@/components/kk-printer/utils/util.js';
import * as blesdk from '@/components/kk-printer/utils/bluetoolth.js';
import kkPrinter from '@/components/kk-printer/index.vue';
export default {
components: {
kkPrinter
},
data() {
return {
indexList: [],
@ -99,6 +92,7 @@
carNum: 0,
carType: 0,
type: '',
bufferData:[],
checkPayData:'',
data:{},
height:0,
@ -117,6 +111,9 @@
}],
multipleList:[]
}
},
components: {
kkPrinter
},
onLoad(options) {
this.height = wx.getSystemInfoSync().windowHeight
@ -270,72 +267,33 @@
},
//点击打印按钮
goPrint(){
//打开蓝牙适配器
blesdk.openBlue().then((res)=>{
//获取已连接设备
blesdk.getConnectedBluetoothDevices().then((res)=>{
if(uni.getStorageSync('deviceId') != '' && uni.getStorageSync('serviceId') != ''){
if(res.devices.length==0 || res.length==0){
blesdk.createBLEConnection(uni.getStorageSync('deviceId'), this.onConnectSuccess, this.onConnectFail);
}else{
let datalen=20;
this.isPrinting = true;
for(var i=0;i<this.carList.length;i++){
this.onPrint(this.multipleList,this.carList[i])
this.$nextTick(()=>{
if(this.bufferData!=''){
let buffer = gbk.strToGBKByte(this.bufferData)
let opt = {
deviceId: uni.getStorageSync('deviceId'),
serviceId: uni.getStorageSync('serviceId'),
characteristicId: uni.getStorageSync('writeId'),
value:buffer,
lasterSuccess: this.onPrintSuccess,
onceLength:datalen
}
blesdk.sendDataToDevice(opt);
this.isPrinting = false;
//打印成功跳转页面
}
})
}
}
}else{
this.iosNo = true
this.isShowSearch = true
}
}).catch((err)=>{
blesdk.catchToast(err);
})
}).catch((err)=>{
blesdk.catchToast(err);
})
},
onPrint(opt,item) {
let strCmd = blesdk.CreatCPCLPage(440, 320, 1, 0);
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, '商品名:'+item.productName)
if(opt.indexOf('货号') != -1){
strCmd += blesdk.addCPCLText('0', '80', '24', '0', 0, '货 号:'+item.productSn)
}
if(opt.indexOf('供应商') != -1){
strCmd += blesdk.addCPCLText('0', '130', '24', '0', 0, '供应商:'+item.supplierName)
}
if(opt.indexOf('批发价') != -1){
strCmd += blesdk.addCPCLText('0', '180', '24', '0', 0, '批发价:'+item.wholesalePrice)
}
if(opt.indexOf('零售价') != -1){
strCmd += blesdk.addCPCLText('0', '230', '24', '0', 0, '零售价:'+item.price)
let that = this;
for(var i=0;i<that.carList.length;i++){
let item = that.carList[i]
let strCmd = blesdk.CreatCPCLPage(440, 320, 1, 0);
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, '商品名:'+item.productName)
if(this.multipleList.indexOf('货号') != -1){
console.log(this.multipleList.indexOf('货号'))
strCmd += blesdk.addCPCLText('0', '80', '24', '0', 0, '货 号:'+item.productSn)
}
if(this.multipleList.indexOf('供应商') != -1){
console.log(this.multipleList.indexOf('供应商'))
strCmd += blesdk.addCPCLText('0', '130', '24', '0', 0, '供应商:'+item.supplierName)
}
if(this.multipleList.indexOf('批发价') != -1){
console.log(this.multipleList.indexOf('批发价'))
strCmd += blesdk.addCPCLText('0', '180', '24', '0', 0, '批发价:'+item.wholesalePrice)
}
if(this.multipleList.indexOf('零售价') != -1){
console.log(this.multipleList.indexOf('零售价'))
strCmd += blesdk.addCPCLText('0', '230', '24', '0', 0, '零售价:'+item.price)
}
strCmd += blesdk.addCPCLQRCode(200, 140, 'H', '1', 6, [item.id,item.shopId]) //二维码
strCmd += blesdk.addCPCLLocation(0); //对齐指令 0-左对齐 1-右对齐 2-居中
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
}
strCmd += blesdk.addCPCLQRCode(200, 140, 'H', '1', 6, [item.id,uni.getStorageSync('shopId')]) //二维码
strCmd += blesdk.addCPCLLocation(0); //对齐指令 0-左对齐 1-右对齐 2-居中
strCmd += blesdk.addCPCLPrint();
this.bufferData = strCmd;
},
}
}
}
</script>

239
pages/inventory/goodsList1.vue

@ -331,13 +331,16 @@
<uni-icons @tap='this.$refs.historyPopup.close()' type="closeempty" color='red' size="16"
style="height:40rpx;line-height: 40rpx;position: absolute !important;bottom:0;right: 30rpx;"></uni-icons>
</view>
<view class="popup-container">
<view class="popup-container" v-if="historyList != null">
<view style="height: 60rpx;line-height: 60rpx;">上次拿货时间:</view>
<view style="height: 60rpx;line-height: 60rpx;">{{historyList.createTime}}</view>
<view style="height: 60rpx;line-height: 60rpx;">上次拿货数:{{historyList.productCount}}</view>
<view style="height: 60rpx;line-height: 60rpx;font-size: 36rpx;font-weight: bold;">上次拿货价:{{historyList.discountAmount}}</view>
</view>
<view class="popup-bottom">
<view class="popup-container" v-else>
<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>
</view>
@ -386,7 +389,7 @@
keyList: [],
temporaryList: [],
zNum: 0,
bufferData: '',
bufferData: [],
zPrice: 0,
priceOk: '', //已收金额
value: 0,
@ -472,6 +475,7 @@
productId:'',
productNum:0,
historyList:{},
printTotal:1040,
afterPrice:0 //第二次选择商品的时候,先计算这个价格,实收金额= 已经存在的实收金额 + afterPrice
}
},
@ -727,8 +731,8 @@
this.noPay = this.relPrice - this.priceOk;
},
changePrice(e) {
this.priceOk = e.target.value
this.noPay = this.relPrice - e.target.value;
this.priceOk = e.target.value >this.relPrice ?this.relPrice :e.target.value
this.noPay = this.relPrice - this.priceOk;
},
getImg(key) {
return this.carList.get(key).productPicture
@ -762,25 +766,53 @@
scanCodeAdd() {
uni.setStorageSync('saoma','1')
uni.scanCode({
// scanType: ['barCode'],
onlyFromCamera: true,
success: (res) => {
// this.productId = res.result
// this.toggle('bottom', res.result);
let shopId = res.result.split(',')[1]
if(shopId == uni.getStorageSync('shopId')){
this.productId = res.result.split(',')[0]
this.toggle('bottom', res.result.split(',')[0]);
if(res.scanType == "QR_CODE"){ //二维码
let shopId = res.result.split(',')[1]
if(shopId == uni.getStorageSync('shopId')){
this.productId = res.result.split(',')[0]
this.toggle('bottom', res.result.split(',')[0]);
if (item.saleDetailDTOList) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
this.carList.push(item.saleDetailDTOList[i])
}
}
}else{
this.tui.toast('您的店铺中暂无该商品!')
}
}else{
this.tui.toast('您的店铺中暂无该商品!')
}
},
fail: (res) => {
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
this.productId = res.result
this.tui.request("/app/product/getByBarcode", "POST", {
barcode:res.result
}, false, true).then((res1) => {
if (res1.code == 200) {
if(res1.result == ''){
this.tui.toast('您的店铺中暂无该商品!')
}else{
this.toggle('bottom', res1.result[0].id);
if (item.saleDetailDTOList) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
this.carList.push(item.saleDetailDTOList[i])
}
}
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {
this.tui.toast(res)
})
}
},
fail: (res) => {
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
})
},
//弹出商品规格选择
@ -1228,14 +1260,8 @@
//打印小票
onPrint(opt) {
let that = this;
that.yNum = 150
let heightNum = 300
heightNum += this.carList.size * 40
this.carList.forEach(function(value, key) {
heightNum += value.stockLogList.size * 30
})
let strCmd = blesdk.CreatCPCLPage(600, heightNum, 1, 0);
that.yNum = 150
let strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLSETMAG(2, 2)
blesdk.addCPCLSETBOLD('bold')
strCmd += blesdk.addCPCLLocation(2);
@ -1250,38 +1276,127 @@
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))
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)
strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value.discountAmount)
strCmd += blesdk.addCPCLText('440', that.yNum, '24', '0', 0, '总价:' + (value
.discountAmount * value1))
}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)
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)
})
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.remark)
}
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLPrint();
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.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() < this.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))
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))
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 < this.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)
}
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.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)
}
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
}
this.bufferData = strCmd;
this.$nextTick(()=>{
uni.redirectTo({
url: "/pages/index/order"
@ -1290,10 +1405,8 @@
},
//计算打印机当前行高度
countPrint(){
if((this.yNum + 30) >= (1040 * this.multiple)){
this.yNum = this.yNum + (1040 * this.multiple - this.yNum) + 50
this.multiple ++
return this.yNum
if((this.yNum + 50) >= 1040){
return this.yNum +=50
}else{
return this.yNum += 30
}

2
pages/inventory/inventory.vue

@ -435,7 +435,7 @@
.uni-mt-10 {
position: relative;
width: 74% !important;
width: 100% !important;
float: left !important;
}

Loading…
Cancel
Save