移动系统liao
2024-05-09 5d6cb15ac86d9174393cb9d1538d69b567e2c26c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<template>
    <view>
        <u-navbar title="拼团" safeAreaInsetTop fixed placeholder>
            <view class="coreshop-navbar-left-slot" slot="left">
                <u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
                <u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
                <u-icon name="home" size="22" @click="goHome"></u-icon>
            </view>
            <view slot="right">
            </view>
        </u-navbar>
        <view class="content">
            <!-- 列表图片 -->
            <scroll-view class="scroll-box" scroll-y>
                <view class="group-wrap coreshop-bg-red">
                    <view class="group-head coreshop-flex coreshop-justify-between">
                        <text class="group-head__title">爆款推荐</text>
                        <text class="group-head__notice">省钱省心限时拼</text>
                    </view>
                    <view class="group-box" v-if="list.length>0">
                        <view class="goods-item" v-for="(item, index) in list" :key="item.id">
                            <view class="coreshop-flex coreshop-justify-start coreshop-padding-left-10 coreshop-padding-top-10  coreshop-padding-bottom-10">
                                <view>
                                    <view class="tag" v-if="index < 3">TOP{{ index + 1 }}</view>
                                    <u--image :src="item.goodThumbnail" mode="widthFix" width="100px" height="100px" radius="10"></u--image>
                                </view>
                                <view class="goods-right coreshop-flex coreshop-flex-direction  coreshop-padding-left-10 coreshop-padding-right-10 coreshop-percent-100">
                                    <view class="title u-line-2 coreshop-text-black">{{ item.name }}</view>
                                    <view class="tip u-line-2 coreshop-text-grey">{{ item.goodName }}</view>
                                    <view class="coreshop-flex coreshop-align-center coreshop-padding-top-10  coreshop-padding-bottom-10">
                                        <view class="coreshop-font-11 coreshop-bg-green coreshop-padding-2 coreshop-border-radius-4 coreshop-margin-right-10">已拼{{item.buyPinTuanCount}}单</view>
                                        <view class="coreshop-font-11 coreshop-bg-orange coreshop-padding-2 coreshop-border-radius-4 coreshop-margin-right-10">已售{{item.pinTuanRecordNums}}{{item.goodUnit}}</view>
                                        <view class="coreshop-font-11 coreshop-bg-olive coreshop-padding-2 coreshop-border-radius-4">{{item.peopleNumber}}人团</view>
                                    </view>
                                    <view class="coreshop-flex coreshop-justify-between  coreshop-flex-direction-row coreshop-align-center">
                                        <view class="coreshop-flex coreshop-align-center">
                                            <view class="current">¥{{ item.pinTuanPrice  }}</view>
                                            <view class="original">¥{{ item.mktPrice }}</view>
                                        </view>
                                        <view class="coreshop-buy-btn" @tap="goPinTuanDetail(item.id)">马上拼</view>
                                    </view>
                                </view>
                            </view>
                        </view>
                        <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" margin-top="20" margin-bottom="20" />
                    </view>
                    <!-- 无数据时默认显示 -->
                    <view class="coreshop-emptybox" v-else>
                        <u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/history.png'" icon-size="150" text="暂无提现明细" mode="list"></u-empty>
                    </view>
                </view>
                <!-- 空白 -->
            </scroll-view>
        </view>
        <!-- 登录提示 -->
        <coreshop-login-modal></coreshop-login-modal>
    </view>
</template>
 
<script>
    var _this;
    export default {
        data() {
            return {
                page: 1,
                limit: 10,
                list: [],
                status: 'loadmore',
                iconType: 'flower',
                loadText: {
                    loadmore: '轻轻上拉',
                    loading: '努力加载中',
                    nomore: '实在没有了'
                }
            };
        },
        onLoad() {
            this.getPinTuanlist()
        },
        onShow() {
        },
        onReachBottom() {
            if (this.status === 'loadmore') {
                this.getPinTuanlist()
            }
        },
        methods: {
            getPinTuanlist() {
                let _this = this;
                let data = {
                    page: this.page,
                    limit: this.limit
                }
                this.status = 'loading'
                this.$u.api.pinTuanList(data).then(res => {
                    if (res.status) {
                        if (res.data) {
                            let _list = res.data
                            this.list = [...this.list, ..._list]
                        }
                        if (res.code >= _this.list.length) {
                            _this.page++
                            _this.status = 'loadmore'
                        } else {
                            _this.status = 'nomore'
                        }
                    } else {
                        _this.$u.toast(res.msg)
                    }
                })
            },
            //取得列表数据
            getGoods: function () {
                uni.showLoading({
                    title: '加载中',
                    mask: true
                });
                var _this = this;
                _this.$u.api.pinTuanList().then(res => {
                    if (res.status) {
                        _this.goodsList = res.data;
                        if (_this.goodsList) {
                            _this.goodsList.forEach(item => {
                                if (item.pinTuanPrice <= 0) {
                                    item.pinTuanPrice = '0.00';
                                } else {
                                    item.pinTuanPrice = parseFloat(item.price - item.pinTuanRule.discountAmount).toFixed(2);
                                }
                            });
                        }
                        uni.hideLoading();
                    } else {
                        uni.hideLoading();
                    }
                });
            }
        }
    };
</script>
 
<style lang="scss">
    @import "list.scss";
</style>