lilei 2 лет назад
Родитель
Сommit
ed33ae6344

+ 2 - 2
App.vue

@@ -1,8 +1,8 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.16.156:9110/saas/clz/', // 本地
-			baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
+			baseUrl: 'http://192.168.0.215:9110/saas/clz/', // 本地
+			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},
 		onLaunch: function() {

+ 8 - 0
api/car.js

@@ -237,4 +237,12 @@ export const getScanVinLogList = (params) => {
     data: params,
     method: 'post'
   })
+}
+
+// 游客vin扫描次数
+export const getScanVinQty = (params) => {
+  return request({
+    url: `scanVinLog/getScanVinQty`,
+    method: 'get'
+  })
 }

+ 45 - 12
pages/index/index.vue

@@ -39,7 +39,7 @@
 					</view>
 				</view>
 				<view>
-					<text class="user-rz">
+					<text v-if="userInfo.identifyType=='VISITOR'" class="user-rz">
 						认证成为门店
 					</text>
 					<u-icon name="arrow-right"></u-icon>
@@ -59,12 +59,17 @@
 		<view class="list-box">
 			<!-- 扫描记录 -->
 			<u-cell-group :border="false">
-				<u-cell-item title="VIN查询历史" @click="toAllRecord" :title-style="{fontSize:'1em'}" value="全部">
+				<u-cell-item title="VIN查询历史" @click="toAllRecord" :title-style="{fontSize:'1em'}" :value="userInfo.identifyType=='VISITOR'?'':'全部'">
 					<u-icon slot="icon" size="38" color="#066cff" style="margin-right: 0.3em;" name="order"></u-icon>
 				</u-cell-item>
 			</u-cell-group>
 			<u-cell-group :border="false" v-if="hasLogin">
-				<u-cell-item v-for="item in vinList" @click="toChoosePart(item)" :key="item.id" :title="item.vinCode" :title-style="{fontSize:'1em'}" :label="item.brandName +' '+item.modelName">
+				<u-cell-item v-for="item in vinList" 
+				@click="toChoosePart(item)" 
+				:key="item.id" 
+				:title="item.vinCode" 
+				:title-style="{fontSize:'1em'}" 
+				:label="userInfo.identifyType=='VISITOR' ? '' : (item.brandName +' '+item.modelName)">
 					<text slot="icon"></text>
 				</u-cell-item>
 				<view style="padding: 20upx;">
@@ -106,7 +111,7 @@
 			}
 		},
 		computed: {
-			...mapState(['hasLogin']),
+			...mapState(['hasLogin','vuex_vinScanNums']),
 			hasShelf(){
 				return this.$store.state.vuex_storeShelf
 			},
@@ -153,6 +158,8 @@
 					this.getStoreShelf()
 					// 获取扫描记录
 					this.getVinLog()
+					// 获取扫描次数
+					this.$store.dispatch("getScanNums")
 				}
 			},
 			//  获取数据字典
@@ -193,15 +200,18 @@
 					})
 				}
 			},
+			// 获取上方滚动扫描记录
 			getScrollLog(){
 				scanVinLogQueryRoll({pageNo:1,pageSize:1000}).then(res => {
 					this.list = res.data.list || []
 				})
 			},
+			// 获取当前门店扫描记录
 			getVinLog(){
 				this.vinList  = []
 				this.status = "loading"
-				getScanVinLogList({pageNo:1,pageSize:5}).then(res => {
+				// VISITOR:游客,EMPLOYEE:雇员
+				getScanVinLogList({pageNo:1,pageSize:5,identifyType: this.userInfo.identifyType}).then(res => {
 					this.vinList = res.data.list || []
 					this.vinList = this.vinList.filter(item => item.vinCode)
 					this.status = 'nomore'
@@ -234,21 +244,44 @@
 			},
 			// 去扫描
 			openCamera(){
-				uni.navigateTo({
-					url: this.hasLogin ? "/pages/scan-frame/scan-frame" : '/pages/login/login'
-				})
+				if(this.userInfo.identifyType=='VISITOR'){
+					if(this.vuex_vinScanNums < 10){
+						uni.navigateTo({
+							url: this.hasLogin ? "/pages/scan-frame/scan-frame" : '/pages/login/login'
+						})
+					}else{
+						uni.showModal({
+							title: '提示',
+							content: '个人用户扫描VIN限10次/天,您的次数已用完!',
+							confirmText: '去认证',
+							success(res) {
+								if(res.confirm) {  
+									uni.navigateTo({
+										url: '/pages/storeManage/storeAuth'
+									})
+								}
+							}
+						})
+					}
+				}else{
+					uni.navigateTo({
+						url: this.hasLogin ? "/pages/scan-frame/scan-frame" : '/pages/login/login'
+					})
+				}
 			},
 			// 查看扫描记录
 			toAllRecord(){
-				uni.navigateTo({
-					url: this.hasLogin ? "/pages/vinRecord/vinRecord" : '/pages/login/login'
-				})
+				if(this.userInfo.identifyType == 'EMPLOYEE'){
+					uni.navigateTo({
+						url: this.hasLogin ? "/pages/vinRecord/vinRecord" : '/pages/login/login'
+					})
+				}
 			},
 			toUser(){
 				if(this.hasLogin){
 					// 用户详细信息 或 门店认证
 					uni.navigateTo({
-						url: !this.hasLogin ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
+						url: this.userInfo.identifyType=='EMPLOYEE' ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
 					})
 				}else{
 					uni.navigateTo({

Разница между файлами не показана из-за своего большого размера
+ 2 - 0
pages/morePage/morePage.vue


+ 40 - 5
pages/scan-frame/scan-frame.vue

@@ -8,6 +8,7 @@
 	  <cover-view class="noAuth" v-if="showAuth" @click="openAuth">
 		  您未开启摄像机权限,<cover-view class="btns">请点击开启权限</cover-view>
 	  </cover-view>
+	  <cover-image class="tips" v-if="userInfo.identifyType=='VISITOR'">个人用户限<cover-view class="text">10次/天</cover-view></cover-image>
       <cover-view class="scanBtn" v-if="scanShow">
         <cover-view class="beat" @click="scan">
           <cover-image class="beatImg" src="@/static/scan-frame/album.png"></cover-image>
@@ -27,6 +28,10 @@
 </template>
 
 <script>
+import {
+	    mapState,
+	    mapMutations,
+	} from 'vuex'
 import { vinCode } from '@/api/car.js'
 export default {
   data() {
@@ -45,11 +50,16 @@ export default {
 	const _this = this
   	uni.getSetting({
   	   success(res) {
-  	      console.log(res.authSetting['scope.camera'])
   		  _this.showAuth = !res.authSetting['scope.camera']
   	   }
   	})
   },
+  computed: {
+  	...mapState(['hasLogin','vuex_vinScanNums']),
+  	userInfo(){
+  		return this.$store.state.vuex_userInfo
+  	}
+  },
   methods: {
 	cameraInit(e){
 		this.showAuth = false
@@ -66,7 +76,7 @@ export default {
 	// 手动输入
 	inputs(){
 		uni.redirectTo({
-			url: "/pages/vinInput/confirmVin?verifyCode="
+			url: "/pages/vinInput/confirmVin?verifyCode=" + "&type=input"
 		})
 	},
     // 相册
@@ -163,7 +173,26 @@ export default {
 			// 拿到base64,不需要base64  就把上层的转换去掉
 			this.scanShow = true
 			// 此处为后端接口 传base64图片 进行ocr识别
-			this.parseVinNo(base.data)
+			if(this.userInfo.identifyType=='VISITOR'){
+				if(this.vuex_vinScanNums < 10){
+					this.parseVinNo(base.data)
+				}else{
+					uni.showModal({
+						title: '提示',
+						content: '个人用户扫描VIN限10次/天,您的次数已用完!',
+						confirmText: '去申请认证',
+						success(res) {
+							if(res.confirm) {
+								uni.redirectTo({
+									url: '/pages/storeManage/storeAuth'
+								})
+							}
+						}
+					})
+				}
+			}else{
+				this.parseVinNo(base.data)
+			}
 		  },
 		  fail: (err) => {
 			uni.hideLoading()
@@ -192,7 +221,7 @@ export default {
 			console.log(res, '识别VIN')
 			if(res.status == 200){
 				uni.redirectTo({
-					url: "/pages/vinInput/confirmVin?verifyCode=123456ads11234567&filePath="+base64Str + "&verifyCode="+res.data
+					url: "/pages/vinInput/confirmVin?verifyCode=123456ads11234567&filePath="+base64Str + "&verifyCode="+res.data + "&type=carmen"
 				})
 			}else{
 				uni.showToast({
@@ -226,7 +255,7 @@ export default {
     height: 100vh;
     z-index: 1;
   }
-  .noAuth{
+  .noAuth,.tips{
 	  width: 100%;
 	  z-index: 999998;
 	  position: fixed;
@@ -236,6 +265,12 @@ export default {
 	  .btns{
 		  color: dodgerblue;
 	  }
+	  .text{
+		  color:#ffff00;
+	  }
+  }
+  .tips{
+	  bottom: 90vh;
   }
   .scanBtn {
     width: 100%;

+ 60 - 16
pages/vinInput/confirmVin.vue

@@ -37,6 +37,10 @@
 </template>
 
 <script>
+	import {
+	    mapState,
+	    mapMutations,
+	} from 'vuex'
 	import { getVehicleInfoByVin, scanVinLog } from '@/api/car.js'
 	export default {
 		data() {
@@ -47,6 +51,7 @@
 			}
 		},
 		computed: {
+			...mapState(['hasLogin','vuex_vinScanNums']),
 			userInfo(){
 				return this.$store.state.vuex_userInfo
 			},
@@ -57,6 +62,21 @@
 		onLoad(opts) {
 			this.verifyCode = opts.verifyCode || ''
 			this.vinImg = opts.filePath || ''
+			
+			// 不是手动输入
+			if(opts.type == 'carmen'){
+				// 游客需要记录扫描记录
+				if(this.userInfo.identifyType=='VISITOR' && this.verifyCode){
+					this.creatRecord(null)
+				}
+				// 如果识别返回空
+				if(!this.verifyCode){
+					uni.showToast({
+						icon: 'none',
+						title: 'VIN识别失败,请重新扫描或手动输入VIN'
+					})
+				}
+			}
 		},
 		// 分享
 		onShareAppMessage(e){
@@ -70,9 +90,30 @@
 		methods: {
 			// 重新扫描
 			toScan(){
-				uni.redirectTo({
-					url: "/pages/scan-frame/scan-frame"
-				})
+				if(this.userInfo.identifyType=='VISITOR'){
+					if(this.vuex_vinScanNums < 10){
+						uni.redirectTo({
+							url: "/pages/scan-frame/scan-frame"
+						})
+					}else{
+						uni.showModal({
+							title: '提示',
+							content: '个人用户扫描VIN限10次/天,您的次数已用完!',
+							confirmText: '去认证',
+							success(res) {
+								if(res.confirm) {  
+									uni.redirectTo({
+										url: '/pages/storeManage/storeAuth'
+									})
+								}
+							}
+						})
+					}
+				}else{
+					uni.redirectTo({
+						url: "/pages/scan-frame/scan-frame"
+					})
+				}
 			},
 			// 复制
 			toCopy(){
@@ -91,17 +132,18 @@
 			creatRecord(data){
 				scanVinLog({
 					vinCode: this.verifyCode.toUpperCase(),
-					brandName: data.brand_name,
-					brandId: data.brand_id,
-					modelName: data.model_name,
-					modelId:data.model_id,
-					modelInfo: data.text,
-					seriesId:data.series_id,
-					seriesName:data.series_name,
-					subId:data.sub_id,
-					subName:data.sub_name,
-					icon: data.icon,
-					year: data.year
+					brandName: data?data.brand_name:'',
+					brandId: data?data.brand_id:'',
+					modelName: data?data.model_name:'',
+					modelId:data?data.model_id:'',
+					modelInfo: data?data.text:'',
+					seriesId:data?data.series_id:'',
+					seriesName:data?data.series_name:'',
+					subId:data?data.sub_id:'',
+					subName:data?data.sub_name:'',
+					icon: data?data.icon:'',
+					year: data?data.year:'',
+					identifyType: this.userInfo.identifyType
 				}).then(res => {
 					console.log(res)
 					uni.$emit("refashHome")
@@ -124,8 +166,10 @@
 						vin:vinNo
 					}).then(res => {
 						if (res.status == 200&&res.data) {
-							// 生成vin记录
-							_this.creatRecord(res.data)
+							// 非游客,生成vin记录
+							if(_this.userInfo.identifyType=='EMPLOYEE'){
+								_this.creatRecord(res.data)
+							}
 							// 打开选择配件页面
 							uni.redirectTo({
 								url: "/pages/digitalShelf/choosePart?vinNumber="+vinNo+"&carList="+encodeURIComponent(JSON.stringify(res.data))

+ 5 - 3
pages/vinRecord/vinRecord.vue

@@ -47,6 +47,9 @@
 		computed: {
 			hasShelf(){
 				return this.$store.state.vuex_storeShelf
+			},
+			userInfo(){
+				return this.$store.state.vuex_userInfo
 			}
 		},
 		methods: {
@@ -61,14 +64,13 @@
 			  if (pageNo) {
 			    this.pageNo = pageNo
 			  }
-			  // 状态条件
-			  const state = ['WAIT','FINISH','CLOSE']
+			  // 查询条件
 			  let params = {
 				// beginDate: moment().subtract('days', 6).format('YYYY-MM-DD 00:00:00'),
 				// endDate: moment(moment().valueOf()).format('YYYY-MM-DD 23:59:59'),
 			    pageNo: this.pageNo,
 			    pageSize: this.pageSize,
-				billState: state[this.swiperCurrent]
+				identifyType: this.userInfo.identifyType
 			  }
 			  this.status = "loading"
 			  getScanVinLogList(params).then(res => {

+ 13 - 1
store/index.js

@@ -3,6 +3,7 @@ import Vuex from 'vuex'
 Vue.use(Vuex)
 import {code2Session, logout, checkLogin} from '@/api/login.js'
 import {getLookUpDatas} from '@/api/data.js'
+import { getScanVinQty } from '@/api/car.js'
 let lifeData = {};
 
 try{
@@ -50,6 +51,7 @@ const store = new Vuex.Store({
 		vuex_userInfo: null,
 		vuex_openid: "",
 		vuex_nowStaffData: null, // 员工临时数据
+		vuex_vinScanNums:null, // 扫描次数
     },
 	getters:{
 		getOpeid(state){
@@ -61,6 +63,8 @@ const store = new Vuex.Store({
 			console.log(data)
             state.hasLogin = true;
 			uni.setStorageSync('token', data.access_token);
+			// VISITOR:游客,EMPLOYEE:雇员
+			data.auth_user['identifyType'] = 'VISITOR'
 			uni.setStorageSync('userInfo', data.auth_user);
 			state.vuex_userInfo = data.auth_user
         },
@@ -101,9 +105,17 @@ const store = new Vuex.Store({
 		setHasLogin(state,isLogin){
 			state.hasLogin = isLogin;
 			state.vuex_userInfo = uni.getStorageSync('userInfo')
-		}
+		},
+		setScanNums(state,nums) {
+			state.vuex_vinScanNums = nums
+		},
     },
 	actions: {
+		getScanNums(context,provider){
+			getScanVinQty().then(res => {
+				context.commit('setScanNums',res.data||0)
+			})
+		},
 		wxLogin(context,provider){
 			uni.login({
 			  provider: provider,

Некоторые файлы не были показаны из-за большого количества измененных файлов