deguodaigou/pages/shopping/shopping.js

90 lines
1.6 KiB
JavaScript
Raw Normal View History

2019-12-13 11:59:11 +08:00
// pages/shopping/shopping.js
2019-12-19 14:27:45 +08:00
import {request} from "../../utils/bin"
2019-12-13 11:59:11 +08:00
Page({
2019-12-16 18:26:28 +08:00
/**
* 页面的初始数据
*/
data: {
2019-12-19 14:27:45 +08:00
list:[1,1,1],
userid:0
2019-12-16 18:26:28 +08:00
},
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
/**
* 生命周期函数--监听页面加载
*/
2019-12-19 14:27:45 +08:00
getlist(){
request({
url:"Cart/cartList/session_id/" + wx.getStorageSync('openid'),
data:{
user_id:this.data.userid
}
}).then((res)=>{
console.log(res)
})
},
2019-12-16 18:26:28 +08:00
onLoad: function(options) {
2019-12-19 14:27:45 +08:00
request({
url:"User/validateOpenid"
}).then((res)=>{
console.log(res)
this.setData({
userid:res.data.data.user_id
})
this.getlist()
})
2019-12-16 18:26:28 +08:00
},
sub() {
wx.navigateTo({
url: "/pages/orderconfirm/orderconfirm"
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
},
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
},
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
},
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
},
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
},
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
},
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
2019-12-13 11:59:11 +08:00
2019-12-16 18:26:28 +08:00
}
2019-12-13 11:59:11 +08:00
})