Ver Fonte

commit -m 商品模块服务化

zhengjinyi há 4 anos atrás
pai
commit
48b9f643e7

+ 7 - 5
components/cm-module/listTemplate/buyagainList.vue

@@ -4,14 +4,14 @@
 		<view class="product-container" v-if="!isShowEmpty" :style="{paddingTop:searchStatus?'112rpx':''}">
 			<scroll-view :style="{'height':scrollHeight+'px'}" @scrolltolower="scrolltolower" scroll-y v-if="productList.length > 0">
 				<view v-for="(item,index) in productList" :key="index" :id="item.productId" class="all-type-list-content commodity-list" @click.stop="navToDetailPage(item.productId)">
-					<image mode='widthFix' :src="item.mainImage"  class="list-img" alt="list-img"></image>
+					<image mode='widthFix' :src="item.image"  class="list-img" alt="list-img"></image>
 					<view class="list-details-info">
 						<text class="list-details-title">{{item.name}}</text>
 						<text class="list-details-specs">规格:{{item.unit !=null ? item.unit : ''}}</text>
 						<text class="list-details-miniQuantity">起订量:{{item.ladderPriceFlag == 1 ? item.maxBuyNumber : item.minBuyNumber}}</text>
 						<view class="list-details-price">
 							<view class="list-shop">
-								<view class="list-price-none" v-if="item.repurchasePriceState">
+								<view class="list-price-none" v-if="item.repurchaseFlag == 1">
 									<text class="price-none">¥{{item.originalPrice}}</text>
 									<text class="iconfont icon-wenhao" @click.stop="repurchModel"></text>
 								</view>
@@ -104,7 +104,7 @@
 			this.$parent.getClubProductNum()
 			this.$api.getComStorage('orderUserInfo').then((resolve) =>{
 				this.userId = resolve.userID
-				this.getProductAgainInfo()
+				this.getProductAgainInfo(false)
 			})
 		},
 		filters: {
@@ -144,16 +144,18 @@
 					this.showSkeleton = false;
 					const listData = response.data.results;
 					if(listData && listData.length > 0){
-						this.hasNextPage = responseData.hasNextPage;
+						this.hasNextPage = response.data.hasNextPage;
 						this.isShowEmpty = false;
 						if(loadMore) {
 							this.productList = [...this.productList,...listData];
 						} else {
-							this.productList = [...listData];
+							this.productList = listData;
+							console.log(this.productList)
 						}
 						//价格显示处理
 						let isActFlg,newProductList=[];
 						this.productList.map((item, index)=> {
+							console.log(item)
 							if(item.actStatus == 1){
 								isActFlg = true
 							}else if(item.actStatus == 1 && item.ladderPriceFlag == 1){

+ 1 - 1
components/cm-module/listTemplate/immediatelyList.vue

@@ -87,7 +87,7 @@
 									<view class="list-shop com">
 										<view class="list-price zuhe_list_price" >
 											<view class="zuhe_price-larger zuhe_list_text" >
-												<view class="list-price-none" v-if="pros.repurchaseFlag">
+												<view class="list-price-none" v-if="pros.repurchaseFlag == 1">
 													<text class="price-none">价格:¥{{ pros.originalPrice }}</text>
 													<text class="iconfont icon-wenhao" @click.stop="repurchModel"></text>
 												</view>

+ 24 - 16
components/cm-module/listTemplate/productList.vue

@@ -3,24 +3,24 @@
 		<list-skeleton v-if="showSkeleton" :listType='0'></list-skeleton>
 		<view class="product-container" v-if="!isShowEmpty">
 			<scroll-view :style="{'height':scrollHeight+'px'}" @scrolltolower="scrolltolower" scroll-y v-if="productList.length > 0">
-				<view v-for="(item,index) in productList" :key="index" :id="item.id" class="all-type-list-content commodity-list" @click.stop="navToDetailPage(item.productID)">
-					<image mode='widthFix' :src="item.mainImage"  class="list-img" alt="list-img"></image>
+				<view v-for="(item,index) in productList" :key="index" :id="item.id" 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">{{item.name}}</text>
 						<text class="list-details-specs">规格:{{item.unit !=null ? item.unit : ''}}</text>
 						<text class="list-details-miniQuantity">起订量:{{ item.ladderPriceFlag == '1' ? item.maxBuyNumber : item.minBuyNumber}}</text>
-						<view class="list-details-price" v-if="item.price1TextFlag == 1">
+						<view class="list-details-price" v-if="item.priceFlag == 1">
 							<view class="list-none"><view class="price-small">未公开价格</view></view>
 						</view>
 						<view class="list-details-price" v-else>
 							<view class="list-shop">
-								<view class="list-price-none" v-if="item.repurchasePriceState">
-									<text class="price-none">¥{{item.discountPrice}}</text>
+								<view class="list-price-none" v-if="item.repurchaseFlag == 1">
+									<text class="price-none">¥{{item.originalPrice}}</text>
 									<text class="iconfont icon-wenhao" @click.stop="repurchModel"></text>
 								</view>
 								<view class="list-price" v-else>
 									<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
-										¥{{ (PromotionsFormat(item.promotions) ? item.price1 : item.retailPrice) | NumFormat }}
+										¥{{ (PromotionsFormat(item.promotions) ? item.originalPrice : item.price) | NumFormat }}
 									</text>
 								</view>
 							</view>
@@ -29,7 +29,7 @@
 						<view class="list-details-price" v-if="item.actStatus==1">
 							<view class="floor-item-act">
 								<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-									{{item.promotions.name}}<text v-if="item.price1TextFlag != 1">:¥{{ item.retailPrice | NumFormat }}</text>
+									{{item.promotions.name}}<text v-if="item.priceFlag != 1">:¥{{ item.price | NumFormat }}</text>
 								</view>
 								<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
 							</view>
@@ -90,7 +90,7 @@
 				windowHeight: '',
 				showSkeleton: true,
 				isShowEmpty: false,
-				userID: '',
+				userId: '',
 				scrollHeight: '',
 				productList: [],
 				showLoading: false,
@@ -109,7 +109,7 @@
 		created() {
 			this.setScrollHeight();		
 			this.$api.getStorage().then((resolve) =>{
-				this.userID = resolve.userId ? resolve.userId : 0
+				this.userId = resolve.userId ? resolve.userId : 0
 				this.getProductAgainInfo()
 			})
 		},
@@ -138,18 +138,26 @@
 				this.loadingText = '加载中';
 				this.isShowEmpty = false;				
 				if(loadMore) {this.pageNum += 1;}
-				let params = {userId:this.userID,identity:this.identity,pageNum:this.pageNum,pageSize:this.pageSize}
-				this.ProductService.GetRepeatBuyAgainProductList(params).then(response =>{
+				this.ProductService.GetRepeatBuyAgainProductList(
+					{
+						userId:13863,
+						// userId:this.userId,
+						identity:this.identity,
+						pageNum:this.pageNum,
+						pageSize:this.pageSize,
+					}
+				)
+				.then(response =>{
 					this.isShowWrapper = true
 					this.cartQuantity = response.data.cartQuantity
-					const responseData = response.data.pageDate;
-					if(responseData.results && responseData.results.length > 0){
-						this.hasNextPage = responseData.hasNextPage;
+					const listData = response.data.results;
+					if(listData && listData.length > 0){
+						this.hasNextPage = response.data.hasNextPage;
 						this.isShowEmpty = false;
 						if(loadMore) {
-							this.productList = [...this.productList,...responseData.results];
+							this.productList = [...this.productList,...listData];
 						} else {
-							this.productList = [...responseData.results];
+							this.productList = listData;
 							this.showSkeleton = false;
 						}
 						//价格显示处理

+ 15 - 7
pages/user/regularPurchase/regularPurchase.vue

@@ -8,7 +8,7 @@
 			<view class="layer" @tap.stop="discard" :style="{paddingBottom :isIphoneX ? '68rpx' : '36rpx',bottom:isIphoneX ?'-332rpx' : '-294rpx'}">
 				<view class="content">
 					<view class="layer-smimg">
-						<image :src="handleData.mainImage" mode=""></image>
+						<image :src="handleData.image" mode=""></image>
 					</view>
 					<view class="layer-nunbox">
 						<view class="layer-nunbox-t">
@@ -44,7 +44,7 @@
 		},
 		data(){
 			return{
-				userID: '',
+				userId: '',
 				serverUrl: '',
 				emptyText: '',
 				lastPageType: '',
@@ -67,8 +67,9 @@
 			hanldOperationConfim(data){//显示选择数量确认弹窗
 				this.specClass = 'show'
 				this.handleData = data
+				console.log(this.handleData)
 				this.minBuyNumber = data.minBuyNumber
-				this.buyRetailPrice = data.retailPrice
+				this.buyRetailPrice = data.price
 				this.buyRetailPriceStep = data.step
 				if(this.handleData.ladderPriceFlag == '1'){
 					this.number = data.maxBuyNumber
@@ -135,7 +136,7 @@
 				let productStp ={
 						allPrice:this.number*this.buyRetailPrice,
 						allCount:this.number,
-						productID:this.handleData.productID,
+						productID:this.handleData.productId,
 						productCount:this.number
 				}	
 				this.$api.navigateTo(`/pages/user/order/create-order?type=prodcut&data=${JSON.stringify({data:productStp})}`)
@@ -144,15 +145,22 @@
 				}, 200);
 			},
 			getAddProductCart(){//增加购物车成功和toast弹窗提示成功
-				this.ProductService.shoppingAddCart({productID:this.handleData.productID,userID:this.userID,productCount:this.number}).then(response => {
+				this.ProductService.shoppingAddCart({productID:this.handleData.productId,userID:this.userId,productCount:this.number}).then(response => {
 					this.specClass = 'hide';
 					this.$util.msg(response.msg,1500,true,'success')
 					setTimeout(() => {this.specClass = 'none'}, 200)
-					this.$refs.productList.cartQuantity = response.data
+					this.GetUserCartNumber()
 				}).catch(error =>{
 					this.$util.msg(error.msg,2000);
 				})
 			},
+			GetUserCartNumber(){
+				this.UserService.GetUserCartNumber({userId:this.userId}).then(response =>{
+					this.$refs.productList.cartQuantity = response.data.length
+				}).catch(error =>{
+					console.log('查询用户购物车数量失败')
+				})
+			},
 			discard(){
 				//丢弃
 			}
@@ -160,7 +168,7 @@
 		onShow() {
 			let pages = getCurrentPages(),thisPage = pages[pages.length - 1];
 			this.$api.getStorage().then((resolve) =>{
-				this.userID = resolve.userId ? resolve.userId : 0
+				this.userId = resolve.userId ? resolve.userId : 0
 			})
 		},
 	}

+ 4 - 4
seller/pages/cart/buyagain.vue

@@ -11,7 +11,7 @@
 			<view class="layer" @tap.stop="discard" :style="{paddingBottom :isIphoneX ? '68rpx' : '36rpx',bottom:isIphoneX ?'-352rpx' : '-320rpx'}">
 				<view class="content">
 					<view class="layer-smimg">
-						<image :src="handleData.mainImage" mode=""></image>
+						<image :src="handleData.image" mode=""></image>
 					</view>
 					<view class="layer-nunbox">
 						<view class="layer-nunbox-t">
@@ -77,7 +77,7 @@
 				this.specClass = 'show';
 				this.handleData = data
 				this.minBuyNumber = data.minBuyNumber
-				this.buyRetailPrice = data.retailPrice;
+				this.buyRetailPrice = data.price;
 				this.buyRetailPriceStep = data.step
 				if(this.handleData.ladderPriceFlag == '1'){
 					this.number = data.maxBuyNumber
@@ -132,7 +132,7 @@
 			},
 			calculatPerice(){//判断是否为阶梯价然后做计算价格处理
 				if(this.handleData.ladderPriceFlag == '1'){
-					this.handleData.ladderPriceList.forEach((item,index)=>{
+					this.handleData.ladderPrices.forEach((item,index)=>{
 						if(this.number>=item.buyNum){
 							this.buyRetailPrice = item.buyPrice
 						}
@@ -143,7 +143,7 @@
 			},
 			getAddProductCart(){//增加购物车成功和toast弹窗提示成功
 				let params ={
-						productId:this.handleData.productID,
+						productId:this.handleData.productId,
 						clubId:this.clubID,
 						serviceProviderId:this.serviceProviderId,
 						num:this.number

+ 2 - 2
seller/pages/cart/immediately.vue

@@ -17,10 +17,10 @@
 			<view class="layer" @tap.stop="discard" :style="{paddingBottom :isIphoneX ? '68rpx' : '36rpx',bottom:isIphoneX ?'-370rpx' : '-360rpx'}">
 				<view class="content">
 					<view class="layer-smimg">
-						<image :src="handleData.p_image" mode=""></image>
+						<image :src="handleData.image" mode=""></image>
 					</view>
 					<view class="layer-nunbox">
-						<view class="layer-nunbox-m" v-if="handleData.p_code!=''&& handleData.p_code!=null">商品编码:{{handleData.p_code}}</view>
+						<view class="layer-nunbox-m" v-if="handleData.code!=''&& handleData.code!=null">商品编码:{{handleData.code}}</view>
 						<view class="layer-nunbox-t">
 							<view class="layer-nunbox-text">数量:</view>
 							<view class="number-box">

+ 8 - 0
services/user.service.js

@@ -259,5 +259,13 @@ export default class UserService {
 			isHost:true
 		})
 	}
+	/* 机构购物车简单列表*/
+	GetUserCartNumber (data = {}) {
+		return this.AjaxService.get({ 
+			url:'/shoppingCart/header/cart', 
+			data, 
+			isLoading: true ,
+		})
+	}
 	
 }