Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
dj-scrm-wx-work-attachment-activity
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6c990531
authored
Mar 22, 2022
by
张权
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
bug:代码优化,以及企微sdk兼容性问题
1 parent
a2590559
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
118 deletions
src/mixins/giftMixin.js
src/views/gift/create.vue
src/views/gift/detail.vue
src/views/gift/index.vue
src/mixins/giftMixin.js
0 → 100644
View file @
6c99053
export
const
setApproveParam
=
res
=>
{
const
{
approveTemplateId
,
approveNo
,
name
,
remarkName
,
anticipatedCost
,
coupons
,
giveReason
}
=
res
let
couponStr
=
''
coupons
.
forEach
(
item
=>
{
couponStr
=
couponStr
+
`
${
item
.
couponName
}
x
${
item
.
couponAmount
}
, 预估成本
${(
item
.
couponAnticipatedCost
*
item
.
couponAmount
/
100
).
toFixed
(
2
)}
元\n`
})
const
param
=
{
"oaType"
:
"10001"
,
"templateId"
:
approveTemplateId
,
"thirdNo"
:
approveNo
,
"extData"
:
{
'fieldList'
:
[
{
'title'
:
'礼包名称'
,
'type'
:
'text'
,
'value'
:
name
,
},
{
'title'
:
'备注名称'
,
'type'
:
'text'
,
'value'
:
remarkName
,
},
{
'title'
:
'预估成本'
,
'type'
:
'text'
,
'value'
:
(
anticipatedCost
/
100
).
toFixed
(
2
)
+
'元'
,
},
{
'title'
:
'礼包明细'
,
'type'
:
'text'
,
'value'
:
couponStr
,
},
{
'title'
:
'赠送原因'
,
'type'
:
'text'
,
'value'
:
giveReason
==
null
?
''
:
giveReason
,
},
]
}
}
console
.
log
(
param
,
'param'
)
return
param
;
}
\ No newline at end of file
\ No newline at end of file
src/views/gift/create.vue
View file @
6c99053
...
@@ -133,6 +133,7 @@
...
@@ -133,6 +133,7 @@
import
GiftModal
from
'./GiftModal.vue'
import
GiftModal
from
'./GiftModal.vue'
import
{
giftApi
,
wxConfig
}
from
'@/api'
import
{
giftApi
,
wxConfig
}
from
'@/api'
import
{
discountTypeMixin
}
from
'@/mixins'
import
{
discountTypeMixin
}
from
'@/mixins'
import
{
setApproveParam
}
from
'@/mixins/giftMixin'
export
default
{
export
default
{
name
:
''
,
name
:
''
,
components
:
{
GiftModal
}
,
components
:
{
GiftModal
}
,
...
@@ -292,49 +293,11 @@ export default {
...
@@ -292,49 +293,11 @@ export default {
giftApi
.
createOrupdataGift
(
params
).
then
(
res
=>
{
giftApi
.
createOrupdataGift
(
params
).
then
(
res
=>
{
this
.
hideLoading
()
this
.
hideLoading
()
if
(
res
.
approveFlag
===
2
){
if
(
res
.
approveFlag
===
2
){
const
{
approveTemplateId
,
approveNo
,
name
,
remarkName
,
anticipatedCost
,
coupons
,
giveReason
,
directionalGiftId
}
=
res
wxConfig
.
thirdPartyOpenPage
(
wxConfig
.
thirdPartyOpenPage
(
setApproveParam
(
res
)))
let
couponStr
=
''
coupons
.
forEach
(
item
=>
{
couponStr
=
couponStr
+
`${item.couponName
}
x${item.couponAmount
}
, 预估成本${(item.couponAnticipatedCost*item.couponAmount/100).toFixed(2)
}
元\n`
}
)
wxConfig
.
thirdPartyOpenPage
({
"oaType"
:
"10001"
,
"templateId"
:
approveTemplateId
,
"thirdNo"
:
approveNo
,
"extData"
:
{
'fieldList'
:
[
{
'title'
:
'礼包名称'
,
'type'
:
'text'
,
'value'
:
name
,
}
,
{
'title'
:
'备注名称'
,
'type'
:
'text'
,
'value'
:
remarkName
,
}
,
{
'title'
:
'预估成本'
,
'type'
:
'text'
,
'value'
:
(
anticipatedCost
/
100
).
toFixed
(
2
)
+
'元'
,
}
,
{
'title'
:
'礼包明细'
,
'type'
:
'text'
,
'value'
:
couponStr
,
}
,
{
'title'
:
'赠送原因'
,
'type'
:
'text'
,
'value'
:
giveReason
,
}
,
]
}
}
)
.
then
((
resp
)
=>
{
.
then
((
resp
)
=>
{
console
.
log
(
resp
,
'已发起审批'
)
console
.
log
(
resp
,
'已发起审批'
)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
$router
.
replace
({
name
:
'gift.detail'
,
query
:
{
id
:
directionalGiftId
,
approveStatus
:
999
}}
)
this
.
$router
.
replace
({
name
:
'gift.detail'
,
query
:
{
id
:
res
.
directionalGiftId
,
approveStatus
:
999
}}
)
}
,
500
)
}
,
500
)
}
)
}
)
}
else
{
}
else
{
...
...
src/views/gift/detail.vue
View file @
6c99053
...
@@ -150,6 +150,7 @@ function appendZero(int) {
...
@@ -150,6 +150,7 @@ function appendZero(int) {
}
}
import
{
giftApi
,
wxConfig
}
from
'@/api'
import
{
giftApi
,
wxConfig
}
from
'@/api'
import
{
discountTypeMixin
}
from
'@/mixins'
import
{
discountTypeMixin
}
from
'@/mixins'
import
{
setApproveParam
}
from
'@/mixins/giftMixin'
export
default
{
export
default
{
name
:
''
,
name
:
''
,
mixins
:
[
discountTypeMixin
],
mixins
:
[
discountTypeMixin
],
...
@@ -253,45 +254,7 @@ export default {
...
@@ -253,45 +254,7 @@ export default {
let
{
id
}
=
this
.
getQuery
()
let
{
id
}
=
this
.
getQuery
()
giftApi
.
toApproveById
({
id
}
).
then
(
res
=>
{
giftApi
.
toApproveById
({
id
}
).
then
(
res
=>
{
if
(
res
.
approveFlag
===
2
){
if
(
res
.
approveFlag
===
2
){
const
{
approveTemplateId
,
approveNo
,
name
,
remarkName
,
anticipatedCost
,
coupons
,
giveReason
}
=
res
wxConfig
.
thirdPartyOpenPage
(
setApproveParam
(
res
))
let
couponStr
=
''
coupons
.
forEach
(
item
=>
{
couponStr
=
couponStr
+
`${item.couponName
}
x${item.couponAmount
}
, 预估成本${(item.couponAnticipatedCost*item.couponAmount/100).toFixed(2)
}
元\n`
}
)
wxConfig
.
thirdPartyOpenPage
({
"oaType"
:
"10001"
,
"templateId"
:
approveTemplateId
,
"thirdNo"
:
approveNo
,
"extData"
:
{
'fieldList'
:
[
{
'title'
:
'礼包名称'
,
'type'
:
'text'
,
'value'
:
name
,
}
,
{
'title'
:
'备注名称'
,
'type'
:
'text'
,
'value'
:
remarkName
,
}
,
{
'title'
:
'预估成本'
,
'type'
:
'text'
,
'value'
:
(
anticipatedCost
/
100
).
toFixed
(
2
)
+
'元'
,
}
,
{
'title'
:
'礼包明细'
,
'type'
:
'text'
,
'value'
:
couponStr
,
}
,
{
'title'
:
'赠送原因'
,
'type'
:
'text'
,
'value'
:
giveReason
,
}
,
]
}
}
)
.
then
((
resp
)
=>
{
.
then
((
resp
)
=>
{
console
.
log
(
resp
,
'已发起审批'
)
console
.
log
(
resp
,
'已发起审批'
)
}
)
}
)
...
...
src/views/gift/index.vue
View file @
6c99053
...
@@ -138,6 +138,7 @@
...
@@ -138,6 +138,7 @@
<
script
type=
'text/ecmascript-6'
>
<
script
type=
'text/ecmascript-6'
>
import
{
giftApi
,
wxConfig
}
from
'@/api'
import
{
giftApi
,
wxConfig
}
from
'@/api'
import
{
setApproveParam
}
from
'@/mixins/giftMixin'
export
default
{
export
default
{
name
:
''
,
name
:
''
,
data
()
{
data
()
{
...
@@ -179,45 +180,7 @@ export default {
...
@@ -179,45 +180,7 @@ export default {
toAppprove
({
id
}){
toAppprove
({
id
}){
giftApi
.
toApproveById
({
id
}).
then
(
res
=>
{
giftApi
.
toApproveById
({
id
}).
then
(
res
=>
{
if
(
res
.
approveFlag
===
2
){
if
(
res
.
approveFlag
===
2
){
const
{
approveTemplateId
,
approveNo
,
name
,
remarkName
,
anticipatedCost
,
coupons
,
giveReason
}
=
res
wxConfig
.
thirdPartyOpenPage
(
wxConfig
.
thirdPartyOpenPage
(
setApproveParam
(
res
)))
let
couponStr
=
''
coupons
.
forEach
(
item
=>
{
couponStr
=
couponStr
+
`
${
item
.
couponName
}
x
${
item
.
couponAmount
}
, 预估成本
${(
item
.
couponAnticipatedCost
*
item
.
couponAmount
/
100
).
toFixed
(
2
)}
元\n`
})
wxConfig
.
thirdPartyOpenPage
({
"oaType"
:
"10001"
,
"templateId"
:
approveTemplateId
,
"thirdNo"
:
approveNo
,
"extData"
:
{
'fieldList'
:
[
{
'title'
:
'礼包名称'
,
'type'
:
'text'
,
'value'
:
name
,
},
{
'title'
:
'备注名称'
,
'type'
:
'text'
,
'value'
:
remarkName
,
},
{
'title'
:
'预估成本'
,
'type'
:
'text'
,
'value'
:
(
anticipatedCost
/
100
).
toFixed
(
2
)
+
'元'
,
},
{
'title'
:
'礼包明细'
,
'type'
:
'text'
,
'value'
:
couponStr
,
},
{
'title'
:
'赠送原因'
,
'type'
:
'text'
,
'value'
:
giveReason
,
},
]
}
})
.
then
((
resp
)
=>
{
.
then
((
resp
)
=>
{
console
.
log
(
resp
,
'已发起审批'
)
console
.
log
(
resp
,
'已发起审批'
)
})
})
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment