123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- const Parse = getApp().Parse;
- const company = getApp().globalData.company
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- active: 0,
- meal: null,
- goods: null,
- room: null,
- },
- async getShopOrder() {
- let ShopOrder = new Parse.Query('ShopOrder')
- ShopOrder.equalTo('company', company)
- ShopOrder.equalTo('user', Parse.User.current().id)
- ShopOrder.equalTo('status', 800)
- ShopOrder.exists('score')
- ShopOrder.equalTo('type', 'meal')
- ShopOrder.include('shopStore')
- let shopOrder = await ShopOrder.find()
- let listJSON = []
- if (shopOrder && shopOrder.length > 0) {
- shopOrder.forEach(c => {
- listJSON.push(c.toJSON())
- })
- }
- this.setData({
- meal: listJSON
- })
- console.log(this.data.meal);
- },
- look(e) {
- let id = e.currentTarget.dataset.item.objectId
- console.log(id);
- wx.navigateTo({
- url: '/nova-tourism/pages/my/comments/look/index?id=' + id
- });
- },
- looks(e) {
- let id = e.currentTarget.dataset.item.objectId
- console.log(id);
- wx.navigateTo({
- url: '/nova-tourism/pages/my/comments/look2/index?id=' + id
- });
- },
- onChange(event) {
- active = event.detail.name
- this.setData({ active: active })
- },
- async getGoods() {
- let ShopOrder = new Parse.Query('ShopOrder')
- ShopOrder.equalTo('company', company)
- ShopOrder.equalTo('user', Parse.User.current().id)
- ShopOrder.equalTo('status', 800)
- ShopOrder.exists('score')
- ShopOrder.equalTo('type', 'goods')
- ShopOrder.include('shopStore')
- let shopOrder = await ShopOrder.find()
- let listJSON = []
- if (shopOrder && shopOrder.length > 0) {
- shopOrder.forEach(c => {
- listJSON.push(c.toJSON())
- })
- }
- this.setData({
- goods: listJSON
- })
- console.log(this.data.goods);
- },
- async getRoom() {
- let ShopOrder = new Parse.Query('RoomOrder')
- ShopOrder.equalTo('company', company)
- ShopOrder.equalTo('user', Parse.User.current().id)
- ShopOrder.equalTo('status', 800)
- ShopOrder.exists('score')
- ShopOrder.include('room')
- let shopOrder = await ShopOrder.find()
- let listJSON = []
- if (shopOrder && shopOrder.length > 0) {
- shopOrder.forEach(c => {
- listJSON.push(c.toJSON())
- })
- }
- this.setData({
- room: listJSON
- })
- console.log(this.data.room);
- },
- onChange(event) {
- let active = event.detail.name
- this.setData({ active: active })
- },
- async submit(e) {
- let that = this
- let id = e.currentTarget.dataset.item.objectId
- console.log(id);
- wx.showModal({
- title: '提示',
- content: '是否删除评论',
- success(res) {
- that.confirm(id)
- if (res.confirm) {
- console.log('确定')
- } else if (res.cancel) {
- console.log('取消')
- return
- }
- }
- })
- },
- async submits(e) {
- let that = this
- let id = e.currentTarget.dataset.item.objectId
- console.log(id);
- wx.showModal({
- title: '提示',
- content: '是否删除评论',
- success(res) {
- that.confirms(id)
- if (res.confirm) {
- console.log('确定')
- } else if (res.cancel) {
- console.log('取消')
- return
- }
- }
- })
- },
- async confirms(id) {
- let shopOrder
- let query = new Parse.Query("RoomOrder")
- shopOrder = await query.get(id)
- console.log(shopOrder);
- shopOrder.set("content", null)
- shopOrder.set("images", null)
- shopOrder.set("score", null)
- shopOrder.save().then(res => {
- console.log(res)
- wx.showToast({
- title: '删除成功',
- icon: 'none'
- })
- wx.navigateBack({
- delta: 1,
- });
- })
- console.log(shopOrder);
- },
- async confirm(id) {
- let shopOrder
- let query = new Parse.Query("ShopOrder")
- shopOrder = await query.get(id)
- console.log(shopOrder);
- shopOrder.set("content", null)
- shopOrder.set("images", null)
- shopOrder.set("score", null)
- shopOrder.save().then(res => {
- console.log(res)
- wx.showToast({
- title: '删除成功',
- icon: 'none'
- })
- wx.navigateBack({
- delta: 1,
- });
- })
- console.log(shopOrder);
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- this.setData({
- activeColor:getApp().globalData.activeColor || '#229293'
- })
- this.getShopOrder()
- this.getGoods()
- this.getRoom()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function() {
- }
- })
|