From e2b0f4792330661461fbdd18a02df3e4153aa755 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期三, 24 八月 2022 13:45:43 +0800
Subject: [PATCH] #
---
pages/basics/checkout.vue | 78 +++++++++++++++++++++++---------------
1 files changed, 47 insertions(+), 31 deletions(-)
diff --git a/pages/basics/checkout.vue b/pages/basics/checkout.vue
index 70e0790..c2a8ef5 100644
--- a/pages/basics/checkout.vue
+++ b/pages/basics/checkout.vue
@@ -9,7 +9,7 @@
<view class="square-content">
<view class="content-input">
<input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8"
- @input="findBarcode()" :focus="barcodeFocus" @focus="focuss" >
+ @input="findBarcode()" :focus="barcodeFocus" >
<uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
</view>
</view>
@@ -22,7 +22,7 @@
<view class="square-content">
<view class="content-input-combox" style="width: 94%;">
<input style="width: 90%;" type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat()":focus="focus"
- @focus="focuss">
+ >
<!-- @focus="focuss" -->
<uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons>
</view>
@@ -73,6 +73,7 @@
export default {
data() {
return {
+ commonUrl:null,
barcode: '',
barcodeFocus:true,
focus:false,
@@ -112,9 +113,16 @@
this.baseIP = UIP;
const UPORT = uni.getStorageSync('UPORT');
this.basePORT = UPORT
-
+ const PROJ = uni.getStorageSync('UPROJ');
+ this.baseUrl = PROJ
+ this.getUrl()
},
methods: {
+ // 鑾峰彇url
+ getUrl() {
+ this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl
+ },
+ // 鍑哄簱鍒嗕负涓ょ 涓�:鍏ㄦ澘鍑哄簱 鎵弿鎵樼洏鐮佹樉绀哄叏鏉垮晢鍝� 鍙互鐩存帴纭 浜屾槸鍑忔枡鍑哄簱 鎵弿鎵樼洏鐮佹彁绀洪渶瑕佸嚭搴撴暟閲� 鎵弿璐у搧鏉$爜杈惧埌鏈�澶у嚭搴撴暟閲忓嵆鍙�
messageToggle(type) {
this.msgType = type
this.messageText = `杩欐槸涓�鏉�${type}娑堟伅鎻愮ず`
@@ -124,14 +132,21 @@
// this.listLen = this.matList.length;
},
focuss() {
- // uni.hideKeyboard()
+ let that = this;
+ that.barcodeFocus = false;
+ setTimeout(()=>{
+ that.barcode = ''
+ that.barcodeFocus = true;
+ }, 100);
},
resst() {
this.matList = []
this.barcode = ''
this.matnr = ''
this.matCount = ''
+ this.removeBarcode();
uni.vibrateShort();
+
},
removeBarcode() {
this.barcode = ''
@@ -190,7 +205,7 @@
findBarcode() {
let that = this
uni.request({
- url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/barcode/auth',
+ url: that.commonUrl + '/mobile/pakout/confirm/barcode/auth',
data: {
barcode:that.barcode
},
@@ -221,6 +236,7 @@
}, 1000);
} else {
uni.showToast({title: res.msg, icon: "none",position: 'top'})
+ that.focuss()
}
}
@@ -229,8 +245,16 @@
},
findMat() {
let that = this
+ if(that.barcode == '') {
+ uni.showToast({title: '璇峰厛鎵弿鎵樼洏鐮侊紒', icon: "none",position: 'top'})
+ that.focuss()
+ setTimeout(function() {
+ that.matnr = ''
+ }, 100);
+ return;
+ }
uni.request({
- url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/pick/auth',
+ url: that.commonUrl + '/mobile/pakout/confirm/pick/auth',
data: {
wrkNo:that.wrkNo,
matnr:that.matnr
@@ -241,32 +265,23 @@
success(result) {
var res = result.data;
if(res.code === 200 ) {
- if(res.data) {
- if (that.matList.length == 0) {
- that.matList.push(res.data)
+ var add = true
+ if(res.data) {
+ console.log(that.matnr);
+ for(let i = 0;i < that.matList.length; i++) {
+ var matnr = that.matList[i].matnr + '-' + that.matList[i].batch
+ console.log(matnr);
+ if (matnr === that.matnr) {
+ that.messageToggle('warn');
+ that.messageText = '璇ュ晢鍝佸凡娣诲姞';
+ that.foucss();
+ add = false
+ }
+ }
+ if (add) {
+ that.matList.unshift(res.data);
that.listLen = that.matList.length;
that.foucss();
- return;
- }
- for(let i = 0;i<that.matList.length;i++) {
- if (that.matList.length < that.matCount){
- if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data)) {
- that.messageToggle('warn');
- that.messageText = '璇ュ晢鍝佸凡娣诲姞';
- that.foucss();
- return;
- } else {
- that.matList.unshift(res.data);
- that.listLen = that.matList.length;
- that.foucss();
- return;
- }
- } else {
- that.messageToggle('warn');
- that.messageText = '宸插嚭鍏ㄩ儴鍟嗗搧锛岃纭鍑哄簱';
- that.foucss();
- return;
- }
}
}
} else if (res.code == 403) {
@@ -278,6 +293,7 @@
}, 1000);
} else {
uni.showToast({title: res.msg, icon: "none",position: 'top'})
+ that.foucss();
}
}
@@ -309,7 +325,7 @@
}
uni.showLoading();
uni.request({
- url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/auth',
+ url: that.commonUrl + '/mobile/pakout/confirm/auth',
data: that.matList,
method: 'POST',
header: {
--
Gitblit v1.9.1