| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546 |
- <template>
- <view class="container">
- <!-- 用户信息 -->
- <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 class="record flex_r flex_ac flex_jc" @tap="NavToSignList">积分记录</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">{{todaySign}}</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=""></image>
- <view class="info_texts flex_r flex_ac flex_jc" @tap="setSignIn">{{nextSign > 0 ? timer : ''}}<text v-if="nextSign <= 0">立即签到</text></view>
- </view>
- </view>
- <view class="sign_time flex_r flex_ac flex_je mar_t20">
- <text></text>
- </view>
- </view>
- <!-- 签到信息-end -->
-
- <!-- 精品推荐 -->
- <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="['product-title', 'ellipsis1']">{{ i.goods_name }}</view>
- <view class="product-price">
- <text class="product-price-original"><text class="product-unit">¥</text>{{ i.price }}</text>
- <!-- <text class="product-price-favour">¥{{i.originalPrice}}</text> -->
- <!-- <text class="product-tip">{{i.tip}}</text> -->
- </view>
- <view class="product-txt">赠送{{ i.give_integral ? i.give_integral + '批发积分' : i.give_cha_bao + '茶宝'}}</view>
- </view>
- <view class='fz_w_text mar_t20 mar_b20'>让数字经济赋能美好生活!</view>
- </view>
- <!-- 精品推荐-end -->
- </view>
- </template>
- <script>
- var tim
- let page = 1;
- let app = getApp();
- var appEv = app.$vm.$options;
- import uniPopup from '@/components/uni-popup/uni-popup'
- import goodsLista from "@/components/goodsLista"
- import { get, post, u_post } from "@/request/api.js";
- export default {
- components: {
- uniPopup,
- goodsLista,
- },
- data() {
- return {
- integerInfo: {}, // 积分详情
- userInof: {}, // 用户详情
- timer: '00:00:00', // 倒计时
- 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, //剩余签到时间 秒
- };
- },
- onShow() {
- this.timer = '00:00:00'
- this.userinfo = uni.getStorageSync("userinfo")
-
- this.loadData()
- this.goodsDay()
- },
- onHide() {
- clearInterval(tim)
- },
- methods: {
- loadData() {
- post("/user/sign").then(res => {
- if (res.code == 0) {
- // that.integerInfo = res.integerInfo
- // that.userInof = res.userInof
- this.todaySign = res.data.today_sign
- this.totalSign = res.data.total_sign
- this.nextSign = res.data.next_sign
- this.setTime()
- }
- })
- },
- // 距可以签到倒计时
- setTime() {
- var date;
- let timer = this.nextSign
- tim = setInterval(() => {
- if (timer >= 1) {
- timer--
- } else {
- clearInterval(tim)
- }
- let hour = parseInt(timer / 3600) > 9 ? parseInt(timer / 3600) : '0' + parseInt(timer / 3600)
- let min = parseInt(timer / 60 % 60) > 9 ? parseInt(timer / 60 % 60) : '0' + parseInt(timer / 60 % 60)
- let sec = parseInt(timer % 60) > 9 ? parseInt(timer % 60) : '0' + parseInt(timer % 60)
-
- date = hour + ':' + min + ':' + sec;
- // console.log(date);
- this.timer = date
- }, 999)
- },
- // 签到
- setSignIn() {
- post("user/doSign").then(res => {
- if (res.code === 0) {
- appEv.errTips(res.msg)
- this.loadData()
- } else {
- appEv.errTips(res.msg)
- }
- })
- },
- // 获取今日值得买
- goodsDay() {
- let that = this;
- let data = {
- page: page,
- type: 4
- }
- post("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;
- }
- .container {
- padding: var(--status-bar-height) 30rpx 30rpx;
- box-sizing: border-box;
- background: url('https://tea.soowin.com/mnt/image/sign_back.png');
- background-repeat: no-repeat;
- background-size: 100% 427rpx;
- }
- // 页面配置-end
- // 用户信息
- .userinfo {
- width: 100%;
- // margin-top: 24rpx;
- position: relative;
- }
- .user_img {
- width: 101.5rpx;
- height: 101.5rpx;
- margin-right: 20rpx;
- border-radius: 50%;
- }
- .level {
- background: rgba(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, .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: 0px 3px 0px 0px rgba(16, 178, 127, 0.36), 0px 6px 10px 0px 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
- // 积分兑好礼
- .more {
- font-size: 24rpx;
- color: #313131;
- }
- .inte_con {
- width: 100%;
- overflow: hidden;
- }
- .goods_price {
- font-size: 30rpx;
- color: #F15C21;
- }
- .inte_goods:nth-last-child(1) {
- margin-right: 0;
- }
- .goods_price text {
- font-size: 18rpx;
- color: #F15C21;
- }
- .more_img {
- width: 9rpx;
- height: 16rpx;
- margin-left: 10rpx;
- }
- .goods_img {
- width: 100%;
- height: 141rpx;
- margin-bottom: 16rpx;
- }
- .goods_name {
- width: 100%;
- overflow: hidden;
- color: #1D1D1D;
- font-size: 24rpx;
- }
- .inte_goods {
- width: calc((100% - 28rpx) / 3);
- margin-right: 14rpx;
- overflow: hidden;
- }
- .inte_title {
- font-size: 36rpx;
- color: #2A2A2A;
- font-family: "SourceHanSansSC-Bold";
- font-weight: bold;
- }
- .integral {
- width: 100%;
- overflow: hidden;
- background: #fff;
- padding: 30rpx;
- box-sizing: border-box;
- border-radius: 20rpx;
- }
- // 积分兑好礼-end
- // 精彩推荐
- .bou_head{
- width: 100%;
- height: 114rpx;
- margin-top: 50rpx;
- .bou_img{
- width: 89rpx;
- height: 30rpx;
- }
- .bou_title{
- font-size: 36rpx;
- color:#121212;
- font-family: "SourceHanSansSC-Bold";
- font-weight: bold;
- margin: 0 36rpx;
- }
- }
- .product-list {
- // padding: 0 20rpx;
- display: flex;
- width: 100%;
- flex-wrap: wrap;
- flex-direction: row;
- .product {
- // width: 50%;
- // padding: 20rpx 10rpx;
- // display: flex;
- // flex-direction: column;
- margin-bottom: 20rpx;
- width: 48.5%;
- padding-bottom: 6px;
- // border: 1px solid #eee;
- border-radius: 5px;
- box-shadow: 4rpx 4rpx 26rpx 2rpx rgba(17, 18, 29, 0.08);
- &:nth-child(2n){
- margin-left: 3%;
- }
- }
- .product-image {
- border-radius: 10rpx 10rpx 0 0;
- width: 100%;
- height: 260rpx;
- object-fit: cover;
- }
- .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;
- }
- .product-price-favour {
- color: #888888;
- text-decoration: line-through;
- margin-left: 10upx;
- }
- .product-tip {
- position: absolute;
- right: 10upx;
- background-color: #ff3333;
- color: #ffffff;
- padding: 0 10upx;
- border-radius: 5upx;
- }
- .product-unit {
- font-size: 24rpx;
- color: #18bb88;
- }
- .product-txt {
- font-size: 22rpx;
- color: #787878;
- }
- }
- </style>
|