|
|
// src/components/order/orderaction.js
|
|
|
// import event from '../../utils/event.js';
|
|
|
import { formatTimeByMin } from '../../utils/index.js';
|
|
|
import { showDialog } from './orderActionUtil.js';
|
|
|
import { prePay } from '../../pages/order/wxpay.js'
|
|
|
// import OrderActionService from './orderActionService.js';
|
|
|
// const DEL_ORDER = 'del_order';
|
|
|
import router from '../../router/index.js'
|
|
|
const BUY_AGAIN = 'buy_again';
|
|
|
// const CANCEL_ORDER = 'cancel_order';
|
|
|
const NOW_BUY = 'now_buy';
|
|
|
const SHOW_DETAIL = 'show_detail';
|
|
|
// const CONFIRM_ORDER = 'confirm_order';//确认收货
|
|
|
// //订单操作接口
|
|
|
// const UFO_BUYER_DELETE_ORDER = 'ufo.buyer.delete';//删除订单
|
|
|
// const UFO_BUYER_CANCEL_ORDER = 'ufo.buyer.cancel';//取消订单
|
|
|
// const UFO_BUYER_CONFIRM_ORDER = 'ufo.buyer.confirm';//确认收货
|
|
|
// const api = new OrderActionService();
|
|
|
|
|
|
// var interval;
|
|
|
|
|
|
Component({
|
|
|
/**
|
...
|
...
|
@@ -57,9 +47,7 @@ attached: function () { |
|
|
if (that.data.timer) {
|
|
|
let leftTime = that.data.lefttime;
|
|
|
let timer = that.data.timer;
|
|
|
// if (interval){
|
|
|
// clearInterval(interval);
|
|
|
// }
|
|
|
|
|
|
if(timer > 0){
|
|
|
let interval = setInterval(() => {
|
|
|
timer = timer - 1;
|
...
|
...
|
@@ -103,73 +91,16 @@ detached: function () { |
|
|
console.log("== 去支付页面===")
|
|
|
prePay(productId, orderCode, 1);
|
|
|
} else if (actionCode == SHOW_DETAIL) {
|
|
|
wx.navigateTo({
|
|
|
url: '../orderDetail/index?orderCode=' + orderCode
|
|
|
})
|
|
|
let params = {
|
|
|
orderCode
|
|
|
}
|
|
|
router.go('orderDetail', params);
|
|
|
}else {
|
|
|
showDialog(orderCode, actionCode, 0);
|
|
|
}
|
|
|
|
|
|
},
|
|
|
/**
|
|
|
* 订单操作
|
|
|
*/
|
|
|
// actionOrder: function (orderCode, method) {
|
|
|
// let that = this;
|
|
|
// wx.showLoading({
|
|
|
// title: '加载中...',
|
|
|
// })
|
|
|
// let params = {
|
|
|
// uid: '500031132',
|
|
|
// method: method,
|
|
|
// orderCode: orderCode,
|
|
|
// debug: 'XYZ',
|
|
|
// }
|
|
|
// api.actionOrder(params, () => {
|
|
|
// wx.hideLoading();
|
|
|
// }).then(data => {
|
|
|
// event.emit('refresh-order');
|
|
|
// });
|
|
|
// },
|
|
|
/**
|
|
|
* 确认Dialog
|
|
|
*/
|
|
|
// showDialog: function (orderCode, actionType, ) {
|
|
|
// let that = this;
|
|
|
// let content = '';
|
|
|
// let method = '';
|
|
|
// if (actionType == DEL_ORDER) {
|
|
|
// content = '您确定删除订单?';
|
|
|
// method = UFO_BUYER_DELETE_ORDER;
|
|
|
// } else if (actionType == CANCEL_ORDER) {
|
|
|
// content = '您确定取消订单?';
|
|
|
// method = UFO_BUYER_CANCEL_ORDER;
|
|
|
|
|
|
// } else if (actionType == CONFIRM_ORDER) {
|
|
|
// content = '您确定收货?';
|
|
|
// method = UFO_BUYER_CONFIRM_ORDER;
|
|
|
|
|
|
// }
|
|
|
// wx.showModal({
|
|
|
// // title: title,
|
|
|
// content: content,
|
|
|
// showCancel: true,
|
|
|
// cancelText: "确定",
|
|
|
// cancelColor: '#000000',
|
|
|
// confirmText: "取消",
|
|
|
// confirmColor: '#E0E0E0',
|
|
|
// success: function (res) {
|
|
|
// if (res.cancel) {
|
|
|
// that.actionOrder(orderCode, method);
|
|
|
// } else {
|
|
|
// //点击取消,默认隐藏弹框
|
|
|
// }
|
|
|
// },
|
|
|
// fail: function (res) { },
|
|
|
// complete: function (res) { },
|
|
|
// })
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
|