From 19a3945f16e9fa10ca6f51f6cd1ddc631dde50c1 Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期一, 15 八月 2022 13:23:03 +0800 Subject: [PATCH] # --- pages/basics/putOnSale.vue | 69 +++++++++++++++++++++++++++------- 1 files changed, 55 insertions(+), 14 deletions(-) diff --git a/pages/basics/putOnSale.vue b/pages/basics/putOnSale.vue index 8d4827b..09fe957 100644 --- a/pages/basics/putOnSale.vue +++ b/pages/basics/putOnSale.vue @@ -9,7 +9,7 @@ <view class="square-content"> <view class="content-input"> <input type="text" v-model="locno" placeholder="鎵爜 / 杈撳叆" :focus="locnoFocus"> - <uni-icons type="closeempty" size="20" color="#dadada"></uni-icons> + <uni-icons v-show="locno" type="closeempty" size="20" color="#dadada" @click="remove('locno')"></uni-icons> </view> </view> </view> @@ -22,7 +22,7 @@ <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"></uni-icons> + <uni-icons v-show="matnr" type="closeempty" size="20" color="#dadada" @click="remove('matnr')"></uni-icons> </view> </view> </view> @@ -48,7 +48,7 @@ <view class="lists-item">涓婃灦鏁伴噺锛歿{item.anfme}}</view> </view> <view class="list-right"> - <uni-icons type="trash" size="20" color="#a5a5a5" @click="remove(item,index)"></uni-icons> + <uni-icons type="trash" size="20" color="#a5a5a5" @click="removeItem(item,index)"></uni-icons> </view> </view> </checkbox-group> @@ -69,7 +69,12 @@ <button class="cu-btn bg-blue " @click="comb()">涓婃灦</button> </label> </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> @@ -78,13 +83,15 @@ export default { data() { return { - locno:null, // 搴撲綅鍙� + locno:'', // 搴撲綅鍙� matnr:'', // 鍟嗗搧鐮� locnoFocus:true, matnrFocus:true, matList:[], // 鍟嗗搧鍒楄〃 listLen:0, - listNum:1 + listNum:1, + msgType: 'success', + messageText: '杩欐槸涓�鏉℃垚鍔熸彁绀�', } }, @@ -93,15 +100,35 @@ 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 = '' + this.$refs.message.open() + }, + // 娓呯┖input + remove(e) { + this[e] = '' + }, + // 閲嶇疆 resst() { - + this.locno = '' + this.matnr = '' + this.matList = [] }, findMat() { let that = this uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth', + url: that.commonUrl + '/mat/auth', data: { matnr:that.matnr }, @@ -134,26 +161,40 @@ }); }, - // . + // 绉婚櫎鐗╂枡 + removeItem(item,index) { + this.matList.splice(index,1) + // this.listLen = this.matList.length + this.messageToggle('success') + this.messageText = '绉婚櫎鎴愬姛' + }, // 涓婃灦 comb() { let that = this + if(that.locno === '') { + uni.showToast({title: '璇锋坊鍔犲簱浣嶇爜', icon: "none", position: 'top'}); + return; + } + if(that.matList.length === 0) { + uni.showToast({title: '璇锋坊鍔犲晢鍝�', icon: "none", position: 'top'}); + return; + } var combList = {} var matList = [] combList['locno'] = that.locno combList['combMats'] = that.matList - matList['matnr'] = that.matList. - console.log(combList) - // console.log(JSON.stringify(combList)) - // return; + matList['matnr'] = that.matList + console.log(JSON.stringify(combList)) uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth', + url: that.commonUrl + '/mobile/mat/onSale/auth', data: { combParam:JSON.stringify(combList) }, header: { 'token':uni.getStorageSync('token') }, + method:'GET', success(result) { console.log(result) + } }) } -- Gitblit v1.9.1