• 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
16@Component
17export struct AddressService {
18  @Link isPanel: boolean;
19  @Link currentLocation: string;
20
21  @Builder
22  Server(text: Resource, marginTop: number) {
23    Row() {
24      Image($r('app.media.service'))
25        .objectFit(ImageFit.Contain)
26        .width(16)
27        .aspectRatio(1)
28
29      Row() {
30        Text(text)
31          .fontSize(14)
32          .fontColor($r('app.color.blank'))
33          .margin({ left: 6 })
34      }
35    }
36    .margin({ top: marginTop })
37  }
38
39  build() {
40    Column() {
41      Row() {
42        Text($r('app.string.send_to'))
43          .fontSize(14)
44          .fontColor($r('app.color.blank'))
45          .fontWeight(500)
46          .margin({ right: 16 })
47        Column() {
48          Row() {
49            Row() {
50              Image($r('app.media.local'))
51                .width(16)
52                .aspectRatio(1)
53                .margin({ right: 12 })
54              Text(`${this.currentLocation}`)
55                .fontSize(14)
56                .fontColor($r('app.color.blank'))
57                .opacity(0.6)
58            }
59            .flexShrink(1)
60            .flexGrow(1)
61
62            Image($r('app.media.alternative'))
63              .objectFit(ImageFit.Contain)
64              .width(14)
65              .aspectRatio(1)
66          }
67          .width('100%')
68          .justifyContent(FlexAlign.SpaceBetween)
69
70          Divider()
71            .color($r('app.color.blank'))
72            .opacity(0.2)
73            .width('100%')
74            .margin({ top: 12 })
75        }
76        .flexShrink(1)
77        .flexGrow(1)
78      }
79      .alignItems(VerticalAlign.Top)
80      .width('100%')
81      .onClick(() => {
82        this.isPanel = !this.isPanel;
83      })
84
85      Row() {
86        Text($r('app.string.service'))
87          .fontSize(14)
88          .fontColor($r('app.color.blank'))
89          .fontWeight(500)
90          .margin({ right: 16 })
91        Column() {
92          this.Server($r('app.string.free_hipping'), 0)
93          this.Server($r('app.string.store_delivery'), 16)
94          this.Server($r('app.string.return_goods'), 16)
95        }
96        .alignItems(HorizontalAlign.Start)
97      }
98      .width('100%')
99      .alignItems(VerticalAlign.Top)
100      .margin({ top: 12 })
101    }
102    .width('100%')
103    .justifyContent(FlexAlign.Start)
104    .backgroundColor($r('app.color.white'))
105    .borderRadius(16)
106    .padding({ top: 16, bottom: 16, left: 12, right: 12 })
107  }
108}