Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
5ae0d911
Commit
5ae0d911
authored
Jun 23, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
24663175
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
5 deletions
+66
-5
ic-deliver/app/base/controller/impl/bizchance/deliverybillCtl.js
+11
-2
ic-deliver/app/base/db/impl/bizchance/deliverybillDao.js
+6
-0
ic-deliver/app/base/db/models/delivery/settlebill.js
+9
-1
ic-deliver/app/base/service/impl/bizchance/deliverybillSve.js
+40
-2
No files found.
ic-deliver/app/base/controller/impl/bizchance/deliverybillCtl.js
View file @
5ae0d911
...
...
@@ -32,6 +32,7 @@ class DeliverybillCtl extends CtlBase {
robj
.
source_name
=
element
.
source_name
;
//渠道来源--前端服务
robj
.
channelNumber
=
element
.
source_number
;
//渠道编码
robj
.
facilitator_name
=
element
.
facilitator_name
;
//服务商--前端服务
robj
.
facilitator_id
=
element
.
facilitator_id
;
//服务商--id
robj
.
serviceName
=
element
.
facilitator_name
;
robj
.
baseInfo
=
element
.
delivery_info
;
//交付单详情
robj
.
payStatus
=
element
.
delivery_info
.
payStatus
;
//交付状态
...
...
@@ -418,10 +419,18 @@ class DeliverybillCtl extends CtlBase {
}
}
async
settleApplyForTacent
(
p
,
q
,
req
){
let
ids
=
p
.
ids
let
spname
=
p
.
spname
let
spid
=
p
.
spid
let
rtn
=
await
this
.
service
.
settleApplyForTacent
(
ids
,
p
.
userid
,
p
.
username
,
spname
,
spid
)
return
system
.
getResult
({})
}
async
settleApply
(
p
,
q
,
req
){
let
ids
=
p
.
ids
let
rtn
=
await
this
.
service
.
settleApply
(
ids
,
p
.
userid
,
p
.
username
)
let
spname
=
p
.
spname
let
spid
=
p
.
spid
let
rtn
=
await
this
.
service
.
settleApply
(
ids
,
p
.
userid
,
p
.
username
,
spname
,
spid
)
return
system
.
getResult
({})
}
/*根据商机编号插入交付单信息*/
...
...
ic-deliver/app/base/db/impl/bizchance/deliverybillDao.js
View file @
5ae0d911
...
...
@@ -25,6 +25,12 @@ class DeliverybillDao extends Dao {
// 为空说明是管理员,不需设置组织结构过滤
if
(
qobj
.
opath
&&
qobj
.
opath
!=
""
)
{
qw
[
"salesman_opcode"
]
=
{
[
this
.
db
.
Op
.
like
]:
'%qobj.opath%'
}
}
else
{
//说明是租户管理员,给租户自己核销结算的功能,
if
(
qobj
.
bizpath
.
indexOf
(
"pmxdeliverrequest"
)
>
0
)
{
//说明是结算核销路由过来的
qw
[
"delivery_status"
]
=
"success"
;
qw
[
"settle_status"
]
=
"waittosettle"
;
}
}
//不是来自平台前端查询
if
(
qobj
.
bizpath
&&
qobj
.
bizpath
.
indexOf
(
"pmx"
)
<
0
)
{
...
...
ic-deliver/app/base/db/models/delivery/settlebill.js
View file @
5ae0d911
...
...
@@ -49,7 +49,15 @@ module.exports = (db, DataTypes) => {
payer
:{
allowNull
:
true
,
type
:
DataTypes
.
STRING
,
}
},
facilitator_id
:{
allowNull
:
true
,
type
:
DataTypes
.
INTEGER
,
},
facilitator_name
:{
allowNull
:
true
,
type
:
DataTypes
.
STRING
,
},
},
{
paranoid
:
true
,
//真的删除
underscored
:
true
,
...
...
ic-deliver/app/base/service/impl/bizchance/deliverybillSve.js
View file @
5ae0d911
...
...
@@ -75,7 +75,9 @@ class DeliverybillService extends ServiceBase {
}
}
async
settleApply
(
ids
,
uid
,
uname
){
//为租户自己给交付打标记,表示中台已经给予结算,自己记账用
//租户自己临时记录结算情况
async
settleApplyForTacent
(
ids
,
uid
,
uname
,
spname
,
spid
){
var
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
){
//先按照ids查询出交付单的合计服务成本
...
...
@@ -88,7 +90,43 @@ class DeliverybillService extends ServiceBase {
code
:
settlecode
,
settle_amount
:
settleAmount
,
creator_id
:
uid
,
creator
:
uname
creator
:
uname
,
facilitator_name
:
spname
,
facilitator_id
:
spid
,
isPayedStatus
:
false
,
auditedStatus
:
true
,
payer_id
:
uid
,
payer
:
uname
,
auditor_id
:
uid
,
auditor
:
uname
}
//生成结算单,结算单状态直接更改为已经付款
let
newentity
=
await
self
.
db
.
models
.
settlebill
.
create
(
settleObj
,{
transaction
:
t
})
//然后按照ids更新交付单的状态为结算中,更新结算单的id到交付单表
for
(
let
idstr
of
ids
){
let
up
=
await
self
.
dao
.
updateByWhere
({
settle_status
:
'settling'
,
settlebill_id
:
newentity
.
id
},
{
id
:
idstr
},
t
);
}
return
newentity
});
}
async
settleApply
(
ids
,
uid
,
uname
,
spname
,
spid
){
var
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
){
//先按照ids查询出交付单的合计服务成本
let
d
=
await
self
.
dao
.
customQuery
(
"select sum(cost_price) as settleAmount from delivery_bill where id in (:idstr)"
,{
idstr
:
ids
});
// let settleAmount=await self.dao.model.sum("cost_price",{where:{id:{[self.db.Op.In]:['40','41','42']}},transaction:t})
let
settleAmount
=
d
[
0
].
settleAmount
settleAmount
=
isNaN
(
settleAmount
)?
0
:
settleAmount
let
settlecode
=
await
self
.
getBusUid
(
"JSD"
)
let
settleObj
=
{
code
:
settlecode
,
settle_amount
:
settleAmount
,
creator_id
:
uid
,
creator
:
uname
,
facilitator_name
:
spname
,
facilitator_id
:
spid
}
//生成结算单,结算单状态为待审核
let
newentity
=
await
self
.
db
.
models
.
settlebill
.
create
(
settleObj
,{
transaction
:
t
})
...
...
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