Procházet zdrojové kódy

commit -m 商品模块化联调

zhengjinyi před 4 roky
rodič
revize
24bf8faf5c

+ 12 - 14
components/cm-module/cm-seller/category.vue

@@ -16,11 +16,11 @@
 			<!--右侧子导航-->
 			<scroll-view  scroll-y="true" class="right-aside" :style="{top:(CustomBar+38)+'px',height:(windowHeight-CustomBar+38)+'px'}">
 				<view class="category" v-for="(first,index) in categoryList" :key="index" v-show="index==showCategoryIndex" >
-					<template v-if="first.smalltypeList">
-						<view class="category-box AAA" v-for="(small,oIndex) in first.smalltypeList" :key="oIndex">
+					<template v-if="first.smallTypeList && first.smallTypeList.length > 0">
+						<view class="category-box AAA" v-for="(small,oIndex) in first.smallTypeList" :key="oIndex">
 							<view class="title">{{small.name}}</view>
-							<view class="list" v-if="small.tinytypeList.length > 0">
-								<view class="box" v-for="(pro,proIndex) in small.tinytypeList" :key="proIndex" @click.stop="navToListPage(pro,3)">
+							<view class="list" v-if="small.tinyTypeList && small.tinyTypeList.length > 0">
+								<view class="box" v-for="(pro,proIndex) in small.tinyTypeList" :key="proIndex" @click.stop="navToListPage(pro,3)">
 									<image :src="pro.crmIcon ? pro.crmIcon : 'https://static.caimei365.com/app/img/icon/icon-noneproduct.jpg'"></image>
 									<view class="text">{{pro.name}}</view>
 								</view>
@@ -39,7 +39,7 @@
 							<view class="no-data">
 								<view class="box" @click.stop="navToListPage(first,1)">
 									<image :src="first.crmIcon ? first.crmIcon : 'https://static.caimei365.com/app/img/icon/icon-noneproduct.jpg'"></image>
-									<view class="text">全部商品</view>
+									<view class="text">全部商品a</view>
 								</view>
 							</view>
 						</view>
@@ -80,8 +80,7 @@
 			this.initData();
 		},
 		methods: {
-			// 数据初始化
-			initData() {
+			initData() {// 数据初始化
 				this.GetProductCate(this.categoryTabIndex);
 				const {windowHeight, pixelRatio} = wx.getSystemInfoSync();
 				this.windowHeight = windowHeight - 1;
@@ -91,13 +90,12 @@
 				this.categoryList = []
 				this.GetProductCate(data);
 			},
-			// 获取商品分类列表
-			GetProductCate (index) {
+			GetProductCate (index) {// 获取商品分类列表
 				this.CommonService.GetFirstClassly({typeSort:index,source :'crm'}).then(response =>{
 					this.categoryList = response.data
 					// 查询第一个拥有二级菜单的子菜单
 					for (let i = 0; i < this.categoryList.length; i++) {
-						if (this.categoryList[i].smalltypeList.length > 0) {
+						if (this.categoryList[i].smallTypeList.length > 0) {
 							this.showCategoryIndex = i;
 							break;
 						}
@@ -113,19 +111,19 @@
 			},
 			toSearch () {// 跳转至搜索详情页
 				uni.navigateTo({
-					url: `/search/pages/search/search?search=${JSON.stringify(this.search)}`
+					url: `/pages/search/search?search=${JSON.stringify(this.search)}`
 				})
 			},
 			navToListPage(item,index){//分类导航跳转
 				switch(index){
 					case 1:
-						this.$api.navigateTo(`/pages/goods/goods-classify?classType=1&id=${item.bigTypeID}&title=${item.name}`)
+						this.$api.navigateTo(`/pages/goods/goods-classify?classType=1&id=${item.bigTypeId}&title=${item.name}`)
 						break;
 					case 2:
-						this.$api.navigateTo(`/pages/goods/goods-classify?classType=2&id=${item.smallTypeID}&title=${item.name}`)
+						this.$api.navigateTo(`/pages/goods/goods-classify?classType=2&id=${item.smallTypeId}&title=${item.name}`)
 						break;
 					case 3:
-						this.$api.navigateTo(`/pages/goods/goods-classify?classType=3&id=${item.tinyTypeID}&title=${item.name}`)
+						this.$api.navigateTo(`/pages/goods/goods-classify?classType=3&id=${item.tinyTypeId}&title=${item.name}`)
 						break;
 				}
 			},

+ 1 - 1
components/cm-module/pageTemplate/templateNav.vue

@@ -37,7 +37,7 @@
 				console.log(this.navList)
 			},
 			NavToDetailPage(item){//分类导航跳转
-				this.$api.navigateTo(`/pages/goods/goods-classify?classType=1&id=${item.bigTypeID}&title=${item.name}`)
+				this.$api.navigateTo(`/pages/goods/goods-classify?classType=1&id=${item.bigTypeId}&title=${item.name}`)
 				// uni.setStorage({
 				// 	key: 'commodity_id',
 				// 	data: pro.tinyTypeID,

+ 12 - 14
components/cm-module/supplier/category.vue

@@ -16,11 +16,11 @@
 			<!--右侧子导航-->
 			<scroll-view  scroll-y="true" class="right-aside" :style="{top:(CustomBar+38)+'px',height:(windowHeight-CustomBar+38)+'px'}">
 				<view class="category" v-for="(first,index) in categoryList" :key="index" v-show="index==showCategoryIndex" >
-					<template v-if="first.smalltypeList">
-						<view class="category-box AAA" v-for="(small,oIndex) in first.smalltypeList" :key="oIndex">
+					<template v-if="first.smallTypeList && first.smallTypeList.length > 0">
+						<view class="category-box AAA" v-for="(small,oIndex) in first.smallTypeList" :key="oIndex">
 							<view class="title">{{small.name}}</view>
-							<view class="list" v-if="small.tinytypeList.length > 0">
-								<view class="box" v-for="(pro,proIndex) in small.tinytypeList" :key="proIndex" @click.stop="navToListPage(pro,3)">
+							<view class="list" v-if="small.tinyTypeList && small.tinyTypeList.length > 0">
+								<view class="box" v-for="(pro,proIndex) in small.tinyTypeList" :key="proIndex" @click.stop="navToListPage(pro,3)">
 									<image :src="pro.crmIcon ? pro.crmIcon : 'https://static.caimei365.com/app/img/icon/icon-noneproduct.jpg'"></image>
 									<view class="text">{{pro.name}}</view>
 								</view>
@@ -39,7 +39,7 @@
 							<view class="no-data">
 								<view class="box" @click.stop="navToListPage(first,1)">
 									<image :src="first.crmIcon ? first.crmIcon : 'https://static.caimei365.com/app/img/icon/icon-noneproduct.jpg'"></image>
-									<view class="text">全部商品</view>
+									<view class="text">全部商品a</view>
 								</view>
 							</view>
 						</view>
@@ -80,8 +80,7 @@
 			this.initData();
 		},
 		methods: {
-			// 数据初始化
-			initData() {
+			initData() {// 数据初始化
 				this.GetProductCate(this.categoryTabIndex);
 				const {windowHeight, pixelRatio} = wx.getSystemInfoSync();
 				this.windowHeight = windowHeight - 1;
@@ -91,13 +90,12 @@
 				this.categoryList = []
 				this.GetProductCate(data);
 			},
-			// 获取商品分类列表
-			GetProductCate (index) {
+			GetProductCate (index) {// 获取商品分类列表
 				this.CommonService.GetFirstClassly({typeSort:index,source :'crm'}).then(response =>{
 					this.categoryList = response.data
 					// 查询第一个拥有二级菜单的子菜单
 					for (let i = 0; i < this.categoryList.length; i++) {
-						if (this.categoryList[i].smalltypeList.length > 0) {
+						if (this.categoryList[i].smallTypeList.length > 0) {
 							this.showCategoryIndex = i;
 							break;
 						}
@@ -113,19 +111,19 @@
 			},
 			toSearch () {// 跳转至搜索详情页
 				uni.navigateTo({
-					url: `/search/pages/search/search?search=${JSON.stringify(this.search)}`
+					url: `/pages/search/search?search=${JSON.stringify(this.search)}`
 				})
 			},
 			navToListPage(item,index){//分类导航跳转
 				switch(index){
 					case 1:
-						this.$api.navigateTo(`/pages/goods/goods-classify?classType=1&id=${item.bigTypeID}&title=${item.name}`)
+						this.$api.navigateTo(`/pages/goods/goods-classify?classType=1&id=${item.bigTypeId}&title=${item.name}`)
 						break;
 					case 2:
-						this.$api.navigateTo(`/pages/goods/goods-classify?classType=2&id=${item.smallTypeID}&title=${item.name}`)
+						this.$api.navigateTo(`/pages/goods/goods-classify?classType=2&id=${item.smallTypeId}&title=${item.name}`)
 						break;
 					case 3:
-						this.$api.navigateTo(`/pages/goods/goods-classify?classType=3&id=${item.tinyTypeID}&title=${item.name}`)
+						this.$api.navigateTo(`/pages/goods/goods-classify?classType=3&id=${item.tinyTypeId}&title=${item.name}`)
 						break;
 				}
 			},

+ 38 - 29
pages/goods/goods-classify.vue

@@ -41,20 +41,20 @@
 			</view>
 			<template v-else>
 				<view class="container-list" :style="{'height':scrollHeight+'px',paddingTop:(CustomBar+44)+'px'}">
-					<view v-for="(item,index) in listData" :key="index" :id="item.p_id" class="all-type-list-content commodity-list" @click.stop="navToDetailPage(item.p_id)">
-						<image mode='widthFix' :src="item.p_image"  class="list-img" alt="list-img"></image>
+					<view v-for="(item,index) in listData" :key="index" :id="item.productId" class="all-type-list-content commodity-list" @click.stop="navToDetailPage(item.productId)">
+						<image mode='widthFix' :src="item.image"  class="list-img" alt="list-img"></image>
 						<view class="list-details-info">
 							<text class="list-details-title">
-								<text class="mclap-tag" v-if="item.p_act_flag == '1'">美博会</text>
-								<text class="mclap" :class="item.p_act_flag =='1' ? 'indent' : ''">{{ item.p_name }}</text>
+								<text class="mclap-tag" v-if="item.beautyActFlag == 1">美博会</text>
+								<text class="mclap" :class="item.beautyActFlag == 1 ? 'indent' : ''">{{ item.name }}</text>
 							</text>
-							<text class="list-details-specs">规格:{{item.p_unit}}</text>
-							<view class="list-details-specs" v-if="item.p_code!=''&&item.p_code!=null">商品编码:{{item.p_code}}</view>
+							<text class="list-details-specs">规格:{{item.unit}}</text>
+							<view class="list-details-specs" v-if="item.code!=''&&item.code!=null">商品编码:{{item.code}}</view>
 							<view class="list-details-price">
 								<template v-if="userIdentity == 3">
 									<view class="floor-item-act" v-if="item.actStatus==1">
 										<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-											{{item.promotions.name}}<text v-if="item.p_price_flag != '1' && item.supplierId === shopId">:¥{{ item.price | NumFormat }}</text>
+											{{item.promotions.name}}<text v-if="item.priceFlag != 1 && item.supplierId === shopId">:¥{{ item.price | NumFormat }}</text>
 										</view>
 										<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
 									</view>
@@ -65,7 +65,7 @@
 								<template v-else>
 									<view class="floor-item-act" v-if="item.actStatus==1">
 										<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-											{{item.promotions.name}}<text v-if="hasLogin && item.p_price_flag != '1'">:¥{{ item.price | NumFormat }}</text>
+											{{item.promotions.name}}<text v-if="hasLogin && item.priceFlag != 1">:¥{{ item.price | NumFormat }}</text>
 										</view>
 										<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
 									</view>
@@ -83,10 +83,10 @@
 										</template>
 									</template>	
 									<template v-if="userIdentity == 4">
-										<view class="price-larger" v-if="item.p_price_flag == '1'">
+										<view class="price-larger" v-if="item.priceFlag == 1">
 											<text class="txt">¥未公开价格</text>
 										</view>
-										<view class="price-larger" v-if="item.p_price_flag == '2'">
+										<view class="price-larger" v-if="item.priceFlag == 1">
 											<text class="txt">¥价格仅会员可见</text>
 										</view>
 										<text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
@@ -98,7 +98,7 @@
 									</template>
 									<template v-if="userIdentity == 3">
 										<template v-if="item.supplierId === shopId">
-											<view class="price-larger" v-if="item.p_price_flag == '1'">
+											<view class="price-larger" v-if="item.priceFlag == 1">
 												<text class="txt">¥未公开价格</text>
 											</view>
 											<text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
@@ -109,12 +109,12 @@
 										<template v-else>
 											<view  class="list-login-now">
 												<text class="p-no">¥</text>
-												<uni-grader :grade="Number(item.p_price_grade)"></uni-grader>
+												<uni-grader :grade="Number(item.priceGrade)"></uni-grader>
 											</view>
 										</template>
 									</template>
 									<template v-if="userIdentity == 2">
-										<view class="price-larger" v-if="item.p_price_flag == '1'">
+										<view class="price-larger" v-if="item.priceFlag == 1">
 											<text class="txt">¥未公开价格</text>
 										</view>
 										<text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
@@ -127,7 +127,7 @@
 								</view>	
 								<view  v-else class="list-login-now">
 									<text class="p-no">¥</text>
-									<uni-grader :grade="Number(item.p_price_grade)"></uni-grader>
+									<uni-grader :grade="Number(item.priceGrade)"></uni-grader>
 								</view>
 							</view>
 						</view>
@@ -144,11 +144,11 @@
 			<view class="drawer-container clearfix" :style="{paddingTop:CustomBar+'px'}">
 				<view class="drawer-title">{{ classData.name }}</view>
 				<view class="drawer-main">
-					<template v-if="classData.smalltypeList">
-						<view class="drawer-item-cell" v-for="(item,index) in classData.smalltypeList" :key="index">
+					<template v-if="classData.smallTypeList">
+						<view class="drawer-item-cell" v-for="(item,index) in classData.smallTypeList" :key="index">
 							<view class="drawer-item-title">{{ item.name }}</view>
-							<view class="drawer-item-main" v-if="item.tinytypeList">
-								<text class="drawer-item-text" :class="tiny.isChecked ? 'checked' : ''" v-for="(tiny,tinyIndex) in item.tinytypeList" :key="tinyIndex"  @click="SearchCondition(3,item,tiny)">{{ tiny.name }}</text>
+							<view class="drawer-item-main" v-if="item.tinyTypeList">
+								<text class="drawer-item-text" :class="tiny.isChecked ? 'checked' : ''" v-for="(tiny,tinyIndex) in item.tinyTypeList" :key="tinyIndex"  @click="SearchCondition(3,item,tiny)">{{ tiny.name }}</text>
 							</view>
 							<view class="drawer-item-main" v-else>
 								<text class="drawer-item-text" :class="item.isChecked ? 'checked' : ''" @click="SearchCondition(2,item)">全部商品</text>
@@ -182,9 +182,9 @@
 	import modalLayer from "@/components/modal-layer"
 	import authorize from '@/common/config/authorize.js'
 	import wxLogin from "@/common/config/wxLogin.js"
-	
 	const defaultListQuery = {
 			id:0,
+			identity:0,
 			pageNum:1,
 			pageSize:10,
 			sortField:'',
@@ -200,7 +200,7 @@
 		},
 		data(){
 			return{
-				shopID:0,
+				shopId:0,
 				tabIndex:0,
 				isModallayer:false,
 				isSearchSalesFirst:true,
@@ -217,7 +217,7 @@
 				isRequest:false,
 				showSkeleton: true,
 				showEmpty: false,
-				userID: 0,
+				userId: 0,
 				userIdentity:'',
 				listData: [],
 				windowHeight: '',
@@ -260,11 +260,12 @@
 		methods:{
 			InitOption(option) {
 				this.listQuery.id = option.id;
+				this.listQuery.identity = this.identity;
 				this.listQuery.idType = this.classifyType = Number(option.classType);
 				uni.setNavigationBarTitle({title:option.title});
 				this.$api.getComStorage('userInfo').then((resolve) =>{
-					this.userID = resolve.userId ? resolve.userId : 0
-					this.shopID = resolve.shopId ? resolve.shopId : 0
+					this.userId = resolve.userId ? resolve.userId : 0
+					this.shopId = resolve.shopId ? resolve.shopId : 0
 					this.userIdentity = resolve.userIdentity
 					this.isRequest = true
 					this.GetProductListInfo()
@@ -276,10 +277,17 @@
 				console.log(this.classifyID)
 			},
 			GetProductOneClassly(){//根据分类ID 查询二三级分类
-				this.CommonService.GetProductOneClassly({typeId:this.listQuery.id,idType:this.classifyType,source :'crm'}).then(response =>{
-					console.log(response.data)
+				this.CommonService.GetProductOneClassly(
+					{
+						typeId:this.listQuery.id,
+						idType:this.classifyType,
+						source :'crm',
+					}
+				)
+				.then(response =>{
 					this.classData = response.data
-				}).catch(error =>{
+				})
+				.catch(error =>{
 					this.$util.msg(error.msg,2000)
 				})
 			},
@@ -312,6 +320,7 @@
 								this.nomoreText = '已至底部'
 							}
 						}
+						console.log(this.listData)
 					} else {
 						this.showEmpty = true;
 					}
@@ -346,11 +355,11 @@
 			GetProductPrice(){//获取价格
 				let productIdArr = [];
 				this.listData.map(item=>{// 0公开价格 1不公开价格 2仅对会员机构公开
-					productIdArr.push(item.p_id)
+					productIdArr.push(item.productId)
 				})
 				this.priceLoading = true;
 				this.productIds = productIdArr.join(",");
-				this.ProductService.querySearchProductPrice({userId: this.userID,productIds:this.productIds}).then(response =>{
+				this.ProductService.querySearchProductPrice({userId: this.userId,productIds:this.productIds}).then(response =>{
 					if(response.data) {
 						this.listData = this.ReturnNewProducts(this.listData,response.data);
 					}
@@ -363,7 +372,7 @@
 				let NewArray = []
 				Array.map(item=>{
 					for (let i = 0; i < list.length; i++) {
-						if( item.p_id == list[i].productId ){
+						if( item.productId == list[i].productId ){
 							NewArray.push(Object.assign(item,list[i])) 
 						}
 					}

+ 1 - 1
pages/tabBar/category/index.vue

@@ -93,7 +93,7 @@
 					this.categoryList = response.data
 					// 查询第一个拥有二级菜单的子菜单
 					for (let i = 0; i < this.categoryList.length; i++) {
-						if (this.categoryList[i].smalltypeList.length > 0) {
+						if (this.categoryList[i].smallTypeList.length > 0) {
 							this.showCategoryIndex = i;
 							break;
 						}

+ 2 - 1
services/common.service.js

@@ -133,9 +133,10 @@ export default class CommonService {
 	/* 根据一、二、三级分类ID查询单条分类 */
 	GetProductOneClassly (data = {}) {
 		return this.AjaxService.get({ 
-			url:'/product/typeId/classify', 
+			url:'/commodity/type/id', 
 			data, 
 			isLoading: false ,
+			isHost:true
 		})
 	}
 	

+ 2 - 2
services/product.service.js

@@ -181,7 +181,7 @@ export default class ProductService {
 		return this.AjaxService.get({ 
 			url:'/commodity/search/query/product/type', 
 			data, 
-			isLoading: true ,
+			isLoading: true,
 			isHost:true
 		})
 	}
@@ -198,7 +198,7 @@ export default class ProductService {
 		return this.AjaxService.get({ 
 			url:'/commodity/price/ladder', 
 			data, 
-			isLoading: false ,
+			isLoading: false,
 			isHost:true
 		})
 	}