wangfukang 3 years ago
parent
commit
a78ba7c01d
  1. 183
      pages/index/orderDetail.vue
  2. 13
      pages/index/peopleList.vue
  3. 3
      pages/index/shopInfo.vue
  4. 9
      pages/inventory/goodsList1.vue
  5. 9
      pages/login/login.vue
  6. 7
      pages/login/register.vue

183
pages/index/orderDetail.vue

@ -291,7 +291,8 @@
<script>
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';
import kkPrinter from '@/components/kk-printer/index.vue';
import gbk from '@/components/kk-printer/utils/printUtil-GBK.js';
import {
maskShopName,
maskPhone
@ -336,7 +337,8 @@
sAmout: 0,
yNum: 150,
printTotal: 1040,
zReturnNum: ""
zReturnNum: "",
deviceType: 'ios'
}
},
components: {
@ -395,7 +397,8 @@
this.lbgName = JSON.parse(JSON.stringify(this.lbgName))
this.type = uni.getStorageSync('type')
},
onLoad(option) {
onLoad(option) {
var that = this;
this.saleId = option.id
if (option.id != null && option.id != undefined && option.id != "") {
if (option.type == 'gys') {
@ -442,7 +445,13 @@
}
}).catch((res) => {})
}
}
}
uni.getSystemInfo({
success(res) {
that.deviceType = res.osName
console.log('设备类型', res.osName)
}
})
},
methods: {
deleteOrder() {
@ -635,50 +644,132 @@
uni.hideLoading();
})
},
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.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)
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)
if(type == 'confirm'){
strCmd += blesdk.addCPCLText('50', '410', '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)
} 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.addCPCLSETMAG(2, 2)
strCmd += blesdk.addCPCLText('0', '650', '24', '0', 0, '——————————————————————————————')
strCmd += blesdk.addCPCLText('50', '730', '24', '0', 0, '店铺:' + maskShopName(this.sales.shopName))
strCmd += blesdk.addCPCLText('50', '810', '24', '0', 0, maskPhone(this.sales.createByPhone))
strCmd += blesdk.addCPCLText('50', '890', '24', '0', 0, '地址:' + this.shopData.shopAddress)
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
this.xierushuju(this.bufferData)
this.$nextTick(() => {
this.bufferData = []
uni.hideLoading();
})
},
xierushuju() {
let that = this;
//写入数据
if (this.defaultText == '打印小票') {
that.$emit('onPrintSmall');
} else if (this.defaultText == '确认打印') {
that.$emit('goPrint');
} else {
that.$emit('onPrint');
}
console.log('查看数据是否正确', that.bufferData)
that.$nextTick(() => {
var dataStr = ''
for (let m = 0; m < that.bufferData.length; m++) {
dataStr += that.bufferData[m]
}
const maxChunk = that.deviceType == 'android' ? 20 : 180;
const delay = that.deviceType == 'android' ? 20 : 180;
let buffer = gbk.strToGBKByte(dataStr)
for (let i = 0, j = 0, length = buffer.byteLength; i < length; i += maxChunk, j++) {
let subPackage = buffer.slice(i, i + maxChunk <= length ? (i + maxChunk) : length);
setTimeout(that._writeBLECharacteristicValue, j * delay, subPackage);
}
})
return;
},
_writeBLECharacteristicValue(buffer) {
let that = this;
wx.writeBLECharacteristicValue({
deviceId: uni.getStorageSync('deviceId'),
serviceId: uni.getStorageSync('serviceId'),
characteristicId: uni.getStorageSync('characteristicId'),
value: buffer,
success(res) {
console.log('打印buffer', buffer)
console.log('writeBLECharacteristicValue success', res)
},
fail(res) {
console.log('writeBLECharacteristicValue fail', res)
wx.closeBLEConnection({
deviceId: uni.getStorageSync('deviceId'),
success(res) {
console.log(res)
}
})
if (uni.getStorageSync('deviceId')) {
console.log("111")
that.xierushuju()
} else {
that.jiantingshebei()
}
}
})
uni.hideLoading();
},
//打印贴包单
onPrint(opt) {
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.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)
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)
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.addCPCLSETMAG(2, 2)
strCmd += blesdk.addCPCLText('0', '650', '24', '0', 0, '——————————————————————————————')
strCmd += blesdk.addCPCLText('50', '730', '24', '0', 0, '店铺:' + maskShopName(this.sales.shopName))
strCmd += blesdk.addCPCLText('50', '810', '24', '0', 0, maskPhone(this.sales.createByPhone))
strCmd += blesdk.addCPCLText('50', '890', '24', '0', 0, '地址:' + this.shopData.shopAddress)
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
this.$nextTick(() => {
this.bufferData = []
uni.hideLoading();
onPrint(opt) {
let that = this;
uni.showModal({
title: "提示",
content: "要隐藏客户信息吗?",
cancelText:'不隐藏',
confirmText:'隐藏',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
that.goPrint('confirm');
}
if(res.cancel){
console.log('用户点击取消');
that.goPrint('cancel');
}
}
})
},
//计算打印机当前行高度

13
pages/index/peopleList.vue

@ -153,7 +153,8 @@
searchName:'',
pages: 1,
totalPages: 0,
noClick:0
noClick:0,
hour:0
}
},
onReachBottom() {
@ -315,6 +316,10 @@
this.tui.toast(this.popleType== 'wlName'?'物流公司已下线': this.popleType== 'fcName'?'厢货车已下线': this.popleType== 'dbName'?'大巴车已下线':this.popleType== 'lbgName'?'拉包工已下线':this.popleType== 'kdyName'?'快递员已下线':'公司已下线')
return
}
if(this.isAfterNoon() && this.popleType== 'dbName'){
this.tui.toast('大巴车已下线')
return
}
if(this.noClick == 0){
let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
let prevPage = pages[pages.length - 2]; //上一页页面实例
@ -333,6 +338,12 @@
})
}
},
//厢货车判断是否超过了下午两点,超过不能选择
isAfterNoon() {
const now = new Date();
const hour = now.getHours();
return hour >= 14; // 下午2点对应的小时数是14(注意:JS中的getHours() 返回的是0到23的整数)
},
//拨打电话
clickPhone(phone) {
uni.makePhoneCall({

3
pages/index/shopInfo.vue

@ -55,7 +55,8 @@
}
if (this.addForm.confirm !== this.addForm.newPass) return this.tui.toast('两次密码不一致', 2000, )
this.tui.request("/user/modifyPassAndMobile", "post", {
mobile: this.addForm.mobile,
mobile: this.addForm.mobile,
username: this.addForm.mobile,
password: this.addForm.password,
newPass: this.addForm.newPass,
userId: this.userId

9
pages/inventory/goodsList1.vue

@ -2129,7 +2129,8 @@
let that = this;
uni.showLoading({
title: '加载中...'
})
})
this.$refs.showPopup.close()
if (this.khName == '') {
this.tui.toast('请选择客户!')
return
@ -2241,8 +2242,10 @@
} else {
this.tui.toast(res.message)
}
})
uni.hideLoading();
})
setTimeout(res => {
uni.hideLoading();
}, 1000)
},
//打印取消按钮
// printChenel() {

9
pages/login/login.vue

@ -107,7 +107,14 @@
saleId:''
}
},
computed: mapState(['type']),
computed: mapState(['type']),
onShareAppMessage() {
return {
title: '邀请您注册快衣店',
imageUrl:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/abdc5c897c4f4fe198b74091a708030b.jpg',
path: '/pages/login/login'
}
},
onLoad(option) {
this.saleId = option.saleId
this.userId = option.userId

7
pages/login/register.vue

@ -101,6 +101,13 @@
isChoose:false,
clock: 60 ,// 倒计时
}
},
onShareAppMessage() {
return {
title: '邀请您注册快衣店',
imageUrl:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/abdc5c897c4f4fe198b74091a708030b.jpg',
path: '/pages/login/register'
}
},
onLoad(option) {
if(option){

Loading…
Cancel
Save