123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426 |
- <template>
- <view>
- <block v-if="!openState">
- <notOpen></notOpen>
- </block>
- <block v-else>
- <view class="nav_label" :style="{backgroundImage:'url('+ bgImg +')'}">
- <view class="back_icon1" @click="goBack">
- <image :src="img_url+'store/white_arrow_l.png'" mode=""></image>
- </view>
- <scroll-view scroll-x class="nav" v-if="labelList.length" >
- <view class="nav_item" @tap="changeNav(0)" :class="{on:curPresellLabelId == 0}">
- <text>{{$L('首页')}}</text>
- </view>
- <view v-for="(item, index) in labelList" :key="index"
- :class="'nav_item ' + (curPresellLabelId==item.presellLabelId?'on':'')"
- @tap="changeNav(item.presellLabelId)">
- <text>{{item.presellLabelName}}</text>
- </view>
- </scroll-view>
- </view>
- <view class="goods_list" v-if="goodsList.length">
- <navigator v-for="(item, index) in goodsList" :key="index" class="goods_item"
- :url="'/pages/product/detail?productId=' + item.productId + '&type=presale'" hover-class="none">
- <view class="item_left">
- <image :src="item.goodsImage" mode="" style="width:294rpx;height:294rpx;"></image>
- </view>
- <view class="item_right">
- <text class="goods_name">{{item.goodsName}}</text>
- <view class="goods_info">
- <view class="goods_price">
- <view class="now_price">
- <text class="small_price">¥</text>
- <text class="big_price">{{filters.toSplit(filters.toFix(item.presellPrice))[0]}}.</text>
- <text
- class="small_price">{{filters.toSplit(filters.toFix(item.presellPrice))[1]}}</text>
- </view>
- <view class="old_price">¥{{item.productPrice}}</view>
- </view>
- </view>
- <view class="presale_btn_wrap">
- <view class="presale_num_wrap">
- <image :src="iconImg" mode="" class="iconImg"></image>
- <text>{{$L('已预定')}}{{item.saleNum}}人</text>
- </view>
- <view class="goods_btn">{{$L('立即预定')}}</view>
- </view>
- </view>
- </navigator>
- </view>
- <loadingState v-if="loadingState == 'first_loading'||goodsList.length > 0" :state='loadingState' />
- <view class="empty" v-if="!goodsList.length && loading">
- <image :src="img_url+'preSale/empty.png'"></image>
- <text>{{$L('暂无商品')}}</text>
- </view>
- <view class="top_wrap" v-show="isShowTopBtn == true">
- <image :src="topImg" mode="" @click="top"></image>
- </view>
- <common title="预售" :gids="gids" v-if="gids.length"></common>
- </block>
- </view>
- </template>
- <script module="filters" lang="wxs" src="../../../utils/filter.wxs"></script>
- <script>
- import loadingState from "@/components/loading-state.vue";
- import notOpen from '@/components/not_open.vue'
- const app = getApp();
- export default {
- data() {
- return {
- list: [],
- active: '0',
- autoplay: true,
- interval: 5000,
- duration: 1000,
- indicatorDots: true,
- img_url: app.globalData.imgUrl,
- loading: false,
- home_info: "",
- pn: 1,
- hasmore: true,
- isShowTopBtn: false,
- bgImg: getApp().globalData.imgUrl + 'preSale/presale_bg.png',
- iconImg: getApp().globalData.imgUrl + 'preSale/icon4.png',
- topImg: getApp().globalData.imgUrl + 'preSale/top.png',
- gids: [],
- current: 1,
- pageSize: 10,
- labelList: [],
- goodsList: [],
- curPresellLabelId: 0, //当前选中的labelId
- loadingState: 'first_loading',
- openState: true
- };
- },
- components: {
- loadingState,
- notOpen
- },
- props: {},
- onLoad: function (options) {
- this.getPreSaleList();
- },
- onReachBottom() {
- if (this.hasmore) {
- this.getPreSaleList();
- }
- },
- methods: {
- //获取预售列表
- getPreSaleList() {
- let that = this;
- let param = {};
- param.url = '/v3/promotion/front/preSell/list';
- param.method = 'GET';
- param.data = {};
- param.data.current = that.current;
- param.data.pageSize = that.pageSize;
- param.data.labelId = that.curPresellLabelId;
- that.loadingState = that.loadingState == 'first_loading' ? that.loadingState : 'loading';
- that.$request(param).then(res => {
- if (res.state == 200) {
- this.loading = true
- this.openState = true
- let result = res.data;
- that.labelList = result.labelList;
- if (that.current == 1) {
- that.goodsList = result.goodsList;
- } else {
- that.goodsList = that.goodsList.concat(result.goodsList);
- }
- that.hasMore = that.$checkPaginationHasMore(res.data.pagination);
- if (that.hasMore) {
- that.current++;
- that.loadingState = 'allow_loading_more';
- } else {
- that.loadingState = 'no_more_data';
- }
- } else if (res.state == 259) {
- this.openState = false
- } else {
- that.$api.msg(res.msg);
- }
- }).catch((e) => {
- //异常处理
- })
- },
- bigPrice(val) {
- return val.split('.')[0]
- },
- smallPrice(val) {
- return val.split('.')[1]
- },
- changeNav(presellLabelId) {
- let that = this;
- that.curPresellLabelId = presellLabelId;
- that.current = 1;
- that.getPreSaleList();
- },
- // 获取滚动距离
- onPageScroll(e) { //根据距离顶部距离是否显示回到顶部按钮
- if (e.scrollTop > 600) { //当距离大于600时显示回到顶部按钮
- this.isShowTopBtn = true
- } else { //当距离小于600时隐藏回到顶部按钮
- this.isShowTopBtn = false
- }
- },
- // 回到顶部
- top() {
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 300
- })
- },
- goBack(){
- uni.navigateBack({
-
- })
- }
- }
- };
- </script>
- <style lang="scss">
- /* addons/pages/presaleIndex.wxss */
- page {
- background-color: #F5F5F5;
- padding-top: 82rpx;
- width: 750rpx;
- margin: 0 auto;
- }
- /* #ifdef H5 */
- page {
- padding-top: 0rpx;
- }
- /* #endif */
-
-
- .nav_label{
- display: flex;
- position: relative;
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- margin: 0 auto;
- width: 750rpx;
- height: 88rpx;
- z-index: 9999;
- }
-
-
- .nav {
- height: 88rpx;
- display: block;
- white-space: nowrap;
- overflow: hidden;
- z-index: 9999;
- right: 0;
- margin: 0 auto;
- }
-
- .back_icon1{
- display: flex;
- align-items: center;
- padding-left: 10rpx;
- image{
- width: 52rpx;
- height: 49rpx;
- }
- }
- .nav_item {
- display: inline-block;
- line-height: 86rpx;
- text-align: center;
- color: #fff;
- font-size: 30rpx;
- padding: 0 20rpx;
- }
- .nav_item.on {
- font-size: 30rpx;
- }
- .nav_item.on text {
- font-weight: bold;
- font-size: 32rpx;
- display: inline-block;
- padding: 0 10rpx;
- line-height: 50rpx;
- }
- .goods_list {
- padding: 0 20rpx;
- background-color: white;
- }
- .goods_list .goods_item {
- height: 334rpx;
- display: flex;
- align-items: center;
- border-bottom: 1rpx solid #F2F2F2;
- }
- .goods_list navigator:nth-last-child(1) {
- border-bottom: none;
- }
- .goods_item .item_left {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 294rpx;
- height: 294rpx;
- }
- .goods_item .item_left image {
- width: 294rpx;
- height: 294rpx;
- border-radius: 15rpx;
- }
- .goods_item .item_right {
- flex: 1;
- display: flex;
- min-height: 200rpx;
- flex-direction: column;
- margin-left: 20rpx;
- justify-content: space-between;
- height: 100%;
- padding-bottom: 20rpx;
- box-sizing: border-box;
- position: relative;
- }
- .goods_item .item_right .goods_name {
- margin-top: 43rpx;
- font-size: 28rpx;
- color: #2D2D2D;
- font-weight: 600;
- line-height: 40rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- word-break: break-all;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- }
- .item_right .goods_info {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .goods_info .goods_price {
- display: flex;
- align-items: flex-end;
- position: absolute;
- bottom: 100rpx;
- }
- .now_price {
- color: #FE006D;
- font-weight: bold;
- }
- .now_price .small_price {
- font-size: 24rpx;
- }
- .now_price .big_price {
- font-size: 34rpx;
- }
- .goods_price .old_price {
- color: #999;
- font-size: 24rpx;
- text-decoration: line-through;
- margin-left: 10rpx;
- padding-bottom: 4rpx;
- }
- .presale_btn_wrap {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 50rpx;
- color: #333;
- font-size: 24rpx;
- border-radius: 25rpx;
- position: absolute;
- bottom: 40rpx;
- left: 0;
- }
- .presale_num_wrap {
- display: flex;
- align-items: center;
- height: 46rpx;
- color: #333333;
- font-size: 25rpx;
- border-radius: 25rpx 0 0 25rpx;
- border: 1rpx solid #A92DC9;
- padding-right: 40rpx;
- padding-left: 20rpx;
- white-space: nowrap;
- }
- .presale_num_wrap .iconImg {
- width: 29rpx;
- height: 34rpx;
- margin-right: 10rpx;
- }
- .goods_btn {
- min-width: 140rpx;
- height: 50rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 0 25rpx 25rpx 25rpx;
- color: #fff;
- font-size: 26rpx;
- background: linear-gradient(90deg, #EC0093 0%, #FF085B 100%);
- margin-left: -30rpx;
- }
- .empty {
- display: flex;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- height: 70vh;
- }
- .empty image {
- width: 200rpx;
- height: 200rpx;
- margin-bottom: 30rpx;
- }
- .empty text {
- color: #333;
- font-size: 28rpx;
- }
- .top_wrap {
- position: fixed;
- right: 46rpx;
- bottom: 66rpx;
- width: 85rpx;
- height: 85rpx;
- }
- .top_wrap image {
- width: 85rpx;
- height: 85rpx;
- }
- </style>
|