|
@@ -0,0 +1,627 @@
|
|
|
+<template>
|
|
|
+ <view>
|
|
|
+ <view class="giftContainer">
|
|
|
+ <view class="banner">
|
|
|
+ <view class="num">
|
|
|
+ <text class="spec" v-if="userServerInfo">{{ integral }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="flex">
|
|
|
+ <view class="mingxi" @click="goAddress">
|
|
|
+ 收货地址
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="fixedHeader">
|
|
|
+ <view />
|
|
|
+ <view v-if="userServerInfo">
|
|
|
+ <view class="title" @tap="exchangerecord">
|
|
|
+ <text>兑换记录</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="list" v-if="list.length > 0">
|
|
|
+ <view v-for="item in list" :key="item.id" class="item" @click="exchange(item)">
|
|
|
+ <view class="avatar" :style="{ backgroundImage: `url(${item.img})` }" @click.stop="priview(item.img)">
|
|
|
+ <view v-if="!Number(item.surplus)" class="none"><text>已兑完</text></view>
|
|
|
+ </view>
|
|
|
+ <view class="info">
|
|
|
+ <view class="title">{{ item.name }}</view>
|
|
|
+ <view class="info-num">
|
|
|
+ <view class="info-other">限量{{ item.total }}份</view>
|
|
|
+ <view class="info-status" v-if="item.exchanged">已兑换</view>
|
|
|
+ </view>
|
|
|
+ <view class="bottom">
|
|
|
+ <view class="money">
|
|
|
+ <text class="spec">{{ item.price }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="btn" :class="Number(item.surplus) ? '' : 'disabled'">立即兑换</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ api_getExchangeList,
|
|
|
+ GetInte
|
|
|
+ } from '../../apis/zbs.js';
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ list: [],
|
|
|
+ integral: ''
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ userServerInfo() {
|
|
|
+ //用户服务器信息
|
|
|
+ return this.$store.state.userServerInfo;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onShow() {
|
|
|
+ // const data = uni.getStorageSync('userServerInfo')
|
|
|
+ // this.$store.commit('GETUSERSERVERINFO', data)
|
|
|
+ this.getGiftList()
|
|
|
+ this.getBound()
|
|
|
+
|
|
|
+ },
|
|
|
+ onPullDownRefresh() {
|
|
|
+ this.getGiftList()
|
|
|
+ this.getBound()
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.stopPullDownRefresh()
|
|
|
+ }, 1500);
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ goAddress() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "../zbs-addAddress/addAddress"
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getGiftList() {
|
|
|
+ // uni.showLoading();
|
|
|
+ api_getExchangeList().then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ //获取兑换礼品列表
|
|
|
+ this.list = res.data.list;
|
|
|
+ console.log(res.data.list)
|
|
|
+ // uni.hideLoading();
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.message || '获取失败',
|
|
|
+ duration: 2000,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getBound() {
|
|
|
+ GetInte({ user_id: this.userServerInfo.id }).then(res => {
|
|
|
+ //获取jiang xue jin
|
|
|
+ this.integral = res.data.integral
|
|
|
+ console.log(res.data.integral)
|
|
|
+ });
|
|
|
+ },
|
|
|
+ exchangerecord() {
|
|
|
+ //进入兑换记录页面
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '../zbs-exchangerecord/exchangerecord'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ priview(src) {
|
|
|
+ // 预览
|
|
|
+ uni.previewImage({
|
|
|
+ urls: [src]
|
|
|
+ });
|
|
|
+ },
|
|
|
+ exchange(data) {
|
|
|
+ if (data.surplus) {
|
|
|
+ //如果有货
|
|
|
+ getApp().globalData.detail = data; //把兑换列表保存到 globalData 中
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '../zbs-detail/detail' //去商品详情页面时
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showModal({
|
|
|
+ content: '来晚了!礼品已兑换完毕!再看看别的吧!',
|
|
|
+ showCancel: false
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .flexCC {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .share_show {
|
|
|
+ width: 100%;
|
|
|
+ height: 100vh;
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ background-color: rgba(0, 0, 0, 0.7);
|
|
|
+ z-index: 9999;
|
|
|
+
|
|
|
+ .share_con {
|
|
|
+ width: 80%;
|
|
|
+ margin: 0 auto;
|
|
|
+ height: 100%;
|
|
|
+ z-index: 999999;
|
|
|
+
|
|
|
+ .canvas {
|
|
|
+ width: 540rpx;
|
|
|
+ height: 960rpx;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ #canvas {
|
|
|
+ width: 540rpx;
|
|
|
+ height: 960rpx;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .poster_img {
|
|
|
+ -webkit-touch-callout: default;
|
|
|
+ width: 540rpx;
|
|
|
+ height: 960rpx;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+
|
|
|
+ img[src=''],
|
|
|
+ img:not([src]) {
|
|
|
+ opacity: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .save_img {
|
|
|
+ color: #fff;
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 40rpx;
|
|
|
+ margin-top: 20rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .iconfont {
|
|
|
+ position: absolute;
|
|
|
+ top: 4vh;
|
|
|
+ right: 25rpx;
|
|
|
+ color: #dedede;
|
|
|
+ font-size: 60rpx;
|
|
|
+ z-index: 999;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .sub_btn {
|
|
|
+ margin-top: 76rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ page {
|
|
|
+ height: auto;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+
|
|
|
+ // .status_bar {
|
|
|
+ // width: 100vw;
|
|
|
+ // position: relative;
|
|
|
+ // z-index: 10;
|
|
|
+ // margin: 0;
|
|
|
+
|
|
|
+ // .nav_box {
|
|
|
+ // width: 100%;
|
|
|
+ // padding: 0 20px;
|
|
|
+ // font-size: 40rpx;
|
|
|
+
|
|
|
+ // .back {
|
|
|
+ // margin-right: 8rpx;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+ // position: fixed;
|
|
|
+ // top: 0;
|
|
|
+ // padding-top: 40rpx;
|
|
|
+ // left: 25rpx;
|
|
|
+ // height: 128rpx;
|
|
|
+ // z-index: 1000;
|
|
|
+ // line-height: 88rpx;
|
|
|
+ // background-color: #fff;
|
|
|
+ // width: 100%;
|
|
|
+ // display: flex;
|
|
|
+ // justify-content: space-between;
|
|
|
+ // align-items: center;
|
|
|
+ // }
|
|
|
+
|
|
|
+ .giftContainer {
|
|
|
+ flex: 1;
|
|
|
+ overflow: hidden;
|
|
|
+ padding: 30rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ // margin-top: 110rpx;
|
|
|
+
|
|
|
+ .message {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0 42rpx 0 14rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background-color: #fff4f3;
|
|
|
+ height: 62rpx;
|
|
|
+ border-radius: 62rpx;
|
|
|
+ margin-bottom: 30rpx;
|
|
|
+
|
|
|
+ .icon {
|
|
|
+ width: 128rpx;
|
|
|
+ height: 46rpx;
|
|
|
+ background: linear-gradient(88deg, #ffc401 0%, #fe2400 41%, #fe0000 100%);
|
|
|
+ border-radius: 45rpx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ color: #ffffff;
|
|
|
+ font-size: 28rpx;
|
|
|
+ margin-right: 14rpx;
|
|
|
+
|
|
|
+ &::before {
|
|
|
+ content: '';
|
|
|
+ display: block;
|
|
|
+ width: 28rpx;
|
|
|
+ height: 28rpx;
|
|
|
+ background: url(../../static/gift/1.png) 100% center no-repeat;
|
|
|
+ background-size: 100%;
|
|
|
+ margin-right: 6rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .text {
|
|
|
+ flex: 1;
|
|
|
+ height: 40rpx;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ .scroll {
|
|
|
+ height: 40rpx;
|
|
|
+ line-height: 40rpx;
|
|
|
+ white-space: nowrap;
|
|
|
+ color: #ea4a41;
|
|
|
+ font-weight: 28rpx;
|
|
|
+ animation: scroll-left-right 12s linear infinite;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .banner {
|
|
|
+ width: 100%;
|
|
|
+ height: 240rpx;
|
|
|
+ background: linear-gradient(270deg, #f97c55 0%, #f44545 100%);
|
|
|
+ border-top-left-radius: 24rpx;
|
|
|
+ border-top-right-radius: 24rpx;
|
|
|
+ position: relative;
|
|
|
+ padding: 60rpx 40rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-bottom: 30rpx;
|
|
|
+
|
|
|
+ .num {
|
|
|
+ color: #ffffff;
|
|
|
+ font-size: 32rpx;
|
|
|
+ line-height: 44rpx;
|
|
|
+
|
|
|
+ .spec {
|
|
|
+ font-size: 76rpx;
|
|
|
+ margin-right: 10rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ margin-bottom: 10rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .mingxi {
|
|
|
+ width: 184rpx;
|
|
|
+ height: 64rpx;
|
|
|
+ background: linear-gradient(180deg, #FCEAC0 0%, #FFD57D 100%);
|
|
|
+ border-radius: 32rpx;
|
|
|
+ color: #FB231F;
|
|
|
+ font-size: 28rpx;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 64rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ &::after {
|
|
|
+ content: '';
|
|
|
+ display: block;
|
|
|
+ width: calc(100% + 30rpx);
|
|
|
+ height: 28rpx;
|
|
|
+ background: linear-gradient(180deg, rgba(234, 74, 65, 0) 0%, rgba(234, 74, 65, 0.35) 100%);
|
|
|
+ border-radius: 28rpx;
|
|
|
+ position: absolute;
|
|
|
+ left: -15rpx;
|
|
|
+ right: -15rpx;
|
|
|
+ bottom: -14rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ &::before {
|
|
|
+ content: '';
|
|
|
+ display: block;
|
|
|
+ width: 170rpx;
|
|
|
+ height: 170rpx;
|
|
|
+ background-image: url('https://api.jiuweiyun.cn/public/uploads/weapp/icon/2.png');
|
|
|
+ background-position: center;
|
|
|
+ background-size: 100%;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ right: 30rpx;
|
|
|
+ transform: translateY(-50%);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .fixedHeader {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-bottom: 30rpx;
|
|
|
+
|
|
|
+ .num {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ color: #333333;
|
|
|
+ font-size: 32rpx;
|
|
|
+ line-height: 56rpx;
|
|
|
+
|
|
|
+ .spec {
|
|
|
+ color: #ea4a41;
|
|
|
+ font-size: 40rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ &::before {
|
|
|
+ content: '';
|
|
|
+ display: block;
|
|
|
+ width: 40rpx;
|
|
|
+ height: 40rpx;
|
|
|
+ background-image: url(../../static/gift/3.png);
|
|
|
+ background-size: 100%;
|
|
|
+ background-position: center;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ margin-right: 10rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .title {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ color: #999999;
|
|
|
+ font-size: 32rpx;
|
|
|
+
|
|
|
+ &::before {
|
|
|
+ content: '';
|
|
|
+ display: block;
|
|
|
+ width: 34rpx;
|
|
|
+ height: 34rpx;
|
|
|
+ background-image: url(../../static/gift/4.png);
|
|
|
+ background-size: 100%;
|
|
|
+ background-position: center;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ margin-right: 10rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .list {
|
|
|
+ width: 100%;
|
|
|
+
|
|
|
+ .item {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: stretch;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-bottom: 30rpx;
|
|
|
+
|
|
|
+ .avatar {
|
|
|
+ width: 260rpx;
|
|
|
+ height: 260rpx;
|
|
|
+ background-color: #f9f9fb;
|
|
|
+ position: relative;
|
|
|
+ border-radius: 16rpx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ margin-right: 20rpx;
|
|
|
+ background-position: center;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-size: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ .none {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ bottom: 0;
|
|
|
+ right: 0;
|
|
|
+ left: 0;
|
|
|
+ background: rgba(0, 0, 0, 0.5);
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ color: #ffffff;
|
|
|
+ font-size: 32rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .info {
|
|
|
+ flex: 1;
|
|
|
+ overflow: hidden;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ .title {
|
|
|
+ color: #333333;
|
|
|
+ font-size: 32rpx;
|
|
|
+ line-height: 44rpx;
|
|
|
+ width: 100%;
|
|
|
+ height: 44rpx;
|
|
|
+ overflow: hidden;
|
|
|
+ font-weight: bold;
|
|
|
+ margin-bottom: 20rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ &-num {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-bottom: 70rpx;
|
|
|
+
|
|
|
+ .info-other {
|
|
|
+ color: #ea4a41;
|
|
|
+ font-size: 28rpx;
|
|
|
+ height: 52rpx;
|
|
|
+ line-height: 52rpx;
|
|
|
+ padding: 0 10rpx;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ background-color: #fff4f3;
|
|
|
+ }
|
|
|
+
|
|
|
+ .info-status {
|
|
|
+ color: #ffffff;
|
|
|
+ font-size: 28rpx;
|
|
|
+ height: 44rpx;
|
|
|
+ line-height: 44rpx;
|
|
|
+ padding: 0 14rpx;
|
|
|
+ background-color: #ffbb01;
|
|
|
+ border-top-left-radius: 16rpx;
|
|
|
+ border-bottom-right-radius: 16rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .bottom {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ .money {
|
|
|
+ color: #ea4a41;
|
|
|
+ font-size: 24rpx;
|
|
|
+
|
|
|
+ .spec {
|
|
|
+ font-size: 40rpx !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn {
|
|
|
+ height: 68rpx;
|
|
|
+ border-radius: 68rpx;
|
|
|
+ background: linear-gradient(141deg, #f97c55 0%, #f44545 100%);
|
|
|
+ line-height: 68rpx;
|
|
|
+ width: 192rpx;
|
|
|
+ text-align: center;
|
|
|
+ color: #ffffff;
|
|
|
+ font-size: 28rpx;
|
|
|
+
|
|
|
+ &.disabled {
|
|
|
+ background: #f8f8f8 !important;
|
|
|
+ color: #999999;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .exchange {
|
|
|
+ // @include page();
|
|
|
+
|
|
|
+ .content {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+
|
|
|
+ .scroll {
|
|
|
+ height: 50rpx;
|
|
|
+ line-height: 50rpx;
|
|
|
+ background: rgba(250, 99, 66, 0.2);
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ color: #fa6342;
|
|
|
+
|
|
|
+ text {
|
|
|
+ font-size: 40rpx;
|
|
|
+ color: #fa6342;
|
|
|
+ margin-left: 30rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .scroll-wrapper {
|
|
|
+ flex: 1;
|
|
|
+ height: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ .scroller {
|
|
|
+ height: 100%;
|
|
|
+ white-space: nowrap;
|
|
|
+ font-size: 26rpx;
|
|
|
+ padding-left: 10rpx;
|
|
|
+ animation: scroll-left-right 12s linear infinite;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .banner {
|
|
|
+ width: 100%;
|
|
|
+ height: 216rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav {
|
|
|
+ height: 76rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 0 30rpx;
|
|
|
+ border-bottom: 6rpx solid #eeeeee;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ font-size: 32rpx;
|
|
|
+
|
|
|
+ view {
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .cuIcon {
|
|
|
+ font-size: 40rpx;
|
|
|
+ margin-right: 12rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .list {
|
|
|
+ flex: 1;
|
|
|
+
|
|
|
+ scroll-view {
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 0 30rpx 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @keyframes scroll-left-right {
|
|
|
+ 0% {
|
|
|
+ transform: translateX(100%);
|
|
|
+ }
|
|
|
+
|
|
|
+ 100% {
|
|
|
+ transform: translateX(-100%);
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|