| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523 |
- <template>
- <view class="container">
- <view class="member"></view>
- <view class="content">
- <view class="member_card">
- <view class="info">开通美卡平均可省</view>
- <view class="text">
- 1588
- <text>元/年</text>
- </view>
- </view>
- <view class="assets">
- <view class="title">
- <image class="" src="/static/img/img33.png"></image>
- <view class="name">美卡特权</view>
- </view>
- <view class="privileges flex">
- <view class="privileges_list" v-for="(ls, index) in list" @click="clickNav(index)">
- <view class="img"><image :src="ls.img"></image></view>
- <view class="text">{{ ls.text }}</view>
- </view>
- </view>
- </view>
- <view class="discount flex" id="block1">
- <view class="tpl">
- <view class="name">美卡专享价</view>
- <view class="text">800+超值低价商品等你来拿</view>
- </view>
- <view class="tip">
- <view class="money">¥172</view>
- <view class="money">平均可省</view>
- </view>
- </view>
- <view class="goods" id="block3">
- <view class="list flex_item" v-for="ls in goods" @click="ToDetail(ls)">
- <view class="list-img"><image :src="ls.image"></image></view>
- <view class="list-info">
- <view class="name clamp">{{ ls.store_name }}</view>
- <view class="describe clamp">{{ ls.store_info }}</view>
- <view class="text" v-if="ls.keyword != ''">
- <text v-for="lss in ls.keyword">{{ lss }}</text>
- </view>
- <view class="price-box flex">
- <view class="price">
- <view class="grey">¥{{ ls.price }}</view>
- <view class="red">
- ¥{{ ls.ot_price }}
- <text>市场价</text>
- </view>
- </view>
- <view class="gocar position-relative" @click.stop="Addcar(ls)">
- <image src="/static/img/img21.png"></image>
- <view class="corner" v-if="ls.cart_num > 0">
- <text>{{ ls.cart_num }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="submit" id="block2">查看800+美卡专享价商品</view>
- <view class="discount flex">
- <view class="tpl">
- <view class="name">免配送券</view>
- <view class="text">每次抵扣4元,价值30元/月</view>
- </view>
- <view class="tip">
- <view class="money">¥172</view>
- <view class="money">平均可省</view>
- </view>
- </view>
- <view class="bound">
- <view class="text">
- 开通美卡美卡享受免配送费
- <text>4次/月</text>
- </view>
- <view class="tpl"><text>配送权仅可当月使用</text></view>
- </view>
- <view class="Tips">
- <uni-icons type="info-filled" color="#999999" size="18" />
- <text>下单自动抵扣,无需领取</text>
- </view>
- <view class="discount flex">
- <view class="tpl">
- <view class="name">美卡专享卡包</view>
- <view class="text">同样的产品,你买就是低价</view>
- </view>
- <view class="tip">
- <view class="money">¥164</view>
- <view class="money">平均可省</view>
- </view>
- </view>
- <view class="bound">
- <view class="text">
- 开通美卡购物领折扣更
- <text>实惠</text>
- </view>
- <view class="tpl"><text>美卡卡购物更实惠</text></view>
- </view>
- <view class="opening flex">
- <view class="more">充值美卡享更多优惠</view>
- <view class="confirm" @click="navTo('/pages/user/member')">立即开通</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { userinfo } from '@/api/user.js';
- import { getProducts } from '@/api/product.js';
- import { cartAdd } from '@/api/product.js';
- export default {
- data() {
- return {
- userInfo: '',
- list: [
- {
- img: 'https://shicaitest.liuniu946.com/img/img51.png',
- text: '美卡专享价'
- },
- {
- img: 'https://shicaitest.liuniu946.com/img/img52.png',
- text: '美卡优惠卡包'
- },
- {
- img: 'https://shicaitest.liuniu946.com/img/img53.png',
- text: '免配送券'
- },
- {
- img: 'https://shicaitest.liuniu946.com/img/img54.png',
- text: '更多'
- }
- ],
- goods: '',
- block_1ScrollTop: '',
- block_2ScrollTop: '',
- pageHeight:''
- };
- },
- onLoad() {},
- onShow() {
- this.loadDate();
- },
- mounted() {
- var query = uni.createSelectorQuery();
- //获取对应模块到顶部的距离
- query
- .select('#block1')
- .boundingClientRect(res => {
- this.block_1ScrollTop = res.top;
- })
- .exec();
- query
- .select('#block2')
- .boundingClientRect(res => {
- this.block_2ScrollTop = res.top;
- })
- .exec();
- },
- onReady() {
- // 初始化获取页面宽度
- uni.createSelectorQuery()
- .select('.content')
- .fields(
- {
- size: true
- },
- data => {
- // 获取页面百分比
- this.pageHeight = data.height * (data.width / 750);
- }
- )
- .exec();
- },
- methods: {
- clickNav(index) {
- if (index == 0) {
- uni.pageScrollTo({
- scrollTop: this.block_1ScrollTop
- });
- };
- if(index == 1){
- uni.pageScrollTo({
- scrollTop: this.block_2ScrollTop + this.pageHeight + 1000
- });
- };
- if(index == 2){
- uni.pageScrollTo({
- scrollTop: this.block_2ScrollTop + this.pageHeight + 1000
- });
- };
- },
- loadDate() {
- let obj = this;
- getProducts({
- page: 1,
- limit: 5,
- type: 1,
- news: '',
- keyword: ''
- }).then(e => {
- obj.goods = e.data;
- });
- },
- //加入购物车
- Addcar(item) {
- let obj = this;
- cartAdd({
- cartNum: '1', //商品数量
- uniqueId: '', //商品标签
- new: 0, //商品是否新增加到购物车1为不加入0为加入
- mer_id: '',
- productId: item.id //商品编号
- })
- .then(function(e) {
- let da = e.data;
- uni.showToast({
- title: '成功加入购物车',
- type: 'top',
- duration: 500,
- icon: 'none'
- });
- obj.loadDate();
- })
- .catch(e => {
- console.log(e);
- });
- },
- // 商品详情页
- ToDetail(item) {
- uni.navigateTo({
- url: `/pages/product/product?id=` + item.id
- });
- },
- navTo(url) {
- uni.navigateTo({
- url
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- height: 100%;
- background-color: $page-color-base;
- .container {
- height: 100%;
- }
- }
- .member {
- background: #1c2532;
- height: 250rpx;
- width: 100%;
- border-bottom-left-radius: 20%;
- border-bottom-right-radius: 20%;
- }
- .content {
- width: 100%;
- margin-top: -120rpx;
- .member_card {
- width: 90%;
- margin: 0rpx auto;
- height: 300rpx;
- padding: 45rpx 45rpx;
- background: #2dbd59;
- border: 2rpx solid #ffe487;
- border-radius: 25rpx;
- text-align: center;
- .info {
- color: #ffffff;
- font-size: 29rpx;
- padding-top: 50rpx;
- }
- .text {
- color: #feeda1;
- font-size: 65rpx;
- padding-top: 40rpx;
- text {
- font-size: 41rpx;
- }
- }
- }
- }
- .assets {
- background: #ffffff;
- width: 100%;
- margin-top: 25rpx;
- padding: 25rpx 0rpx;
- text-align: center;
- .title {
- width: 85%;
- height: 3rpx;
- margin: 0rpx auto;
- image {
- width: 100%;
- height: 100%;
- }
- .name {
- position: relative;
- bottom: 40rpx;
- font-weight: bold;
- }
- }
- .privileges {
- margin-top: 100rpx;
- font-size: 24rpx;
- margin-bottom: 40rpx;
- .privileges_list {
- text-align: center;
- width: 200rpx !important;
- .img {
- height: 80rpx;
- text-align: center;
- image {
- width: 80rpx;
- height: 100%;
- }
- }
- .text {
- padding-top: 15rpx;
- }
- }
- }
- }
- .discount {
- width: 100%;
- padding: 50rpx 25rpx;
- .tpl {
- .name {
- font-size: 36rpx;
- color: #333333;
- font-weight: bold;
- }
- .text {
- color: #999999;
- font-size: 24rpx;
- padding-top: 15rpx;
- }
- }
- .tip {
- text-align: right;
- background: #1c2532;
- border-radius: 40rpx;
- padding: 18rpx 24rpx;
- border-bottom-right-radius: 10rpx !important;
- .money {
- background: linear-gradient(270deg, rgba(204, 178, 121, 1) 0%, rgba(245, 234, 197, 1) 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- font-weight: bold;
- font-size: 26rpx;
- }
- }
- }
- .goods {
- padding: 0rpx 25rpx;
- width: 92%;
- margin: 0rpx auto;
- background: #ffffff;
- border-radius: 15rpx;
- margin-bottom: 50rpx;
- .list {
- border-bottom: 2rpx solid #f0f0f0;
- padding: 25rpx 0rpx;
- .list-img {
- width: 225rpx;
- height: 225rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .list-info {
- padding-left: 25rpx;
- width: 60%;
- .name {
- color: #333333;
- font-size: 30rpx;
- font-weight: 500;
- }
- .describe {
- color: #999999;
- font-size: 24rpx;
- margin: 15rpx 0rpx;
- padding-bottom: 15rpx;
- }
- .text {
- color: #ff383e;
- padding: 15rpx 0rpx;
- text {
- border-radius: 10rpx;
- border: 2rpx solid #ff383e;
- font-size: 20rpx;
- padding: 2rpx 15rpx;
- }
- }
- .price-box {
- .price {
- font-size: 26rpx;
- .grey {
- color: #666666;
- text-decoration: line-through;
- }
- .red {
- color: #2dbd59;
- text {
- margin-left: 15rpx;
- background: #2dbd59;
- color: #ffffff;
- border-radius: 10rpx;
- padding: 3rpx 15rpx;
- }
- }
- }
- .gocar {
- width: 50rpx;
- height: 50rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- }
- }
- }
- .submit {
- background: #ffe487;
- width: 92%;
- margin: 0rpx auto;
- padding: 25rpx 0rpx;
- text-align: center;
- margin-bottom: 20rpx;
- border-radius: 15rpx;
- font-weight: bold;
- color: rgba(51, 51, 51, 1);
- font-size: 30rpx;
- }
- .bound {
- width: 92%;
- margin: 0rpx auto;
- height: 100px;
- display: flex;
- flex-direction: column;
- align-items: center;
- position: relative; //设置定位
- background: linear-gradient(-21deg, rgba(0, 184, 72, 1) 0%, rgba(40, 218, 116, 1) 100%);
- border-radius: 20rpx;
- padding: 30rpx 20rpx;
- color: #ffffff;
- .text {
- font-size: 36rpx;
- text {
- color: #feeda1;
- font-size: 48rpx;
- }
- }
- .tpl {
- margin-top: 25rpx;
- text {
- background: #ffffff;
- padding: 14rpx 103rpx;
- border-radius: 20rpx;
- color: #333333;
- font-size: 32rpx;
- }
- }
- }
- .bound::before {
- content: '';
- width: 35px;
- height: 30px;
- border-radius: 50%;
- display: block;
- background: #f8f6f6;
- position: absolute;
- top: 50%;
- left: -20px;
- transform: translateY(-50%);
- }
- .bound::after {
- content: '';
- width: 35px;
- height: 30px;
- border-radius: 50%;
- display: block;
- background: #f8f6f6;
- position: absolute;
- top: 50%;
- right: -20px;
- transform: translateY(-50%);
- }
- .opening {
- width: 100%;
- font-size: 30rpx;
- padding-top: 90rpx;
- text-align: center;
- .more {
- background: #1e2531;
- color: #feeda1;
- width: 60%;
- padding: 30rpx 0rpx;
- }
- .confirm {
- background: #2dbd59;
- color: #ffffff;
- width: 40%;
- padding: 30rpx 0rpx;
- }
- }
- .Tips {
- width: 100%;
- padding-left: 25rpx;
- font-size: 24rpx;
- color: #999999;
- padding-top: 20rpx;
- text {
- padding-left: 10rpx;
- }
- }
- </style>
|