2312970463@qq.com 4 rokov pred
rodič
commit
e56ef70398
3 zmenil súbory, kde vykonal 53 pridanie a 22 odobranie
  1. 43 13
      api/product.js
  2. 4 7
      pages/index/index.vue
  3. 6 2
      pages/product/product.vue

+ 43 - 13
api/product.js

@@ -164,9 +164,9 @@ export function getCombinationPoster(data) {
  */
 export function getSeckillIndexTime(data) {
 	return request({
-			url: '/api/store/product/seckill/select',
-			methods: 'get',
-			data
+		url: '/api/store/product/seckill/select',
+		methods: 'get',
+		data
 	});
 }
 // 获取秒杀分类
@@ -211,17 +211,47 @@ export function getStoreDetail(id, data) {
 		url: '/api/store/merchant/detail/' + id,
 		method: 'get',
 		data
-	})
+	})
 }
-/**
- * 获取秒杀商品详情
- * @param int id
- * 
- */
-export function getSeckillProductDetail(data,id) {
+/**
+ * 获取秒杀商品详情
+ * @param int id
+ * 
+ */
+export function getSeckillProductDetail(data, id) {
 	return request({
-		url:'/api/store/product/seckill/detail/'+id,
-		method:'get',
+		url: '/api/store/product/seckill/detail/' + id,
+		method: 'get',
 		data
-	})
+	})
+}
+
+//获取普通商品
+export function getProductslist(data) {
+	if (data.brand_id && Array.isArray(data.brand_id)) {
+		data = {
+			...data
+		}
+		data.brand_id = data.brand_id.toString()
+	}
+	// return request.get('product/spu/lst', data, {
+	// 	noAuth: true
+	// });
+	return request({
+		url: '/product/spu/lst',
+		method: 'get',
+		data
+	})
+}
+//
+export function getProductHot(data) {
+	let dataa = {
+		page: data.page === undefined ? 1 : page,
+		limit: data.limit === undefined ? 10 : limit
+	}
+	return request({
+		url: '/api/product/spu/recommend',
+		method: 'get',
+		data
+	})
 }

+ 4 - 7
pages/index/index.vue

@@ -199,7 +199,7 @@ import { setCoupons } from '@/api/functionalUnit.js';
 // import { getBargainList } from '@/api/product.js';
 import { interceptor } from '@/utils/loginUtils';
 import { mapState } from 'vuex';
-import { getCombinationList } from '@/api/product.js';
+import { getCombinationList, getProductslist, getProductHot } from '@/api/product.js';
 
 export default {
 	components: {
@@ -306,12 +306,6 @@ export default {
 			});
 		}
 		// #endif
-		// uni.request({
-		// 	complete(res) {
-		// 		console.log(res);
-		// 	},
-		// 	url: 'http://base.liuniu946.com/api/index'
-		// });
 	},
 	onShow: function() {
 		// 判断是否强制登录
@@ -506,6 +500,9 @@ export default {
 				this.swiperLength = this.carouselList.length;
 				this.menusList = data.menu;
 			})
+			getProductHot({page:1,limit:1}).then( ({data})=> {
+				console.log(data,"data+++++++++--------------")
+			} )
 		},
 		//轮播图切换修改背景色
 		swiperChange(e) {

+ 6 - 2
pages/product/product.vue

@@ -489,12 +489,16 @@ export default {
 			// 	productId: goodId, //商品编号
 			// 	uniqueId: obj.uniqueId
 			// };
+			let is_new = 0
+			if(obj.type == 1){
+				is_new = 1
+			}
 			let data = {
 				product_id: goodId,
 				product_attr_unique: obj.uniqueId,
 				cart_num: obj.goodsNumber,
 				product_type: obj.product_type,
-				is_new: 1 
+				is_new: is_new
 			}
 			console.log("立即购买++++++",data);
 			if (obj.type == 2) {
@@ -517,7 +521,7 @@ export default {
 							duration: 2000,
 							icon: 'none'
 						});
-						obj.goodsDetail();
+						obj.getGoodsDetails();
 					}
 					obj.toggleSpec();
 				})