移动系统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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<template>
    <view>
        <u-toast ref="uToast" /><u-no-network></u-no-network>
        <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">
            <view v-if="list.length>0">
                <view class="orderList" v-for="(item, index) in list" :key="index">
                    <view class="item coreshop-solid-bottom coreshop-margin-top-5 coreshop-margin-padding-10 coreshop-padding-bottom-5">
                        <view class="left">
                            <u--image :showLoading="true" :src="item.thumbnail" width="140px" height="140px"></u--image>
                        </view>
                        <view class="content">
                            <view class="title u-line-2">{{item.title}}</view>
                            <view class="type u-line-3">{{item.description}}</view>
                            <view class="coreshop-text-price coreshop-text-red coreshop-margin-bottom-5">{{ item.money }}</view>
                            <view class="delivery-time">最大购买限制:{{item.maxBuyNumber== 0 ? '不限' : item.maxBuyNumber}}</view>
                        </view>
                    </view>
                    <view class="coreshop-text-gray coreshop-font-xs coreshop-flex coreshop-flex-nowrap coreshop-padding-10 coreshop-solid-bottom">
                        兑换级别:
                        <view class="coreshop-text-gray coreshop-font-xs coreshop-flex coreshop-flex-nowrap" v-if="item.allowedMemberships && item.allowedMemberships.length>0">
                            <view class="coreshop-width-fit-content coreshop-margin-right-5" v-for="(ship, indexChild) in item.allowedMemberships" :key="indexChild">
                                <u-tag :text="ship" :plain="true" mode="light" size="mini" />
                            </view>
                        </view>
                    </view>
                    <view class="coreshop-text-gray coreshop-font-xs coreshop-flex coreshop-flex-nowrap coreshop-padding-10 coreshop-solid-bottom">
                        兑换门店:
                        <view class="coreshop-text-gray coreshop-font-xs coreshop-flex coreshop-flex-nowrap" v-if="item.consumableStores && item.consumableStores.length>0">
                            <view class="coreshop-bg-orange-light sm  coreshop-padding-4 coreshop-margin-right-5" v-for="(store, indexChild) in item.consumableStores" :key="indexChild">{{store}}</view>
                        </view>
                    </view>
                    <view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-padding-10">
                        <view class="coreshop-text-right coreshop-time-right" v-if="item.openStatus == 1 && item.timestamp > 0">
                            <u-count-down :time="item.timestamp * 1000" :autoStart="true" :millisecond="true" format="DD天HH时mm分ss秒" @change="onChange($event,index)">
                                <view class="time coreshop-font-11 coreshop-text-gray">
                                    <view class="">仅剩时间:</view>
                                    <view class="time__custom">
                                        <text class="time__custom__item">{{ item.timeData.days }}</text>
                                    </view>
                                    <text class="time__doc">天</text>
                                    <view class="time__custom">
                                        <text class="time__custom__item">{{ item.timeData.hours>=10?item.timeData.hours:'0'+item.timeData.hours}}</text>
                                    </view>
                                    <text class="time__doc">:</text>
                                    <view class="time__custom">
                                        <text class="time__custom__item">{{ item.timeData.minutes }}</text>
                                    </view>
                                    <text class="time__doc">:</text>
                                    <view class="time__custom">
                                        <text class="time__custom__item">{{ item.timeData.seconds }}</text>
                                    </view>
                                </view>
                            </u-count-down>
                        </view>
                        <view class="coreshop-text-right coreshop-time-right" v-if="item.openStatus == 2 && item.timestamp > 0">
                            <u-count-down :time="item.timestamp * 1000" :autoStart="true" :millisecond="true" format="DD天HH时mm分ss秒" @change="onChange($event,index)">
                                <view class="time coreshop-font-11 coreshop-text-gray">
                                    <view class="">距离开始:</view>
                                    <view class="time__custom">
                                        <text class="time__custom__item">{{ item.timeData.days }}</text>
                                    </view>
                                    <text class="time__doc">天</text>
                                    <view class="time__custom">
                                        <text class="time__custom__item">{{ item.timeData.hours>=10?item.timeData.hours:'0'+item.timeData.hours}}</text>
                                    </view>
                                    <text class="time__doc">:</text>
                                    <view class="time__custom">
                                        <text class="time__custom__item">{{ item.timeData.minutes }}</text>
                                    </view>
                                    <text class="time__doc">:</text>
                                    <view class="time__custom">
                                        <text class="time__custom__item">{{ item.timeData.seconds }}</text>
                                    </view>
                                </view>
                            </u-count-down>
                        </view>
                        <view class="coreshop-text-right coreshop-time-right" v-if="item.openStatus == 3">
                            <view class="time coreshop-font-11 coreshop-text-gray">
                                <view class="">活动已结束</view>
                            </view>
                        </view>
                        <view v-if="item.openStatus == 3">
                            <u-button shape="square" size="small" :plain="true">活动已结束</u-button>
                        </view>
                        <view v-if="item.openStatus != 3">
                            <u-button type="warning" shape="square" size="small" @click="goServicesDetail(item.id)">立刻抢购</u-button>
                        </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>
        <!-- 登录提示 -->
        <coreshop-login-modal></coreshop-login-modal>
    </view>
 
</template>
 
<script>
 
    export default {
 
        data() {
            return {
                page: 1,
                limit: 10,
                list: [],
                status: 'loadmore',
                iconType: 'flower',
                loadText: {
                    loadmore: '轻轻上拉',
                    loading: '努力加载中',
                    nomore: '实在没有了'
                }
            };
        },
        onLoad() {
            this.getServicelist()
        },
        onShow() {
        },
        onReachBottom() {
            if (this.status === 'loadmore') {
                this.getServicelist()
            }
        },
        methods: {
            getServicelist() {
                let _this = this;
                let data = {
                    page: this.page,
                    limit: this.limit
                }
                this.status = 'loading'
                this.$u.api.getServicelist(data).then(res => {
                    if (res.status) {
                        let _list = res.data.list
                        this.list = [...this.list, ..._list]
                        if (res.data.count > _this.list.length) {
                            _this.page++
                            _this.status = 'loadmore'
                        } else {
                            _this.status = 'nomore'
                        }
                    } else {
                        _this.$u.toast(res.msg)
                    }
                })
            },
            onChange(e, key) {
                this.$set(this.list[key], 'timeData', e)
            },
        }
    };
</script>
 
<style lang="scss">
    .orderList {
        .title { font-size: 18px; font-weight: bolder; }
    }
</style>