You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.2 KiB
63 lines
1.2 KiB
var util = require('../../utils/util.js');
|
|
var api = require('../../config/api.js');
|
|
|
|
|
|
var app = getApp();
|
|
|
|
Page({
|
|
data: {
|
|
id: 0,
|
|
brand: {},
|
|
goodsList: [],
|
|
page: 1,
|
|
size: 100
|
|
},
|
|
onLoad: function (options) {
|
|
// 页面初始化 options为页面跳转所带来的参数
|
|
var that = this;
|
|
that.setData({
|
|
id: parseInt(options.id)
|
|
});
|
|
this.getBrand();
|
|
},
|
|
getBrand: function () {
|
|
let that = this;
|
|
util.request(api.BrandDetail, { id: that.data.id }).then(function (res) {
|
|
if (res.code === 200) {
|
|
that.setData({
|
|
brand: res.data
|
|
});
|
|
|
|
that.getGoodsList();
|
|
}
|
|
});
|
|
},
|
|
getGoodsList() {
|
|
var that = this;
|
|
|
|
util.request(api.GoodsList, { brandId: that.data.id, page: that.data.page, size: that.data.size,categoryId:0})
|
|
.then(function (res) {
|
|
if (res.code === 200) {
|
|
that.setData({
|
|
goodsList: res.data
|
|
});
|
|
}
|
|
});
|
|
},
|
|
onReady: function () {
|
|
// 页面渲染完成
|
|
|
|
},
|
|
onShow: function () {
|
|
// 页面显示
|
|
|
|
},
|
|
onHide: function () {
|
|
// 页面隐藏
|
|
|
|
},
|
|
onUnload: function () {
|
|
// 页面关闭
|
|
|
|
}
|
|
}) |