const Parse = getApp().Parse; const company = getApp().globalData.company let navigationBarHeight = getApp().globalData.statusBarHeight + 44; Page({ /** * 页面的初始数据 */ data: { active: 0, list: [], price: null, stickytop: navigationBarHeight, activeColor:"" }, async acceptResult(e) { let { activeOrder } = this.data let that = this let { params, no } = e.detail; that.setData({ showPayment: false }) try { if (params == "ok") { // activeOrder.set("status", 200) // activeOrder.set("isPay", true) await that.getorder() // await activeOrder.save() wx.showToast({ title: '支付成功', icon: 'none', duration: 1500, mask: false, }); wx.navigateBack({ delta: 1, }) } else { wx.showToast({ title: '支付失败,取消订单', icon: 'none', duration: 1500, mask: false, }); } } catch (error) { console.log(error) wx.showToast({ title: "支付失败", icon: "error", duration: 1500, }); wx.hideLoading() } }, async getorder(){ let id=this.data.id console.log(id); let shopOrder let ShopOrder = new Parse.Query("ShopOrder") shopOrder = await ShopOrder.get(id) shopOrder.set("status", 200) shopOrder.save().then(res => { console.log(res) }) }, onChange(event) { let active = event.detail.name this.setData({ active: active }) console.log(active); this.getShopOrder() }, storepackage(e) { let userLogin = wx.getStorageSync("userLogin"); if (userLogin == "") { login.loginNow(); return; } let price = e.currentTarget.dataset.item.price let id=e.currentTarget.dataset.item.objectId console.log(price); this.setData({ show: true, price: price, id:id }) }, //删除 delOrder(e) { console.log(e); let { index } = e.currentTarget.dataset let { list } = this.data let _this = this wx.showModal({ title: '', content: '你确定删除该订单吗?', showCancel: true, cancelText: '取消', cancelColor: '#000000', confirmText: '确定', confirmColor: '#3CC51F', success: async(result) => { if (result.confirm) { await this.upDel(list[index].objectId) list.splice(index, 1) _this.setData({ list }) wx.showToast({ title: '已取消', icon: 'none', image: '', duration: 1500, }); } }, fail: () => {}, complete: () => {} }); }, async upDel(id) { let ShopOrder = new Parse.Query('ShopOrder') let order = await ShopOrder.get(id) if (order && order.id) { console.log(order); await order.destroy() } }, evaluation(e) { let id = e.currentTarget.dataset.item.objectId console.log(id); wx.navigateTo({ url: '/nova-tourism/pages/my/order-details/evaluation/index?id=' + id }); }, orderpay(e) { let id = e.currentTarget.dataset.item.objectId console.log(id); wx.navigateTo({ url: '/nova-tourism/pages/my/order-details/order-pay/index?id=' + id }); }, refund(e) { let id = e.currentTarget.dataset.item.objectId console.log(id); wx.navigateTo({ url: '/nova-tourism/pages/my/refund/reply-refund/index?id=' + id }); }, async getShopOrder() { let ShopOrder = new Parse.Query('ShopOrder') ShopOrder.equalTo('company', company) ShopOrder.equalTo('user', Parse.User.current().id) if (this.data.active == 1) { ShopOrder.equalTo('status', 100) } if (this.data.active == 2) { ShopOrder.equalTo('status', 200) } if (this.data.active == 3) { console.log(this.data.active) ShopOrder.equalTo('status', 400) } ShopOrder.include('shopStore') let shopOrder = await ShopOrder.find() let listJSON = [] if (shopOrder && shopOrder.length > 0) { shopOrder.forEach(c => { listJSON.push(c.toJSON()) }) } this.setData({ list: listJSON }) console.log(this.data.list); }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { this.setData({ activeColor:getApp().globalData.activeColor || '#229293' }) this.getShopOrder() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { }, /** * 生命周期函数--监听页面显示 */ onShow: function() { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { } })