Commit f0275b78 by 朱继来

调整样片列表、记录页面

parent 06458951
......@@ -16,6 +16,9 @@ use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
use App\Model\UserMainModel;
use App\Model\UserInfoModel;
use App\Model\UserCompanyModel;
class WebController extends Controller
{
......@@ -298,6 +301,14 @@ class WebController extends Controller
$data['paths'] = [["title" => '自营订单', "href" => '#'], ["title" => '自营订单领取列表', "href" => '/web/selfSampleList'], ["title" => '自营样片领取和邀约记录', "href" => '#']];
$data['user_id'] = $user_id;
$UserMainModel = new UserMainModel;
$UserInfoModel = new UserInfoModel;
$UserCompanyModel = new UserCompanyModel;
$data['user_info'] = $UserMainModel->find($user_id);
$data['work_card'] = $UserInfoModel->where('user_id', $user_id)->value('work_card');
$data['company_info'] = $UserCompanyModel->getCompanyInfo($user_id);
return view('web', $data);
}
......
......@@ -10,12 +10,19 @@ class RegionModel extends Model
protected $primaryKey = 'region_id';
public $timestamps = false;
// 获取地址
// 获取指定类型地址
public function getRegion($region_type=1)
{
$map['region_type'] = $region_type;
return $this->where($map)->select('region_id', 'parent_id', 'region_name')->get()->toArray();
}
// 获取地址名称
public function getRegionName($region_id)
{
if (!$region_id) return null;
return $this->where('region_id', $region_id)->value('region_name');
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
use App\Model\RegionModel;
class UserCompanyModel extends Model
{
......@@ -13,4 +14,22 @@ class UserCompanyModel extends Model
protected $primaryKey = 'com_id';
public $timestamps = false;
// 获取公司信息
public function getCompanyInfo($user_id)
{
$info = $this->where('user_id', $user_id)->first();
// 公司性质
$company_type = Config('params.company_type');
$info['type_id_val'] = $company_type[$info['type_id']];
// 省市区
$RegionModel = new RegionModel;
$info['com_province'] = $RegionModel->getRegionName($info['com_province_id']);
$info['com_city'] = $RegionModel->getRegionName($info['com_city_id']);
$info['com_area'] = $RegionModel->getRegionName($info['com_area_id']);
return $info;
}
}
\ No newline at end of file
......@@ -23,4 +23,16 @@ class UserInfoModel extends Model
return $user_info->apply_count;
}
// 获取用户职务
public function getWorkFunction($user_id)
{
$work_function = $this->where('user_id', $user_id)->value('work_function');
if (!$work_function) return '';
$work_function_val = Config('params.work_function');
return isset($work_function_val[$work_function]) ? $work_function_val[$work_function] : '';
}
}
\ No newline at end of file
......@@ -93,10 +93,10 @@ class UserSampleApplyModel extends Model
{
if (!$data) return false;
$UserSampleInviteModel = new UserSampleInviteModel;
$UserInfoModel = new UserInfoModel;
foreach ($data as &$v) {
$UserSampleInviteModel = new UserSampleInviteModel;
$UserInfoModel = new UserInfoModel;
$v['work_function'] = $UserInfoModel->getWorkFunction($v['user_id']);
$v['invite_count'] = $UserSampleInviteModel->getUserInviteCount($v['user_id']);
$v['apply_num_total'] = $this->getSampleApplySum($v['user_id']); // 获取指定用户申请的样片总数
// $v['quota_total'] = $this->getSampleApplySum($v['user_id'], 'quota'); // 获取指定用户申请的样片总数
......@@ -157,7 +157,10 @@ class UserSampleApplyModel extends Model
$OrderModel = new OrderModel();
foreach ($data as &$v) {
$order = $OrderModel->where('order_id', $v['order_id'])->select('status')->first();
$order = $OrderModel->where('order_id', $v['order_id'])->select('status')->first();
if (!$order) continue;
$v['order_status'] = Config('params.order_status')[$order->status];
}
......
......@@ -106,5 +106,27 @@
4 => '个人',
],
'work_function' => [ // 客户职位
1 => '工程师',
2 => '采购',
3 => '企业管理',
4 => '学生',
5 => '其他',
6 => '销售',
7 => '贸易商',
8 => '终端商',
],
//公司类别
'company_type'=>array(
0 => '个人',
1 => '终端采购商',
2 => '代工厂',
3 => '代理商',
4 => '学校/科研机构',
5 => '贸易商',
6 => '其他',
),
];
\ No newline at end of file
......@@ -22,6 +22,7 @@ layui.use(['form', 'table', 'laydate'], function(){
{title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'user_id', title: '用户ID', width: 100}
,{field: 'account', title: '用户账户', width: 150}
,{field: 'work_function', title: '用户职务', width: 150}
,{field: 'invite_count', title: '邀请人数', width: 100}
,{field: 'apply_num_total', title: '已申请样片数', width: 120}
,{field: 'apply_count', title: '剩余有效人数', width: 120}
......
......@@ -51,6 +51,12 @@ layui.use(['table'], function(){
,limit: 10
,limits: [10, 20, 50,]
});
// 图片展示
layer.photos({
photos: '.layer-img'
,shift: 5 //0-6的选择,指定弹出图片动画类型,默认随机
});
});
\ No newline at end of file
<input type="hidden" name="user_id" value="{{ $user_id }}">
<h3>账户信息</h3>
<table class="layui-table">
<thead>
<tr>
<th>联系人</th>
<th>手机号码</th>
<th>邮箱</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ $user_info['user_name'] }}</td>
<td>{{ $user_info['mobile'] }}</td>
<td>{{ $user_info['email'] }}</td>
</tr>
</tbody>
</table>
<hr>
<style>
.layer-img{ cursor: pointer; }
</style>
<h3>公司信息</h3>
<table class="layui-table">
<thead>
<tr>
<th>公司名称</th>
<th>公司性质</th>
<th>公司座机</th>
<th>公司地址</th>
<th>工牌/名片</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ $company_info['com_name'] }}</td>
<td>{{ $company_info['type_id_val'] }}</td>
<td>{{ $company_info['com_telphone'] }}</td>
<td>{{ $company_info['com_province'].$company_info['com_city'].$company_info['com_area'].$company_info['com_address'] }}</td>
<td>
@if ($work_card)
<span class="layer-img"><img src="{{ $work_card }}" alt="名片/工牌" width="60"></span>
@endif
</td>
</tr>
</tbody>
</table>
<hr>
<h3>领取记录</h3>
<table id="apply_log" lay-filter="apply"></table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment