diff --git a/pages/coupons/index/index.js b/pages/coupons/index/index.js
index 8f85bf8..cbe946a 100644
--- a/pages/coupons/index/index.js
+++ b/pages/coupons/index/index.js
@@ -1,44 +1,49 @@
+let Http = require('../../../utils/http.js')
+let format = require('../../../utils/util.js')
+let app = getApp()
+
+//1535126400000
Page({
data: {
tabs: [{
- key: 1,
+ key: 0,
name: "未使用"
},
{
- key: 2,
+ key: 1,
name: "已使用"
},
{
- key: 3,
+ key: 2,
name: "已过期"
},
{
- key: 4,
+ key: 3,
name: "已退款"
}
],
- list: [{
- key: '1',
- data: [{
- name: '111'
- }]
- },
- {
- key: '2',
- data: [{
- name: '222'
- }]
- },
- {
- key: '3',
- data: [{
- name: '333'
- }]
- }
- ],
+ list: [],
current: '',
current_scroll: '1'
},
+ onLoad() {
+ this.getList(0)
+ },
+ getList(key) {
+ Http.getResquest('/api/couponOrder/list', app.globalData.token, '加载中', {
+ pageNum: 1,
+ pageSize: 10,
+ orderStatus: key
+ }, (res) => {
+ res.data.list.map(file => {
+ file.expiredTime = format.formatTime(file.expiredTime, 'yyyy-MM-dddd hh:mm:ss')
+ })
+ this.setData({
+ list: res.data.list
+ })
+ console.log(res)
+ })
+ },
handleChange({
detail
}) {
@@ -49,6 +54,7 @@ Page({
handleChangeScroll({
detail
}) {
+ this.getList(detail.key)
this.setData({
current_scroll: detail.key
});
diff --git a/pages/coupons/index/index.json b/pages/coupons/index/index.json
index 656da8f..85a5c31 100644
--- a/pages/coupons/index/index.json
+++ b/pages/coupons/index/index.json
@@ -1,8 +1,7 @@
{
"usingComponents": {
"i-tab": "../../../dist/tab/index",
- "i-tabs": "../../../dist/tabs/index",
- "c-coupons": "../../../components/coupons/index"
+ "i-tabs": "../../../dist/tabs/index"
},
"navigationBarTitleText": "我的优惠劵"
}
\ No newline at end of file
diff --git a/pages/coupons/index/index.wxml b/pages/coupons/index/index.wxml
index 49f19bd..d654529 100644
--- a/pages/coupons/index/index.wxml
+++ b/pages/coupons/index/index.wxml
@@ -2,7 +2,7 @@
-
+
@@ -12,25 +12,7 @@
黑椒牛排
- 有效期至:2018-07-10 11:30
-
-
- 立即使用
-
-
-
-
-
-
-
-
-
-
-
- 黑椒牛排
-
-
- 有效期至:2018-07-10 11:30
+ 有效期至:{{item.expiredTime}}
立即使用