| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- <template>
- <view class="container">
- <view class="tui-coupon-list">
- <view class="tui-coupon-item tui-top20" v-for="(item,index) in couponList" :key="index">
- <image src="/static/images/mall/coupon/bg_coupon_3x.png" class="tui-coupon-bg"
- mode="widthFix"></image>
- <image v-if="item.fetch==1" src="/static/images/mall/coupon/img_couponcentre_received_3x.png" class="tui-coupon-sign"></image>
- <view class="tui-coupon-item-left">
- <view class="tui-coupon-price-box">
- <view class="tui-coupon-price-sign" v-if="item.coupon_type==10">¥</view>
- <view class="tui-coupon-price" v-if="item.coupon_type==10">{{item.reduce_price}}</view>
- <view class="tui-coupon-price" v-if="item.coupon_type==20">{{item.discount}}</view>
- <view class="tui-coupon-price-sign" v-if="item.coupon_type==20">折</view>
- </view>
- <view class="tui-coupon-intro">满{{item.min_price}}元可用</view>
- </view>
- <view class="tui-coupon-item-right">
- <view class="tui-coupon-content">
- <view class="tui-coupon-title-box">
- <view v-if="item.sid==0" class="tui-coupon-btn" :class="{'tui-bg-grey':i>0}">全场券</view>
- <view v-if="item.use_goods==0" class="tui-coupon-title">全部商品可用</view>
- <view v-if="item.use_goods==1" class="tui-coupon-title">{{item.cat_ids_name}}类目可用</view>
- <view v-if="item.use_goods==2" class="tui-coupon-title">{{item.goods_ids_name}}可用</view>
- </view>
- <view class="tui-coupon-rule">
- <view class="tui-rule-box tui-padding-btm">
- <view class="tui-coupon-circle"></view>
- <view class="tui-coupon-text">不可叠加使用</view>
- </view>
- <view class="tui-rule-box">
- <view class="tui-coupon-circle"></view>
- <view v-if="item.expire_type==10" class="tui-coupon-text">自领取之日起{{item.expire_day}}天有效
- </view>
- <view v-if="item.expire_type==20" class="tui-coupon-text">
- {{item.start_time}}至{{item.end_time}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <view v-if="item.fetch!=1" class="tui-btn-box">
- <tui-button @click="toCounpon(item.id)" type="danger" width="152rpx" height="52rpx" :size="24"
- shape="circle">立即领取</tui-button>
- </view>
- </view>
- </view>
- <!--加载loadding-->
- <tui-loadmore v-if="loadding" :index="3" type="red"></tui-loadmore>
- <tui-nomore v-if="!pullUpOn" backgroundColor="#f5f5f5"></tui-nomore>
- <!--加载loadding-->
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- lang:{},
- loadding: false,
- pullUpOn: true,
- couponList: []
- }
- },
- onLoad: function(e) {
- let _this = this;
- _this.$request.get('Lang.getlang').then(res => {
- if (res.errno == 0) {
- _this.lang = res.data;
- }
- });
- this.getCoupons();
- },
- methods: {
- getCoupons: function() { // 读取可领取券列表
- var _this = this;
- _this.$request.get('couponreceive.couponlist',{samkey: (new Date()).valueOf(),showLoading:true}).then(res => {
- if (res.errno == 0) {
- _this.couponList = res.data;
- }
- })
- },
- toCounpon: function(id) {
- const _this = this
- _this.$request.post('Couponreceive.fetch', {
- id: id
- }).then(res => {
- if (res.errno == 20001 || res.errno == 20002) {
- wx.showModal({
- title: '错误',
- content: '来晚了',
- showCancel: false
- })
- return;
- }
- if (res.errno == 20003) {
- wx.showModal({
- title: '错误',
- content: '你领过了,别贪心哦~',
- showCancel: false
- })
- return;
- }
- if (res.errno == 30001) {
- wx.showModal({
- title: '错误',
- content: '您的'+lang.points+'不足',
- showCancel: false
- })
- return;
- }
- if (res.errno == 20004) {
- wx.showModal({
- title: '错误',
- content: '已过期~',
- showCancel: false
- })
- return;
- }
- if (res.errno == 0) {
- wx.showToast({
- title: '领取成功',
- icon: 'success',
- duration: 2000
- })
- _this.getCoupons();
-
- } else {
- wx.showModal({
- title: '错误',
- content: res.msg,
- showCancel: false
- })
- }
- })
- }
- },
- onPullDownRefresh() {
- setTimeout(() => {
- this.pullUpOn = true
- uni.stopPullDownRefresh()
- }, 200);
- },
- onReachBottom() {
- //只是测试效果,逻辑以实际数据为准
- if (!this.pullUpOn) return;
- this.loadding = true
- setTimeout(() => {
- this.loadding = false
- this.pullUpOn = false
- }, 1000)
- }
- }
- </script>
- <style>
- page {
- background-color: #F5F5F5;
- }
- .container {
- padding-bottom: env(safe-area-inset-bottom);
- }
- .tui-coupon-list {
- width: 100%;
- padding: 0 25rpx;
- box-sizing: border-box;
- }
- .tui-coupon-banner {
- width: 100%;
- }
- .tui-coupon-item {
- width: 100%;
- height: 210rpx;
- position: relative;
- display: flex;
- align-items: center;
- padding-right: 30rpx;
- box-sizing: border-box;
- overflow: hidden;
- }
- .tui-coupon-bg {
- width: 100%;
- height: 210rpx;
- position: absolute;
- left: 0;
- top: 0;
- z-index: 1;
- }
- .tui-coupon-sign {
- height: 110rpx;
- width: 110rpx;
- position: absolute;
- z-index: 9;
- top: -30rpx;
- right: 40rpx;
- }
- .tui-coupon-item-left {
- width: 218rpx;
- height: 210rpx;
- position: relative;
- z-index: 2;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- flex-shrink: 0;
- }
- .tui-coupon-price-box {
- display: flex;
- color: #e41f19;
- align-items: flex-end;
- }
- .tui-coupon-price-sign {
- font-size: 30rpx;
- }
- .tui-coupon-price {
- font-size: 70rpx;
- line-height: 68rpx;
- font-weight: bold;
- }
- .tui-price-small {
- font-size: 58rpx !important;
- line-height: 56rpx !important;
- }
- .tui-coupon-intro {
- background: #F7F7F7;
- padding: 8rpx 10rpx;
- font-size: 26rpx;
- line-height: 26rpx;
- font-weight: 400;
- color: #666;
- margin-top: 18rpx;
- }
- .tui-coupon-item-right {
- flex: 1;
- height: 210rpx;
- position: relative;
- z-index: 2;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-left: 24rpx;
- box-sizing: border-box;
- overflow: hidden;
- }
- .tui-coupon-content {
- width: 82%;
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .tui-coupon-title-box {
- display: flex;
- align-items: center;
- font-size: 28rpx;
- }
- .tui-coupon-title {
- width: 100%;
- font-size: 26rpx;
- color: #333;
- }
- .tui-coupon-btn {
- padding: 6rpx;
- background: #FFEBEB;
- color: #e41f19;
- font-size: 25rpx;
- line-height: 25rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- transform: scale(0.9);
- transform-origin: 0 center;
- border-radius: 4rpx;
- flex-shrink: 0;
- }
- .tui-color-grey {
- color: #888 !important;
- }
- .tui-bg-grey {
- background: #F0F0F0 !important;
- color: #888 !important;
- }
- .tui-coupon-rule {
- padding-top: 22rpx;
- }
- .tui-rule-box {
- display: flex;
- align-items: center;
- transform: scale(0.8);
- transform-origin: 0 100%;
- }
- .tui-padding-btm {
- padding-bottom: 6rpx;
- }
- .tui-coupon-circle {
- width: 8rpx;
- height: 8rpx;
- background: rgb(160, 160, 160);
- border-radius: 50%;
- }
- .tui-coupon-text {
- font-size: 28rpx;
- line-height: 28rpx;
- font-weight: 400;
- color: #666;
- padding-left: 8rpx;
- white-space: nowrap;
- }
- .tui-top20 {
- margin-top: 20rpx;
- }
- .tui-coupon-radio {
- transform: scale(0.7);
- transform-origin: 100% center;
- }
- .tui-btn-box {
- position: absolute;
- width: 146rpx;
- height: 52rpx;
- right: 20rpx;
- bottom: 40rpx;
- z-index: 10;
- }
- /* #ifdef APP-PLUS || MP */
- .wx-radio-input {
- margin-right: 0 !important;
- }
- /* #endif */
- /* #ifdef H5 */
- >>>uni-radio .uni-radio-input {
- margin-right: 0 !important;
- }
- /* #endif */
- </style>
|