lilei 10 달 전
부모
커밋
b548399901

+ 2 - 2
App.vue

@@ -1,9 +1,9 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.2.113:9110/saas/clz/', // 本地
+			baseUrl: 'http://192.168.2.131:9688/saas/clz/', // 本地
 			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
-			baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
+			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},
 		onLaunch: function() {
 			console.log('App Launch');

+ 16 - 0
api/purchase.js

@@ -23,4 +23,20 @@ export const purchaseQueryDetailPage = params => {
     method: 'post',
     data: params
   })
+}
+// 采购单-取消
+export const purchaseCancel = params => {
+  return request({
+    url: `purchase/cancel`,
+    method: 'post',
+    data: params
+  })
+}
+// 采购单-收货
+export const purchaseReceive = params => {
+  return request({
+    url: `purchase/receive`,
+    method: 'post',
+    data: params
+  })
 }

+ 47 - 0
api/shop.js

@@ -0,0 +1,47 @@
+import request from './request';
+
+// 获取商品列表
+export function getShopProductList(params) {
+  return request({
+    url: `shopProduct/queryProductPage/${params.pageNo}/${params.pageSize}`,
+    method: 'post',
+    data: params
+  },true)
+}
+
+// 获取商品详情
+export function getShopDetail(params) {
+	return request({
+	  url: `shopProduct/queryBySn/${params.shopProductSn}`,
+	  method: 'post',
+	  data: params
+	},true)
+}
+
+// 获取商品分类
+export function getShopCategory(params) {
+	return request({
+	  url: `shopCategory/queryList`,
+	  method: 'post',
+	  data: params
+	},true)
+}
+
+// 获取商品分类详情
+export function getShopCategoryDetail(params) {
+	return request({
+	  url: `shopCategory/queryBySn/${params.categorySn}`,
+	  method: 'post',
+	  data: params
+	},true)
+}
+
+// 获取商品分类扩展
+export function getShopCategoryExt(params) {
+  return request({
+    url: `shopCategory/queryExtBySn/${params.categorySn}`,
+    method: 'post',
+    data: params
+  },true)
+}
+ 

+ 94 - 128
pages/index/index.vue

@@ -86,7 +86,7 @@
 					<view class="ptype-nav pa-box" v-if="hasShopiing">
 						<swiper class="swiper" @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" @callback="onNavFun"></iconItemsList>
+								<iconItemsList :list="item.list" type="img"></iconItemsList>
 							</swiper-item>
 						</swiper>
 						<view class="indicator-dots">
@@ -105,7 +105,12 @@
 							:index="index"
 							:itemWidth="(screenWidth-25)*0.5"
 							:gap="5"
+							:isLogin="hasLogin"
 							></productItem>
+							<view style="padding: 20upx;">
+								<u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="productList.length==0 && status!='loading'" mode="list"></u-empty>
+								<u-loadmore v-if="status=='loading'" :status="status" />
+							</view>
 						</view>
 					</view>
 				</view>
@@ -158,6 +163,7 @@
 	import { promoTerminalList } from '@/api/video.js'
 	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"
 	export default {
 		components: {
@@ -171,7 +177,7 @@
 			return {
 				status: 'loading',
 				noDataText: '暂无数据',
-				hasShopiing: false, // 是否开通商城
+				hasShopiing: true, // 是否开通商城
 				bondRecord: null, // 保证金
 				list:[], // 扫描记录滚动
 				slist:[], // 红包滚动
@@ -182,9 +188,10 @@
 				scanMaxNums: 10, // 扫描VIN仅限10次
 				carouselList: [] ,// 修理厂促销活动列表
 				productTypeList: [], // 产品分类
-				currentPtypeDot: 0,
-				screenWidth: 325,
-				productList:[]
+				currentPtypeDot: 0, // 当前产品分类页
+				screenWidth: 325, // 屏幕宽度
+				productList:[], // 热门产品
+				hotProductPageNo: 1 // 热门产品页码
 			}
 		},
 		computed: {
@@ -234,7 +241,7 @@
 				const list = [
 					{
 						id:'n0',
-						auth: this.hasLogin&&this.userInfo.sysUserFlag == '1',
+						auth: true,
 						icon:'bianmachaxun',
 						name: '产品编码取货',
 						color:'#056cd9',
@@ -243,7 +250,7 @@
 					},
 					{
 						id:'n1',
-						auth: this.hasLogin&&this.userInfo.sysUserFlag == '1',
+						auth: true,
 						icon:'saoma',
 						name: '二维/条码取货',
 						color:'#ffaa7f',
@@ -252,7 +259,7 @@
 					},
 					{
 						id:'n3',
-						auth: this.hasLogin,
+						auth: true,
 						icon:'shipin1',
 						name: '视频教程',
 						color:'#55aaff',
@@ -261,7 +268,7 @@
 					},
 					{
 						id:'n2',
-						auth: this.hasLogin,
+						auth: true,
 						icon:'chaxunjilu',
 						name: 'VIN查询历史',
 						color:'#97d695',
@@ -269,7 +276,7 @@
 						target: 'page'
 					}
 				]
-				return list.filter(item=> item.auth)
+				return list
 			}
 		},
 		onReady() {
@@ -287,8 +294,6 @@
 			this.orderTodo = null
 			this.bondRecord = null
 			this.vinList = []
-			// 推荐产品列表
-			this.getProductList()
 			// 视频类型
 			this.getLookUpList('CONTENT_CATEGORY', 'vuex_videoTypeList');
 			// 检测是否登录
@@ -306,6 +311,8 @@
 			uni.$on("refashHome",()=>{
 				this.pageInit(true)
 			})
+			// 商品分类
+			this.getGoodType()
 		},
 		// 页面卸载
 		onUnload() {
@@ -366,11 +373,6 @@
 					url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
 				})
 			},
-			// 获取产品列表
-			getProductList(){
-				const cacheList = this.$store.state.vuex_cartList.find(k => k.sn == '693459699332595712')
-				this.productList = cacheList ? JSON.parse(JSON.stringify(cacheList.list)) : []
-			},
 			// 初始化页面
 			pageInit(flag){
 				this.carouselList = []
@@ -379,8 +381,7 @@
 					if(this.userInfo.sysUserFlag == '1'){
 						// 查询是否有商城
 						this.getHasShopping(flag)
-					}else{
-						// 游客
+					}else{// 游客
 						// 获取扫描次数
 						this.$store.dispatch("getScanNums")
 						// 获取最大扫描次数
@@ -389,6 +390,8 @@
 						this.findLastApply()
 						// 获取扫描记录
 						this.getVinLog()
+						// 商品分类
+						this.getGoodType()
 					}
 					
 				}else{
@@ -413,18 +416,34 @@
 			},
 			// 快速导航单击
 			onNavFun(item){
-				// 编码取货
-				if(item.url=='openTakeGood1'){
-					this.openTakeGood(1)
-				}
-				// 扫码取货
-				if(item.url=='openTakeGood0'){
-					this.openTakeGood(0)
-				}
-				// 产品分类跳转
-				if(item.url=='ptypeNav'){
+				if(this.hasLogin){
+					// 非游客
+					if(this.userInfo.sysUserFlag == '1'){
+						// 编码取货
+						if(item.url=='openTakeGood1'){
+							this.openTakeGood(1)
+						}
+						// 扫码取货
+						if(item.url=='openTakeGood0'){
+							this.openTakeGood(0)
+						}
+					}else{
+						uni.showModal({
+							title: '提示',
+							content: '你还未申请认证门店,暂无法使用此功能',
+							confirmText: '去认证',
+							success(res) {
+								if(res.confirm){
+									uni.navigateTo({
+										url: '/pages/storeManage/storeAuth'
+									})
+								}
+							}
+						})
+					}
+				}else{
 					uni.navigateTo({
-						url:'/pagesB/shopiing/searchProduct?clzId='+item.sn+'&clzName='+item.name
+						url: '/pages/login/login'
 					})
 				}
 			},
@@ -529,104 +548,52 @@
 					this.status = 'nomore'
 				})
 			},
-			// 商品分类
+			// 商品一级分类
 			getGoodType(){
-				const list = [
-					{
-						id:'0',
-						sn:'0',
-						name:'轮胎',
-						icon:'/static/temp/t1.jpeg',
-						url: 'ptypeNav',
-						target: 'fun'
-					},
-					{
-						id:'1',
-						sn:'1',
-						name:'滤清器',
-						icon:'/static/temp/t2.jpeg',
-						url: 'ptypeNav',
-						target: 'fun'
-					},
-					{
-						id:'2',
-						sn:'3',
-						name:'刹车片',
-						icon:'/static/temp/t4.jpg',
-						url: 'ptypeNav',
-						target: 'fun'
-					},{
-						id:'4',
-						sn:'4',
-						name:'油品',
-						icon:'/static/temp/t5.png',
-						url: 'ptypeNav',
-						target: 'fun'
-					},{
-						id:'5',
-						sn:'5',
-						name:'雨刮',
-						icon:'/static/temp/t11.jpg',
-						url: 'ptypeNav',
-						target: 'fun'
-					},{
-						id:'6',
-						sn:'6',
-						name:'火花塞',
-						icon:'/static/temp/t6.jpeg',
-						url: 'ptypeNav',
-						target: 'fun'
-					},{
-						id:'7',
-						sn:'7',
-						name:'电火线圈',
-						icon:'/static/temp/t7.jpg',
-						url: 'ptypeNav',
-						target: 'fun'
-					},{
-						id:'8',
-						sn:'8',
-						name:'照明系列',
-						icon:'/static/temp/t9.jpg',
-						url: 'ptypeNav',
-						target: 'fun'
-					},{
-						id:'9',
-						sn:'9',
-						name:'空气滤',
-						icon:'/static/temp/t10.jpg',
-						url: 'ptypeNav',
-						target: 'fun'
-					},{
-						id:'10',
-						sn:'10',
-						name:'机油率',
-						icon:'/static/temp/t3.jpg',
-						url: 'ptypeNav',
-						target: 'fun'
-					},{
-						id:'11',
-						sn:'11',
-						name:'电瓶电池',
-						icon:'/static/temp/t8.jpg',
-						url: 'ptypeNav',
-						target: 'fun'
-					},{
-						id:'12',
-						sn:'12',
-						name:'洗美养护',
-						icon:'/static/temp/t12.jpg',
-						url: 'ptypeNav',
-						target: 'fun'
-					}
-				]
-				// 转成二维数组
-				for(let i=0;i<list.length;i=i+8){
-					this.productTypeList.push({
-						id: 'swiper-item-'+i,
-						list: list.slice(i,(i+8)>list.length?list.length:(i+8))
+				this.productTypeList = []
+				getShopCategory({categoryLevel: 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))
+						})
+					}
+				})
+				// 获取推荐产品
+				this.getProductList()
+			},
+			// 商品列表查询
+			getProductList(){
+				this.productList = []
+				this.status = "loading"
+				 getShopProductList({pageNo:this.hotProductPageNo,pageSize:15,hotFlag:1}).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 / 15)
+						 this.status = this.hotProductPageNo >= maxPages ? "nomore" : 'loadmore'
+						 this.noDataText = this.status == 'nomore' ? '没有更多了' : '更多商品'
+					 }else{
+						 this.status = "nomore"
+						 this.noDataText = res.message || '没有更多了'
+					 }
+				 })
 			},
 			// 商城信息, flag: true 再次刷新,false 首次加载
 			getHasShopping(flag){
@@ -642,8 +609,7 @@
 							this.showCatTab()
 							// 商品分类
 							this.getGoodType()
-						}else{ 
-							// 没有商城
+						}else{ // 没有商城
 							// 滚动扫描记录
 							this.getScrollLog()
 							// 获取扫描记录

+ 7 - 3
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.productImage+'?x-oss-process=image/resize,p_30'" style="height: 140px;width: 100%;"></image>
+				<image mode="aspectFit" :src="item.productMsg+'?x-oss-process=image/resize,p_30'" style="height: 140px;width: 100%;"></image>
 				<!-- <view class="back-price" v-if="item.promoRuleValue">返<text>{{item.promoRuleValue}}</text>元</view> -->
 				<view class="product-code"><text class="ellipsis-one" overflow="ellipsis">{{item.productCode}}</text></view>
 			</view>
@@ -16,7 +16,7 @@
 				<view class="product-name ellipsis-two">{{item.productName}}</view>
 				<view class="product-guige"><text class="ellipsis-two" max-lines="2" overflow="ellipsis">{{item.productOrigCode}}</text></view>
 				<view class="product-button">
-					<view class="price-txt">¥<text>{{item.cost}}</text></view>
+					<view class="price-txt flex align_center">¥<text>{{isLogin ? item.price : '***'}}</text></view>
 					<view>
 						 
 					</view>
@@ -45,6 +45,10 @@
 			itemWidth:{
 				type: [Number,String],
 				default: 0
+			},
+			isLogin: {
+				type: Boolean,
+				default: false
 			}
 		},
 		data() {
@@ -55,7 +59,7 @@
 		methods: {
 			toDetail(item){
 				uni.navigateTo({
-					url:'/pagesB/shopiing/productDetail?sn='+item.productSn
+					url:'/pagesB/shopiing/productDetail?sn='+item.shopProductSn
 				})
 				this.$emit('detail',item)
 			},

+ 42 - 3
pagesB/cart/index.vue

@@ -65,7 +65,7 @@
 									<text>合计:</text>
 								</view>
 								<view class="cart-footer-left-price-num">
-									<text>¥{{totalAmount}}</text>
+									<text>¥{{Number(totalAmount).toFixed(2)}}</text>
 								</view>
 							</view>
 							<!-- <view class="cart-head-btton red" v-if="editFlag" @click="clearAll">
@@ -90,7 +90,7 @@
 	} from 'vuex'
 	import productItem from '@/pagesB/cart/productitem.vue'
 	import { getCartList, updateCart, deleteCart } from '@/api/cart.js'
-	
+	import { purchaseSave } from '@/api/purchase.js'
 	export default {
 		components:{
 			productItem
@@ -349,7 +349,7 @@
 			// 去结算
 			settlement(){
 				if(this.totalAmount>0){
-					 
+					 this.submitOrder()
 				}else{
 					uni.showToast({
 						title: '请选择产品',
@@ -357,6 +357,45 @@
 					})
 				}
 			},
+			// 去结算
+			submitOrder(){
+				uni.showLoading({
+					title: '提交中...',
+					mask: true
+				})
+				// 获取已选商品
+				const detailList = []
+				const cartSn = []
+				this.list.forEach(key => {
+					key.filter(item=>item.checked).forEach(item => {
+						detailList.push({
+							productSn:item.productSn,
+							productCode:item.productCode,
+							qty: item.qty,
+							price:item.price,
+						})
+						cartSn.push(item.cartSn)
+					})
+				})
+				purchaseSave({
+					detailList: detailList
+				}).then(res => {
+					if(res.status == 200){
+						// 删除已提交产品
+						this.removeCart(cartSn,true)
+						res.data.detailList = []
+						this.$store.state.vuex_tempData = res.data
+						uni.navigateTo({
+							url: "/pagesB/procureOrder"
+						})
+					}else{
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+					}
+				})
+			},
 			// 计算总款数、合计、数量
 			getChooseHeji(){
 				this.totalAmount = 0

+ 9 - 6
pagesB/components/chooseProductItemSkline.vue

@@ -5,7 +5,7 @@
 		:key="item.id" 
 		@click="toDetail(item)"
 		>
-			 <view>
+			 <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>
 					<view class="back-price" v-if="item.promoRuleValue&&!isView">返<text>{{item.promoRuleValue}}</text>元</view>
@@ -28,6 +28,9 @@
 					</view>
 				 </view>
 			 </view>
+			 <view class="flex align_center justify_center" v-if="isView">
+			 	<uni-icons type="arrowright" size="20" color="#999"></uni-icons>
+			 </view>
 		</view>
 	</block>
 </template>
@@ -65,15 +68,14 @@
 				this.$emit('remove',id)
 			},
 			toDetail(item){
-				uni.navigateTo({
-						url: '/pagesB/shopiing/productDetail?sn='+item.productSn
-					})
+				this.$emit('toDetail',item)
 			}
 		}
 	}
 </script>
 
 <style lang="less">
+	@import '/flex.css';
 	.choose-product-item{
 		display: flex;
 		align-items: center;
@@ -92,8 +94,9 @@
 			 display: flex;
 			 align-items: center;
 			 justify-content: space-between;
-			 flex-grow: 1;
-			 width: 100%;
+			 &::first-child{
+				 flex-grow: 1;
+			 }
 		}
 		.choose-product-item-img{
 			margin-right: 20rpx;

+ 46 - 4
pagesB/procureOrderList.vue

@@ -26,11 +26,13 @@
 									 <view class="nums">
 										 共{{item.totalQty}}件商品
 									 </view>
-									 <view style="text-align: right;">
+									 <view style="text-align: right;color: #999;">
 										 <span v-if="item.billStatus == 'WAIT_AUDIT'">待审核</span>
 										 <span v-if="item.billStatus == 'AUDIT_REJECT'">审核不通过</span>
-										 <span v-if="item.billStatus == 'WAIT_OUT_WAREHOUSE'">待收货</span>
+										 <span v-if="item.billStatus == 'WAIT_OUT_WAREHOUSE' || item.billStatus == 'WAIT_RECEIVE'">待收货</span>
 										 <span v-if="item.billStatus == 'FINISH'">已完结</span>
+										 <u-button style="margin-left: 10px;" v-if="item.billStatus == 'WAIT_AUDIT'" size="mini" shape="circle" type="error" @click="cancelOrder(item)">取消订单</u-button>
+										 <u-button style="margin-left: 10px;" v-if="item.billStatus == 'WAIT_RECEIVE'" size="mini" shape="circle" type="primary" @click="receiveOrder(item)">确认收货</u-button>
 									 </view>
 								 </view>
 							 </view>
@@ -46,7 +48,7 @@
 </template>
 
 <script>
-	import { purchaseQueryPage } from '@/api/purchase.js'
+	import { purchaseQueryPage,purchaseCancel,purchaseReceive } from '@/api/purchase.js'
 	export default {
 		data() {
 			return {
@@ -136,6 +138,46 @@
 					this.status = "nomore"
 				}
 			},
+			// 取消订单
+			cancelOrder(item){
+				let _this = this
+				uni.showModal({
+					title: '提示',
+					content: '确定取消订单吗?',
+					success: function (res) {
+						if (res.confirm) {
+							purchaseCancel({purchaseSn:item.purchaseSn}).then(res => {
+								if (res.status == 200) {
+									_this.message('取消成功')
+									_this.pageInit()
+								} else {
+									_this.message(res.message)
+								}
+							})
+						}
+					}
+				});
+			},
+			// 确认收货
+			receiveOrder(item){
+				let _this = this
+				uni.showModal({
+					title: '提示',
+					content: '确定收货吗?',
+					success: function (res) {
+						if (res.confirm) {
+							purchaseReceive({purchaseSn:item.purchaseSn}).then(res => {
+								if (res.status == 200) {
+									_this.message('收货成功')
+									_this.pageInit()
+								} else {
+									_this.message(res.message)
+								}
+							})
+						}
+					}
+				});
+			},
 			// 查询列表
 			getRow (pageNo) {
 			  let _this = this
@@ -148,7 +190,7 @@
 			  }
 			  // 状态条件
 			  if(this.swiperCurrent == 1){
-				  params.billStatusList = ['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE']
+				  params.billStatusList = ['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE','WAIT_RECEIVE']
 			  }
 			  if(this.swiperCurrent == 2){
 				  params.billStatusList = ['FINISH']

+ 124 - 65
pagesB/shopiing/productDetail.vue

@@ -13,14 +13,14 @@
 		</view>
 		<!-- 内容 -->
 		<view class="scrollPage-content">
-			<view class="product-info">
+			<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="heightFix" :interval="3000" :height="450" :list="imgList"></u-swiper>
+				<u-swiper mode="number" :border-radius="0" bg-color="#000" img-mode="widthFix" :interval="3000" :height="450" :list="imgList"></u-swiper>
 				<view class="product-info-text">
-					<view class="product-info-text-title">【新品】Apple iPhone 13 Pro Max (A2644) 256GB 金色 支持移动联通电信5G 双卡双待手机</view>
+					<view class="product-info-text-title">{{detail.productName}}</view>
 					<view class="product-info-text-attr">
 						<view class="product-info-price">
-							¥<text class="price-red">45.8</text>
+							¥<text class="price-red">{{hasLogin ? detail.price : '***'}}</text>
 						</view>
 						<view class="product-info-nums">
 							<view class="share">
@@ -31,18 +31,21 @@
 				</view>
 			</view>
 			<u-divider bg-color="">商品详情</u-divider>
-			<view class="product-info-guige">
-				<view class="row">品牌:<text>箭冠</text></view>
-				<view class="row-ban">原厂编码:<text>128/79 R78 </text></view>
-				<view class="row-ban">产品编码:<text>Y123</text></view>
-				<view class="row-ban">单位:<text>箱</text></view>
-				<view class="row-ban">包装数:<text>5/个</text></view>
-				<view class="row-ban">尺寸:<text>16cm</text></view>
-				<view class="row-ban">内盒尺寸:<text>15cm</text></view>
-				<view class="row-ban">重量:<text>1.5KG</text></view>
-				<view class="row-ban">颜色:<text>箭冠</text></view>
+			<view class="product-info-guige" v-if="detail">
+				<view class="row">品牌:<text>{{detail.productBrandName||'--'}}</text></view>
+				<view class="row-ban">原厂编码:<text>{{detail.productOrigCode||'--'}} </text></view>
+				<view class="row-ban">产品编码:<text>{{detail.productCode||'--'}}</text></view>
+				<view class="row-ban">计量单位:<text>{{detail.unit||'--'}}</text></view>
+				<view class="row-ban">包装数:<text>{{ (detail && detail.packQty) || '--' }}{{ (detail && detail.packQty) ? detail.unit : '' }}/{{ detail.packQtyUnit||'--' }}</text></view>
+				<view class="row-ban">尺寸:<text>{{detail.size||'--'}}</text></view>
+				<view class="row-ban">内盒尺寸:<text>{{detail.size||'--'}}</text></view>
+				<view class="row-ban">重量:<text>{{detail.weight||'--'}}</text></view>
+				<view class="row-ban">颜色:<text>{{detail.color||'--'}}</text></view>
+			</view>
+			<view class="product-info-content">
+				<rich-text v-if="detail && detail.description" :nodes="detail.description"></rich-text>
+				<view v-else style="font-size: 12px;color: #999;text-align: center;">暂无产品介绍</view>
 			</view>
-			<view class="product-info-content"></view>
 		</view>
 		<!-- 底部栏 -->
 		<view class="scrollPage-footer">
@@ -73,21 +76,21 @@
 		position="bottom" 
 		custom-style="height:30%"
 		@afterleave="closePopu">
-			<view class="popu-content">
+			<view class="popu-content" v-if="detail">
 				<view class="popu-close" @click="showPopu=false">
 					<uni-icons size="26" type="closeempty"></uni-icons>
 				</view>
 				<view class="pupu-box">
 					<view class="popu-content-img">
-						<image style="width: 100px; height: 100px;" mode="aspectFit" src="https://cdn.uviewui.com/uview/swiper/1.jpg"></image>
+						<image style="width: 100px; height: 100px;" mode="aspectFit" :src="detail.productMsg"></image>
 					</view>
 					<view class="popu-content-info">
-						<view class="popu-content-info-title">【新品】Apple iPhone 13 Pro Max (A2644) 256GB 金色 支持移动联通电信5G 双卡双待手机</view>
+						<view class="popu-content-info-title">{{detail.productName}}</view>
 						<view class="popu-content-box">
-							<view class="popu-content-price">¥<text class="price-red">45.8</text></view>
+							<view class="popu-content-price">¥<text class="price-red">{{detail.price}}</text></view>
 							<view class="popu-content-num flex align_center">
-								<text style="margin-right: 5px;">数量</text>
-								<uni-number-box :min="1" :max="99"></uni-number-box>
+								<text style="margin-right: 10px;">数量</text>
+								<uni-number-box v-model="qty" :min="1" :max="99"></uni-number-box>
 							</view>
 						</view>
 					</view>
@@ -102,44 +105,52 @@
 </template>
 
 <script>
+	import {
+	    mapState,
+	    mapMutations,
+	} from 'vuex'
 	import { addCart, getCartCount } from '@/api/cart.js'
+	import { getShopDetail } from '@/api/shop.js'
+	import { purchaseSave } from '@/api/purchase.js'
 	export default {
 		data() {
 			return {
 				showPopu: false, // 弹框
 				statusBarHeight: 0, // 状态栏高度
 				safeAreaBottom: 0, // 底部安全区域高度
-				imgList: [
-					'https://cdn.uviewui.com/uview/swiper/1.jpg',
-					'https://cdn.uviewui.com/uview/swiper/2.jpg',
-					'https://cdn.uviewui.com/uview/swiper/3.jpg',
-					'https://cdn.uviewui.com/uview/swiper/1.jpg',
-					'https://cdn.uviewui.com/uview/swiper/2.jpg',
-				],
+				imgList: [],
 				totalNum: 0 ,// 购物车总数
-				productSn: null,
-				detail: null
+				shopProductSn: null,
+				detail: null,
+				qty: 1,// 数量
 			}
 		},
 		onLoad(option) {
 			// 计算安全区域
 			this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
 			this.safeAreaBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
-			this.productSn = option.sn
-			// 购物车数量
-			this.cartCount()
+			this.shopProductSn = option.sn
 			// 获取产品详情
-			// this.getDetail()
+			this.getDetail()
+		},
+		onShow(){
+			if(this.hasLogin){
+				// 购物车数量
+				this.cartCount()
+			}
 		},
 		// 分享
 		onShareAppMessage(e){
 			return {
-			  title: '产品标题',
-			  path: '/pagesB/shopiing/productDetail?sn='+this.productSn,
-			  imageUrl:'https://cdn.uviewui.com/uview/swiper/1.jpg',
-			  type: '1',
+			  title: this.detail ? this.detail.productName : '商品名称',
+			  path: '/pagesB/shopiing/productDetail?sn='+this.shopProductSn,
+			  imageUrl:this.detail ? this.detail.productMsg : '',
+			  type: '1'
 			}
 		},
+		computed: {
+			...mapState(['hasLogin'])
+		},
 		methods: {
 			// 返回
 			goBack(){
@@ -151,10 +162,12 @@
 					title: '加载中'
 				})
 				// 获取产品详情
-				getDetail({
-					productSn: this.productSn
+				getShopDetail({
+					shopProductSn: this.shopProductSn
 				}).then(res => {
 					if(res.status == 200){
+						this.detail = res.data
+						this.imgList = [res.data.productMsg]
 					}
 					uni.hideLoading()
 				})
@@ -169,41 +182,87 @@
 	        },
 			// 加入购物车
 			addCart(){
-				addCart({
-					qty:19,
-					price: 10,
-					productSn:13
-				}).then(res => {
-					if(res.status == 200){
-						this.cartCount()
-						uni.showToast({
-							title: '加入成功',
-							icon: 'success'
-						})
-					}
-				})
+				if(this.hasLogin){
+					addCart({
+						qty: 1,
+						price: this.detail.price,
+						productSn: this.detail.productSn
+					}).then(res => {
+						if(res.status == 200){
+							this.cartCount()
+							uni.showToast({
+								title: '加入成功',
+								icon: 'success'
+							})
+						}
+					})
+				}else{
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
+				}
 			},
 			// 打开购物车
 			toCart(){
-				uni.switchTab({
-					url: '/pages/cart/index'
-				})
+				if(this.hasLogin){
+					uni.navigateTo({
+						url: '/pagesB/cart/index'
+					})
+				}else{
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
+				}
 			},
 			// 立即购买
 			toBuy(){
-				// 打开数量选择弹框
-				if(!this.showPopu){
-					this.showPopu = true
+				if(this.hasLogin){
+					// 打开数量选择弹框
+					if(!this.showPopu){
+						this.showPopu = true
+					}else{
+						// 提交
+						this.submitOrder()
+					}
 				}else{
-					// 提交
-					this.submitOk = true
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
 				}
 			},
+			// 去结算
+			submitOrder(){
+				uni.showLoading({
+					title: '提交中...',
+					mask: true
+				})
+				const detailList = [{
+							productSn:this.detail.productSn,
+							productCode:this.detail.productCode,
+							qty: this.qty,
+							price:this.detail.price,
+						}]
+				purchaseSave({
+					detailList: detailList
+				}).then(res => {
+					if(res.status == 200){
+						res.data.detailList = []
+						this.$store.state.vuex_tempData = res.data
+						this.showPopu = false
+						this.submitOk = true
+					}else{
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+					}
+				})
+			},
 			// 关闭后
 			closePopu(){
 				this.showPopu = false
+				this.qty = 1
 				uni.hideLoading()
-				
 				// 提交成功
 				if(this.submitOk){
 					uni.navigateTo({
@@ -434,7 +493,7 @@
 					margin-top: 10px;
 					.popu-content-price{
 						font-size: 14px;
-						color: #eb0000;
+						color: #d50e0e;
 						.price-red{
 							font-size: 24px;
 						}
@@ -452,9 +511,9 @@
 					justify-content: center;
 					margin-top: 20px;
 					.popu-content-btn-item{
-						width: 100%;
+						width: 50%;
 						height: 40px;
-						background-color: #eb0000;
+						background-color: #d50e0e;
 						color: #FFFFFF;
 						font-size: 14px;
 						display: flex;

+ 105 - 26
pagesB/shopiing/searchProduct.vue

@@ -13,18 +13,20 @@
 			</view>
 		</view>
 		<view class="search-result">
-			<view class="tab-left" v-if="clzId">
-				<view class="item-clz active">滤清器</view>
-				<view class="item-clz">机油</view>
-				<view class="item-clz">轮胎</view>
-				<view class="item-clz">火花塞</view>
-				<view class="item-clz">刹车片</view>
+			<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?'75%':'100%'}">
+			<view class="right-box" :style="{width:clzId&&categoryList.length?'75%':'100%'}">
 				<!-- body -->
 				<scroll-view 
 				class="scrollPage-body" 
-				:class="clzId?'right-item':''"
+				:class="clzId&&categoryList.length?'right-item':''"
 				:style="{height: (screenHeight - statusBarHeight - safeAreaBottom - 40) + 'px'}" 
 				scroll-y="true" 
 				type="custom" 
@@ -32,7 +34,7 @@
 					<!-- 搜索,吸顶 -->
 					<sticky-header>
 						<view class="search-head">
-							<uni-search-bar v-model="queryWord" :focus="focus" radius="100" placeholder="请输入商品名称/产品编码/原厂编码" :bgColor="clzId?'#f5f5f5':'#fff'" textColor="#666" clearButton="auto" cancelButton="none" @confirm="searchList" @clear="searchList" />
+							<uni-search-bar v-model="queryWord" :focus="focus" radius="100" placeholder="请输入商品名称/产品编码/原厂编码" :bgColor="clzId?'#f5f5f5':'#fff'" textColor="#666" clearButton="auto" cancelButton="none" @confirm="searchList" @clear="clearList" />
 						</view>
 					</sticky-header>
 					<!-- 产品列表 -->
@@ -42,13 +44,14 @@
 					:index="index"
 					:list="item" 
 					:isView="true"
+					@toDetail="viewDetail"
 					>
 					</chooseProductItem>
 					<!-- loading -->
-					<view class="loading-bar" v-if="list.length && (loading||loadEnd)">{{loadText}}</view>
+					<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 v-if="queryWord!=''&&clzId!=''">{{empty.tip}}</view>
+						<view>{{empty.tip}}</view>
 					</view>
 					<!-- 搜索记录 -->
 					<view class="search-history" v-if="historyList.length&&queryWord==''&&clzId==''">
@@ -76,18 +79,17 @@
 
 <script>
 	import chooseProductItem from '@/pagesB/components/chooseProductItemSkline.vue'
-	import { queryPromoProductByPage } from '@/api/video.js'
+	import { getShopCategoryExt, getShopProductList } from '@/api/shop.js'
 	export default {
 		components:{
 			chooseProductItem
 		},
 		data() {
 			return {
-				clzId: null,
 				title: '',
 				loadText: '加载中...',
 				empty: {
-					tip: '',
+					tip: '暂无商品',
 					imgUrl: '/static/nodata.png'
 				},
 				queryWord:'',
@@ -103,7 +105,10 @@
 				loadEnd: false,
 				searchHistoryList: [],
 				focus: false,
-				expend: false
+				expend: false,
+				clzId: null, // 一级分类
+				categorySn: null ,// 当前分类sn
+				categoryList: [], // 二级分类列表
 			};
 		},
 		computed: {
@@ -118,7 +123,7 @@
 			this.screenHeight = uni.getSystemInfoSync().windowHeight
 			this.safeAreaBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
 			
-			// 分类id
+			// 一级分类id
 			this.clzId = opts.clzId
 			
 			// 搜索商品
@@ -128,13 +133,15 @@
 			}else{
 				// 分类下产品
 				this.title = opts.clzName
-				this.searchList()
+				// 查二级目录
+				this.getCategory()
 			}
 			
 			// 搜索历史
 			this.searchHistoryList = uni.getStorageSync('searchHistoryList') || []
 		},
 		methods: {
+			// 返回
 			goBack(){
 				uni.navigateBack()
 			},
@@ -153,11 +160,69 @@
 					}
 				})
 			},
+			// 清空搜索
+			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 = '没有找到相关产品'
+				}
+			},
 			// 选择搜索记录
 			toSearch(item){
 				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.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
+							  })
+							})
+							// 追加数据
+							this.list.push(ret)
+						}
+					}
+				})
+			},
 			// 搜索列表
 			searchList(event) {
 				 //  存储搜索记录
@@ -176,6 +241,11 @@
 				 this.pageNo = 1
 				 this.getList()
 			},
+			// 单击二级分类
+			handleTab(item){
+				this.categorySn = item.categorySn
+				this.searchList()
+			},
 			// 滚动到底部
 			reachBottom() {
 				if(!this.loading && !this.loadEnd){
@@ -186,15 +256,15 @@
 			// 列表查询
 			getList(){
 				this.loading = true
-				queryPromoProductByPage({
+				getShopProductList({
 					pageNo: this.pageNo,
 					pageSize: this.pageSize,
 					queryWord: this.queryWord,
-					promoActiveSn: '692378329129918464'
+					categorySn: this.categorySn
 				}).then(res => {
 					this.loading = false
 					if(res.status == 200){
-						this.total = res.data.count
+						this.total = Number(res.data.count)
 						if(this.total){
 							const list = res.data.list || []
 							const ret = []
@@ -202,16 +272,19 @@
 							list.forEach(k => {
 							  ret.push({
 								  id: k.id,
-								  cost: k.cost,
+								  price: k.price,
 								  productCode: k.productCode,
 								  productSn: k.productSn,
-								  productImage: k.productImage,
+								  productImage: k.productMsg,
 								  productName: k.productName,
 								  productOrigCode: k.productOrigCode,
-								  promoActiveSn: k.promoActiveSn,
-								  promoRuleSn: k.promoRuleSn,
-								  promoRuleValue: k.promoRuleValue,
-								  promoRuleType: k.promoRuleType,
+								  categorySn: k.categorySn,
+								  hotFlag: k.hotFlag,
+								  productSn: k.productSn,
+								  priceType: k.priceType,
+								  shopProductSn: k.shopProductSn,
+								  status: k.status,
+								  statusDictValue: k.statusDictValue
 							  })
 							})
 							// 追加数据
@@ -234,6 +307,12 @@
 					this.loading = false
 				})
 			},
+			// 产品详情查看
+			viewDetail(item){
+				uni.navigateTo({
+					url:'/pagesB/shopiing/productDetail?sn='+item.shopProductSn
+				})
+			}
 		}
 	}
 </script>

BIN
static/temp/t1.jpeg


BIN
static/temp/t10.jpg


BIN
static/temp/t11.jpg


BIN
static/temp/t12.jpg


BIN
static/temp/t2.jpeg


BIN
static/temp/t3.jpg


BIN
static/temp/t4.jpg


BIN
static/temp/t5.png


BIN
static/temp/t6.jpeg


BIN
static/temp/t7.jpg


BIN
static/temp/t8.jpg


BIN
static/temp/t9.jpg