购物车获取
This commit is contained in:
		
							parent
							
								
									f51effaf09
								
							
						
					
					
						commit
						d99b44f534
					
				@ -1,18 +1,38 @@
 | 
			
		||||
// pages/shopping/shopping.js
 | 
			
		||||
import {request} from "../../utils/bin"
 | 
			
		||||
Page({
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 页面的初始数据
 | 
			
		||||
     */
 | 
			
		||||
    data: {
 | 
			
		||||
        list:[1,1,1]
 | 
			
		||||
        list:[1,1,1],
 | 
			
		||||
        userid:0
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 生命周期函数--监听页面加载
 | 
			
		||||
     */
 | 
			
		||||
    getlist(){
 | 
			
		||||
        request({
 | 
			
		||||
            url:"Cart/cartList/session_id/" + wx.getStorageSync('openid'),
 | 
			
		||||
            data:{
 | 
			
		||||
                user_id:this.data.userid
 | 
			
		||||
            }
 | 
			
		||||
        }).then((res)=>{
 | 
			
		||||
            console.log(res)
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
    onLoad: function(options) {
 | 
			
		||||
 | 
			
		||||
        request({
 | 
			
		||||
            url:"User/validateOpenid"
 | 
			
		||||
        }).then((res)=>{
 | 
			
		||||
            console.log(res)
 | 
			
		||||
            this.setData({
 | 
			
		||||
                userid:res.data.data.user_id
 | 
			
		||||
            })
 | 
			
		||||
            this.getlist()
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
    sub() {
 | 
			
		||||
        wx.navigateTo({
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user