浏览代码

commit -m 商品模块化联调

zhengjinyi 4 年之前
父节点
当前提交
30072af159

+ 14 - 14
components/cm-module/productDetails/cm-price.vue

@@ -4,7 +4,7 @@
 		<template v-if="!hasLogin">
 			<view class="p-login grade tui-skeleton-fillet">
 				<text class="p-no">¥</text>
-				<uni-grader :grade="Number(product.price1Grade)"></uni-grader>
+				<uni-grader :grade="Number(product.priceGrade)"></uni-grader>
 				<view v-if="product.actStatus==1" class="floor-item-act">
 					<view v-if="product.promotions.type == 1 && product.promotions.mode==1"  class="floor-tags" @click.stop="clickPopupShow()">
 						{{product.promotions.name}}<text v-if="hasLogin">:¥{{ product.price | NumFormat }}</text>
@@ -25,7 +25,7 @@
 				<view class="wrap-main-item">
 					<view class="p-price tui-skeleton-fillet" :class="PromotionsFormat(product.promotions) ? 'none' : ''">
 						<text class="txt sm">¥</text>
-						<text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.price1 : product.retailPrice) | NumFormat }}</text>
+						<text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.originalPrice : product.price) | NumFormat }}</text>
 					</view>
 					<view v-if="product.actStatus==1" class="floor-item-act">
 						<view v-if="product.promotions.type == 1 && product.promotions.mode == 1"  class="floor-tags" @click.stop="clickPopupShow(1)">
@@ -41,14 +41,14 @@
 			<!-- 会员机构  -->
 			<template v-if="userIdentity == 2">
 				<view class="wrap-main-item">
-					<view v-if="product.price1TextFlag == '1'" class="wrap-main-text">¥未公开价格</view>
+					<view v-if="product.priceFlag == 1" class="wrap-main-text">¥未公开价格</view>
 					<view v-else class="p-price tui-skeleton-fillet" :class="PromotionsFormat(product.promotions) ? 'none' : ''">
 						<text class="txt sm">¥</text>
-						<text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.price1 : product.retailPrice) | NumFormat }}</text>
+						<text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.originalPrice : product.price) | NumFormat }}</text>
 					</view>
 					<view v-if="product.actStatus==1" class="floor-item-act">
 						<view v-if="product.promotions.type == 1 && product.promotions.mode == 1"  class="floor-tags" @click.stop="clickPopupShow(1)">
-							{{product.promotions.name}}<text v-if="hasLogin && product.price1TextFlag != '1'">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
+							{{product.promotions.name}}<text v-if="hasLogin && product.priceFlag != 1">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
 						</view>
 						<view v-else class="floor-tags" @click.stop="clickPopupShow()">{{product.promotions.name}}</view>	
 					</view>
@@ -61,14 +61,14 @@
 			<template v-if="userIdentity == 3">
 				<template v-if="product.shopID === shopID">
 					<view class="wrap-main-item">
-						<view v-if="product.price1TextFlag == '1'" class="wrap-main-text">¥未公开价格</view>
+						<view v-if="product.priceFlag == 1" class="wrap-main-text">¥未公开价格</view>
 						<view v-else class="p-price tui-skeleton-fillet" :class="PromotionsFormat(product.promotions) ? 'none' : ''">
 							<text class="txt sm">¥</text>
-							<text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.price1 : product.retailPrice) | NumFormat }}</text>
+							<text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.originalPrice : product.price) | NumFormat }}</text>
 						</view>
 						<view v-if="product.actStatus==1" class="floor-item-act">
 							<view v-if="product.promotions.type == 1 && product.promotions.mode == 1"  class="floor-tags" @click.stop="clickPopupShow(1)">
-								{{product.promotions.name}}<text v-if="hasLogin && product.price1TextFlag != '1'">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
+								{{product.promotions.name}}<text v-if="hasLogin && product.priceFlag != 1">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
 							</view>
 							<view v-else class="floor-tags" @click.stop="clickPopupShow()">{{product.promotions.name}}</view>	
 						</view>
@@ -80,30 +80,30 @@
 				<template v-else>
 					<view class="p-login grade tui-skeleton-fillet">
 						<text class="p-no">¥</text>
-						<uni-grader :grade="Number(product.price1Grade)"></uni-grader>
+						<uni-grader :grade="Number(product.priceGrade)"></uni-grader>
 					</view>
 				</template>	
 			</template>
 			<!-- 普通机构  -->
 			<template v-if="userIdentity == 4">
-				<template v-if="product.price1TextFlag == '1'">
+				<template v-if="product.priceFlag == 1">
 					<text class="wrap-main-text">¥未公开价格</text>
 				</template>
-				<template v-if="product.price1TextFlag == '2'">
+				<template v-if="product.priceFlag == 2">
 					<text class="wrap-main-text">¥价格仅会员可见</text>
 					<view class="floor-item-btn">
 						<view class="btn" @click.stop="goUpgradeApply">升级会员查看价格</view>
 					</view>
 				</template>
-				<template v-if="product.price1TextFlag == '0'">
+				<template v-if="product.priceFlag == 0">
 					<view class="wrap-main-item">
 						<view class="p-price tui-skeleton-fillet" :class="PromotionsFormat(product.promotions) ? 'none' : ''">
 							<text class="txt sm">¥</text>
-							<text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.price1 : product.retailPrice) | NumFormat }}</text>
+							<text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.originalPrice : product.price) | NumFormat }}</text>
 						</view>
 						<view v-if="product.actStatus==1" class="floor-item-act">
 							<view v-if="product.promotions.type == 1 && product.promotions.mode == 1"  class="floor-tags" @click.stop="clickPopupShow(1)">
-								{{product.promotions.name}}<text v-if="hasLogin && product.price1TextFlag != '1'">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
+								{{product.promotions.name}}<text v-if="hasLogin && product.priceFlag != 1">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
 							</view>
 							<view v-else class="floor-tags" @click.stop="clickPopupShow()">{{product.promotions.name}}</view>	
 						</view>

+ 1 - 1
components/cm-module/productDetails/recommend.vue

@@ -85,7 +85,7 @@
 		padding: 0 24rpx;
 		font-size: $font-size-28;
 		color: #999999;
-		text-align: center;
+		text-align: left;
 	}
 	.recommend-list{
 		width: 100%;

+ 30 - 17
pages/goods/product.vue

@@ -121,7 +121,7 @@
 						<view class="title-tab">商品详情</view>
 					</view>
 					<view class="content tui-banner product-rich-text tui-skeleton-rect">
-						<parser :html="html" :img-mode="widthFix" v-if="!goodsData.isNoneDisabled"></parser>
+						<parser :html="html" :img-mode="widthFix" v-if="!goodsData.isNoneDisabled && product.productDetail.detailInfo"></parser>
 						<view class="product-rich-text-none" v-else>暂无商品信息</view>
 					</view>
 				</view>	
@@ -143,7 +143,7 @@
 						<view class="title-tab">相关推荐</view>
 					</view>
 					<view class="content hot">
-						<recommend :query-productid="product.productID" :query-type="product.recommendType" v-if="isRequest"></recommend>
+						<recommend :query-productid="product.productId" :query-type="product.recommendType" v-if="isRequest"></recommend>
 					</view>
 				</view>	
 				<!-- 商品参数 -->
@@ -319,9 +319,9 @@
 				disabled:false,
 				isNoneDisabled:false,
 				tabCurrentIndex:0,
-				userID:'',
+				userId:'',
 				shopID:'',
-				productID:0,
+				productId:0,
 				userIdentity:0,//用户类型
 				goodsData:{},//自定义数据
 				shop:{},//供应商信息
@@ -361,7 +361,7 @@
 			...mapState(['hasLogin','isWxAuthorize','identity'])
 		},
 		onLoad(option) {
-			this.productID = option.id;//获取商品ID
+			this.productId = option.id;//获取商品ID
 			this.isShareType = option.type
 			this.linkPath = option.path
 			this.isHeaderPoduct = true
@@ -380,7 +380,14 @@
 		},
 		methods:{
 			initData(){// 初始化商品详情查询
-				this.ProductService.queryProductDetils({userId:this.userID,productID:this.productID,identity:this.identity}).then(response =>{	
+				this.ProductService.QueryProductDetils(
+					{
+						userId:this.userId,
+						productId:this.productId,
+						identity:this.identity,
+					}
+				)
+				.then(response =>{	
 					this.skeletonShow = false
 					this.productImage=[];
 					this.shop = response.data.shop
@@ -418,9 +425,16 @@
 						this.buyRetailPrice = this.product.retailPrice;
 					}
 					//处理下架商品和售罄商品
-					if(this.product.validFlag =='3' || this.stock == 0 || this.product.price1TextFlag == "1"){
-						this.disabled = true
+					if(this.product.validFlag =='3' || this.stock == 0){
 						this.isNoneDisabled = true
+						this.disabled = true
+					}else{			
+						this.disabled = false
+						this.isNoneDisabled = false
+						this.goodsData.disabledText = ''
+					}
+					if(this.product.price1TextFlag == "1"){
+						this.disabled = true
 					}else if(this.product.price1TextFlag == "2"){
 						if(this.userIdentity == 4){
 							this.disabled = true
@@ -429,8 +443,6 @@
 						}
 					}else{
 						this.disabled = false
-						this.isNoneDisabled = false
-						this.goodsData.disabledText = ''
 					}
 					this.goodsData.disabled = this.disabled
 					this.goodsData.isNoneDisabled = this.isNoneDisabled
@@ -447,7 +459,8 @@
 						this.getSectionProps();
 					},2000)
 					this.isRequest = true
-				}).catch(error =>{
+				})
+				.catch(error =>{
 					this.$util.msg(error.msg,2000);
 				})
 			},
@@ -580,7 +593,7 @@
 				let productStp ={
 						allPrice:this.number*this.buyRetailPrice,
 						allCount:this.number,
-						productID:this.product.productID,
+						productID:this.product.productId,
 						productCount:this.number
 				}	
 				this.$api.navigateTo(`/pages/user/order/create-order?type=prodcut&data=${JSON.stringify({data:productStp})}`)
@@ -589,7 +602,7 @@
 				}, 200);
 			},
 			getAddProductCart(){//增加购物车成功和toast弹窗提示成功	
-				this.ProductService.shoppingAddCart({productID:this.productID,userID:this.userID,productCount:this.number}).then(response => {
+				this.ProductService.shoppingAddCart({productID:this.productId,userID:this.userId,productCount:this.number}).then(response => {
 					this.specClass = 'hide';
 					this.$util.msg('加入购物车成功',1500,true,'success')
 					this.isAnimation = true
@@ -603,7 +616,7 @@
 			navToLogin(){
 				if(uni.getStorageSync('_WX_State')){
 					this.$store.commit('setLoginType',8)
-					this.$store.commit('setLoginProductId',this.productID)
+					this.$store.commit('setLoginProductId',this.productId)
 					this.$api.navigateTo(`/pages/login/login?id=${this.productID}`)
 				}else{
 					console.log(new Date +'用户未授权微信信息')
@@ -641,7 +654,7 @@
 			    }
 				return {
 				  title: `${this.product.name}`,
-				  path: `pages/goods/product?type=share&id=${this.productID}`,
+				  path: `pages/goods/product?type=share&id=${this.productId}`,
 				  imageUrl:`${this.productImage[0]}`
 				}
 			},
@@ -737,13 +750,13 @@
 		    }
 			return {
 			  title: `${this.product.name}`,
-			  path: `pages/goods/product?type=share&id=${this.productID}`,
+			  path: `pages/goods/product?type=share&id=${this.productId}`,
 			  imageUrl:`${this.productImage[0]}`
 			}
 		},
 		onShow() {
 			this.$api.getStorage().then((resolve) => {
-				this.userID = resolve.userId ? resolve.userId : '';	
+				this.userId = resolve.userId ? resolve.userId : '';	
 				this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 0
 				this.shopID =  resolve.shopId ? resolve.shopId : '';
 				if(this.userIdentity == 0 || this.userIdentity == 2 || this.userIdentity == 4){

+ 3 - 2
services/product.service.js

@@ -75,11 +75,12 @@ export default class ProductService {
 	 * @param:userId 用户ID(未登录传0或者'')
 	 * @param:productIds 商品ID
 	 */
-	queryProductDetils (data = {}) {
+	QueryProductDetils (data = {}) {
 		return this.AjaxService.get({ 
-			url:'/product/details', 
+			url:'/commodity/product/details', 
 			data, 
 			isLoading: false ,
+			isHost:true
 		})
 	}
 	/**

+ 12 - 2
services/shop.service.js

@@ -39,11 +39,21 @@ export default class ShopService {
 	}
 	/* 小程序供应商操作添加删除主推商品 */
 	SupplierSwitchFeaturedyProduct (data = {}) {
-		return this.AjaxService.post({ url:'/supplier/switchFeatured', data, isLoading: true })
+		return this.AjaxService.post({ 
+			url:'/commodity/shop/featured/switch', 
+			data, 
+			isLoading: true ,
+			isHost:true
+		})
 	}
 	/* 小程序供应商操作下架商品 */
 	SupplierSoldOutProduct (data = {}) {
-		return this.AjaxService.post({ url:'/supplier/soldOut', data, isLoading: true })
+		return this.AjaxService.post({ 
+			url:'/commodity/shop/product/offline', 
+			data, 
+			isLoading: true ,
+			isHost:true
+		})
 	}
 	/* 小程序供应商我的店铺详情 */
 	GetSupplierHomeDeatils (data = {}) {

+ 22 - 21
supplier/pages/user/my-product.vue

@@ -229,13 +229,14 @@
 			verifyStatusFilter: function(state){
 				let stateText = '',
 					stateTextObject={
-						'2':'已上架',
-						'3':'已下架',
-						'1':'待审核',
-						'8':'审核未通过',
-						'9':'已隐身',
-						'10':'已冻结',
-						'0':'已删除'
+						0:'已删除',
+						1:'待审核',
+						2:'已上架',
+						3:'已下架',
+						8:'审核未通过',
+						9:'已隐身',
+						10:'已冻结',
+						
 					};
 				Object.keys(stateTextObject).forEach(function(key) {
 					if(key == state){
@@ -302,16 +303,16 @@
 			},	
 			handleDataList(){//根据商品状态set不同的tabAction返回新的数据
 				this.dataList.forEach(item =>{
-					if(item.validFlag === '0' || item.validFlag === '3' || item.validFlag === '8' || item.validFlag === '9'){
+					if(item.validFlag === 0 || item.validFlag === 3 || item.validFlag === 8 || item.validFlag === 9){
 						item.actions = [
 							{name: '无操作',color: '#fff',fontsize: 26,width: 50,background: '#e1e1e1'},
 						]
-					}else if(item.validFlag === '1' || item.validFlag === '10'){
+					}else if(item.validFlag === 1 || item.validFlag === 10){
 						item.actions = [
 							{name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'},
 						]
-					}else if(item.validFlag === '2'){
-						if(item.featuredFlag ==='1'){
+					}else if(item.validFlag === 2){
+						if(item.featuredFlag ===1){
 							item.actions = [
 								{name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'},
 								{name: '删除主页推荐',color: '#fff',fontsize: 26,width: 50,background: '#ff7a51'},
@@ -345,21 +346,21 @@
 				this.classificationThreeList = [];
 			},
 			handlerButton(e,item){//监听侧滑按钮点击事件
-				if(item.validFlag === '0' || item.validFlag === '3' || item.validFlag === '8' || item.validFlag === '9'){
+				if(item.validFlag === 0 || item.validFlag === 3 || item.validFlag === 8 || item.validFlag === 9){
 					if(e.index == 0){
 						return
 					}
-				}else if(item.validFlag === '1' || item.validFlag === '10'){
+				}else if(item.validFlag === 1 || item.validFlag === 10){
 					if(e.index == 0){
-						this.$api.navigateTo(`/pages/goods/product?id=${item.productID}`)
+						this.$api.navigateTo(`/pages/goods/product?id=${item.productId}`)
 					}
-				}else if(item.validFlag === '2'){
+				}else if(item.validFlag === 2){
 					switch(e.index){
 						case 0:
-							this.$api.navigateTo(`/pages/goods/product?id=${item.productID}`)
+							this.$api.navigateTo(`/pages/goods/product?id=${item.productId}`)
 							break;
 						case 1:
-							if(item.featuredFlag ==='1'){
+							if(item.featuredFlag === 1){
 								this.handleDeleteShopRemb(item)
 							}else{
 								this.handleAddShopRemb(item)
@@ -401,7 +402,7 @@
 								isValidFlag = true; 
 							}else{
 								isValidFlag = false
-								this.productIds += el.productID+','
+								this.productIds += el.productId+','
 							}
 						}
 					})
@@ -436,7 +437,7 @@
 				this.modal = false;
 			},
 			SupplierDeleteSwitchFeatured(item){//操作删除主页推荐
-				this.ShopService.SupplierSwitchFeaturedyProduct({productId:item.productID,featuredFlag:0}).then(response =>{
+				this.ShopService.SupplierSwitchFeaturedyProduct({productId:item.productId,featuredFlag:0}).then(response =>{
 					this.$util.msg('删除成功',2000,true,'success');
 					setTimeout(() => {
 						this.GetProductListInfo()
@@ -446,7 +447,7 @@
 				})
 			},
 			SupplierAddSwitchFeatured(item){//操作添加主页推荐
-				this.ShopService.SupplierSwitchFeaturedyProduct({productId:item.productID,featuredFlag:1}).then(response =>{
+				this.ShopService.SupplierSwitchFeaturedyProduct({productId:item.productId,featuredFlag:1}).then(response =>{
 					this.$util.msg('添加成功',2000,true,'success');
 					setTimeout(() => {
 						this.GetProductListInfo()
@@ -456,7 +457,7 @@
 				})
 			},
 			SupplierSoldOutProduct(item){//操作下架商品
-				this.ShopService.SupplierSoldOutProduct({productIds:item.productID}).then(response =>{
+				this.ShopService.SupplierSoldOutProduct({productIds:item.productId}).then(response =>{
 					this.$util.msg('下架成功',2000,true,'success');
 					setTimeout(() => {
 						this.GetProductListInfo()