lilei 9 tháng trước cách đây
mục cha
commit
57d92b05a4

+ 8 - 7
components/icon-items-list/icon-items-list.vue

@@ -15,6 +15,7 @@
 </template>
 
 <script>
+	import { toAuthStore } from "@/utils/index.js"
 	export default {
 		name: "iconItemsList",
 		props:{
@@ -58,14 +59,14 @@
 		methods: {
 			toPage(item,index){
 				if(this.isLogin){
-					// 游客去认证
-					if(this.sysUserFlag == '0'){
-						uni.navigateTo({
-							url: '/pages/storeManage/storeAuth'
-						})
-						return true
-					}
 					if(item.url&&item.url!=''){
+						if(!item.ignoreAuth){
+							// 游客去认证
+							if(this.sysUserFlag == '0'){
+								toAuthStore()
+								return true
+							}
+						}
 						if(item.target == 'page'){
 							uni.navigateTo({
 								url: item.url

+ 26 - 97
pages/index/index.vue

@@ -41,7 +41,7 @@
 					</view>
 					<!-- 去认证门店 -->
 					<view class="notices flex justify_between" v-if="hasLogin&&userInfo&&userInfo.sysUserFlag == '0'">
-						<view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> {{storeApply&&storeApply.auditStatus=='WAIT'?'认证门店审核中':'您还未认证门店'}}</view> <text class="text" @click="toAuthStore()">{{storeApply&&storeApply.auditStatus=='WAIT'?'查看':'去认证'}}</text>
+						<view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> {{storeApply&&storeApply.auditStatus=='WAIT'?'认证门店审核中':'您还未认证门店'}}</view> <text class="text" @click="authStore">{{storeApply&&storeApply.auditStatus=='WAIT'?'查看':'去认证'}}</text>
 					</view>
 					<!-- 名片 -->
 					<view class="userCard flex align_center justify_between" v-if="!hasShopiing">
@@ -182,7 +182,7 @@
 	import { getRewardRollList } from '@/api/rewardRule.js'
 	import { getShopStatus } from '@/api/cart.js'
 	import { getShopCategory, getShopProductList } from '@/api/shop.js'
-	import { openWebView } from "@/utils/index.js"
+	import { openWebView, clickTab, toAuthStore, clickBannerList } from "@/utils/index.js"
 	export default {
 		components: {
 			iconItemsList, // 图标网格
@@ -263,6 +263,7 @@
 					{
 						id:'n0',
 						auth: this.hasLogin,
+						ignoreAuth: false,
 						icon:'bianmachaxun',
 						name: '产品编码取货',
 						color:'#056cd9',
@@ -272,6 +273,7 @@
 					{
 						id:'n1',
 						auth: this.hasLogin,
+						ignoreAuth: false,
 						icon:'saoma',
 						name: '二维/条码取货',
 						color:'#f44336',
@@ -281,6 +283,7 @@
 					{
 						id:'n3',
 						auth: true,
+						ignoreAuth: true,
 						icon:'shipin1',
 						name: '视频教程',
 						color:'#03a9f4',
@@ -290,6 +293,7 @@
 					{
 						id:'n2',
 						auth: this.hasLogin,
+						ignoreAuth: true,
 						icon:'chaxunjilu',
 						name: 'VIN查询历史',
 						color:'#ff9800',
@@ -368,16 +372,16 @@
 			}
 		},
 		methods: {
-			// 去登陆
-			toLogin(){
+			// 去认证
+			authStore(){
 				uni.navigateTo({
-					url: '/pages/login/login'
+					url: '/pages/storeManage/storeAuth'
 				})
 			},
-			// 去认证
-			toAuthStore(){
+			// 去登陆
+			toLogin(){
 				uni.navigateTo({
-					url: '/pages/storeManage/storeAuth'
+					url: '/pages/login/login'
 				})
 			},
 			// 初始化页面
@@ -504,6 +508,7 @@
 							id: item.id,
 							categorySn: item.categorySn,
 							auth: true,
+							ignoreAuth: false,
 							name: item.categoryName,
 							icon: item.iconUrl,
 							url: '/pagesB/shopiing/shopProduct?clzId='+item.categorySn+'&clzName='+item.categoryName+"&shopCategoryCount="+item.shopCategoryCount+'&shopProductCount='+item.shopProductCount,
@@ -565,75 +570,23 @@
 					this.status = 'nomore'
 				})
 			},
-			// 扫描vin
+			// tab单击
 			beforeSwitch(index){
-				const row = this.$store.state.vuex_tabBarList[index]
-				if(row.text == '促销'){
-					uni.$emit('refashProm')
-				}
-				if(row.text == '购物车'){
-					if(!this.hasLogin){
-						this.toLogin()
-						return true
-					}
-					// 游客去认证
-					if(this.userInfo.sysUserFlag == '0'){
-						this.toAuthStore()
-						return true
-					}
-					// 打开购物车页面
-					uni.navigateTo({
-						url:'/pagesB/cart/index',
-						target: 'page'
-					})
-				}
-				// 打开vin扫码页面
-				if(row.text == '扫描VIN'){
-					this.openCamera()
-				}else{
-					return true
-				}
-			},
-			// 去扫VIN
-			openCamera(){
-				if(this.hasLogin){
-					// 游客身份
-					if(this.userInfo.sysUserFlag == '0'){
-						// 最多扫10次
-						if(this.vuex_vinScanNums < this.scanMaxNums){
-							uni.navigateTo({
-								url: "/pages/scan-frame/scan-frame"
-							})
-						}else{
-							uni.showModal({
-								title: '提示',
-								content: '个人用户扫描VIN仅限10次,您的次数已用完!',
-								confirmText: '好的',
-								showCancel: false,
-								success(res) {}
-							})
-						}
-					}else{
-						// 非游客,直接扫
-						uni.navigateTo({
-							url: "/pages/scan-frame/scan-frame"
-						})
-					}
-				}else{
-					this.toLogin()
-				}
+				const row = this.$store.state.vuex_tabBarList[index] // 当前tab
+				const isNoAuth = this.userInfo ? this.userInfo.sysUserFlag == '0' : false // 是否认证门店
+				return clickTab(row,this.hasLogin,isNoAuth,this.vuex_vinScanNums < this.vuex_scanMaxNums)
 			},
 			// 去搜索产品
 			toSearch(event){
 				if(this.hasLogin){
 					// 游客去认证
 					if(this.userInfo.sysUserFlag == '0'){
-						this.toAuthStore()
-						return true
+						toAuthStore()
+					}else{
+						uni.navigateTo({
+							url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
+						})
 					}
-					uni.navigateTo({
-						url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
-					})
 				}else{
 					this.toLogin()
 				}
@@ -666,7 +619,7 @@
 						}
 					}else{
 						// 去认证
-						this.toAuthStore()
+						toAuthStore()
 					}
 				}else{
 					this.toLogin()
@@ -898,31 +851,7 @@
 			},
 			// 单击banner
 			clickBanner(index){
-				const row = this.imgList[index]
-				// 红包
-				if(row.activeType == 'redPacket'){
-					uni.navigateTo({url:"/pages/morePage/redPacket"})
-				}
-				// 图文
-				if(row.contentType == 'IMAGE_CONTENT'){
-					uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoActiveSn})
-				}
-				// 视频
-				if(row.contentType == 'VIDEO'){
-					uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoActiveSn})
-				}
-				// 链接
-				if(row.contentType == 'LINK'){
-					// 货架促销活动
-					if(row.content.indexOf("pagesB/promoDetail") >= 0){
-						uni.navigateTo({
-							url: '/pagesB/promoProduct?promoActiveSn='+row.promoActiveSn+'&title='+row.title
-						 })
-					}else{
-						// 外网页面
-						openWebView({url:row.content})
-					}
-				}
+				clickBannerList(this.imgList[index])
 			},
 			// 查看扫描VIN记录
 			toAllRecord(){
@@ -944,7 +873,7 @@
 						})
 					}else{
 						// 或 门店认证
-						this.toAuthStore()
+						toAuthStore()
 					}
 				}else{
 					this.toLogin()
@@ -966,7 +895,7 @@
 		background-color: #ffffff;
 	}
 	.bg-0{
-		background-image: linear-gradient(#86defa 0%, #ffffff 15%);
+		background-image: linear-gradient(#86defa 0%, #ffffff 30%);
 	}
 	.bg-1{
 		background-image: linear-gradient(#86defa 0%,#cdeff9 20%,#f8f8f8 30%);

+ 4 - 55
pages/morePage/morePage.vue

@@ -107,6 +107,7 @@
 	import { queryQplsConfig,getProductfindByScanCode } from '@/api/shelf.js'
 	import { findUserReward } from '@/api/rewardRule.js'
 	import { ticketQueryCount } from '@/api/user.js'
+	import { clickTab } from "@/utils/index.js"
 	export default {
 		components: {
 			UniStatusBar // 状态栏组件
@@ -380,33 +381,9 @@
 			},
 			// tab单击
 			beforeSwitch(index){
-				const row = this.$store.state.vuex_tabBarList[index]
-				if(row.text == '促销'){
-					uni.$emit('refashProm')
-				}
-				if(row.text == '购物车'){
-					if(!this.hasLogin){
-						uni.navigateTo({
-							url: '/pages/login/login'
-						})
-						return true
-					}
-					if(this.userInfo.sysUserFlag == '0'){
-						uni.navigateTo({
-							url: '/pages/storeManage/storeAuth'
-						})
-						return true
-					}
-					uni.navigateTo({
-						url:'/pagesB/cart/index',
-						target: 'page'
-					})
-				}
-				if(row.text == '扫描VIN'){
-					this.openCamera()
-				}else{
-					return true
-				}
+				const row = this.$store.state.vuex_tabBarList[index] // 当前tab
+				const isNoAuth = this.userInfo ? this.userInfo.sysUserFlag == '0' : false // 是否认证门店
+				return clickTab(row,this.hasLogin,isNoAuth,this.vuex_vinScanNums < this.vuex_scanMaxNums)
 			},
 			// 网格打开页面
 			openPage(e,child){
@@ -423,34 +400,6 @@
 					this.showPriceSet = ret.filter(item => !!item).length > 0
 				})
 			},
-			// 去扫描
-			openCamera(){
-				if(this.hasLogin){
-					if(this.userInfo.sysUserFlag == '0'){
-						if(this.vuex_vinScanNums < this.vuex_scanMaxNums){
-							uni.navigateTo({
-								url: "/pages/scan-frame/scan-frame"
-							})
-						}else{
-							uni.showModal({
-								title: '提示',
-								content: '个人用户扫描VIN仅限10次,您的次数已用完!',
-								confirmText: '好的',
-								showCancel: false,
-								success(res) {}
-							})
-						}
-					}else{
-						uni.navigateTo({
-							url: "/pages/scan-frame/scan-frame"
-						})
-					}
-				}else{
-					uni.navigateTo({
-						url: '/pages/login/login'
-					})
-				}
-			},
 			// 取货
 			openTakeGood(index){
 				// 已有数字货架

+ 5 - 56
pages/promo/index.vue

@@ -31,6 +31,7 @@
 	    mapMutations,
 	} from 'vuex'
 	import { promoTerminalListByPage } from '@/api/video.js'
+	import { clickTab } from "@/utils/index.js"
 	export default {
 		data() {
 			return {
@@ -114,63 +115,11 @@
 				 	url: '/pagesB/promoProduct?promoActiveSn='+item.promoActiveSn+'&title='+item.title
 				 })
 			},
-			// 扫描vin
+			// tab单击
 			beforeSwitch(index){
-				const row = this.$store.state.vuex_tabBarList[index]
-				if(row.text == '促销'){
-					uni.$emit('refashProm')
-				}
-				if(row.text == '购物车'){
-					if(!this.hasLogin){
-						uni.navigateTo({
-							url: '/pages/login/login'
-						})
-						return true
-					}
-					if(this.userInfo.sysUserFlag == '0'){
-						uni.navigateTo({
-							url: '/pages/storeManage/storeAuth'
-						})
-						return true
-					}
-					uni.navigateTo({
-						url:'/pagesB/cart/index',
-						target: 'page'
-					})
-				}
-				if(row.text == '扫描VIN'){
-					this.openCamera()
-				}else{
-					return true
-				}
-			},
-			// 去扫描
-			openCamera(){
-				if(this.hasLogin){
-					if(this.userInfo.sysUserFlag == '0'){
-						if(this.vuex_vinScanNums < this.vuex_scanMaxNums){
-							uni.navigateTo({
-								url: "/pages/scan-frame/scan-frame"
-							})
-						}else{
-							uni.showModal({
-								title: '提示',
-								content: '个人用户扫描VIN仅限10次,您的次数已用完!',
-								confirmText: '好的',
-								showCancel: false,
-								success(res) {}
-							})
-						}
-					}else{
-						uni.navigateTo({
-							url: "/pages/scan-frame/scan-frame"
-						})
-					}
-				}else{
-					uni.navigateTo({
-						url: '/pages/login/login'
-					})
-				}
+				const row = this.$store.state.vuex_tabBarList[index] // 当前tab
+				const isNoAuth = this.userInfo ? this.userInfo.sysUserFlag == '0' : false // 是否认证门店
+				return clickTab(row,this.hasLogin,isNoAuth,this.vuex_vinScanNums < this.vuex_scanMaxNums)
 			},
 		}
 	}

+ 1 - 0
pagesB/cart/productitem.vue

@@ -24,6 +24,7 @@
 					</view>
 					<view class="choose-product-item-left-info-price">
 						<view class="price-txt" v-if="item.status==1">¥<text>{{item.price}}</text></view>
+						<view class="price-txt" v-else></view>
 						<view>
 							<view v-if="item.status==1&&item.dealerScopeFlag==1" :style="{opacity:!item.edit?1:0,width:!item.edit?'auto':0}">
 								<view class="flex align_center qty-box">

+ 110 - 3
utils/index.js

@@ -1,8 +1,9 @@
+// 格式化数字
 function formatNumber(n) {
   const str = n.toString();
   return str[1] ? str : `0${str}`;
 }
-
+// object转url参数
 export function objToUrl(obj) {
   let uri = '';
   let keys = Object.keys(obj);
@@ -14,7 +15,7 @@ export function objToUrl(obj) {
 
   return uri;
 }
-
+// 格式化和日期
 export function formatTime(date) {
   date = new Date(date.substr(0, 19));
   let year1 = date.getFullYear();
@@ -59,7 +60,6 @@ export function openLocation(item) {
 }
 // 评分
 export function getStarNum(level) {
-  console.log(level,'level')
   if(level){
 	  const star = level.toString();
 	  return star.indexOf('.') > -1 ? star : star + '.0';
@@ -80,4 +80,111 @@ export function openWebView(item){
 			})
 		}
 	}
+}
+// 去登陆页面
+export function toLogin(){
+	uni.navigateTo({
+		url: '/pages/login/login'
+	})
+}
+// 去认证页面
+export function toAuthStore(){
+	uni.showModal({
+		title: '提示',
+		content: '您还未认证门店,暂无法继续使用!',
+		confirmText: '去认证',
+		success(ret) {
+			if(ret.confirm){
+				uni.navigateTo({
+					url: '/pages/storeManage/storeAuth'
+				})
+			}
+		}
+	})
+}
+// vin 扫码
+export function openCamera(hasLogin,sysUserFlag,maxNums){
+	if(hasLogin){
+		// 游客身份
+		if(sysUserFlag){
+			// 最多扫10次
+			if(maxNums){
+				uni.navigateTo({
+					url: "/pages/scan-frame/scan-frame"
+				})
+			}else{
+				uni.showModal({
+					title: '提示',
+					content: '个人用户扫描VIN仅限10次,您的次数已用完!',
+					confirmText: '好的',
+					showCancel: false,
+					success(res) {}
+				})
+			}
+		}else{
+			// 非游客,直接扫
+			uni.navigateTo({
+				url: "/pages/scan-frame/scan-frame"
+			})
+		}
+	}else{
+		toLogin()
+	}
+}
+// 单击底部tab
+export function clickTab(row,hasLogin,isNoAuth,isMax){
+	// 点击促销刷新列表
+	if(row.text == '促销'){
+		uni.$emit('refashProm')
+	}
+	// 点击购物车
+	if(row.text == '购物车'){
+		if(!hasLogin){
+			toLogin()
+			return true
+		}
+		// 游客去认证
+		if(isNoAuth){
+			toAuthStore()
+			return true
+		}
+		// 打开购物车页面
+		uni.navigateTo({
+			url:'/pagesB/cart/index',
+			target: 'page'
+		})
+	}
+	// 打开vin扫码页面
+	if(row.text == '扫描VIN'){
+		openCamera(hasLogin,isNoAuth,isMax)
+	}else{
+		return true
+	}
+}
+// 单击banner
+export function clickBannerList(row){
+	 // 红包
+	 if(row.activeType == 'redPacket'){
+	 	uni.navigateTo({url:"/pages/morePage/redPacket"})
+	 }
+	 // 图文
+	 if(row.contentType == 'IMAGE_CONTENT'){
+	 	uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoActiveSn})
+	 }
+	 // 视频
+	 if(row.contentType == 'VIDEO'){
+	 	uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoActiveSn})
+	 }
+	 // 链接
+	 if(row.contentType == 'LINK'){
+	 	// 货架促销活动
+	 	if(row.content.indexOf("pagesB/promoDetail") >= 0){
+	 		uni.navigateTo({
+	 			url: '/pagesB/promoProduct?promoActiveSn='+row.promoActiveSn+'&title='+row.title
+	 		 })
+	 	}else{
+	 		// 外网页面
+	 		openWebView({url:row.content})
+	 	}
+	 }
 }