• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { Cart } from '../shoppingCart/Cart';
17import { FavorGoodList } from '../shoppingCart/FavorGoodlist';
18import { ProductDataModel } from '../../model/GoodsModel';
19import { Url } from '../../main/NavigationHomePage';
20
21@Preview
22@Component
23export struct ShopCart {
24  private url: string = '';
25  @StorageLink('goodsListHeight') goodsListHeight: number = 100;
26  @State shoppingCartGoodsList: number[] | undefined = AppStorage.get('shoppingCartGoodsList');
27
28  build() {
29    Column() {
30      Scroll() {
31        Column() {
32          Column() {
33            Row() {
34              Text($r('app.string.shop_cart'))
35                .fontSize(24)
36                .fontColor($r('app.color.blank'))
37                .fontFamily('HarmonyHeiTi')
38
39              Blank()
40              Text($r('app.string.shop_cart_edit'))
41                .fontSize(16)
42                .fontFamily('HarmonyHeiTi')
43                .fontColor($r('app.color.blank'))
44                .opacity(0.6)
45            }
46            .width('100%')
47            .margin({
48              top: 16,
49              bottom: 12
50            })
51
52            Cart({ shoppingCartGoodsListToCart: $shoppingCartGoodsList });
53          }
54          .width('100%')
55          .padding({
56            right: 12
57          })
58          .backgroundColor($r('app.color.divider'))
59
60          Text($r('app.string.guess_you_like'))
61            .fontSize(20)
62            .fontColor($r('app.color.blank'))
63            .padding({
64              top: 24,
65              bottom: 20,
66              left: 12
67            })
68          FavorGoodList(new Url(this.url));
69        }
70        .padding({
71          bottom: 12
72        })
73        .alignItems(HorizontalAlign.Start)
74      }
75      .layoutWeight(1)
76      .padding({
77        left: 12,
78        right: 12
79      })
80      .scrollBar(BarState.Off)
81      .align(Alignment.Top)
82
83      Divider()
84        .color($r('app.color.divider2'))
85        .height(0.5)
86    }
87    .width('100%')
88    .height('100%')
89    .backgroundColor($r('app.color.divider'))
90  }
91}