123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- var util = require('../../../utils/util.js');
- var api = require('../../../config/api.js');
- Page({
- data: {
- order_status: '',
- evaluate_status: '',
- orderList: [],
- page: 1,
- size: 10,
- totalPages:0,
- tabList: ['全部', '待付款', '待发货', '待收货', '待评价', '维权'],
- tabIndex: 0,
- orderIds:[],
- currentStoreId: ''
- // markers: [{
- // iconPath: "/static/images/rider.png",
- // id: 0,
- // latitude: 31.834082,
- // longitude: 117.232939,
- // width: 40,
- // height: 40,
- // callout: {
- // content: '距离你2.77km',
- // color: '#fe7200',
- // display: 'ALWAYS',
- // padding: 10,
- // borderRadius: 30
- // }
- // }]
- },
- toggleTab(e) {
- this.setData({
- tabIndex: e.currentTarget.dataset.index,
- orderList: [],
- page: 1,
- });
- this.switchOrderType(e.currentTarget.dataset.index);
- },
- swiperChange(e) {
- this.setData({
- tabIndex: e.detail.current
- });
- this.switchOrderType(e.detail.current);
- },
- onLoad: function (options) {
- // 页面初始化 options为页面跳转所带来的参数
- if (options.tabIndex) {
- this.setData({
- tabIndex: options.tabIndex
- });
- }
- },
- getOrderList() {
- let that = this;
- wx.showLoading({
- title: '加载中...',
- });
- util.request(api.OrderList,
- {
- order_status: that.data.order_status,
- evaluate_status: that.data.evaluate_status,
- page: that.data.page,
- size: that.data.size
- }).then(function (res) {
- if (res.errno === 0) {
- let orderList = that.data.orderList.concat(res.data.data);
- // console.log(orderList);
- that.setData({
- orderList: orderList,
- totalPages: res.data.totalPages
- }, () => {
- //获取待付款倒计时
- that.data.orderList.forEach((item, num) => {
- if (item.pay_status == 0 || item.pay_status == 1) {
- util.countdown(that, that.data.orderList, 'orderList', num)
- }
- })
- });
- wx.hideLoading();
- }
- });
- },
- payOrder(event) {
- wx.redirectTo({
- url: '/pages/pay/pay?orderIds=' + event.target.dataset.orderId
- + '&actualPrice=' + event.target.dataset.actualPrice
- })
- },
- applyRefund(event) {
- wx.navigateTo({
- url: '/pages/ucenter/applyRefund/applyRefund?orderId=' + event.target.dataset.orderId
- + '&refundMoney=' + event.target.dataset.actualPrice
- })
- },
- againBuy(event) {
- let orderId = event.target.dataset.orderId;
- // let goodType = event.target.dataset.goodType;
- // if (goodType!= '00'){
- // wx.showModal({
- // title: '提示信息',
- // content: '非保税仓商品不允许再来一单,需门店扫描二维码进行购买',
- // showCancel: false
- // });
- // return;
- // }
- util.request(api.CartAddByOrder, {orderId: orderId}).then(function (res) {
- if (res.errno === 0) {
- wx.switchTab({
- url: '/pages/cart/cart',
- });
- } else if (res.errno === 0) {
- wx.showToast({
- title: res.errmsg,
- image: '/static/images/icon_error.png',
- duration: 2000
- });
- }
- });
- },
- againBuyDisabel(event) {
- let goodType = event.target.dataset.goodType;
- let isStore = event.target.dataset.isStore;
- if (goodType != '00' && isStore) {
- wx.showModal({
- title: '提示信息',
- content: '非保税仓商品不允许再来一单,需门店扫描二维码进行购买',
- showCancel: false
- });
- }
- if (!isStore){
- wx.showModal({
- title: '',
- content: '该订单非当前门店订单,不允许再来一单,需切换门店进行购买',
- showCancel: false
- });
- }
- },
- switchOrderType(tabIndex) {
- let that = this;
- if (tabIndex == 0) {
- that.setData({
- order_status: '',
- evaluate_status: '',
- });
- } else if (tabIndex == 1) {
- that.setData({
- order_status: 0,
- evaluate_status: '',
- });
- } else if (tabIndex == 2) {
- that.setData({
- order_status: 201,
- evaluate_status: '',
- });
- } else if (tabIndex == 3) {
- that.setData({
- order_status: 300,
- evaluate_status: 0,
- });
- } else if (tabIndex == 4) {
- that.setData({
- order_status: 301,
- evaluate_status: 0,
- });
- } else if (tabIndex == 5) {
- that.setData({
- order_status: 401,
- evaluate_status: 0,
- });
- }
- that.getOrderList();
- },
- onReady: function () {
- // 页面渲染完成
- },
- onShow: function () {
- // 页面显示
- let that = this;
- that.setData({ orderList: [] });//初始化列表
- that.switchOrderType(that.data.tabIndex);
- that.setData({
- currentStoreId: wx.getStorageSync('storeId')
- });
- },
- onHide: function () {
- // 页面隐藏
- },
- onUnload: function () {
- // 页面关闭
- },
- onReachBottom() {
- var that = this;
- if (that.data.page <= that.data.totalPages) {
- that.setData({
- page: that.data.page + 1,
- });
- that.getOrderList();
- }
- },
- getWuliuList(event) {
- let shippingNo = event.target.dataset.shippingNo;
- let shippingCode = event.target.dataset.shippingCode;
- let orderId = event.target.dataset.orderId;
- let goodsType = event.target.dataset.goodsType;
- wx.navigateTo({
- url: '/pages/ucenter/wuliu/wuliu?id=' + shippingNo + '&code=' + shippingCode + '&orderId=' + orderId + '&goodsType=' + goodsType,
- });
- }
- })
|