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
d04b6c23
authored
Sep 15, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'zjl_check_20200818'
parents
25e28f92
0e324bd1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
76 deletions
app/Http/Controllers/ExportController.php
public/js/web/selfSampleList.js
resources/views/web/selfSampleList.blade.php
app/Http/Controllers/ExportController.php
View file @
d04b6c23
<?php
<?php
namespace
App\Http\Controllers
;
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
use
App\Http\Controllers\Controller
;
use
App\Model\UserSampleApplyModel
;
use
App\Model\UserSampleApplyModel
;
use
App\Model\UserSampleInviteModel
;
use
App\Model\UserSampleInviteModel
;
use
DB
;
use
DB
;
use
Excel
;
use
Excel
;
Class
ExportController
extends
Controller
Class
ExportController
extends
Controller
{
{
// 统一入口
// 统一入口
public
function
entrance
(
Request
$request
,
$id
)
public
function
entrance
(
Request
$request
,
$id
)
{
{
return
$this
->
$id
(
$request
);
return
$this
->
$id
(
$request
);
}
}
// 导出会员
// 导出会员
public
function
selfSampleExport
(
$request
)
public
function
selfSampleExport
(
$request
)
{
{
$UserSampleApplyModel
=
new
UserSampleApplyModel
();
$UserSampleApplyModel
=
new
UserSampleApplyModel
();
$UserSampleInviteModel
=
new
UserSampleInviteModel
();
$UserSampleInviteModel
=
new
UserSampleInviteModel
();
$data
=
$UserSampleApplyModel
->
lists
(
$request
,
1
);
$data
=
$UserSampleApplyModel
->
lists
(
$request
,
1
);
foreach
(
$data
as
$k
=>
$v
)
{
foreach
(
$data
as
$k
=>
$v
)
{
$cellData
[
$k
][
'user_id'
]
=
$v
[
'user_id'
];
$cellData
[
$k
][
'user_id'
]
=
$v
[
'user_id'
];
$cellData
[
$k
][
'account'
]
=
$v
[
'account'
];
$cellData
[
$k
][
'account'
]
=
$v
[
'account'
];
$cellData
[
$k
][
'invite_count'
]
=
$v
[
'invite_count'
];
$cellData
[
$k
][
'invite_count'
]
=
$v
[
'invite_count'
];
$cellData
[
$k
][
'apply_num_total'
]
=
$v
[
'apply_num_total'
];
$cellData
[
$k
][
'apply_num_total'
]
=
$v
[
'apply_num_total'
];
$cellData
[
$k
][
'apply_count'
]
=
$v
[
'apply_count'
];
$cellData
[
$k
][
'apply_count'
]
=
$v
[
'apply_count'
];
$cellData
[
$k
][
'order_id'
]
=
$v
[
'order_id'
];
$cellData
[
$k
][
'order_id'
]
=
$v
[
'order_id'
];
$cellData
[
$k
][
'order_sn'
]
=
$v
[
'order_sn'
];
$cellData
[
$k
][
'order_sn'
]
=
$v
[
'order_sn'
];
$cellData
[
$k
][
'goods_id'
]
=
$v
[
'goods_id'
];
$cellData
[
$k
][
'goods_id'
]
=
$v
[
'goods_id'
];
$cellData
[
$k
][
'goods_name'
]
=
$v
[
'goods_name'
];
$cellData
[
$k
][
'goods_name'
]
=
$v
[
'goods_name'
];
$invite
=
$UserSampleInviteModel
->
where
(
'user_id'
,
$v
[
'user_id'
])
->
select
(
'invitee_mobile'
)
->
get
()
->
toArray
();
$invite
=
$UserSampleInviteModel
->
where
(
'user_id'
,
$v
[
'user_id'
])
->
select
(
'invitee_mobile'
)
->
get
()
->
toArray
();
if
(
!
empty
(
$invite
))
{
if
(
!
empty
(
$invite
))
{
$cellData
[
$k
][
'invitee'
]
=
implode
(
','
,
array_column
(
$invite
,
'invitee_mobile'
));
$cellData
[
$k
][
'invitee'
]
=
implode
(
','
,
array_column
(
$invite
,
'invitee_mobile'
));
}
else
{
}
else
{
$cellData
[
$k
][
'invitee'
]
=
''
;
$cellData
[
$k
][
'invitee'
]
=
''
;
}
}
$cellData
[
$k
][
'create_time'
]
=
$v
[
'create_time'
];
$cellData
[
$k
][
'create_time'
]
=
$v
[
'create_time'
];
}
}
$headerCell
=
[
'用户ID'
,
'用户账户'
,
'邀请人数'
,
'已申请样片数'
,
'剩余领取次数'
,
'订单ID'
,
'订单编号'
,
'样片ID'
,
'样片名称'
,
'邀请用户'
,
'最近一次领取时间'
];
$headerCell
=
[
'用户ID'
,
'用户账户'
,
'邀请人数'
,
'已申请样片数'
,
'剩余领取次数'
,
'订单ID'
,
'订单编号'
,
'样片ID'
,
'样片名称'
,
'邀请用户'
,
'最近一次领取时间'
];
$fileName
=
'自营样片领取记录导出'
.
date
(
'_YmdHis'
);
$fileName
=
'自营样片领取记录导出'
.
date
(
'_YmdHis'
);
$sheetName
=
'自营样片'
;
$sheetName
=
'自营样片'
;
$this
->
commonFunc
(
$cellData
,
$headerCell
,
$fileName
,
$sheetName
);
$this
->
commonFunc
(
$cellData
,
$headerCell
,
$fileName
,
$sheetName
);
}
}
/**
// 工具尺邀约记录导出
* 导出
public
function
rulesInviteExport
(
$request
)
* @param [type] $cellData [导出数据]
{
* @param [type] $headerCell [菜单项]
$UserSampleInviteModel
=
new
UserSampleInviteModel
();
* @param [type] $fileName [文件名]
* @param string $sheetName [sheet名]
$data
=
$UserSampleInviteModel
->
where
(
'type'
,
2
)
->
get
()
->
toArray
();
* @return [type] [description]
*/
foreach
(
$data
as
$k
=>
$v
)
{
public
function
commonFunc
(
$cellData
,
$headerCell
,
$fileName
,
$sheetName
=
''
)
$cellData
[
$k
][
'invite_id'
]
=
$v
[
'invite_id'
];
{
$cellData
[
$k
][
'user_id'
]
=
$v
[
'user_id'
];
$sheetName
=
$sheetName
?
$sheetName
:
'导出'
;
$cellData
[
$k
][
'account'
]
=
$v
[
'account'
];
$cellData
[
$k
][
'invitee_uid'
]
=
$v
[
'invitee_uid'
];
array_unshift
(
$cellData
,
$headerCell
);
$cellData
[
$k
][
'invitee_mobile'
]
=
$v
[
'invitee_mobile'
];
$cellData
[
$k
][
'is_expire'
]
=
$v
[
'is_expire'
]
==
1
?
'是'
:
'否'
;
Excel
::
create
(
$fileName
,
function
(
$excel
)
use
(
$cellData
,
$sheetName
){
$cellData
[
$k
][
'create_time'
]
=
$v
[
'create_time'
];
$excel
->
sheet
(
$sheetName
,
function
(
$sheet
)
use
(
$cellData
){
}
$sheet
->
rows
(
$cellData
);
});
$headerCell
=
[
'邀请ID'
,
'用户ID'
,
'用户账户'
,
'受邀者ID'
,
'受邀者账号'
,
'是否有效'
,
'受邀者注册时间'
];
})
->
export
(
'xls'
);
$fileName
=
'工具尺邀请记录导出'
.
date
(
'_YmdHis'
);
}
$sheetName
=
'工具尺邀请'
;
$this
->
commonFunc
(
$cellData
,
$headerCell
,
$fileName
,
$sheetName
);
}
/**
* 导出
* @param [type] $cellData [导出数据]
* @param [type] $headerCell [菜单项]
* @param [type] $fileName [文件名]
* @param string $sheetName [sheet名]
* @return [type] [description]
*/
public
function
commonFunc
(
$cellData
,
$headerCell
,
$fileName
,
$sheetName
=
''
)
{
$sheetName
=
$sheetName
?
$sheetName
:
'导出'
;
array_unshift
(
$cellData
,
$headerCell
);
Excel
::
create
(
$fileName
,
function
(
$excel
)
use
(
$cellData
,
$sheetName
){
$excel
->
sheet
(
$sheetName
,
function
(
$sheet
)
use
(
$cellData
){
$sheet
->
rows
(
$cellData
);
});
})
->
export
(
'xls'
);
}
}
}
\ No newline at end of file
public/js/web/selfSampleList.js
View file @
d04b6c23
...
@@ -76,5 +76,19 @@ layui.use(['form', 'table', 'laydate'], function(){
...
@@ -76,5 +76,19 @@ layui.use(['form', 'table', 'laydate'], function(){
});
});
})
})
// 工具尺邀约记录导出
$
(
'.invite_export'
).
click
(
function
()
{
var
url
=
'/export/rulesInviteExport'
;
layer
.
confirm
(
'确定导出数据吗?'
,
{
title
:
'导出数据'
,
btn
:
[
'确定'
,
'取消'
]
},
function
(){
layer
.
closeAll
(
'dialog'
);
// 确定时关闭弹框
window
.
location
.
href
=
url
;
});
})
});
});
\ No newline at end of file
resources/views/web/selfSampleList.blade.php
View file @
d04b6c23
...
@@ -48,6 +48,7 @@
...
@@ -48,6 +48,7 @@
<div
class=
"layui-btn-container"
style=
"text-align: center; margin-top: 10px;"
>
<div
class=
"layui-btn-container"
style=
"text-align: center; margin-top: 10px;"
>
<button
lay-submit
lay-filter=
"load"
class=
"layui-btn"
data-type=
"search"
>
搜索
</button>
<button
lay-submit
lay-filter=
"load"
class=
"layui-btn"
data-type=
"search"
>
搜索
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-normal export"
>
导出
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-normal export"
>
导出
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-normal invite_export"
style=
"float:right;"
>
工具尺邀约记录导出
</button>
</div>
</div>
</div>
</div>
</form>
</form>
...
...
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