Browse Source

入库确认

caojunjie 4 years ago
parent
commit
2b1cc2161c
2 changed files with 213 additions and 73 deletions
  1. 113 52
      pages/home/Scan-code-in/index.vue
  2. 100 21
      pages/home/scancode/index.vue

+ 113 - 52
pages/home/Scan-code-in/index.vue

@@ -1,6 +1,42 @@
 <template>
 	<!-- 扫码入库确认页面 -->
 	<view>
+		<u-modal v-model="show" :show-title="false" @confirm="confirm">
+			<view style="width: 100%;height: 42rpx;margin-top: 30rpx;margin-bottom: 10rpx;text-align: center;">成功信息</view>
+			<u-table border-color="#f2f2f2">
+				<u-tr class="u-tr">
+					<u-td class="u-td">{{successCount}}</u-td>
+					<u-td class="u-td">成功入库轮胎</u-td>
+				</u-tr>
+			</u-table>
+			<view style="width: 100%;height: 42rpx;margin-top: 30rpx;margin-bottom: 10rpx;text-align: center;">失败信息</view>
+			<u-table border-color="#f2f2f2">
+				<u-tr class="u-tr">
+					<u-th class="u-th">轮胎胎号</u-th>
+					<u-th class="u-th">失败原因</u-th>
+				</u-tr>
+				<u-tr class="u-tr" v-for="item in notBelongStoreBrandTyreNumbers">
+					<u-td class="u-td">{{item}}</u-td>
+					<u-td class="u-td">非门店经营品牌</u-td>
+				</u-tr>
+				<u-tr class="u-tr" v-for="item in nonRegularTyreNumbers">
+					<u-td class="u-td">{{item}}</u-td>
+					<u-td class="u-td">非正规胎号</u-td>
+				</u-tr>
+				<u-tr class="u-tr" v-for="item in alreadyExistsTyreNumbers">
+					<u-td class="u-td">{{item}}</u-td>
+					<u-td class="u-td">库存中已存在</u-td>
+				</u-tr>
+
+			</u-table>
+			<view style="width: 100%;height: 42rpx;margin-top: 30rpx;margin-bottom: 10rpx;text-align: center;">奖励明细</view>
+			<u-table border-color="#f2f2f2">
+				<u-tr class="u-tr">
+					<u-td class="u-td">{{rewardMoney}}奖励</u-td>
+					<u-td class="u-td">{{rewardIntegral}}积分</u-td>
+				</u-tr>
+			</u-table>
+		</u-modal>
 		<view class="header">
 			<view class="behind"></view>
 			<view class="content">
@@ -16,7 +52,7 @@
 						<view>{{item.rewardMoney}}元</view>
 					</view>
 				</view>
-			
+
 				<view class="content-three">
 					<view>
 						合计:{{total}}元
@@ -43,75 +79,100 @@
 		data() {
 			return {
 				dalist: [],
-				total: 0
+				total: 0,
+				show: false,
+				successCount: '', //成功条数
+				notBelongStoreBrandTyreNumbers: [], //非门店经营品牌胎号
+				nonRegularTyreNumbers: [], //非正规胎号
+				alreadyExistsTyreNumbers: [], //库存中已存在轮胎号
+				rewardMoney: '', //奖励金额
+				rewardIntegral: '' //奖励积分
 			}
 		},
 		created() {
 			this.getDatalist()
 		},
 		methods: {
+			confirm() {
+				this.$u.route({
+					type:'redirectTo',
+					url: 'pages/me/Warehousing-details/index'
+				})
+
+			},
 			getDatalist() {
 				uni.$on('update', data => {
-							this.datalist = data.materialList
-							request({
-								url: '/storeScan/getTyreReword',
-								method: 'Post',
-								data: {
-									storeId: '1000',
-									userId: '123',
-									materialList: this.datalist
-								}
-							}).then(res => {
-									this.dalist = res.data.data
-									
-									for (let i = 0; i < this.dalist.length; i++) {
-										this.total += parseInt(this.dalist[i].rewardMoney)
-									}
-									return this.total
-										
-									}).catch(err => {
-									console.log(err)
-								}).finally(() => {
-									Loading.close()
-								})
-							})
-					},
-					Submit() {
-						request({
-							url: '/storeScan/storeScanTyres',
-							method: 'Post',
-							data: {
-								storeId: '1000',
-								userId: '123',
-								scanAddress: '中国',
-								longitude: '1213.61256',
-								latitude: '541651.56',
-								materialList: this.datalist
-							}
-						}).then(res => {
-							console.log(res.data.msg)
-							this.$refs.repeat.show({
-								title: res.data.msg,
-								type: 'default',
-								position: 'bottom'
-							})
-						}).catch(err => {
-							console.log(err.data.msg)
-						}).finally(() => {
-							Loading.close()
+					this.datalist = data.materialList
+					request({
+						url: '/storeScan/getTyreReword',
+						method: 'Post',
+						data: {
+							storeId: '1000',
+							userId: '123',
+							materialList: this.datalist
+						}
+					}).then(res => {
+						this.dalist = res.data.data
+
+						for (let i = 0; i < this.dalist.length; i++) {
+							this.total += parseInt(this.dalist[i].rewardMoney)
+						}
+						return this.total
+
+					}).catch(err => {
+						console.log(err)
+					}).finally(() => {
+						// Loading.close()
+					})
+				})
+			},
+			Submit() {
+				this.show = true;
+				request({
+					url: '/storeScan/storeScanTyres',
+					method: 'Post',
+					data: {
+						storeId: '1000',
+						userId: '123',
+						scanAddress: '中国',
+						longitude: '1213.61256',
+						latitude: '541651.56',
+						materialList: this.datalist
+					}
+				}).then(res => {
+					console.log(res.data.msg)
+					if (res.data.code == 500) {
+						this.$refs.repeat.show({
+							title: res.data.msg,
+							type: 'default',
+							position: 'bottom'
 						})
 					}
-			},
-		}
+					this.notBelongStoreBrandTyreNumbers = res.data.data.notBelongStoreBrandTyreNumbers //非门店经营品牌胎号
+					this.successCount = res.data.data.successCount //成功条数
+					this.nonRegularTyreNumbers = res.data.data.nonRegularTyreNumbers //非正规胎号
+					this.alreadyExistsTyreNumbers = res.data.data.alreadyExistsTyreNumbers //库存中已存在轮胎号
+					this.rewardMoney = res.data.data.rewardMoney //奖励金额
+					this.rewardIntegral = res.data.data.rewardIntegral //奖励积分
+					console.log(res)
+				}).catch(err => {
+					console.log(err.data.msg)
+				}).finally(() => {
+					// Loading.close()
+				})
+			}
+		},
+	}
 </script>
 
 <style lang="scss" scoped>
-	.behind{
+	.behind {
 		width: 100%;
 		height: 230rpx;
 		margin-bottom: -200rpx;
 		background-color: #0094FE;
 	}
+
 	.header {
 		width: 100%;
 	}

+ 100 - 21
pages/home/scancode/index.vue

@@ -9,8 +9,9 @@
 				<view @click="show =! show">
 					<u-icon name="edit-pen"></u-icon>手动录入
 				</view>
-				<view class="" v-if="show==true">
-					<input type="text" value="wocao" style="background-color: #DD6161;width: 60%;font-size: 42rpx;border: 1rpx solid #000;" />
+				<view class="lnput" v-if="show==false">
+					<input type="text" v-model="number_a" :placeholder="content" clearable="true" />
+					<u-button type="primary" size="medium" @click="manualentry">确认录入</u-button>
 				</view>
 				<view class="" v-else>
 					<view>{{tips}}:{{number}}</view>
@@ -45,8 +46,8 @@
 		<view>
 		</view>
 		<u-toast ref="repeat" position="bottom" />
-		
-		
+
+
 	</view>
 </template>
 
@@ -61,42 +62,42 @@
 				tips: '提示',
 				number: '请扫码入库',
 				nbTitle: '扫码标题',
-				content: '东临碣石,以观沧海',
+				content: '请输入轮胎胎号',
 				number_s: '',
+				number_a: '',
 				lisi: [],
 				background: {
 					backgroundColor: '#0094fe',
 				},
 				show: true,
-				zoom:18,//地图相关设置
-				center:{lng:0,lat:0}
-
-
 			}
 		},
 		created() {
-			
+			uni.getLocation({
+				type: 'wgs84',
+				success: function(res) {
+					console.log('当前位置的经度:' + res.longitude);
+					console.log('当前位置的纬度:' + res.latitude);
+				    console.log(res.address);
+				},
+			});
 		},
 		methods: {
-			//获取扫码控件
-			getScanCode(val) {
-				console.log(val)
-				this.number = val
-				this.number_s = val
+			//手动录入调用
+			manualentry() {
 				request({
 						url: '/storeScan/storeScanGetTyre',
 						method: 'Post',
 						data: {
 							storeId: '1000',
 							userId: '123',
-							tyreNum: this.number_s
+							tyreNum: this.number_a
 						}
 					}).then(res => {
-						this.tips = "胎号"
 						for (let i = 0; i < this.lisi.length; i++) {
 							if (this.lisi[i].tireNumber == res.data.data[0].tirenumber) {
 								this.$refs.repeat.show({
-									title: '请勿重复扫码',
+									title: '请勿重复录入',
 									type: 'default',
 									position: 'bottom'
 								})
@@ -111,10 +112,11 @@
 							}
 						}
 						this.$refs.repeat.show({
-							title: '扫码成功',
+							title: '录入成功',
 							type: 'success',
 							position: 'bottom'
 						})
+						this.number_a = ""
 						console.log("我成功啦")
 						this.lisi.push({
 							specs: res.data.data[0].specs,
@@ -132,7 +134,7 @@
 						console.log(this.lisi)
 					}).catch(err => {
 						this.$refs.repeat.show({
-							title: "请重新扫码",
+							title: "请重新录入",
 							type: 'default',
 							position: 'bottom'
 						})
@@ -142,6 +144,73 @@
 						// Loading.close()
 					})
 			},
+			//获取扫码控件
+			getScanCode(val) {
+				console.log(val)
+				this.number = val
+				this.number_s = val
+				request({
+						url: '/storeScan/storeScanGetTyre',
+						method: 'Post',
+						data: {
+							storeId: '1000',
+							userId: '123',
+							tyreNum: this.number_s
+						}
+					}).then(res => {
+						this.tips = "胎号"
+						for (let i = 0; i < this.lisi.length; i++) {
+							if (this.lisi[i].tireNumber == res.data.data[0].tirenumber) {
+								this.$refs.repeat.show({
+									title: '请勿重复扫码',
+									type: 'default',
+									position: 'bottom'
+								})
+								return
+							}
+						}
+						this.number_s = ""
+						console.log("我成功啦")
+						console.log(res)
+						this.lisi.push({
+							specs: res.data.data[0].specs,
+							flagRegular: res.data.data[0].isRegular,
+							diameter: res.data.data[0].diameter,
+							maktx: res.data.data[0].maktx,
+							pattern: res.data.data[0].pattern,
+							soldToPartyKunnr: res.data.data[0].soldToPartyKunnr,
+							matnr: res.data.data[0].matnr,
+							tireNumber: res.data.data[0].tirenumber,
+							brand: res.data.data[0].brand,
+							shippedDate: res.data.data[0].shippedDate,
+							scanWay: '1'
+						})
+						this.$refs.repeat.show({
+							title: '扫码成功',
+							type: 'success',
+							position: 'bottom'
+						})
+						console.log(this.lisi)
+					}).catch(err => {
+						if (code == 400) {
+							this.$refs.repeat.show({
+								title: "无网络",
+								type: 'default',
+								position: 'bottom'
+							})
+						} else {
+							this.$refs.repeat.show({
+								title: "请重新扫码",
+								type: 'default',
+								position: 'bottom'
+							})
+						}
+						console.log(err)
+					})
+					.finally(() => {
+						// Loading.close()
+					})
+			},
 			confirm(index) {
 				console.log(index + "什么情况")
 				this.lisi.splice(index, 1)
@@ -153,13 +222,14 @@
 						type: 'default',
 						position: 'bottom'
 					})
-				} else { //解
+				} else {
 					this.$u.route({
 						url: 'pages/home/Scan-code-in/index'
 					})
 					uni.$emit('update', {
 						materialList: this.lisi
 					})
+					this.lisi = []
 				}
 			}
 		}
@@ -167,6 +237,15 @@
 </script>
 
 <style lang="scss" scoped>
+	.lnput>input {
+		background-color: none;
+		width: 60%;
+		font-size: 42rpx;
+		float: left;
+		margin-top: 10rpx;
+		margin-left: 20rpx;
+	}
+
 	.generate {
 		width: 98%;
 		height: 300rpx;