Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
komatsu-lease-app
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
komatsu
komatsu-lease-app
Commits
57cf79e4
Commit
57cf79e4
authored
Dec 23, 2022
by
Step_by_step
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 融资意向接口联调
parent
ec282208
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
224 additions
and
60 deletions
+224
-60
AuForm.vue
src/components/AuForm.vue
+29
-1
index.js
src/modules/intention/api/index.js
+6
-0
index.js
src/modules/intention/store/index.js
+10
-5
index.vue
src/modules/intention/views/index.vue
+37
-21
intentionForm.vue
src/modules/intention/views/intentionForm.vue
+125
-33
location.js
src/utils/location.js
+17
-0
No files found.
src/components/AuForm.vue
View file @
57cf79e4
...
...
@@ -66,11 +66,20 @@
<DatetimePicker
v-model=
"currentDate"
type=
"date"
title=
"选择年月日"
@
confirm=
"typeOnConfirm($event, 'date')"
@
cancel=
"typeOnCancel"
/>
</Popup>
<Popup
v-model:show=
"typeShowCascader"
position=
"bottom"
>
<Cascader
v-model=
"cascaderValue"
title=
"请选择"
:options=
"typeColumns"
@
close=
"typeOnCancel"
@
finish=
"typeOnConfirm($event, 'cascader')"
/>
</Popup>
<Popup
v-model:show=
"typeShowArea"
position=
"bottom"
>
<Area
title=
"请选择"
:area-list=
"typeColumns"
@
confirm=
"typeOnConfirm($event, 'area')"
/>
</Popup>
</div>
</template>
<
script
setup
>
import
{
Popup
,
Picker
,
Cell
,
Field
,
DatetimePicker
,
CheckboxGroup
,
Checkbox
}
from
'vant'
;
import
{
Popup
,
Picker
,
Cell
,
Field
,
DatetimePicker
,
CheckboxGroup
,
Checkbox
,
Cascader
,
Area
}
from
'vant'
;
import
{
currency
,
toPercent
}
from
'@/utils/textFormat'
import
{
ref
}
from
"vue"
;
...
...
@@ -104,9 +113,12 @@ const emit = defineEmits(['update:modelValue'])
const
nowItem
=
ref
({})
const
typeShow
=
ref
(
false
)
const
typeShowDate
=
ref
(
false
)
const
typeShowCascader
=
ref
(
false
)
const
typeShowArea
=
ref
(
false
)
const
typeColumns
=
ref
([])
const
currentDate
=
ref
(
new
Date
())
const
cascaderValue
=
ref
(
''
)
// const miniDate = ref(new Date('1920-01-1 00:46:53'))
const
currencyFormatter
=
(
value
)
=>
currency
(
value
.
replace
(
/
[^
0-9.
]
*/g
,
''
))
...
...
@@ -140,6 +152,12 @@ function chooser(formItem) {
typeShowDate
.
value
=
true
}
else
if
(
typeof
formItem
.
select
===
"function"
)
{
formItem
.
select
()
}
else
if
(
Object
.
prototype
.
toString
.
call
(
formItem
.
select
)
===
'[object Object]'
)
{
typeShowArea
.
value
=
true
typeColumns
.
value
=
formItem
.
select
}
else
if
(
formItem
.
select
[
0
].
hasOwnProperty
(
'children'
))
{
typeShowCascader
.
value
=
true
typeColumns
.
value
=
formItem
.
select
}
else
{
typeShow
.
value
=
true
typeColumns
.
value
=
formItem
.
select
...
...
@@ -156,6 +174,14 @@ function typeOnConfirm(value, type) {
}
}
else
if
(
type
===
'date'
)
{
nowItem
.
value
.
value
=
value
.
toLocaleDateString
()
}
else
if
(
type
===
'cascader'
)
{
nowItem
.
value
.
value
=
value
}
else
if
(
type
===
'area'
)
{
if
(
value
[
0
].
name
===
value
[
1
].
name
)
{
nowItem
.
value
.
value
=
value
[
0
].
name
+
value
[
2
].
name
}
else
{
nowItem
.
value
.
value
=
value
[
0
].
name
+
value
[
1
].
name
+
value
[
2
].
name
}
}
typeOnCancel
()
}
...
...
@@ -164,6 +190,8 @@ function isObject(obj) {
}
function
typeOnCancel
()
{
typeShow
.
value
=
typeShowDate
.
value
=
false
typeShowCascader
.
value
=
false
;
typeShowArea
.
value
=
false
;
}
function
getClass
(
item
)
{
...
...
src/modules/intention/api/index.js
View file @
57cf79e4
...
...
@@ -10,6 +10,12 @@ const api = {
getDetail
(
data
=
{})
{
return
post
(
`
${
baseURL
}
/app/api/app/financing/intention/file`
,
data
)
},
saveInfo
(
data
=
{})
{
return
post
(
`
${
baseURL
}
/app/api/app/financing/intention/save`
,
{
userId
:
window
.
localStorage
.
getItem
(
'userId'
),
...
data
})
},
getAgent
()
{
return
post
(
`
${
baseURL
}
/app/api/app/agent/file`
,
{})
}
};
export
default
api
;
src/modules/intention/store/index.js
View file @
57cf79e4
const
state
=
{};
import
{
ref
,
computed
}
from
'vue'
import
{
defineStore
}
from
'pinia'
export
default
{
namespaced
:
true
,
state
,
};
export
const
useIntention
=
defineStore
(
'formStore'
,
()
=>
{
const
intentionData
=
ref
({})
const
agentList
=
ref
([])
return
{
intentionData
,
agentList
}
})
src/modules/intention/views/index.vue
View file @
57cf79e4
...
...
@@ -3,48 +3,64 @@
<NavBar
title=
"融资意向"
left-arrow
@
click-left=
"goBack"
/>
<section
class=
"list"
>
<PullRefresh
v-model=
"refreshing"
@
refresh=
"onRefresh"
class=
"scroll"
>
<List
:finished=
"finished"
finished-text=
"没有更多了"
@
load=
"loadApproval"
>
<PullRefresh
v-model=
"refreshing"
@
refresh=
"getList"
class=
"scroll"
>
<List
:finished=
"finished"
finished-text=
"没有更多了"
>
<Empty
v-if=
"!listValue.length"
description=
"无记录"
/>
<ListItem
v-for=
"item in listValue"
:other_title=
"item.other_title"
:title=
"item.title"
:values=
"item.values"
@
click=
"jump"
/>
@
click=
"jump
(item.intentionId)
"
/>
</List>
</PullRefresh>
</section>
<Plus
@
click=
"jump"
/>
<Plus
@
click=
"jump
('')
"
/>
</div>
</
template
>
<
script
setup
>
import
{
goBack
}
from
"@/utils/globalFun"
import
{
NavBar
,
List
,
PullRefresh
}
from
"vant"
;
import
{
NavBar
,
List
,
PullRefresh
,
Empty
}
from
"vant"
;
import
ListItem
from
'@/components/ListItem.vue'
import
Plus
from
'@/components/Plus.vue'
import
api
from
"../api"
;
import
{
useRouter
}
from
"vue-router"
;
import
{
useIntention
}
from
'../store/index'
const
listValue
=
$ref
([
{
title
:
'R00001'
,
other_title
:
"2022-07-18"
,
values
:
[[
"合同金额"
,
"状态"
],
[
"¥ 20,000.00"
,
"受理中"
]]
const
formStore
=
useIntention
()
const
listValue
=
$ref
([])
const
getList
=
async
()
=>
{
let
res
=
await
api
.
getlist
()
if
(
res
.
result
===
'SUCCESS'
&&
res
.
data
.
length
)
{
listValue
=
res
.
data
.
map
(
item
=>
{
return
{
title
:
item
.
intentionNumber
,
other_title
:
item
.
creationDate
,
values
:
[[
"合同金额"
,
"状态"
],
[
"¥ "
+
item
.
contractAmount
,
item
.
intentionStatusN
]],
intentionId
:
item
.
intentionId
}
})
}
else
{
listValue
=
[]
}
])
refreshing
=
false
;
}
getList
()
const
refreshing
=
$ref
(
true
);
const
finished
=
$ref
(
true
);
const
onRefresh
=
()
=>
{
// 下拉重置参数,重新加载
};
const
loadApproval
=
()
=>
{
}
const
router
=
useRouter
();
const
jump
=
()
=>
{
router
.
push
({
name
:
'intention-views-intentionForm'
})
const
jump
=
async
(
intentionId
=
''
)
=>
{
if
(
intentionId
)
{
let
res
=
await
api
.
getDetail
({
intentionId
:
intentionId
+
''
})
if
(
res
.
result
===
'SUCCESS'
&&
res
.
data
.
length
)
{
formStore
.
intentionData
=
res
.
data
[
0
];
router
.
push
({
name
:
'intention-views-intentionForm'
})
}
}
else
{
router
.
push
({
name
:
'intention-views-intentionForm'
})
}
}
</
script
>
...
...
src/modules/intention/views/intentionForm.vue
View file @
57cf79e4
<
template
>
<div
class=
"container"
>
<NavBar
title=
"申请融资意向"
left-arrow
@
click-left=
"
goBack
"
/>
<NavBar
title=
"申请融资意向"
left-arrow
@
click-left=
"
toLast
"
/>
<div
class=
"content"
>
<section
class=
"form-area"
>
<AuForm
v-model=
"formConfig"
:key=
"form"
/>
<Field
v-model=
"message"
rows=
"2"
autosize
label=
"备注说明"
type=
"textarea"
maxlength=
"200"
placeholder=
"最多可编写200字
"
show-word-limit
/>
<Field
v-model=
"message"
rows=
"2"
autosize
:readonly=
"messageDisabled"
label=
"备注说明"
type=
"textarea
"
maxlength=
"200"
placeholder=
"最多可编写200字"
show-word-limit
/>
</section>
<section
class=
"sub"
>
<Button
type=
"primary"
block
>
确认
</Button>
<Button
type=
"primary"
v-show=
"!messageDisabled"
@
click=
"save"
block
>
确认
</Button>
</section>
</div>
</div>
...
...
@@ -18,50 +18,53 @@
<
script
setup
>
import
{
goBack
}
from
"@/utils/globalFun"
import
{
NavBar
,
Button
,
Field
}
from
"vant"
;
import
{
NavBar
,
Button
,
Field
,
Toast
}
from
"vant"
;
import
AuForm
from
'@/components/AuForm.vue'
;
import
AuFormClass
from
"@/components/useAuForm"
;
import
{
useLocation
}
from
"@/utils/location"
import
{
phoneReg
}
from
"@/utils/Reg"
import
{
useRouter
}
from
"vue-router"
;
import
{
useIntention
}
from
'../store/index'
import
{
unref
}
from
"vue"
;
import
api
from
"../api"
;
import
{
areaList
}
from
'@vant/area-data'
;
console
.
log
(
areaList
);
const
form
=
$ref
();
const
formConfig
=
$ref
(
new
AuFormClass
([
const
formStore
=
useIntention
()
let
location
=
useLocation
()
const
formRaw
=
[
{
title
:
'合同总额'
,
propName
:
'
paymentReqDate
'
,
propName
:
'
contractAmount
'
,
type
:
'currency'
,
value
:
''
,
isRequired
:
true
},
{
title
:
'融资租期(月)'
,
propName
:
'
paymentReqDat3e
'
,
propName
:
'
term
'
,
type
:
'digit'
,
value
:
''
,
isRequired
:
true
},
{
title
:
'首付款比例'
,
propName
:
'
paymentReqDat3e
'
,
propName
:
'
firstGoldRatio
'
,
type
:
'rate'
,
value
:
''
,
isRequired
:
true
},
{
title
:
'首付款比例'
,
propName
:
'paymentReqDat3e'
,
type
:
'rate'
,
value
:
''
,
value
:
'6'
,
isRequired
:
true
},
{
title
:
'首付款金额'
,
propName
:
'
paymentReqDat3e
'
,
propName
:
'
firstGold
'
,
type
:
'currency'
,
value
:
''
,
isRequired
:
true
},
{
title
:
'代理店'
,
propName
:
'
paymentRe3qDat3
e'
,
propName
:
'
agentBpNam
e'
,
type
:
'cell'
,
value
:
''
,
isRequired
:
true
,
...
...
@@ -69,41 +72,130 @@ const formConfig = $ref(new AuFormClass([
},
{
title
:
'代理店联系电话'
,
propName
:
'
paymentRe3qDat3
e'
,
propName
:
'
agentPhon
e'
,
type
:
'digit'
,
value
:
''
,
isRequired
:
true
,
reg
:
phoneReg
},
{
title
:
'您的姓名/公司名称'
,
propName
:
'paymentRe3qDat3e'
,
type
:
'input'
,
value
:
''
,
isRequired
:
true
,
},
{
title
:
'您的姓名/公司名称'
,
propName
:
'paymentRe3qDat3e'
,
propName
:
'name'
,
type
:
'input'
,
value
:
''
,
isRequired
:
true
,
},
{
title
:
'您的电话号码'
,
propName
:
'
digit
'
,
propName
:
'
phone
'
,
type
:
'input'
,
value
:
''
,
isRequired
:
true
,
reg
:
phoneReg
},
{
title
:
'联系地址'
,
propName
:
'
paymentRe3qDat3e
'
,
propName
:
'
contactAddress
'
,
type
:
'cell'
,
value
:
''
,
isRequired
:
true
,
select
:
[]
,
select
:
areaList
,
},
]))
]
const
form
=
$ref
();
const
message
=
$ref
(
''
)
const
formConfig
=
$ref
(
new
AuFormClass
(
formRaw
))
const
messageDisabled
=
$ref
(
false
)
let
agentList
=
[]
const
router
=
useRouter
()
const
toLast
=
()
=>
{
formStore
.
intentionData
=
{}
goBack
()
}
const
save
=
async
()
=>
{
if
(
formConfig
.
validate
())
{
let
formValueObj
=
formConfig
.
getValues
()
for
(
const
key
in
formValueObj
)
{
formValueObj
[
key
]
=
formValueObj
[
key
]
+
''
;
}
console
.
log
(
formValueObj
);
if
(
formConfig
.
validate
())
{
let
res
=
await
api
.
saveInfo
({
remark
:
message
,
...
formValueObj
})
if
(
res
.
success
)
{
Toast
.
success
(
'保存成功'
);
}
else
{
Toast
.
fail
(
'保存失败, 请稍后重试'
);
}
setTimeout
(()
=>
{
toLast
()
},
2000
);
}
}
else
{
Toast
({
message
:
'请将信息填写完整'
,
position
:
'top'
});
}
}
const
handleAgent
=
async
()
=>
{
if
(
formStore
.
agentList
.
length
)
{
agentList
=
formStore
.
agentList
}
else
{
let
agentRes
=
await
api
.
getAgent
()
if
(
agentRes
.
success
)
{
agentList
=
agentRes
.
rows
.
map
(
item
=>
({
provinceIdN
:
item
.
provinceIdN
||
''
,
cityIdN
:
item
.
cityIdN
||
''
,
bpName
:
item
.
bpName
,
bpCode
:
item
.
bpCode
,
})
).
map
(
item
=>
{
return
{
text
:
item
.
provinceIdN
+
item
.
cityIdN
+
item
.
bpName
,
value
:
item
.
bpName
}
}).
sort
((
a
,
b
)
=>
(
a
.
text
.
localeCompare
(
b
.
text
)))
formStore
.
agentList
=
agentList
;
}
}
formConfig
.
setFormValue
(
'agentBpName'
,
'select'
,
agentList
)
}
handleAgent
()
const
getLocation
=
()
=>
{
location
(
function
(
info
)
{
console
.
log
(
info
);
let
provineReg
=
new
RegExp
(
info
.
address
.
province
)
let
cityReg
=
new
RegExp
(
info
.
address
.
city
)
let
temp1
=
agentList
.
filter
(
item
=>
provineReg
.
test
(
item
.
text
));
if
(
temp1
.
length
)
{
let
temp2
=
temp1
.
filter
(
item
=>
cityReg
.
test
(
item
.
text
))
if
(
temp2
.
length
)
{
formConfig
.
setFormValue
(
'agentBpName'
,
'value'
,
temp2
[
0
].
text
)
}
else
{
formConfig
.
setFormValue
(
'agentBpName'
,
'value'
,
temp1
[
0
].
text
)
}
}
},
function
(
error
)
{
console
.
error
(
'定位error'
,
error
)
})
}
const
getFormVal
=
()
=>
{
if
(
formStore
.
intentionData
?.
intentionId
)
{
formConfig
.
fillValues
(
unref
(
formStore
.
intentionData
));
message
=
formStore
.
intentionData
.
remark
;
formConfig
.
setAll
(
'disabled'
,
()
=>
true
);
messageDisabled
=
true
;
}
else
{
getLocation
()
}
}
getFormVal
()
</
script
>
<
style
lang=
"less"
scoped
>
...
...
src/utils/location.js
0 → 100644
View file @
57cf79e4
function
useLocation
(
onSuccess
=
(
message
)
=>
{
console
.
info
(
message
)
},
onError
=
(
error
)
=>
{
console
.
error
(
error
)
})
{
return
function
location
()
{
let
options
=
{
"platform"
:
"gaode"
,
//百度(baidu)或高德(gaode)
}
let
arg
=
{
className
:
"LocationBridge"
,
function
:
"location"
,
params
:
options
,
successCallBack
:
"onSuccess"
,
failCallBack
:
"onError"
}
HandBridge
.
postMessage
(
JSON
.
stringify
(
arg
));
}
}
export
{
useLocation
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment