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
d5664c7b
Commit
d5664c7b
authored
Apr 21, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dd
parent
35cdcea9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
3 deletions
+91
-3
xgg-saas-merchant/app/base/controller/impl/saas/invoiceCtl.js
+80
-1
xgg-saas-merchant/app/base/service/impl/saas/invoiceSve.js
+9
-0
xgg-saas-merchant/app/base/system.js
+2
-2
No files found.
xgg-saas-merchant/app/base/controller/impl/saas/invoiceCtl.js
View file @
d5664c7b
...
...
@@ -67,7 +67,7 @@ class InvoiceCtl extends CtlBase {
try
{
let
fee_type
=
this
.
trim
(
params
.
fee_type
);
if
(
fee_type
==
"00"
)
{
return
await
this
.
apply00
(
params
,
pobj2
,
req
);
}
else
if
(
fee_type
==
"10"
)
{
return
await
this
.
apply10
(
params
,
pobj2
,
req
);
}
else
if
(
fee_type
==
"20"
)
{
...
...
@@ -164,6 +164,85 @@ class InvoiceCtl extends CtlBase {
return
system
.
getResultSuccess
(
data
);
}
// 功能1开票
async
apply00
(
params
,
pobj2
,
req
)
{
validation
.
check
(
params
,
'data_ids'
,
{
name
:
"提示信息"
,
arr_require
:
true
});
let
title
=
await
this
.
merchantSve
.
title
(
params
)
||
{};
title
=
title
.
data
||
{};
if
(
!
title
.
merchant_name
||
!
title
.
merchant_credit_code
||
!
title
.
merchant_addr
||
!
title
.
merchant_mobile
||
!
title
.
merchant_bank
||
!
title
.
merchant_account
)
{
return
system
.
getResult
(
null
,
"开票抬头不完整,请联系平台"
);
}
let
addr
=
await
this
.
merchantSve
.
addr
(
params
)
||
{};
addr
=
addr
.
data
||
{};
if
(
!
addr
||
!
addr
.
mail_to
||
!
addr
.
mail_addr
||
!
addr
.
mail_mobile
)
{
return
system
.
getResult
(
null
,
"开票邮寄不完整"
);
}
let
orders
=
await
this
.
orderSve
.
byIds
({
ids
:
params
.
data_ids
,
saas_merchant_id
:
params
.
saas_merchant_id
,
attrs
:
"id"
,
handle_status
:
[
'20'
,
'30'
],
unInvoice
:
true
,
})
||
[];
if
(
orders
.
data
.
length
!=
params
.
data_ids
.
length
)
{
return
system
.
getResult
(
null
,
"订单数据选择有误,请重新搜索后选择"
);
}
let
info
=
await
this
.
merchantSve
.
signInfo
({
id
:
params
.
saas_merchant_id
})
||
{};
info
=
info
.
data
||
{};
if
(
!
info
.
main_trade
)
{
return
system
.
getResult
(
null
,
"商户未设置转账交易主体,请联系平台进行设置、"
);
}
let
main
=
info
.
main_trade
||
{};
let
batch_no
=
await
this
.
redisClient
.
genrateId
(
"invoice_batch_no"
);
let
apply_no
=
batch_no
;
let
data
=
{
saas_id
:
params
.
saas_id
,
saas_merchant_id
:
params
.
saas_merchant_id
,
parent_id
:
""
,
owner_type
:
"00"
,
status
:
"1000"
,
batch_no
:
batch_no
,
apply_no
:
apply_no
,
fee_type
:
this
.
trim
(
params
.
fee_type
),
invoice_type
:
this
.
trim
(
params
.
invoice_type
),
from_name
:
main
.
name
,
from_credit_code
:
main
.
credit_code
,
from_mobile
:
main
.
mobile
,
from_addr
:
main
.
addr
,
from_bank
:
main
.
bank_name
,
from_account
:
main
.
bank_account
,
to_name
:
this
.
trim
(
title
.
merchant_name
),
to_credit_code
:
this
.
trim
(
title
.
merchant_credit_code
),
to_addr
:
this
.
trim
(
title
.
merchant_addr
),
to_mobile
:
this
.
trim
(
title
.
merchant_mobile
),
to_bank
:
this
.
trim
(
title
.
merchant_bank
),
to_account
:
this
.
trim
(
title
.
merchant_account
),
mail_addr
:
this
.
trim
(
addr
.
mail_addr
),
mail_mobile
:
this
.
trim
(
addr
.
mail_mobile
),
mail_to
:
this
.
trim
(
addr
.
mail_to
),
};
data
=
await
this
.
invoiceSve
.
applySave
(
data
);
console
.
log
(
data
);
data
=
data
.
data
;
if
(
!
data
||
!
data
.
id
)
{
return
system
.
getResult
(
null
,
"网络异常,发票申请失败"
);
}
let
rs
=
await
this
.
orderSve
.
updateInvoice
({
ids
:
params
.
data_ids
,
saas_invoice_id
:
data
.
id
});
console
.
log
(
rs
);
console
.
log
(
data
);
return
system
.
getResultSuccess
(
data
);
}
//发票申请列表
async
merchantinvoiceapplyPage
(
params
,
pobj2
,
req
)
{
try
{
...
...
xgg-saas-merchant/app/base/service/impl/saas/invoiceSve.js
View file @
d5664c7b
...
...
@@ -74,6 +74,14 @@ class InvoiceService extends ServiceBase {
}
}
async
byIds
(
params
)
{
let
rs
=
await
this
.
callms
(
"order"
,
"itemByIds"
,
params
);
return
rs
;
}
async
updateInvoice
(
params
)
{
let
rs
=
await
this
.
callms
(
"order"
,
"updateItemInvoice"
,
params
);
return
rs
;
}
}
module
.
exports
=
InvoiceService
;
\ No newline at end of file
xgg-saas-merchant/app/base/system.js
View file @
d5664c7b
...
...
@@ -187,10 +187,10 @@ class System {
merchant
:
dev
+
":3101"
+
path
,
// 订单服务
order
:
dev
+
":3103"
+
path
,
order
:
local
+
":3103"
+
path
,
// 发票服务
invoice
:
dev
+
":3105"
+
path
,
invoice
:
local
+
":3105"
+
path
,
// 用户服务
uc
:
dev
+
":3106"
+
path
,
...
...
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