BillingInformation.ets
5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import preferencesUtil from '../utils/preferences'
import { promptAction } from '@kit.ArkUI';
import { AxiosResponse } from '@ohos/axios'
import { headerTest, headerRow, companyData } from '../api/userType'
import { getHeaderInfo, updateHeaderInfo, addHeaderInfo } from '../api/user'
import NavHeader from '../components/NavHeader'
let companyId = preferencesUtil.get('XF_COMPANY_ID', 65) as number
@Entry
@Component
struct EditUser {
@Builder indicatorBuilder(icon: ResourceStr) {
Image(icon)
}
@State companyInfo: companyData = {
createBy: null,
createTime: null,
updateBy: null,
updateTime: '',
remark: null,
companyId: 65,
companyName: '',
province: '',
city: '',
county: '',
address: '',
legalPerson: null,
lpTel: null,
linkMan: '',
lmTel: '',
companyTel: null,
fax: null,
postCode: null,
email: '',
website: null,
floorage: 0,
siteVoucher: '',
businessLicenseNo: '',
businessStartTime: null,
businessEndTime: null,
businessLicensePic: '',
businessScope: null,
peopleNum: 0,
companyIntroduce: null,
registeredCapital: null,
compangyPic: '',
memo: null,
state: '',
companyType: '',
isShow: null,
isValidVedio: null,
userId: 0,
username: '',
level: null,
regionCode: null,
levelModifyDate: null,
endTime: '',
}
@State isEdit: boolean = false
@State headerInfo: headerRow = {
account: '',
bank: '',
address: '',
phone: '',
companyId: '',
companyName: '',
businessLicenseNo: ''
}
async onPageShow() {
if(preferencesUtil.get('XF_COMPANY_INFO', '') !== '') {
this.companyInfo = JSON.parse(preferencesUtil.get('XF_COMPANY_INFO', '') as string)
this.headerInfo.businessLicenseNo = this.companyInfo.businessLicenseNo
this.headerInfo.companyName = this.companyInfo.companyName
}
let res: AxiosResponse<headerTest> = await getHeaderInfo({pageSize: 1, pageNum: 1, companyId: companyId})
this.isEdit = res.data.rows.length > 0
if(res.data.rows.length > 0){
this.headerInfo = res.data.rows[0]
}
}
build() {
Column(){
NavHeader({title: '公司信息'})
Column(){
Column(){
Row(){
Row(){
Image($r('app.media.require')).width(20)
Text('公司名称')
}.margin({right: 15})
Text(this.headerInfo?.companyName).layoutWeight(1).padding({top: 10, bottom: 10})
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10})
Row(){
Row(){
Image($r('app.media.require')).width(20)
Text('统一信用代码')
}.margin({right: 15})
Text(this.headerInfo?.businessLicenseNo).layoutWeight(1).padding({top: 10, bottom: 10})
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10})
Row(){
Row(){
Image($r('app.media.require')).width(20)
Text('对公账户')
}
TextInput({placeholder: '请输入对公账户', text: $$this.headerInfo.account})
.backgroundColor('#fff').layoutWeight(1).type(InputType.Number)
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10})
Row(){
Row(){
Image($r('app.media.require')).width(20)
Text('开户行')
}
TextInput({placeholder: '请输入开户行', text: $$this.headerInfo.bank})
.backgroundColor('#fff').layoutWeight(1)
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10})
Row(){
Row(){
Image($r('app.media.require')).width(20)
Text('公司电话')
}
TextInput({placeholder: '请输入公司电话', text: $$this.headerInfo.phone})
.backgroundColor('#fff').layoutWeight(1)
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10})
Row(){
Row(){
Image($r('app.media.require')).width(20)
Text('公司地址')
}
TextInput({placeholder: '请输入公司地址', text: $$this.headerInfo.address})
.backgroundColor('#fff').layoutWeight(1)
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10})
}.backgroundColor('#fff').width('100%').padding({left: 5, right: 5}).borderRadius(10)
}.padding(10).margin({bottom: 20, top: 10}).width('100%').layoutWeight(1)
Row({ space: 10}){
Text('提交').borderRadius(5).layoutWeight(1).height(30).fontColor('#fff')
.backgroundColor('#1B65FD').fontSize(14).textAlign(TextAlign.Center)
.onClick(async () => {
if(this.isEdit) {
await updateHeaderInfo(this.headerInfo)
promptAction.showToast({
message: '修改成功',
duration: 2000
})
} else {
await addHeaderInfo(this.headerInfo)
promptAction.showToast({
message: '新增成功',
duration: 2000
})
}
})
}.width('100%').height(40).backgroundColor('#fff').padding({left: 10, right: 10})
}.width('100%').height('100%').backgroundColor('#f2f3f7')
}
}