@@ -5,51 +5,51 @@ const Http = require("../../../utils/HttpBasics") | |||
//1535126400000 | |||
Page({ | |||
data: { | |||
tabs: [{ | |||
key: 0, | |||
name: "未使用" | |||
}, | |||
{ | |||
key: 1, | |||
name: "已使用" | |||
}, | |||
{ | |||
key: 2, | |||
name: "已过期" | |||
}, | |||
{ | |||
key: 3, | |||
name: "已退款" | |||
} | |||
], | |||
tabs: [], | |||
list: [], | |||
current: '', | |||
current_scroll: '1' | |||
}, | |||
onLoad() { | |||
this.getList(0) | |||
this.getBusinessList(1) | |||
this.getList(0, 1) | |||
}, | |||
getList(key) { | |||
getList(key, pageNum) { | |||
var that = this | |||
Http.get({ | |||
url: config.api.couponOrderList, | |||
data: { | |||
pageNum: 1, | |||
pageSize: 10, | |||
orderStatus: key | |||
} | |||
}) | |||
.then(function(res) { | |||
console.log(res) | |||
res.data.list.map(file => { | |||
file.expiredTime = format.formatTime(file.expiredTime, 'yyyy-MM-dddd hh:mm:ss') | |||
url: config.api.couponOrderList, | |||
data: { | |||
pageNum: pageNum, | |||
pageSize: 10, | |||
orderStatus: key | |||
} | |||
}) | |||
that.setData({ | |||
list: res.data.list | |||
.then(res => { | |||
console.log(res) | |||
res.data.list.map(file => { | |||
file.expiredTime = format.formatTime(file.expiredTime, 'yyyy-MM-dddd hh:mm:ss') | |||
}) | |||
that.setData({ | |||
list: res.data.list | |||
}) | |||
}) | |||
},function(error){ | |||
}) | |||
}, | |||
getBusinessList(pageNum) { | |||
var that = this | |||
Http.get({ | |||
url: config.api.businessList, | |||
data: { | |||
pageNum: pageNum, | |||
pageSize: 10, | |||
type: 1 | |||
} | |||
}) | |||
.then(function(res) { | |||
console.log(res) | |||
that.setData({ | |||
list: res.data.list | |||
}) | |||
}, function(error) {}) | |||
}, | |||
handleChange({ | |||
detail | |||
@@ -1,6 +1,6 @@ | |||
<view class="market"> | |||
<i-tabs class='tabs' current="{{ current_scroll }}" scroll bindchange="handleChangeScroll"> | |||
<i-tab class='i-tab' wx:for="{{tabs}}" wx:key="unique" key="{{item.key}}" title="{{item.name}}"></i-tab> | |||
<i-tab class='i-tab' wx:for="{{tabs}}" wx:key="unique" key="{{item.id}}" title="{{item.title}}"></i-tab> | |||
</i-tabs> | |||
<view class='section' wx:for='{{list}}' wx:key='{{index}}'> | |||
<view class='detail_msg'> | |||
@@ -14,32 +14,7 @@ Component({ | |||
* 组件的初始数据 | |||
*/ | |||
data: { | |||
tabs: [{ | |||
key: 1, | |||
name: "全部" | |||
}, | |||
{ | |||
key: 2, | |||
name: "餐饮" | |||
}, | |||
{ | |||
key: 3, | |||
name: "娱乐" | |||
}, { | |||
key: 4, | |||
name: "服饰" | |||
}, { | |||
key: 5, | |||
name: "超市" | |||
}, | |||
{ | |||
key: 6, | |||
name: "亲子" | |||
}, { | |||
key: 7, | |||
name: "其他" | |||
}, | |||
], | |||
tabs: [], | |||
list: [], | |||
current: '1', | |||
current_scroll: '1', | |||
@@ -66,8 +41,23 @@ Component({ | |||
}, | |||
}, | |||
ready() { | |||
// TODO business获取 | |||
if (app.globalData.token && app.globalData.token != null) { | |||
// business获取 | |||
Http.get({ | |||
url: config.api.businessList, | |||
data: { | |||
pageNum: 1, | |||
pageSize: 10, | |||
type: 1 | |||
} | |||
}) | |||
.then(res => { | |||
console.log(res) | |||
that.setData({ | |||
list: res.data.list | |||
}) | |||
}) | |||
// 券list获取 | |||
Http.get({ | |||
url: config.api.couponList, | |||
data: { | |||
@@ -82,6 +72,22 @@ Component({ | |||
}) | |||
} else { | |||
app.couponListCallback = token => { | |||
// business获取 | |||
Http.get({ | |||
url: config.api.businessList, | |||
data: { | |||
pageNum: pageNum, | |||
pageSize: 10, | |||
type: 1 | |||
} | |||
}) | |||
.then(res => { | |||
console.log(res) | |||
that.setData({ | |||
list: res.data.list | |||
}) | |||
}) | |||
// 券list获取 | |||
Http.get({ | |||
url: config.api.couponList, | |||
data: { | |||