lilei 2 lat temu
rodzic
commit
e16726918b

+ 1 - 1
App.vue

@@ -1,7 +1,7 @@
 <script>
 	export default {
 		globalData: {
-			baseUrl: 'http://192.168.0.102:9110/saas/clz/', // 本地
+			baseUrl: 'http://192.168.0.103:9110/saas/clz/', // 本地
 			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},

+ 1 - 1
api/car.js

@@ -228,7 +228,7 @@ export const scanVinLogQueryRoll = (params) => {
     url: `scanVinLog/queryRoll/${params.pageNo}/${params.pageSize}`,
     data: params,
     method: 'post'
-  })
+  }, true)
 }
 // vin查询记录分页
 export const getScanVinLogList = (params) => {

+ 8 - 2
api/request.js

@@ -1,5 +1,5 @@
 import { objToUrl } from '@/utils/index';
-function request(options) {
+function request(options,hasNoToken) {
   return new Promise((resolve, reject) => {
     let _obj = {
       url: '',
@@ -10,12 +10,17 @@ function request(options) {
       }
     };
 	const baseUrl = getApp().globalData.baseUrl
+	const userInfo = uni.getStorageSync('userInfo');
     Object.assign(_obj, options);
 	const header = {
 			'USER-TERM-TYPE': 'ipad', // 支付时需要用到 与pad一致
 			'App-Type': 2,
 			'Version': '1.0.0',
-			'authorization': uni.getStorageSync('token')
+	}
+	if(userInfo.sysUserFlag == '0'){
+		header['auth_token'] = hasNoToken ? '' : uni.getStorageSync('token')
+	}else{
+		header['authorization'] = hasNoToken ? '' : uni.getStorageSync('token')
 	}
 	_obj.header = header
 	_obj.header['X-HEADER-APPID'] = '!z2Yc.aes|STw5oReFk+wACvW4IGVHZsFe+/MgMT9cp0amuic1gqE=';
@@ -24,6 +29,7 @@ function request(options) {
     _obj.method = _obj.method.toUpperCase();
     _obj.success = function(res) {
       if (_obj.url.indexOf('checkLogin') > -1) {
+	    console.log(res.data,'res.data checkLogin')
         resolve(res.data);
       } else if (res.data.status === '900010') {
         setTimeout(function() {

+ 3 - 3
pages/digitalShelf/choosePart.vue

@@ -250,7 +250,7 @@
 			this.getCarCodeByVin()
 			
 			// 游客去认证
-			if(this.userInfo.identifyType == 'VISITOR'){
+			if(this.userInfo.sysUserFlag == '0'){
 				this.showPopup = true
 			}
 		},
@@ -266,7 +266,7 @@
 			},
 			callPhone() {
 				// 游客未认证
-				if(this.userInfo.identifyType == 'VISITOR'){
+				if(this.userInfo.sysUserFlag == '0'){
 					this.showPopup = true
 				}else{
 					if(this.dealerPhone!=''){
@@ -511,7 +511,7 @@
 			// 立即提交
 			submitForm(){
 				// 游客去认证
-				if(this.userInfo.identifyType == 'VISITOR'){
+				if(this.userInfo.sysUserFlag == '0'){
 					this.showPopup = true
 					return
 				}

+ 32 - 23
pages/index/index.vue

@@ -38,13 +38,13 @@
 							请点击登录
 						</view>
 						<view v-else>
-							<view class="user-name">{{userInfo.userNameCN}}</view>
+							<view class="user-name">{{userInfo.userNameCN || '游客'}}</view>
 							<view>{{userInfo.orgName}}</view>
 						</view>
 					</view>
 				</view>
 				<view>
-					<text v-if="userInfo&&userInfo.identifyType=='VISITOR'" class="user-rz">
+					<text v-if="hasLogin&&userInfo&&userInfo.sysUserFlag == '0'" class="user-rz">
 						{{storeApply.auditStatus=='WAIT'?'认证门店审核中':'认证成为门店'}}
 					</text>
 					<u-icon name="arrow-right"></u-icon>
@@ -64,7 +64,7 @@
 		<view class="list-box">
 			<!-- 扫描记录 -->
 			<u-cell-group :border="false">
-				<u-cell-item title="VIN查询历史" @click="toAllRecord" :title-style="{fontSize:'1em'}" :value="userInfo&&userInfo.identifyType=='VISITOR'?'':'全部'">
+				<u-cell-item title="VIN查询历史" @click="toAllRecord" :title-style="{fontSize:'1em'}" :value="userInfo&&userInfo.sysUserFlag == '0'?'':'全部'">
 					<u-icon slot="icon" size="38" color="#066cff" style="margin-right: 0.3em;" name="order"></u-icon>
 				</u-cell-item>
 			</u-cell-group>
@@ -74,7 +74,7 @@
 				:key="item.id" 
 				:title="item.vinCode" 
 				:title-style="{fontSize:'1em'}" 
-				:label="userInfo&&userInfo.identifyType=='VISITOR' ? '' : (item.brandName +' '+item.modelName)">
+				:label="userInfo&&userInfo.sysUserFlag == '0' ? '' : (item.brandName +' '+item.modelName)">
 					<text slot="icon"></text>
 				</u-cell-item>
 				<view style="padding: 20upx;">
@@ -130,10 +130,6 @@
 			}
 		},
 		onReady() {
-			// 检测是否登录
-			this.$store.dispatch('checkLogin',()=>{
-				this.pageInit()
-			})
 			this.getScrollLog()
 			
 			// 获取导航栏高度
@@ -146,10 +142,15 @@
 			}
 		},
 		onLoad() {
-			// 获取数据字典
-			this.getListLookUp();
-			// 获取支付,收款方式
-			this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
+			// 检测是否登录
+			this.$store.dispatch('checkLogin',()=>{
+				// 获取数据字典
+				this.getListLookUp();
+				// 获取支付,收款方式
+				this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
+				// 初始化页面
+				this.pageInit()
+			})
 			// 刷新首页数据
 			uni.$on("refashHome",()=>{
 				this.pageInit()
@@ -167,19 +168,26 @@
 		},
 		onShareAppMessage() {},
 		onShow() {
-			// 查询门店认证信息
-			this.findLastApply()
+			if(this.hasLogin){
+				// 查询门店认证信息
+				this.findLastApply()
+			}
 		},
 		methods: {
 			pageInit(){
 				if(this.hasLogin){
 					this.avatarUrl = this.userInfo.avatarUrl
-					// 查询是否有数字货架
-					this.getStoreShelf()
+					// 非游客
+					if(this.userInfo.sysUserFlag == '1'){
+						// 查询是否有数字货架
+						this.getStoreShelf()
+					}
 					// 获取扫描记录
 					this.getVinLog()
 					// 获取扫描次数
 					this.$store.dispatch("getScanNums")
+					// 查询门店认证信息
+					this.findLastApply()
 				}else{
 					uni.removeStorageSync('token')
 				}
@@ -203,8 +211,8 @@
 			},
 			// 获取最新申请门店
 			findLastApply(){
-				// const mobile = this.userInfo.mobile
-				this.$store.dispatch('getSotreAuth','11223564569')
+				const mobile = this.userInfo.mobile
+				this.$store.dispatch('getSotreAuth',mobile)
 			},
 			// 知道审核不通过
 			toKnow(){
@@ -242,6 +250,7 @@
 			// 获取上方滚动扫描记录
 			getScrollLog(){
 				scanVinLogQueryRoll({pageNo:1,pageSize:1000}).then(res => {
+					console.log(res)
 					this.list = res.data.list || []
 				})
 			},
@@ -250,7 +259,7 @@
 				this.vinList  = []
 				this.status = "loading"
 				// VISITOR:游客,EMPLOYEE:雇员
-				getScanVinLogList({pageNo:1,pageSize:5,identifyType: this.userInfo.identifyType}).then(res => {
+				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'
@@ -284,7 +293,7 @@
 			// 去扫描
 			openCamera(){
 				if(this.hasLogin){
-					if(this.userInfo.identifyType=='VISITOR'){
+					if(this.userInfo.sysUserFlag == '0'){
 						if(this.vuex_vinScanNums < 10){
 							uni.navigateTo({
 								url: "/pages/scan-frame/scan-frame"
@@ -316,7 +325,7 @@
 			},
 			// 查看扫描记录
 			toAllRecord(){
-				if(this.userInfo.identifyType == 'EMPLOYEE'){
+				if(this.userInfo.sysUserFlag == '1'){
 					uni.navigateTo({
 						url: this.hasLogin ? "/pages/vinRecord/vinRecord" : '/pages/login/login'
 					})
@@ -326,11 +335,11 @@
 				if(this.hasLogin){
 					// 用户详细信息 或 门店认证
 					uni.navigateTo({
-						url: this.userInfo.identifyType=='EMPLOYEE' ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
+						url: this.userInfo.sysUserFlag == '1' ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
 					})
 				}else{
 					uni.navigateTo({
-						url: '/pages/storeManage/storeAuth'
+						url: '/pages/login/login'
 					})
 				}
 			},

+ 0 - 1
pages/login/login.vue

@@ -96,7 +96,6 @@
 							console.log(res,_this.path, 'login data')
 							if (res.status == '200') {
 								this.toMain(res.data)
-								uni.$emit("getUserInfo")
 								if (_this.path === '/pages/index/index' || _this.lanuch) {
 									uni.reLaunch({
 										url: _this.path

+ 1 - 1
pages/morePage/morePage.vue

@@ -98,7 +98,7 @@
 			toPage(path){
 				if(this.hasLogin){
 					// 游客未认证
-					if(this.userInfo.identifyType == 'VISITOR'){
+					if(this.userInfo.sysUserFlag == '0'){
 						this.showPopup = true
 					}else{
 						// 已有数字货架

+ 2 - 2
pages/scan-frame/scan-frame.vue

@@ -8,7 +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-image class="tips" v-if="userInfo.sysUserFlag == '0'">个人用户限<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>
@@ -173,7 +173,7 @@ export default {
 			// 拿到base64,不需要base64  就把上层的转换去掉
 			this.scanShow = true
 			// 此处为后端接口 传base64图片 进行ocr识别
-			if(this.userInfo.identifyType=='VISITOR'){
+			if(this.userInfo.sysUserFlag == '0'){
 				if(this.vuex_vinScanNums < 10){
 					this.parseVinNo(base.data)
 				}else{

+ 1 - 2
pages/storeManage/storeAuth.vue

@@ -186,8 +186,7 @@
 				this.form.label = this.labelArr.join('-')
 				this.findDealer()
 			}else{
-				// this.form.contactPhone = this.$store.state.vuex_userInfo.mobile
-				this.form.contactPhone = '11223564569'
+				this.form.contactPhone = this.$store.state.vuex_userInfo.mobile
 				this.tipTit = ''
 			}
 		},

+ 10 - 11
pages/vinInput/confirmVin.vue

@@ -10,7 +10,6 @@
 		<view class="vin-img" v-if="vinImg">
 			<u-image :src="vinImg" width="100%" height="165"></u-image>
 		</view>
-		<!-- <xt-verify-code v-model="verifyCode" inputType='text' size="17" @confirm="confirm"></xt-verify-code> -->
 		<view style="padding: 30rpx 60rpx;margin-top: 20rpx;">
 			<u-input v-model="verifyCode" :custom-style="{fontSize:'40rpx'}" type="text" height="90" :maxlength='17' input-align="center" placeholder="请输入VIN" :border="true" />
 		</view>
@@ -66,7 +65,7 @@
 			// 不是手动输入
 			if(opts.type == 'carmen'){
 				// 游客需要记录扫描记录
-				if(this.userInfo.identifyType=='VISITOR' && this.verifyCode){
+				if(this.userInfo.sysUserFlag == '0' && this.verifyCode){
 					this.creatRecord(null)
 				}
 				// 如果识别返回空
@@ -90,7 +89,7 @@
 		methods: {
 			// 重新扫描
 			toScan(){
-				if(this.userInfo.identifyType=='VISITOR'){
+				if(this.userInfo.sysUserFlag == '0'){
 					if(this.vuex_vinScanNums < 10){
 						uni.redirectTo({
 							url: "/pages/scan-frame/scan-frame"
@@ -151,13 +150,13 @@
 			},
 			// 提交并匹配车型
 			submitForm(){
-				if(!this.hasShelf){
-					uni.showToast({
-						icon:'none',
-						title: '门店没有关联数字货架,无法使用此功能!'
-					})
-					return
-				}
+				// if(!this.hasShelf){
+				// 	uni.showToast({
+				// 		icon:'none',
+				// 		title: '门店没有关联数字货架,无法使用此功能!'
+				// 	})
+				// 	return
+				// }
 				const _this = this
 				const vinNo = this.verifyCode.toUpperCase()
 				if(vinNo.length>=17){
@@ -167,7 +166,7 @@
 					}).then(res => {
 						if (res.status == 200&&res.data) {
 							// 非游客,生成vin记录
-							if(_this.userInfo.identifyType=='EMPLOYEE'){
+							if(_this.userInfo.sysUserFlag == '1'){
 								_this.creatRecord(res.data)
 							}
 							// 打开选择配件页面

+ 8 - 7
store/index.js

@@ -62,22 +62,23 @@ const store = new Vuex.Store({
 	},
     mutations: {
         login(state, data) {
-			console.log(data)
+			console.log(data,'-----loginSucees-----')
             state.hasLogin = true;
-			uni.setStorageSync('token', data.access_token);
+			state.vuex_userInfo = data.auth_user
 			// VISITOR:游客,EMPLOYEE:雇员
-			data.auth_user['identifyType'] = 'VISITOR'
+			data.auth_user['identifyType'] = data.sysUserFlag == '0' ? 'VISITOR' : 'EMPLOYEE';
+			uni.setStorageSync('token', data.access_token);
 			uni.setStorageSync('userInfo', data.auth_user);
-			state.vuex_userInfo = data.auth_user
         },
         logout(state) {
+			console.log(state,'----logout------')
             state.hasLogin = false;
 			uni.removeStorageSync('token')
 			uni.removeStorageSync('userInfo')
 			state.vuex_userInfo = null
         },
 		openId(state,id) {
-			console.log(id,'----------')
+			console.log(id,'----openId------')
 			state.vuex_openid = id
 			uni.setStorageSync('openid', id);
 		},
@@ -158,13 +159,13 @@ const store = new Vuex.Store({
 		},
 		// 检测是否登录
 		checkLogin(context,callback){
-			console.log(callback)
+			console.log(callback,'--checkLogin--')
 			checkLogin().then(res => {
 				if(res.status == '200'){
 					context.commit('setHasLogin',true)
 					callback&&callback()
 				}else{
-					context.commit('logout')
+					// context.commit('logout')
 				}
 			})
 		},