|
|
import wx from '../../../utils/wx';
|
|
|
import Yas from '../../../common/yas';
|
|
|
import orderHandle from './order-handle';
|
|
|
import commonModel from '../../../models/common';
|
|
|
import orderModel from '../../../models/home/order';
|
|
|
import formatImage from '../../../utils/formatImage';
|
|
|
|
...
|
...
|
@@ -15,7 +16,8 @@ Page({ |
|
|
windowHeight: windowHeight + 48,
|
|
|
orderType: 1,
|
|
|
ordersList: [],
|
|
|
reason: []
|
|
|
reason: [],
|
|
|
orderCode: ''
|
|
|
},
|
|
|
onLoad: function (options) {
|
|
|
let type = options.type || 1;
|
...
|
...
|
@@ -151,22 +153,28 @@ Page({ |
|
|
delOrder: function(e) {
|
|
|
const code = e.target.dataset.code;
|
|
|
|
|
|
orderHandle.deleteOrder(code, () => {
|
|
|
this.getOrders(this.data.orderType);
|
|
|
orderHandle.deleteOrder(code, res => {
|
|
|
if (res && res.code == 200) {
|
|
|
this.getOrders(this.data.orderType);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
confirmReceive: function(e) {
|
|
|
let code = e.currentTarget.dataset.code;
|
|
|
|
|
|
orderHandle.confirmReceive(code, () => {
|
|
|
this.getOrders(this.data.orderType);
|
|
|
orderHandle.confirmReceive(code, res => {
|
|
|
if (res && res.code == 200) {
|
|
|
this.getOrders(this.data.orderType);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
cancelOrder: function(e) {
|
|
|
let code = e.currentTarget.dataset.code;
|
|
|
|
|
|
orderHandle.cancelOrder(code, () => {
|
|
|
this.getOrders(this.data.orderType);
|
|
|
orderHandle.cancelOrder(code, res => {
|
|
|
if (res && res.code == 200) {
|
|
|
this.getOrders(this.data.orderType);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
expressDetail: function(e){
|
...
|
...
|
@@ -175,8 +183,8 @@ Page({ |
|
|
orderHandle.expressDetail(code);
|
|
|
},
|
|
|
payNow: function(e) {
|
|
|
let code = e.target.dataset.code;
|
|
|
let amount = e.target.dataset.amount;
|
|
|
let code = e.currentTarget.dataset.code;
|
|
|
let amount = e.currentTarget.dataset.amount;
|
|
|
|
|
|
orderHandle.payNow({ order_code: code, order_amount: amount});
|
|
|
},
|
...
|
...
|
@@ -191,9 +199,11 @@ Page({ |
|
|
});
|
|
|
this.getOrders(type);
|
|
|
},
|
|
|
refundOrder() {
|
|
|
refundOrder(e) {
|
|
|
let that = this;
|
|
|
|
|
|
this.refundOrderCode = e.currentTarget.dataset.code;
|
|
|
|
|
|
wx.showModal({
|
|
|
content: '申请退款后,本单享有的优惠可能会一并取消,确定申请吗?',
|
|
|
cancelText: '取消',
|
...
|
...
|
@@ -216,12 +226,22 @@ Page({ |
|
|
this.reasonIndex = e.detail.value[0];
|
|
|
},
|
|
|
reasonSure() {
|
|
|
orderHandle.refundNow(this.orderCode, this.data.reason[this.reasonIndex || 0], res => {
|
|
|
orderHandle.refundNow(this.refundOrderCode,
|
|
|
this.data.reason[this.reasonIndex || 0], res => {
|
|
|
if (res && res.code == 200) {
|
|
|
wx.navigateBack({delta:1});
|
|
|
this.getOrders(this.data.orderType);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.setData({showReason: false});
|
|
|
},
|
|
|
submitFormId: function (e) {
|
|
|
//上报formID
|
|
|
commonModel.addWechatFormId({
|
|
|
order_code: e.detail.value.orderCode,
|
|
|
openId: app.getOpenID(),
|
|
|
miniapp_type: app.getMiniappType(),
|
|
|
formId: e.detail.formId
|
|
|
});
|
|
|
}
|
|
|
}); |
...
|
...
|
|