ccj 1 year ago
parent
commit
66b26b172c
1 changed files with 95 additions and 103 deletions
  1. 95 103
      pages/index/index.vue

+ 95 - 103
pages/index/index.vue

@@ -1,72 +1,64 @@
 <template>
 	<view class="content">
 		<view class="row row-bottom">
-		<view class="left">日期</view>
-				<picker mode="date"  @change="bindDateChange">
-					<view>{{param.date}}</view>
-				</picker>
+			<view class="left">日期</view>
+			<picker mode="date" @change="bindDateChange">
+				<view>{{param.date}}</view>
+			</picker>
 		</view>
 		<view class="row row-bottom">
 			<view class="left">类型</view>
-				<radio-group @change="selectType">
-					<label v-for="item in inOutType" :key="item">
-						<radio :value="item" :checked="item==param.type" />{{item}}
-					</label>
-				</radio-group>
+			<radio-group @change="selectType">
+				<label v-for="item in inOutType" :key="item">
+					<radio :value="item" :checked="item==param.type" />{{item}}
+				</label>
+			</radio-group>
 		</view>
 		<view v-if="param.type=='出库'" class="row row-bottom">
 			<view class="left">班组</view>
-			 <picker @change="outtypeChange" :value="industryIndex" :range="list" range-key="name">
+			<picker @change="outtypeChange" :value="industryIndex" :range="list" range-key="name">
 				{{industryIndex>0 ? list[industryIndex].name : industryIndex==0 ? list[0].name :'请选择班组'}}
 			</picker>
 		</view>
 		<view v-if="param.type=='出库'" class="row row-bottom">
 			<view class="left">班次</view>
-				<radio-group @change="chang">
-					<label v-for="item in radioGroup" :key="item">
-						<radio :value="item" :checked="item==param.banci" />{{item}}
-					</label>
-				</radio-group>
+			<radio-group @change="chang">
+				<label v-for="item in radioGroup" :key="item">
+					<radio :value="item" :checked="item==param.banci" />{{item}}
+				</label>
+			</radio-group>
 		</view>
 		<view v-if="param.type=='出库'" class="row row-bottom">
 			<view class="left">巴西(吨)</view>
-			<input v-model='param.filed1' class="right-bottom"  type="number"
-				placeholder="请输入"></input>
+			<input v-model='param.filed1' class="right-bottom" type="number" placeholder="请输入"></input>
 		</view>
 		<view v-if="param.type=='出库'" class="row row-bottom">
 			<view class="left">中美洲(吨)</view>
-			<input v-model='param.filed2' class="right-bottom" type="number"
-				placeholder="请输入"></input>
+			<input v-model='param.filed2' class="right-bottom" type="number" placeholder="请输入"></input>
 		</view>
 		<view v-if="param.type=='出库'" class="row row-bottom">
 			<view class="left">回溶(吨)</view>
-			<input v-model='param.filed3' class="right-bottom"  type="number"
-				placeholder="请输入"></input>
+			<input v-model='param.filed3' class="right-bottom" type="number" placeholder="请输入"></input>
 		</view>
 		<view v-if="param.type=='出库'" class="row row-bottom">
-			<view class="left">加工糖100%(吨)</view> 
-			<input v-model='param.filed4' class="right-bottom"  type="number"
-				placeholder="请输入"></input>
+			<view class="left">加工糖100%(吨)</view>
+			<input v-model='param.filed4' class="right-bottom" type="number" placeholder="请输入"></input>
 		</view>
 		<view v-if="param.type=='出库'" class="row row-bottom">
 			<view class="left">非食用糖92%(吨)</view>
-			<input v-model='param.filed5' class="right-bottom"  type="number"
-				placeholder="请输入"></input>
+			<input v-model='param.filed5' class="right-bottom" type="number" placeholder="请输入"></input>
 		</view>
 		<view v-if="param.type=='出库'" class="row row-bottom">
 			<view class="left">国储(吨)</view>
-			<input v-model='param.filed6' class="right-bottom"  type="number"
-				placeholder="请输入"></input>
+			<input v-model='param.filed6' class="right-bottom" type="number" placeholder="请输入"></input>
 		</view>
 		<view v-if="param.type=='出库'" class="row row-bottom">
 			<view class="left">合计(吨)</view>
-			<input :disabled="true" v-model='total' class="right-bottom"
-				placeholder="请输入"></input>
+			<input :disabled="true" v-model='total' class="right-bottom" placeholder="请输入"></input>
 		</view>
 		<view v-if="param.type=='入库'" class="row row-bottom">
 			<view class="left">入库量(吨)</view>
-			<input v-model='param.inNum' class="right-bottom"
-				placeholder="请输入"></input>
+			<input v-model='param.inNum' class="right-bottom" placeholder="请输入"></input>
 		</view>
 		<view class="bottom-btn">
 			<button type="primary" class="submit" hover-class="none" @click="submit()">提交</button>
@@ -78,76 +70,75 @@
 	export default {
 		data() {
 			return {
-				param:{
-					filed1:'0',
-					filed2:'0',
-					filed3:'0',
-					filed4:'0',
-					filed5:'0',
-					filed6:'0',
-					total:'0',
-					banci:'白班',
-					banzu:'甲班',
-					type:'出库',
-					inNum:'0',
-					date:this.getDate()
+				param: {
+					filed1: '0',
+					filed2: '0',
+					filed3: '0',
+					filed4: '0',
+					filed5: '0',
+					filed6: '0',
+					total: '0',
+					banci: '白班',
+					banzu: '甲班',
+					type: '出库',
+					inNum: '0',
+					date: this.getDate()
 				},
 				radioGroup: ['白班', '夜班'],
 				inOutType: ['出库', '入库'],
 				list: [{
-							name: '甲班'
-						},
-						{
-							name: '乙班'
-						},
-						{
-							name: '丙班'
-						}
-				] ,
-				industryIndex:0,
-				
+						name: '甲班'
+					},
+					{
+						name: '乙班'
+					},
+					{
+						name: '丙班'
+					}
+				],
+				industryIndex: 0,
+
 			}
 		},
-		computed:{
-				total(){
-					return parseFloat(this.param.filed1)
-					+parseFloat(this.param.filed2)
-					+parseFloat(this.param.filed3)
-					+parseFloat(this.param.filed4)
-					+parseFloat(this.param.filed5)
-					+parseFloat(this.param.filed6);
-				}
+		computed: {
+			total() {
+				return parseFloat(this.param.filed1) +
+					parseFloat(this.param.filed2) +
+					parseFloat(this.param.filed3) +
+					parseFloat(this.param.filed4) +
+					parseFloat(this.param.filed5) +
+					parseFloat(this.param.filed6);
+			}
 		},
 		onLoad() {
 
 		},
 		methods: {
-			submit(){
-				this.param.total = this.total; 
+			submit() {
+				this.param.total = this.total;
 				let that = this
 				uni.showModal({
-						title: '提示',
-						content: '确定提交?',
-						success: function(res) {
+					title: '提示',
+					content: '确定提交?',
+					success: function(res) {
 						if (res.confirm) {
-						    uni.showLoading({
-						    	title: '正在提交',
+							uni.showLoading({
+								title: '正在提交',
 								mask: true
-						    });
+							});
 							uni.request({
 								url: 'http://localhost:8888/v1/testTable',
 								method: 'POST',
-								data:this.param,
+								data: that.param,
 								success: (res) => {
 									console.log(res)
 								}
 							})
 							uni.hideLoading()
-							.catch(res => {
-								uni.hideLoading()
-							})
-						} 
-						else {
+								.catch(res => {
+									uni.hideLoading()
+								})
+						} else {
 							// 执行取消后的操作
 						}
 					}
@@ -155,29 +146,29 @@
 			},
 
 			chang(e) {
-				this.banci = e.detail.value;  //选中按钮的value值
+				this.banci = e.detail.value; //选中按钮的value值
 			},
 			selectType(e) {
-				
-				this.type = e.detail.value;  //选中按钮的value值
-				this.param.type = e.detail.value; 
+
+				this.type = e.detail.value; //选中按钮的value值
+				this.param.type = e.detail.value;
 			},
 			outtypeChange(e) {
 				this.industryIndex = e.detail.value
-				this.banzu= this.list[e.detail.value].name
+				this.banzu = this.list[e.detail.value].name
 			},
 			getDate() {
-							const date = new Date();
-							let year = date.getFullYear();
-							let month = date.getMonth() + 1;
-							let day = date.getDate();
-							month = month > 9 ? month : '0' + month;
-							day = day > 9 ? day : '0' + day;
-							return `${year}-${month}-${day}`;
-						},
-						bindDateChange: function(e) {
-							this.date = e.detail.value;
-						}
+				const date = new Date();
+				let year = date.getFullYear();
+				let month = date.getMonth() + 1;
+				let day = date.getDate();
+				month = month > 9 ? month : '0' + month;
+				day = day > 9 ? day : '0' + day;
+				return `${year}-${month}-${day}`;
+			},
+			bindDateChange: function(e) {
+				this.date = e.detail.value;
+			}
 		}
 	}
 </script>
@@ -189,28 +180,28 @@
 		border-radius: 20rpx;
 		background: white;
 		padding: 20rpx;
-	
+
 		.title {
 			font-size: 28rpx;
 			font-weight: 600;
 			color: #333333;
 		}
-	
+
 		.row {
 			display: flex;
 			justify-content: space-between;
 			border-bottom: 1px solid #EEEEEE;
 			padding: 21rpx 0;
-	
+
 			.right,
 			input {
 				font-size: 28rpx;
 				color: #333333;
 			}
 		}
-	
+
 		.row-bottom {
-	
+
 			// border: 0;
 			.right-bottom {
 				width: 280rpx;
@@ -218,10 +209,12 @@
 			}
 		}
 	}
+
 	.right-bottom {
 		width: 280rpx;
 		text-align: right;
 	}
+
 	.logo {
 		height: 200rpx;
 		width: 200rpx;
@@ -240,6 +233,7 @@
 		font-size: 36rpx;
 		color: #8f8f94;
 	}
+
 	.bottom-btn {
 		padding: 30rpx;
 		background: #FFFFFF;
@@ -247,7 +241,5 @@
 		position: fixed;
 		bottom: 0rpx;
 		display: flex;
-		z-index: 9999;
 	}
-	
-</style>
+</style>