zhengjinyi 4 anos atrás
pai
commit
2ebf64ecc2

+ 0 - 33
api/product.js

@@ -92,22 +92,6 @@ export function queryNewSearchProduct(params) {
 		})
 	});
 }
-/**
- * @新商品搜索重新请求价格
- * @param:productIds 商品ID
- * @param:userId	用户ID
- */
-export function querySearchProductPrice(params) {
-	return new Promise(function(resolve,reject) {
-		request.get("/product/listPrice",params, res => {
-			if(res.code == 0){
-				resolve(res);
-			}else{
-				reject(res)
-			}
-		})
-	});
-}
 /**
  * @新商品搜索查询商品阶梯价格
  * @param:productIds 商品ID
@@ -208,23 +192,6 @@ export function queryEvaluate(params) {
 		})
 	});
 }
-/**
- * @常用商品,精品推荐,热门推荐列表
- * @param:preferredFlag 新品上线(001) 优惠商品(010) 常用商品(100),,
- * @param:pageNum 页码
- * @param:pageSize 每页条数
- */
-export function queryPreferred(params) {
-	return new Promise(function(resolve,reject) {
-		request.get("/product/preferred",params, res => {
-			if(res.code == 0){
-				resolve(res);
-			}else{
-				reject(res)
-			}
-		})
-	});
-}
 /**
  * @再次购买商品列表
  * @param:userId  用户ID

+ 3 - 3
common/config/config.js

@@ -1,10 +1,10 @@
 let URL_CONFIG = ""
 if(process.env.NODE_ENV === 'development'){
     // 开发环境
-	// URL_CONFIG = 'http://192.168.1.33:8008'	 //俊俊联调地址
+	// URL_CONFIG = 'http://192.168.2.56:8008'	 //本地IP联调地址
 	// URL_CONFIG = 'http://192.168.2.67:8008'	 //裴裴联调地址
-	// URL_CONFIG = 'http://192.168.1.10:8008'	 //超超联调地址
-    URL_CONFIG = 'https://spi-b.caimei365.com'	 //采美测试地址
+	URL_CONFIG = 'http://192.168.2.75:8008'	 //超超联调地址
+    // URL_CONFIG = 'https://spi-b.caimei365.com'	 //采美测试地址
 	// URL_CONFIG = 'https://spi.caimei365.com'
 }else{
     // 生产环境

+ 4 - 4
components/cm-module/creatOrder/goodsList.vue

@@ -7,9 +7,9 @@
 					<view class="title-logo"><image :src="item.logo" mode=""></image></view>
 					<view class="title-text">{{item.name}}</view> 
 				</view>
-				<view class="productlist" v-for="(pros,idx) in item.productsList" :key="idx">
+				<view class="productlist" v-for="(pros,idx) in item.cartList" :key="idx">
 					<view class="goods-pros-t">
-						<view class="pros-img"><image :src="pros.mainImage" alt="" /></view>
+						<view class="pros-img"><image :src="pros.image" alt="" /></view>
 						<view class="pros-product">
 							<view class="producttitle">{{pros.name}}</view>
 							<view class="productspec"  v-if="pros.productCategory!=2">规格:{{pros.unit}}</view>
@@ -18,10 +18,10 @@
 							</view>
 							<view class="productprice">
 								<view class="price">
-									<text>¥{{pros.retailPrice.toFixed(2)}}</text>
+									<text>¥{{pros.price.toFixed(2)}}</text>
 								</view>
 								<view class="count">
-									<text class="small">x</text>{{pros.productCount}}
+									<text class="small">x</text>{{pros.number}}
 								</view>
 							</view>
 						</view>	

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

@@ -57,7 +57,7 @@
 	import listSkeleton from '@/components/cm-module/listTemplate/listSkeleton'
 	import modalLayer from "@/components/modal-layer"
 	import uniStars from '@/components/uni-stars/uni-stars.vue'
-	import { searchQueryTinyType,querySearchProductPrice} from "@/api/product.js"
+	import { searchQueryTinyType} from "@/api/product.js"
 	import { mapState,mapMutations } from 'vuex';
 	export default{
 		name:'CommodityList',

+ 2 - 3
components/cm-module/listTemplate/commodityList.vue

@@ -60,7 +60,7 @@
 	import listSkeleton from '@/components/cm-module/listTemplate/listSkeleton'
 	import modalLayer from "@/components/modal-layer"
 	import uniStars from '@/components/uni-stars/uni-stars.vue'
-	import { searchQueryTinyType,querySearchProductPrice} from "@/api/product.js"
+	import { searchQueryTinyType} from "@/api/product.js"
 	import { mapState,mapMutations } from 'vuex';
 	export default{
 		name:'CommodityList',
@@ -184,13 +184,12 @@
 				})
 			},
 			setProductPrice(){//获取价格
-				if (!this.userID) {return false;}
 				let productIdArr = [];
 				this.listData.map(item=>{// 0公开价格 1不公开价格 2仅对会员机构公开
 					productIdArr.push(item.p_id)
 				})
 				this.productIds = productIdArr.join(",");
-				querySearchProductPrice({userId: this.userID,productIds:this.productIds}).then(response =>{
+				this.ProductService.querySearchProductPrice({userId: this.userID,productIds:this.productIds}).then(response =>{
 					if (response.data) {
 						let priceList = response.data
 						this.listData.map(item=>{

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

@@ -133,7 +133,7 @@
 	import modalLayer from "@/components/modal-layer"
 	import uniStars from '@/components/uni-stars/uni-stars.vue'
 	import cmDrag from '@/components/cm-custom/cm-drag.vue'
-	import { queryNewSearchProduct,querySearchProductPrice} from "@/api/product.js"
+	import { queryNewSearchProduct} from "@/api/product.js"
 	import { getcombinationProduct } from "@/api/seller.js"
 	import { mapState,mapMutations } from 'vuex';
 	export default{
@@ -274,7 +274,7 @@
 					productIdArr.push(item.p_id) 
 				})
 				this.productIds = productIdArr.join(",");
-				querySearchProductPrice({userId: this.clubUserId,productIds:this.productIds}).then(response =>{
+				this.ProductService.querySearchProductPrice({userId: this.clubUserId,productIds:this.productIds}).then(response =>{
 					if (response.data) {
 						let priceList = response.data,isActFlg;
 						this.listData.map(item=>{

+ 2 - 3
pages/search/search.vue

@@ -88,8 +88,7 @@
 		queryNewSearchProduct , 
 		querySearchHistory,
 		clearSearchHistory,
-		searchHistoryAdd,
-		querySearchProductPrice
+		searchHistoryAdd
 	} from "@/api/product.js" 
 	
 	export default {
@@ -231,7 +230,7 @@
 					productIdArr.push(item.p_id)
 				})
 				this.productIds = productIdArr.join(",");
-				querySearchProductPrice({userId: this.userID,productIds:this.productIds}).then(response =>{
+				this.ProductService.querySearchProductPrice({userId: this.userID,productIds:this.productIds}).then(response =>{
 					if (response.data) {
 						let priceList = response.data
 						this.listData.map(item=>{

+ 41 - 8
pages/tabBar/home/home.vue

@@ -90,11 +90,14 @@
 									</view>
 								</view>
 								<view v-else class="no-price">
-									<text class="p-no">价格:</text>
 									<view class="p-stars">
-										<uni-stars :stars="parseInt(item.price1Grade)"></uni-stars>
+										<text class="p-no">¥</text>
+										<uni-stars :stars="parseInt(item.price1Grade)" :fontSize="36" :widthInfo="180"></uni-stars>
 									</view>
 								</view>	
+								<view class="" v-if="item.actStatus==1">
+									
+								</view>
 							</view>
 						</view>
 					</view>
@@ -178,7 +181,7 @@
 					textColor:'#FFFFFF'
 				},
 				CustomBar:this.CustomBar,// 顶部导航栏高度
-				userID:'',
+				userID:0,
 				clubStatus:'',
 				current:0,
 				mode:'round',
@@ -266,12 +269,38 @@
 				})
 			},
 			getOrganizeProducts(){//获取模块三商品
-				queryPreferred({userId:this.userID,preferredFlag:100,pageNum:1,pageSize:6}).then(res =>{
+				this.ProductService.queryProductPreferred({userId:this.userID,preferredFlag:100,pageNum:1,pageSize:6}).then(res =>{
 					this.organizeProducts = res.data.results
+					this.getProductPrice()
+				}).catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})
+			},
+			getProductPrice(){//获取商品或者活动价格
+				let productIdArr = [];
+				let productIds ='';
+				this.organizeProducts.map(item=>{// 0公开价格 1不公开价格 2仅对会员机构公开
+					productIdArr.push(item.productID)
+				})
+				productIds = productIdArr.join(",");
+				this.ProductService.querySearchProductPrice({userId: this.userID,productIds:productIds}).then(response =>{
+					this.organizeProducts = this.ReturnNewProducts(this.organizeProducts,response.data);
+					console.log(this.organizeProducts);
 				}).catch(error =>{
 					this.$util.msg(error.msg,2000)
 				})
 			},
+			ReturnNewProducts(Array,list){
+				let NewArray = []
+				Array.map(item=>{
+					for (let i = 0; i < list.length; i++) {
+						if( item.productID == list[i].productId ){
+							NewArray.push(Object.assign(item,list[i])) 
+						}
+					}
+				});
+				return NewArray
+			},
 			//轮播图切换修改背景色
 			swiperChange(e) {
 				const index = e.detail.current;
@@ -585,6 +614,7 @@
 			border-radius: 20rpx;
 			.floor-item{
 				width: 341rpx;
+				height: 590rpx;
 				margin-right: 20rpx;
 				font-size: $font-size-24;
 				color: $text-color;
@@ -646,13 +676,16 @@
 					height: 76rpx;
 					line-height: 76rpx;
 					display: flex;
+					box-sizing: border-box;
 					.p-no{
-						font-size: $font-size-24;
-						color: $color-system;
-						margin-right: 5rpx;
+						font-size: $font-size-30;
+						color: $text-color;
+						display: block;
+						float: left;
 					}
 					.p-stars{
-						margin-top: 3rpx;
+						width: 230rpx;
+						margin: 0 auto;
 					}
 				}
 				.price{

+ 7 - 6
pages/user/order/create-order.vue

@@ -140,7 +140,7 @@
 				createOrderInfo(params).then(response =>{
 					let resData = response.data
 					this.isRequest = true
-					this.goodsData = resData.shopList
+					this.goodsData = resData.list
 					this.userMoney = resData.userMoney
 					this.rechargeGoods = resData.rechargeGoods
 				}).catch(error =>{
@@ -273,14 +273,15 @@
 				}
 				this.orderInfo = this.goodsData.map(el => {
 					let productInfo = [];
-					el.productsList.forEach(item => {
+					el.cartList.forEach(item => {
 						productInfo.push({
-							productId:item.productID,
-							productNum:item.productCount,
-							presentNum:0
+							productId:item.id,
+							productNum:item.number,
+							presentNum:0,
+							productType:item.productType
 						})
 					})
-					return {shopId:el.shopID,note:el.note?el.note:'',productInfo:productInfo}
+					return {shopId:el.id,note:el.note?el.note:'',productInfo:productInfo}
 				})
 				//订单信息
 				this.payInfo = {

+ 2 - 3
seller/pages/search/search.vue

@@ -88,8 +88,7 @@
 		queryNewSearchProduct , 
 		querySearchHistory,
 		clearSearchHistory,
-		searchHistoryAdd,
-		querySearchProductPrice
+		searchHistoryAdd
 	} from "@/api/product.js" 
 	
 	export default {
@@ -231,7 +230,7 @@
 					productIdArr.push(item.p_id)
 				})
 				this.productIds = productIdArr.join(",");
-				querySearchProductPrice({userId: this.userID,productIds:this.productIds}).then(response =>{
+				this.ProductService.querySearchProductPrice({userId: this.userID,productIds:this.productIds}).then(response =>{
 					if (response.data) {
 						let priceList = response.data
 						this.listData.map(item=>{

+ 4 - 4
services/ajax.env.js

@@ -1,10 +1,10 @@
 let URL_CONFIG = ""
 if(process.env.NODE_ENV === 'development'){
     // 开发环境
-	// URL_CONFIG = 'http://192.168.1.33:8008'	 //俊俊联调地址
-	URL_CONFIG = 'http://192.168.2.67:8008'		 //裴裴联调地址
-	// URL_CONFIG = 'http://192.168.1.10:8008'	 //超超联调地址
-    // URL_CONFIG = 'https://spi-b.caimei365.com'//采美测试地址
+	// URL_CONFIG = 'http://192.168.2.56:8008'	 //俊俊联调地址
+	// URL_CONFIG = 'http://192.168.2.67:8008'	 //裴裴联调地址
+	URL_CONFIG = 'http://192.168.2.75:8008'	 //超超联调地址
+    // URL_CONFIG = 'https://spi-b.caimei365.com'	 //采美测试地址
 	// URL_CONFIG = 'https://spi.caimei365.com'
 }else{
     // 生产环境

+ 3 - 0
services/index.js

@@ -4,6 +4,7 @@ import ajaxService from './ajax.service.js'
 import CommonService from './common.service'
 import LocateService from './locate.service'
 import UserService from './user.service'
+import ProductService from './product.service'
 import ShopService from './shop.service'
 import PayService from './pay.service'
 import PhotoService from './photo.service'
@@ -15,6 +16,7 @@ import OrderService from './order.service'
 let commonService = new CommonService(ajaxService)
 let locateService = new LocateService(ajaxService)
 let userService = new UserService(ajaxService)
+let productService = new ProductService(ajaxService)
 let shopService = new ShopService(ajaxService)
 let payService = new PayService(ajaxService)
 let photoService = new PhotoService(ajaxService)
@@ -27,6 +29,7 @@ Vue.prototype.AjaxService = ajaxService
 Vue.prototype.CommonService = commonService
 Vue.prototype.LocateService = locateService
 Vue.prototype.UserService = userService
+Vue.prototype.ProductService = productService
 Vue.prototype.ShopService = shopService
 Vue.prototype.PayService = payService
 Vue.prototype.PhotoService = photoService

+ 33 - 0
services/product.service.js

@@ -0,0 +1,33 @@
+/**
+ * 这是与购物有关的业务逻辑的服务
+ */
+export default class ProductService {
+	constructor(AjaxService) {
+		Object.assign(this, { AjaxService })
+		this.name = 'ProductService'
+	}
+	/**
+	 * @商城首页-常用商品列表
+	 * @param:userId 用户ID(未登录传0或者''),
+	 * @param:preferredFlag 新品上线(001) 优惠商品(010) 常用商品(100),,
+	 * @param:pageNum 页码
+	 * @param:pageSize 每页条数
+	 */
+	queryProductPreferred (data = {}) {
+		return this.AjaxService.get({ url:'/product/preferred', data, isLoading: false })
+	}
+	/**
+	 * @商品列表-查询商品价格
+	 * @param:userId 用户ID(未登录传0或者'')
+	 * @param:productIds 商品ID','符号拼接
+	 */
+	querySearchProductPrice (data = {}) {
+		return this.AjaxService.get({ url:'/product/listPrice', data, isLoading: false })
+	}
+
+	/* 余额抵扣 orderId 订单ID */
+	OrderBalanceDeduction (data = {}) {
+		return this.AjaxService.post({ url:'/order/balanceDeduction', data, isLoading: false })
+	}
+	
+}