2019-12-23 10:04:09 +08:00
|
|
|
// pages/classify/classify.js
|
|
|
|
import { request } from "../../utils/bin"
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
type: [],
|
|
|
|
list:[]
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function(options) {
|
|
|
|
request({
|
|
|
|
url: "Goods/goodsCategoryList",
|
|
|
|
data: {
|
|
|
|
parent_id: 2
|
|
|
|
}
|
|
|
|
}).then((res) => {
|
|
|
|
// console.log(res)
|
|
|
|
this.setData({
|
|
|
|
type: res.data.result
|
|
|
|
})
|
|
|
|
this.select({detail:{id:res.data.result[0].id}})
|
|
|
|
console.log(this.data.type, 150)
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
select(a){
|
|
|
|
// console.log(a)
|
|
|
|
// a.detail.id
|
|
|
|
request({
|
|
|
|
url:'Goods/goodsList',
|
|
|
|
urldata:{
|
2019-12-24 16:32:27 +08:00
|
|
|
cat_id:a.detail.id,
|
2019-12-23 10:04:09 +08:00
|
|
|
sort:'shop_price',
|
|
|
|
sort_asc:'desc',
|
|
|
|
p:0
|
|
|
|
}
|
|
|
|
}).then((res)=>{
|
|
|
|
console.log(res)
|
|
|
|
this.setData({
|
|
|
|
list:res.data.result.goods_list
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady: function() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide: function() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload: function() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh: function() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom: function() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage: function() {
|
|
|
|
|
|
|
|
}
|
2019-12-13 15:39:55 +08:00
|
|
|
})
|