From ea8888c74be672930ee35b31b66980fdd6daf100 Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期六, 23 四月 2022 13:55:04 +0800
Subject: [PATCH] #

---
 pages/basics/pakin.vue     |    1 
 pages/basics/matQuery.vue  |    2 
 pages.json                 |    7 +
 pages/basics/matSelect.vue |    5 
 pages/basics/checkout.vue  |  368 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 pages/index/index.vue      |   16 +
 6 files changed, 393 insertions(+), 6 deletions(-)

diff --git a/pages.json b/pages.json
index 69e50c5..f3d3874 100644
--- a/pages.json
+++ b/pages.json
@@ -27,6 +27,13 @@
 		        "enablePullDownRefresh": false
 		    } 
 		},{
+		    "path" : "pages/basics/checkout",
+		    "style" :                                                                                    
+		    {
+		        "navigationBarTitleText": "鍑哄簱纭",
+		        "enablePullDownRefresh": false
+		    } 
+		},{
 		    "path" : "pages/basics/pakin",
 		    "style" :                                                                                    
 		    {
diff --git a/pages/basics/checkout.vue b/pages/basics/checkout.vue
new file mode 100644
index 0000000..fc747d0
--- /dev/null
+++ b/pages/basics/checkout.vue
@@ -0,0 +1,368 @@
+<template>
+	<view >
+		<scroll-view scroll-y catch:touchmove="touchmove">
+			<view class="pak-seach-box">
+				<view class="box-top">
+					<view class="color-block-blue"></view>
+					<text class="title">鎵樼洏鏉$爜</text>
+				</view>
+				<view class="box-buttom">
+					<input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆">
+					<view class="search-icon">
+						<uni-icons type="closeempty" size="20" color="#a5a5a5" @click="removeBarcode()"></uni-icons>
+					</view>
+				</view>
+			</view>
+			<view class="pak-seach-box">
+				<view class="box-top">
+					<view class="color-block-blue"></view>
+					<text class="title">璐у搧鏉$爜</text>
+				</view>
+				<view class="box-buttom">
+					<input v-model="matnr" type="text" placeholder="鎵爜 / 杈撳叆" @input="findMat()">
+					<view class="search-icon">
+						<uni-icons type="closeempty" size="20" color="#a5a5a5" @click="removeMatnr()"></uni-icons>
+					</view>
+				</view>
+				<button class="cu-btn bg-blue" @click="selectMat()">+鎻愬彇</button>
+			</view>
+			<view class="pak-data-box">
+				<view class="box-top">
+					<view class="color-block-blue"></view>
+					<text class="title">鍟嗗搧鍒楄〃</text>
+				</view>
+			</view>
+			<view class="pak-data-box"  v-show="matList.length === 0">
+				<view style="text-align: center;">鏆傛棤鏇村鏁版嵁</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"><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">
+						<uni-icons type="trash" size="25" 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>
+</template>
+
+<script>
+	import permision from "@/common/permission.js"
+	export default {
+		data() {
+			return {
+				barcode: '',
+				type: 'center',
+				searchBox: 'hide',
+				pick:'hide',
+				matnr:'',
+				matList:[],
+				result: ''
+			}
+		},
+		mounted(){
+			const UIP = uni.getStorageSync('UIP');
+			this.baseIP = UIP;
+			const UPORT = uni.getStorageSync('UPORT');
+			this.basePORT = UPORT
+		},
+		methods: {
+			resst() {
+				this.matList = []
+				this.barcode = ''
+				this.matnr = ''
+				uni.vibrateShort();
+			},
+			removeBarcode() {
+				this.barcode = ''
+				uni.vibrateShort();
+			},
+			removeMatnr() {
+				this.matnr = ''
+				uni.vibrateShort();
+			},
+			remove(item,index) {
+				this.matList.splice(index,1)
+				uni.vibrateShort();
+			},
+			comb() {
+				uni.vibrateShort();
+				let that = this;
+				if (that.barcode === '') {
+					uni.showToast({title: '璇锋壂鎻忔墭鐩樻潯鐮�', icon: "none", position: 'top'});
+					return;
+				}
+				if (that.matList.length === 0) {
+					uni.showToast({title: '璇锋坊鍔犲晢鍝佸垪琛�', icon: "none", position: 'top'});
+					return;
+				}
+				uni.showLoading();
+				uni.request({
+				    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/comb/auth',
+				    data: JSON.stringify({
+						barcode: that.barcode,
+						combMats: 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
+							});
+						} 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 + '/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
+							uni.navigateTo({
+								url: "matQuery",
+								events: {
+								    // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
+								    matList: function(data) {
+										that.matList.push(data.data)
+								    },
+								  },
+								  success: function(res) {
+								    // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+								    res.eventChannel.emit('matData', { data: that.matData })
+								  }
+							});
+						}
+						
+					}
+				});
+			},
+		
+			change(e) {
+				console.log('褰撳墠妯″紡锛�' + e.type + ',鐘舵�侊細' + e.show);
+			},
+			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: #ededed;
+		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: 180rpx;
+		margin: 15rpx;
+		border-radius: 20rpx;
+	}
+	.data-list:first-child {
+		margin-top: 20rpx;
+	}
+	.data-list:last-child {
+		margin-bottom: 120rpx;
+	}
+	/* .data-list-left {
+		display: inline-block;
+		float: left;
+		text-align: center;
+		width: 100rpx;
+		height: 180rpx;
+		line-height: 180rpx;
+	} */
+	.data-list-left {
+		display: inline-block;
+		float: left;
+		margin-left: 6%;
+		height: 180rpx;
+		color: #676767;
+	}
+	.matnr {
+		padding-top: 10rpx;
+	}
+	.data-list-right {
+		display: inline-block;
+		float: right;
+		height: 180rpx;
+		line-height: 180rpx;
+		margin-right: 10%;
+	}
+</style>
\ No newline at end of file
diff --git a/pages/basics/matQuery.vue b/pages/basics/matQuery.vue
index 091f889..991cd95 100644
--- a/pages/basics/matQuery.vue
+++ b/pages/basics/matQuery.vue
@@ -15,7 +15,7 @@
 					<view class="text-title">{{matData.specs}}</view>
 				</view>
 				<view class="text-box">
-					<view class="text-title"><text>鎵瑰彿</text></view>
+					<view class="text-title"><text>搴忓垪鍙�</text></view>
 					<view class="text-title"><input type="text" v-model="matData.batch"></view>
 				</view>
 				<view class="text-box">
diff --git a/pages/basics/matSelect.vue b/pages/basics/matSelect.vue
index 61d265a..5b4d679 100644
--- a/pages/basics/matSelect.vue
+++ b/pages/basics/matSelect.vue
@@ -110,6 +110,7 @@
 			showTag(parentId) {
 				let that = this
 				uni.vibrateShort();
+				uni.showLoading();
 				uni.request({
 					// url: "http://localhost:8081/jkwms/tag/list/pda/auth",
 				    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/tag/list/pda/auth',
@@ -122,6 +123,7 @@
 						'token':uni.getStorageSync('token'),
 				    },
 					success(result) {
+						
 						that.tag = null
 						that.data = null
 						var res = result.data
@@ -141,6 +143,7 @@
 						} else {
 							uni.showToast({title: res.msg, icon: "none",position: 'top'})
 						}
+						uni.hideLoading();
 					}
 				});
 			},
@@ -150,6 +153,7 @@
 				if (tagId == null || tagId == '' || tagId == undefined) {
 					return;
 				}
+				uni.showLoading();
 				uni.request({
 					// url: "http://localhost:8081/jkwms/mat/list/pda/auth",
 				    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/list/pda/auth',
@@ -179,6 +183,7 @@
 						} else {
 							uni.showToast({title: res.msg, icon: "none",position: 'top'})
 						}
+						uni.hideLoading();
 					}
 				});
 			},
diff --git a/pages/basics/pakin.vue b/pages/basics/pakin.vue
index b5772b1..211e2a7 100644
--- a/pages/basics/pakin.vue
+++ b/pages/basics/pakin.vue
@@ -146,6 +146,7 @@
 			selectMat() {
 				let that = this
 				uni.vibrateShort();
+				uni.showLoading();
 				uni.navigateTo({
 					url: "matSelect",
 					events: {
diff --git a/pages/index/index.vue b/pages/index/index.vue
index f744eb8..8d92c35 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -32,13 +32,13 @@
 					{
 						title: '缁勬墭鍏ュ簱',
 						name: 'pakin',
-						color: 'grey',
+						color: 'blue',
 						cuIcon: 'goods'
 					},
 					{
-						title: '璁㈠崟缁勬墭',
-						name: 'order',
-						color: 'grey',
+						title: '纭鍑哄簱',
+						name: 'checkout',
+						color: 'blue',
 						cuIcon: 'goods'
 					},
 					{
@@ -48,9 +48,15 @@
 						cuIcon: 'goods'
 					},
 					{
+						title: '璁㈠崟缁勬墭',
+						name: 'order',
+						color: 'grey',
+						cuIcon: 'goods'
+					},
+					{
 						title: '閫�鍑虹櫥褰�',
 						name: 'logOut',
-						color: 'blue',
+						color: 'grey',
 						cuIcon: 'exit'
 					}]
 			}

--
Gitblit v1.9.1