From 54fce333aae7d6f596616a6eb5e65c27c28a9994 Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期三, 21 八月 2024 12:39:26 +0800 Subject: [PATCH] # --- pages/basics/offLines.vue | 236 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 218 insertions(+), 18 deletions(-) diff --git a/pages/basics/offLines.vue b/pages/basics/offLines.vue index b16073d..7875456 100644 --- a/pages/basics/offLines.vue +++ b/pages/basics/offLines.vue @@ -1,18 +1,6 @@ <template> <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"> - <input type="text" v-model="yyds" placeholder="鎵爜 / 杈撳叆" @input="find" :focus="focus"> - <uni-icons type="closeempty" size="20" color="#dadada"></uni-icons> - </view> - </view> - </view> + <!-- 搴撲綅鐮佽緭鍏ユ --> <view class="square-2"> <view class="square-title"> @@ -21,11 +9,58 @@ </view> <view class="square-content"> <view class="content-input"> - <input type="text" v-model="yyds" placeholder="鎵爜 / 杈撳叆" @input="find" :focus="focus"> - <uni-icons type="closeempty" size="20" color="#dadada"></uni-icons> + <input type="text" v-model="locno" placeholder="鎵爜 / 杈撳叆" :focus="locnoFocus"> + <uni-icons type="closeempty" size="20" color="#dadada" @click="remove('locno')"></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"> + <input type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat" :focus="matnrFocus"> + <uni-icons type="closeempty" size="20" color="#dadada" @click="remove('matnr')"></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> + <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"><text style="width: 400rpx;">缂栫爜锛歿{item.matnr}}</text></view> + <view><text style="width: 400rpx;">鍝佸悕锛歿{item.maktx}}</text></view> + <view><text style="width: 400rpx;">鎵瑰彿锛歿{item.batch}}</text></view> + <view> + <text style="width: 400rpx;">鎬绘暟閲忥細{{item.anfme}}</text><text style="width: 400rpx;">涓嬫灦鏁伴噺锛歿{item.qty}}</text> + </view> + <view> + + </view> + </view> + <view class="data-list-right"> + <label><uni-icons type="compose" size="20" color="#a5a5a5" @click="revise(item,index)"></uni-icons></label> + <label><uni-icons type="trash" size="25" color="#a5a5a5" @click="removeItem(item,index)"></uni-icons></label> + </view> + </view> + </checkbox-group> + <!-- 搴曢儴鎸夐挳 --> <view class="footer flex justify-around"> <!-- <label class="label-btn" style="width: 170rpx;"> @@ -42,20 +77,185 @@ <button class="cu-btn bg-blue " @click="comb()">涓嬫灦</button> </label> </view> + + <!-- 寮圭獥 --> + <!-- 淇敼鏁伴噺 --> + <uni-popup ref="revise" background-color="#fff"> + <view class="revise-box"> + <view class="revise-box-top"> + <view class="color-block-blue"></view> + <text class="title">淇敼鏁伴噺</text> + </view> + <view class="changeBox"> + <view class="num-box"> + <uni-number-box :value="qty" :max="9999" color="#747474" @change="changeValue"/> + </view> + </view> + <view class="revise-box-buttom"> + <view> + <button class="cu-btn bg-blue" @click="confirm()">纭</button> + </view> + </view> + </view> + </uni-popup> </view> </template> <script> export default { - data() { + data() { return { - yyds:'', - focus:true + matnr: '', + locno: 'NA003', + matList: [], + locnoFocus:true, + matnrFocus:false, + res:'', + qty:0 } + }, + mounted(){ + const UIP = uni.getStorageSync('UIP'); + 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 + }, + // 鎼滅储 + findMat() { + this.res = '' + let that = this, + url = '/mobile/mat/find/auth', + data = {locNo: that.locno, matnr: that.matnr}, + method = "GET"; + that.res='' + that.request(url,data,method); + setTimeout(function() { + that.res = that.res.data + that.checkMat(that.res) + }, 100); + + + }, + // 涓嬫灦鎸夐挳 + comb() { + this.res = '' + var offSaleParam = {} + offSaleParam['locNo'] = this.locno + offSaleParam['matnr'] = this.matnr + offSaleParam['anfme'] = this.matList[0].qty + let that = this, + url = '/mobile/mat/offSale/auth', + data = JSON.stringify(offSaleParam), + method = "POST" + that.request(url,data,method) + setTimeout(function() { + if(that.res.code === 200) { + that.resst() + uni.showToast({title: that.res.msg, icon: "none",position: 'top'}) + } + }, 100); + + }, + revise(item,index) { + // this.qty = this.matList[index].anfme + this.rowNum = index + this.eject() + }, + eject(type) { + this.type = type + // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴�� + this.$refs.revise.open(type) + }, + confirm() { + this.matList[this.rowNum].qty = this.qty + this.$refs.revise.close() + this.$forceUpdate() // 寮哄埗鍒锋柊 + }, + changeValue(value) { + this.qty = value + }, + // 娓呯┖input + remove(e) { + this[e] = '' + }, + // 閲嶇疆鎸夐挳 + resst() { + this.matList = [] + this.locno = '' + this.matnr = '' + }, + // 娣诲姞鍟嗗搧 + addMat(mat) { + mat['qty'] = 0 + this.matList.unshift(mat) + }, + checkMat(mat) { + var len = this.matList.length + var add = true + for (var i = 0; i < len; i++) { + if (mat.matnr == this.matList[i].matnr) { + this.matList[i].anfme += mat.anfme + this.$forceUpdate() // 寮哄埗鍒锋柊 + add = false + } + } + if (add) { + mat['qty'] = 0 + this.matList.unshift(mat) + } + }, + // 閫氱敤鏂规硶 + request(url,data,method){ + let that = this + uni.request({ + url: this.commonUrl + url, + data: data, + header:{'token':uni.getStorageSync('token')}, + method: method, + success(result) { + var res = result.data + console.log(res); + if ( res.code === 200 ) { + that.res = res + } else if(res.code === 403) { + uni.showToast({title: res.msg, icon: "none", position: 'top'}) + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); + } else { + console.log(res.msg); + uni.showToast({title: res.msg, icon: "none",position: 'top'}) + } + + } + }) + }, } } </script> <style> + @import url(@/static/css/putOnSale.css); + .footer { + width: 100%; + height: 100rpx; + line-height: 100rpx; + background-color: #FFF; + position: fixed; + bottom: 0; + border-top: 1px solid #d8d8d8; + border-radius: 20rpx 20rpx 0 0 ; + z-index: 1; + } </style> \ No newline at end of file -- Gitblit v1.9.1