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 | 327 +++++++++++++++++++++++++++++-------------------------
1 files changed, 177 insertions(+), 150 deletions(-)
diff --git a/pages/basics/checkout.vue b/pages/basics/checkout.vue
index aba9c37..c2a8ef5 100644
--- a/pages/basics/checkout.vue
+++ b/pages/basics/checkout.vue
@@ -1,6 +1,6 @@
<template>
<view >
- <scroll-view scroll-y catch:touchmove="touchmove">
+ <scroll-view scroll-y class="scroll-Y">
<view class="square-2">
<view class="square-title">
<view class="title-sign"><view class="sign"></view></view>
@@ -9,28 +9,20 @@
<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>
</view>
- <view class="square-3">
+ <view class="square-2">
<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="siteList" v-model="desc" placeholder="绔欏彴鍙�"
- @input="choseStaNo" disabled='true'></uni-combox>
- </view>
- </view>
- <view class="square-content">
- <text>璐у搧鏉$爜锛�</text>
- <view class="content-input-combox">
- <input type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat()":focus="focus"
- @focus="focuss">
+ <view class="content-input-combox" style="width: 94%;">
+ <input style="width: 90%;" 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>
@@ -41,19 +33,20 @@
<view class="square-title">
<view class="title-sign"><view class="sign"></view></view>
<view class="title-text"><text>鍟嗗搧鍒楄〃</text></view>
+ <view v-show="matCount > 0" style="display: inline-block;float: right;height: 100rpx;line-height: 100rpx;margin-right: 50rpx;">璇锋壂鐮侀�夊彇 {{matCount}} 浠跺晢鍝�</view>
</view>
</view>
<view class="square-none" v-show="matList.length === 0">
- <view class="v-show">鏆傛棤鏇村鏁版嵁...</view>
+ <view class="v-show">鏆傛棤鏇村鏁版嵁. . . </view>
</view>
<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">No:{{listLen-index}}</view>
- <view class="matnr">{{item.matnr}}-{{item.batch}}</view>
+ <view class="matnr" :style="item.color">No:{{listLen-index}}</view>
+ <view class="matnr" :style="item.color">{{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>
+ <uni-icons type="trash" size="20" color="#a5a5a5" @click="remove(item,index)"></uni-icons>
</view>
</view>
</checkbox-group>
@@ -66,6 +59,12 @@
<button class="cu-btn lg pakin-btn bg-blue" @click="comb()">纭</button>
</view>
</view>
+ <view>
+ <!-- 鎻愮ず淇℃伅寮圭獥 -->
+ <uni-popup ref="message" type="message">
+ <uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
+ </uni-popup>
+ </view>
</view>
</template>
@@ -74,6 +73,7 @@
export default {
data() {
return {
+ commonUrl:null,
barcode: '',
barcodeFocus:true,
focus:false,
@@ -81,44 +81,72 @@
searchBox: 'hide',
pick:'hide',
matnr:'',
- matList:[{matnr:'1101842-10000',batch:'22047515999'}],
+ // matList:[{matnr:'1101842-10000',batch:'22047515999',color:{color:'red'}}],
+ matList:[],
result: '',
siteList:[],
- desc:'',
staNoList:[],
satNo:'',
listLen:0,
+ msgType: 'success',
+ messageText: '杩欐槸涓�鏉℃垚鍔熸彁绀�',
+ fontColor:{color:'red'},
+ matCount:'',
+ wrkNo:'',
}
+ },
+ onReady() {
+ setInterval(function(){
+ // console.log(this.matList)
+ // this.getMatListLen()
+ },1000)
+ },
+ onLoad() {
+ // #ifdef APP
+ setInterval(()=>{
+ uni.hideKeyboard()
+ },20)
+ // #endif
},
mounted(){
const UIP = uni.getStorageSync('UIP');
this.baseIP = UIP;
const UPORT = uni.getStorageSync('UPORT');
this.basePORT = UPORT
- this.getOutBound();
+ 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}娑堟伅鎻愮ず`
this.$refs.message.open()
},
- choseStaNo() {
- for (var i = 0;i < this.staNoList.length; i++) {
- if (this.desc == this.staNoList[i].desc) {
- this.staNo = this.staNoList[i].siteId
- }
- }
+ getMatListLen() {
+ // 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.desc = ''
+ this.matCount = ''
+ this.removeBarcode();
uni.vibrateShort();
+
},
removeBarcode() {
this.barcode = ''
@@ -127,6 +155,16 @@
this.$nextTick(function() {
this.barcodeFocus = true;
});
+ },
+ foucss() {
+ // #ifdef APP
+ let that = this;
+ that.focus = false;
+ setTimeout(()=>{
+ that.matnr = '';
+ that.focus = true;
+ }, 100);
+ // #endif
},
removeMatnr() {
this.matnr = ''
@@ -137,46 +175,13 @@
});
},
remove(item,index) {
- this.matList.splice(index,1)
+ this.matList.splice(index,1);
+ this.listLen = this.matList.length
+ this.messageToggle('success')
+ this.messageText = '鍒犻櫎鎴愬姛'
uni.vibrateShort();
},
- comb() {
- uni.vibrateShort();
- let that = this;
- uni.showLoading();
- uni.request({
- url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/auth',
- data: that.matList,
- method: 'POST',
- header: {
- 'token':uni.getStorageSync('token')
- },
- success(result) {
- uni.showLoading();
- var res = result.data
- if (res.code === 200) {
- uni.showToast({
- title: res.msg,
- 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(() => {
- uni.reLaunch({
- url: '../login/login'
- });
- }, 1000);
- } else {
- uni.showToast({title: res.msg, icon: "none",position: 'top'})
- }
- }
- });
- },
+
selectMat() {
let that = this
uni.vibrateShort();
@@ -197,12 +202,61 @@
});
that.matnr = ''
},
- findMat() {
+ findBarcode() {
let that = this
uni.request({
- url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth',
+ url: that.commonUrl + '/mobile/pakout/confirm/barcode/auth',
data: {
- staNo:that.staNo,
+ barcode:that.barcode
+ },
+ header: {
+ 'token':uni.getStorageSync('token'),
+ },
+ success(result) {
+ let res = result.data;
+ if (res.code === 200) {
+ if (res.data.ioType === 101) {
+ that.matList = res.data.list.concat(that.matList)
+ that.listLen = that.matList.length;
+ that.foucss();
+ return;
+ }
+ if (res.data.ioType === 103 || res.data.ioType === 104 || res.data.ioType === 107) {
+ that.matCount = res.data.list.length
+ that.wrkNo = res.data.list[0].wrkNo
+ that.foucss();
+ return;
+ }
+ } else if (res.code === 403) {
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../login/login'
+ });
+ }, 1000);
+ } else {
+ uni.showToast({title: res.msg, icon: "none",position: 'top'})
+ that.focuss()
+ }
+
+ }
+ });
+
+ },
+ 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.commonUrl + '/mobile/pakout/confirm/pick/auth',
+ data: {
+ wrkNo:that.wrkNo,
matnr:that.matnr
},
header: {
@@ -211,21 +265,24 @@
success(result) {
var res = result.data;
if(res.code === 200 ) {
- 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)
- }
+ 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
}
}
- that.matList = res.data.concat(that.matList)
- that.listLen = that.matList.length;
- that.focus = false;
- that.$nextTick(function() {
- that.focus = true;
- });
- that.matnr = ''
+ if (add) {
+ that.matList.unshift(res.data);
+ that.listLen = that.matList.length;
+ that.foucss();
+ }
}
} else if (res.code == 403) {
uni.showToast({title: res.msg, icon: "none", position: 'top'})
@@ -236,80 +293,50 @@
}, 1000);
} else {
uni.showToast({title: res.msg, icon: "none",position: 'top'})
+ that.foucss();
}
}
});
},
- 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])
- }
-
+ comb() {
+ let that = this;
+ if (that.barcode === '') {
+ this.messageToggle('error')
+ this.messageText = '璇锋壂鎻忔墭鐩樼爜'
+ return;
}
- console.log(this.matList)
- },
- findBarcode() {
- let that = this
- uni.request({
- url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth',
- data: {
- barcode:that.barcode
- },
- header: {
- 'token':uni.getStorageSync('token'),
-
- },
- success(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)
- }
-
- }
- });
+ if (that.barcode.length !== 8) {
+ this.messageToggle('error')
+ this.messageText = '鎵樼洏鐮佸繀椤讳负8浣�'
+ return;
+ }
+ if (that.matList.length === 0) {
+ this.messageToggle('error')
+ this.messageText = '璇锋坊鍔犲晢鍝佸垪琛�'
+ return;
+ }
- },
- getOutBound() { // 鑾峰彇鍑哄簱鍙�
- let that = this
+ if (that.matList.length < that.matCount) {
+ var len = that.matCount - that.matList.length
+ that.messageToggle('error')
+ that.messageText = '杩樺墿' + len + '浠舵湭鎵弿'
+ return;
+ }
+ uni.showLoading();
uni.request({
- url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/available/take/site',
+ url: that.commonUrl + '/mobile/pakout/confirm/auth',
+ data: that.matList,
method: 'POST',
- header: {
+ header: {
'token':uni.getStorageSync('token')
- },
+ },
success(result) {
+ uni.showLoading();
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
+ uni.showToast({ title: res.msg,position: 'bottom',duration: 1000});
+ that.resst();
} else if (res.code == 403) {
uni.showToast({title: res.msg, icon: "none", position: 'top'})
setTimeout(() => {
@@ -320,9 +347,9 @@
} else {
uni.showToast({title: res.msg, icon: "none",position: 'top'})
}
- },
+ }
});
- }, // getOutBound
+ },
getCheckDetl() { // 鑾峰彇鍑哄簱鍙h揣鐗╀俊鎭�
let that = this
@@ -362,7 +389,7 @@
<style>
/* @import "../../colorui/main.css";
@import "../../colorui/icon.css"; */
-
+
.pak-seach-box {
background-color: #FFFFFF;
margin: 15rpx 15rpx 0rpx 15rpx;
@@ -468,7 +495,7 @@
margin-top: 20rpx;
}
.data-list:last-child {
- margin-bottom: 120rpx;
+ margin-bottom: 200rpx;
}
/* .data-list-left {
display: inline-block;
@@ -490,9 +517,9 @@
.matnr {
display: inline-block;
width: 100%;
- font-size: 16px;
+ font-size: 14px;
font-weight: 700;
- padding-top: 20rpx;
+ padding-top: 15rpx;
/* height: 130rpx;
line-height: 130rpx; */
}
--
Gitblit v1.9.1