添加购物车
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// pages/product/product.js
|
||||
// pages/product/product.js'
|
||||
import { request } from "../../utils/bin"
|
||||
Page({
|
||||
|
||||
/**
|
||||
@@ -12,15 +13,40 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
|
||||
console.log(options)
|
||||
request({
|
||||
url: "Goods/goodsInfo",
|
||||
data: {
|
||||
id: options.shopid
|
||||
}
|
||||
}).then((res) => {
|
||||
// console.log(res)
|
||||
this.setData({
|
||||
info: res.data.result,
|
||||
shopid:options.shopid,
|
||||
})
|
||||
// console.log(this.data.type, 150)
|
||||
})
|
||||
},
|
||||
// goshop() {
|
||||
|
||||
// },
|
||||
bindPickerChange(e) {
|
||||
wx.switchTab({
|
||||
url: '/pages/shopping/shopping'
|
||||
})
|
||||
console.log(e.detail.value)
|
||||
request({
|
||||
url: "Cart/addCart",
|
||||
data: {
|
||||
goods_id: this.data.shopid,
|
||||
goods_num: 1,
|
||||
goods_spec:e.detail.value
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
wx.switchTab({
|
||||
url: '/pages/shopping/shopping'
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
|
||||
Reference in New Issue
Block a user