|
@@ -1,5 +1,5 @@
|
|
|
const app = getApp();
|
|
|
-import { getOrderList,orderData } from '../../api/order.js';
|
|
|
+import { getRollList } from '../../api/order.js';
|
|
|
import { getIndexData, getCoupons } from '../../api/api.js';
|
|
|
import Util from '../../utils/util.js';
|
|
|
|
|
@@ -24,8 +24,7 @@ Page({
|
|
|
interval: 3000,
|
|
|
duration: 500,
|
|
|
orderStatus:1,//订单状态
|
|
|
- orderList:[],//订单数组
|
|
|
-
|
|
|
+ orderList:[],//订单数组
|
|
|
page:1,
|
|
|
limit:5,
|
|
|
loading:false,//是否加载中
|
|
@@ -46,7 +45,8 @@ Page({
|
|
|
onLoad: function (options) {
|
|
|
if (options.spid) app.globalData.spid = options.spid;
|
|
|
if (options.scene) app.globalData.code = decodeURIComponent(options.scene);
|
|
|
- this.getOrderList();
|
|
|
+ // this.getOrderList();
|
|
|
+ console.log(wx.getStorageSync('token'));
|
|
|
},
|
|
|
/**
|
|
|
* 事件回调
|
|
@@ -58,21 +58,43 @@ Page({
|
|
|
let value = opt.value != undefined ? opt.value : null;
|
|
|
(action && this[action]) && this[action](value);
|
|
|
},
|
|
|
+getIndexConfig:function(){
|
|
|
+ var that = this;
|
|
|
+ getIndexData().then(res=>{
|
|
|
+ that.setData({
|
|
|
+ imgUrls: res.data.banner,
|
|
|
+ bastBanner: res.data.info.bastBanner,
|
|
|
+ bastInfo: res.data.info.bastInfo,
|
|
|
+ bastList: res.data.info.bastList,
|
|
|
+ fastInfo: res.data.info.fastInfo,
|
|
|
+ firstInfo: res.data.info.firstInfo,
|
|
|
+ salesInfo: res.data.info.salesInfo,
|
|
|
+ logoUrl: res.data.logoUrl,
|
|
|
+ couponList: res.data.couponList,
|
|
|
+ });
|
|
|
+ wx.getSetting({
|
|
|
+ success(res) {
|
|
|
+ if (!res.authSetting['scope.userInfo']) {
|
|
|
+ that.setData({ window: that.data.couponList.length ? true : false });
|
|
|
+ } else {
|
|
|
+ that.setData({ window: false });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+},
|
|
|
/**
|
|
|
- * 获取订单列表
|
|
|
+ * 获取开团列表
|
|
|
*/
|
|
|
getOrderList:function(){
|
|
|
var that=this;
|
|
|
if(that.data.loadend) return;
|
|
|
- if(that.data.loading) return;2
|
|
|
- that.setData({ loading: true, loadTitle:""});
|
|
|
- getOrderList({
|
|
|
- type: that.data.orderStatus,
|
|
|
- page: that.data.page,
|
|
|
- limit: that.data.limit,
|
|
|
+ if(that.data.loading) return;
|
|
|
+ that.setData({ loading: true, loadTitle:""});
|
|
|
+ getRollList({
|
|
|
+ status: that.data.orderStatus
|
|
|
}).then(res=>{
|
|
|
- var list = res.data || [];
|
|
|
- var loadend = list.length < that.data.limit;
|
|
|
+ var list = res.data, loadend = list.length < that.data.limit;
|
|
|
that.data.orderList = app.SplitArray(list, that.data.orderList);
|
|
|
that.setData({
|
|
|
orderList: that.data.orderList,
|
|
@@ -112,44 +134,15 @@ Page({
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
this.getIndexConfig();
|
|
|
+ this.getOrderList();
|
|
|
if(app.globalData.isLog && app.globalData.token) this.get_issue_coupon_list();
|
|
|
if (app.globalData.isLog && this.data.isClose){
|
|
|
this.setData({ loadend: false, page: 1, orderList:[]});
|
|
|
- this.getOrderList();
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
- get_issue_coupon_list:function(){
|
|
|
- var that = this;
|
|
|
- getCoupons({page:1,limit:3}).then(res=>{
|
|
|
- that.setData({ couponList: res.data });
|
|
|
- if (!res.data.length) that.setData({ window: false });
|
|
|
- });
|
|
|
- },
|
|
|
- getIndexConfig:function(){
|
|
|
- var that = this;
|
|
|
- getIndexData().then(res=>{
|
|
|
- that.setData({
|
|
|
- imgUrls: res.data.banner,
|
|
|
- bastBanner: res.data.info.bastBanner,
|
|
|
- bastInfo: res.data.info.bastInfo,
|
|
|
- bastList: res.data.info.bastList,
|
|
|
- fastInfo: res.data.info.fastInfo,
|
|
|
- firstInfo: res.data.info.firstInfo,
|
|
|
- salesInfo: res.data.info.salesInfo,
|
|
|
- logoUrl: res.data.logoUrl,
|
|
|
- couponList: res.data.couponList,
|
|
|
- });
|
|
|
- wx.getSetting({
|
|
|
- success(res) {
|
|
|
- if (!res.authSetting['scope.userInfo']) {
|
|
|
- that.setData({ window: that.data.couponList.length ? true : false });
|
|
|
- } else {
|
|
|
- that.setData({ window: false });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
@@ -167,6 +160,7 @@ Page({
|
|
|
*/
|
|
|
onPullDownRefresh: function () {
|
|
|
this.getIndexConfig();
|
|
|
+ this.getOrderList();
|
|
|
if (app.globalData.isLog && app.globalData.token) this.get_issue_coupon_list();
|
|
|
wx.stopPullDownRefresh();
|
|
|
},
|
|
@@ -191,7 +185,7 @@ Page({
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
- onReachBottom: function () {
|
|
|
- this.getOrderList();
|
|
|
- },
|
|
|
+ // onReachBottom: function () {
|
|
|
+ // this.getOrderList();
|
|
|
+ // },
|
|
|
})
|