Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
yunxin
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
ea23a175
authored
Apr 04, 2019
by
PRY5YKGJ82EZEPX\Administrator
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
v1.0
parent
5b9f3348
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
203 additions
and
94 deletions
app/Http/Controllers/ApiController.php
app/Http/Controllers/HandleController.php
app/Jobs/JopExportAbnormlList.php
public/pc/js/controller/AbnormalList.js
public/pc/js/controller/OrderList.js
resources/views/pc/AbnormalDetail.blade.php
resources/views/pc/AbnormalList.blade.php
resources/views/pc/OrderDetail.blade.php
resources/views/pc/OrderList.blade.php
app/Http/Controllers/ApiController.php
View file @
ea23a175
...
...
@@ -2,6 +2,7 @@
namespace
App\Http\Controllers
;
use
App\Jobs\JopExportAbnormlList
;
use
App\Jobs\JopExportGoodsList
;
use
App\Jobs\JopExportOrderList
;
use
App\Model\CommonModel
;
...
...
@@ -61,9 +62,11 @@ class ApiController extends Controller
private
function
ApiOrderDetail
(
$request
,
$id
){
(
new
ServerPurModel
(
$request
->
appid
,
$request
->
key
))
->
OrderDetail
(
$request
->
input
());
}
//退货列表
//退货列表
(寄售)
private
function
ApiAbnormalList
(
$request
,
$id
){
(
new
ServerPurModel
(
$request
->
appid
,
$request
->
key
))
->
AbnormalList
(
$request
->
input
());
$data
=
$request
->
input
();
$data
[
'picking_type'
]
=
2
;
//寄售类型
(
new
ServerPurModel
(
$request
->
appid
,
$request
->
key
))
->
AbnormalList
(
$data
);
}
//退货详情
private
function
ApiAbnormalDetail
(
$request
,
$id
){
...
...
@@ -71,7 +74,12 @@ class ApiController extends Controller
}
//退货列表导出
private
function
ApiAbnormalListExport
(
$request
,
$id
){
ExportModel
::
ApiAbnormalListExport
(
$request
);
$data
=
$request
->
input
();
$data
[
'picking_type'
]
=
2
;
//寄售类型
$id
=
(
new
UploadLogModel
())
->
addLog
(
$request
->
account_id
,
1
,
$data
);
if
(
!
$id
)
return
Export
(
20003
,
'任务推送失败'
);
dispatch
(
new
JopExportAbnormlList
(
$id
));
Export
(
0
,
$id
);
}
//获取对账单列表
private
function
ApiAccountCheckingList
(
$request
,
$id
){
...
...
app/Http/Controllers/HandleController.php
View file @
ea23a175
...
...
@@ -2,6 +2,7 @@
namespace
App\Http\Controllers
;
use
App\Jobs\JopExportAbnormlList
;
use
App\Jobs\JopExportGoodsList
;
use
App\Jobs\JopExportOrderList
;
use
App\Jobs\PreSaleOrder
;
...
...
@@ -92,7 +93,7 @@ class HandleController extends Controller
}
private
function
c
(){
$s
=
(
new
JopExport
Order
List
(
$_GET
[
'id'
]))
->
handle
();
$s
=
(
new
JopExport
Abnorml
List
(
$_GET
[
'id'
]))
->
handle
();
print_r
(
$s
);
die
();
echo
dispatch
(
new
JopExportOrderList
(
$_GET
[
'id'
]));
...
...
app/Jobs/JopExportAbnormlList.php
0 → 100644
View file @
ea23a175
<?php
namespace
App\Jobs
;
use
App\Jobs\Job
;
use
App\Model\ExportModel
;
use
App\Model\Server\ServerPurModel
;
use
App\Model\SupplierAccountModel
;
use
App\Model\UploadLogModel
;
use
Illuminate\Queue\SerializesModels
;
use
Illuminate\Queue\InteractsWithQueue
;
use
Illuminate\Contracts\Queue\ShouldQueue
;
use
Illuminate\Support\Facades\Storage
;
use
RedisDB
;
use
DB
;
class
JopExportAbnormlList
extends
Job
implements
ShouldQueue
{
use
InteractsWithQueue
,
SerializesModels
;
private
$id
;
public
function
__construct
(
$id
)
{
$this
->
id
=
$id
;
}
/**
* Execute the job.
* @return void
*/
public
function
handle
()
{
$UploadLogModel
=
new
UploadLogModel
();
$LogInfo
=
$UploadLogModel
->
LogInfo
(
$this
->
id
);
$log
=
json_decode
(
$LogInfo
[
'log'
],
true
);
$query
=
json_decode
(
$LogInfo
[
'remark'
],
true
);
$UploadLogModel
->
UpdateLogArr
(
$this
->
id
,
'开始处理任务'
,
1
,
$log
);
#建立临时文件
$filename
=
date
(
'Y-m-d-H-i-s'
)
.
'-'
.
uniqid
()
.
'.csv'
;
$filePath
=
storage_path
()
.
DIRECTORY_SEPARATOR
.
'app'
.
DIRECTORY_SEPARATOR
.
'uploads'
.
DIRECTORY_SEPARATOR
.
$filename
;
$x
=
fopen
(
$filePath
,
'a'
);
//不存在则创建
$Arr
=
[
'退货单号'
,
'创建单时间'
,
'金额'
,
'状态'
,
'币种'
,
'商品编码'
,
'型号'
,
'品牌'
,
'封装'
,
'包装方式'
,
'MPQ'
,
'数量'
,
'单价'
];
// 表头
foreach
(
$Arr
as
$k
=>
$v
){
$Arr
[
$k
]
=
iconv
(
'utf-8'
,
'gbk//IGNORE'
,
$v
);
}
fputcsv
(
$x
,
$Arr
);
//写入表头
#导出查询数据
$account
=
(
new
SupplierAccountModel
())
->
select
(
"appid"
,
"key"
)
->
where
(
"id"
,
$LogInfo
[
'create_uid'
])
->
first
();
$query
[
'p'
]
=
1
;
$query
[
'limit'
]
=
1000
;
$res
=
(
new
ServerPurModel
(
$account
->
appid
,
$account
->
key
,
$LogInfo
[
'extend'
]))
->
AbnormalDetail
(
$query
,
2
);
if
(
!
count
(
$res
[
'data'
])
){
$UploadLogModel
->
UpdateLogArr
(
$this
->
id
,
'没有数据'
,
3
,
$log
);
return
true
;
}
$count
=
ceil
(
$res
[
'count'
]
/
1000
);
for
(
$p
=
1
;
$p
<
$count
+
1
;
$p
++
)
{
sleep
(
1
);
$query
[
'p'
]
=
$p
;
$query
[
'limit'
]
=
1000
;
$list
=
(
new
ServerPurModel
(
$account
->
appid
,
$account
->
key
,
$LogInfo
[
'extend'
]))
->
AbnormalDetail
(
$query
,
2
);
if
(
$list
[
'code'
]
>
0
){
break
;
}
foreach
(
$list
[
'data'
]
as
$k
=>&
$v
){
$out
=
[
'abnormal_sn'
=>
$v
[
'abnormal_sn'
],
'create_time'
=>
$v
[
'create_time'
],
'withdraw_amount'
=>
$v
[
'withdraw_amount'
],
'status'
=>
$v
[
'status'
],
'currency'
=>
$v
[
'currency'
],
'supplier_goods_id'
=>
$v
[
'supplier_goods_id'
],
'goods_name'
=>
$v
[
'goods_name'
],
'supplier_brand_name'
=>
$v
[
'supplier_brand_name'
],
'encap'
=>
$v
[
'encap'
],
'packing_id'
=>
$v
[
'packing_id'
],
'mpq'
=>
$v
[
'mpq'
],
'real_number'
=>
$v
[
'real_number'
],
'initial_price'
=>
$v
[
'initial_price'
],
];
foreach
(
$out
as
$k1
=>&
$v1
){
$v1
=
iconv
(
'utf-8'
,
'gbk'
,
$v1
);
}
fputcsv
(
$x
,
$out
);
}
}
$UploadFileModel
=
new
UploadLogModel
();
$Url
=
$UploadFileModel
->
SaveDownFile
(
$filename
);
fclose
(
$x
);
unlink
(
$filePath
);
if
(
!
$Url
){
$UploadLogModel
->
UpdateLogArr
(
$this
->
id
,
'导出失败'
,
3
,
$log
);
return
true
;
}
else
{
$UploadLogModel
->
where
(
'id'
,
$this
->
id
)
->
update
([
'file_path'
=>
$Url
]);
$UploadLogModel
->
UpdateLogArr
(
$this
->
id
,
'任务完成'
,
2
,
$log
,[
'file_path'
=>
$Url
]);
return
true
;
}
}
}
public/pc/js/controller/AbnormalList.js
View file @
ea23a175
;
!
function
()
{
var
ids
=
[];
//选择的ids
var
table_data
=
[];
window
.
app
=
{
init
:
function
()
{
app
.
tableList
(
1
);
//搜索
$
(
"#search"
).
click
(
function
()
{
app
.
tableList
(
1
);
})
//导出
$
(
"#export"
).
click
(
function
()
{
exportUrl
(
'/api/ApiAbnormalListExport'
,
'form1'
,
'确定导出数据?'
)
})
//下单时间选择
layui
.
laydate
.
render
({
elem
:
'.order-time-1'
,
theme
:
'#1080d0'
});
layui
.
laydate
.
render
({
elem
:
'.order-time-2'
,
theme
:
'#1080d0'
});
},
//列表数据查询
tableList
:
function
(
page
)
{
var
postData
=
{
'p'
:
page
,
'abnormal_sn'
:
$
(
"input[name='abnormal_sn']"
).
val
(),
'goods_name'
:
$
(
"input[name='goods_name']"
).
val
(),
'status'
:
$
(
"input[name='status']"
).
val
(),
'create_time1'
:
$
(
"input[name='create_time1']"
).
val
(),
'create_time2'
:
$
(
"input[name='create_time2']"
).
val
(),
}
var
res
=
ajax_push
(
URL_YUNXIN
+
'/api/ApiAbnormalList'
,
postData
)
if
(
res
.
code
==
0
)
{
var
html
=
""
;
if
(
res
.
data
.
length
>
0
)
{
for
(
i
=
0
;
i
<
res
.
data
.
length
;
i
++
)
{
var
s
=
res
.
data
[
i
];
html
+=
"<tr class=\"you\"> "
+
"<td><span class=\"t1\">"
+
s
.
abnormal_sn
+
"</span></td>"
+
"<td><span class=\"t1\">"
+
s
.
create_time
+
"</span></td>"
+
"<td><span class=\"t1\">"
+
s
.
currency
+
"</span></td>"
+
"<td><span class=\"t1\">"
+
s
.
status
+
"</span></td>"
+
"<td><span class=\"t1\">"
+
s
.
amount
+
"</span></td>"
+
"<td><a href=\"/web/AbnormalDetail?id="
+
s
.
abnormal_id
+
"\" class=\"lineBlock va-m operation-1\"><i class=\"iconfont icon-mingxi-\"></i><em>明细</em></a></td></tr>"
}
}
else
{
html
=
"<tr class=\"you\"><td colspan='9' style='text-align: center;'><span class=\"t1\" style='color: #cccccc'>没有数据</span></td></tr>"
;
}
init
:
function
()
{
app
.
tableList
();
$
(
"#shopListContent"
).
html
(
html
)
layui
.
laypage
.
render
({
elem
:
'pagination'
,
theme
:
'#1080d0'
,
count
:
res
.
count
,
groups
:
10
,
curr
:
page
,
jump
:
function
(
obj
,
first
)
{
if
(
!
first
){
app
.
tableList
(
obj
.
curr
)
}
//刷新列表
$
(
"#search"
).
click
(
function
()
{
app
.
tableList
()
})
//重置表单
$
(
"#reset"
).
click
(
function
()
{
$
(
'#form1'
)[
0
].
reset
()
})
//导出
$
(
"#export"
).
click
(
function
()
{
app
.
export
()
})
//下单时间选择
layui
.
laydate
.
render
({
elem
:
'.order-time-1'
,
theme
:
'#1080d0'
});
layui
.
laydate
.
render
({
elem
:
'.order-time-2'
,
theme
:
'#1080d0'
});
},
tableList
:
function
()
{
layui
.
table
.
render
({
elem
:
'#list'
,
url
:
'/api/ApiAbnormalList'
,
method
:
'post'
,
cellMinWidth
:
100
//全局定义常规单元格的最小宽度
,
request
:
{
pageName
:
'p'
//页码的参数名称,默认:page
,
limitName
:
'limit'
//每页数据量的参数名,默认:limit
}
});
}
else
{
alert_err
(
res
.
msg
)
return
false
;
}
,
where
:
formJson
(
'form1'
)
,
loading
:
true
,
first
:
true
//不显示首页
,
last
:
false
//不显示尾页
,
cols
:
[[
{
field
:
'abnormal_sn'
,
title
:
'退货单号'
,
align
:
'center'
}
,{
field
:
'create_time'
,
title
:
'创建时间'
,
align
:
'center'
}
,{
field
:
'currency'
,
title
:
'币种'
,
align
:
'center'
}
,{
field
:
'amount'
,
title
:
'金额'
,
align
:
'center'
}
,{
field
:
'status'
,
title
:
'状态'
,
align
:
'center'
}
,{
field
:
'cahe'
,
title
:
'操作'
,
templet
:
'#cahe'
,
width
:
80
,
align
:
'center'
,
fixed
:
'right'
}
]]
,
id
:
'Abnormal'
,
page
:{
}
,
done
:
function
(
res
,
curr
,
count
)
{
table_data
=
res
.
data
;
}
});
},
export
:
function
(){
//商品列表导出
common_export
(
'/api/ApiAbnormalListExport'
,
formJson
(
'form1'
))
}
},
$
(
function
()
{
app
.
init
();
})
}();
\ No newline at end of file
}();
public/pc/js/controller/OrderList.js
View file @
ea23a175
...
...
@@ -17,6 +17,15 @@
$
(
"#export"
).
click
(
function
()
{
app
.
export
()
})
//下单时间选择
layui
.
laydate
.
render
({
elem
:
'.order-time-1'
,
theme
:
'#1080d0'
});
layui
.
laydate
.
render
({
elem
:
'.order-time-2'
,
theme
:
'#1080d0'
});
},
tableList
:
function
()
{
layui
.
table
.
render
({
...
...
@@ -39,7 +48,7 @@
,{
field
:
'currency'
,
title
:
'结算币种'
,
align
:
'center'
}
,{
field
:
'pay_type'
,
title
:
'结算方式'
,
align
:
'center'
}
,{
field
:
'status'
,
title
:
'付款状态'
,
align
:
'center'
}
,{
field
:
'cahe'
,
title
:
'操作'
,
templet
:
'#cahe'
,
width
:
5
0
,
align
:
'center'
,
fixed
:
'right'
}
,{
field
:
'cahe'
,
title
:
'操作'
,
templet
:
'#cahe'
,
width
:
8
0
,
align
:
'center'
,
fixed
:
'right'
}
]]
,
id
:
'Abnormal'
,
page
:{
...
...
resources/views/pc/AbnormalDetail.blade.php
View file @
ea23a175
...
...
@@ -2,7 +2,7 @@
<div
class=
"tit-bar"
>
<a
href=
""
>
订单管理
</a>
<span>
>
</span>
<a
href=
""
>
退货列表
</a>
<a
href=
"
/web/AbnormalList
"
>
退货列表
</a>
<span>
>
</span>
<a
class=
"text"
href=
""
>
{{ $title }}
</a>
</div>
...
...
resources/views/pc/AbnormalList.blade.php
View file @
ea23a175
<div
class=
"lx-content-r fr"
>
<div
class=
"tit-bar"
>
<a
href=
""
>
库存
管理
</a>
<a
href=
""
>
订单
管理
</a>
<span>
>
</span>
<a
class=
"text"
href=
"
"
>
订单
列表
</a>
<a
class=
"text"
href=
"
/web/AbnormalList"
>
退货
列表
</a>
</div>
<div
class=
"con-section shop-list"
>
<p
class=
"text"
>
订单
列表
</p>
<form
action=
""
>
<p
class=
"text"
>
退货
列表
</p>
<form
action=
""
id=
"form1"
>
<div
class=
"search-bar"
>
<div
class=
"lineBlock input-inline va-m"
>
<label
class=
"tag"
>
退货单号:
</label>
<input
type=
"text"
class=
"inp w180"
name=
"
order
_sn"
>
<input
type=
"text"
class=
"inp w180"
name=
"
abnormal
_sn"
>
</div>
<div
class=
"lineBlock input-inline va-m"
>
<label
class=
"tag"
>
型号:
</label>
...
...
@@ -44,21 +44,13 @@
</div>
</div>
</form>
<div
class=
"table-list"
id=
"shopList"
>
<table>
<tr>
<th>
退货单号
<b></b></th>
<th>
创建时间
<b></b></th>
<th>
币种
<b></b></th>
<th>
金额
<b></b></th>
<th>
状态
<b></b></th>
<th>
操作
</th>
</tr>
<tbody
id=
"shopListContent"
>
</tbody
>
</table>
<div
class=
"table-list"
id=
"shopList"
>
<
table
class=
"layui-table"
lay-filter=
"test"
id=
"list"
><
/table>
</div>
<div
class=
"pagination-with"
id=
"pagination"
></div>
<script
type=
"text/html"
id=
"cahe"
>
<
a
class
=
"btn btn-xs btn-outline btn-danger"
href
=
"/web/AbnormalDetail?id=@{{ d.abnormal_id }}"
>
明细
<
/a
>
</script>
</div>
</div>
resources/views/pc/OrderDetail.blade.php
View file @
ea23a175
...
...
@@ -2,7 +2,7 @@
<div
class=
"tit-bar"
>
<a
href=
""
>
订单管理
</a>
<span>
>
</span>
<a
href=
""
>
订单列表
</a>
<a
href=
"
/web/OrderList
"
>
订单列表
</a>
<span>
>
</span>
<a
class=
"text"
href=
""
>
{{ $title }}
</a>
</div>
...
...
resources/views/pc/OrderList.blade.php
View file @
ea23a175
...
...
@@ -28,7 +28,7 @@
</div>
<div
class=
"lineBlock input-inline va-m"
>
<label
class=
"tag"
>
下单时间:
</label>
<input
type=
"text"
name=
"create_time1"
class=
"inp w120 order-time-1"
lay-key=
"1"
>
<input
type=
"text"
name=
"create_time1"
class=
"inp w120 order-time-1"
lay-key=
"1"
>
<span
class=
"lineBlock va-m line"
>
~
</span>
<input
type=
"text"
name=
"create_time2"
class=
"inp w120 order-time-2"
lay-key=
"2"
>
</div>
...
...
@@ -57,7 +57,7 @@
</div>
<script
type=
"text/html"
id=
"cahe"
>
<
a
class
=
"btn btn-xs btn-outline btn-danger"
href
=
"/web/OrderDetail?id=@{{ d.
goods
_id }}"
>
明细
<
/a
>
<
a
class
=
"btn btn-xs btn-outline btn-danger"
href
=
"/web/OrderDetail?id=@{{ d.
order
_id }}"
>
明细
<
/a
>
</script>
</div>
...
...
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