Commit 32d448e5 by LJM

add

parent 6a121254
Showing with 109 additions and 14 deletions
......@@ -19,6 +19,10 @@
</scroll-view>
</view>
<view class="fix-btn row rowCenter verCenter" @click="fixBox()">合 箱</view>
<!-- 关单封箱弹窗 -->
<uni-popup ref="inputDialog" type="dialog" :mask-click="true" @maskClick="maskClick">
<uni-popup-dialog ref="inputClose" mode="input" :title="title" value="" confirmText="确定" cancelText="取消" placeholder="请输入毛重" @close="dialogInputClose" @confirm="dialogInputConfirm" :before-close="true"></uni-popup-dialog>
</uni-popup>
</view>
</template>
......@@ -29,10 +33,14 @@
export default {
data() {
return {
email: uni.getStorageSync('email') || '', //操作人邮箱
is_focus: true, //获取焦点动态化
keyword: '',
old_box_sn_str: '',
list: []
list: [],
title: '',
box_sn: '',
wsty_id: ''
};
},
watch: {
......@@ -106,20 +114,16 @@
}
this.request(API.fixBox, 'POST', { old_box_sn_str: this.old_box_sn_str }, true).then(res => {
if (res.err_code === 0) {
uni.showModal({
title: '',
content: '合箱成功',
showCancel: false,
success: (res) => {
if (res.confirm) {
this.list = [];
// 再次获取焦点
this.clearInputAndFocus();
} else if (res.cancel) {
console.log('用户点击取消');
}
}
uni.showToast({
title: '合箱成功',
icon: 'success',
duration: 2000
});
setTimeout(() => {
this.box_sn = res.data.box_sn;
this.wsty_id = res.data.wsty_id;
this.print();
}, 2000);
} else {
uni.showToast({
title: res.err_msg,
......@@ -129,6 +133,27 @@
});
},
/**
* 打印箱号
*/
print() {
var params = {
type: 1,
email: this.email,
print_json: JSON.stringify([{ box_sn: this.box_sn }])
}
this.request(API.addSCTallyData, 'POST', params, true).then(res => {
if (res.code === 0) {
this.title = `箱号${this.box_sn}打印成功`;
this.$refs.inputDialog.open();
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
});
},
/**
* 删除
*/
deleteFix(index) {
......@@ -142,6 +167,57 @@
setTimeout(() => {
this.is_focus = true;
}, 200);
},
/**
* 点击遮罩层触发
*/
maskClick() {
this.$refs.inputDialog.close();
},
/**
* 确定
*/
dialogInputConfirm(val) {
if (!val) {
uni.showToast({
title: '请输入毛重',
icon: 'error'
});
return false;
}
// 判断 val 是否为数字
if (isNaN(val)) {
uni.showToast({
title: '请输入合法数字',
icon: 'error'
});
return false;
}
this.request(API.closeBox, 'POST', { wsty_id: this.wsty_id, gross_weight: val, box_sn: this.box_sn }, true).then(res => {
if (res.err_code === 0) {
uni.showToast({
title: '操作成功',
icon: 'success',
duration: 2000
});
setTimeout(() => {
this.list = [];
// 再次获取焦点
this.clearInputAndFocus();
}, 2000);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 不需要换箱
*/
dialogInputClose() {
this.$refs.inputDialog.close();
}
}
};
......@@ -149,4 +225,22 @@
<style scoped lang="scss">
@import '@/assets/css/tally/fixBox.scss';
::v-deep {
.uni-dialog-input {
font-size: 24rpx !important;
}
.uni-dialog-title-text {
padding: 10px;
text-align: center;
color: #404547;
font-size: 26rpx !important;
font-weight: bold !important;
}
.uni-dialog-button-group .uni-dialog-button:first-child {
display: none;
}
}
</style>
\ No newline at end of file
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