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
bf89fd19
authored
Dec 21, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加编辑功能
parent
5249e781
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
230 additions
and
14 deletions
app/Http/Controllers/ApiController.php
app/Model/OrderServiceModel.php
public/js/order_service.js
public/js/web/orderServiceList.js
resources/views/common/order_service.blade.php
resources/views/table/js.blade.php
resources/views/web/orderServiceList.blade.php
app/Http/Controllers/ApiController.php
View file @
bf89fd19
...
...
@@ -448,6 +448,13 @@ class ApiController extends Controller
$this
->
Export
(
$OrderServiceModel
->
action
(
$request
));
}
// 售后单编辑
public
function
ApiOrderServiceEdit
(
$request
)
{
$OrderServiceModel
=
new
OrderServiceModel
;
$this
->
Export
(
$OrderServiceModel
->
edit
(
$request
));
}
// 售后单明细列表
public
function
ApiOrderServiceItemsList
(
$request
)
{
...
...
app/Model/OrderServiceModel.php
View file @
bf89fd19
...
...
@@ -4,6 +4,7 @@ namespace App\Model;
use
Illuminate\Database\Eloquent\Model
;
use
Request
;
use
App\Model\UserMainModel
;
use
App\Model\OrderServiceItemsModel
;
use
App\Model\OrderServiceLogModel
;
use
App\Http\Controllers\PermController
;
...
...
@@ -23,7 +24,7 @@ class OrderServiceModel extends Model
return
strtotime
(
parent
::
fromDateTime
(
$value
));
}
// 获取
领取
列表
// 获取列表
public
function
lists
(
$request
,
$export
=
''
)
{
$page
=
$request
->
input
(
'page'
,
1
);
...
...
@@ -121,6 +122,7 @@ class OrderServiceModel extends Model
if
(
!
$data
)
return
false
;
$UserMainModel
=
new
UserMainModel
;
$OrderServiceItemsModel
=
new
OrderServiceItemsModel
;
foreach
(
$data
as
&
$v
)
{
$user
=
$UserMainModel
->
getUserAccount
(
$v
[
'user_id'
]);
...
...
@@ -130,6 +132,10 @@ class OrderServiceModel extends Model
$v
[
'refund_status_val'
]
=
array_get
(
Config
(
'order_service.refund_status'
),
$v
[
'refund_status'
],
''
);
$v
[
'return_status_val'
]
=
array_get
(
Config
(
'order_service.return_status'
),
$v
[
'return_status'
],
''
);
$v
[
'auditor_time'
]
=
$v
[
'auditor_time'
]
?
date
(
'Y-m-d H:i:s'
,
$v
[
'auditor_time'
])
:
''
;
if
(
$v
[
'service_status'
]
==
1
)
{
$v
[
'items'
]
=
$OrderServiceItemsModel
->
where
(
'service_id'
,
$v
[
'id'
])
->
get
()
->
toArray
();
}
}
return
$data
;
...
...
@@ -179,5 +185,42 @@ class OrderServiceModel extends Model
return
[
0
,
'成功'
];
}
// 编辑
public
function
edit
(
$request
)
{
$id
=
$request
->
input
(
'id'
);
$event
=
'编辑售后单'
;
$info
=
$this
->
find
(
$id
);
$event
.=
',修改前---申请理由:'
.
array_get
(
Config
(
'order_service.apply_reason'
),
$info
[
'apply_reason'
],
''
)
.
',备注:'
.
$info
[
'remark'
];
$order_service
[
'apply_reason'
]
=
$request
->
input
(
'apply_reason'
);
$order_service
[
'remark'
]
=
$request
->
input
(
'remark'
);
$res
=
$this
->
where
(
'id'
,
$id
)
->
update
(
$order_service
);
if
(
$res
===
false
)
return
[
-
1
,
'更新订单售后表失败'
];
$service_items
=
$request
->
input
(
'service_item'
);
$OrderServiceItemsModel
=
new
OrderServiceItemsModel
;
$event
.=
',售后明细:'
;
foreach
(
$service_items
as
$k
=>
$v
)
{
$item
=
$OrderServiceItemsModel
->
find
(
$k
);
$event
.=
'['
.
$item
[
'goods_name'
]
.
' | '
.
$item
[
'adjust_number'
]
.
' | '
.
$item
[
'adjust_price'
]
.
'] '
;
$v
[
'update_time'
]
=
time
();
$res
=
$OrderServiceItemsModel
->
where
(
'id'
,
$k
)
->
update
(
$v
);
if
(
$res
===
false
)
return
[
-
1
,
'更新订单售后明细表失败'
];
}
OrderServiceLogModel
::
addLog
(
$id
,
$request
->
user
->
userId
,
$event
);
return
[
0
,
'成功'
];
}
}
\ No newline at end of file
public/js/order_service.js
View file @
bf89fd19
...
...
@@ -112,7 +112,7 @@
})
// 数量输入校验
$
(
'.adjust_number'
).
keyup
(
function
()
{
$
(
document
).
delegate
(
'.adjust_number'
,
'keyup'
,
function
()
{
var
val
=
$
(
this
).
val
();
if
(
!
val
)
return
false
;
...
...
@@ -146,7 +146,7 @@
})
// 单价输入校验
$
(
'.adjust_price'
).
keyup
(
function
()
{
$
(
document
).
delegate
(
'.adjust_price'
,
'keyup'
,
function
()
{
var
val
=
$
(
this
).
val
();
if
(
!
val
)
return
false
;
...
...
@@ -183,7 +183,10 @@
return
false
;
}
}).
blur
(
function
()
{
})
// 单价输入校验
$
(
document
).
delegate
(
'.adjust_price'
,
'blur'
,
function
()
{
var
val
=
$
(
this
).
val
();
if
(
!
val
)
return
false
;
...
...
public/js/web/orderServiceList.js
View file @
bf89fd19
...
...
@@ -57,39 +57,138 @@ layui.use(['form', 'table', 'laydate'], function(){
var
data
=
obj
.
data
;
//获得当前行数据
var
layEvent
=
obj
.
event
;
//获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
var
tr
=
obj
.
tr
;
//获得当前行 tr 的DOM对象
var
type
=
0
;
var
area
=
'auto'
;
var
title
=
''
;
var
content
=
''
;
var
url
=
'/api/ApiOrderServiceAction'
;
var
datax
=
[];
if
(
layEvent
===
'submit'
){
// 提交
if
(
layEvent
===
'submit'
){
// 提交
title
=
'提交申请'
;
content
=
'确定提交该申请吗?'
;
datax
=
{
id
:
data
.
id
,
service_status
:
2
};
}
else
if
(
layEvent
===
'audit'
){
// 审核
}
else
if
(
layEvent
===
'audit'
){
// 审核
title
=
'审核申请'
;
content
=
'确定审核该申请吗?'
;
datax
=
{
id
:
data
.
id
,
service_status
:
3
};
}
else
if
(
layEvent
===
'cancel'
){
// 取消
}
else
if
(
layEvent
===
'cancel'
){
// 取消
title
=
'取消申请'
;
content
=
'确定取消该申请吗?'
;
datax
=
{
id
:
data
.
id
,
service_status
:
-
1
};
}
else
if
(
layEvent
===
'confirm'
){
// 确认退款
}
else
if
(
layEvent
===
'confirm'
){
// 确认退款
title
=
'确认退款'
;
content
=
'确认已退款吗?'
;
url
=
'/api/ApiConfirmRefund'
;
datax
=
{
id
:
data
.
id
};
}
else
if
(
layEvent
===
'edit'
){
// 编辑
type
=
1
;
area
=
[
'1000px'
,
'600px'
];
title
=
'编辑申请'
;
content
=
$
(
'.order_service_info'
);
// 填充内容
$
(
'.apply_reason'
).
val
(
data
.
apply_reason
);
$
(
'.remark'
).
val
(
data
.
remark
);
var
html
=
''
;
var
items
=
data
.
items
;
var
len
=
items
.
length
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
html
+=
'<tr>\
<input type="hidden" class="single_pre_price" name="service_item['
+
items
[
i
].
id
+
'][single_pre_price]" value="'
+
items
[
i
].
single_pre_price
+
'">\
<td>'
+
(
i
+
1
)
+
'</td>\
<td>'
+
items
[
i
].
goods_name
+
'</td>\
<td>'
+
items
[
i
].
brand_name
+
'</td>\
<td class="origin-goods-number">'
+
items
[
i
].
goods_number
+
'</td>\
<td>'
+
items
[
i
].
removal_number
+
'</td>\
<td class="origin-goods-price">'
+
items
[
i
].
goods_price
+
'</td>\
<td class="service-goods-number"></td>'
;
if
(
items
[
i
].
adjust_number
!=
0
)
{
html
+=
'<td><input type="text" class="adjust_number" name="service_item['
+
items
[
i
].
id
+
'][adjust_number]" value="'
+
items
[
i
].
adjust_number
+
'"></td>'
;
}
else
{
html
+=
'<td><input type="text" class="adjust_number" name="service_item['
+
items
[
i
].
id
+
'][adjust_number]"></td>'
;
}
if
(
items
[
i
].
adjust_price
!=
0.000000
)
{
html
+=
'<td><input type="text" class="adjust_price" name="service_item['
+
items
[
i
].
id
+
'][adjust_price]" value="'
+
items
[
i
].
adjust_price
+
'"></td>'
;
}
else
{
html
+=
'<td><input type="text" class="adjust_price" name="service_item['
+
items
[
i
].
id
+
'][adjust_price]"></td>'
;
}
html
+=
'</tr>'
;
}
$
(
'.order-service-table tbody'
).
html
(
html
);
url
=
'/api/ApiOrderServiceEdit'
;
}
layer
.
open
({
type
:
type
,
area
:
area
,
title
:
title
,
content
:
content
,
btn
:
[
'确认'
,
'取消'
],
yes
:
function
(
index
)
{
if
(
layEvent
==
'edit'
)
{
var
apply_reason
=
$
(
'.apply_reason'
).
val
();
var
remark
=
$
(
'.remark'
).
val
();
var
is_all_num_empty
=
false
;
// 校验全部申请数量是否为空
var
is_all_price_empty
=
false
;
// 校验全部单价是否为空
if
(
!
apply_reason
)
{
layer
.
tips
(
'请选择申请原因'
,
$
(
'.apply_reason'
));
return
false
;
}
if
(
!
remark
)
{
layer
.
tips
(
'请填写备注'
,
$
(
'.remark'
));
return
false
;
}
var
is_one_empty
=
false
;
// 同一行的售后数量或单价中一个为空
$
(
'.order-service-table'
).
find
(
'tbody tr'
).
each
(
function
()
{
var
goods_number
=
$
(
this
).
find
(
'.adjust_number'
).
val
();
var
goods_price
=
$
(
this
).
find
(
'.adjust_price'
).
val
();
if
(
!
goods_number
&&
goods_price
)
{
layer
.
tips
(
'请填写数量'
,
$
(
this
).
find
(
'.adjust_number'
));
is_one_empty
=
true
;
return
false
;
}
if
(
goods_number
&&
!
goods_price
)
{
layer
.
tips
(
'请填写单价'
,
$
(
this
).
find
(
'.adjust_price'
));
is_one_empty
=
true
;
return
false
;
}
if
(
goods_number
)
is_all_num_empty
=
true
;
if
(
goods_price
)
is_all_price_empty
=
true
;
})
if
(
is_one_empty
)
return
false
;
if
(
!
is_all_num_empty
)
{
layer
.
msg
(
'请填写申请数量'
);
return
false
;
}
if
(
!
is_all_price_empty
)
{
layer
.
msg
(
'请填写售后单价'
);
return
false
;
}
datax
=
$
(
'.orderServiceForm'
).
serialize
()
+
'&id='
+
data
.
id
;
}
$
.
ajax
({
url
:
url
,
type
:
'post'
,
...
...
@@ -105,6 +204,7 @@ layui.use(['form', 'table', 'laydate'], function(){
return
false
;
}
layer
.
close
(
index
)
layer
.
alert
(
resp
.
errmsg
);
},
error
:
function
(
err
)
{
...
...
resources/views/common/order_service.blade.php
0 → 100644
View file @
bf89fd19
<style>
.order_service_info
{
display
:
none
;
}
.orderServiceForm
{
padding
:
20px
;
}
.apply_reason
{
width
:
300px
;
}
.orderServiceForm
textarea
{
width
:
300px
;
padding
:
6px
5px
;
border
:
1px
solid
#ccc
;
border-radius
:
4px
;
resize
:
none
;
}
.orderServiceForm
input
{
width
:
120px
;
height
:
34px
;
}
</style>
<div
class=
"order_service_info"
>
<form
class=
"form-horizontal orderServiceForm"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
><i
class=
"text-danger"
>
*
</i>
申请原因:
</label>
<div
class=
"col-sm-9"
>
<select
class=
"form-control apply_reason"
name=
"apply_reason"
>
<option
value=
""
></option>
@if (Config('order_service.apply_reason'))
@foreach (Config('order_service.apply_reason') as $k=>$v)
<option
value=
"{{ $k }}"
>
{{ $v }}
</option>
@endforeach
@endif
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
><i
class=
"text-danger"
>
*
</i>
原因备注:
</label>
<div
class=
"col-sm-9"
>
<textarea
class=
"form-control remark"
name=
"remark"
placeholder=
"请填写备注"
cols=
"60"
rows=
"3"
></textarea>
</div>
</div>
<div
class=
"form-group"
>
<a
class=
"btn btn-info select-all"
>
全退
</a>
</div>
<div
class=
"form-group"
>
<table
class=
"table table-bordered order-service-table"
>
<thead>
<tr>
<th
width=
"5%"
></th>
<th
width=
"20%"
>
型号
</th>
<th
width=
"20%"
>
品牌
</th>
<th
width=
"8%"
>
订单数量
</th>
<th
width=
"8%"
>
出库数量
</th>
<th
width=
"8%"
>
原单价
</th>
<th
width=
"10%"
>
已售后数量
</th>
<th
width=
"8%"
>
申请数量
</th>
<th
width=
"8%"
>
售后单价
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</form>
</div>
<script
src=
"/js/order_service.js?v={{time()}}"
></script>
<script>
$
.
lie
.
order_service
.
index
();
</script>
\ No newline at end of file
resources/views/table/js.blade.php
View file @
bf89fd19
<script
src=
"/js/bootstrap.min.js"
></script>
<script
src=
"/js/plugins/slimscroll/jquery.slimscroll.min.js"
></script>
<script
src=
"/js/plugins/metisMenu/jquery.metisMenu.js"
></script>
<script
src=
"/js/bootstrap.min.js"
></script>
<script
src=
"/js/plugins/slimscroll/jquery.slimscroll.min.js"
></script>
<script
src=
"/js/plugins/metisMenu/jquery.metisMenu.js"
></script>
<script
src=
"/js/inspinia.min.js"
></script>
\ No newline at end of file
resources/views/web/orderServiceList.blade.php
View file @
bf89fd19
...
...
@@ -121,7 +121,8 @@
<
a
class
=
"btn btn-xs btn-outline btn-info"
href
=
"/web/orderServiceDetails?id=@{{ d.id }}"
target
=
"_blank"
>
详情
<
/a
>
@{{
#
if
(
d
.
service_status
==
1
)
{
}}
<
a
class
=
"btn btn-xs btn-outline btn-success"
lay
-
event
=
"submit"
>
提交
<
/a
>
<
a
class
=
"btn btn-xs btn-outline btn-success"
lay
-
event
=
"edit"
>
编辑
<
/a
>
<
a
class
=
"btn btn-xs btn-outline btn-warning"
lay
-
event
=
"submit"
>
提交
<
/a
>
<
a
class
=
"btn btn-xs btn-outline btn-danger"
lay
-
event
=
"cancel"
>
取消
<
/a
>
@{{
#
}
else
if
(
d
.
service_status
==
2
)
{
}}
<?php
if
(
in_array
(
$role
,
[
1
,
2
]))
{
?>
...
...
@@ -131,5 +132,6 @@
@{{
#
}
else
if
(
d
.
service_status
==
3
&&
d
.
refund_status
!=
3
)
{
}}
<
a
class
=
"btn btn-xs btn-outline btn-success"
lay
-
event
=
"confirm"
>
确认退款
<
/a
>
@{{
#
}
}}
</script>
</script>
\ No newline at end of file
@include('common.order_service')
\ No newline at end of file
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