|
|
@@ -0,0 +1,121 @@
|
|
|
+import { DiaLogSheetControl, YTAvoid } from 'basic';
|
|
|
+import { CustomTextStyle } from '../style/CustomTextStyle';
|
|
|
+import { buttonComp } from './BuilderIndex';
|
|
|
+
|
|
|
+
|
|
|
+@ComponentV2
|
|
|
+export struct AddressComp{
|
|
|
+ // @Param @Require param: BasicType
|
|
|
+ @Param @Require control: DiaLogSheetControl
|
|
|
+
|
|
|
+ @Local safeBottom: number = AppStorage.get(YTAvoid.SAFE_BOTTOM_KEY) as number
|
|
|
+ @Local selectIndex: number = 0
|
|
|
+
|
|
|
+ build() {
|
|
|
+ Column(){
|
|
|
+ Row(){
|
|
|
+ Text('选择地址')
|
|
|
+ .fontSize(16)
|
|
|
+ .fontWeight(500)
|
|
|
+ .fontColor('#FF000000')
|
|
|
+
|
|
|
+ Image($r('[basic].media.icon_close'))
|
|
|
+ .width(22).aspectRatio(1)
|
|
|
+ .onClick(() => { this.control._onBackPress() })
|
|
|
+ }.width('100%')
|
|
|
+ .backgroundColor(Color.White)
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+ .borderRadius({topLeft: 12, topRight: 12})
|
|
|
+ .padding({left: 18, right: 18, top: 14, bottom: 14})
|
|
|
+
|
|
|
+ Column({space: 18}){
|
|
|
+ ForEach(new Array(3).fill(''), (item: string, index) => {
|
|
|
+ this.addressItem(index)
|
|
|
+ })
|
|
|
+ }.width('100%')
|
|
|
+ .backgroundColor('#F7F9FA')
|
|
|
+ .padding({top: 18, bottom: 18, left: 15, right: 15})
|
|
|
+
|
|
|
+ Row(){
|
|
|
+ buttonComp(
|
|
|
+ '添加收件地址',
|
|
|
+ '100%',
|
|
|
+ 10,
|
|
|
+ new CustomTextStyle({size: 18, weight: 400}),
|
|
|
+ () => {}
|
|
|
+ )
|
|
|
+ }.width('100%')
|
|
|
+ .backgroundColor(Color.White)
|
|
|
+ .padding({ bottom: this.safeBottom, top: 10, left: 16, right: 16 })
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .backgroundColor(Color.Transparent)
|
|
|
+ }
|
|
|
+
|
|
|
+ @Builder
|
|
|
+ addressItem(index: number){
|
|
|
+ RelativeContainer(){
|
|
|
+ Row(){
|
|
|
+ Image($r('[basic].media.icon_location')).width(24).aspectRatio(1)
|
|
|
+
|
|
|
+ Column({space: 2}){
|
|
|
+ Text('福建省厦门市火炬园高新区火炬园路321号韩菲诗.诚享大厦304室内')
|
|
|
+ .fontSize(14)
|
|
|
+ .fontWeight(400)
|
|
|
+ .fontColor('#FF000000')
|
|
|
+
|
|
|
+ Row(){
|
|
|
+ Text('占三峰')
|
|
|
+ .fontSize(14)
|
|
|
+ .fontWeight(500)
|
|
|
+ .fontColor('#FF000000')
|
|
|
+ Text('13598728343')
|
|
|
+ .fontSize(14)
|
|
|
+ .fontWeight(500)
|
|
|
+ .fontColor('#FF000000')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .layoutWeight(1)
|
|
|
+ .margin({left: 11, right: 19})
|
|
|
+ .alignItems(HorizontalAlign.Start)
|
|
|
+
|
|
|
+ if(this.selectIndex == index) {
|
|
|
+ Image($r('[basic].media.icon_select'))
|
|
|
+ .width(15).aspectRatio(1)
|
|
|
+ } else {
|
|
|
+ Row()
|
|
|
+ .borderRadius(15)
|
|
|
+ .border({width: 1})
|
|
|
+ .width(15).aspectRatio(1)
|
|
|
+ }
|
|
|
+ }.width('100%').height('100%')
|
|
|
+ .borderRadius(16)
|
|
|
+ .alignItems(VerticalAlign.Center)
|
|
|
+ .padding({left: 16, right: 16, top: 18, bottom: 18})
|
|
|
+ .alignRules({
|
|
|
+ left: {anchor: '__container__', align: HorizontalAlign.Start},
|
|
|
+ top: {anchor: '__container__', align: VerticalAlign.Top}
|
|
|
+ })
|
|
|
+
|
|
|
+ if(0 == index){
|
|
|
+ Text('默认')
|
|
|
+ .fontSize(12)
|
|
|
+ .fontWeight(500)
|
|
|
+ .fontColor(Color.White)
|
|
|
+ .backgroundColor('#FFFFC500')
|
|
|
+ .padding({left: 11, top: 4, right: 11, bottom: 4})
|
|
|
+ .borderRadius({bottomLeft: 0, topLeft: 16, topRight: 0, bottomRight: 16})
|
|
|
+ .alignRules({
|
|
|
+ right: {anchor: '__container__', align: HorizontalAlign.End},
|
|
|
+ bottom: {anchor: '__container__', align: VerticalAlign.Bottom}
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ }.width('100%')
|
|
|
+ .height(100)
|
|
|
+ .borderRadius(16)
|
|
|
+ .backgroundColor(Color.White)
|
|
|
+ .onClick(() => { this.selectIndex = index })
|
|
|
+ .border({width: 1, color: 0 == index ? '#FFFECF2F' : '#FF000000'})
|
|
|
+ }
|
|
|
+}
|