|
@@ -100,10 +100,10 @@ Page({
|
|
|
// 查询数据
|
|
|
let arr = meal.list.find(i => i.id === data.id);
|
|
|
if (arr) {//已有值
|
|
|
- let qwe = { id: arr.id, title: arr.title, num: arr.num + 1 }
|
|
|
+ let qwe = { ...arr, num: arr.num + 1 } //id: arr.id, title: arr.title
|
|
|
meal.list.splice(res, 1, qwe)
|
|
|
} else {//没有值
|
|
|
- let arr = { id: data.id, title: data.title, num: 1 }
|
|
|
+ let arr = { ...data, num: 1 } //id: data.id, title: data.title
|
|
|
meal.list.push(arr)
|
|
|
}
|
|
|
},
|
|
@@ -140,6 +140,28 @@ Page({
|
|
|
// 提交
|
|
|
onSubmit: function () {
|
|
|
console.log(this.data.form);
|
|
|
+ console.log(app.globalData.openid)
|
|
|
+ const data = JSON.parse(JSON.stringify(this.data.form))
|
|
|
+ if (app.globalData.openid) data.openid = app.globalData.openid;
|
|
|
+ if (this.data.today) data.date = this.data.today
|
|
|
+ console.log(data)
|
|
|
+ // wx.request({
|
|
|
+ // url: `${app.globalData.publicUrl}/api/st/dining/order`,
|
|
|
+ // method: "post",
|
|
|
+ // header: {
|
|
|
+ // 'x-tenant': 'test'
|
|
|
+ // },
|
|
|
+ // data,
|
|
|
+ // success: res => {
|
|
|
+ // console.log(res)
|
|
|
+ // },
|
|
|
+ // error: err => {
|
|
|
+ // wx.showToast({
|
|
|
+ // title: err.msg,
|
|
|
+ // icon: 'error'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
wx.showToast({
|
|
|
title: '完成点餐',
|
|
|
})
|