MrShi
29 分钟以前 742e2a6eb5d0c6c348ae779a8bc8eaa79c958b4f
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<template>
    <view class="cart">
        <u-swipe-action>
            <u-swipe-action-item :options="options" v-for="(item, index) in list" :name="index" :key="index">
                <view class="cart-item">
                    <view class="cart-item-check">
                        <image src="/static/icon/ic_agree@2x.png" mode="widthFix" v-if="!item.active"></image>
                        <image src="/static/icon/cart_ic_sel@2x.png" mode="widthFix" v-else></image>
                    </view>
                    <view class="cart-item-image">
                        <view class="cart-item-image-xj" v-if="item.status === 1">商品下架</view>
                        <image :src="item.imgUrl" mode="widthFix"></image>
                    </view>
                    <view class="cart-item-info">
                        <view class="title">{{item.goodsName}}</view>
                        <view class="bottom">
                            <view class="bottom-price">
                                <text>{{item.price[0]}}</text>
                                <text>.{{item.price[1]}}</text>
                            </view>
                            <u-number-box v-model="item.num"></u-number-box>
                        </view>
                    </view>
                </view>
            </u-swipe-action-item>
        </u-swipe-action>
        <view class="footer">
            <view class="edit">
                <view class="edit-left">
                    <image src="/static/icon/ic_agree@2x.png" mode="widthFix"></image>
                    <text>全选</text>
                </view>
                <view class="edit-right">
                    <view class="edit-right-label">合计:</view>
                    <view class="edit-right-price">
                        <text>499</text>
                        <text>.00</text>
                    </view>
                    <view class="edit-right-btn">结算</view>
                </view>
            </view>
            <view style="width: 100%; height: env(safe-area-inset-bottom);"></view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                value: 1,
                options: [
                    { text: '删除', style: { backgroundColor: '#E4001D' } },
                ],
                list: [],
                page: 1,
                next: true
            };
        },
        onLoad() {
            this.getList()
        },
        methods: {
            getList() {
                if (!this.next) return;
                this.$u.api.shopCartPage({
                    capacity: 10,
                    page: this.page,
                    model: {}
                }).then(res => {
                    if (res.code === 200) {
                        console.log(res)
                        res.data.records.forEach(item => {
                            item.price = item.price.toFixed(2).split('.')
                            item.active = false
                        })
                        this.list.push(...res.data.records)
                        this.page++
                        if (this.list.length === res.data.total) {
                            this.next = false
                        }
                    }
                })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .cart {
        width: 100%;
        padding: 30rpx 0;
        box-sizing: border-box;
        
        .footer {
            width: 100%;
            position: fixed;
            bottom: 0;
            left: 0;
            padding: 0 30rpx;
            box-sizing: border-box;
            box-shadow: 0rpx -2rpx 4rpx 0rpx rgba(0,0,0,0.06);
            background-color: #ffffff;
            height: calc(env(safe-area-inset-bottom) + 108rpx);
            .edit {
                width: 100%;
                height: 108rpx;
                display: flex;
                align-items: center;
                justify-content: space-between;
                .edit-left {
                    flex-shrink: 0;
                    display: flex;
                    align-items: center;
                    image {
                        width: 40rpx;
                        height: 40rpx;
                        margin-right: 20rpx;
                    }
                    text {
                        font-weight: 400;
                        font-size: 28rpx;
                        color: #222222;
                    }
                }
                .edit-right {
                    display: flex;
                    align-items: baseline;
                    .edit-right-label {
                        font-weight: 400;
                        font-size: 28rpx;
                        color: #333333;
                    }
                    .edit-right-price {
                        text {
                            &:nth-child(1) {
                                font-weight: 500;
                                font-size: 36rpx;
                                color: #E4001D;
                                &::before {
                                    content: '¥';
                                    font-weight: 500;
                                    font-size: 24rpx;
                                    color: #E4001D;
                                }
                            }
                            &:nth-child(2) {
                                font-weight: 500;
                                font-size: 24rpx;
                                color: #E4001D;
                            }
                        }
                    }
                    .edit-right-btn {
                        width: 200rpx;
                        height: 88rpx;
                        line-height: 88rpx;
                        text-align: center;
                        background: #004096;
                        border-radius: 44rpx;
                        font-weight: 500;
                        font-size: 30rpx;
                        color: #FFFFFF;
                        margin-left: 40rpx;
                    }
                }
            }
        }
 
        .cart-item {
            width: 100%;
            height: 160rpx;
            padding: 0 30rpx;
            box-sizing: border-box;
            display: flex;
            align-items: center;
            margin-bottom: 40rpx;
 
            .cart-item-check {
                flex-shrink: 0;
                width: 40rpx;
                height: 40rpx;
                margin-right: 30rpx;
 
                image {
                    width: 100%;
                }
            }
 
            .cart-item-image {
                flex-shrink: 0;
                width: 160rpx;
                height: 160rpx;
                border-radius: 8rpx;
                border: 1rpx solid #EEEEEE;
                margin-right: 24rpx;
                position: relative;
                
                .cart-item-image-xj {
                    width: 120rpx;
                    height: 40rpx;
                    line-height: 40rpx;
                    text-align: center;
                    position: absolute;
                    top: 50%;
                    left: 50%;
                    transform: translate(-50%, -50%);
                    background: rgba(0,0,0,0.5);
                    border-radius: 8rpx;
                    font-weight: 400;
                    font-size: 24rpx;
                    color: #FFFFFF;
                }
 
                image {
                    width: 100%;
                }
            }
 
            .cart-item-info {
                flex: 1;
                height: 100%;
                display: flex;
                flex-direction: column;
                justify-content: space-between;
 
                .title {
                    font-weight: 400;
                    font-size: 28rpx;
                    color: #111111;
                }
 
                .bottom {
                    width: 100%;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
 
                    .bottom-price {
                        display: flex;
                        align-items: center;
                        justify-content: space-between;
 
                        text {
                            &:nth-child(1) {
                                font-weight: 500;
                                font-size: 32rpx;
                                color: #E4001D;
 
                                &::before {
                                    content: '¥';
                                    font-weight: 500;
                                    font-size: 24rpx;
                                    color: #E4001D;
                                }
                            }
 
                            &:nth-child(2) {
                                font-weight: 500;
                                font-size: 24rpx;
                                color: #E4001D;
                            }
                        }
                    }
                }
            }
        }
    }
</style>