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
9bd9ef2b
Commit
9bd9ef2b
authored
Apr 22, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
991b6dca
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
21 deletions
+41
-21
xgg-saas-merchant/app/base/controller/impl/saas/invoiceCtl.js
+40
-20
xgg-saas-merchant/app/base/system.js
+1
-1
No files found.
xgg-saas-merchant/app/base/controller/impl/saas/invoiceCtl.js
View file @
9bd9ef2b
...
...
@@ -70,6 +70,7 @@ class InvoiceCtl extends CtlBase {
// 发票申请
async
apply
(
params
,
pobj2
,
req
)
{
try
{
validation
.
check
(
params
,
"fee_type"
,
{
name
:
"费用记录类型"
,
is_require
:
true
,
dics
:
[
'00'
,
"10"
,
"20"
]});
let
fee_type
=
this
.
trim
(
params
.
fee_type
);
if
(
fee_type
==
"00"
)
{
return
await
this
.
apply00
(
params
,
pobj2
,
req
);
...
...
@@ -153,6 +154,7 @@ class InvoiceCtl extends CtlBase {
mail_addr
:
this
.
trim
(
addr
.
mail_addr
),
mail_mobile
:
this
.
trim
(
addr
.
mail_mobile
),
mail_to
:
this
.
trim
(
addr
.
mail_to
),
data_ids
:
params
.
data_ids
.
join
(
","
),
};
data
=
await
this
.
invoiceSve
.
applySave
(
data
);
...
...
@@ -171,11 +173,9 @@ class InvoiceCtl extends CtlBase {
// 功能3开票
async
apply20
(
params
,
pobj2
,
req
)
{
try
{
// TODO 方法未测试
validation
.
check
(
params
,
"fee_type"
,
{
name
:
"费用记录类型"
,
is_require
:
true
,
dics
:
[
'00'
,
"10"
,
"20"
]});
validation
.
check
(
params
,
"invoice_type"
,
{
name
:
"发票类型"
,
is_require
:
true
,
dics
:
[
'00'
,
"10"
,
"20"
]});
validation
.
check
(
params
,
"invoiceList"
,
{
name
:
"开票信息"
,
arr_require
:
true
});
...
...
@@ -205,7 +205,10 @@ class InvoiceCtl extends CtlBase {
for
(
let
invoice
of
invoiceList
)
{
creditCodes
.
push
(
invoice
.
credit_code
);
}
let
businessmenMap
=
await
this
.
orderSve
.
mapByCreditCodes
({
creditCodes
:
creditCodes
,
saas_merchant_id
:
params
.
saas_merchant_id
});
let
businessmenMap
=
await
this
.
orderSve
.
mapByCreditCodes
({
creditCodes
:
creditCodes
,
saas_merchant_id
:
params
.
saas_merchant_id
});
for
(
let
invoice
of
invoiceList
)
{
validation
.
check
(
businessmenMap
,
invoice
.
credit_code
,
{
name
:
`个体户[
${
invoice
.
credit_code
}
]`
,
is_require
:
true
});
...
...
@@ -214,6 +217,10 @@ class InvoiceCtl extends CtlBase {
let
applyList
=
[];
let
batch_no
=
await
this
.
redisClient
.
genrateId
(
"invoice_batch_no"
);
for
(
let
invoice
of
invoiceList
)
{
if
(
!
invoice
.
data_ids
)
{
return
system
.
getResult
(
null
,
"数据错误,请刷新重试"
);
}
let
bussinessmen
=
businessmenMap
[
invoice
.
credit_code
];
let
apply_no
=
await
this
.
redisClient
.
genrateId
(
"invoice_apply_no"
);
let
data
=
{
...
...
@@ -254,19 +261,25 @@ class InvoiceCtl extends CtlBase {
quantity
:
this
.
trim
(
invoice
.
quantity
),
price
:
this
.
trim
(
invoice
.
price
),
remark
:
this
.
trim
(
invoice
.
remark
),
data_ids
:
invoice
.
data_ids
,
};
applyList
.
push
(
data
);
}
let
rs
=
await
this
.
invoiceSve
.
applyBulkSave
({
fee_type
:
params
.
fee_type
,
dataList
:
applyList
,
parent_id
:
""
,
updateStatus
:
{
id
:
apply
.
id
,
preStatus
:
"1040"
,
status
:
"1060"
,
}
parent_id
:
""
});
if
(
rs
&&
rs
.
data
&&
rs
.
data
.
length
>
0
)
{
for
(
let
d
of
rs
.
data
)
{
console
.
log
(
d
.
id
,
d
.
data_ids
);
if
(
!
d
.
data_ids
)
{
continue
;
}
let
tradeIds
=
d
.
data_ids
.
split
(
","
);
await
this
.
tradeSve
.
updateInvoice
({
ids
:
tradeIds
,
saas_invoice_id
:
d
.
id
});
}
}
return
system
.
getResultSuccess
(
rs
);
}
catch
(
error
)
{
let
msg
=
error
.
message
;
...
...
@@ -279,7 +292,7 @@ class InvoiceCtl extends CtlBase {
// 功能1开票
async
apply00
(
params
,
pobj2
,
req
)
{
validation
.
check
(
params
,
'data_ids'
,
{
name
:
"
提示
信息"
,
arr_require
:
true
});
validation
.
check
(
params
,
'data_ids'
,
{
name
:
"
订单
信息"
,
arr_require
:
true
});
let
title
=
await
this
.
merchantSve
.
title
(
params
)
||
{};
title
=
title
.
data
||
{};
...
...
@@ -298,14 +311,14 @@ class InvoiceCtl extends CtlBase {
ids
:
params
.
data_ids
,
saas_merchant_id
:
params
.
saas_merchant_id
,
attrs
:
"id,price"
,
handle_status
:
[
'20'
,
'30'
],
handle_status
:
[
'20'
,
'30'
],
unInvoice
:
true
,
})
||
[];
if
(
orders
.
data
.
length
!=
params
.
data_ids
.
length
)
{
return
system
.
getResult
(
null
,
"订单数据选择有误,请重新搜索后选择"
);
}
let
invoice_amount
=
0
;
for
(
let
item
of
orders
.
data
)
{
for
(
let
item
of
orders
.
data
)
{
invoice_amount
=
invoice_amount
+
Number
(
item
.
price
||
0
);
}
...
...
@@ -348,9 +361,9 @@ class InvoiceCtl extends CtlBase {
mail_mobile
:
this
.
trim
(
addr
.
mail_mobile
),
mail_to
:
this
.
trim
(
addr
.
mail_to
),
invoice_amount
:
invoice_amount
,
service_tax
:
service_tax
,
invoice_amount
:
invoice_amount
,
service_tax
:
service_tax
,
data_ids
:
params
.
data_ids
.
join
(
","
),
};
data
=
await
this
.
invoiceSve
.
applySave
(
data
);
...
...
@@ -366,6 +379,7 @@ class InvoiceCtl extends CtlBase {
console
.
log
(
data
);
return
system
.
getResultSuccess
(
data
);
}
//发票申请列表
async
merchantinvoiceapplyPage
(
params
,
pobj2
,
req
)
{
try
{
...
...
@@ -448,7 +462,10 @@ class InvoiceCtl extends CtlBase {
bmMap
[
creditCode
]
=
list
;
creditCodes
.
push
(
creditCode
);
}
let
businessmenMap
=
await
this
.
orderSve
.
mapByCreditCodes
({
creditCodes
:
creditCodes
,
saas_merchant_id
:
params
.
saas_merchant_id
});
let
businessmenMap
=
await
this
.
orderSve
.
mapByCreditCodes
({
creditCodes
:
creditCodes
,
saas_merchant_id
:
params
.
saas_merchant_id
});
let
invoiceList
=
[];
let
calcParams
=
[];
...
...
@@ -457,8 +474,10 @@ class InvoiceCtl extends CtlBase {
let
businessmen
=
businessmenMap
[
creditCode
];
let
itemList
=
bmMap
[
creditCode
];
let
amount
=
0
;
let
data_ids
=
[];
for
(
let
item
of
itemList
)
{
amount
=
amount
+
Number
(
item
.
amt
||
0
);
data_ids
.
push
(
item
.
id
);
}
let
service_tax
=
parseFloat
((
Number
(
amount
)
*
Number
(
invoice_service_rate
)
/
100
).
toFixed
(
2
));
calcParams
.
push
({
...
...
@@ -482,7 +501,8 @@ class InvoiceCtl extends CtlBase {
"unit"
:
""
,
"quantity"
:
""
,
"price"
:
""
,
"remark"
:
""
"remark"
:
""
,
"data_ids"
:
data_ids
.
join
(
","
),
});
}
...
...
@@ -500,8 +520,8 @@ class InvoiceCtl extends CtlBase {
url
:
url
,
data
:
calcParams
});
if
(
!
res
||
!
res
.
data
||
res
.
data
.
status
!=
0
||
res
.
data
.
data
.
length
==
0
)
{
return
system
.
getResult
(
null
,
`试算错误`
);
if
(
!
res
||
!
res
.
data
||
res
.
data
.
status
!=
0
||
res
.
data
.
data
.
length
==
0
)
{
return
system
.
getResult
(
null
,
`试算错误`
);
}
let
calcList
=
res
.
data
.
data
;
...
...
@@ -543,7 +563,7 @@ class InvoiceCtl extends CtlBase {
});
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误`
);
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
}
...
...
xgg-saas-merchant/app/base/system.js
View file @
9bd9ef2b
...
...
@@ -197,7 +197,7 @@ class System {
order
:
dev
+
":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