添加购物车

This commit is contained in:
asd
2019-12-19 14:29:24 +08:00
parent a42c9a1ba3
commit b545679dad
5 changed files with 50 additions and 21 deletions

View File

@@ -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'
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成