lilei hai 9 meses
pai
achega
b2edfbf53c

+ 1 - 1
api/shop.js

@@ -39,7 +39,7 @@ export function getShopCategoryDetail(params) {
 // 获取商品分类扩展
 export function getShopCategoryExt(params) {
   return request({
-    url: `shopCategory/queryExtBySn/${params.categorySn}`,
+    url: `shopCategory/queryExtBySn`,
     method: 'post',
     data: params
   },true)

+ 23 - 13
components/icon-items-list/icon-items-list.vue

@@ -40,6 +40,10 @@
 			noDataText: {
 				type: String,
 				default: '暂无数据'
+			},
+			isLogin: {
+				type: Boolean,
+				default: false
 			}
 		},
 		data() {
@@ -49,20 +53,26 @@
 		},
 		methods: {
 			toPage(item,index){
-				if(item.url&&item.url!=''){
-					if(item.target == 'page'){
-						uni.navigateTo({
-							url: item.url
-						})
-					}
-					if(item.target == 'tabPage'){
-						uni.switchTab({
-							url: item.url
-						})
-					}
-					if(item.target == 'fun'){
-						this.$emit('callback',item)
+				if(this.isLogin){
+					if(item.url&&item.url!=''){
+						if(item.target == 'page'){
+							uni.navigateTo({
+								url: item.url
+							})
+						}
+						if(item.target == 'tabPage'){
+							uni.switchTab({
+								url: item.url
+							})
+						}
+						if(item.target == 'fun'){
+							this.$emit('callback',item)
+						}
 					}
+				}else{
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
 				}
 			}
 		}

+ 41 - 0
components/uni-authStore-popup.vue

@@ -0,0 +1,41 @@
+<template>
+	<!-- 去认证弹框 -->
+	<u-popup v-model="showPopup" mode="center" :border-radius="20" closeable @close="close">
+		<view style="background-color: #fff;padding: 1rem;">
+			<u-image width="533" height="415" src="/static/authimg.jpg"></u-image>
+			<view style="padding-top:1rem;" class="flex justify_center">
+				<u-button @click="toAuthStore()" shape="circle" :custom-style="{background:'#066cff',color:'#fff',width:'350rpx'}">开始认证</u-button>
+			</view>
+		</view>
+	</u-popup>
+</template>
+
+<script>
+	export default {
+		name:"uni-authStore-popup",
+		data() {
+			return {
+				showPopup: false
+			};
+		},
+		methods: {
+			close(){
+				this.showPopup = false
+			},
+			open(){
+				this.showPopup = true
+			},
+			// 去认证
+			toAuthStore(){
+				this.close()
+				uni.navigateTo({
+					url: '/pages/storeManage/storeAuth'
+				})
+			},
+		},
+	}
+</script>
+
+<style>
+
+</style>

+ 11 - 3
pages.json

@@ -480,9 +480,17 @@
 				"navigationBarTitleText" : "商品搜索",
 				"navigationStyle": "custom",
 				"disableScroll": true,
-				"app-plus":{
-					"bounce":"none"
-				},
+				"renderer":"skyline",
+				"componentFramework": "glass-easel"
+			}
+		},
+		{
+			"path" : "shopiing/shopProduct",
+			"style" : 
+			{
+				"navigationBarTitleText" : "商城商品",
+				"navigationStyle": "custom",
+				"disableScroll": true,
 				"renderer":"skyline",
 				"componentFramework": "glass-easel"
 			}

+ 23 - 16
pages/index/index.vue

@@ -15,7 +15,7 @@
 				<UniStatusBar></UniStatusBar>
 				<view class="title flex align_center" :style="{height:(navHeight+'px')}">
 					<view class="search-head" @click="toSearch">
-						<uni-search-bar readonly radius="100" placeholder="请输入商品名称/产品编码/原厂编码" clearButton="auto" cancelButton="none"/>
+						<uni-search-bar readonly radius="100" bg-color="#fff" placeholder="请输入商品名称/产品编码/原厂编码" clearButton="auto" cancelButton="none"/>
 					</view>
 				</view>
 			</view>
@@ -68,7 +68,7 @@
 					</view>
 					<!-- 搜索 -->
 					<view class="search-head" v-if="hasShopiing" @click="toSearch">
-						<uni-search-bar readonly radius="100" placeholder="请输入商品名称/产品编码/原厂编码" clearButton="auto" cancelButton="none"/>
+						<uni-search-bar readonly radius="100" bg-color="#fff" placeholder="请输入商品名称/产品编码/原厂编码" clearButton="auto" cancelButton="none"/>
 					</view>
 				</view>
 				<view :class="hasShopiing?'body-box1':'body-box'">	
@@ -89,13 +89,13 @@
 					</view>
 					<!-- 快捷导航 -->
 					<view class="quick-nav pa-box" v-if="hasShopiing&&navList.length">
-						<iconItemsList :list="navList" :iconSize="45" @callback="onNavFun"></iconItemsList>
+						<iconItemsList :list="navList" :isLogin="true" :iconSize="45" @callback="onNavFun"></iconItemsList>
 					</view>
 					<!-- 产品分类 -->
 					<view class="ptype-nav pa-box" v-if="hasShopiing&&productTypeList.length">
-						<swiper class="swiper" :style="{height:navHeight==44?'170px':'150px'}" @change="e=>{currentPtypeDot=e.detail.current}">
+						<swiper class="swiper" :style="{height:navHeight==44?'160px':'160px'}" @change="e=>{currentPtypeDot=e.detail.current}">
 							<swiper-item v-for="(item, idx) in productTypeList" :index="idx" :key="item.id">
-								<iconItemsList :list="item.list" type="img"></iconItemsList>
+								<iconItemsList :isLogin="hasLogin" :list="item.list" type="img"></iconItemsList>
 							</swiper-item>
 						</swiper>
 						<view class="indicator-dots" v-if="productTypeList.length>1">
@@ -104,7 +104,11 @@
 					</view>
 					<!-- 产品列表 -->
 					<view class="product-box" v-if="hasShopiing && totalhotPage>0">
-						<u-divider bg-color="" color="#666" :fontSize="28">热门推荐</u-divider>
+						<u-divider bg-color="" color="#666" use-slot :fontSize="28">
+							<image style="width: 16px;height:16px;" src="../../static/hot.png"></image> 
+							<text style="margin: 0 5px;font-weight: bold;">热门推荐</text>
+							<image style="width: 16px;height:16px;" src="../../static/hot.png"></image>
+						</u-divider>
 						<view class="product-list">
 							<!-- 产品列表 -->
 							<productItem
@@ -265,7 +269,7 @@
 						auth: this.hasLogin,
 						icon:'saoma',
 						name: '二维/条码取货',
-						color:'#ffaa7f',
+						color:'#f44336',
 						url:'openTakeGood0',
 						target: 'fun'
 					},
@@ -274,7 +278,7 @@
 						auth: true,
 						icon:'shipin1',
 						name: '视频教程',
-						color:'#55aaff',
+						color:'#03a9f4',
 						url:'/pagesB/videos/index',
 						target: 'page'
 					},
@@ -283,7 +287,7 @@
 						auth: this.hasLogin,
 						icon:'chaxunjilu',
 						name: 'VIN查询历史',
-						color:'#97d695',
+						color:'#ff9800',
 						url:'/pagesA/vinRecord/vinRecord',
 						target: this.hasLogin ? 'page' : 'fun'
 					}
@@ -495,7 +499,7 @@
 							auth: true,
 							name: item.categoryName,
 							icon: item.iconUrl,
-							url: '/pagesB/shopiing/searchProduct?clzId='+item.categorySn+'&clzName='+item.categoryName,
+							url: '/pagesB/shopiing/shopProduct?clzId='+item.categorySn+'&clzName='+item.categoryName,
 							target: 'page'
 						})
 					})
@@ -518,7 +522,7 @@
 				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 => {
+				 getShopProductList({pageNo:this.hotProductPageNo,pageSize:10,hotFlag:1, status: 1,categoryStatus : 1, dealerSn: dealerSn}).then(res => {
 					 if(res.status == 200){
 						 const list = res.data ? res.data.list : []
 						 this.productList.push(list)
@@ -614,9 +618,13 @@
 			},
 			// 去搜索产品
 			toSearch(event){
-				uni.navigateTo({
-					url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
-				})
+				if(this.hasLogin){
+					uni.navigateTo({
+						url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
+					})
+				}else{
+					this.toLogin()
+				}
 			},
 			// 促销活动的轮播图片
 			getCarousel(){
@@ -1009,8 +1017,7 @@
 				border-radius: 6px;
 				margin: 10px 0;
 				padding: 10px 0;
-				box-shadow: 1px 1px 3px #eee;
-				border: 1px solid #f8f8f8;
+				border: 1px solid #eee;
 			}
 			.product-box{
 				margin: 10px 0;

+ 1 - 1
pages/index/productItem.vue

@@ -94,7 +94,7 @@
 .product-item{
 	background: #ffffff;
 	border-radius: 10upx;
-	box-shadow: 1px 1px 3px #EEEEEE;
+	border: 1px solid #eee;
 	width: 48%;
 	margin: 10px 0 0 0;
 	display: flex;

+ 2 - 1
pagesB/cart/index.vue

@@ -18,6 +18,7 @@
 				scroll-y 
 				class="cart-list" 
 				type="custom" 
+				:bounces="false"
 				@scrolltolower="onreachBottom">
 					<sticky-header>
 						 <!-- 头部 -->
@@ -454,7 +455,7 @@
 								title: '提示',
 								content: (removeList.length ? `产品${removeList.join(',')}已下架,`:'')+(selloutList.length?`产品${selloutList.join(',')}已售罄,`:'')+`不可采购。`+(successList.length?'是否继续采购其他产品?':''),
 								showCancel: successList.length,
-								confirmText: successList.length?'确定':'知道了',
+								confirmText: successList.length?'确定':'知道了',
 								success(ret) {
 									if(ret.confirm && successList.length){
 										_this.submitForm(successList,delSn)

+ 24 - 12
pagesB/shopiing/productDetail.vue

@@ -6,7 +6,7 @@
 			<view class="header-title">
 				<view class="header-left" @click="goBack">
 					<image style="width: 16px; height: 16px;margin-right:3px;" mode="aspectFit" src="../static/arrow-left.png"></image>
-					<text>返回</text>
+					<text>{{isShare?'首页':'返回'}}</text>
 				</view>
 				<view class="header-right"></view>
 			</view>
@@ -15,11 +15,11 @@
 		<view class="scrollPage-content">
 			<view class="product-info" v-if="detail">
 				<view :style="{height:statusBarHeight+'px'}"></view>
-				<u-swiper mode="number" :border-radius="0" bg-color="#000" img-mode="widthFix" :interval="3000" :height="450" :list="imgList"></u-swiper>
+				<u-swiper mode="number" :border-radius="0" img-mode="aspectFit" :interval="3000" :height="450" :list="imgList"></u-swiper>
 				<view class="product-info-text">
 					<view class="product-info-text-title">
-					{{detail.productName}} 
-					<view class="copyText" @click="copy(detail.product.origCode)">复制</view>
+						{{detail.productName}} 
+						<view class="copyText" @click="copy(detail.productName)">复制</view>
 					</view>
 					<view class="product-info-text-attr">
 						<view class="product-info-price flex align_center">
@@ -54,6 +54,10 @@
 		<view class="scrollPage-footer">
 			<view class="scrollPage-footer-box">
 				<view class="footer-left">
+					<view v-if="isShare" class="footer-left-item" @click="goBack">
+						<u-icon :size='50' color="#666" name="home"></u-icon>
+						<text class="footer-left-item-text">首页</text>
+					</view>
 					<view class="footer-left-item" @click="toCart">
 						<u-icon :size='50' color="#666" name="shopping-cart"></u-icon>
 						<text class="footer-left-item-text">购物车</text>
@@ -77,7 +81,7 @@
 		:round="true"
 		:z-index="100"
 		position="bottom" 
-		custom-style="height:30%"
+		custom-style="height:30%;"
 		@afterleave="closePopu">
 			<view class="popu-content" v-if="detail">
 				<view class="popu-close" @click="showPopu=false">
@@ -85,7 +89,7 @@
 				</view>
 				<view class="pupu-box">
 					<view class="popu-content-img">
-						<image style="width: 100px; height: 100px;" mode="aspectFit" :src="detail.productMsg"></image>
+						<image style="width: 100px; height: 100px;" mode="aspectFit" :src="detail.productMsg||'/static/def_imgs.png'"></image>
 					</view>
 					<view class="popu-content-info">
 						<view class="popu-content-info-title">{{detail.productName}}</view>
@@ -137,9 +141,11 @@
 				shopProductSn: null,
 				detail: null,
 				qty: 1,// 数量
+				isShare: false // 是否从分享打开的
 			}
 		},
 		onLoad(option) {
+			this.isShare = !!option.share
 			// 计算安全区域
 			this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
 			this.safeAreaBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
@@ -158,7 +164,7 @@
 		onShareAppMessage(e){
 			return {
 			  title: this.detail ? this.detail.productName : '商品名称',
-			  path: '/pagesB/shopiing/productDetail?sn='+this.shopProductSn,
+			  path: '/pagesB/shopiing/productDetail?sn='+this.shopProductSn+'&share=1',
 			  imageUrl:this.detail ? this.detail.productMsg : '',
 			  type: '1'
 			}
@@ -173,7 +179,13 @@
 		methods: {
 			// 返回
 			goBack(){
-				uni.navigateBack()
+				if(this.isShare){
+					uni.reLaunch({
+						url: '/pages/index/index'
+					})
+				}else{
+					uni.navigateBack()
+				}
 			},
 			// 复制
 			copy(text){
@@ -204,10 +216,10 @@
 						this.detail = res.data
 						if(res.data && res.data.productPicList){
 							res.data.productPicList.forEach(item => {
-								this.imgList.push(item.imageUrl)
+								this.imgList.push(item.imageUrl||'/static/def_imgs.png')
 							})
 						}else{
-							this.imgList.push(res.data.productMsg)
+							this.imgList.push(res.data.productMsg||'/static/def_imgs.png')
 						}
 					}
 					uni.hideLoading()
@@ -325,7 +337,7 @@
 								title: '提示',
 								content: (removeList.length ? `产品${removeList.join(',')}已下架,`:'')+(selloutList.length?`产品${selloutList.join(',')}已售罄,`:'')+`不可采购。`+(successList.length?'是否继续采购其他产品?':''),
 								showCancel: successList.length,
-								confirmText: successList.length?'确定':'知道了',
+								confirmText: successList.length?'确定':'知道了',
 								success(ret) {
 									uni.hideLoading()
 									if(ret.confirm && successList.length){
@@ -540,7 +552,7 @@
 						background: #f44336;
 						color: #fff;
 						position: absolute;
-						right: 0;
+						right: 5px;
 						top: -8px;
 						font-size: 12px;
 						display: flex;

+ 42 - 121
pagesB/shopiing/searchProduct.vue

@@ -13,28 +13,19 @@
 			</view>
 		</view>
 		<view class="search-result">
-			<view class="tab-left" v-if="clzId&&categoryList.length>0">
-				<view class="item-clz" 
-				v-for="item in categoryList" 
-				:key="item.categorySn" 
-				:class="item.categorySn==categorySn?'active':''" 
-				@click="handleTab(item)">
-				{{item.categoryName}}
-				</view>
-			</view>
-			<view class="right-box" :style="{width:clzId&&categoryList.length?'75%':'100%'}">
+			<view class="right-box">
 				<!-- body -->
 				<scroll-view 
 				class="scrollPage-body" 
-				:class="clzId&&categoryList.length?'right-item':''"
 				:style="{height: (screenHeight - statusBarHeight - safeAreaBottom - 40) + 'px'}" 
 				scroll-y="true" 
 				type="custom" 
+				:bounces="false"
 				@scrolltolower="reachBottom">
 					<!-- 搜索,吸顶 -->
 					<sticky-header>
 						<view class="search-head">
-							<uni-search-bar v-model="queryWord" :focus="focus" radius="100" placeholder="请输入商品名称/产品编码/原厂编码" textColor="#666" clearButton="auto" cancelButton="none" @confirm="searchList" @clear="clearList" />
+							<uni-search-bar v-model="queryWord" :focus="focus" radius="100" placeholder="请输入商品名称/产品编码/原厂编码" textColor="#666" clearButton="auto" cancelButton="none" @input="searchChange" @confirm="searchList" @clear="clearList" />
 						</view>
 					</sticky-header>
 					<!-- 产品列表 -->
@@ -50,12 +41,12 @@
 					</chooseProductItem>
 					<!-- loading -->
 					<view class="loading-bar" v-if="total>0 && (loading||loadEnd)">{{loadText}}</view>
-					<view class="empty-bar" v-if="total==0&&!loading">
+					<!-- <view class="empty-bar" v-if="total==0&&!loading">
 						<image mode="aspectFit" :src="empty.imgUrl"></image>
 						<view>{{empty.tip}}</view>
-					</view>
+					</view> -->
 					<!-- 搜索记录 -->
-					<view class="search-history" v-if="historyList.length&&queryWord==''&&clzId==''">
+					<view class="search-history" v-if="historyList.length&&list.length==0&&queryWord==''&&clzId==''">
 						<view class="search-history-title">
 							<text>搜索记录</text>
 							<view class="search-history-right">
@@ -84,7 +75,7 @@
 	    mapMutations,
 	} from 'vuex'
 	import chooseProductItem from '@/pagesB/components/chooseProductItemSkline.vue'
-	import { getShopCategoryExt, getShopProductList } from '@/api/shop.js'
+	import { getShopProductList } from '@/api/shop.js'
 	export default {
 		components:{
 			chooseProductItem
@@ -113,13 +104,12 @@
 				expend: false,
 				clzId: null, // 一级分类
 				categorySn: null ,// 当前分类sn
-				categoryList: [], // 二级分类列表
 			};
 		},
 		computed: {
 			...mapState(['hasLogin']),
 			historyList() {
-				return this.searchHistoryList.filter(item=>item.text!='').reverse().slice(0,this.expend?20:10)
+				return this.searchHistoryList.filter(item=>!!item.text).reverse().slice(0,this.expend?20:10)
 			},
 			// 登录用户信息
 			userInfo(){
@@ -132,24 +122,23 @@
 			this.screenWidth = uni.getSystemInfoSync().windowWidth
 			this.screenHeight = uni.getSystemInfoSync().windowHeight
 			this.safeAreaBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
-			
 			// 一级分类id
 			this.clzId = opts.clzId
-			
 			// 搜索商品
 			if(opts.clzId==''){
 				this.title = '商城商品搜索'
 				this.focus = true
-			}else{
-				// 分类下产品
-				this.title = opts.clzName
-				// 查二级目录
-				this.getCategory()
-			}
-			
+			} 
 			// 搜索历史
 			this.searchHistoryList = uni.getStorageSync('searchHistoryList') || []
 		},
+		onUnload() {
+			// 历史记录最多存30条
+			if(this.searchHistoryList.length>30){
+				this.searchHistoryList = this.searchHistoryList.slice(this.searchHistoryList.length-30,this.searchHistoryList.length)
+				uni.setStorageSync('searchHistoryList', this.searchHistoryList)
+			}
+		},
 		methods: {
 			// 返回
 			goBack(){
@@ -172,17 +161,17 @@
 			},
 			// 清空搜索
 			clearList(){
-				// 有二级分类
-				if(this.clzId&&this.categoryList.length){
-					this.queryWord = ''
-					this.searchList()
-				}else{
-					this.queryWord = ''
-					this.list = []
-					this.total = 0
-					this.pageNo = 1
-					this.loadEnd = false
-					this.loadText = '没有找到相关产品'
+				this.queryWord = ''
+				this.list = []
+				this.total = 0
+				this.pageNo = 1
+				this.loadEnd = false
+				this.loadText = '没有找到相关产品'
+			},
+			// 失去焦点
+			searchChange(){
+				if(this.queryWord == ''){
+					this.clearList()
 				}
 			},
 			// 选择搜索记录
@@ -190,59 +179,6 @@
 				this.queryWord = item.text
 				this.searchList()
 			},
-			// 获取二级目录
-			getCategory(){
-				getShopCategoryExt({
-					categorySn: this.clzId
-				}).then(res => {
-					if(res.status == 200){
-						// 二级目录
-						this.categoryList = res.data && res.data.shopCategoryList ? res.data.shopCategoryList : []
-						// 如果有二级目录
-						if(this.categoryList.length > 0){
-							// this.categoryList.unshift({
-							// 	categorySn: this.clzId,
-							// 	categoryName: '全部'
-							// })
-							// 默认显示第一个
-							this.categorySn = this.categoryList[0].categorySn
-							// 目录下商品
-							this.searchList()
-						}else{
-							// 只有产品
-							const list = res.data && res.data.shopProductList ? res.data.shopProductList : []
-							const ret = []
-							// 更新已选状态
-							list.forEach(k => {
-							  ret.push({
-								  id: k.id,
-								  price: k.price,
-								  productCode: k.productCode,
-								  productSn: k.productSn,
-								  productImage: k.productMsg,
-								  productName: k.productName,
-								  productOrigCode: k.productOrigCode,
-								  categorySn: k.categorySn,
-								  hotFlag: k.hotFlag,
-								  productSn: k.productSn,
-								  priceType: k.priceType,
-								  shopProductSn: k.shopProductSn,
-								  status: k.status,
-								  statusDictValue: k.statusDictValue,
-								  dealerScopeFlag: k.dealerScopeFlag
-							  })
-							})
-							// 追加数据
-							this.list.push(ret)
-						}
-					}else{
-						uni.showToast({
-							title: res.message,
-							icon: 'none'
-						})
-					}
-				})
-			},
 			// 搜索列表
 			searchList(event) {
 				 //  存储搜索记录
@@ -254,21 +190,17 @@
 					 })
 					 uni.setStorageSync('searchHistoryList', this.searchHistoryList)
 				 }
-				 
-				 this.loadEnd = false
-				 this.loadText = '加载中...'
-				 this.list = []
-				 this.pageNo = 1
-				 this.getList()
-			},
-			// 单击二级分类
-			handleTab(item){
-				this.categorySn = item.categorySn
-				this.queryWord = ''
-				this.searchList()
+				 if(this.queryWord != ''){
+					 this.loadEnd = false
+					 this.loadText = '加载中...'
+					 this.list = []
+					 this.pageNo = 1
+					 this.getList()
+				 }
 			},
 			// 滚动到底部
 			reachBottom() {
+				console.log(11)
 				if(!this.loading && !this.loadEnd){
 					this.pageNo++
 					this.getList()
@@ -277,13 +209,16 @@
 			// 列表查询
 			getList(){
 				this.loading = true
-				const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_storeShelf.dealerSn : ''
+				const storeShelf = this.$store.state.vuex_storeShelf
+				const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1'&&storeShelf ? storeShelf.dealerSn : ''
 				getShopProductList({
 					pageNo: this.pageNo,
 					pageSize: this.pageSize,
-					queryWord: this.queryWord,
+					productCode: this.queryWord,
 					categorySn: this.categorySn,
-					dealerSn: dealerSn
+					dealerSn: dealerSn,
+					categoryStatus : 1,
+					status: 1
 				}).then(res => {
 					this.loading = false
 					if(res.status == 200){
@@ -379,22 +314,8 @@
 		flex-grow: 1;
 		display: flex;
 		justify-content: space-between;
-		.tab-left{
-			width: 25%;
-			flex-grow: 1;
-			background: #FFFFFF;
-			.item-clz{
-				font-size: 14px;
-				padding: 8px 10px;
-				line-height: 30px;
-			}
-			.active{
-				border-left: 3px solid #00aaff;
-				background: #f8f8f8;
-			}
-		}
 		.right-box{
-			width: 75%;
+			width: 100%;
 			.scrollPage-body{
 				width:100%;
 				.uni-searchbar{

+ 474 - 0
pagesB/shopiing/shopProduct.vue

@@ -0,0 +1,474 @@
+<template>
+	<view class="pages">
+		<!-- head -->
+		<view class="scrollPage-header">
+			<view :style="{height:statusBarHeight+'px'}"></view>
+			<view class="header-title">
+				<view class="header-left" @click="goBack">
+					<image style="width: 16px; height: 16px;margin-right:3px;" mode="aspectFit" src="../static/arrow-left.png"></image>
+					<text>返回</text>
+				</view>
+				<view class="header-title"><text class="ellipsis-one" overflow="ellipsis">{{title}}</text></view>
+				<view class="header-right"></view>
+			</view>
+			<view class="search-head" @click="goSearch">
+				<uni-search-bar readonly v-model="queryWord" :focus="focus" radius="100" placeholder="请输入商品名称/产品编码/原厂编码" textColor="#666" clearButton="auto" cancelButton="none" />
+			</view>
+		</view>
+		<view class="search-result">
+			<view class="tab-left" v-if="clzId&&categoryList.length>0">
+				<scroll-view
+				:style="{height: (screenHeight - statusBarHeight - 44 - 43) + 'px'}" 
+				scroll-y="true" 
+				:bounces="false"
+				type="list" 
+				>
+					<view class="item-clz" 
+					v-for="item in categoryList" 
+					:key="item.categorySn" 
+					:class="item.categorySn==categorySn?'active':''" 
+					@click="handleTab(item)">
+					{{item.categoryName}}
+					</view>
+				</scroll-view>
+			</view>
+			<view class="right-box" :style="{width:clzId&&categoryList.length?'75%':'100%'}">
+				<!-- body -->
+				<scroll-view 
+				class="scrollPage-body" 
+				:class="clzId&&categoryList.length?'right-item':''"
+				:style="{height: (screenHeight - statusBarHeight - 44 - 43) + 'px'}" 
+				scroll-y="true" 
+				type="list" 
+				:bounces="false"
+				:refresher-enabled="enableRefresh" 
+				:refresher-triggered="triggered" 
+				@refresherpulling="onPulling"
+				@refresherrefresh="onRefresh"
+				@refresherrestore="onRestore"
+				@refresherabort="onAbort"
+				@scrolltolower="reachBottom">
+					<!-- 产品列表 -->
+					<chooseProductItem
+					v-for="(item, index) in list"
+					:key="item.id"  
+					:index="index"
+					:list="item" 
+					:isView="true"
+					:isLogin="hasLogin"
+					@toDetail="viewDetail"
+					>
+					</chooseProductItem>
+					<!-- loading -->
+					<view class="loading-bar" v-if="total>0 && (loading||loadEnd)">{{loadText}}</view>
+					<view class="empty-bar" v-if="total==0&&!loading">
+						<image mode="aspectFit" :src="empty.imgUrl"></image>
+						<view>{{empty.tip}}</view>
+					</view>
+				</scroll-view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+	    mapState,
+	    mapMutations,
+	} from 'vuex'
+	import chooseProductItem from '@/pagesB/components/chooseProductItemSkline.vue'
+	import { getShopCategoryExt, getShopProductList } from '@/api/shop.js'
+	export default {
+		components:{
+			chooseProductItem
+		},
+		data() {
+			return {
+				title: '',
+				loadText: '加载中...',
+				empty: {
+					tip: '暂无商品',
+					imgUrl: '/static/nodata.png'
+				},
+				queryWord:'',
+				screenWidth: 325,
+				screenHeight: 0,
+				statusBarHeight: 44,
+				safeAreaBottom: 0,
+				pageSize: 10,
+				pageNo:1,
+				total:0,
+				list: [],
+				loading:false,
+				loadEnd: false,
+				focus: false,
+				expend: false,
+				clzId: null, // 一级分类
+				categorySn: null ,// 当前分类sn
+				categoryList: [], // 二级分类列表
+				enableRefresh: true,
+				triggered: false,
+				pulling: false
+			};
+		},
+		computed: {
+			...mapState(['hasLogin']),
+			// 登录用户信息
+			userInfo(){
+				return this.$store.state.vuex_userInfo
+			},
+		},
+		onLoad(opts) {
+			// 计算区域高度
+			this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
+			this.screenWidth = uni.getSystemInfoSync().windowWidth
+			this.screenHeight = uni.getSystemInfoSync().windowHeight
+			this.safeAreaBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
+			
+			// 一级分类id
+			this.clzId = opts.clzId
+			
+			// 搜索商品
+			if(opts.clzId==''){
+				this.title = '商城商品搜索'
+				this.focus = true
+			}else{
+				// 分类下产品
+				this.title = opts.clzName
+				// 查二级目录
+				this.getCategory()
+			}
+		},
+		methods: {
+			// 返回
+			goBack(){
+				uni.navigateBack()
+			},
+			// 去搜索产品
+			goSearch(event){
+				uni.navigateTo({
+					url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
+				})
+			},
+			// 获取二级目录
+			getCategory(){
+				getShopCategoryExt({
+					categorySn: this.clzId,
+					status: 1
+				}).then(res => {
+					if(res.status == 200){
+						// 二级目录
+						this.categoryList = res.data && res.data.shopCategoryList ? res.data.shopCategoryList : []
+						// 如果有二级目录
+						if(this.categoryList.length > 0){
+							// this.categoryList.unshift({
+							// 	categorySn: this.clzId,
+							// 	categoryName: '全部'
+							// })
+							// 默认显示第一个
+							this.categorySn = this.categoryList[0].categorySn
+							// 目录下商品
+							this.searchList()
+						}else{
+							// 禁用下拉刷新
+							this.enableRefresh = false
+							// 只有产品
+							const list = res.data && res.data.shopProductList ? res.data.shopProductList : []
+							this.total = list.length
+							// 更新已选状态
+							for(let i=0;i<list.length;i=i+this.pageSize){
+							  // 追加数据
+							  this.list.push(list.slice(i,(i+this.pageSize)>list.length?list.length:(i+this.pageSize)).map(k=>{
+								  return  {
+									  id: k.id,
+									  price: k.price,
+									  productCode: k.productCode,
+									  productSn: k.productSn,
+									  productImage: k.productMsg,
+									  productName: k.productName,
+									  productOrigCode: k.productOrigCode,
+									  categorySn: k.categorySn,
+									  hotFlag: k.hotFlag,
+									  productSn: k.productSn,
+									  priceType: k.priceType,
+									  shopProductSn: k.shopProductSn,
+									  status: k.status,
+									  statusDictValue: k.statusDictValue,
+									  dealerScopeFlag: k.dealerScopeFlag
+								  }
+							  }))
+							}
+							this.loadEnd = true
+							this.loadText = '没有更多了'
+						}
+					}else{
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+					}
+				})
+			},
+			// 搜索列表
+			searchList(event) {
+				 this.loadEnd = false
+				 this.loadText = '加载中...'
+				 this.list = []
+				 this.pageNo = 1
+				 this.getList()
+			},
+			// 单击二级分类
+			handleTab(item){
+				this.categorySn = item.categorySn
+				this.queryWord = ''
+				this.searchList()
+			},
+			// 自定义下拉刷新控件被下拉
+			onPulling(e){
+				console.log('onPulling')
+				this.triggered = true
+				this.pulling = true
+			},
+			// 自定义下拉刷新被触发
+			onRefresh(e){
+				console.log('onRefresh')
+				setTimeout(() => {      
+					this.triggered = false 
+				}, 500); 
+			},
+			// 自定义下拉刷新被复位
+			onRestore(e){
+				console.log('onRestore')
+				this.queryWord = ''
+				this.searchList()
+			},
+			// 自定义下拉刷新被中止
+			onAbort(e){
+				console.log('onAbort')
+				this.triggered = false 
+			},
+			// 滚动到底部
+			reachBottom() {
+				console.log('reachBottom',this.pulling)
+				if(this.enableRefresh){
+					if(!this.loading && !this.loadEnd && !this.pulling){
+						this.pageNo++
+						this.getList()
+					}
+					if(this.pulling){
+						this.pulling = false
+					}
+				}
+			},
+			// 列表查询
+			getList(){
+				this.loading = true
+				const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_storeShelf.dealerSn : ''
+				getShopProductList({
+					pageNo: this.pageNo,
+					pageSize: this.pageSize,
+					queryWord: this.queryWord,
+					categorySn: this.categorySn,
+					dealerSn: dealerSn,
+					categoryStatus : 1,
+					status: 1
+				}).then(res => {
+					this.loading = false
+					if(res.status == 200){
+						this.total = Number(res.data.count)
+						if(this.total){
+							const list = res.data.list || []
+							const ret = []
+							// 更新已选状态
+							list.forEach(k => {
+							  ret.push({
+								  id: k.id,
+								  price: k.price,
+								  productCode: k.productCode,
+								  productSn: k.productSn,
+								  productImage: k.productMsg,
+								  productName: k.productName,
+								  productOrigCode: k.productOrigCode,
+								  categorySn: k.categorySn,
+								  hotFlag: k.hotFlag,
+								  productSn: k.productSn,
+								  priceType: k.priceType,
+								  shopProductSn: k.shopProductSn,
+								  status: k.status,
+								  statusDictValue: k.statusDictValue,
+								  dealerScopeFlag: k.dealerScopeFlag
+							  })
+							})
+							// 追加数据
+							this.list.push(ret)
+							// 判断是否最后一页
+							const maxPages = Math.ceil(this.total / this.pageSize)
+							if(this.pageNo >= maxPages){
+								this.loadEnd = true
+								this.loadText = '没有更多了'
+							}
+						}else{
+							this.loadEnd = false
+							this.loadText = '没有找到相关产品'
+						}
+					}else{
+						this.loadEnd = false
+						this.loadText = res.message
+					}
+				}).catch(err => {
+					this.loading = false
+				})
+			},
+			// 产品详情查看
+			viewDetail(item){
+				uni.navigateTo({
+					url:'/pagesB/shopiing/productDetail?sn='+item.shopProductSn
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+.pages{
+	height: 100vh;
+	display: flex;
+	flex-direction: column;
+	.scrollPage-header{
+		z-index: 1;
+		.header-title{
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+			padding: 0 10px;
+			height: 44px;
+			background-color: #FFFFFF;
+			box-shadow: 0px 1px 0px 0px #E6E6E6;
+			.header-title{
+				font-size: 16px;
+				color: #333333;
+				max-width: 70%;
+			}
+			.header-left{
+				display: flex;
+				align-items: center;
+				text{
+					font-size: 14px;
+					color: #333333;
+					margin-left: 5px;
+				}
+			}
+			.header-right{
+				width: 50px;
+			}
+		}
+	}
+	.search-head{
+		background-color: #FFFFFF;
+		/deep/ .uni-searchbar{
+			padding: 5px 6px;
+		}
+	}
+	.search-result{
+		flex-grow: 1;
+		display: flex;
+		justify-content: space-between;
+		.tab-left{
+			width: 25%;
+			flex-grow: 1;
+			background: #FFFFFF;
+			.item-clz{
+				font-size: 14px;
+				padding: 8px 10px;
+				line-height: 30px;
+			}
+			.active{
+				border-left: 3px solid #00aaff;
+				background: #f8f8f8;
+			}
+		}
+		.right-box{
+			width: 75%;
+			.scrollPage-body{
+				width:100%;
+				.uni-searchbar{
+					background-color: #FFFFFF;
+				}
+				/deep/ .choose-product-item{
+					background-color: #FFFFFF;
+					margin: 6px 10px;
+					border-radius: 10px;
+				}
+				.loading-bar{
+					text-align: center;
+					padding: 10px 0;
+					color: #999999;
+				}
+				.empty-bar{
+					display: flex;
+					flex-direction: column;
+					align-items: center;
+					justify-content: center;
+					padding: 20px 0;
+					image{
+						width: 100px;
+						height: 100px;
+					}
+					view{
+						font-size: 12px;
+						color: #999999;
+					}
+				}
+				.search-history{
+					padding: 0 1.5rem;
+					.search-history-title{
+						display: flex;
+						align-items: center;
+						justify-content: space-between;
+						padding: 6px 0;
+						font-size: 14px;
+						color: #333333;
+						border-bottom: 1px solid #E6E6E6;
+					}
+					.search-history-right{
+						display: flex;
+						align-items: center;
+					}
+					.search-history-expend{
+						display: flex;
+						align-items: center;
+						font-size: 12px;
+						margin-right: 15px;
+					}
+					.search-history-body{
+						display: flex;
+						flex-wrap: wrap;
+						align-items: center;
+						justify-content: space-between;
+						padding: 10px 10px;
+						.item{
+							padding: 6px 0;
+							background-color: #f8f8f8;
+							border-radius: 20px;
+							font-size: 12px;
+							color: #333333;
+							width: 46%;
+						}
+					}
+				}
+			}
+			.right-item{
+				/deep/ .choose-product-item{
+					margin: 5px 8px;
+					.choose-product-item-img{
+						height: 130rpx;
+					}
+					.choose-product-item-info .choose-product-item-left-info-name{
+						font-weight: normal;
+					}
+				}
+			}
+		}
+	}
+}
+</style>

BIN=BIN
static/def_imgs.png


BIN=BIN
static/hot.png


+ 1 - 1
uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue

@@ -193,7 +193,7 @@
 	}
 
 	.uni-numbox__value {
-		margin: 0 2px;
+		margin: 0 5px;
 		background-color: $bg;
 		width: 30px;
 		height: $box-height;