| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362 |
- <template>
- <view :style="vuex_skin" style="width: 100vw;overflow: hidden;">
- <!-- #ifdef MP-WEIXIN -->
- <u-navbar title-color="#fff" z-index="90" :border-bottom="false" :is-back="false" title="积分换礼"
- :background="{'backgroundColor': vuex_theme.shopBg}"></u-navbar>
- <!-- #endif -->
- <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback" :safearea="true">
- <view class="bg-card">
- <view class="info" style="display: flex;justify-content: space-between;">
- <view class="flex" v-if="vuex_userId">
- <image style="width: 90rpx;height: 90rpx;border-radius: 50%;" :src="avatar">
- </image>
- <view class="center data">
- <text style="color: #FFD7D9;">我的积分:</text>
- <text class="text-bold text-xxl">{{userData.userPufaPoint || 0}}</text>
- </view>
- </view>
- <view class="flex" v-else @click="showLogin">
- <image style="width: 90rpx;height: 90rpx;border-radius: 50%;" src="/static/icon/unlogin.png">
- </image>
- <view class="center data">
- <text style="color: #FFFFFF;font-weight: 800;">点击授权登录</text>
- </view>
- </view>
- <view class="center" style="margin-right: -30rpx;">
- <view class="cu-btn round sm rule"
- @click="$jump('/pages/introduce/notice?title=积分规则')">
- 积分兑换规则
- </view>
- </view>
- </view>
- </view>
- <view class="swiper">
- <u-swiper :list="swiperList" name="url" mode="rect" border-radius="12" height="270" @click="handleSwiper"></u-swiper>
- </view>
- <filter-bar :currentIndex="currentIndex" ref="filterBar" @exchangeTag="handeExchangeTag"></filter-bar>
- <view class="recommend-info">
- <view class="goods-list">
- <navigator hover-class="none" :url="'detail?id='+item.id" class="list" v-for="(item,index) in list"
- :key="index">
- <view class="pictrue">
- <image :src="item.imgUrl"></image>
- </view>
- <view class="title-tag" style="text-align: center;font-weight: 800;">
- <text class="text-cut-1">{{item.name}}</text>
- </view>
- <view class="price-info">
- <view class="user-price">
- <text class="max">{{item.point}}积分</text>
- </view>
- </view>
- <view class="bottom padding-top-20">
- <button class="cu-btn round text-white bg-base"
- style="width: 140upx;height: 50upx;">兑换</button>
- </view>
- </navigator>
- </view>
- </view>
- </mescroll-body>
- <login ref="login" @signIn="signIn" @phoneSuccess="phoneSuccess"></login>
- <u-tabbar :bg-color="tabbar.bgColor" :icon-size="tabbar.iconSize" :height="100" :border-top="tabbar.borderTop"
- :inactive-color="tabbar.inactiveColor" :active-color="tabbar.activeColor" :list="tabbar.list">
- </u-tabbar>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- import filterBar from "@/components/filterBar/filterBar.vue"
- import {tabbar} from "@/assets/http/tabbar.js"
- export default {
- components: {
- filterBar,
- },
- mixins: [MescrollMixin],
- data() {
- return {
- //tabbar
- tabbar: {},
-
- swiperList: [],
- downOption: {
- auto: false
- },
- upOption:{
- auto:false
- },
- avatar: '',
- userData: {},
- list: [],
- isWorksSkip: false, //是否从作品详情页跳转进来
- currentIndex: 0, //筛选栏下标,默认为0, 1: 销量 2
- searchType: 0, //搜索类型
- }
- },
- onShow() {
- this.init()
- },
- async onLoad() {
- //加载底部导航栏
- this.fetchTabbar()
- //获取轮播图
- this.fetchSwiperList()
- //加载积分商城
- this.fetchGoods()
- },
- watch: {
- isWorksSkip(newVal, oldVal) {
- if(newVal != oldVal){this.fetchGoods();}
- },
- searchType(newVal, oldVal) {
- if(newVal != oldVal){this.fetchGoods();}
- }
- },
- methods: {
- handleSwiper(index){
- let url = this.swiperList[index].path;
- if(!!url && (url.indexOf('http://') > -1 || url.indexOf('https://') > -1) ){
- window.location.href = url;
- }
- },
- fetchGoods(){
- // #ifdef MP-WEIXIN
- this.mescroll.resetUpScroll();
- // #endif
-
- // #ifdef H5
- setTimeout(()=>{
- this.mescroll.resetUpScroll();
- },50)
- // #endif
- },
- async fetchTabbar() {
- this.tabbar = tabbar
- if (this.vuex_theme.bgColor) {
- this.tabbar.activeColor = this.vuex_theme.bgColor
- }else{
- this.tabbar.activeColor = this.$config.themeRed.theme.bgColor
- }
- },
- async fetchSwiperList() {
- try {
- let {
- POINT_GOODS_SETTING
- } = (await this.$api.platform.getPlatformParams({
- keys: 'POINT_GOODS_SETTING'
- })).data.data;
- this.swiperList = JSON.parse(POINT_GOODS_SETTING).indexImageList
- } catch (e) {
- console.log(e);
- }
- },
- init() {
- this.avatar = this.$cache.get('userInfo').avatar
- this.fetchUserInfo()
- this.isWorksSkip = uni.getStorageSync('isWorksSkip');
- },
- fetchUserInfo() {
- if (!this.vuex_phone) {
- return
- }
- let params = {
- phone: this.vuex_phone
- }
- this.$api.loginUser.userHeatValueAndPufaPoint(params).then(res => {
- this.userData = res.data.data
- })
- },
- downCallback() {
- setTimeout(() => {
- this.fetchSwiperList()
- this.mescroll.resetUpScroll();
- }, 800)
- },
- upCallback(mescroll) {
- try {
- let params = {};
- if(this.isWorksSkip){
- params = {
- searchType: this.searchType,
- current: mescroll.num,
- size: mescroll.size,
- activeId: this.vuex_active_setting.defaultActiveId
- }
- }else{
- params = {
- searchType: this.searchType,
- current: mescroll.num,
- size: mescroll.size,
- }
- }
- this.$api.pointgoods.queryList(params).then(res => {
- let data = res.data.data.records
- let total = res.data.data.total
- mescroll.endBySize(data.length, total);
- if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
- this.list = this.list.concat(data); //追加新数据
- })
- } catch (e) {
- console.error(e);
- this.mescroll.endErr()
- }
- },
- handeExchangeTag(index) {
- this.currentIndex = index;
- this.mescroll.scrollTo(0, 300); //滚动列表到指定位置(y,t),y=0回到列表顶部,t时长,单位ms,默认300
- if(this.currentIndex == 0){
- this.searchType = 0
- }else if(this.currentIndex == 1){
- this.searchType = 1
- }else if(this.currentIndex == 2){
- if(this.$refs.filterBar.sort != 'asc'){
- this.searchType = 3
- }else{
- this.searchType = 2
- }
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .rule {
- background-color: rgba(0,0,0,0.26);
- color: #FFFFFF;
- padding: 20rpx 40rpx 20rpx 30rpx;
- }
- .bg-card {
- // position: relative;
- width: 100vw;
- height: 260rpx;
- background-color: var(--bgColor);
- border-radius: 0 0 10% 10%;
- .info {
- display: flex;
- padding: 30rpx 0rpx 0rpx 40rpx;
- .data {
- color: #FFFFFF;
- margin-left: 10rpx;
- }
- }
- }
- .swiper {
- margin-top: -120rpx;
- padding: 0 20rpx;
- }
- /* 为你推荐 */
- .recommend-info {
- width: 100%;
- border-radius: 20rpx;
- .recommend-title {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- height: 100rpx;
- .title {
- display: flex;
- align-items: center;
- image {
- width: 416rpx;
- height: 40rpx;
- }
- }
- }
- .goods-list {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- padding: 0 20rpx;
- .list {
- width: 49%;
- height: 550rpx;
- margin-bottom: 20rpx;
- background-color: #FFFFFF;
- border-radius: 12rpx;
- overflow: hidden;
- .pictrue {
- display: flex;
- justify-content: center;
- width: 100%;
- image {
- width: 100%;
- height: 340rpx;
- }
- }
- .title-tag {
- // display: flex;
- height: 70rpx;
- padding: 20rpx;
- }
- .price-info {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- justify-content: center;
- padding: 0 20rpx;
- height: 50rpx;
- .user-price {
- display: flex;
- justify-content: center;
- align-items: center;
- text {
- color: #e72226;
- }
- .min {
- font-size: 24rpx;
- }
- .max {
- font-size: 32rpx;
- }
- }
- .vip-price {
- padding-left: 20rpx;
- display: flex;
- align-items: center;
- image {
- width: 26rpx;
- height: 26rpx;
- margin-right: 10rpx;
- }
- text {
- text-decoration: line-through;
- color: #8c8c8c;
- font-size: 24rpx;
- }
- }
- }
- .bottom {
- margin: 10rpx 0;
- display: flex;
- justify-content: center;
- align-items: flex-end;
- }
- }
- }
- }
- </style>
|