chore[litemall-wx, litemall-wx-api]: 商品API调整及文档

This commit is contained in:
Junling Bu
2019-05-07 15:12:31 +08:00
parent 5db8a6e8f2
commit dc327eb563
11 changed files with 474 additions and 105 deletions

View File

@@ -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',

View File

@@ -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
});
}

View File

@@ -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() {