Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openApi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hj
openApi
Commits
7a949730
Commit
7a949730
authored
Jul 23, 2025
by
hj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新提交0
parent
495a26aa
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
127 additions
and
1 deletion
+127
-1
server/app/Http/Controllers/Swagger/Responses/Rhawn/Properties/OrdersDetailProperty.php
...agger/Responses/Rhawn/Properties/OrdersDetailProperty.php
+10
-0
server/app/Http/Controllers/Swagger/Responses/Rhawn/Properties/OrdersDispatchProperty.php
...ger/Responses/Rhawn/Properties/OrdersDispatchProperty.php
+10
-0
server/app/Repositories/Transformers/Rhawn/OrderDetailTransformer.php
...epositories/Transformers/Rhawn/OrderDetailTransformer.php
+1
-0
server/app/Rhawn/Repositories/Eloquent/RhawnCustomerRepositoryEloquent.php
...Repositories/Eloquent/RhawnCustomerRepositoryEloquent.php
+30
-0
server/app/Rhawn/Services/RhawnCustomerService.php
server/app/Rhawn/Services/RhawnCustomerService.php
+14
-0
server/app/Rhawn/Services/RhawnOrdersService.php
server/app/Rhawn/Services/RhawnOrdersService.php
+1
-1
server/app/Services/Api/RhawnOrdersService.php
server/app/Services/Api/RhawnOrdersService.php
+61
-0
No files found.
server/app/Http/Controllers/Swagger/Responses/Rhawn/Properties/OrdersDetailProperty.php
View file @
7a949730
...
@@ -76,6 +76,16 @@ class OrdersDetailProperty
...
@@ -76,6 +76,16 @@ class OrdersDetailProperty
*/
*/
public
$siAmount
;
public
$siAmount
;
/**
* @Property(
* type="number",
* description="代金券抵扣金额"
* )
*
* @var string
*/
public
$siVamount
;
/**
/**
* @Property(
* @Property(
* type="string",
* type="string",
...
...
server/app/Http/Controllers/Swagger/Responses/Rhawn/Properties/OrdersDispatchProperty.php
View file @
7a949730
...
@@ -85,4 +85,14 @@ class OrdersDispatchProperty
...
@@ -85,4 +85,14 @@ class OrdersDispatchProperty
* @var string
* @var string
*/
*/
public
$cas
;
public
$cas
;
/**
* @Property(
* type="string",
* description="批次号"
* )
*
* @var string
*/
public
$pstkNo
;
}
}
server/app/Repositories/Transformers/Rhawn/OrderDetailTransformer.php
View file @
7a949730
...
@@ -65,6 +65,7 @@ class OrderDetailTransformer extends TransformerAbstract
...
@@ -65,6 +65,7 @@ class OrderDetailTransformer extends TransformerAbstract
$tempItems
[
'si_discount'
]
=
$item
[
'si_discount'
];
$tempItems
[
'si_discount'
]
=
$item
[
'si_discount'
];
$tempItems
[
'si_num'
]
=
$item
[
'si_num'
];
$tempItems
[
'si_num'
]
=
$item
[
'si_num'
];
$tempItems
[
'si_amount'
]
=
$item
[
'si_amount'
];
$tempItems
[
'si_amount'
]
=
$item
[
'si_amount'
];
$tempItems
[
'si_vamount'
]
=
$item
[
'si_vamount'
];
$tempItems
[
'p_code'
]
=
$item
[
'p_code'
];
$tempItems
[
'p_code'
]
=
$item
[
'p_code'
];
$tempItems
[
'p_cn_name'
]
=
$item
[
'p_cn_name'
];
$tempItems
[
'p_cn_name'
]
=
$item
[
'p_cn_name'
];
$tempItems
[
'p_level'
]
=
$item
[
'p_level'
];
$tempItems
[
'p_level'
]
=
$item
[
'p_level'
];
...
...
server/app/Rhawn/Repositories/Eloquent/RhawnCustomerRepositoryEloquent.php
View file @
7a949730
...
@@ -118,4 +118,34 @@ class RhawnCustomerRepositoryEloquent extends BaseRepository implements RhawnCus
...
@@ -118,4 +118,34 @@ class RhawnCustomerRepositoryEloquent extends BaseRepository implements RhawnCus
}
}
return
null
;
return
null
;
}
}
public
function
getCustomerRebate
(
$cusCode
)
{
$customerCrStatus
=
RhawnCustomer
::
query
()
->
join
(
'cusrebate'
,
'customers.cus_id'
,
'cusrebate.cus_id'
)
->
where
(
'customers.cus_no'
,
$cusCode
)
->
get
();
if
(
$customerCrStatus
){
$customerCrStatus
=
$customerCrStatus
->
toArray
();
if
(
!
empty
(
$customerCrStatus
)
&&
current
(
$customerCrStatus
)[
'cr_status'
]
==
3
){
return
true
;
}
}
return
false
;
}
public
function
getCustomerVoucherList
(
$cusCode
)
{
$customerVoucherList
=
RhawnCustomer
::
query
()
->
join
(
'voucher'
,
'customers.cus_id'
,
'voucher.cus_id'
)
->
where
(
'customers.cus_no'
,
$cusCode
)
->
where
(
'voucher.so_id'
,
0
)
->
orderBy
(
'voucher.v_amount'
,
'DESC'
)
->
get
();
if
(
$customerVoucherList
){
return
$customerVoucherList
->
toArray
();
}
return
null
;
}
}
}
server/app/Rhawn/Services/RhawnCustomerService.php
View file @
7a949730
...
@@ -50,4 +50,18 @@ class RhawnCustomerService
...
@@ -50,4 +50,18 @@ class RhawnCustomerService
}
}
return
$customer
;
return
$customer
;
}
}
/**
* 获取客户代金券信息
* @param $cusCode
* @return void|null
*/
public
function
getCustomerVoucherList
(
$cusCode
)
{
$customerRebate
=
$this
->
customerRepository
->
getCustomerRebate
(
$cusCode
);
if
(
$customerRebate
){
return
null
;
}
return
$this
->
customerRepository
->
getCustomerVoucherList
(
$cusCode
);
}
}
}
server/app/Rhawn/Services/RhawnOrdersService.php
View file @
7a949730
...
@@ -168,7 +168,7 @@ class RhawnOrdersService
...
@@ -168,7 +168,7 @@ class RhawnOrdersService
$connection
->
table
(
'soitems'
)
->
insert
(
$soitems
);
$connection
->
table
(
'soitems'
)
->
insert
(
$soitems
);
if
(
$data
[
'v_id'
]
!=
''
){
if
(
$data
[
'v_id'
]
!=
''
){
$
orderId
=
$
connection
->
table
(
'voucher'
)
$connection
->
table
(
'voucher'
)
->
where
(
'v_id'
,
$data
[
'v_id'
])
->
where
(
'v_id'
,
$data
[
'v_id'
])
->
update
([
->
update
([
'so_id'
=>
$orderId
'so_id'
=>
$orderId
...
...
server/app/Services/Api/RhawnOrdersService.php
View file @
7a949730
...
@@ -201,7 +201,33 @@ class RhawnOrdersService
...
@@ -201,7 +201,33 @@ class RhawnOrdersService
$data
[
'express'
]
=
$express
;
$data
[
'express'
]
=
$express
;
$data
[
'v_id'
]
=
''
;
$data
[
'v_id'
]
=
''
;
$data
[
'soitems'
]
=
[];
$data
[
'soitems'
]
=
[];
//如果使用代金券
$equalVoucherList
=
[];
if
(
!
empty
(
$requestParams
[
'use_voucher'
])
&&
$requestParams
[
'use_voucher'
]
==
1
){
$voucherList
=
$this
->
rhawnCustomerService
->
getCustomerVoucherList
(
$customer
[
'cus_no'
]);
//找到最合适的代金券
if
(
$voucherList
){
foreach
(
$voucherList
as
$voucher
){
if
(
$data
[
'sorders'
][
'so_total'
]
>=
$voucher
[
'v_cond'
]){
if
(
empty
(
$equalVoucherList
[
$voucher
[
'v_cond'
]][
$voucher
[
'v_amount'
]])){
$equalVoucherList
[
$voucher
[
'v_cond'
]][
$voucher
[
'v_amount'
]]
=
$voucher
;
}
}
}
if
(
!
empty
(
$equalVoucherList
)){
asort
(
$equalVoucherList
);
$equalVoucherList
=
current
(
current
(
$equalVoucherList
));
}
}
}
if
(
!
empty
(
$equalVoucherList
)){
$v_amount
=
0
;
$num
=
count
(
$orderItems
[
'rows'
]);
$data
[
'v_id'
]
=
$equalVoucherList
[
'v_id'
];
}
foreach
(
$orderItems
[
'rows'
]
as
$k
=>
$v
){
foreach
(
$orderItems
[
'rows'
]
as
$k
=>
$v
){
$soitem
=
[];
$soitem
=
[];
$soitem
[
'p_id'
]
=
$v
[
'product_info'
][
'p_id'
];
$soitem
[
'p_id'
]
=
$v
[
'product_info'
][
'p_id'
];
$soitem
[
'si_price'
]
=
$v
[
'product_info'
][
'p_price'
];
$soitem
[
'si_price'
]
=
$v
[
'product_info'
][
'p_price'
];
...
@@ -219,8 +245,43 @@ class RhawnOrdersService
...
@@ -219,8 +245,43 @@ class RhawnOrdersService
if
(
isset
(
$v
[
'si_molbase_pog'
])){
if
(
isset
(
$v
[
'si_molbase_pog'
])){
$soitem
[
'si_molbase_pog'
]
=
$v
[
'si_molbase_pog'
];
$soitem
[
'si_molbase_pog'
]
=
$v
[
'si_molbase_pog'
];
}
}
if
(
!
empty
(
$equalVoucherList
)){
if
(
$num
==
1
)
{
$tmp_amount
=
$v
[
'amount'
]
-
$equalVoucherList
[
'v_amount'
];
$si_discount
=
bcdiv
(
$tmp_amount
,
$v
[
'num'
],
1
);
//抵扣后的折后价
$si_amount
=
bcmul
(
$si_discount
,
$v
[
'num'
],
2
);
//抵扣后的小计
$this_v_amount
=
bcsub
(
$v
[
'amount'
],
$si_amount
,
2
);
//最终抵扣金额
}
else
{
if
((
$k
+
1
)
!=
$num
)
{
$rate
=
bcdiv
(
$v
[
'amount'
],
$data
[
'sorders'
][
'so_total'
],
3
);
$this_v_amount
=
round
(
bcmul
(
$rate
,
$equalVoucherList
[
'v_amount'
]));
//计算抵扣代金券总额的比例
$tmp_amount
=
$v
[
'amount'
]
-
$this_v_amount
;
$si_discount
=
bcdiv
(
$tmp_amount
,
$v
[
'num'
],
1
);
//抵扣后的折后价
$si_amount
=
bcmul
(
$si_discount
,
$v
[
'num'
],
2
);
//抵扣后的小计
$this_v_amount
=
bcsub
(
$v
[
'amount'
],
$si_amount
,
2
);
//最终抵扣金额
}
else
{
$this_v_amount
=
$equalVoucherList
[
'v_amount'
]
-
$v_amount
;
$tmp_amount
=
$v
[
'amount'
]
-
$this_v_amount
;
$si_discount
=
bcdiv
(
$tmp_amount
,
$v
[
'num'
],
1
);
//抵扣后的折后价
$si_amount
=
bcmul
(
$si_discount
,
$v
[
'num'
],
2
);
//抵扣后的小计
$this_v_amount
=
bcsub
(
$v
[
'amount'
],
$si_amount
,
2
);
//最终抵扣金额
}
}
$v_amount
+=
$this_v_amount
;
$soitem
[
'si_discount'
]
=
$si_discount
;
$soitem
[
'si_amount'
]
=
$si_amount
;
$soitem
[
'si_vamount'
]
=
$this_v_amount
;
//$data['sorders']['so_total'] = bcsub($data['sorders']['so_total'] , $v_amount , 2);
}
array_push
(
$data
[
'soitems'
],
$soitem
);
array_push
(
$data
[
'soitems'
],
$soitem
);
}
}
if
(
!
empty
(
$data
[
'v_id'
])){
$data
[
'sorders'
][
'so_total'
]
=
bcsub
(
$data
[
'sorders'
][
'so_total'
]
,
$v_amount
,
2
);
}
$orderId
=
$this
->
rhawnOrdersService
->
createOrders
(
$data
);
$orderId
=
$this
->
rhawnOrdersService
->
createOrders
(
$data
);
if
(
$orderId
){
if
(
$orderId
){
...
...
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