浏览代码

数量添加弹窗

cjb 2 月之前
父节点
当前提交
ec40ca626a

+ 152 - 0
entry/src/main/ets/view/ModifyMaterialNumDialog.ets

@@ -0,0 +1,152 @@
+// 确认框
+import Want from '@ohos.app.ability.Want';
+import common from '@ohos.app.ability.common';
+@CustomDialog
+export struct ModifyMaterialNumDialog {
+  context = getContext(this) as common.UIAbilityContext;
+  @Prop currentMaterialName :string = ''
+  @Prop currentMaterialNo :string = ''
+  @Prop currentBatchNo :string = ''
+  @Prop currentUnit :string = ''
+  @Link materialNum :number
+  @State addClick:number = 1
+  @State subClick:number = 1
+  controller: CustomDialogController
+  onConfirm: () => void = () => {}
+  build() {
+    Column() {
+      // 标题
+      Column(){
+        Text("数量")
+          .fontColor($r('app.color.FFFFFF'))
+          .fontSize($r('app.float.fontSize_30'))
+      }.height('25%')
+      .justifyContent(FlexAlign.Center)
+      Column(){
+        Text(`物料名称:${this.currentMaterialName}`)
+          .fontColor($r('app.color.FFFFFF'))
+          .fontSize($r('app.float.fontSize_16'))
+          .fontWeight(FontWeight.Lighter)
+        Text(`型号:${this.currentMaterialNo}`)
+          .fontColor($r('app.color.FFFFFF'))
+          .fontSize($r('app.float.fontSize_16'))
+          .fontWeight(FontWeight.Lighter)
+        Text(`批次号:${this.currentBatchNo}`)
+          .fontColor($r('app.color.FFFFFF'))
+          .fontSize($r('app.float.fontSize_16'))
+          .fontWeight(FontWeight.Lighter)
+        Text(`数量(${this.currentUnit})`)
+          .fontColor($r('app.color.FFFFFF'))
+          .fontSize($r('app.float.fontSize_16'))
+          .margin({top:'4%',bottom:"2%",left:'2%'})
+        Row(){
+          Row() {
+            Button({ type: ButtonType.Normal }) {
+              Image($r('app.media.process_material_subtraction'))
+                .width('50%')
+                .height('50%')
+                .objectFit(ImageFit.Contain)
+                .fillColor($r('app.color.FFFFFF'))
+            }
+            .width('100%')
+            .height('100%')
+            .backgroundColor($r('app.color.20FFFFFF'))
+            .borderRadius($r('app.float.virtualSize_16'))
+            .scale({ x: this.addClick, y: this.addClick })
+            .animation({
+              duration: 200,
+              curve: Curve.Linear
+            })
+            .onClick(() => {
+              this.addClick = 0.9;
+              setTimeout(() => {
+                this.addClick = 1;
+                this.materialNum--
+              }, 200);
+            })
+          }.width('22%')
+          Row(){
+            Text(String(this.materialNum))
+              .fontColor($r('app.color.FFFFFF'))
+              .fontSize($r('app.float.fontSize_38'))
+          }
+          .width('56%')
+          .justifyContent(FlexAlign.Center)
+          Row() {
+            Button({ type: ButtonType.Normal }) {
+              Image($r('app.media.process_material_add'))
+                .width('50%')
+                .height('50%')
+                .objectFit(ImageFit.Contain)
+                .fillColor($r('app.color.FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+            }
+            .width('100%')
+            .height('100%')
+            .backgroundColor($r('app.color.20FFFFFF'))
+            .borderRadius($r('app.float.virtualSize_16'))
+            .scale({ x: this.subClick, y: this.subClick })
+            .animation({
+              duration: 200,
+              curve: Curve.Linear
+            })
+            .onClick(() => {
+              this.subClick = 0.9;
+              setTimeout(() => {
+                this.subClick = 1;
+                this.materialNum++
+              }, 200);
+            })
+          }.width('22%')
+        }
+        .height('22%')
+        .width('100%')
+        .backgroundColor($r('app.color.10FFFFFF'))
+        .borderRadius($r('app.float.virtualSize_16'))
+      }
+      .width('60%')
+      .justifyContent(FlexAlign.Start)
+      .alignItems(HorizontalAlign.Start)
+      .margin({bottom:"10%"})
+
+      Column(){
+        Divider()
+          .vertical(false)
+          .strokeWidth(1)
+          .color($r('app.color.15FFFFFF'))
+        Row(){
+          Row(){
+            Text('取消')
+              .fontColor($r('app.color.60FFFFFF'))
+              .fontSize($r('app.float.fontSize_30'))
+          }
+          .justifyContent(FlexAlign.Center)
+          .width('50%')
+          .onClick(() => this.controller.close())
+          Divider()
+            .vertical(true)
+            .strokeWidth(1)
+            .color($r('app.color.15FFFFFF'))
+          Row(){
+            Text('确认')
+              .fontColor($r('app.color.007AFF'))
+              .fontSize($r('app.float.fontSize_30'))
+          }
+          .justifyContent(FlexAlign.Center)
+          .width('50%')
+          .onClick(() => {
+            this.onConfirm();
+            this.controller.close();
+          })
+        }
+      }
+      .width('100%')
+      .height('16%')
+    }
+    .height('34%')
+    .width('30%')
+    .backgroundColor($r('app.color.2A2A2A'))
+    .justifyContent(FlexAlign.End)
+    .borderRadius($r('app.float.virtualSize_16'))
+  }
+}

+ 3 - 0
entry/src/main/resources/base/media/process_material_add.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" viewBox="0 0 48 48">
+  <path d="M25.5 42.32c0 .835-.672 1.512-1.5 1.512s-1.5-.677-1.5-1.512V25.177h-17c-.828 0-1.5-.677-1.5-1.513 0-.835.672-1.512 1.5-1.512h17V5.009c0-.836.672-1.513 1.5-1.513s1.5.677 1.5 1.513v37.31Zm17-20.168c.828 0 1.5.677 1.5 1.512 0 .836-.672 1.513-1.5 1.513h-15v-3.025h15Z"/>
+</svg>

+ 3 - 0
entry/src/main/resources/base/media/process_material_subtraction.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" viewBox="0 0 48 48">
+  <path d="M5.5 25.177c-.828 0-1.5-.678-1.5-1.513 0-.835.672-1.513 1.5-1.513h37c.828 0 1.5.678 1.5 1.513 0 .835-.672 1.513-1.5 1.513h-37Z"/>
+</svg>