第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

《仿盒馬》app開(kāi)發(fā)技術(shù)分享-- 綁定銀行卡回顯(52)

標(biāo)簽:
鴻蒙 HarmonyOS

技术栈

Appgallery connect

开发准备

上一节我们实现了安全锁的绑定,这一切都是为了帮助用户在提现流程上能有更好更安全的体验,现在我们开始正式着手提现相关的流程,我们先进行提现银行卡的绑定,绑定成功后我们关闭页面把数据回显到提现页

功能分析

首先我们要实现相应信息的录入,我们需要新建对应的银行卡绑定页面来填充信息,信息填充完成后把银行卡数据提交到云端的bindbank表中,然后我们在提现页面的onPageShow方法中查询对应的数据,展示到卡信息显示模块中,操作的时候一定要跟我们的userid进行关联

代码实现

首先我们创建对应的卡信息录入页面

import { bind_bank } from '../../clouddb/bind_bank';
import { User } from '../../entity/User';
import { StorageUtils } from '../../utils/StorageUtils';
import { cloudDatabase } from '@kit.CloudFoundationKit';
import showToast from '../../utils/ToastUtils';
import { router, Router } from '@kit.ArkUI';
import { CommonTopBar } from '../../widget/CommonTopBar';

let databaseZone = cloudDatabase.zone('default');

@Entry
@Component
struct BindCardPage {
  @State cardNum: string = '';
  @State bankName: string = '';
  @State peopleName: string = '';
  @State user: User|null=null

  async aboutToAppear(): Promise<void> {

    const value = await StorageUtils.getAll('user');
    if (value != "") {
      this.user = JSON.parse(value)
    }
  }


  build() {
    Column({space:5}) {
      CommonTopBar({ title: "添加银行卡", alpha: 0, titleAlignment: TextAlign.Center ,backButton:true})

      Row() {
        Text("卡 号")
          .fontColor(Color.Black)
          .fontSize(16)
          .fontWeight(FontWeight.Bold)
        TextInput({ text: this.cardNum, placeholder: '请输入银行卡号' })
          .placeholderColor("#999999")
          .placeholderFont({ size: 16, weight: 400 })
          .caretColor("#FCDB29")
          .width(400)
          .height(50)
          .backgroundColor(null)
          .type(InputType.Number)
          .margin(20)
          .fontSize(14)
          .fontColor(Color.Black)
          .onChange((value: string) => {
            this.cardNum = value
          })
      }
      Divider().width('100%').height(0.8)
        .color("#e6e6e6")
        .width('100%')
      Row() {
        Text("银 行")
          .fontColor(Color.Black)
          .fontSize(16)
          .fontWeight(FontWeight.Bold)
        TextInput({ text: this.bankName, placeholder: '请输入所属银行' })
          .placeholderColor("#999999")
          .placeholderFont({ size: 16, weight: 400 })
          .caretColor("#FCDB29")
          .width(400)
          .height(50)
          .backgroundColor(null)
          .margin(20)
          .fontSize(14)
          .fontColor(Color.Black)
          .onChange((value: string) => {
            this.bankName = value
          })
      }
      Divider().width('100%').height(0.8)
        .color("#e6e6e6")
        .width('100%')
      Row() {
        Text("开户名")
          .fontColor(Color.Black)
          .fontSize(16)
          .fontWeight(FontWeight.Bold)
        TextInput({ text: this.peopleName, placeholder: '请输入银行卡号' })
          .placeholderColor("#999999")
          .placeholderFont({ size: 16, weight: 400 })
          .caretColor("#FCDB29")
          .width(400)
          .height(50)
          .backgroundColor(null)
          .margin(20)
          .fontSize(14)
          .fontColor(Color.Black)
          .onChange((value: string) => {
            this.peopleName = value
          })
      }
      Text("绑定")

        .width('95%')
        .padding(10)
        .borderRadius(10)
        .textAlign(TextAlign.Center)
        .fontColor(Color.White)
        .backgroundColor("#ffe03636")
        
    }
    .height('100%')
    .backgroundColor(Color.White)
  }
}

添加完成之后,我们把提交方法写到绑定事件上

  Text("绑定")

        .width('95%')
        .padding(10)
        .borderRadius(10)
        .textAlign(TextAlign.Center)
        .fontColor(Color.White)
        .backgroundColor("#ffe03636")
        .onClick(async ()=>{
          let cardInfo=new bind_bank()
          cardInfo.id=Math.floor(Math.random() * 1000000)
          cardInfo.user_id=this.user!.user_id
          cardInfo.bank_name=this.bankName
          cardInfo.bank_card=this.cardNum
          cardInfo.bank_people=this.peopleName
          let num = await databaseZone.upsert(cardInfo);
          if (num>0) {
            showToast("绑定成功")
            router.back()
          }
        })

绑定成功后我们关闭当前页面,回到提现页面进行数据查询


  @State bankList:BindBank[]=[]

async onPageShow(): Promise<void> {
    const value = await StorageUtils.getAll('user');
    if (value != "") {
      this.user = JSON.parse(value)
    }
    let databaseZone = cloudDatabase.zone('default');
    let condition = new cloudDatabase.DatabaseQuery(bind_bank);
    condition.equalTo("user_id", this.user?.user_id)
    let listData = await databaseZone.query(condition);
    let json = JSON.stringify(listData)
    let data: BindBank[] = JSON.parse(json)
    if (data.length>0) {
      this.bankList=data

    }
  }

到这里我们就实现了银行卡的绑定和回显

點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺(jué)得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫(xiě)下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消