123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508 |
- <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 class="nav-container" scroll-x>
- <view :class="'item ' + (tid==0?'on':'')" data-id="0" @tap="changeNav">{{$L("首页")}}</view>
- <view v-for="(item, index) in NavData" :key="index" :class="'item ' + (tid==item.spellLabelId?'on':'')" :data-id="item.spellLabelId"
- @tap="changeNav">{{item.spellLabelName}}</view>
- </scroll-view>
- </view>
-
- <view class="goods-list" v-if="goodsList.length" :style="'padding-bottom:'+bottomSateArea">
- <view v-for="(item, index) in goodsList" :key="index" class="item">
- <view class="goods-list-top">
- <view class="img">
- <image :src="item.goodsImage" mode="aspectFit"></image>
- </view>
-
- <view class="goods-info">
- <view class="info">
- <view class="goods_nameBox">
- <text class="goods_nameText">{{item.goodsName}}</text>
- </view>
- <!-- <view class="p">已参与{{item.incom_num}}人</view> -->
- <view class="goods_price_wrap">
- <view class="now_price">
- <text class="small_price">¥</text><text class="big_price">{{item.spellPrice.toFixed(2).toString().split('.')[0]}}.</text><text
- class="small_price">{{item.spellPrice.toFixed(2).toString().split('.')[1]}}</text>
- </view>
- <view class="old_price">¥{{item.productPrice}}</view>
- </view>
- <navigator :url="'/pages/product/detail?productId=' + item.productId + '&promotionId='+item.spellId" hover-class="none">
- <view class="group_num_wrap">
- <image :src="iconImg" mode="" class="iconImg"></image>
- <text>{{item.requiredNum}}{{$L("人团")}}</text>
- </view>
- <view class="go_to_group">{{$L("去拼团")}}</view>
- </navigator>
- </view>
- </view>
- </view>
-
- <view class="activity-info">
- <image :src="saveImg" mode="" class="save_img"></image>
- <text class="group_bottom_text">{{$L("拼团购买立省")}}{{item.spellDiscount}}<block v-if="item.leaderDiscount!=0">,{{$L("团长优惠")}}{{item.leaderDiscount}}{{$L("元")}}</block>;{{$L("单独购买价")}}{{item.productPrice}}</text>
- </view>
- </view>
- </view>
-
- <view class="empty" v-if="!goodsList.length && isLoading">
- <view class="img">
- <image :src="img_url+'index/empty.png'" mode="widthFix"></image>
- </view>
- <view class="tip">{{$L("暂无商品")}}</view>
- <text>{{$L("选择其他分类试试吧!")}}</text>
- </view>
-
- <view class="top_wrap" v-show="isShowTopBtn == true">
- <image :src="topImg" mode="" @click="top"></image>
- </view>
- </block>
- </view>
- </template>
- <script>
- import notOpen from '@/components/not_open.vue'
- export default {
- data() {
- return {
- key: '',
- tid: '',
- isLoading: false,
- NavData: "",
- goodsList: "",
- pn: 1,
- hasmore: true,
- img_url: getApp().globalData.imgUrl,
- bgImg: getApp().globalData.imgUrl + 'pinGroup/group_bg.png',
- iconImg: getApp().globalData.imgUrl + 'pinGroup/icon.png',
- saveImg: getApp().globalData.imgUrl + 'pinGroup/save.png',
- topImg: getApp().globalData.imgUrl + 'pinGroup/top.png',
- isShowTopBtn: false,
- bottomSateArea: 0, //iphone手机底部一条黑线的高度
- gids: [],
- openState:true
- };
- },
- components: {
- notOpen
- },
- props: {},
- onLoad: function(options) {
- this.initData();
- },
- onReachBottom() {
- if (this.hasmore) {
- this.getList();
- }
- },
- methods: {
- initData() {
- this.getNavData();
- this.getList();
- },
- getNavData() {
- let params ={
- url:'v3/promotion/front/spell/list',
- method:'GET'
- }
- this.$request(params).then(res=>{
- if(res.state==200){
- this.isLoading = true
- this.NavData = res.data.labelList
- }
- })
- },
- getList() {
- let params = {
- url:'v3/promotion/front/spell/list',
- method:"GET",
- data:{
- labelId:this.tid,
- current:this.pn
- }
- }
- this.$request(params).then(res=>{
- if(res.state == 200){
- this.openState = true
- if(this.pn==1){
- this.goodsList = res.data.goodsList
- }else{
- this.goodsList = this.goodsList.concat(res.data.goodsList)
- }
- this.loading = true
- this.hasmore = this.$checkPaginationHasMore(res.data.pagination)
- if(this.hasmore){
- this.pn++
- }
- }else if(res.state==259){
- this.openState = false
- }
- })
- },
- changeNav(e) {
- let newTid = e.currentTarget.dataset.id;
- let {
- tid
- } = this;
- if (newTid == tid) return;
- this.pn = 1;
- this.hasmore = true;
- this.tid = newTid
-
- this.getList();
- },
- // 获取滚动距离
- 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">
- /* integral/activity/pin_index/pin_index.wxss */
- page {
- background-color: #f5f5f5;
- padding-top: 90rpx;
- 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-container {
- white-space: nowrap;
- z-index: 999;
- background-size: 100% 100%;
- right: 0;
- margin: 0 auto;
- }
-
- .back_icon1{
- display: flex;
- align-items: center;
- padding-left: 10rpx;
- image{
- width: 52rpx;
- height: 49rpx;
- }
- }
- .nav-container .item {
- display: inline-block;
- color: #fff;
- font-size: 30rpx;
- margin: 0 30rpx;
- line-height: 40rpx;
- margin-top: 25rpx;
- }
- .nav-container .item.on {
- font-weight: bold;
- font-size: 32rpx;
- padding-bottom: 8rpx;
- box-sizing: border-box;
- }
- .goods-list {
- padding: 0 20rpx;
- }
- .goods-list .item {
- height: 382rpx;
- display: flex;
- flex-direction: column;
- border-radius: 15rpx;
- box-sizing: border-box;
- background-color: #fff;
- font-size: 24rpx;
- color: #999;
- margin-top: 20rpx;
- padding: 20rpx 20rpx 0 20rpx;
- }
- .goods-list-top .img {
- position: relative;
- width: 270rpx;
- height: 270rpx;
- margin-right: 20rpx;
- background-color: #f8f8f8;
- border-radius: 15rpx;
- }
- .img image {
- width: 270rpx;
- height: 270rpx;
- border-radius: 15rpx;
- }
- .img .activity-info {
- position: absolute;
- bottom: 30rpx;
- left: 30rpx;
- width: 120rpx;
- height: 80rpx;
- background-color: #EF1B21;
- border-radius: 4rpx;
- color: #fff;
- line-height: 30rpx;
- text-align: center;
- }
- .goods-list .item {
- display: flex;
- flex-direction: column;
- }
- .goods-list-top {
- display: flex;
- }
- .activity-info .t {
- display: block;
- margin: 6rpx;
- height: 36rpx;
- line-height: 36rpx;
- color: #EF1B21;
- background-color: #fff;
- }
- .goods-info {
- display: flex;
- flex-direction: column;
- position: relative;
- }
- .goods-info .info view {
- margin-bottom: 5rpx;
- }
- .goods-info .goods_price_wrap {
- display: flex;
- align-items: flex-end;
- margin-top: 30rpx;
- }
- .goods_price_wrap .now_price {
- /* display: flex; */
- font-size: 24rpx;
- font-weight: 600;
- color: #FC1C1C;
- font-weight: bold;
- }
- .now_price .big_price {
- font-size: 34rpx;
- }
- .goods-info .info .old_price {
- color: #9A9A9A;
- font-size: 20rpx;
- margin-left: 10rpx;
- text-decoration: line-through;
- padding-bottom: 4rpx;
- }
- .goods-info .info .p {
- font-size: 24rpx;
- color: #666;
- display: flex;
- align-items: center;
- }
- .goods-info .p .line {
- display: block;
- width: 1rpx;
- height: 20rpx;
- margin: 0 15rpx;
- background-color: #999;
- }
- .goods-info navigator {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 280rpx;
- height: 50rpx;
- color: #fff;
- font-size: 28rpx;
- border-radius: 38rpx;
- position: absolute;
- bottom: 0;
- left: 0;
- }
- .group_num_wrap {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 150rpx;
- height: 46rpx;
- color: #FC1C1C;
- font-size: 25rpx;
- border-radius: 25rpx 0 0 25rpx;
- border: 1rpx solid #FC1C1C;
- padding-right: 10px;
- }
- .goods-info .iconImg {
- width: 31rpx;
- height: 27rpx;
- margin-right: 10rpx;
- }
- .go_to_group {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 148rpx;
- height: 50rpx;
- font-size: 26rpx;
- color: #fff;
- background-color: #FC1C1C;
- border-radius: 0 25rpx 25rpx 25rpx;
- margin-left: -30rpx;
- }
- .empty {
- display: flex;
- width: 750rpx;
- height: calc(100vh - 100rpx);
- flex-direction: column;
- align-items: center;
- /* justify-content: center; */
- margin-top: 200rpx;
- }
- .empty .img {
- width: 210rpx;
- height: 210rpx;
- background-color: #DDD;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .empty .img image {
- width: 210rpx;
- height: 210rpx;
- }
- .empty .tip {
- color: #000;
- font-size: 30rpx;
- margin: 30rpx 0;
- }
- .empty text {
- font-size: 26rpx;
- color: #999;
- }
- .goods_nameBox {
- margin-top: 20rpx;
- }
- .goods_nameText {
- color: #2E2E2E;
- font-size: 29rpx;
- font-weight: 600;
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .activity-info {
- width: 100%;
- height: 70rpx;
- display: flex;
- align-items: center;
- font-size: 26rpx;
- color: #666;
- margin-top: 20rpx;
- border-top: 1rpx solid #F2F2F2;
- }
- .activity-info .save_img {
- width: 30rpx;
- height: 30rpx;
- margin-right: 20rpx;
- }
- .top_wrap {
- position: fixed;
- right: 46rpx;
- bottom: 66rpx;
- width: 85rpx;
- height: 85rpx;
- }
- .top_wrap image {
- width: 85rpx;
- height: 85rpx;
- }
- .group_bottom_text {
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- }
- </style>
|