Stormeye.Wu 7 лет назад
Родитель
Сommit
141233bb0f
3 измененных файлов: 69 добавлений и 63 удалений
  1. +35
    -35
      pages/coupons/index/index.js
  2. +1
    -1
      pages/coupons/index/index.wxml
  3. +33
    -27
      pages/index/coupons/index.js

+ 35
- 35
pages/coupons/index/index.js Просмотреть файл

@@ -5,51 +5,51 @@ const Http = require("../../../utils/HttpBasics")
//1535126400000 //1535126400000
Page({ Page({
data: { data: {
tabs: [{
key: 0,
name: "未使用"
},
{
key: 1,
name: "已使用"
},
{
key: 2,
name: "已过期"
},
{
key: 3,
name: "已退款"
}
],
tabs: [],
list: [], list: [],
current: '', current: '',
current_scroll: '1' current_scroll: '1'
}, },
onLoad() { onLoad() {
this.getList(0)
this.getBusinessList(1)
this.getList(0, 1)
}, },
getList(key) {
getList(key, pageNum) {
var that = this var that = this
Http.get({ 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({ handleChange({
detail detail


+ 1
- 1
pages/coupons/index/index.wxml Просмотреть файл

@@ -1,6 +1,6 @@
<view class="market"> <view class="market">
<i-tabs class='tabs' current="{{ current_scroll }}" scroll bindchange="handleChangeScroll"> <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> </i-tabs>
<view class='section' wx:for='{{list}}' wx:key='{{index}}'> <view class='section' wx:for='{{list}}' wx:key='{{index}}'>
<view class='detail_msg'> <view class='detail_msg'>


+ 33
- 27
pages/index/coupons/index.js Просмотреть файл

@@ -14,32 +14,7 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { 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: [], list: [],
current: '1', current: '1',
current_scroll: '1', current_scroll: '1',
@@ -66,8 +41,23 @@ Component({
}, },
}, },
ready() { ready() {
// TODO business获取
if (app.globalData.token && app.globalData.token != null) { 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({ Http.get({
url: config.api.couponList, url: config.api.couponList,
data: { data: {
@@ -82,6 +72,22 @@ Component({
}) })
} else { } else {
app.couponListCallback = token => { 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({ Http.get({
url: config.api.couponList, url: config.api.couponList,
data: { data: {


Загрузка…
Отмена
Сохранить