Commit 2bdbe965 by liangjianmin

js

parent 5e88be03
Showing with 93 additions and 42 deletions
......@@ -31,7 +31,7 @@
<view class="box row verCenter">
<view class="row verCenter" style="flex:0 0 93%">
<view class="label">入仓号</view>
<input type="text" v-model="form.erp_order_sn" 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>
<text class="scan iconfont icon-juxing6" @click="scanChange()"></text>
</view>
......@@ -47,6 +47,16 @@
</picker>
</view>
</view>
<view class="box row verCenter" v-if="index_print_type == 0">
<view class="label">卡板数</view>
<input type="number" @input="changeNumber()" v-model="form.number" placeholder-style="font-size:24rpx;color:#404547;" class="uni-input" placeholder="请输入卡板数" />
</view>
<template v-for="(item, index) in numberList" v-if="flag && index_print_type == 0">
<view class="box row verCenter">
<view class="label">{{ index + 1 }}卡板数量</view>
<input type="number" placeholder-style="font-size:24rpx;color:#404547;" class="uni-input" placeholder="请输入数量" @input="onInput($event, index)" />
</view>
</template>
</view>
<view class="btn row rowCenter verCenter" @click="submit()">提交打印</view>
</view>
......@@ -60,7 +70,6 @@ const ToBase64 = require('../../util/base64gb2312.js');
export default {
data() {
return {
number: '', //从条码管理列表过来的
print_number: 0,
serviceId: '',
deviceId: '',
......@@ -79,11 +88,15 @@ export default {
platform: '',
wstyptll_id: '',
batchArr: [0, 1, 2, 3, 4, 5, 6],
flag: false,
numberList: [],
form: {
batch: 0, //批次
print_type: 2, //打印类型
erp_order_sn: '', //入仓号
label_num: '1' //总箱数
label_num: '1', //总箱数
number: 1,
numbers: []
}
};
},
......@@ -117,9 +130,6 @@ export default {
}
},
methods: {
bindPickerChangeBatch(e) {
this.form.batch = e.target.value;
},
scanChange() {
uni.scanCode({
success: res => {
......@@ -135,31 +145,57 @@ export default {
}
});
},
bindPickerChange: function(e) {
this.index = e.target.value;
this.form.tray_remark = this.traySelectOption[e.target.value].wstylt_id;
uni.setStorageSync('tray_sn_index', this.index);
uni.setStorageSync('tray_sn_value', this.traySelectOption[e.target.value].wstylt_id);
/**
* 批次监听
*/
bindPickerChangeBatch(e) {
this.form.batch = e.target.value;
},
submit() {
if (!this.device_name) {
uni.showModal({
title: '提示',
content: '请连接蓝牙设备',
showCancel: false,
confirmText: '关闭',
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url: '/pages/tag/deviceList'
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
return false;
/**
* 卡板数量list监听
*/
onInput(e, index) {
this.form.numbers[index].value = e.detail.value;
},
/**
* 卡板数监听
*/
changeNumber() {
if (this.form.number > 1) {
this.flag = true;
this.numberList = [];
this.form.numbers = [];
for (var i = 0; i < this.form.number; i++) {
this.numberList.push(i);
this.form.numbers.push({
value: ''
});
}
} else {
this.flag = false;
this.numberList = [];
this.form.numbers = [];
}
},
submit() {
// if (!this.device_name) {
// uni.showModal({
// title: '提示',
// content: '请连接蓝牙设备',
// showCancel: false,
// confirmText: '关闭',
// success: function(res) {
// if (res.confirm) {
// uni.navigateTo({
// url: '/pages/tag/deviceList'
// });
// } else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// });
// return false;
// }
if (!this.form.erp_order_sn) {
uni.showModal({
title: '提示',
......@@ -187,6 +223,26 @@ export default {
return false;
}
if (this.index_print_type == 0 && this.form.number > 1) {
let label_num = this.form.label_num * 1; //总箱数
let num = 0;
if (this.form.numbers.length > 1) {
for (let i = 0; i < this.form.numbers.length; i++) {
num += this.form.numbers[i].value * 1;
}
}
if (label_num != num) {
uni.showModal({
title: '提示',
content: '卡板数量总和必须等于总箱数',
showCancel: false
});
return false;
}
}
let params = Object.assign(this.form, {
is_add: 0
});
......@@ -365,17 +421,7 @@ export default {
});
},
change(index, type) {
if (type == 'erp_order_sn_pre') {
//订单类型
this.index_erp_order_sn_pre = index;
if (index == 0) {
this.form.erp_order_sn_pre = 'A';
} else if (index == 1) {
this.form.erp_order_sn_pre = 'B';
} else if (index == 2) {
this.form.erp_order_sn_pre = 'D';
}
} else if (type == 'print_type') {
if (type == 'print_type') {
//打印类型
this.index_print_type = index;
if (index == 0) {
......@@ -386,6 +432,11 @@ export default {
this.form.print_type = 2;
this.text = '标签数量';
this.print_text = '箱号';
//置空卡板
this.flag = false;
this.form.number = '';
this.form.numbers = [];
}
}
}
......
const API_BASE = 'https://api.ichunt.com';
//const API_BASE = 'http://api.liexin.com';
//const API_BASE = 'https://api.ichunt.com';
const API_BASE = 'http://api.liexin.com';
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