Commit 413f8e65 by liangjianmin

打印需求

parent 1fc371ba
...@@ -56,6 +56,12 @@ ...@@ -56,6 +56,12 @@
font-size: 52rpx; font-size: 52rpx;
color: #197adb; color: #197adb;
} }
.pick-box {
width: calc(100% - 156rpx);
.picker {
width: 100%;
}
}
.tab { .tab {
.tab-pane { .tab-pane {
width: 100rpx; width: 100rpx;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<view class="box row verCenter"> <view class="box row verCenter">
<view class="row verCenter" style="flex:0 0 93%"> <view class="row verCenter" style="flex:0 0 93%">
<view class="label">入仓号</view> <view class="label">入仓号</view>
<input type="text" v-model="form.erp_order_sn_number" placeholder-style="font-size:24rpx;color:#404547;" class="uni-input" placeholder="请输入" /> <input type="text" v-model="form.erp_order_sn" placeholder-style="font-size:24rpx;color:#404547;" class="uni-input" placeholder="请输入" />
</view> </view>
<text class="scan iconfont icon-juxing6" @click="scanChange()"></text> <text class="scan iconfont icon-juxing6" @click="scanChange()"></text>
</view> </view>
...@@ -39,6 +39,14 @@ ...@@ -39,6 +39,14 @@
<view class="label">{{ text }}</view> <view class="label">{{ text }}</view>
<input type="number" v-model="form.label_num" placeholder-style="font-size:24rpx;color:#404547;" class="uni-input" placeholder="请输入" /> <input type="number" v-model="form.label_num" placeholder-style="font-size:24rpx;color:#404547;" class="uni-input" placeholder="请输入" />
</view> </view>
<view class="box row verCenter">
<view class="label">批次</view>
<view class="pick-box row">
<picker @change="bindPickerChangeBatch" :value="form.batch" :range="batchArr" class="picker">
<view class="uni-input">{{ batchArr[form.batch] }}</view>
</picker>
</view>
</view>
</view> </view>
<view class="btn row rowCenter verCenter" @click="submit()">提交打印</view> <view class="btn row rowCenter verCenter" @click="submit()">提交打印</view>
</view> </view>
...@@ -70,9 +78,11 @@ export default { ...@@ -70,9 +78,11 @@ export default {
print_text: '总箱数', print_text: '总箱数',
platform: '', platform: '',
wstyptll_id: '', wstyptll_id: '',
batchArr: [0, 1, 2, 3, 4, 5, 6],
form: { form: {
batch: 0, //批次
print_type: 1, //打印类型 print_type: 1, //打印类型
erp_order_sn_number: '', //入仓号 erp_order_sn: '', //入仓号
label_num: '1' //总箱数 label_num: '1' //总箱数
} }
}; };
...@@ -80,22 +90,6 @@ export default { ...@@ -80,22 +90,6 @@ export default {
onLoad(option) { onLoad(option) {
this.platform = getPlatform(); this.platform = getPlatform();
//从条码管理列表过来的 赋值订单类型和入仓号
if (option.number) {
let str = option.number;
this.form.erp_order_sn_pre = str.charAt(0);
this.form.erp_order_sn_number = str.substring(1, str.length);
if (option.number.charAt(0) == 'A') {
this.index_erp_order_sn_pre = 0;
}
if (option.number.charAt(0) == 'B') {
this.index_erp_order_sn_pre = 1;
}
if (option.number.charAt(0) == 'D') {
this.index_erp_order_sn_pre = 2;
}
}
//停止搜索,节省系统资源 //停止搜索,节省系统资源
uni.stopBluetoothDevicesDiscovery({ uni.stopBluetoothDevicesDiscovery({
success: res => { success: res => {
...@@ -123,11 +117,14 @@ export default { ...@@ -123,11 +117,14 @@ export default {
} }
}, },
methods: { methods: {
bindPickerChangeBatch(e) {
this.form.batch = e.target.value;
},
scanChange() { scanChange() {
uni.scanCode({ uni.scanCode({
success: res => { success: res => {
if (res.errMsg == 'scanCode:ok') { if (res.errMsg == 'scanCode:ok') {
this.form.erp_order_sn_number = res.result; this.form.erp_order_sn = res.result;
} }
}, },
fail: function(res) { fail: function(res) {
...@@ -163,43 +160,33 @@ export default { ...@@ -163,43 +160,33 @@ export default {
}); });
return false; return false;
} }
/* if (!this.form.erp_order_sn_pre) { if (!this.form.erp_order_sn) {
uni.showToast({ uni.showModal({
icon: 'error', title: '提示',
title: '请选择订单类型' content: '请输入入仓号',
}); showCancel: false
return false;
} */
if (!this.form.erp_order_sn_number) {
uni.showToast({
icon: 'error',
title: '请输入入仓号'
});
return false;
}
if (!/(^[0-9]*$)/.test(this.form.erp_order_sn_number)) {
uni.showToast({
icon: 'error',
title: '入仓号为纯数字'
}); });
return false; return false;
} }
if (!this.form.label_num) { if (!this.form.label_num) {
uni.showToast({ uni.showModal({
icon: 'error', title: '提示',
title: '请输入' + this.text content: '请输入' + this.text,
showCancel: false
}); });
return false; return false;
} }
if (!/(^[0-9]*$)/.test(this.form.label_num)) { if (!/(^[0-9]*$)/.test(this.form.label_num)) {
uni.showToast({ uni.showModal({
icon: 'error', title: '提示',
title: this.text + '为纯数字' content: this.text + '为纯数字',
showCancel: false
}); });
return false; return false;
} }
this.request(API.printLabel, 'POST', this.form, false).then(res => { this.request(API.printLabel, 'POST', this.form, false).then(res => {
if (res.err_code === 0) { if (res.err_code === 0) {
this.printLabelData = res.data; this.printLabelData = res.data;
...@@ -239,9 +226,9 @@ export default { ...@@ -239,9 +226,9 @@ export default {
data.push('T 8 0 10 180 时间:' + this.printLabelData[this.print_number].create_time_cn + '\r\n'); data.push('T 8 0 10 180 时间:' + this.printLabelData[this.print_number].create_time_cn + '\r\n');
data.push('T 8 0 10 220 仓库代码:' + this.printLabelData[this.print_number].warehouse_code + '\r\n'); data.push('T 8 0 10 220 仓库代码:' + this.printLabelData[this.print_number].warehouse_code + '\r\n');
data.push('T 8 0 10 260 流水号:' + this.printLabelData[this.print_number].wstyptll_id_sn + '\r\n'); data.push('T 8 0 10 260 流水号:' + this.printLabelData[this.print_number].wstyptll_id_sn + '\r\n');
data.push('SETMAG 4 1'); data.push('SETMAG 4 1' + '\r\n');
data.push('T 8 0 350 30 #1'); data.push('T 8 0 350 30 ' + this.printLabelData[this.print_number].batch + '\r\n');
data.push('SETMAG 0 0'); data.push('SETMAG 0 0' + '\r\n');
data.push('B QR 280 110 M 2 U 8\r\n'); data.push('B QR 280 110 M 2 U 8\r\n');
data.push('MA,' + this.printLabelData[this.print_number]['box_code'] + '|\r\n'); data.push('MA,' + this.printLabelData[this.print_number]['box_code'] + '|\r\n');
data.push('ENDQR\r\n'); data.push('ENDQR\r\n');
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<view class="box row verCenter"> <view class="box row verCenter">
<view class="row verCenter" style="flex:0 0 93%"> <view class="row verCenter" style="flex:0 0 93%">
<view class="label">入仓号</view> <view class="label">入仓号</view>
<input type="text" v-model="form.erp_order_sn_number" placeholder-style="font-size:24rpx;color:#404547;" class="uni-input" placeholder="请输入" /> <input type="text" v-model="form.erp_order_sn" placeholder-style="font-size:24rpx;color:#404547;" class="uni-input" placeholder="请输入" />
</view> </view>
<text class="scan iconfont icon-juxing6" @click="scanChange()"></text> <text class="scan iconfont icon-juxing6" @click="scanChange()"></text>
</view> </view>
...@@ -39,6 +39,14 @@ ...@@ -39,6 +39,14 @@
<view class="label">{{ text }}</view> <view class="label">{{ text }}</view>
<input type="number" v-model="form.label_num" placeholder-style="font-size:24rpx;color:#404547;" class="uni-input" placeholder="请输入" /> <input type="number" v-model="form.label_num" placeholder-style="font-size:24rpx;color:#404547;" class="uni-input" placeholder="请输入" />
</view> </view>
<view class="box row verCenter">
<view class="label">批次</view>
<view class="pick-box row">
<picker @change="bindPickerChangeBatch" :value="form.batch" :range="batchArr" class="picker">
<view class="uni-input">{{ batchArr[form.batch] }}</view>
</picker>
</view>
</view>
</view> </view>
<view class="btn row rowCenter verCenter" @click="submit()">提交打印</view> <view class="btn row rowCenter verCenter" @click="submit()">提交打印</view>
</view> </view>
...@@ -66,11 +74,14 @@ export default { ...@@ -66,11 +74,14 @@ export default {
platform: 'android', platform: 'android',
printLabelData: [], printLabelData: [],
wstyptll_id: '', wstyptll_id: '',
batchArr: [0, 1, 2, 3, 4, 5, 6],
form: { form: {
batch: 0, //批次
is_add: 1, is_add: 1,
print_type: 1, print_type: 1,
erp_order_sn_pre: '', erp_order_sn_pre: '',
erp_order_sn_number: '', erp_order_sn_number: '',
erp_order_sn: '', //入仓号
label_num: '' label_num: ''
} }
}; };
...@@ -105,11 +116,14 @@ export default { ...@@ -105,11 +116,14 @@ export default {
} }
}, },
methods: { methods: {
bindPickerChangeBatch(e) {
this.form.batch = e.target.value;
},
scanChange() { scanChange() {
uni.scanCode({ uni.scanCode({
success: res => { success: res => {
if (res.errMsg == 'scanCode:ok') { if (res.errMsg == 'scanCode:ok') {
this.form.erp_order_sn_number = res.result; this.form.erp_order_sn = res.result;
} }
}, },
fail: function(res) { fail: function(res) {
...@@ -139,46 +153,34 @@ export default { ...@@ -139,46 +153,34 @@ export default {
}); });
return false; return false;
} }
if (!this.form.erp_order_sn_pre) { if (!this.form.erp_order_sn) {
uni.showToast({ uni.showModal({
icon: 'error', title: '提示',
title: '请选择订单类型' content: '请输入入仓号',
}); showCancel: false
return false;
}
if (!this.form.erp_order_sn_number) {
uni.showToast({
icon: 'error',
title: '请输入入仓号'
});
return false;
}
if (!/(^[0-9]*$)/.test(this.form.erp_order_sn_number)) {
uni.showToast({
icon: 'error',
title: '入仓号为纯数字'
}); });
return false; return false;
} }
if (!this.form.label_num) { if (!this.form.label_num) {
uni.showToast({ uni.showModal({
icon: 'error', title: '提示',
title: '请输入' + this.text content: '请输入' + this.text,
showCancel: false
}); });
return false; return false;
} }
if (!/(^[0-9]*$)/.test(this.form.label_num)) { if (!/(^[0-9]*$)/.test(this.form.label_num)) {
uni.showToast({ uni.showModal({
icon: 'error', title: '提示',
title: this.text + '为纯数字' content: this.text + '为纯数字',
showCancel: false
}); });
return false; return false;
} }
this.request(API.printLabel, 'POST', { erp_order_sn_pre: this.form.erp_order_sn_pre, erp_order_sn_number: this.form.erp_order_sn_number, label_num: this.form.label_num, is_add: 1, print_type: this.form.print_type }, true).then(res => { this.request(API.printLabel, 'POST', { erp_order_sn: this.form.erp_order_sn, batch: this.form.batch, label_num: this.form.label_num, is_add: 1, print_type: this.form.print_type }, true).then(res => {
if (res.err_code === 0) { if (res.err_code === 0) {
this.printLabelData = res.data; this.printLabelData = res.data;
this.wstyptll_id = res.data[0].wstyptll_id; this.wstyptll_id = res.data[0].wstyptll_id;
...@@ -217,6 +219,9 @@ export default { ...@@ -217,6 +219,9 @@ export default {
data.push('T 8 0 10 180 时间:' + this.printLabelData[this.print_number].create_time_cn + '\r\n'); data.push('T 8 0 10 180 时间:' + this.printLabelData[this.print_number].create_time_cn + '\r\n');
data.push('T 8 0 10 220 仓库代码:' + this.printLabelData[this.print_number].warehouse_code + '\r\n'); data.push('T 8 0 10 220 仓库代码:' + this.printLabelData[this.print_number].warehouse_code + '\r\n');
data.push('T 8 0 10 260 流水号:' + this.printLabelData[this.print_number].wstyptll_id_sn + '\r\n'); data.push('T 8 0 10 260 流水号:' + this.printLabelData[this.print_number].wstyptll_id_sn + '\r\n');
data.push('SETMAG 4 1' + '\r\n');
data.push('T 8 0 350 30 ' + this.printLabelData[this.print_number].batch + '\r\n');
data.push('SETMAG 0 0' + '\r\n');
data.push('B QR 280 110 M 2 U 8\r\n'); data.push('B QR 280 110 M 2 U 8\r\n');
data.push('MA,' + this.printLabelData[this.print_number]['box_code'] + '|\r\n'); data.push('MA,' + this.printLabelData[this.print_number]['box_code'] + '|\r\n');
data.push('ENDQR\r\n'); data.push('ENDQR\r\n');
......
const API_BASE = 'https://api.ichunt.com'; //const API_BASE = 'https://api.ichunt.com';
//const API_BASE = 'http://api.liexin.com'; const API_BASE = 'http://api.liexin.com';
const API = { const API = {
/** /**
* 上传数据 * 上传数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment