Commit c8d39dde by 梁建民

福利

parent 8ef2db1e
// pages/person/welfare/index.js
const http = require('../../../utils/util.js');
import {
apis
} from '../../../utils/api.js';
Page({
/**
* 页面的初始数据
*/
data: {
integralsList: {},
integral: '',
code: ''
},
/**
......@@ -26,7 +33,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getData();
},
/**
......@@ -56,4 +63,54 @@ Page({
onReachBottom: function () {
},
/**
* 获取数据
*/
getData: function () {
http.getData(apis.integralsList, 'GET', null, (res) => {
if (res.errcode === 0) {
this.setData({
integralsList: res.data,
integral: res.integral,
code: res.code
});
}
}, true, false, true);
},
/**
* 跳转地址
*/
toUrl: function (e) {
let id = e.currentTarget.dataset.id;
if (id == 1) {
wx.navigateTo({
url: "/pages/person/invitation/index"
})
} else if (id == 2) {
wx.navigateTo({
url: "/pages/form/good/index"
})
} else if (id == 3) {
wx.navigateTo({
url: "/pages/person/packet/index"
})
} else if (id == 4) {
} else if (id == 5) {
wx.navigateTo({
url: "/pages/form/xj/index"
})
} else if (id == 6) {
wx.navigateTo({
url: "/pages/list/signin/index"
})
}
}
})
\ No newline at end of file
......@@ -6,27 +6,44 @@
<text class="t1">我的红包</text>
</view>
<view class="num">
<text class="t1">10.93</text>
<text class="t1">{{integral}}</text>
<text class="t2">元</text>
</view>
<view class="code-text">
<text class="t1">红包码:</text>
<text class="t2">RDD23423</text>
<text class="t2">{{code}}</text>
</view>
</view>
<view class="column">
<text class="rule">查看规则</text>
<view class="exchange row verCenter ">
<text class="t1">兑换记录</text>
<view class="t2 row verCenter rowCenter">
<navigator url="/pages/person/exchange/index" class="t1">兑换记录</navigator>
<navigator url="/pages/person/withdrawal/index" class="t2 row verCenter rowCenter">
<text class="icon iconfont iconiconxiantiaoshouji28"></text>
<text>提现兑换</text>
</view>
</navigator>
</view>
</view>
</view>
<view class="list">
<view class="list-wrap row verCenter bothSide bor">
<block wx:for="{{integralsList}}" wx:for-item="item" wx:for-index="index">
<view class="list-wrap row verCenter bothSide bor">
<view>
<view>
<text class="t1">{{item.name}}</text>
<text wx:if="{{item.tips}}" class="icon iconfont iconiconxiantiaoshouji27"></text>
<text class="t2">{{item.tips}}</text>
</view>
<view>
<text class="t3">{{item.description}}</text>
</view>
</view>
<view bind:tap="toUrl" data-id="{{item.id}}" wx:if="{{item.button_text}}" class="btn blue {{index > 2 ? 'yellow':''}}">
{{item.button_text}}
</view>
</view>
</block>
<!-- <view class="list-wrap row verCenter bothSide bor">
<view>
<view>
<text class="t1">邀请好友</text>
......@@ -98,6 +115,6 @@
</view>
</view>
<view class="btn yellow">去报价</view>
</view>
</view> -->
</view>
</view>
\ No newline at end of file
......@@ -136,39 +136,54 @@ Page({
this.getData()
}
},
getData: function() {
getData: function () {
let me = this;
let url, token = wx.getStorageSync('access_token');
let str = "";
let params = {
offset: me.data.limit,
p: me.data.p,
"goods_name/like": me.data.confirmKey
};
if (me.data.tabIndex == 1) {
url = apis.goodsSearch
str = "goods_list"
} else {
url = apis.inquirySearch;
str = "inquiry_list"
}
if (token) {
params.token = token
}
getData(url, 'get', params, function(res) {
getData(url, 'get', params, function (res) {
if (res.errcode === 0) {
let newArr = [];
if (me.data.p > 1) {
newArr = me.data.priceList;
}
for (let key in res[str]) {
newArr.push(res[str][key])
}
me.setData({
priceList: newArr,
total: res.total,
});
} else {
if (me.data.p == 1) {
me.setData({
priceList: []
......
......@@ -65,6 +65,13 @@
"id": -1,
"name": "pages/list/signin/index",
"pathName": "pages/list/signin/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/welfare/index",
"pathName": "pages/person/welfare/index",
"scene": null
}
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment