lilei 9 月之前
父节点
当前提交
e56cd2e617

+ 184 - 184
pages/index/index.vue

@@ -187,7 +187,6 @@
 				status: 'loading',
 				noDataText: '暂无数据',
 				hasShopiing: true, // 是否开通商城
-				showPopup: false, // 去认证弹框
 				bondRecord: null, // 保证金
 				list:[], // 扫描记录滚动
 				slist:[], // 红包滚动
@@ -360,6 +359,18 @@
 			}
 		},
 		methods: {
+			// 去登陆
+			toLogin(){
+				uni.navigateTo({
+					url: '/pages/login/login'
+				})
+			},
+			// 去认证
+			toAuthStore(){
+				uni.navigateTo({
+					url: '/pages/storeManage/storeAuth'
+				})
+			},
 			// 初始化页面
 			pageInit(flag){
 				this.carouselList = []
@@ -402,6 +413,8 @@
 						this.$store.state.vuex_storeShelf = res.data;
 						// 有数字货架
 						if(res.data){
+							// 获取轮播数据,包括促销活动
+							this.getCarousel()
 							// 查询是否有商城
 							this.getHasShopping(flag)
 							// 只需加载一次
@@ -417,14 +430,31 @@
 							}
 							// 获取价格权限配置
 							this.getPriceCofig()
-							// 获取轮播数据,包括促销活动
-							this.getCarousel()
 						}else{
 							// 没有数字货架,隐藏促销模块
 							this.hidePromoTab()
 						}
 				})
 			},
+			// 最新用户信息
+			getCurrUserInfo(){
+				getCurrUserInfo().then(res => {
+					if(res.data){
+						this.$store.state.vuex_userInfo.userNameCN = res.data.name;
+						this.$store.state.vuex_userInfo.mobile = res.data.mobile;
+						this.$store.state.vuex_userInfo.adminId = res.data.id;
+						this.$store.state.vuex_userPhoto = res.data.photo;
+						uni.setStorageSync('userPhoto', res.data.photo);
+					}
+				})
+			},
+			// 获取价格配置
+			getPriceCofig(){
+				const data = this.$store.state.vuex_storeShelf
+				queryQplsConfig({shelfSn: data.shelfSn}).then(res => {
+					this.$store.state.vuex_configPrice = res.data || null
+				})
+			},
 			// 商城信息, flag: true 再次刷新,false 只加载一次
 			getHasShopping(flag){
 				getShopStatus().then(res => {
@@ -452,6 +482,78 @@
 					this.getRedPacketRule()
 				})
 			},
+			// 商品一级分类
+			getGoodType(){
+				this.productTypeList = []
+				getShopCategory({categoryLevel: 1, status: 1}).then(res => {
+					const list = res.data || []
+					const ret = []
+					list.forEach(item => {
+						ret.push({
+							id: item.id,
+							categorySn: item.categorySn,
+							auth: true,
+							name: item.categoryName,
+							icon: item.iconUrl,
+							url: '/pagesB/shopiing/searchProduct?clzId='+item.categorySn+'&clzName='+item.categoryName,
+							target: 'page'
+						})
+					})
+					// 转成二维数组
+					for(let i=0;i<ret.length;i=i+8){
+						this.productTypeList.push({
+							id: 'swiper-item-'+i,
+							list: ret.slice(i,(i+8)>ret.length?ret.length:(i+8))
+						})
+					}
+				})
+			},
+			// 商品列表查询
+			getHotProductList(){
+				this.productList = []
+				this.hotProductPageNo = 1
+				this.getProductList()
+			},
+			getProductList(){
+				this.status = "loading"
+				const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_storeShelf.dealerSn : ''
+				// 获取推荐产品	
+				 getShopProductList({pageNo:this.hotProductPageNo,pageSize:10,hotFlag:1, status: 1, dealerSn: dealerSn}).then(res => {
+					 if(res.status == 200){
+						 const list = res.data ? res.data.list : []
+						 this.productList.push(list)
+						 this.status = res.data.count>=this.list.length ? "nomore" : 'loadmore'
+						 // 判断是否最后一页
+						 const maxPages = Math.ceil(res.data.count / 10)
+						 this.totalhotPage = maxPages
+						 this.status = this.hotProductPageNo >= maxPages ? "nomore" : 'loadmore'
+						 this.noDataText = this.status == 'nomore' ? '没有更多了' : '更多商品'
+					 }else{
+						 this.status = "nomore"
+						 this.noDataText = res.message || '没有更多了'
+					 }
+				 })
+			},
+			// 获取上方滚动扫描记录
+			getScrollLog(){
+				scanVinLogQueryRoll({pageNo:1,pageSize:50}).then(res => {
+					this.list = res.data.list || []
+					this.list.map(item => {
+						item.placeText = item.userName + '刚刚扫描了一个VIN'
+					})
+				})
+			},
+			// 获取当前门店扫描记录
+			getVinLog(){
+				this.vinList  = []
+				this.status = "loading"
+				// VISITOR:游客,EMPLOYEE:雇员
+				getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
+					this.vinList = res.data&&res.data.list || []
+					this.vinList = this.vinList.filter(item => item.vinCode)
+					this.status = 'nomore'
+				})
+			},
 			// 扫描vin
 			beforeSwitch(index){
 				const row = this.$store.state.vuex_tabBarList[index]
@@ -460,35 +562,63 @@
 				}
 				if(row.text == '购物车'){
 					if(!this.hasLogin){
-						uni.navigateTo({
-							url: '/pages/login/login'
-						})
+						this.toLogin()
 						return true
 					}
+					// 游客去认证
 					if(this.userInfo.sysUserFlag == '0'){
-						uni.navigateTo({
-							url: '/pages/storeManage/storeAuth'
-						})
+						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()
+				}
+			},
 			// 去搜索产品
 			toSearch(event){
 				uni.navigateTo({
 					url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
 				})
 			},
-			// 轮播图片
+			// 促销活动的轮播图片
 			getCarousel(){
 				this.carouselList = []
 				// 获取所有促销活动数据
@@ -497,9 +627,6 @@
 						res.data&&res.data.map(item => {
 							item.image = item.imageSet&&item.imageSet[0] // 默认取第一张图片
 						})
-						// 过滤掉产品促销活动
-						// this.carouselList = res.data.filter(item => item.content.indexOf("pages/promo/index") < 0)
-						// 所有数据
 						this.carouselList = res.data
 					}
 				})
@@ -518,23 +645,11 @@
 							this.openTakeGood(0)
 						}
 					}else{
-						uni.showModal({
-							title: '提示',
-							content: '你还未申请认证门店,暂无法使用此功能',
-							confirmText: '去认证',
-							success(res) {
-								if(res.confirm){
-									uni.navigateTo({
-										url: '/pages/storeManage/storeAuth'
-									})
-								}
-							}
-						})
+						// 去认证
+						this.toAuthStore()
 					}
 				}else{
-					uni.navigateTo({
-						url: '/pages/login/login'
-					})
+					this.toLogin()
 				}
 			},
 			//  获取数据字典
@@ -554,25 +669,6 @@
 					}
 				});
 			},
-			// 获取价格配置
-			getPriceCofig(){
-				const data = this.$store.state.vuex_storeShelf
-				queryQplsConfig({shelfSn: data.shelfSn}).then(res => {
-					this.$store.state.vuex_configPrice = res.data || null
-				})
-			},
-			// 最新用户信息
-			getCurrUserInfo(){
-				getCurrUserInfo().then(res => {
-					if(res.data){
-						this.$store.state.vuex_userInfo.userNameCN = res.data.name;
-						this.$store.state.vuex_userInfo.mobile = res.data.mobile;
-						this.$store.state.vuex_userInfo.adminId = res.data.id;
-						this.$store.state.vuex_userPhoto = res.data.photo;
-						uni.setStorageSync('userPhoto', res.data.photo);
-					}
-				})
-			},
 			// 获取最大扫描数
 			getMaxQty(){
 				getScanGetMaxQty().then(res => {
@@ -618,78 +714,6 @@
 					})
 				}
 			},
-			// 获取上方滚动扫描记录
-			getScrollLog(){
-				scanVinLogQueryRoll({pageNo:1,pageSize:50}).then(res => {
-					this.list = res.data.list || []
-					this.list.map(item => {
-						item.placeText = item.userName + '刚刚扫描了一个VIN'
-					})
-				})
-			},
-			// 获取当前门店扫描记录
-			getVinLog(){
-				this.vinList  = []
-				this.status = "loading"
-				// VISITOR:游客,EMPLOYEE:雇员
-				getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
-					this.vinList = res.data&&res.data.list || []
-					this.vinList = this.vinList.filter(item => item.vinCode)
-					this.status = 'nomore'
-				})
-			},
-			// 商品一级分类
-			getGoodType(){
-				this.productTypeList = []
-				getShopCategory({categoryLevel: 1, status: 1}).then(res => {
-					const list = res.data || []
-					const ret = []
-					list.forEach(item => {
-						ret.push({
-							id: item.id,
-							categorySn: item.categorySn,
-							auth: true,
-							name: item.categoryName,
-							icon: item.iconUrl,
-							url: '/pagesB/shopiing/searchProduct?clzId='+item.categorySn+'&clzName='+item.categoryName,
-							target: 'page'
-						})
-					})
-					// 转成二维数组
-					for(let i=0;i<ret.length;i=i+8){
-						this.productTypeList.push({
-							id: 'swiper-item-'+i,
-							list: ret.slice(i,(i+8)>ret.length?ret.length:(i+8))
-						})
-					}
-				})
-			},
-			// 商品列表查询
-			getHotProductList(){
-				this.productList = []
-				this.hotProductPageNo = 1
-				this.getProductList()
-			},
-			getProductList(){
-				this.status = "loading"
-				const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_storeShelf.dealerSn : ''
-				// 获取推荐产品	
-				 getShopProductList({pageNo:this.hotProductPageNo,pageSize:10,hotFlag:1, status: 1, dealerSn: dealerSn}).then(res => {
-					 if(res.status == 200){
-						 const list = res.data ? res.data.list : []
-						 this.productList.push(list)
-						 this.status = res.data.count>=this.list.length ? "nomore" : 'loadmore'
-						 // 判断是否最后一页
-						 const maxPages = Math.ceil(res.data.count / 10)
-						 this.totalhotPage = maxPages
-						 this.status = this.hotProductPageNo >= maxPages ? "nomore" : 'loadmore'
-						 this.noDataText = this.status == 'nomore' ? '没有更多了' : '更多商品'
-					 }else{
-						 this.status = "nomore"
-						 this.noDataText = res.message || '没有更多了'
-					 }
-				 })
-			},
 			// 显示购物车tab
 			showCatTab(){
 				const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
@@ -794,33 +818,6 @@
 					})
 				}
 			},
-			// 单击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})
-					}
-				}
-			},
 			// 选择取货方式
 			clickAction(index){
 				const shelfSn = this.hasShelf.shelfSn
@@ -829,7 +826,6 @@
 				if(index == 0){
 					uni.scanCode({
 						success: function (ret) {
-							console.log(ret);
 							const params = {
 								codeType: ret.scanType == 'QR_CODE' ? 0 : 1
 							}
@@ -880,54 +876,58 @@
 					})
 				}
 			},
-			// 去扫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{
-						// 非游客,直接扫
+			// 单击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: "/pages/scan-frame/scan-frame"
-						})
+							url: '/pagesB/promoProduct?promoActiveSn='+row.promoActiveSn+'&title='+row.title
+						 })
+					}else{
+						// 外网页面
+						openWebView({url:row.content})
 					}
-				}else{
-					uni.navigateTo({
-						url: '/pages/login/login'
-					})
 				}
 			},
 			// 查看扫描VIN记录
 			toAllRecord(){
-				uni.navigateTo({
-					url: this.hasLogin ? "/pagesA/vinRecord/vinRecord" : '/pages/login/login'
-				})
+				if(this.hasLogin){
+					uni.navigateTo({
+						url: "/pagesA/vinRecord/vinRecord"
+					})
+				}else{
+					this.toLogin()
+				}
 			},
 			// 查看用户信息
 			toUser(){
 				if(this.hasLogin){
-					// 用户详细信息 或 门店认证
-					uni.navigateTo({
-						url: this.userInfo.sysUserFlag == '1' ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
-					})
+					if(this.userInfo.sysUserFlag == '1'){
+						// 用户详细信息
+						uni.navigateTo({
+							url: '/pages/personData/personData'
+						})
+					}else{
+						// 或 门店认证
+						this.toAuthStore()
+					}
 				}else{
-					uni.navigateTo({
-						url: '/pages/login/login'
-					})
+					this.toLogin()
 				}
 			},
 			// 选择配件

+ 1 - 1
pages/index/productItem.vue

@@ -8,7 +8,7 @@
 		v-for="(item,index) in list"
 	    :key="item.id" @click="toDetail(item)">
 			<view>
-				<image mode="aspectFit" :src="item.productMsg+'?x-oss-process=image/resize,p_30'" style="height: 140px;width: 100%;"></image>
+				<image mode="aspectFit" :src="item.productMsg ? item.productMsg+'?x-oss-process=image/resize,p_30':'/static/def_imgs.png'" style="height: 140px;width: 100%;"></image>
 				<view class="back-price" v-if="item.dealerScopeFlag==0">售罄</view>
 				<view class="product-code"><text class="ellipsis-one" overflow="ellipsis">{{item.productCode}}</text></view>
 			</view>

+ 1 - 1
pagesB/cart/productitem.vue

@@ -10,7 +10,7 @@
 			</view>
 			 <view>
 				 <view class="choose-product-item-img">
-					<image mode="aspectFit" :src="item.productImage+'?x-oss-process=image/resize,p_30'" style="width: 100%;height: 180rpx;"></image>
+					<image mode="aspectFit" :src="item.productImage?item.productImage+'?x-oss-process=image/resize,p_30':'/static/def_imgs.png'" style="width: 100%;height: 180rpx;"></image>
 					<view class="back-price xiajia" v-if="item.status==0">下架</view>
 					<view class="back-price xiajia" v-else-if="item.dealerScopeFlag==0">售罄</view>
 					<view class="choose-product-item-left-info-code">

+ 7 - 2
pagesB/components/chooseProductItemSkline.vue

@@ -7,7 +7,7 @@
 		>
 			 <view style="flex-grow: 1;">
 				 <view class="choose-product-item-img">
-					<image mode="aspectFit" :src="item.productImage+'?x-oss-process=image/resize,p_30'" style="width: 100%;height: 100%;"></image>
+					<image mode="aspectFit" :src="item.productImage ? item.productImage+'?x-oss-process=image/resize,p_30':'/static/def_imgs.png'" style="width: 100%;height: 100%;"></image>
 					<view class="back-price fantext" v-if="item.promoRuleValue&&!isView">返<text>{{item.promoRuleValue}}</text>元</view>
 					<view class="back-price xiajia" v-if="isView&&item.status==0">下架</view>
 					<view class="back-price xiajia" v-else-if="isView&&item.dealerScopeFlag==0">售罄</view>
@@ -19,7 +19,8 @@
 						<text class="ellipsis-two" max-lines="2" overflow="ellipsis">{{item.productOrigCode}}</text>
 					</view>
 					<view class="choose-product-item-left-info-price">
-						<view class="price-txt">¥<text>{{isView ? item.price : item.cost}}</text></view>
+						<view class="price-txt" v-if="isLogin">¥<text>{{isView ? item.price : item.cost}}</text></view>
+						<view class="price-txt" v-else>¥<text>***</text></view>
 						<view v-if="!isView">
 							<view :style="{opacity:!edit?1:0,width:!edit?'auto':0}">
 								<uni-number-box v-model="item.qty" :min="1" :max="999999" @change="v=>{changeQty(v,item.id)}"></uni-number-box>
@@ -58,6 +59,10 @@
 			isView: {
 				type: Boolean,
 				default: false
+			},
+			isLogin:{
+				type: Boolean,
+				default: false
 			}
 		},
 		data() {

+ 3 - 2
pagesB/shopiing/productDetail.vue

@@ -90,7 +90,7 @@
 					<view class="popu-content-info">
 						<view class="popu-content-info-title">{{detail.productName}}</view>
 						<view class="popu-content-box">
-							<view class="popu-content-price">¥<text class="price-red">{{detail.price}}</text></view>
+							<view class="popu-content-price">¥<text class="price-red">{{hasLogin?detail.price:'***'}}</text></view>
 							<view class="popu-content-num flex align_center">
 								<text style="margin-right: 10px;">数量</text>
 								<uni-number-box v-model="qty" :min="1" :max="999999"></uni-number-box>
@@ -148,7 +148,8 @@
 			this.getDetail()
 		},
 		onShow(){
-			if(this.hasLogin){
+			// 已登录,且已认证
+			if(this.hasLogin&&this.userInfo.sysUserFlag == '1'){
 				// 购物车数量
 				this.cartCount()
 			}

+ 1 - 0
pagesB/shopiing/searchProduct.vue

@@ -44,6 +44,7 @@
 					:index="index"
 					:list="item" 
 					:isView="true"
+					:isLogin="hasLogin"
 					@toDetail="viewDetail"
 					>
 					</chooseProductItem>