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
95fa5e61
authored
Dec 20, 2019
by
allen
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
ssh://119.23.72.7:22611/zhujilai/Order
into lt_订单周迭代3.09
parents
73f24e4f
70918906
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
12 deletions
app/Model/UserSampleApplyModel.php
public/js/web/selfSampleList.js
public/js/web/selfSampleLog.js
app/Model/UserSampleApplyModel.php
View file @
95fa5e61
...
@@ -25,7 +25,7 @@ class UserSampleApplyModel extends Model
...
@@ -25,7 +25,7 @@ class UserSampleApplyModel extends Model
{
{
$page
=
$request
->
input
(
'page'
,
1
);
$page
=
$request
->
input
(
'page'
,
1
);
$limit
=
$request
->
input
(
'limit'
,
10
);
$limit
=
$request
->
input
(
'limit'
,
10
);
$field
=
[
'a.apply_id'
,
'a.user_id'
,
'a.account'
,
'a.order_id'
,
'order_sn'
,
'a.goods_id'
,
'a.goods_name'
,
'a.apply_num'
,
'a.create_time'
];
$field
=
[
'a.apply_id'
,
'a.user_id'
,
'a.account'
,
'a.order_id'
,
'order_sn'
,
'a.goods_id'
,
'a.goods_name'
,
'a.apply_num'
,
'a.
quota'
,
'a.
create_time'
];
$map
[
'account'
]
=
$request
->
input
(
'account'
,
''
);
// 用户账户
$map
[
'account'
]
=
$request
->
input
(
'account'
,
''
);
// 用户账户
$map
[
'goods_name'
]
=
$request
->
input
(
'goods_name'
,
''
);
// 商品名称
$map
[
'goods_name'
]
=
$request
->
input
(
'goods_name'
,
''
);
// 商品名称
...
@@ -98,17 +98,29 @@ class UserSampleApplyModel extends Model
...
@@ -98,17 +98,29 @@ class UserSampleApplyModel extends Model
$UserInfoModel
=
new
UserInfoModel
;
$UserInfoModel
=
new
UserInfoModel
;
$v
[
'invite_count'
]
=
$UserSampleInviteModel
->
getUserInviteCount
(
$v
[
'user_id'
]);
$v
[
'invite_count'
]
=
$UserSampleInviteModel
->
getUserInviteCount
(
$v
[
'user_id'
]);
$v
[
'apply_num_total'
]
=
$this
->
getSampleApplySum
(
$v
[
'user_id'
]);
$v
[
'apply_num_total'
]
=
$this
->
getSampleApplySum
(
$v
[
'user_id'
]);
// 获取指定用户申请的样片总数
// $v['quota_total'] = $this->getSampleApplySum($v['user_id'], 'quota'); // 获取指定用户申请的样片总数
$v
[
'quota_total'
]
=
$this
->
getUsedCount
(
$v
[
'user_id'
]);
// 获取指定用户申请的样片消耗总人数
$v
[
'apply_count'
]
=
$UserInfoModel
->
getUserApplyCount
(
$v
[
'user_id'
]);
$v
[
'apply_count'
]
=
$UserInfoModel
->
getUserApplyCount
(
$v
[
'user_id'
]);
}
}
return
$data
;
return
$data
;
}
}
// 获取指定
用户申请的样片
总数
// 获取指定
字段的
总数
public
function
getSampleApplySum
(
$user_id
)
public
function
getSampleApplySum
(
$user_id
,
$field
=
'apply_num'
)
{
{
return
$this
->
where
(
'user_id'
,
$user_id
)
->
sum
(
'apply_num'
);
return
$this
->
where
(
'user_id'
,
$user_id
)
->
sum
(
$field
);
}
// 获取指定用户申请的样片消耗总人数
public
function
getUsedCount
(
$user_id
)
{
return
$this
->
from
(
'lie_user_sample_apply as s'
)
->
join
(
'lie_order as o'
,
's.order_id'
,
'='
,
'o.order_id'
)
->
where
(
's.user_id'
,
'='
,
$user_id
)
->
where
(
'o.status'
,
'<>'
,
'-1'
)
->
sum
(
'quota'
);
}
}
// 获取领取记录
// 获取领取记录
...
@@ -118,7 +130,7 @@ class UserSampleApplyModel extends Model
...
@@ -118,7 +130,7 @@ class UserSampleApplyModel extends Model
$page
=
$request
->
input
(
'page'
,
1
);
$page
=
$request
->
input
(
'page'
,
1
);
$limit
=
$request
->
input
(
'limit'
,
10
);
$limit
=
$request
->
input
(
'limit'
,
10
);
$field
=
[
'apply_id'
,
'user_id'
,
'account'
,
'order_id'
,
'order_sn'
,
'goods_id'
,
'goods_name'
,
'apply_num'
,
'create_time'
];
$field
=
[
'apply_id'
,
'user_id'
,
'account'
,
'order_id'
,
'order_sn'
,
'goods_id'
,
'goods_name'
,
'apply_num'
,
'
quota'
,
'
create_time'
];
$list
=
$this
->
where
(
'user_id'
,
$user_id
)
$list
=
$this
->
where
(
'user_id'
,
$user_id
)
->
select
(
$field
)
->
select
(
$field
)
...
@@ -126,7 +138,25 @@ class UserSampleApplyModel extends Model
...
@@ -126,7 +138,25 @@ class UserSampleApplyModel extends Model
->
orderBy
(
'apply_id'
,
'asc'
)
->
orderBy
(
'apply_id'
,
'asc'
)
->
paginate
(
$limit
,
[
'*'
],
'page'
,
$page
)
->
toArray
();
->
paginate
(
$limit
,
[
'*'
],
'page'
,
$page
)
->
toArray
();
$list
[
'data'
]
=
$this
->
handleData
(
$list
[
'data'
]);
return
[
0
,
'获取成功'
,
$list
[
'data'
],
$list
[
'total'
]];
return
[
0
,
'获取成功'
,
$list
[
'data'
],
$list
[
'total'
]];
}
}
// 处理记录
public
function
handleData
(
$data
)
{
if
(
!
$data
)
return
false
;
$OrderModel
=
new
OrderModel
();
foreach
(
$data
as
&
$v
)
{
$order
=
$OrderModel
->
where
(
'order_id'
,
$v
[
'order_id'
])
->
select
(
'status'
)
->
first
();
$v
[
'order_status'
]
=
Config
(
'params.order_status'
)[
$order
->
status
];
}
return
$data
;
}
}
}
\ No newline at end of file
public/js/web/selfSampleList.js
View file @
95fa5e61
...
@@ -24,7 +24,8 @@ layui.use(['form', 'table', 'laydate'], function(){
...
@@ -24,7 +24,8 @@ layui.use(['form', 'table', 'laydate'], function(){
,{
field
:
'account'
,
title
:
'用户账户'
,
width
:
150
}
,{
field
:
'account'
,
title
:
'用户账户'
,
width
:
150
}
,{
field
:
'invite_count'
,
title
:
'邀请人数'
,
width
:
100
}
,{
field
:
'invite_count'
,
title
:
'邀请人数'
,
width
:
100
}
,{
field
:
'apply_num_total'
,
title
:
'已申请样片数'
,
width
:
120
}
,{
field
:
'apply_num_total'
,
title
:
'已申请样片数'
,
width
:
120
}
,{
field
:
'apply_count'
,
title
:
'剩余领取次数'
,
width
:
120
}
,{
field
:
'apply_count'
,
title
:
'剩余有效人数'
,
width
:
120
}
,{
field
:
'quota_total'
,
title
:
'总消耗人数'
,
width
:
120
}
,{
field
:
'order_id'
,
title
:
'订单ID'
,
width
:
100
}
,{
field
:
'order_id'
,
title
:
'订单ID'
,
width
:
100
}
,{
field
:
'order_sn'
,
title
:
'订单编号'
,
width
:
150
}
,{
field
:
'order_sn'
,
title
:
'订单编号'
,
width
:
150
}
,{
field
:
'goods_id'
,
title
:
'样片ID'
,
width
:
100
}
,{
field
:
'goods_id'
,
title
:
'样片ID'
,
width
:
100
}
...
...
public/js/web/selfSampleLog.js
View file @
95fa5e61
...
@@ -14,14 +14,16 @@ layui.use(['table'], function(){
...
@@ -14,14 +14,16 @@ layui.use(['table'], function(){
}
}
,
cols
:
[[
//表头
,
cols
:
[[
//表头
{
title
:
'序号'
,
type
:
'numbers'
,
fixed
:
'left'
,
width
:
80
}
{
title
:
'序号'
,
type
:
'numbers'
,
fixed
:
'left'
,
width
:
80
}
,{
field
:
'user_id'
,
title
:
'用户ID'
,
width
:
1
5
0
}
,{
field
:
'user_id'
,
title
:
'用户ID'
,
width
:
1
2
0
}
,{
field
:
'account'
,
title
:
'用户账户'
,
width
:
200
}
,{
field
:
'account'
,
title
:
'用户账户'
,
width
:
200
}
,{
field
:
'order_id'
,
title
:
'订单ID'
,
width
:
1
5
0
}
,{
field
:
'order_id'
,
title
:
'订单ID'
,
width
:
1
2
0
}
,{
field
:
'order_sn'
,
title
:
'订单编号'
,
width
:
200
}
,{
field
:
'order_sn'
,
title
:
'订单编号'
,
width
:
200
}
,{
field
:
'goods_id'
,
title
:
'样片ID'
,
width
:
150
}
,{
field
:
'order_status'
,
title
:
'订单状态'
,
width
:
100
}
,{
field
:
'goods_id'
,
title
:
'样片ID'
,
width
:
120
}
,{
field
:
'goods_name'
,
title
:
'样片名称'
,
width
:
300
}
,{
field
:
'goods_name'
,
title
:
'样片名称'
,
width
:
300
}
,{
field
:
'apply_num'
,
title
:
'领取数量'
,
width
:
150
}
,{
field
:
'apply_num'
,
title
:
'领取数量'
,
width
:
120
}
,{
field
:
'create_time'
,
title
:
'领取时间'
,
width
:
218
}
,{
field
:
'quota'
,
title
:
'样片消耗人数'
,
width
:
120
}
,{
field
:
'create_time'
,
title
:
'领取时间'
,
width
:
215
}
]]
]]
,
limit
:
10
,
limit
:
10
,
limits
:
[
10
,
20
,
50
,]
,
limits
:
[
10
,
20
,
50
,]
...
...
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