提交 f04cddcb 编写于 作者: D devil_gong

小程序优惠劵

上级 e05d4d23
......@@ -45,6 +45,7 @@ class Coupon extends Common
*/
public function User()
{
//sleep(5);
$coupon_params = [
'user' => $this->user,
'where' => [
......
......@@ -4,7 +4,14 @@ Page({
data_bottom_line_status: false,
data_list_loding_status: 1,
data_list_loding_msg: '',
data_list: [],
data_list: null,
nav_tabs_list: [
{ name: "未使用", value: "not_use" },
{ name: "已使用", value: "already_use" },
{ name: "已过期", value: "already_expire" },
],
nav_tabs_value: 'not_use',
},
onLoad(params) {
......@@ -46,7 +53,8 @@ Page({
wx.stopPullDownRefresh();
if (res.data.code == 0) {
self.setData({
data_list: res.data.data,
data_list: res.data.data || null,
data_bottom_line_status: true,
data_list_loding_status: 3,
data_list_loding_msg: '',
});
......@@ -71,6 +79,13 @@ Page({
});
},
// 导航事件
nav_tabs_event(e) {
var index = e.currentTarget.dataset.index;
var value = e.currentTarget.dataset.value;
this.setData({ nav_tabs_value: value});
},
// 下拉刷新
onPullDownRefresh() {
this.get_data_list();
......
<!--pages/user-coupon/user-coupon.wxml-->
<text>pages/user-coupon/user-coupon.wxml</text>
<view wx:if="{{data_list != null}}">
<!-- 导航 -->
<view class="nav-tabs">
<block wx:for="{{nav_tabs_list}}" wx:key="item">
<view class="nav-item cr-666 fl {{item.value == nav_tabs_value ? 'nav-item-active' : ''}}" data-index="{{index}}" data-value="{{item.value}}" bindtap="nav_tabs_event">{{item.name}}</view>
</block>
</view>
<!-- 优惠劵列表 -->
<view class="data-list">
<!-- 未使用 -->
<view wx:if="{{(data_list.not_use || null) != null && data_list.not_use.length > 0 && nav_tabs_value == 'not_use'}}">
<block wx:for="{{data_list.not_use}}" wx:key="item">
<view class="item spacing-mt bg-white" style="border:1px solid {{item.coupon.bg_color_value}};">
<view class="v-left fl">
<view class="base single-text" style="color:{{item.coupon.bg_color_value}};">
<text class="symbol">¥</text>
<text class="price">{{item.coupon.discount_value}}</text>
<text class="unit">{{item.coupon.type == 0 ? '元' : '折'}}</text>
<text wx:if="{{(item.coupon.desc || null) != null}}" class="desc cr-888">{{item.coupon.desc}}</text>
</view>
<view wx:if="{{(item.coupon.use_limit_type_name || null) != null}}" class="base-tips cr-666">{{item.coupon.use_limit_type_name}}</view>
<view class="base-time cr-888">{{item.time_start_text}} 至 {{item.time_end_text}}</view>
</view>
<navigator url="/pages/index/index" open-type="switchTab" hover-class="none">
<view class="v-right fr" style="background:{{item.coupon.bg_color_value}};">
<text class="circle"></text>
<text>去使用</text>
</view>
</navigator>
</view>
</block>
</view>
<!-- 已使用 -->
<view wx:if="{{(data_list.already_use || null) != null && data_list.already_use.length > 0 && nav_tabs_value == 'already_use'}}">
<block wx:for="{{data_list.already_use}}" wx:key="item">
<view class="item spacing-mt bg-white item-disabled">
<view class="v-left fl">
<view class="base single-text">
<text class="symbol">¥</text>
<text class="price">{{item.coupon.discount_value}}</text>
<text class="unit">{{item.coupon.type == 0 ? '元' : '折'}}</text>
<text wx:if="{{(item.coupon.desc || null) != null}}" class="desc cr-888">{{item.coupon.desc}}</text>
</view>
<view wx:if="{{(item.coupon.use_limit_type_name || null) != null}}" class="base-tips cr-666">{{item.coupon.use_limit_type_name}}</view>
<view class="base-time cr-888">{{item.time_start_text}} 至 {{item.time_end_text}}</view>
</view>
<view class="v-right fr">
<text class="circle"></text>
<text>已使用</text>
</view>
</view>
</block>
</view>
<!-- 已过期 -->
<view wx:if="{{(data_list.already_expire || null) != null && data_list.already_expire.length > 0 && nav_tabs_value == 'already_expire'}}">
<block wx:for="{{data_list.already_expire}}" wx:key="item">
<view class="item spacing-mt bg-white item-disabled">
<view class="v-left fl">
<view class="base single-text">
<text class="symbol">¥</text>
<text class="price">{{item.coupon.discount_value}}</text>
<text class="unit">{{item.coupon.type == 0 ? '元' : '折'}}</text>
<text wx:if="{{(item.coupon.desc || null) != null}}" class="desc cr-888">{{item.coupon.desc}}</text>
</view>
<view wx:if="{{(item.coupon.use_limit_type_name || null) != null}}" class="base-tips cr-666">{{item.coupon.use_limit_type_name}}</view>
<view class="base-time cr-888">{{item.time_start_text}} 至 {{item.time_end_text}}</view>
</view>
<view class="v-right fr">
<text class="circle"></text>
<text>已过期</text>
</view>
</view>
</block>
</view>
</view>
</view>
<view wx:if="{{data_list == null}}">
<import src="/pages/common/nodata.wxml" />
<template is="nodata" data="{{status: data_list_loding_status}}">
</template>
</view>
<import src="/pages/common/bottom_line.wxml" />
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
\ No newline at end of file
/* pages/user-coupon/user-coupon.wxss */
\ No newline at end of file
/*
* 导航
*/
.nav-tabs {
overflow: hidden;
background: #eee;
position: fixed;
left: 0;
top: 0;
width: 100%;
}
.nav-tabs .nav-item {
text-align: center;
width: 33.33%;
height: 80rpx;
line-height: 80rpx;
border-bottom: 6rpx solid transparent;
}
.nav-tabs .nav-item-active {
color: #d2364c;
border-bottom: 6rpx solid #d2364c;
}
/*
* 数据列表
*/
.data-list {
margin-top: 100rpx;
padding: 0 10rpx;
}
.data-list .item {
overflow: hidden;
height: 230rpx;
border: 1px solid #D2364C;
}
.v-left {
width: calc(100% - 140rpx);
padding: 30rpx 0 30rpx 20rpx;
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
}
.v-left .base {
color: #D2364C;
}
.v-left .base .symbol {
font-family: Verdana, Tahoma;
font-size: 48rpx;
font-weight: 400;
}
.v-left .base .price {
font-weight: 700;
font-family: arial;
font-size: 76rpx;
}
.v-left .base .desc {
margin-left: 20rpx;
}
.v-left base-tips, .v-left .base-time {
margin-top: 10rpx;
}
.v-right {
background: #d2364c;
width: 140rpx;
height: 230rpx;
color: #fff;
font-weight: 500;
position: relative;
text-align: center;
}
.v-right:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
.v-right .circle {
display: block;
position: absolute;
left: -1px;
top: -3px;
width: 3px;
height: 230rpx;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAACpCAYAAADur4c3AAAAGXRFWHR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IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjcyNTNjMjA5LThlY2UtNGU1Ny04NDg4LTVkMTE5OTA4Y2RiYyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pvy+vnQAAAEqSURBVHjaYvz//z8DDDAxIAFyOVeBOAHEYfyPMDsLmXMfmfMT2YADDP8h4CEQq4A4aUDMA1LNSKZDXwJxGcg1yJaWIXOeInO+IxuwA+acK0AsA+IEADEbic7hhPOAer4DcQcQMyNb2oLMeYVsADcyZwPMObuBWBTEsQFpI9E54sjO+QvEc0F+YoHKJgHxJ2TnvEM2gBmZswrmnA1AzAXiaJPhHC1k58BNQ3bBTGTOR2QD/iJzFsH8Mw/kHxBHggzn2KA7BxzWyC5Yisz5imwACmc2LLY7QbEN4nCS4ZwAIGZFds5lUEpEdsF6nKn3PTJnAsiAV0BcBsSM5GamFCDmQXYOOJ8iu2Anzrz9HKU8ABlwDYgTKcnbo0XNaFEzWtQgipqOYVLUAAQYAKPWa4c8cIHnAAAAAElFTkSuQmCC) no-repeat;
}
.item-disabled .v-right {
background: #dfdfdf !important;
color: #c0c0c0 !important;
cursor: no-drop !important;
}
.item-disabled {
border: 1px solid #dfdfdf !important;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册