diff --git a/scr/food/pages/cart/cart.js b/scr/food/pages/cart/cart.js index 337f2ef..3831afd 100644 --- a/scr/food/pages/cart/cart.js +++ b/scr/food/pages/cart/cart.js @@ -179,6 +179,7 @@ let foodid=cartlistsee[index]._id title: '温馨提示', content: '确定删除当前商品吗?', confirmColor: "#f00", + success: (res) => { if (res.confirm) { cartlistsee.splice(index, 1); diff --git a/scr/food/pages/index/index.wxml b/scr/food/pages/index/index.wxml index bdf6ab6..ced66fd 100644 --- a/scr/food/pages/index/index.wxml +++ b/scr/food/pages/index/index.wxml @@ -2,7 +2,7 @@ - + diff --git a/scr/food/pages/orderlist/orderlist.js b/scr/food/pages/orderlist/orderlist.js index abfd40b..5c25cde 100644 --- a/scr/food/pages/orderlist/orderlist.js +++ b/scr/food/pages/orderlist/orderlist.js @@ -23,7 +23,7 @@ Page({ console.log(foodid) wx.showModal({ title: '温馨提示', - content: '确定删除当前商品吗?', + content: '确定删除当前订单吗?', confirmColor: "#f00", success: (res) => { if (res.confirm) { @@ -55,7 +55,7 @@ Page({ ) }} }) - this.getTotalPrice() + console.log(orderlist) }, /** diff --git a/scr/food/pages/select1/select1.js b/scr/food/pages/select1/select1.js new file mode 100644 index 0000000..01e8492 --- /dev/null +++ b/scr/food/pages/select1/select1.js @@ -0,0 +1,109 @@ +// pages/select1/select1.js +Page({ + data: { + foodlist:[], + tabs: ['主食','小吃'], + index:null, + current:'', + re:[], + selectlist:[] + }, + + + tabSelect:function(e){ + var foodlist=[] + var current = e.currentTarget.dataset.tab + this.setData({ + current:current + }) + + const _ = wx.cloud.database().command + console.log(current) + wx.cloud.database().collection('food').where(_.or([ + { + tab: wx.cloud.database().RegExp({ + regexp: this.data.current, + options: 'i', + }) + } + ]) + ) + .get() + .then(res => { + this.setData({ + foodlist: res.data, + }) + wx.hideLoading({ + }) + wx.setStorageSync('foodlist', res.data) + let foodlist= wx.getStorageSync('foodlist') + console.log(foodlist) + + + }), + + wx.navigateTo({ + url: '/pages/select2/select2?info='+JSON.stringify(this.data.foodlist) + }) +}, + /** + * 页面的初始数据 + */ + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/scr/food/pages/select1/select1.json b/scr/food/pages/select1/select1.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/scr/food/pages/select1/select1.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/scr/food/pages/select1/select1.wxml b/scr/food/pages/select1/select1.wxml new file mode 100644 index 0000000..6835083 --- /dev/null +++ b/scr/food/pages/select1/select1.wxml @@ -0,0 +1,7 @@ + + +选择您需要的食物类型 + + + {{item}} + \ No newline at end of file diff --git a/scr/food/pages/select1/select1.wxss b/scr/food/pages/select1/select1.wxss new file mode 100644 index 0000000..53c4613 --- /dev/null +++ b/scr/food/pages/select1/select1.wxss @@ -0,0 +1,30 @@ +/* pages/select1/select1.wxss */ +.title{ + font-family:fantasy; + font-size: larger; + font-style:italic; + text-align: center; + font: weight 700; + +} +.button{ + font-family:fantasy; + font-size: larger; + width: 80%; + height: 100rpx; + margin: 100rpx; + background-color: rgb(137, 186, 192); + color: rgb(57, 65, 71); + border-radius: 98rpx; + text-align: center; + vertical-align: center; + line-height: 100rpx; + margin: 0 auto; + font-weight: bolder; + +} +.button_hover{ + position: relative; + top: 3rpx; + box-shadow:0px 0px 8px #999 inset; +} \ No newline at end of file diff --git a/scr/food/pages/select2/select2.js b/scr/food/pages/select2/select2.js new file mode 100644 index 0000000..e68263f --- /dev/null +++ b/scr/food/pages/select2/select2.js @@ -0,0 +1,137 @@ +// pages/select1/select1.js +Page({ + data: { + foodlist:[], + tastes: ['香辣','香咸','酸甜','椒麻'], + index:null, + current:'', + re:[], + selectlist:[] + }, + + +tasteSelect:function(e){ +var taste=e.currentTarget.dataset.taste +console.log(taste) +var foodlist=this.data.foodlist +console.log(foodlist) +var foodlistselect=[] +console.log(foodlist[1].taste) +//对食物进行筛选 +for(var i=0;i { + if (res.confirm) { + wx.navigateTo({ + url: '/pages/paying/paying?info='+JSON.stringify(selection2)+'&totalprice='+total + }) + } + + + + } + }) + + + +}, + + + // wx.navigateTo({ + // url: '/pages/fuzzy/fuzzy?list='+JSON.stringify(list), + // }) + /** + * 页面的初始数据 + */ + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad:function(options) { + + var foodlist=JSON.parse(options.info) + console.log(foodlist) + this.setData({ + foodlist:foodlist + }) + + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/scr/food/pages/select2/select2.json b/scr/food/pages/select2/select2.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/scr/food/pages/select2/select2.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/scr/food/pages/select2/select2.wxml b/scr/food/pages/select2/select2.wxml new file mode 100644 index 0000000..7d88c9f --- /dev/null +++ b/scr/food/pages/select2/select2.wxml @@ -0,0 +1,7 @@ + + + + + {{item}} + + diff --git a/scr/food/pages/select2/select2.wxss b/scr/food/pages/select2/select2.wxss new file mode 100644 index 0000000..0d610b7 --- /dev/null +++ b/scr/food/pages/select2/select2.wxss @@ -0,0 +1,22 @@ +/* pages/select2/select2.wxss */ +.button{ + font-family:fantasy; + font-size: larger; + width: 80%; + height: 100rpx; + margin: 100rpx; + background-color: rgb(137, 186, 192); + color: rgb(57, 65, 71); + border-radius: 98rpx; + text-align: center; + vertical-align: center; + line-height: 100rpx; + margin: 0 auto; + font-weight: bolder; + +} +.button_hover{ + position: relative; + top: 3rpx; + box-shadow:0px 0px 8px #999 inset; +} \ No newline at end of file diff --git a/scr/food/pages/turning/turning.js b/scr/food/pages/turning/turning.js index 64bfc0d..f69d1cf 100644 --- a/scr/food/pages/turning/turning.js +++ b/scr/food/pages/turning/turning.js @@ -38,7 +38,8 @@ Page({ wx.showModal({ title: '提示', content: str, - success: function() { //点击确定后还原到0度 + success(res) { //点击确定后还原到0度 + if (res.confirm) { let animation = wx.createAnimation({ duration: 100, timingFunction: 'linear' @@ -48,7 +49,7 @@ Page({ rotate: animation.export(), turning: false }) - + } var Selection=[] var detailObj=_this.data.detailObj var total=detailObj.price @@ -87,7 +88,6 @@ Page({ }, onLoad: function() { const db=wx.cloud.database() - var that=this db.collection("user") .where({ "_openid":userid @@ -101,12 +101,12 @@ Page({ //随机在购物车里选择一件商品 var p=Math.round(Math.random()*o) console.log(p) - that.setData({ + this.setData({ list:res.data[0].cartlist[p].food_name, detailObj:res.data[0].cartlist[p] }) var detailObj=this.data.detailObj - console.log(detailObj) + console.log("cartlist内容:",detailObj) // console.log('请求成功2',res.data[0].cartlist[p].food_name); wx.setStorageSync('i', res.data[0].cartlist[p].food_name) },