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

113
pages/index/orderDetail.vue

@ -292,6 +292,7 @@
import util from '@/components/kk-printer/utils/util.js'; import util from '@/components/kk-printer/utils/util.js';
import * as blesdk from '@/components/kk-printer/utils/bluetoolth.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 { import {
maskShopName, maskShopName,
maskPhone maskPhone
@ -336,7 +337,8 @@
sAmout: 0, sAmout: 0,
yNum: 150, yNum: 150,
printTotal: 1040, printTotal: 1040,
zReturnNum: "" zReturnNum: "",
deviceType: 'ios'
} }
}, },
components: { components: {
@ -396,6 +398,7 @@
this.type = uni.getStorageSync('type') this.type = uni.getStorageSync('type')
}, },
onLoad(option) { onLoad(option) {
var that = this;
this.saleId = option.id this.saleId = option.id
if (option.id != null && option.id != undefined && option.id != "") { if (option.id != null && option.id != undefined && option.id != "") {
if (option.type == 'gys') { if (option.type == 'gys') {
@ -443,6 +446,12 @@
}).catch((res) => {}) }).catch((res) => {})
} }
} }
uni.getSystemInfo({
success(res) {
that.deviceType = res.osName
console.log('设备类型', res.osName)
}
})
}, },
methods: { methods: {
deleteOrder() { deleteOrder() {
@ -636,8 +645,7 @@
}) })
}, },
//打印贴包单 goPrint(type){
onPrint(opt) {
let strCmd = '' let strCmd = ''
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 1); strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 1);
strCmd += blesdk.addCPCLSETMAG(2, 2) strCmd += blesdk.addCPCLSETMAG(2, 2)
@ -654,14 +662,18 @@
strCmd += blesdk.addCPCLText('50', '330', '24', '0', 0, this.sales.province + '/' + this.sales.city + '/' + strCmd += blesdk.addCPCLText('50', '330', '24', '0', 0, this.sales.province + '/' + this.sales.city + '/' +
this.sales.area) this.sales.area)
strCmd += blesdk.addCPCLSETMAG(1, 1) strCmd += blesdk.addCPCLSETMAG(1, 1)
if (this.sales.receiveAddress.length > 20) { if(type == 'confirm'){
let position = 20; strCmd += blesdk.addCPCLText('50', '410', '24', '0', 0, "*****")
let part1 = this.sales.receiveAddress.substring(0, position); }else{
let part2 = this.sales.receiveAddress.substring(position); if (this.sales.receiveAddress.length > 20) {
strCmd += blesdk.addCPCLText('50', '410', '24', '0', 0, part1) let position = 20;
strCmd += blesdk.addCPCLText('50', '440', '24', '0', 0, part2) let part1 = this.sales.receiveAddress.substring(0, position);
} else { let part2 = this.sales.receiveAddress.substring(position);
strCmd += blesdk.addCPCLText('50', '410', '24', '0', 0, this.sales.receiveAddress) 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) strCmd += blesdk.addCPCLSETMAG(2, 2)
blesdk.addCPCLSETBOLD('bold') blesdk.addCPCLSETBOLD('bold')
@ -676,11 +688,90 @@
strCmd += blesdk.addCPCLLocation(0); strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLPrint(); strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd); this.bufferData.push(strCmd);
this.xierushuju(this.bufferData)
this.$nextTick(() => { this.$nextTick(() => {
this.bufferData = [] this.bufferData = []
uni.hideLoading(); 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 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');
}
}
})
},
//计算打印机当前行高度 //计算打印机当前行高度
countPrint() { countPrint() {
if ((this.yNum + 50) >= 1040) { if ((this.yNum + 50) >= 1040) {

13
pages/index/peopleList.vue

@ -153,7 +153,8 @@
searchName:'', searchName:'',
pages: 1, pages: 1,
totalPages: 0, totalPages: 0,
noClick:0 noClick:0,
hour:0
} }
}, },
onReachBottom() { onReachBottom() {
@ -315,6 +316,10 @@
this.tui.toast(this.popleType== 'wlName'?'物流公司已下线': this.popleType== 'fcName'?'厢货车已下线': this.popleType== 'dbName'?'大巴车已下线':this.popleType== 'lbgName'?'拉包工已下线':this.popleType== 'kdyName'?'快递员已下线':'公司已下线') this.tui.toast(this.popleType== 'wlName'?'物流公司已下线': this.popleType== 'fcName'?'厢货车已下线': this.popleType== 'dbName'?'大巴车已下线':this.popleType== 'lbgName'?'拉包工已下线':this.popleType== 'kdyName'?'快递员已下线':'公司已下线')
return return
} }
if(this.isAfterNoon() && this.popleType== 'dbName'){
this.tui.toast('大巴车已下线')
return
}
if(this.noClick == 0){ if(this.noClick == 0){
let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。 let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
let prevPage = pages[pages.length - 2]; //上一页页面实例 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) { clickPhone(phone) {
uni.makePhoneCall({ uni.makePhoneCall({

1
pages/index/shopInfo.vue

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

5
pages/inventory/goodsList1.vue

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

7
pages/login/login.vue

@ -108,6 +108,13 @@
} }
}, },
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) { onLoad(option) {
this.saleId = option.saleId this.saleId = option.saleId
this.userId = option.userId this.userId = option.userId

7
pages/login/register.vue

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

Loading…
Cancel
Save