chore[litemall-wx, litemall-wx-api]: 商品API调整及文档
This commit is contained in:
434
doc/api.md
434
doc/api.md
@@ -243,6 +243,440 @@ API应该存在版本控制,以保证兼容性。
|
||||
|
||||
### 2.4 商品服务
|
||||
|
||||
#### 2.4.1 商品列表
|
||||
|
||||
应用场景
|
||||
|
||||
商品列表
|
||||
|
||||
接口链接
|
||||
|
||||
GET /wx/goods/list
|
||||
|
||||
请求参数
|
||||
|
||||
isNew: 是否新品,true或者false
|
||||
isHot: 是否热卖商品,true或者false
|
||||
keyword: 关键字,如果设置则查询是否匹配关键字
|
||||
brandId: 品牌商ID,如果设置则查询品牌商所属商品
|
||||
categoryId: 商品分类ID,如果设置则查询分类所属商品
|
||||
page: 请求页码
|
||||
limit: 每一页数量
|
||||
sort: 排序字段
|
||||
order: 升序降序
|
||||
|
||||
响应内容
|
||||
|
||||
{
|
||||
"errno": 0,
|
||||
"data": {
|
||||
"total": 11,
|
||||
"pages": 6,
|
||||
"limit": 2,
|
||||
"page": 1,
|
||||
"list": [
|
||||
{
|
||||
"id": 1181000,
|
||||
"name": "母亲节礼物-舒适安睡组合",
|
||||
"brief": "安心舒适是最好的礼物",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/1f67b1970ee20fd572b7202da0ff705d.png",
|
||||
"isNew": true,
|
||||
"isHot": false,
|
||||
"counterPrice": 2618.00,
|
||||
"retailPrice": 2598.00
|
||||
},
|
||||
{
|
||||
"id": 1116011,
|
||||
"name": "蔓越莓曲奇 200克",
|
||||
"brief": "酥脆奶香,甜酸回味",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/767b370d07f3973500db54900bcbd2a7.png",
|
||||
"isNew": true,
|
||||
"isHot": true,
|
||||
"counterPrice": 56.00,
|
||||
"retailPrice": 36.00
|
||||
}
|
||||
],
|
||||
"filterCategoryList": [
|
||||
{
|
||||
"id": 1005007,
|
||||
"name": "锅具",
|
||||
"keywords": "",
|
||||
"desc": "一口好锅,炖煮生活一日三餐",
|
||||
"pid": 1005001,
|
||||
"iconUrl": "http://yanxuan.nosdn.127.net/4aab4598017b5749e3b63309d25e9f6b.png",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/d2db0d1d0622c621a8aa5a7c06b0fc6d.png",
|
||||
"level": "L2",
|
||||
"sortOrder": 1,
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": 1008002,
|
||||
"name": "布艺软装",
|
||||
"keywords": "",
|
||||
"desc": "各种风格软装装点你的家",
|
||||
"pid": 1005000,
|
||||
"iconUrl": "http://yanxuan.nosdn.127.net/8bbcd7de60a678846664af998f57e71c.png",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/2e2fb4f2856a021bbcd1b4c8400f2b06.png",
|
||||
"level": "L2",
|
||||
"sortOrder": 6,
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": 1008008,
|
||||
"name": "被枕",
|
||||
"keywords": "",
|
||||
"desc": "守护你的睡眠时光",
|
||||
"pid": 1005000,
|
||||
"iconUrl": "http://yanxuan.nosdn.127.net/927bc33f7ae2895dd6c11cf91f5e3228.png",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/b43ef7cececebe6292d2f7f590522e05.png",
|
||||
"level": "L2",
|
||||
"sortOrder": 2,
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": 1008009,
|
||||
"name": "床品件套",
|
||||
"keywords": "",
|
||||
"desc": "MUJI等品牌制造商出品",
|
||||
"pid": 1005000,
|
||||
"iconUrl": "http://yanxuan.nosdn.127.net/243e5bf327a87217ad1f54592f0176ec.png",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/81f671bd36bce05d5f57827e5c88dd1b.png",
|
||||
"level": "L2",
|
||||
"sortOrder": 4,
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": 1008015,
|
||||
"name": "糕点",
|
||||
"keywords": "",
|
||||
"desc": "四季糕点,用心烘焙",
|
||||
"pid": 1005002,
|
||||
"iconUrl": "http://yanxuan.nosdn.127.net/93168242df456b5f7bf3c89653b3db76.png",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/66ea1d6ad602a8e441af7cada93bdc7a.png",
|
||||
"level": "L2",
|
||||
"sortOrder": 1,
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": 1012003,
|
||||
"name": "文具",
|
||||
"keywords": "",
|
||||
"desc": "找回书写的力量",
|
||||
"pid": 1012000,
|
||||
"iconUrl": "http://yanxuan.nosdn.127.net/e1743239e41ca9af76875aedc73be7f0.png",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/e074795f61a83292d0f20eb7d124e2ac.png",
|
||||
"level": "L2",
|
||||
"sortOrder": 1,
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": 1020003,
|
||||
"name": "服饰",
|
||||
"keywords": "",
|
||||
"desc": "萌宝穿搭,柔软舒适触感",
|
||||
"pid": 1011000,
|
||||
"iconUrl": "http://yanxuan.nosdn.127.net/4e50f3c4e4d0a64cd0ad14cfc0b6bd17.png",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/004f5f96df4aeb0645abbd70c0637239.png",
|
||||
"level": "L2",
|
||||
"sortOrder": 1,
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"errmsg": "成功"
|
||||
}
|
||||
|
||||
错误码
|
||||
|
||||
略
|
||||
|
||||
|
||||
#### 2.4.2 商品详情
|
||||
|
||||
应用场景
|
||||
|
||||
商品详情
|
||||
|
||||
接口链接
|
||||
|
||||
GET /wx/goods/detail
|
||||
|
||||
请求参数
|
||||
|
||||
id: 商品ID,例如id=1152008
|
||||
|
||||
响应内容
|
||||
|
||||
{
|
||||
"errno": 0,
|
||||
"data": {
|
||||
"specificationList": [
|
||||
{
|
||||
"name": "规格",
|
||||
"valueList": [
|
||||
{
|
||||
"id": 231,
|
||||
"goodsId": 1152008,
|
||||
"specification": "规格",
|
||||
"value": "标准",
|
||||
"picUrl": "",
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"groupon": [],
|
||||
"issue": [
|
||||
{
|
||||
"id": 1,
|
||||
"question": "购买运费如何收取?",
|
||||
"answer": "单笔订单金额(不含运费)满88元免邮费;不满88元,每单收取10元运费。\n(港澳台地区需满",
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"question": "使用什么快递发货?",
|
||||
"answer": "严选默认使用顺丰快递发货(个别商品使用其他快递),配送范围覆盖全国大部分地区(港澳台地区除",
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"question": "如何申请退货?",
|
||||
"answer": "1.自收到商品之日起30日内,顾客可申请无忧退货,退款将原路返还,不同的银行处理时间不同,",
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"question": "如何开具发票?",
|
||||
"answer": "1.如需开具普通发票,请在下单时选择“我要开发票”并填写相关信息(APP仅限2.4.0及以",
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
}
|
||||
],
|
||||
"userHasCollect": 0,
|
||||
"shareImage": "",
|
||||
"comment": {
|
||||
"data": [],
|
||||
"count": 0
|
||||
},
|
||||
"attribute": [],
|
||||
"brand": {},
|
||||
"productList": [
|
||||
{
|
||||
"id": 232,
|
||||
"goodsId": 1152008,
|
||||
"specifications": [
|
||||
"标准"
|
||||
],
|
||||
"price": 29.00,
|
||||
"number": 100,
|
||||
"url": "http://yanxuan.nosdn.127.net/203cb83d93606865e3ddde57b69b9e9a.png",
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false
|
||||
}
|
||||
],
|
||||
"info": {
|
||||
"id": 1152008,
|
||||
"goodsSn": "1152008",
|
||||
"name": "魔兽世界 部落 护腕 一只",
|
||||
"categoryId": 1032000,
|
||||
"brandId": 0,
|
||||
"gallery": [
|
||||
"http://yanxuan.nosdn.127.net/46bcddbc57e70bf5f36bdff9c9195c65.png",
|
||||
"http://yanxuan.nosdn.127.net/46bcddbc57e70bf5f36bdff9c9195c65.png",
|
||||
"http://yanxuan.nosdn.127.net/46bcddbc57e70bf5f36bdff9c9195c65.png",
|
||||
"http://yanxuan.nosdn.127.net/46bcddbc57e70bf5f36bdff9c9195c65.png",
|
||||
"http://yanxuan.nosdn.127.net/46bcddbc57e70bf5f36bdff9c9195c65.png"
|
||||
],
|
||||
"keywords": "",
|
||||
"brief": "吸汗、舒适、弹性、防护、耐用",
|
||||
"isOnSale": true,
|
||||
"sortOrder": 7,
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/203cb83d93606865e3ddde57b69b9e9a.png",
|
||||
"shareUrl": "",
|
||||
"isNew": false,
|
||||
"isHot": true,
|
||||
"unit": "件",
|
||||
"counterPrice": 49.00,
|
||||
"retailPrice": 29.00,
|
||||
"addTime": "2018-02-01 00:00:00",
|
||||
"updateTime": "2018-02-01 00:00:00",
|
||||
"deleted": false,
|
||||
"detail": ""
|
||||
}
|
||||
},
|
||||
"errmsg": "成功"
|
||||
}
|
||||
|
||||
错误码
|
||||
|
||||
略
|
||||
|
||||
|
||||
#### 2.4.3 商品推荐
|
||||
|
||||
应用场景
|
||||
|
||||
针对某个商品推荐其他商品
|
||||
|
||||
接口链接
|
||||
|
||||
GET /wx/goods/related
|
||||
|
||||
请求参数
|
||||
|
||||
id: 商品ID,例如id=1152008
|
||||
page: 请求页码
|
||||
limit: 每一页数量
|
||||
sort: 排序字段
|
||||
order: 升序降序
|
||||
|
||||
响应内容
|
||||
|
||||
{
|
||||
"errno": 0,
|
||||
"data": {
|
||||
"total": 8,
|
||||
"pages": 2,
|
||||
"limit": 6,
|
||||
"page": 1,
|
||||
"list": [
|
||||
{
|
||||
"id": 1152004,
|
||||
"name": "魔兽世界 蛋盾包 双肩包",
|
||||
"brief": "伊利丹掉落,挤地铁神器",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/8c93cef435d888bd79833777df1cd0c2.png",
|
||||
"isNew": false,
|
||||
"isHot": false,
|
||||
"counterPrice": 419.00,
|
||||
"retailPrice": 399.00
|
||||
},
|
||||
{
|
||||
"id": 1152008,
|
||||
"name": "魔兽世界 部落 护腕 一只",
|
||||
"brief": "吸汗、舒适、弹性、防护、耐用",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/203cb83d93606865e3ddde57b69b9e9a.png",
|
||||
"isNew": false,
|
||||
"isHot": true,
|
||||
"counterPrice": 49.00,
|
||||
"retailPrice": 29.00
|
||||
},
|
||||
{
|
||||
"id": 1152009,
|
||||
"name": "魔兽世界 联盟 护腕 一只",
|
||||
"brief": "吸汗、舒适、弹性、防护、耐用",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/ae6d41117717387b82dcaf1dfce0cd97.png",
|
||||
"isNew": false,
|
||||
"isHot": true,
|
||||
"counterPrice": 49.00,
|
||||
"retailPrice": 29.00
|
||||
},
|
||||
{
|
||||
"id": 1152031,
|
||||
"name": "魔兽世界-伊利丹颈枕眼罩套装",
|
||||
"brief": "差旅好伴侣",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/fd6e78a397bd9e9804116a36f0270b0a.png",
|
||||
"isNew": false,
|
||||
"isHot": true,
|
||||
"counterPrice": 119.00,
|
||||
"retailPrice": 99.00
|
||||
},
|
||||
{
|
||||
"id": 1152095,
|
||||
"name": "魔兽世界 联盟·暴风城 堡垒收纳盒",
|
||||
"brief": "桌面整理神器",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/c86b49f635fa141decebabbd0966a6ef.png",
|
||||
"isNew": false,
|
||||
"isHot": false,
|
||||
"counterPrice": 519.00,
|
||||
"retailPrice": 499.00
|
||||
},
|
||||
{
|
||||
"id": 1152097,
|
||||
"name": "魔兽世界 雷霆之怒逐风者的祝福之剑 雨伞",
|
||||
"brief": "炫酷装备,可以背的雨伞",
|
||||
"picUrl": "http://yanxuan.nosdn.127.net/532836444ae5eaec40b5810ca4f9b1e6.png",
|
||||
"isNew": false,
|
||||
"isHot": false,
|
||||
"counterPrice": 419.00,
|
||||
"retailPrice": 399.00
|
||||
}
|
||||
]
|
||||
},
|
||||
"errmsg": "成功"
|
||||
}
|
||||
|
||||
错误码
|
||||
|
||||
略
|
||||
|
||||
#### 2.4.4 商品分类
|
||||
|
||||
应用场景
|
||||
|
||||
针对某个商品推荐其他商品
|
||||
|
||||
接口链接
|
||||
|
||||
GET /wx/goods/related
|
||||
|
||||
请求参数
|
||||
|
||||
|
||||
响应内容
|
||||
|
||||
错误码
|
||||
|
||||
#### 2.4.5 在售商品总数
|
||||
|
||||
应用场景
|
||||
|
||||
在售商品总数
|
||||
|
||||
接口链接
|
||||
|
||||
GET /wx/goods/count
|
||||
|
||||
请求参数
|
||||
|
||||
无
|
||||
|
||||
响应内容
|
||||
|
||||
{
|
||||
"errno": 0,
|
||||
"data": 238,
|
||||
"errmsg": "成功"
|
||||
}
|
||||
|
||||
错误码
|
||||
|
||||
无
|
||||
|
||||
### 2.5 购物车服务
|
||||
|
||||
### 2.6 订单服务
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package org.linlinjava.litemall.wx.web;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mysql.jdbc.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.linlinjava.litemall.core.system.SystemConfig;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -276,12 +274,18 @@ public class WxGoodsController {
|
||||
categoryList = new ArrayList<>(0);
|
||||
}
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("goodsList", goodsList);
|
||||
data.put("count", PageInfo.of(goodsList).getTotal());
|
||||
data.put("filterCategoryList", categoryList);
|
||||
PageInfo<LitemallGoods> pagedList = PageInfo.of(goodsList);
|
||||
|
||||
return ResponseUtil.ok(data);
|
||||
Map<String, Object> entity = new HashMap<>();
|
||||
entity.put("list", goodsList);
|
||||
entity.put("total", pagedList.getTotal());
|
||||
entity.put("page", pagedList.getPageNum());
|
||||
entity.put("limit", pagedList.getPageSize());
|
||||
entity.put("pages", pagedList.getPages());
|
||||
entity.put("filterCategoryList", categoryList);
|
||||
|
||||
// 因为这里需要返回额外的filterCategoryList参数,因此不能方便使用ResponseUtil.okList
|
||||
return ResponseUtil.ok(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,9 +307,7 @@ public class WxGoodsController {
|
||||
// 查找六个相关商品
|
||||
int related = 6;
|
||||
List<LitemallGoods> goodsList = goodsService.queryByCategory(cid, 0, related);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("goodsList", goodsList);
|
||||
return ResponseUtil.ok(data);
|
||||
return ResponseUtil.okList(goodsList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,9 +318,7 @@ public class WxGoodsController {
|
||||
@GetMapping("count")
|
||||
public Object count() {
|
||||
Integer goodsCount = goodsService.queryOnSale();
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("goodsCount", goodsCount);
|
||||
return ResponseUtil.ok(data);
|
||||
return ResponseUtil.ok(goodsCount);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,7 @@ Page({
|
||||
});
|
||||
util.request(api.GoodsCount).then(function(res) {
|
||||
that.setData({
|
||||
goodsCount: res.data.goodsCount
|
||||
goodsCount: res.data
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Page({
|
||||
scrollTop: 0,
|
||||
scrollHeight: 0,
|
||||
page: 1,
|
||||
size: 100
|
||||
limit: 10
|
||||
},
|
||||
onLoad: function(options) {
|
||||
// 页面初始化 options为页面跳转所带来的参数
|
||||
@@ -85,7 +85,6 @@ Page({
|
||||
},
|
||||
onShow: function() {
|
||||
// 页面显示
|
||||
console.log(1);
|
||||
},
|
||||
onHide: function() {
|
||||
// 页面隐藏
|
||||
@@ -96,11 +95,11 @@ Page({
|
||||
util.request(api.GoodsList, {
|
||||
categoryId: that.data.id,
|
||||
page: that.data.page,
|
||||
size: that.data.size
|
||||
limit: that.data.limit
|
||||
})
|
||||
.then(function(res) {
|
||||
that.setData({
|
||||
goodsList: res.data.goodsList,
|
||||
goodsList: res.data.list,
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -210,7 +210,7 @@ Page({
|
||||
}).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
that.setData({
|
||||
relatedGoods: res.data.goodsList,
|
||||
relatedGoods: res.data.list,
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -467,23 +467,15 @@ Page({
|
||||
valueId: this.data.id
|
||||
}, "POST")
|
||||
.then(function(res) {
|
||||
let _res = res;
|
||||
if (_res.errno == 0) {
|
||||
if (_res.data.type == 'add') {
|
||||
that.setData({
|
||||
collectImage: that.data.hasCollectImage
|
||||
});
|
||||
} else {
|
||||
that.setData({
|
||||
collectImage: that.data.noCollectImage
|
||||
});
|
||||
}
|
||||
|
||||
if (that.data.userHasCollect == 1) {
|
||||
that.setData({
|
||||
collectImage: that.data.noCollectImage,
|
||||
userHasCollect: 0
|
||||
});
|
||||
} else {
|
||||
wx.showToast({
|
||||
image: '/static/images/icon_error.png',
|
||||
title: _res.errmsg,
|
||||
mask: true
|
||||
that.setData({
|
||||
collectImage: that.data.hasCollectImage,
|
||||
userHasCollect: 1
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
<view class="goods-info">
|
||||
<view class="c">
|
||||
<text class="desc">{{goods.goodsBrief}}</text>
|
||||
<text class="desc">{{goods.brief}}</text>
|
||||
<view class="price">
|
||||
<view class="counterPrice">原价:¥{{goods.counterPrice}}</view>
|
||||
<view class="retailPrice">现价:¥{{checkedSpecPrice}}</view>
|
||||
|
||||
@@ -16,7 +16,7 @@ Page({
|
||||
currentSort: 'add_time',
|
||||
currentSortOrder: 'desc',
|
||||
page: 1,
|
||||
size: 100
|
||||
limit: 10
|
||||
},
|
||||
getCategoryList: function() {
|
||||
var that = this;
|
||||
@@ -38,7 +38,7 @@ Page({
|
||||
util.request(api.GoodsList, {
|
||||
isHot: true,
|
||||
page: that.data.page,
|
||||
size: that.data.size,
|
||||
limit: that.data.limit,
|
||||
order: that.data.currentSortOrder,
|
||||
sort: that.data.currentSort,
|
||||
categoryId: that.data.categoryId
|
||||
@@ -46,7 +46,7 @@ Page({
|
||||
.then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
that.setData({
|
||||
goodsList: res.data.goodsList,
|
||||
goodsList: res.data.list,
|
||||
filterCategory: res.data.filterCategoryList
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ Page({
|
||||
currentSort: 'add_time',
|
||||
currentSortOrder: 'desc',
|
||||
page: 1,
|
||||
limit: 100
|
||||
limit: 10
|
||||
},
|
||||
getGoodsList: function() {
|
||||
var that = this;
|
||||
@@ -24,7 +24,7 @@ Page({
|
||||
util.request(api.GoodsList, {
|
||||
isNew: true,
|
||||
page: that.data.page,
|
||||
size: that.data.size,
|
||||
limit: that.data.limit,
|
||||
order: that.data.currentSortOrder,
|
||||
sort: that.data.currentSort,
|
||||
categoryId: that.data.categoryId
|
||||
@@ -32,7 +32,7 @@ Page({
|
||||
.then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
that.setData({
|
||||
goodsList: res.data.goodsList,
|
||||
goodsList: res.data.list,
|
||||
filterCategory: res.data.filterCategoryList
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ Page({
|
||||
grouponLink: {}, //参与的团购
|
||||
attribute: [],
|
||||
issueList: [],
|
||||
comment: [],
|
||||
brand: {},
|
||||
specificationList: [],
|
||||
productList: [],
|
||||
@@ -25,9 +24,6 @@ Page({
|
||||
tmpSpecText: '请选择规格数量',
|
||||
checkedSpecPrice: 0,
|
||||
openAttr: false,
|
||||
noCollectImage: '/static/images/icon_collect.png',
|
||||
hasCollectImage: '/static/images/icon_collect_checked.png',
|
||||
collectImage: '/static/images/icon_collect.png',
|
||||
shareImage: '',
|
||||
isGroupon: false, //标识是否是一个参团购买
|
||||
soldout: false,
|
||||
@@ -126,7 +122,6 @@ Page({
|
||||
goods: res.data.info,
|
||||
attribute: res.data.attribute,
|
||||
issueList: res.data.issue,
|
||||
comment: res.data.comment,
|
||||
brand: res.data.brand,
|
||||
specificationList: res.data.specificationList,
|
||||
productList: res.data.productList,
|
||||
@@ -152,16 +147,6 @@ Page({
|
||||
|
||||
}
|
||||
|
||||
if (res.data.userHasCollect == 1) {
|
||||
that.setData({
|
||||
collectImage: that.data.hasCollectImage
|
||||
});
|
||||
} else {
|
||||
that.setData({
|
||||
collectImage: that.data.noCollectImage
|
||||
});
|
||||
}
|
||||
|
||||
WxParse.wxParse('goodsDetail', 'html', res.data.info.detail, that);
|
||||
//获取推荐商品
|
||||
that.getGoodsRelated();
|
||||
@@ -437,38 +422,6 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
//添加或是取消收藏
|
||||
addCollectOrNot: function() {
|
||||
let that = this;
|
||||
util.request(api.CollectAddOrDelete, {
|
||||
type: 0,
|
||||
valueId: this.data.id
|
||||
}, "POST")
|
||||
.then(function(res) {
|
||||
let _res = res;
|
||||
if (_res.errno == 0) {
|
||||
if (_res.data.type == 'add') {
|
||||
that.setData({
|
||||
collectImage: that.data.hasCollectImage
|
||||
});
|
||||
} else {
|
||||
that.setData({
|
||||
collectImage: that.data.noCollectImage
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
wx.showToast({
|
||||
image: '/static/images/icon_error.png',
|
||||
title: _res.errmsg,
|
||||
mask: true
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
//立即购买(先自动加入购物车)
|
||||
addFast: function() {
|
||||
var that = this;
|
||||
@@ -599,15 +552,7 @@ Page({
|
||||
openAttr: !that.data.openAttr,
|
||||
cartGoodsCount: _res.data
|
||||
});
|
||||
if (that.data.userHasCollect == 1) {
|
||||
that.setData({
|
||||
collectImage: that.data.hasCollectImage
|
||||
});
|
||||
} else {
|
||||
that.setData({
|
||||
collectImage: that.data.noCollectImage
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
wx.showToast({
|
||||
image: '/static/images/icon_error.png',
|
||||
|
||||
@@ -16,7 +16,7 @@ Page({
|
||||
currentSort: 'add_time',
|
||||
currentSortOrder: 'desc',
|
||||
page: 1,
|
||||
limit: 100
|
||||
limit: 10
|
||||
},
|
||||
getCategoryList: function() {
|
||||
var that = this;
|
||||
@@ -38,7 +38,7 @@ Page({
|
||||
util.request(api.GoodsList, {
|
||||
isHot: true,
|
||||
page: that.data.page,
|
||||
limit: that.data.size,
|
||||
limit: that.data.limit,
|
||||
order: that.data.currentSortOrder,
|
||||
sort: that.data.currentSort,
|
||||
categoryId: that.data.categoryId
|
||||
@@ -46,7 +46,7 @@ Page({
|
||||
.then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
that.setData({
|
||||
goodsList: res.data.goodsList,
|
||||
goodsList: res.data.list,
|
||||
filterCategory: res.data.filterCategoryList
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ Page({
|
||||
currentSort: 'add_time',
|
||||
currentSortOrder: 'desc',
|
||||
page: 1,
|
||||
size: 100
|
||||
limit: 10
|
||||
},
|
||||
|
||||
onPullDownRefresh() {
|
||||
@@ -28,7 +28,7 @@ Page({
|
||||
util.request(api.GoodsList, {
|
||||
isNew: true,
|
||||
page: that.data.page,
|
||||
size: that.data.size,
|
||||
limit: that.data.limit,
|
||||
order: that.data.currentSortOrder,
|
||||
sort: that.data.currentSort,
|
||||
categoryId: that.data.categoryId
|
||||
@@ -36,7 +36,7 @@ Page({
|
||||
.then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
that.setData({
|
||||
goodsList: res.data.goodsList,
|
||||
goodsList: res.data.list,
|
||||
filterCategory: res.data.filterCategoryList
|
||||
});
|
||||
}
|
||||
@@ -44,7 +44,6 @@ Page({
|
||||
},
|
||||
onLoad: function(options) {
|
||||
// 页面初始化 options为页面跳转所带来的参数
|
||||
this.getBanner();
|
||||
this.getGoodsList();
|
||||
},
|
||||
onReady: function() {
|
||||
|
||||
Reference in New Issue
Block a user