123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- const Parse = getApp().Parse;
- const company = getApp().globalData.company;
- const dateF = require('../../../../../utils/date')
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- id:null,
- schema:null,
- order:{},
- explain: '',
- show:false,
- causes:[
- {
- label: '多拍/拍错/不想要',
- value: '多拍/拍错/不想要',
- checked: false
- },
- {
- label: '时间变更',
- value: '时间变更',
- checked: false
- },
- {
- label: '其他',
- value: '其他',
- checked: false
- }
- ],
- causeVal:'',
- activeColor:''
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData({
- activeColor:getApp().globalData.activeColor || '#229293'
- })
- let {id,schema}=options;
- this.setData({
- id,
- schema
- })
- if(schema == 'RoomOrder'){
- this.getRoomOrder()
- return
- }
- this.getOrder()
- },
- async getRoomOrder() {
- console.log(this.data.schema,this.data.id);
- let Order = new Parse.Query("RoomOrder")
- Order.include('shopStore')
- Order.include('room')
- let parseOrder = await Order.get(this.data.id)
- console.log(parseOrder);
- if(parseOrder && parseOrder.id){
- let order = parseOrder.toJSON()
- order.startTime = dateF.formatTime("YYYY/mm/dd", order.startTime.iso)
- order.endTime = dateF.formatTime("YYYY/mm/dd", order.endTime.iso)
- this.setData({
- parseOrder,
- order
- })
- }
- console.log(this.data.order);
- },
- async getOrder() {
- console.log(this.data.schema,this.data.id);
- let Order = new Parse.Query(this.data.schema || 'ShopOrder')
- Order.include('shopStore')
- let parseOrder = await Order.get(this.data.id)
- console.log(parseOrder);
- if(parseOrder && parseOrder.id){
- let order = parseOrder.toJSON()
- this.setData({
- parseOrder,
- order
- })
- }
- console.log(this.data.order);
- },
- async submit(){
- if(this.data.causeVal.trim() == '' ){
- wx.showToast({
- title: '请选择退款原因',
- icon: 'none'
- })
- return
- }
- let parseOrder = this.data.parseOrder;
- parseOrder.fetch().then((res) =>{
- console.log(res);
- parseOrder.set("status", 500);
- parseOrder.set("refundCause", this.data.causeVal);
- parseOrder.set("refundExplain", this.data.explain);
- parseOrder.save();
- wx.showToast({
- title: '提交成功',
- icon: 'none'
- })
- setTimeout(() => {
- wx.navigateBack({
- delta: 1,
- })
- }, 1000);
- },err =>{
- console.log(err);
- })
- },
- showPopup() {
- this.setData({ show: true });
- },
-
- onClose() {
- this.setData({ show: false });
- },
- causeChange(event){
- console.log(event);
- this.setData({ causeVal: event.detail.value });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|