From 3dc1c36cc46adda3ade2777e94cb5c6de3a87e15 Mon Sep 17 00:00:00 2001 From: whycq <123456> Date: 星期四, 12 五月 2022 21:02:05 +0800 Subject: [PATCH] # --- pages/basics/checkout2.vue | 520 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 520 insertions(+), 0 deletions(-) diff --git a/pages/basics/checkout2.vue b/pages/basics/checkout2.vue new file mode 100644 index 0000000..9990525 --- /dev/null +++ b/pages/basics/checkout2.vue @@ -0,0 +1,520 @@ +<template> + <view > + <scroll-view scroll-y catch:touchmove="touchmove"> + <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"> + <view class="content-input"> + <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> + </view> + <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"> + <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> + </view> + </view> + + <view class="square-1"> + <view class="square-title"> + <view class="title-sign"><view class="sign"></view></view> + <view class="title-text"><text>鍟嗗搧鍒楄〃</text></view> + </view> + </view> + <view class="square-none" v-show="matList.length === 0"> + <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" :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="20" color="#a5a5a5" @click="remove(item,index)"></uni-icons> + </view> + </view> + </checkbox-group> + </scroll-view> + <view class="footer flex justify-around"> + <view> + <button class="cu-btn lg" @click="resst()">閲嶇疆</button> + </view> + <view> + <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> + +<script> + import permision from "@/common/permission.js" + export default { + data() { + return { + barcode: '', + barcodeFocus:true, + focus:false, + type: 'center', + searchBox: 'hide', + pick:'hide', + matnr:'', + matList:[{matnr:'1101842-10000',batch:'22047515999',color:{color:'red'}}], + // matList:[], + result: '', + siteList:[], + desc:'', + staNoList:[], + satNo:'', + listLen:0, + msgType: 'success', + messageText: '杩欐槸涓�鏉℃垚鍔熸彁绀�', + fontColor:{color:'red'} + } + }, + onReady() { + setInterval(function(){ + // console.log(this.matList) + // this.getMatListLen() + },1000) + }, + mounted(){ + const UIP = uni.getStorageSync('UIP'); + this.baseIP = UIP; + const UPORT = uni.getStorageSync('UPORT'); + this.basePORT = UPORT + this.getOutBound(); + + }, + methods: { + 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() + }, + resst() { + this.matList = [] + this.barcode = '' + this.matnr = '' + this.desc = '' + uni.vibrateShort(); + }, + removeBarcode() { + this.barcode = '' + 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); + 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(); + uni.showLoading(); + uni.navigateTo({ + url: "matSelect", + events: { + // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� + acceptDataFromOpenedPage: function(data) { + that.matnr = data.data + that.findMat(that.matnr) + }, + }, + success: function(res) { + // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� + res.eventChannel.emit('acceptDataFromOpenerPage', {baseIP:that.baseIP, basePORT:that.basePORT }) + } + }); + that.matnr = '' + }, + findMat() { + let that = this + uni.request({ + url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth/v2', + data: { + staNo:that.staNo, + matnr:that.matnr + }, + header: { + 'token':uni.getStorageSync('token') + }, + 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) + } + } + } + that.matList = res.data.concat(that.matList) + that.listLen = that.matList.length; + that.focus = false; + that.$nextTick(function() { + that.focus = true; + }); + that.matnr = '' + } + } 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'}) + } + + } + }); + }, + 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 + 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; + 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.listLen = that.matList.length; + } + }); + + }, + getOutBound() { // 鑾峰彇鍑哄簱鍙� + let that = this + uni.request({ + url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/available/take/site', + method: 'POST', + header: { + 'token':uni.getStorageSync('token') + }, + 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'}) + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); + } else { + uni.showToast({title: res.msg, icon: "none",position: 'top'}) + } + }, + }); + }, // getOutBound + getCheckDetl() { // 鑾峰彇鍑哄簱鍙h揣鐗╀俊鎭� + let that = this + + }, // getCheckDetl + change(e) { + }, + toggle(type) { + this.type = type + // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴�� + this.$refs.goodsSearch.open(type) + }, + checkbox: function (e) { + var items = this.data, + values = e.detail.value; + for (var i = 0, lenI = items.length; i < lenI; ++i) { + const item = items[i] + item.id = item.id + '' + if(values.indexOf(item.id) >= 0){ + this.$set(item,'checked',true) + }else{ + this.$set(item,'checked',false) + } + } + if (values.length == items.length) { + this.check = true + this.checkText = "鍙栨秷鍏ㄩ��" + } else { + this.check = false + this.checkText = "鍏ㄩ��" + } + uni.vibrateShort(); + }, + } + } +</script> + +<style> + /* @import "../../colorui/main.css"; + @import "../../colorui/icon.css"; */ + + .pak-seach-box { + background-color: #FFFFFF; + margin: 15rpx 15rpx 0rpx 15rpx; + width: 96%; + height: 150rpx; + border-radius: 20rpx; + } + .box-top{ + display: block; + height: 60rpx; + width: 720rpx; + } + .color-block-blue { + background-color: #1E9FFF; + display: inline-block; + float: left; + margin: 15rpx 15rpx 0 15rpx; + width: 12rpx; + height: 40rpx; + border: 5rpx solid #1E9FFF; + border-radius: 20rpx; + } + .title { + display: inline-block; + float: left; + font-size: 34rpx; + font-weight: 700; + height: 50rpx; + line-height: 50rpx; + margin-top: 10rpx; + } + .box-buttom { + display: inline-block; + background-color: #f0f0f0; + width: 65%; + height: 60rpx; + border-radius: 20rpx; + margin: 15rpx 15rpx 0rpx 15rpx; + } + .box-buttom input { + width: 75%; + float: left; + margin: 8rpx 10rpx 0rpx 25rpx; + } + .box-buttom .search-icon{ + width: 60rpx; + height: 60rpx; + float: right; + margin-top: 5rpx; + margin-right: 10rpx; + } + + /* .pak-seach-box input { + background-color: #ededed; + border: 1rpx solid #d8d8d8; + display: inline-block; + border-radius: 20rpx; + float: left; + width: 70%; + height: 60rpx; + line-height: 60rpx; + margin: 15rpx 15rpx 0rpx 15rpx; + padding-left: 20rpx; + } */ + .pak-seach-box button { + background-color: #1E9FFF; + color: #ffffff; + display: inline-block; + float: right; + width: 180rpx; + height: 60rpx; + margin: 15rpx 15rpx 0rpx 15rpx; + line-height: 60rpx; + } + .pakin-btn { + background-color: #1E9FFF; + } + .pak-data-box { + background-color: #F1F1F1; + margin: 15rpx 15rpx 0rpx 15rpx; + width: 96%; + height: 70rpx; + border-radius: 20rpx; + } + .pak-data-box .box-top { + background-color: #FFFFFF; + height: 70rpx; + border-radius: 20rpx 20rpx 20rpx 20rpx; + } + .bg-false { + background-color: #FFFFFF; + } + .bg-true { + background-color: #ebebeb; + } + .data-list { + border-bottom: 1px solid #d8d8d8; + height: 130rpx; + margin: 15rpx; + border-radius: 20rpx; + } + .data-list:first-child { + margin-top: 20rpx; + } + .data-list:last-child { + margin-bottom: 200rpx; + } + /* .data-list-left { + display: inline-block; + float: left; + text-align: center; + width: 100rpx; + height: 180rpx; + line-height: 180rpx; + } */ + .data-list-left { + width: 550rpx; + /* background-color: #007AFF; */ + display: inline-block; + float: left; + margin-left: 4%; + height: 130rpx; + color: #676767; + } + .matnr { + display: inline-block; + width: 100%; + font-size: 14px; + font-weight: 700; + padding-top: 15rpx; + /* height: 130rpx; + line-height: 130rpx; */ + } + .data-list-right { + /* background-color: #6739B6; */ + display: inline-block; + float: right; + width: 100rpx; + height: 130rpx; + line-height: 130rpx; + } +</style> \ No newline at end of file -- Gitblit v1.9.1