| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744 |
- <template>
- <view class="content">
- <view class="cont-box">
- <u-sticky offsetTop="0" customNavHeight="0">
- <image class="home_top_bg" src="@/static/images/integral/coin_points_mall_top_bg_blue.png"
- mode="widthFix"></image>
- <view class="top-box" :style="{ paddingTop: paddingTop + 'px' }">
- <view class="top-title">
- <image class="title-img" src="/static/images/integral/fanghua_coin_mall_title.png"></image>
- </view>
- <!-- <view class="my-integral">
- <view class="left">
- <view class="x-ac">
- <view class="label">我的健康币</view>
- <view class="x-ac" style="margin-left: 20rpx;" @click="goCart()">
- <u-icon name="shopping-cart" color="#fff" size="28"></u-icon>
- <view class="label">购物车</view>
- </view>
-
- </view>
- <view style="display: flex;align-items: baseline;">
- <view class="integral">{{integral}}</view>
- <view class="integralbtn" @click="goIntegral">获取健康币</view>
- </view>
- </view>
- <view class="btn-box">
- <view class="btn" @click="navTo('/pages/user/integral/integralLogsList')">获得记录</view>
- <view class="btn" @click="navTo('/pages/user/integral/integralOrderList')">健康币订单</view>
- </view>
- </view> -->
- <view class="inner-box">
- <view class="topbox">
- <view class="left">
- <view class="align-center">
- <image class="points-icon" src="@/static/images/integral/my_points_icon.png"
- mode=""></image>
- <text class="points-title">我的健康币</text>
- </view>
- <view class="num">{{ integral }}</view>
- </view>
- <view class="guize" @click="goIntegral">获取健康币</view>
- </view>
- <view class="bottom-box">
- <view class="ttbg"></view>
- <view class="x-bc" style="height: 100rpx;">
- <view class="t-left" @click="navTo('/pages/user/integral/integralLogsList')">
- <image src="@/static/images/integral/points_details_icon_blue.png" mode=""></image>
- <view>获得记录</view>
- </view>
- <view class="t-right" @click="navTo('/pages/user/integral/integralOrderList')">
- <image src="@/static/images/integral/exchange_records_icon_blue.png" mode="">
- </image>
- <view>健康币订单</view>
- </view>
- </view>
- </view>
- </view>
- <!-- 搜索 -->
- <view class="search-box">
- <uni-search-bar class="search" bgColor="#FFFFFF" radius="34" v-model="keyword"
- placeholder="搜索商品" clearButton="auto" cancelButton="none" @confirm="search"
- @clear="handleClear">
- <template v-slot:searchIcon>
- <image src="@/static/image/hall/search_gray_icon.png" mode="aspectFill"></image>
- </template>
- </uni-search-bar>
- </view>
- <view class="tabs" v-if="tabs.length > 0">
- <u-tabs :current="tabIndex" :scrollable="true" :list="tabs" :lineWidth="40" :lineHeight="8"
- :lineColor="'linear-gradient(64deg, #5DADFF 0%, #FF5030100%)'"
- :activeStyle="{ fontSize: '32rpx', fontWeight: 'bold', color: '#222222' }"
- @change="tabChange">
- </u-tabs>
- </view>
- </view>
- </u-sticky>
- <mescroll-body bottom="0" :top="top2 + 'px'" ref="mescrollRef" @init="mescrollInit" @down="downCallback"
- @up="upCallback" :down="downOption" :up="upOption">
- <view class="integral-box">
- <view class="item" @click="navTo('/pages/user/integral/integralGoodsDetails?goodsId=' + item.goodsId)"
- v-for="(item, index) in dataList">
- <view class="top">
- <image :src="item.imgUrl"></image>
- </view>
- <view class="bottom">
- <view class="title ellipsis">
- {{ item.goodsName }}
- </view>
- <view class="price-box">
- <view class="count">标准价¥{{ item.otPrice.toFixed(2) }}</view>
- <view class="price">
- <image src="@/static/images/integral/my_points_icon.png" class="icon"></image><text
- class="bold">{{ item.integral }}</text>健康币
- </view>
- </view>
- <view class="exchange">兑换</view>
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- <view class="slide-cart" @click="goCart()">
- <view class="cart-box">
- <view class="badge-box">
- <u-badge type="error" max="99" :value="cartNum" bgColor="#FF5030"></u-badge>
- </view>
- <image class="shop-cart" src="@/static/images/integral/orange_shopping_car_icon.png"></image>
- </view>
- <text>购物车</text>
- </view>
- </view>
- </template>
- <script>
- import {
- getDictByKey
- } from '@/api/common.js'
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- import {
- getIntegralGoodsList,
- getFsIntegralCartList
- } from '@/api/integral.js'
- import {
- getUserInfo
- } from '@/api/user'
- export default {
- mixins: [MescrollMixin],
- data() {
- return {
- integral: 0,
- type: null,
- typeOptions: [],
- tabIndex: 0,
- tabs: [],
- mescroll: null,
- downOption: { //下拉刷新
- use: true,
- auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
- },
- upOption: {
- onScroll: false,
- use: true, // 是否启用上拉加载; 默认true
- page: {
- pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- size: 10 // 每页数据的数量,默认10
- },
- noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- textNoMore: "已经到底了",
- empty: {
- icon: 'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
- tip: '暂无数据'
- }
- },
- dataList: [],
- keyword: "",
- top2: uni.upx2px(432),
- paddingTop: uni.getSystemInfoSync().statusBarHeight + 12,
- cartNum: 0
- }
- },
- onLoad() {
- this.getDictByKey("sys_integral_goods_type");
- },
- onShow() {
- this.getUserInfo();
- this.getcartNum()
- },
- onReady() {
- this.getTop()
- },
- methods: {
- goCart() {
- uni.navigateTo({
- url: '/pages/user/integral/cart'
- })
- },
- getcartNum() {
- getFsIntegralCartList().then(res => {
- if (res.code == 200) {
- this.cartNum = res.data.total || 0
- }
- })
- },
- getTop() {
- const query = uni.createSelectorQuery().in(this);
- query
- .select(".top-box")
- .boundingClientRect((data) => {
- if (data) {
- this.top2 = data.height + uni.upx2px(88)
- }
- })
- .exec();
- },
- handleClear() {
- // 清除搜索关键词后刷新列表
- this.keyword = '';
- this.mescroll.resetUpScroll()
- },
- getUserInfo() {
- getUserInfo().then(
- res => {
- if (res.code == 200) {
- if (res.user != null) {
- this.integral = res.user.integral;
- this.mescroll.resetUpScroll()
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: "请求失败",
- });
- }
- },
- rej => { }
- );
- },
- navTo(url) {
- uni.navigateTo({
- url: url
- })
- },
- goCart() {
- if (this.$isLogin()) {
- uni.navigateTo({
- url: '/pages/user/integral/cart'
- })
- } else {
- uni.navigateTo({
- url: '/pages/auth/loginIndex'
- })
- }
- },
- goIntegral() {
- let pages = getCurrentPages();
- let url = pages[pages.length - 2];
- if (pages.length > 1 && url && url.route == 'pages/user/integral/points') {
- uni.navigateBack()
- } else {
- uni.navigateTo({
- url: '/pages/user/integral/points'
- })
- }
- },
- getDictByKey(key) {
- var data = {
- key: key
- }
- var that = this;
- getDictByKey(data).then(
- res => {
- if (res.code == 200) {
- this.typeOptions = res.data;
- this.typeOptions.forEach(function (item, index) {
- var data = {
- name: item.dictLabel
- };
- that.tabs.push(data);
- })
- this.tabs.unshift({
- name: '全部'
- })
- if (this.tabs.length > 0) {
- this.tabIndex = 0
- }
- }
- },
- err => { }
- );
- },
- tabChange(item) {
- this.type = item.index == 0 ? null : this.typeOptions[item.index - 1].dictValue;
- this.mescroll.resetUpScroll()
- },
- search() {
- this.mescroll.resetUpScroll()
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- /*下拉刷新的回调 */
- downCallback(mescroll) {
- mescroll.resetUpScroll()
- },
- upCallback(page) {
- //联网加载数据
- var that = this;
- var data = {
- pageNum: page.num,
- pageSize: page.size,
- keyword: this.keyword
- };
- if (this.type != null) {
- data.goodsType = this.type
- }
- getIntegralGoodsList(data).then(res => {
- if (res.code == 200) {
- //设置列表数据
- if (page.num == 1) {
- that.dataList = res.data.list;
- } else {
- that.dataList = that.dataList.concat(res.data.list);
- }
- that.mescroll.endBySize(res.data.list.length, res.data.total);
- } else {
- uni.showToast({
- icon: 'none',
- title: "请求失败",
- });
- that.dataList = null;
- that.mescroll.endErr();
- }
- });
- }
- }
- }
- </script>
- <style scoped lang="scss">
- page {
- height: 100%;
- background: #F5F7FA !important;
- }
- // .cartbox {
- // position: fixed;
- // bottom: 50rpx;
- // right: 20rpx;
- // z-index: 99;
- // background-color: #fff;
- // box-shadow: 0 2px 4px rgba(150, 150, 150, 0.6);
- // padding: 10rpx;
- // border-radius: 50%;
- // .box {
- // position: absolute;
- // top: -10rpx;
- // right: 0;
- // z-index: 99;
- // }
- // }
- .content {
- height: 100%;
- .slide-cart {
- position: fixed;
- right: 0;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- top: 70%;
- width: 136rpx;
- height: 136rpx;
- background: #FFFFFF;
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- border: 1rpx solid #EEEEEE;
- font-weight: 500;
- font-size: 24rpx;
- color: #222222;
- .cart-box {
- position: relative;
- }
- .badge-box {
- position: absolute;
- top: -10rpx;
- right: 0rpx;
- z-index: 99;
- }
- .shop-cart {
- width: 56rpx;
- height: 56rpx;
- margin-bottom: 10rpx;
- }
- }
- .home_top_bg {
- width: 100%;
- height: auto;
- position: absolute;
- top: 0;
- left: 0;
- z-index: -1;
- }
- .cont-box {
- .top-title {
- text-align: center;
- }
- .top-box {
- box-sizing: border-box;
- padding: 30rpx 30rpx 0 30rpx;
- width: 100%;
- z-index: 998;
- //background-color: #f5f5f5;
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- .top-title {
- width: 100%;
- height: 88rpx;
- line-height: 88rpx;
- .title-img {
- width: 200rpx;
- height: 40rpx;
- }
- }
- .my-integral {
- height: 200rpx;
- box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.05);
- background: linear-gradient(#FF5030, #E2C99E);
- border-radius: 30rpx;
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- padding: 30rpx;
- box-sizing: border-box;
- .integralbtn {
- font-size: 30rpx;
- font-weight: bold;
- font-family: PingFang SC;
- color: #fff;
- margin-left: 16rpx;
- //text-decoration: underline;
- background-color: #F5533C;
- padding: 8rpx 15rpx;
- border-radius: 30rpx;
- }
- .btn {
- width: 100%;
- //margin-bottom: 30rpx;
- background-color: #fff;
- border-radius: 30rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 10rpx 15rpx;
- font-size: 24upx;
- font-family: PingFang SC;
- color: #FF5030;
- }
- .left {
- height: 100%;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: space-around;
- .label {
- font-size: 28upx;
- font-family: PingFang SC;
- color: #fff;
- }
- .integral {
- font-weight: bold;
- font-size: 40upx;
- font-family: PingFang SC;
- color: #fff;
- }
- }
- .btn-box {
- height: 100%;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: space-around;
- }
- }
- .tabs {
- height: 88rpx;
- background-color: #F5F7FA;
- //z-index: 999;
- .u-tabs__wrapper__nav__line {
- border-radius: 8rpx !important;
- opacity: 0.8 !important;
- bottom: 10rpx !important;
- }
- .u-tabs__wrapper__nav__item {
- padding: 0 16rpx;
- }
- .u-tabs__wrapper__nav__item__text {
- font-size: 28rpx;
- }
- }
- }
- .inner-box {
- z-index: 9;
- position: relative;
- // padding: 40upx 30upx;
- .topbox {
- padding: 30rpx;
- margin: 0 30rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- background: #FFFFFF;
- border-radius: 24rpx 24rpx 0rpx 0rpx;
- .left {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- text {
- margin-left: 12rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 26rpx;
- color: #626468;
- text-align: left;
- }
- .num {
- font-family: Roboto, Roboto;
- font-weight: 500;
- font-size: 64rpx;
- color: #222426;
- text-align: left;
- }
- .points-icon {
- width: 40rpx;
- height: 40rpx;
- }
- .points-title {
- font-size: 32rpx;
- color: #222222;
- }
- }
- .guize {
- width: 220rpx;
- height: 72rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- background: linear-gradient(280deg, #FD7600 0%, #FD4015 100%);
- border-radius: 36rpx 36rpx 36rpx 36rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 28rpx;
- color: #FFFFFF;
- }
- }
- .bottom-box {
- font-size: 28rpx;
- color: #222222;
- background: #DFEEFC;
- border-radius: 24rpx 24rpx 24rpx 24rpx;
- height: 150rpx;
- z-index: -1;
- position: relative;
- margin-top: -50rpx;
- .ttbg {
- width: 100%;
- height: 50rpx;
- background: #0372FD;
- border-radius: 24rpx 24rpx 24rpx 24rpx;
- }
- .t-left {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #222222;
- border-right: 2rpx solid rgba(0, 112, 253, 0.2);
- image {
- width: 40rpx;
- height: 40rpx;
- margin-right: 12rpx;
- }
- }
- .t-right {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #222222;
- image {
- width: 32rpx;
- height: 32rpx;
- margin-right: 12rpx;
- }
- }
- }
- }
- .integral-box {
- padding: 0 30rpx 30rpx 30rpx;
- display: flex;
- align-items: flex-start;
- justify-content: flex-start;
- flex-wrap: wrap;
- .item {
- box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.05);
- background-color: #fff;
- width: calc(50% - 20rpx);
- border-radius: 15rpx;
- margin: 10rpx;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- &:last-child {}
- .top {
- width: 100%;
- height: 300rpx;
- image {
- border-radius: 15rpx 15rpx 0rpx 0rpx;
- width: 100%;
- height: 300rpx;
- }
- }
- .bottom {
- width: 100%;
- padding: 15rpx;
- .title {
- font-weight: 500;
- font-size: 32rpx;
- color: #222222;
- }
- .price-box {
- display: flex;
- flex-direction: column;
- width: 100%;
- font-size: 24rpx;
- .price {
- display: flex;
- align-items: center;
- border-radius: 30rpx;
- color: #FF5030;
- margin: 18rpx 0;
- .icon {
- width: 32rpx;
- height: 32rpx;
- margin-right: 8rpx;
- }
- .bold {
- font-family: Roboto, Roboto;
- font-weight: 600;
- font-size: 32rpx;
- margin-right: 4rpx;
- }
- }
- .count {
- margin-top: 18rpx;
- color: #999999;
- }
- }
- .exchange {
- text-align: center;
- width: 100%;
- padding: 8rpx 0;
- font-weight: 500;
- font-size: 28rpx;
- color: #FFFFFF;
- box-sizing: border-box;
- background: linear-gradient(280deg, #FD7600 0%, #FD4015 100%);
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- }
- }
- }
- }
- }
- }
- .search-box {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-top: 22rpx;
- font-size: 28rpx;
- .search {
- padding: 0;
- flex: 1;
- image {
- width: 28rpx;
- height: 28rpx;
- padding-left: 16rpx;
- }
- }
- }
- </style>
|