123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- // lionfish_comshop/pages/refund/refundList.js
- var util = require('../../utils/util.js');
- var app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- containerHeight: 0,
- scrollTop: 0,
- currentTab: "0",
- navList: [{
- name: "全部",
- status: "0"
- }, {
- name: "处理中",
- status: "1"
- }, {
- name: "已退款",
- status: "2"
- }, {
- name: "已拒绝",
- status: "3"
- }],
- refundList: [],
- loading: true,
- page: 1,
- loadover: false,
- order_status: 12,
- no_order: 0,
- hide_tip: true,
- order: [],
- tip: '正在加载',
- pageNum: [1, 1, 1, 1],
- pageSize: 20,
- loadText: "没有更多订单了~",
- LoadingComplete: ["", "", "", ""]
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let sysInfo = wx.getSystemInfoSync();
- this.setData({
- currentTab: options.orderStatus || "0",
- containerHeight: sysInfo.windowHeight - Math.round(sysInfo.windowWidth / 375 * 55)
- });
- this.getData();
- },
- getData: function () {
- this.setData({
- isHideLoadMore: true
- })
- this.data.no_order = 1
- let that = this;
- var token = wx.getStorageSync('token');
- app.util.request({
- 'url': 'entry/wxapp/index',
- 'data': {
- controller: 'order.refundorderlist',
- token: token,
- currentTab: that.data.currentTab,
- page: that.data.page,
- order_status: that.data.order_status
- },
- dataType: 'json',
- success: function (res) {
- if (res.data.code == 0) {
- let rushList = that.data.order.concat(res.data.data);
- that.setData({
- order: rushList,
- hide_tip: true,
- 'no_order': 0
- });
- } else {
- that.setData({
- isHideLoadMore: true
- })
- return false;
- }
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.setData({
- pageNum: [1, 1, 1, 1, 1],
- loading: true
- }), this.getAllList();
- },
- /**
- * 重载页面
- */
- reloadPage: function () {
- var t = this;
- let data = getApp().globalData.options;
- // 请求数据
- t.setData({
- pageNum: [1, 1, 1, 1, 1],
- loading: true
- }), t.getAllList();
- },
- /**
- * 获取列表
- */
- getAllList: function(){
- var that = this;
- Promise.all([this.getDataList({
- pageNum: 1,
- status: ""
- }), this.getDataList({
- pageNum: 1,
- status: 1
- }), this.getDataList({
- pageNum: 1,
- status: 3
- }), this.getDataList({
- pageNum: 1,
- status: 4
- })])
- .then(function (res) {
- console.log(res)
- res.forEach(function (item, n) {
- // todo
- });
- that.setData({
- loading: false
- });
- wx.stopPullDownRefresh();
- })
- .catch(function () { });
- },
- /**
- * 切换导航
- */
- switchNav: function (t) {
- this.data.currentTab !== t.currentTarget.dataset.current && this.setData({
- currentTab: t.currentTarget.dataset.current
- });
- },
- /**
- * 监控改变
- */
- bindChange: function (t) {
- console.log(t.detail.current);
- //ww
-
- this.setData({
- no_order:0,
- page:1,
- order:[],
- currentTab: t.detail.current + ""
- });
- this.getData();
- },
- /**
- * 获取数据列表
- */
- getDataList: function (t) {
- let data = {
- pageNum: t.pageNum,
- pageSize: this.data.pageSize,
- status: t.status
- };
- // 请求数据
- return data;
- },
- /**
- * 前往订单详情
- */
- goOrder: function (t) {
- var order_id = t.currentTarget.dataset.type;
- wx.navigateTo({
- url: "/lionfish_comshop/pages/order/refunddetail?id=" + order_id
- });
- },
- /**
- * 撤销申请
- */
- cancelApplication: function (t) {
- var a = this, n = t.detail;
- wx.showModal({
- title: "撤销申请",
- content: "您确定要撤销本次退款申请吗?",
- success: function (t) {
- t.confirm && (0, e.default)("/shop-return-order/refund/undo", {
- returnOrderNo: n
- }).then(function (t) {
- 0 === t.head.error ? (wx.showToast({
- title: "撤销成功",
- icon: "none"
- }), a.getAllList()) : (wx.showToast({
- title: "该退款申请已处理",
- icon: "none"
- }), a.getAllList());
- }).catch(function () { });
- }
- });
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
- getCurrentList:function(){
- if (this.data.no_order == 1) return false;
- this.data.page += 1;
- this.getData();
- this.setData({
- isHideLoadMore: false
- })
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
-
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|