|
|
// dist/pages/orderDetail/index.js
|
|
|
import OrderDetailService from './orderDetailService.js'
|
|
|
import OrderActionService from '../../components/order/orderActionService.js';
|
|
|
import { getImgUrl, formatTimeByMin } from '../../utils/index.js';
|
|
|
import { showDialog } from '../../components/order/orderActionUtil.js';
|
|
|
import { prePay } from '../order/wxpay.js'
|
|
|
import {getImgUrl, formatTimeByMin} from '../../utils/index.js';
|
|
|
import {showDialog} from '../../components/order/orderActionUtil.js';
|
|
|
import {prePay} from '../order/wxpay.js'
|
|
|
import router from '../../router/index.js'
|
|
|
import Yas from '../../utils/yas';
|
|
|
|
...
|
...
|
@@ -20,11 +20,12 @@ Page({ |
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
detailApi:Object,
|
|
|
orderActionApi:Object,
|
|
|
data:{},
|
|
|
detailApi: Object,
|
|
|
orderActionApi: Object,
|
|
|
data: {},
|
|
|
timer: '',
|
|
|
lastIndex: 0,
|
|
|
orderCode: ''
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -33,14 +34,13 @@ Page({ |
|
|
onLoad: function (options) {
|
|
|
yas = new Yas(this);
|
|
|
yas.pageOpenReport();
|
|
|
let orderCode = options.orderCode
|
|
|
let api = new OrderDetailService();
|
|
|
let orderActionApi = new OrderActionService();
|
|
|
this.setData({ detailApi: api,
|
|
|
orderActionApi: orderActionApi});
|
|
|
if(orderCode){
|
|
|
this.fetchOrderDetail(orderCode);
|
|
|
}
|
|
|
this.setData({
|
|
|
detailApi: api,
|
|
|
orderActionApi: orderActionApi,
|
|
|
orderCode: options.orderCode
|
|
|
});
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -54,6 +54,7 @@ Page({ |
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
this.fetchOrderDetail(this.data.orderCode);
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -95,7 +96,7 @@ Page({ |
|
|
|
|
|
},
|
|
|
|
|
|
fetchOrderDetail: function(code){
|
|
|
fetchOrderDetail: function (code) {
|
|
|
let that = this;
|
|
|
let params = {
|
|
|
orderCode: code,
|
...
|
...
|
@@ -104,8 +105,8 @@ Page({ |
|
|
this.data.detailApi.getOrderDetailInfo(params, () => {
|
|
|
wx.hideLoading();
|
|
|
}).then(data => {
|
|
|
if (data.goodsInfo && data.goodsInfo.goodImg){
|
|
|
data.goodsInfo.goodImg = getImgUrl(data.goodsInfo.goodImg, 270,270);
|
|
|
if (data.goodsInfo && data.goodsInfo.goodImg) {
|
|
|
data.goodsInfo.goodImg = getImgUrl(data.goodsInfo.goodImg, 270, 270);
|
|
|
}
|
|
|
let lastIndex = 0;
|
|
|
if (data && data.buttons && data.buttons.length > 0) {
|
...
|
...
|
@@ -116,11 +117,11 @@ Page({ |
|
|
lastIndex: lastIndex
|
|
|
});
|
|
|
|
|
|
if (data.statusDetail && data.statusDetail.leftTime){
|
|
|
if (data.statusDetail && data.statusDetail.leftTime) {
|
|
|
let leftTime = data.statusDetail.leftTime;
|
|
|
// let leftTime = 30;
|
|
|
let timer = that.data.timer;
|
|
|
if (leftTime > 0){
|
|
|
if (leftTime > 0) {
|
|
|
interval = setInterval(() => {
|
|
|
leftTime = leftTime - 1;
|
|
|
timer = formatTimeByMin(leftTime, 'm:s');
|
...
|
...
|
@@ -154,7 +155,7 @@ Page({ |
|
|
|
|
|
if (actionCode == BUY_AGAIN) {
|
|
|
let params = {
|
|
|
id: productId
|
|
|
id: productId
|
|
|
}
|
|
|
router.go('productDetail', params);
|
|
|
} else if (actionCode == NOW_BUY) {
|
...
|
...
|
@@ -170,16 +171,16 @@ Page({ |
|
|
}
|
|
|
},
|
|
|
|
|
|
onClickProduct: function() {
|
|
|
let productId = this.data.data.goodsInfo.productId || '';
|
|
|
onClickProduct: function () {
|
|
|
let productId = this.data.data.goodsInfo.productId || '';
|
|
|
let params = {
|
|
|
id: productId
|
|
|
}
|
|
|
if(this.data.data.isOffline === 'Y') return;
|
|
|
router.go('productDetail', params);
|
|
|
}
|
|
|
if (this.data.data.isOffline === 'Y') return;
|
|
|
router.go('productDetail', params);
|
|
|
},
|
|
|
|
|
|
onClickLogistics: function(e) {
|
|
|
onClickLogistics: function (e) {
|
|
|
let orderCode = e.currentTarget.dataset.orderCode || '';
|
|
|
let params = {
|
|
|
orderCode
|
...
|
...
|
@@ -187,11 +188,11 @@ Page({ |
|
|
router.go('logistics', params);
|
|
|
},
|
|
|
|
|
|
onCopyOrderCode: function() {
|
|
|
onCopyOrderCode: function () {
|
|
|
let orderCode = String(this.data.data.orderCode) || '';
|
|
|
wx.setClipboardData({
|
|
|
data: orderCode,
|
|
|
success (res) {
|
|
|
success(res) {
|
|
|
|
|
|
}
|
|
|
})
|
...
|
...
|
|