|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
// pages/cart/cart.js
|
|
|
|
|
const db = wx.cloud.database({});
|
|
|
|
|
const app=getApp()
|
|
|
|
|
const userid=app.globalData.openid
|
|
|
|
|
Page({
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -98,8 +100,10 @@ setChecked: function() {
|
|
|
|
|
cartlistsee:cartlistsee //更新商品数据
|
|
|
|
|
})
|
|
|
|
|
console.log(cartlistsee)
|
|
|
|
|
db.collection('user')
|
|
|
|
|
.doc('eda7dd506371adb300c89bc66afc4601') //还需修改
|
|
|
|
|
db.collection('user').
|
|
|
|
|
where({
|
|
|
|
|
"_openid":userid
|
|
|
|
|
}) //还需修改
|
|
|
|
|
.update(
|
|
|
|
|
{
|
|
|
|
|
data:{
|
|
|
|
@ -130,7 +134,9 @@ db.collection('user')
|
|
|
|
|
})
|
|
|
|
|
console.log(cartlistsee)
|
|
|
|
|
db.collection('user')//回调回云数据库
|
|
|
|
|
.doc('eda7dd506371adb300c89bc66afc4601') //还需修改
|
|
|
|
|
.where({
|
|
|
|
|
"_openid":userid
|
|
|
|
|
}) //还需修改
|
|
|
|
|
.update(
|
|
|
|
|
{
|
|
|
|
|
data:{
|
|
|
|
@ -160,7 +166,9 @@ let foodid=cartlistsee[index]._id
|
|
|
|
|
cartlistsee:cartlistsee
|
|
|
|
|
})
|
|
|
|
|
db.collection('user')//回调回云数据库
|
|
|
|
|
.doc('eda7dd506371adb300c89bc66afc4601') //还需修改
|
|
|
|
|
. where({
|
|
|
|
|
"_openid":userid
|
|
|
|
|
}) //还需修改
|
|
|
|
|
.update(
|
|
|
|
|
{
|
|
|
|
|
data:{
|
|
|
|
@ -169,7 +177,9 @@ let foodid=cartlistsee[index]._id
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
db.collection('user')//回调回云数据库
|
|
|
|
|
.doc('eda7dd506371adb300c89bc66afc4601') //还需修改
|
|
|
|
|
.where({
|
|
|
|
|
"_openid":userid
|
|
|
|
|
}) //还需修改
|
|
|
|
|
.update(
|
|
|
|
|
{
|
|
|
|
|
data:{
|
|
|
|
@ -193,14 +203,16 @@ let foodid=cartlistsee[index]._id
|
|
|
|
|
})
|
|
|
|
|
//2、开始查询数据了 news对应的是集合的名称
|
|
|
|
|
db.collection("user")
|
|
|
|
|
.doc("eda7dd506371adb300c89bc66afc4601")
|
|
|
|
|
.where({
|
|
|
|
|
"_openid":userid
|
|
|
|
|
})
|
|
|
|
|
.get()
|
|
|
|
|
.then(res => {
|
|
|
|
|
console.log("列表页", res.data);
|
|
|
|
|
console.log(res.data.cartlist)
|
|
|
|
|
console.log(res.data[0].cartlist)
|
|
|
|
|
//再次显示数据
|
|
|
|
|
this.setData({
|
|
|
|
|
cartlistsee:res.data.cartlist,
|
|
|
|
|
cartlistsee:res.data[0].cartlist,
|
|
|
|
|
total_all_price: 0,
|
|
|
|
|
checked: false
|
|
|
|
|
})
|
|
|
|
|