From 2146088541cdc9523b3899fcbce6da8ca631fcd2 Mon Sep 17 00:00:00 2001
From: whycq <you@example.com>
Date: 星期二, 31 一月 2023 20:25:25 +0800
Subject: [PATCH] #

---
 pages/basics/putOnSale.vue |  311 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 302 insertions(+), 9 deletions(-)

diff --git a/pages/basics/putOnSale.vue b/pages/basics/putOnSale.vue
index d2fdec6..a60a8e6 100644
--- a/pages/basics/putOnSale.vue
+++ b/pages/basics/putOnSale.vue
@@ -1,15 +1,15 @@
 <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 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>
+					<input type="text" v-model="locno" placeholder="鎵爜 / 杈撳叆" :focus="locnoFocus">
+					<uni-icons v-show="locno" type="closeempty" size="20" color="#dadada" @click="remove('locno')"></uni-icons>
 				</view>
 			</view>
 		</view>
@@ -17,21 +17,314 @@
 		<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 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 class="content-input-btn">
+					<input v-model="matnr" type="text" placeholder="鎵爜 / 杈撳叆" @input="findMat()"
+					:focus="matnrFocus" placeholder-style="line-height:  85rpx;">
+					<uni-icons v-show="matnr" type="closeempty" size="20" color="#dadada" @click="remove('matnr')"></uni-icons>
+				</view>
+				<view class="content-btn">
+					<button class="cu-btn bg-blue pda-btn" @click="selectMat()">+鎻愬彇</button>
 				</view>
 			</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>
+					</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;">
+				<checkbox :checked="check" @click="allChecked()">{{checkText}}</checkbox>
+			</label>
+			<label class="label-btn" style="width: 100rpx;">
+				<text  @click="reChecked()">鍙嶉��</text>
+			</label> -->
+			
+			<label class="label-btn" style="width: 150rpx;">
+				<button class="cu-btn" @click="resst()">閲嶇疆</button>
+			</label>
+			<label class="label-btn">
+				<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>
 	
+		<!-- 寮圭獥 -->
+		<!-- 淇敼鏁伴噺 -->
+		<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="" style="position: relative;left: 50px;margin-bottom: 20px;">
+					<text style="display: inline-block;float: left;width: 50px;">鎵瑰彿锛�</text>
+					<input type="text" style="width: 100px;border-bottom: 1px solid #9e9e9e;" v-model="batch">
+				</view>
+				<view class="changeBox">
+					<view class="num-box">
+						<uni-number-box :value="count" :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() {
+		 	return {
+				locno:'', // 搴撲綅鍙�
+				matnr:'', // 鍟嗗搧鐮�
+				locnoFocus:true,
+				matnrFocus:true,
+				matList:[], // 鍟嗗搧鍒楄〃
+				listLen:0,
+				listNum:1,
+				msgType: 'success',
+				messageText: '杩欐槸涓�鏉℃垚鍔熸彁绀�',
+				count:'',
+				rowNum:'',
+				batch:''
+			}
+		},
+		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
+			},
+			// 娑堟伅鎻愮ず寮圭獥
+			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.commonUrl + '/mat/auth',
+				    data: {
+						matnr:that.matnr
+				    },
+				    header: {
+						'token':uni.getStorageSync('token')
+				    },
+					success(result) {
+						uni.vibrateShort();
+						let res = result.data
+						if (res.code === 200 && res.data) {
+							that.matData = res.data
+							that.matnr = ''
+							uni.navigateTo({
+								url: "matQuery",
+								events: {
+								    // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
+								    matList: function(data) {
+										console.log(data)
+										that.matList.push(data.data)
+									},
+								},
+								success: function(res) {
+									// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+									res.eventChannel.emit('matData', { data: that.matData })
+								},
+							});
+						}
+						
+					}
+				});
+				
+			},
+			// 绉婚櫎鐗╂枡
+			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 combMats = []
+				var combParam = {}
+				combParam['locno'] = that.locno
+				combParam['combMats'] = that.matList
+				uni.request({
+					url: that.commonUrl + '/mobile/mat/onSale/auth',
+					data: JSON.stringify(combParam),
+					header: { 'token':uni.getStorageSync('token'),},
+					method:'POST',
+					success(result) {
+						var res = result.data
+						if (res.code === 200) {
+							uni.showToast({title: res.msg, icon: "none", position: 'top'});
+							that.resst()
+						} 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.navigateTo({
+					url: "matSelect",
+					events: {
+					    // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�  鍙﹀涓�涓〉闈紶杩囨潵鐨�
+					    acceptDataFromOpenedPage: function(data) {
+							that.matnr = data.data
+							that.findMat(that.matnr)
+					    },
+					},
+					success: function(res) {
+					    // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�   鍚戝彟澶栦竴涓〉闈紶閫掑�肩殑
+					    res.eventChannel.emit('commonUrl', {commonUrl:that.commonUrl })
+					},
+					
+				});
+				that.matnr = ''
+			},
+			revise(item,index) {
+				this.count = this.matList[index].anfme
+				this.rowNum = index
+				this.eject()
+			},
+			eject(type) {
+				this.type = type
+				// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴��
+				this.$refs.revise.open(type)
+			},
+			changeValue(value) {
+				this.count = value
+			},
+			confirm() {
+				this.matList[this.rowNum].anfme = this.count
+				this.matList[this.rowNum].batch = this.batch
+				this.$refs.revise.close()
+				this.$forceUpdate() // 寮哄埗鍒锋柊
+			},
+			
+		}
+	 }
 </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;
+	}
+	.revise-box {
+		position: relative;
+		width: 500rpx;
+		height: 400rpx;
+		border-radius: 25px;
+	}
+	.revise-box-top {
+		width: 400rpx;
+		height: 120rpx;
+		border-radius: 25px;
+	}
+	.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;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.1