Browse Source

解决冲突

qukaidi 4 years ago
parent
commit
5925c6f7cd
5 changed files with 289 additions and 18 deletions
  1. 66 0
      common/p-scan/scan.vue
  2. 4 0
      main.js
  3. 24 18
      pages.json
  4. 195 0
      pages/home/scancode/index.vue
  5. BIN
      static/sailun/line.png

+ 66 - 0
common/p-scan/scan.vue

@@ -0,0 +1,66 @@
+<template>
+	<view id="barcode"></view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				// #ifdef APP-PLUS
+				barcode: [
+					plus.barcode.CODE39,
+					plus.barcode.CODE93,
+					plus.barcode.CODE128,
+				], //码类型
+				// #endif
+			};
+		},
+		created() {
+			var statusBarHeight = uni.getSystemInfoSync().statusBarHeight; //状态栏
+			var height = statusBarHeight + 44 + 104 + 'px';
+			var pages = getCurrentPages();
+			var page = pages[pages.length - 1];
+			// #ifdef APP-PLUS
+			var currentWebview = page.$getAppWebview();
+			this.barcode = plus.barcode.create('barcode', this.barcode, {
+				top: '7px',
+				left: '10%',
+				width: '80%',
+				height: '35%', //180px
+				position: 'static',
+				background:'#ffffff',
+				frameColor:'#00A0EA',
+				scanbarColor:'#00A0EA'
+				
+				
+			});
+			this.barcode.onmarked = this.onmarked;
+			currentWebview.append(this.barcode);
+			const res = uni.getSystemInfoSync();
+			if (res.platform == 'android') { //安卓机
+				this.barcode.start();
+			}
+			
+			this.barcode.setStyle({
+				
+				});
+			// #endif
+		},
+		onUnload() {
+			clearTimeout(this.t);
+		},
+		methods: {
+			onmarked(type, result) {
+				// console.log(type +':'+ result);
+				this.$emit('getCode', result);
+				this.t = setTimeout(() => {
+					this.barcode.start();
+				}, 1000)
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+
+</style>

+ 4 - 0
main.js

@@ -62,3 +62,7 @@ import httpApi from '@/common/http.api.js'
 Vue.use(httpApi, app)
 
 app.$mount()
+
+//扫码组件
+import scan from '@/common/p-scan/scan.vue'
+Vue.component('scan',scan)

+ 24 - 18
pages.json

@@ -11,20 +11,26 @@
 	// 	}]
 	// },
 	"pages": [
-
 		// 首页
 		{
 			"path": "pages/home/index",
 			"style": {
-				"navigationStyle": "custom", // 隐藏系统导航栏
-				"navigationBarTextStyle": "black"
+				"navigationBarTitleText": "首页"
 			}
+
 		},
 		// 系统消息
 		{
-			"path": "pages/System-message/index",
+			"path": "pages/home/scancode/index",
 			"style": {
-				"navigationBarTitleText": "系统消息"
+				"navigationBarTitleText": "扫码入库",
+				"navigationBarBackgroundColor": "#0095FF",
+				"navigationBarTextStyle": "white",
+				"app-plus": {
+					"bounce": "none" ,//关闭窗口回弹效果
+					"scrollIndicator": "none"
+				}
+				// "app-plus": {"titleNView": false} //取消去掉导航栏顶部标题
 			}
 
 		},
@@ -33,7 +39,7 @@
 		{
 			"path": "pages/msg/index",
 			"style": {
-				"navigationBarTitleText": "消息中心"
+				"navigationBarTitleText": "消息"
 			}
 
 		},
@@ -43,7 +49,7 @@
 			"style": {
 				// "navigationBarTitleText": "我的",
 				"app-plus": {
-					"titleNView": false
+					"titleNView":false
 				}
 			}
 
@@ -53,7 +59,7 @@
 			"path": "pages/login/index",
 			"style": {
 				"app-plus": {
-					"titleNView": false
+					"titleNView":false
 				}
 			}
 		},
@@ -220,16 +226,16 @@
 							}
 						}
 					}
-
-				},
-				//查询结果
-				{
-					"path": "scancodequery/result",
-					"style": {
-						"navigationBarTitleText": "查询结果",
-						"app-plus": {
-							"bounce": "none" //取消页面上的回弹效果
-						}
+				}
+			
+			},
+			//查询结果
+			{
+				"path": "scancodequery/result",
+				"style": {
+					"navigationBarTitleText": "查询结果",
+					"app-plus": {
+						"bounce": "none" //取消页面上的回弹效果
 					}
 				}
 			]

+ 195 - 0
pages/home/scancode/index.vue

@@ -0,0 +1,195 @@
+<template>
+	<view class="content">
+		<view class="text-area">
+			<view class="white_b"></view>
+		</view>
+		<view class="stripe"></view>
+		<view class="roll">
+			<view>
+				<view @click="show = true">
+					<u-icon name="edit-pen"></u-icon>手动录入
+				</view>
+				<view>{{tips}}:{{number}}</view>
+			</view>
+			<view>
+				<view></view>
+				<view></view>
+				<view style="width: 94%;height: 20px;background-color: rgb(0,0,0,0);margin: 0 auto;margin-top: -1rpx;border-radius: 0;">
+					<image src="../../../static/sailun/line.png" style="width: 100%;height: 1rpx;" mode=""></image>
+				</view>
+			</view>
+			<view class="generate" style="overflow:auto;">
+				<u-table font-size="20" border-color="#ffffff" bg-color="#fff">
+					<u-tr class="u-tr">
+						<u-th class="u-th" width="30%">胎号</u-th>
+						<u-th class="u-th">规格</u-th>
+						<u-th class="u-th" width="15%"></u-th>
+					</u-tr>
+					<u-tr class="u-tr" :key="index" v-for="(item, index) in lisi">
+						<u-td class="u-td" width="30%">{{item.name}}</u-td>
+						<u-td class="u-td">{{item.Specifications}}</u-td>
+						<u-td class="u-td" width="15%">删除</u-td>
+					</u-tr>
+				</u-table>
+				<u-divider color="rgb(144, 147, 153)" half-width="200" border-color="rgb(144, 147, 153)" margin-top="40">没有更多了</u-divider>
+			</view>
+		</view>
+		<view class="determine">
+			<u-button type="primary" :ripple="true" shape="circle">扫码确认</u-button>
+		</view>
+		<view>
+		</view>
+		<view>
+			<scan @getCode="getScanCode" />
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				tips: '提示',
+				number: '请扫码入库',
+				i: 1,
+				lisi: [{
+					name: '1',
+					Specifications: '175/70R14 88T XL BH15 BGBL'
+				}]
+			}
+		},
+		onLoad() {
+
+		},
+		onReady() {
+			uni.setNavigationBarTitle({
+				title: '扫码干哈'
+			});
+		},
+		methods: {
+			bug() {
+				console.log("成功")
+				this.i++
+				this.lisi.push({
+					name: this.i,
+					Specifications: this.i
+				})
+			},
+			//获取扫码控件
+			getScanCode(val) {
+				console.log(val)
+				this.number = val
+				this.tips = "胎号"
+				this.bug()
+			}
+		}
+	}
+</script>
+
+<style>
+	.generate {
+		width: 92%;
+		height: 420rpx;
+		margin: 0 auto;
+		margin-top: 120rpx;
+	}
+
+	.determine {
+		width: 690rpx;
+		margin-top: 30rpx;
+	}
+
+	.content {
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+	}
+
+	.logo {
+		height: 200rpx;
+		width: 200rpx;
+		margin-top: 200rpx;
+		margin-left: auto;
+		margin-right: auto;
+		margin-bottom: 50rpx;
+	}
+
+	.stripe {
+		width: 720rpx;
+		height: 30rpx;
+		background: rgba(0, 0, 0, 0.2);
+		border-radius: 12rpx;
+		margin: 0 auto;
+		margin-top: -200rpx;
+	}
+
+	.text-area {
+		width: 100%;
+		height: 750rpx;
+		background-color: #0094fe;
+		display: flex;
+		justify-content: center;
+	}
+
+	.white_b {
+		width: 83%;
+		height: 540rpx;
+		background-color: rgb(255, 255, 255, 0.5);
+		border-radius: 20rpx;
+	}
+
+	.title {
+		font-size: 36rpx;
+		color: #8f8f94;
+	}
+
+	page {
+		/* background-color: #000; */
+	}
+
+	.roll {
+		width: 690rpx;
+		height: auto;
+		background: #FFFFFF;
+		margin: 0 auto;
+		margin-top: -15rpx;
+		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(101, 176, 249, 0.3);
+		border-bottom-left-radius: 10rpx;
+		border-bottom-right-radius: 10rpx;
+		padding-top: 50rpx;
+		padding-bottom: 50rpx;
+	}
+
+	.roll>view:nth-child(1)>view:nth-child(2) {
+		font-size: 42rpx;
+		font-weight: bold;
+		color: #0192FD;
+		text-align: center;
+		margin-bottom: 50rpx;
+	}
+
+	.roll>view:nth-child(1)>view:nth-child(1) {
+		width: 200rpx;
+		color: #0094FE;
+		position: relative;
+		top: -40rpx;
+		left: 500rpx;
+		font-size: 32rpx;
+		text-align: center;
+	}
+
+	.roll>view:nth-child(2)>view {
+		width: 50rpx;
+		height: 50rpx;
+		background-color: #F4F4F4;
+		border-radius: 100%;
+		float: right;
+		margin-right: -30rpx;
+	}
+
+	.roll>view:nth-child(2)>view:nth-child(1) {
+		float: left;
+		margin-left: -30rpx;
+	}
+</style>

BIN
static/sailun/line.png