From dcb4247056504024bdb9f685776e27e45d174b67 Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期一, 09 五月 2022 23:17:04 +0800
Subject: [PATCH] ##
---
pages/basics/checkout.vue | 142 ++++++++++++++++++++++++++++++++++++----------
1 files changed, 110 insertions(+), 32 deletions(-)
diff --git a/pages/basics/checkout.vue b/pages/basics/checkout.vue
index 7c591fd..7512b4c 100644
--- a/pages/basics/checkout.vue
+++ b/pages/basics/checkout.vue
@@ -8,7 +8,9 @@
</view>
<view class="square-content">
<view class="content-input">
- <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8" @input="findBarcode()">
+ <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8"
+ @input="findBarcode()" :focus="barcodeFocus" >
+ <!-- @focus="focuss" -->
<uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
</view>
</view>
@@ -26,17 +28,24 @@
</view>
</view> -->
- <view class="square-2">
+ <view class="square-3">
<view class="square-title">
<view class="title-sign"><view class="sign"></view></view>
<view class="title-text"><text>璐у搧鏉$爜</text></view>
</view>
<view class="square-content">
+ <text>绔欏彴锛�</text>
<view class="content-combox">
- <uni-combox emptyTips="鏆傛棤鏁版嵁" :candidates="staNoList" v-model="staNo" placeholder="绔欏彴鍙�"></uni-combox>
+ <uni-combox emptyTips="鏆傛棤鏁版嵁" :candidates="siteList" v-model="desc" placeholder="绔欏彴鍙�"
+ @input="choseStaNo"></uni-combox>
</view>
+ </view>
+ <view class="square-content">
+ <text>璐у搧鏉$爜锛�</text>
<view class="content-input-combox">
- <input type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat()">
+ <input type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat()"
+ :focus="focus" >
+ <!-- @focus="focuss" -->
<uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons>
</view>
</view>
@@ -72,7 +81,7 @@
<checkbox-group @change="checkbox">
<view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
<view class="data-list-left">
- <view class="matnr">{{item.barcode}}</view>
+ <view class="matnr">{{item.matnr}}-{{item.batch}}</view>
</view>
<view class="data-list-right">
<uni-icons type="trash" size="25" color="#a5a5a5" @click="remove(item,index)"></uni-icons>
@@ -97,14 +106,18 @@
data() {
return {
barcode: '',
+ barcodeFocus:true,
+ focus:false,
type: 'center',
searchBox: 'hide',
pick:'hide',
matnr:'',
- matList:[{barcode:'92992929292'}],
+ matList:[],
result: '',
+ siteList:[],
+ desc:'',
staNoList:[],
- staNo:'',
+ satNo:'',
}
},
mounted(){
@@ -115,19 +128,38 @@
this.getOutBound();
},
methods: {
+ choseStaNo() {
+ for (var i = 0;i < this.staNoList.length; i++) {
+ if (this.desc == this.staNoList[i].desc) {
+ this.staNo = this.staNoList[i].siteId
+ }
+ }
+ },
+ focuss() {
+ uni.hideKeyboard()
+ },
resst() {
this.matList = []
this.barcode = ''
this.matnr = ''
+ this.desc = ''
uni.vibrateShort();
},
removeBarcode() {
this.barcode = ''
- uni.vibrateShort();
+ uni.vibrateShort();
+ this.barcodeFocus = false;
+ this.$nextTick(function() {
+ this.barcodeFocus = true;
+ });
},
removeMatnr() {
this.matnr = ''
uni.vibrateShort();
+ this.focus = false;
+ this.$nextTick(function() {
+ this.focus = true;
+ });
},
remove(item,index) {
this.matList.splice(index,1)
@@ -136,21 +168,18 @@
comb() {
uni.vibrateShort();
let that = this;
- if (that.barcode === '') {
- uni.showToast({title: '璇锋壂鎻忔墭鐩樻潯鐮�', icon: "none", position: 'top'});
- return;
- }
- if (that.matList.length === 0) {
- uni.showToast({title: '璇锋坊鍔犲晢鍝佸垪琛�', icon: "none", position: 'top'});
- return;
- }
+ // if (that.barcode === '') {
+ // uni.showToast({title: '璇锋壂鎻忔墭鐩樻潯鐮�', icon: "none", position: 'top'});
+ // return;
+ // }
+ // if (that.matList.length === 0) {
+ // uni.showToast({title: '璇锋坊鍔犲晢鍝佸垪琛�', icon: "none", position: 'top'});
+ // return;
+ // }
uni.showLoading();
uni.request({
- url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/comb/auth',
- data: JSON.stringify({
- barcode: that.barcode,
- combMats: that.matList
- }),
+ url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/auth',
+ data: that.matList,
method: 'POST',
header: {
'token':uni.getStorageSync('token')
@@ -164,6 +193,10 @@
position: 'bottom',
duration: 1000
});
+ that.matList = []
+ that.barcode = ''
+ that.matnr = ''
+ that.desc = ''
} else if (res.code == 403) {
uni.showToast({title: res.msg, icon: "none", position: 'top'})
setTimeout(() => {
@@ -209,10 +242,45 @@
'token':uni.getStorageSync('token')
},
success(result) {
- console.log(result)
+ var res = result.data;
+ if(res.data) {
+ for(let i = 0;i<that.matList.length;i++) {
+ for (let j = 0;j < res.data.length; j++) {
+ if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data[j])) {
+ res.data.splice(j,1)
+ }
+ }
+ }
+ that.matList = res.data.concat(that.matList)
+ // that.matList = that.matList.concat(res.data)
+ }
}
});
+ },
+ addMatList(mat) {
+ console.log(mat)
+ if (this.matList.length == 0){
+
+ // this.matList.push(mat[0])
+ // this.matList.prototype.push.apply(mat)
+ } else {
+
+ let toUnshift = true
+ for (var i = 0; i < this.matList.length; i++) {
+ let matnr = this.matList[i].matnr
+ if (matnr == this.matList[i].matnr) {
+ // this.messageToggle('warn')
+ // this.messageText = matnr + '宸茬粡鎵弿锛岃鍕块噸澶嶆壂鎻�'
+ toUnshift = false
+ }
+ }
+ if (toUnshift) {
+ this.matList.unshift(mat[0])
+ }
+
+ }
+ console.log(this.matList)
},
findBarcode() {
let that = this
@@ -222,10 +290,23 @@
barcode:that.barcode
},
header: {
- 'token':uni.getStorageSync('token')
+ 'token':uni.getStorageSync('token'),
+
},
success(result) {
- console.log(result)
+ var res = result.data;
+ console.log(res)
+ if(res.data) {
+ for(let i = 0;i<that.matList.length;i++) {
+ for (let j = 0;j < res.data.length; j++) {
+ if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data[j])) {
+ res.data.splice(j,1)
+ }
+ }
+ }
+ that.matList = res.data.concat(that.matList)
+ // that.matList = that.matList.concat(res.data)
+ }
}
});
@@ -234,7 +315,7 @@
getOutBound() { // 鑾峰彇鍑哄簱鍙�
let that = this
uni.request({
- url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/available/take/check/site',
+ url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/available/take/site',
method: 'POST',
header: {
'token':uni.getStorageSync('token')
@@ -242,6 +323,9 @@
success(result) {
var res = result.data
if (res.code === 200) {
+ for (var i = 0; i < res.data.length; i++){
+ that.siteList.push(res.data[i].desc)
+ }
that.staNoList = res.data
} else if (res.code == 403) {
uni.showToast({title: res.msg, icon: "none", position: 'top'})
@@ -261,7 +345,6 @@
}, // getCheckDetl
change(e) {
- console.log('褰撳墠妯″紡锛�' + e.type + ',鐘舵�侊細' + e.show);
},
toggle(type) {
this.type = type
@@ -348,12 +431,7 @@
margin-top: 5rpx;
margin-right: 10rpx;
}
- .combox {
- position: fixed;
- display: inline-block;
- width: 28%;
- float: right;
- }
+
/* .pak-seach-box input {
background-color: #ededed;
border: 1rpx solid #d8d8d8;
--
Gitblit v1.9.1