Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c47147cd
authored
Dec 11, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
审核通过添加退款单
parent
31073704
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
17 deletions
app/Model/OrderServiceModel.php
config/order_service.php
resources/views/detail/order_service.blade.php
app/Model/OrderServiceModel.php
View file @
c47147cd
...
@@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Model;
...
@@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Model;
use
Request
;
use
Request
;
use
App\Model\UserMainModel
;
use
App\Model\UserMainModel
;
use
App\Model\OrderServiceLogModel
;
use
App\Model\OrderServiceLogModel
;
use
App\Http\Controllers\PermController
;
class
OrderServiceModel
extends
Model
class
OrderServiceModel
extends
Model
{
{
...
@@ -37,37 +38,40 @@ class OrderServiceModel extends Model
...
@@ -37,37 +38,40 @@ class OrderServiceModel extends Model
$map
[
'begin_time'
]
=
$request
->
input
(
'begin_time'
,
''
)
?
strtotime
(
$request
->
input
(
'begin_time'
))
:
''
;
$map
[
'begin_time'
]
=
$request
->
input
(
'begin_time'
,
''
)
?
strtotime
(
$request
->
input
(
'begin_time'
))
:
''
;
$map
[
'end_time'
]
=
$request
->
input
(
'end_time'
,
''
)
?
strtotime
(
$request
->
input
(
'end_time'
))
+
86399
:
''
;
$map
[
'end_time'
]
=
$request
->
input
(
'end_time'
,
''
)
?
strtotime
(
$request
->
input
(
'end_time'
))
+
86399
:
''
;
$list
=
$this
->
where
(
function
(
$query
)
use
(
$map
)
{
$perm
=
new
PermController
;
$role
=
$perm
->
getUserRole
(
$request
);
// 用户角色
$list
=
$this
->
where
(
function
(
$query
)
use
(
$map
,
$request
,
$role
)
{
// 售后单号
// 售后单号
if
(
$map
[
'service_sn'
])
{
if
(
$map
[
'service_sn'
])
{
$query
->
where
(
'service_sn'
,
'='
,
$map
[
'service_sn'
]);
$query
->
where
(
'service_sn'
,
'='
,
$map
[
'service_sn'
]);
}
}
})
->
where
(
function
(
$query
)
use
(
$map
)
{
// 订单号
// 订单号
if
(
$map
[
'order_sn'
])
{
if
(
$map
[
'order_sn'
])
{
$query
->
where
(
'order_sn'
,
'='
,
$map
[
'order_sn'
]);
$query
->
where
(
'order_sn'
,
'='
,
$map
[
'order_sn'
]);
}
}
})
->
where
(
function
(
$query
)
use
(
$map
)
{
// 申请人
// 申请人
if
(
$map
[
'apply_id'
])
{
if
(
$map
[
'apply_id'
])
{
$query
->
where
(
'apply_id'
,
'='
,
$map
[
'apply_id'
]);
$query
->
where
(
'apply_id'
,
'='
,
$map
[
'apply_id'
]);
}
}
})
->
where
(
function
(
$query
)
use
(
$map
)
{
// 售后状态
// 售后状态
if
(
$map
[
'service_status'
])
{
if
(
$map
[
'service_status'
])
{
$query
->
where
(
'service_status'
,
'='
,
$map
[
'service_status'
]);
$query
->
where
(
'service_status'
,
'='
,
$map
[
'service_status'
]);
}
}
})
->
where
(
function
(
$query
)
use
(
$map
)
{
// 退款状态
// 退款状态
if
(
$map
[
'refund_status'
])
{
if
(
$map
[
'refund_status'
])
{
$query
->
where
(
'refund_status'
,
'='
,
$map
[
'refund_status'
]);
$query
->
where
(
'refund_status'
,
'='
,
$map
[
'refund_status'
]);
}
}
})
->
where
(
function
(
$query
)
use
(
$map
)
{
// 退货状态
// 退货状态
if
(
$map
[
'return_status'
])
{
if
(
$map
[
'return_status'
])
{
$query
->
where
(
'return_status'
,
'='
,
$map
[
'return_status'
]);
$query
->
where
(
'return_status'
,
'='
,
$map
[
'return_status'
]);
}
}
})
->
where
(
function
(
$query
)
use
(
$map
)
{
// 创建时间
// 创建时间
if
(
!
empty
(
$map
[
'begin_time'
])
&&
!
empty
(
$map
[
'end_time'
]))
{
if
(
!
empty
(
$map
[
'begin_time'
])
&&
!
empty
(
$map
[
'end_time'
]))
{
$query
->
whereBetween
(
'create_time'
,
[
$map
[
'begin_time'
],
$map
[
'end_time'
]]);
$query
->
whereBetween
(
'create_time'
,
[
$map
[
'begin_time'
],
$map
[
'end_time'
]]);
...
@@ -78,6 +82,17 @@ class OrderServiceModel extends Model
...
@@ -78,6 +82,17 @@ class OrderServiceModel extends Model
else
if
(
!
empty
(
$map
[
'end_time'
]))
{
else
if
(
!
empty
(
$map
[
'end_time'
]))
{
$query
->
where
(
'create_time'
,
'<='
,
$map
[
'end_time'
]);
$query
->
where
(
'create_time'
,
'<='
,
$map
[
'end_time'
]);
}
}
switch
(
$role
)
{
case
2
:
// 查看下级
$sub_sale_ids
=
$perm
->
getSubSaleId
(
$request
->
user
->
userId
);
$query
->
whereIn
(
'apply_id'
,
$sub_sale_ids
);
break
;
case
3
:
case
5
:
// 查看自己
$query
->
where
(
'apply_id'
,
$request
->
user
->
userId
);
break
;
}
})
})
->
orderBy
(
'id'
,
'desc'
);
->
orderBy
(
'id'
,
'desc'
);
// $tmp = str_replace('?', '"'.'%s'.'"', $list->toSql());
// $tmp = str_replace('?', '"'.'%s'.'"', $list->toSql());
...
@@ -131,20 +146,34 @@ class OrderServiceModel extends Model
...
@@ -131,20 +146,34 @@ class OrderServiceModel extends Model
$data
[
'service_status'
]
=
$request
->
input
(
'service_status'
,
1
);
$data
[
'service_status'
]
=
$request
->
input
(
'service_status'
,
1
);
$data
[
'update_time'
]
=
time
();
$data
[
'update_time'
]
=
time
();
if
(
$data
[
'service_status'
]
==
3
)
{
switch
(
$data
[
'service_status'
])
{
case
-
1
:
$event
=
'取消售后申请'
;
break
;
case
2
:
$event
=
'提交售后申请'
;
break
;
case
3
:
$event
=
'审核通过售后申请'
;
break
;
}
if
(
$data
[
'service_status'
]
==
3
)
{
// 审核通过
$data
[
'auditor_id'
]
=
$request
->
user
->
userId
;
$data
[
'auditor_id'
]
=
$request
->
user
->
userId
;
$data
[
'auditor_name'
]
=
$request
->
user
->
name
;
$data
[
'auditor_name'
]
=
$request
->
user
->
name
;
$data
[
'auditor_time'
]
=
time
();
$data
[
'auditor_time'
]
=
time
();
}
$this
->
where
(
'id'
,
$id
)
->
update
(
$data
);
// 生成退款单
$post
=
[];
$post
[
'id'
]
=
$id
;
$post
[
'k1'
]
=
time
();
$post
[
'k2'
]
=
md5
(
md5
(
$post
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$post
[
'operator_id'
]
=
$request
->
user
->
userId
;
switch
(
$data
[
'service_status'
])
{
$url
=
Config
(
'website.api_domain'
)
.
'refund/apply'
;
case
-
1
:
$event
=
'取消申请'
;
break
;
case
2
:
$event
=
'提交申请'
;
break
;
$res
=
json_decode
(
curlApi
(
$url
,
$post
,
'POST'
),
true
);
case
3
:
$event
=
'审核通过申请'
;
break
;
if
(
!
$res
||
$res
[
'err_code'
]
!=
0
)
return
[
-
2
,
'审核通过生成退款单失败'
];
$event
.=
',生成退款单,退款单号:'
.
$res
[
'data'
];
}
}
$this
->
where
(
'id'
,
$id
)
->
update
(
$data
);
OrderServiceLogModel
::
addLog
(
$id
,
$request
->
user
->
userId
,
$event
);
OrderServiceLogModel
::
addLog
(
$id
,
$request
->
user
->
userId
,
$event
);
return
[
0
,
'成功'
];
return
[
0
,
'成功'
];
...
...
config/order_service.php
View file @
c47147cd
...
@@ -22,10 +22,14 @@ return [
...
@@ -22,10 +22,14 @@ return [
3
=>
'已入库'
,
3
=>
'已入库'
,
],
],
//
退货状态
//
申请原因
'apply_reason'
=>
[
'apply_reason'
=>
[
1
=>
'型号下错'
,
1
=>
'批次不符'
,
2
=>
'测试单'
,
2
=>
'质量问题'
,
3
=>
'包装问题'
,
4
=>
'客户取消'
,
5
=>
'库存不足'
,
6
=>
'其他'
,
],
],
...
...
resources/views/detail/order_service.blade.php
View file @
c47147cd
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][rec_id]"
value=
"{{ $v['rec_id'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][rec_id]"
value=
"{{ $v['rec_id'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][goods_id]"
value=
"{{ $v['goods_id'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][goods_id]"
value=
"{{ $v['goods_id'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][goods_name]"
value=
"{{ $v['goods_name'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][goods_name]"
value=
"{{ $v['goods_name'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][sku_name]"
value=
"{{ $v['sku_name'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][brand_id]"
value=
"{{ $v['brand_id'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][brand_id]"
value=
"{{ $v['brand_id'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][brand_name]"
value=
"{{ $v['brand_name'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][brand_name]"
value=
"{{ $v['brand_name'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][supplier_id]"
value=
"{{ $v['supplier_id'] }}"
>
<input
type=
"hidden"
name=
"service_item[{{ $v['rec_id'] }}][supplier_id]"
value=
"{{ $v['supplier_id'] }}"
>
...
...
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