| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484 |
- <template>
- <div class="container">
- <view class="head">
- <!-- 用户信息 -->
- <view class="userinfo flex_r flex_ac">
- <image class="user_img" :src="userinfo.head_pic" mode=""></image>
- <view class="user_info flex_c flex_jc">
- <view class="user_name">{{ userinfo.nickname }}</view>
- <view class="level_con flex_r flex_ac">
- <view class="level">{{ userinfo.level_name }}</view>
- </view>
- </view>
- </view>
- <!-- 用户信息-end -->
- <!-- 签到信息 -->
- <view class="sign_info flex_c">
- <view class="info flex_r flex_ac flex_jb">
- <view class="info_today flex_c flex_ac">
- <view class="today_text g_color">{{ todaySign }}</view>
- <view class="info_text">今日签到</view>
- </view>
- <view class="info_today flex_c flex_ac">
- <view class="today_text">{{ totalSign }}</view>
- <view class="info_text">累计签到({{ totalSign || 0 }}次)</view>
- </view>
- <view class="info_con">
- <image class="info_img" :src="nextSign > 0 ? '/static/sgin/p_back2.png' : '/static/sgin/p_back.png'" mode="" />
- <!-- <view class="info_texts flex_r flex_ac flex_jc" v-if="nextSign > 0">{{ timer }}</view> -->
- <uni-countdown class="info_texts flex_r flex_ac flex_jc" v-if="nextSign > 0" :second="nextSign" :showDay="false" />
- <view class="info_texts flex_r flex_ac flex_jc" @tap="setSignIn" v-else>立即签到</view>
- </view>
- </view>
- <view class="sign_time flex_r flex_ac flex_je mar_t20">
- <text></text>
- </view>
- </view>
- <!-- 签到信息-end -->
- </view>
- <!-- 精品推荐 -->
- <view class="bou_head flex_r flex_ac flex_jc">
- <image class="bou_img" src="/static/sgin/left.png" mode=""></image>
- <view class="bou_title">精品推荐</view>
- <image class="bou_img" src="/static/sgin/right.png" mode=""></image>
- </view>
- <view class="product-list">
- <view class="product" v-for="(i, s) in goods" :key="s" @click="NavToGoodsDetail(i.id, i.type)">
- <view class="image-view">
- <image class="product-image" :src="i.original_img"></image>
- </view>
- <view class="content-view">
- <view :class="['product-title', 'ellipsis']">{{ i.goods_name }}</view>
- <view class="product-price">
- <text class="product-price-original">{{ i.price }}</text>
- <text class="product-text" v-if="['3','4'].includes(i.type)">赠<text class="corFE2C15">{{ i.give_cha_bao }}</text>茶宝</text>
- </view>
- <view class="product-txt" v-if="i.type == 4">
- <text class="product-price-favour">{{i.market_price}}</text>
- <text class="product-text">消费金抵</text>
- <span class="corFE2C15">¥{{ Number(i.consume) }}</span>
- </view>
- <view class="product-txt" v-if="i.type == 1">赠送{{ i.give_integral + "批发券" }}</view>
- <view class="product-txt" v-if="['3','4'].includes(i.type)">限时赠送<text class="corFE2C15">{{ i.teac }}</text>TeaC</view>
- <view class="product-txt fenxiang" v-if="['3','4'].includes(i.type)">
- <text class="iconfont red"></text>
- <text class="red">分享约获得 {{ i.first_teac }} {{i.type==3?'TeaC':'现金'}}</text>
- </view>
- </view>
- </view>
- </view>
- <!-- 精品推荐-end -->
- <view class="fz_w_text">让数字经济赋能美好生活!</view>
- </div>
- </template>
- <script>
- let page = 1;
- let app = getApp();
- var appEv = app.$vm.$options;
- import { post } from "@/request/api.js";
- export default {
- components: {},
- data() {
- return {
- integerInfo: {}, // 积分详情
- userInof: {}, // 用户详情
- goods: [], // 精品推荐
- haveGoods: false, // 是否有商品
- way_list: [], //兑换方式
- checked: false, //是否选中协议
- currrent: 0, // 选中的兑换方式
- pay_way: 0, //选中的支付方式
- isShow: false, // 是否显示现金支付
- goodsId: "", // 选中的商品Id
- shopInfo: {}, // 商户信息
- userinfo: undefined, //用户信息
- todaySign: 0, //今日签到数
- totalSign: 0, //累计签到数
- nextSign: 0, //剩余签到时间 秒
- canClick: true,
- };
- },
- onShow() {},
- onLoad(da) {
- this.userinfo = uni.getStorageSync("userinfo");
- this.loadData();
- this.goodsDay();
- },
- onHide() {},
- methods: {
- loadData() {
- let data = {
- time: (new Date().getTime() / 1000).toFixed(0)
- }
- post("v1/user/sign", data).then((res) => {
- if (res.code == 0) {
- this.todaySign = res.data.today_sign;
- this.totalSign = res.data.total_sign;
- this.$set(this, "nextSign", res.data.next_sign)
- }
- });
- },
- // 签到
- setSignIn() {
- let data = {
- time: (new Date().getTime() / 1000).toFixed(0)
- }
- post("v1/user/doSign", data).then((res) => {
- if (res.code === 0) {
- this.loadData();
- } else {
- appEv.errTips(res.msg);
- }
- });
- },
- // 获取消费金电商
- goodsDay() {
- let that = this;
- let data = { page, type: 4 };
- post("v1/goods/goodsList", data).then((res) => {
- if (res.code === 0) {
- let obj = res.data.data;
- if (page <= 1) that.goods = [];
- if (obj.length > 0) {
- obj.forEach((e) => {
- that.goods.push(e);
- });
- } else {
- if (page == 1) {
- that.haveGoods = true;
- page = -1;
- } else {
- page = -1;
- appEv.errTips("暂无更多");
- }
- }
- } else {
- if (page == 1) {
- that.haveGoods = true;
- page = -1;
- } else {
- page = -1;
- appEv.errTips("暂无更多");
- }
- }
- });
- },
- // 跳转到商品详情页
- NavToGoodsDetail(id, type) {
- this.goto("/pages/product/p_details", { id, type });
- },
- },
- //页面上拉触底事件的处理函数
- onReachBottom() {
- if (page != -1) {
- setTimeout(() => {
- ++page;
- this.goodsDay();
- }, 500);
- }
- },
- };
- </script>
- <style lang="scss" scoped>
- // 页面配置
- page {
- background: #f5f5f5;
- }
- .head {
- padding: 30rpx;
- }
- // 页面配置-end
- // 用户信息
- .userinfo {
- width: 100%;
- position: relative;
- }
- .user_img {
- width: 101.5rpx;
- height: 101.5rpx;
- margin-right: 20rpx;
- border-radius: 50%;
- }
- .level {
- background: rgba(0, 0, 0, 0.18);
- padding: 6rpx 24rpx;
- font-size: 24rpx;
- color: #fff;
- border-radius: 100rpx;
- }
- .user_name {
- font-size: 30rpx;
- color: #333;
- font-family: "SourceHanSansSC-Medium";
- font-weight: 500;
- margin-bottom: 18rpx;
- line-height: 1;
- }
- .record {
- width: 136rpx;
- height: 54rpx;
- background: rgba(0, 0, 0, 0.18);
- color: #fff;
- font-size: 24rpx;
- border-radius: 27rpx 0 0 27rpx;
- position: absolute;
- bottom: calc(50% - 27rpx);
- right: -30rpx;
- }
- // 用户信息-end
- // 签到信息
- .info {
- width: 100%;
- overflow: hidden;
- }
- .info_text {
- font-size: 24rpx;
- color: #404040;
- }
- .info_con {
- width: 185rpx;
- height: 185rpx;
- position: relative;
- }
- .info_img {
- width: 100%;
- height: 185rpx;
- animation: myfirst 1s infinite;
- }
- .info_texts {
- width: 100%;
- height: 100%;
- position: absolute;
- top: 0;
- left: 0;
- }
- .today_text {
- font-family: "SourceHanSansCN-Medium";
- font-size: 53rpx;
- color: #373737;
- }
- .info_texts text {
- width: 56rpx;
- text-align: justify;
- font-size: 28rpx;
- color: #12b381;
- }
- .sign_time text {
- width: 185rpx;
- overflow: hidden;
- font-size: 36rpx;
- color: #353535;
- font-family: "SourceHanSansCN-Bold";
- font-weight: bold;
- }
- .sign_info {
- width: 100%;
- overflow: hidden;
- background: #fff;
- border-radius: 16rpx;
- box-shadow: 2px 3px 0px 0px rgba(16, 178, 127, 0.36), 0px 4px 15px 10px rgba(17, 179, 129, 0.2);
- padding: 24rpx 40rpx;
- box-sizing: border-box;
- margin-top: 44rpx;
- }
- .g_color {
- color: #12b381;
- }
- .gr_color {
- color: #999 !important;
- }
- // 签到信息-end
- // 动画效果
- @keyframes myfirst {
- 0% {
- transform: rotate(0);
- }
- 10% {
- transform: rotate(-36deg);
- }
- 20% {
- transform: rotate(-72deg);
- }
- 30% {
- transform: rotate(-108deg);
- }
- 40% {
- transform: rotate(-144deg);
- }
- 50% {
- transform: rotate(-180deg);
- }
- 60% {
- transform: rotate(-216deg);
- }
- 70% {
- transform: rotate(-252deg);
- }
- 80% {
- transform: rotate(-288deg);
- }
- 90% {
- transform: rotate(-324deg);
- }
- 100% {
- transform: rotate(-360deg);
- }
- }
- // 动画效果-end
- // 精彩推荐
- .bou_head {
- width: 100%;
- height: 114rpx;
- margin-top: 50rpx;
- .bou_img {
- width: 92rpx;
- height: 30rpx;
- }
- .bou_title {
- height: 30rpx;
- line-height: 30rpx;
- font-size: 36rpx;
- color: #121212;
- font-weight: bold;
- margin: 0 36rpx;
- }
- }
- .product-list {
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- flex-direction: row;
- padding: 0 30rpx;
- .product {
- width: 48.5%;
- margin-bottom: 20rpx;
- padding-bottom: 12rpx;
- border-radius: 10rpx;
- box-shadow: 4rpx 4rpx 16rpx 10rpx rgba($color: #000, $alpha: 0.15);
- &:nth-child(2n) {
- margin-left: 3%;
- }
- }
- .product-image {
- border-radius: 10rpx 10rpx 0 0;
- width: 100%;
- height: 42.3vw;
- object-fit: cover;
- }
- .content-view {
- padding: 0 16rpx;
- }
- .product-title {
- width: 100%;
- overflow: hidden;
- line-height: 1.5;
- font-size: 28rpx;
- color: #121212;
- }
- .product-price {
- color: #121212;
- font-size: 28rpx;
- position: relative;
- }
- .product-price-original {
- color: #18bb88;
- font-size: 32rpx;
- font-weight: bold;
- &:before {
- content: "¥";
- font-size: 20rpx;
- }
- }
- .product-price-favour {
- color: #888888;
- text-decoration: line-through;
- margin-left: 20rpx;
- }
- .product-tip {
- position: absolute;
- right: 20rpx;
- background-color: #ff3333;
- color: #ffffff;
- padding: 0 20rpx;
- border-radius: 10rpx;
- }
- .product-unit {
- font-size: 24rpx;
- color: #18bb88;
- }
- .product-txt,
- .product-text {
- font-size: 22rpx;
- color: #787878;
- .iconfont {
- margin-right: 6rpx;
- }
- }
- .product-text {
- margin-left: 16rpx;
- }
- .red {
- color: #FA2E18;
- }
- .fenxiang {
- font-size: 20rpx;
- background: rgba(250, 46, 24, 0.08);
- display: inline-block;
- border-radius: 6rpx;
- padding: 0 16rpx;
- }
- }
- </style>
|