提交 23693b09 编写于 作者: D devil_gong

应用

上级 2936ddf9
...@@ -83,8 +83,8 @@ class Pets extends Controller ...@@ -83,8 +83,8 @@ class Pets extends Controller
); );
$data = Service::PetsList($data_params); $data = Service::PetsList($data_params);
$this->assign('data_list', $data['data']); $this->assign('data_list', $data['data']);
//print_r($data['data']);
$this->assign('pets_attribute_status_list', Service::$pets_attribute_status_list);
$this->assign('pets_attribute_is_text_list', Service::$pets_attribute_is_text_list); $this->assign('pets_attribute_is_text_list', Service::$pets_attribute_is_text_list);
$this->assign('pets_attribute_gender_list', Service::$pets_attribute_gender_list); $this->assign('pets_attribute_gender_list', Service::$pets_attribute_gender_list);
$this->assign('pets_attribute_type_list', Service::$pets_attribute_type_list); $this->assign('pets_attribute_type_list', Service::$pets_attribute_type_list);
...@@ -101,7 +101,22 @@ class Pets extends Controller ...@@ -101,7 +101,22 @@ class Pets extends Controller
*/ */
public function saveinfo($params = []) public function saveinfo($params = [])
{ {
$this->assign('data', []); // 获取数据
$data = [];
if(!empty($params['id']))
{
$data_params = array(
'm' => 0,
'n' => 1,
'where' => ['id' => intval($params['id'])],
);
$ret = Service::PetsList($data_params);
$data = empty($ret['data'][0]) ? [] : $ret['data'][0];
unset($params['id']);
}
$this->assign('data', $data);
$this->assign('params', $params);
$this->assign('pets_attribute_status_list', Service::$pets_attribute_status_list);
$this->assign('pets_attribute_is_text_list', Service::$pets_attribute_is_text_list); $this->assign('pets_attribute_is_text_list', Service::$pets_attribute_is_text_list);
$this->assign('pets_attribute_gender_list', Service::$pets_attribute_gender_list); $this->assign('pets_attribute_gender_list', Service::$pets_attribute_gender_list);
$this->assign('pets_attribute_type_list', Service::$pets_attribute_type_list); $this->assign('pets_attribute_type_list', Service::$pets_attribute_type_list);
......
...@@ -41,6 +41,14 @@ class Service ...@@ -41,6 +41,14 @@ class Service
1 => ['value' => 1, 'name' => '母'], 1 => ['value' => 1, 'name' => '母'],
]; ];
// 状态(0正常, 1丢失, 2去世, 3关闭)
public static $pets_attribute_status_list = [
0 => ['value' => 0, 'name' => '正常'],
1 => ['value' => 1, 'name' => '丢失'],
2 => ['value' => 2, 'name' => '去世'],
3 => ['value' => 3, 'name' => '关闭'],
];
/** /**
* 宠物列表 * 宠物列表
* @author Devil * @author Devil
...@@ -75,6 +83,9 @@ class Service ...@@ -75,6 +83,9 @@ class Service
// 是否疫苗 // 是否疫苗
$v['vaccine_name'] = self::$pets_attribute_is_text_list[$v['vaccine']]['name']; $v['vaccine_name'] = self::$pets_attribute_is_text_list[$v['vaccine']]['name'];
// 状态
$v['status_name'] = self::$pets_attribute_status_list[$v['status']]['name'];
// 生日/年龄 // 生日/年龄
if(empty($v['birthday'])) if(empty($v['birthday']))
{ {
...@@ -92,6 +103,9 @@ class Service ...@@ -92,6 +103,9 @@ class Service
// 相册 // 相册
$v['photo'] = empty($v['photo']) ? null : self::GetPestPhotoHandle($v['photo']); $v['photo'] = empty($v['photo']) ? null : self::GetPestPhotoHandle($v['photo']);
// 二维码
$v['qrcode_url'] = MyUrl('index/qrcode/index', ['content'=>urlencode(base64_encode(MyUrl('index/goods/index', ['id'=>$v['id']], true, true)))]);
// 时间 // 时间
$v['add_time_time'] = date('Y-m-d H:i:s', $v['add_time']); $v['add_time_time'] = date('Y-m-d H:i:s', $v['add_time']);
$v['add_time_date'] = date('Y-m-d', $v['add_time']); $v['add_time_date'] = date('Y-m-d', $v['add_time']);
...@@ -114,8 +128,12 @@ class Service ...@@ -114,8 +128,12 @@ class Service
private static function GetPestPhotoHandle($photo) private static function GetPestPhotoHandle($photo)
{ {
$result = []; $result = [];
if(!empty($photo) && is_array($photo)) if(!empty($photo))
{ {
if(is_string($photo))
{
$photo = json_decode($photo, true);
}
foreach($photo as &$v) foreach($photo as &$v)
{ {
$result[] = [ $result[] = [
...@@ -161,6 +179,10 @@ class Service ...@@ -161,6 +179,10 @@ class Service
{ {
$where[] = ['type', '=', $params['type']]; $where[] = ['type', '=', $params['type']];
} }
if(isset($params['status']) && $params['status'] > -1)
{
$where[] = ['status', '=', intval($params['status'])];
}
if(isset($params['gender']) && $params['gender'] > -1) if(isset($params['gender']) && $params['gender'] > -1)
{ {
$where[] = ['gender', '=', intval($params['gender'])]; $where[] = ['gender', '=', intval($params['gender'])];
...@@ -327,8 +349,31 @@ class Service ...@@ -327,8 +349,31 @@ class Service
'person_weixin' => isset($params['person_weixin']) ? $params['person_weixin'] : '', 'person_weixin' => isset($params['person_weixin']) ? $params['person_weixin'] : '',
]; ];
// 绑定编号
$edit_msg_title = '编辑';
if(empty($params['id']) && !empty($params['pest_no']))
{
$pets = Db::name('PluginsPetscmsPets')->where(['pest_no'=>$params['pest_no']])->field('id,pest_no,user_id')->find();
if(empty($pets))
{
return DataReturn('宠物编号不存在['.$params['pest_no'].']', -10);
}
// 是否被其他用户绑定
if(!empty($pets['user_id']))
{
return DataReturn('宠物编号已被绑定['.$params['pest_no'].']', -11);
}
// 使用编辑模式
$params['id'] = $pets['id'];
$edit_msg_title = '绑定';
}
// 添加/编辑
if(empty($params['id'])) if(empty($params['id']))
{ {
$data['pest_no'] = date('YmdHis').GetNumberCode(6);
$data['add_time'] = time(); $data['add_time'] = time();
if(Db::name('PluginsPetscmsPets')->insertGetId($data) > 0) if(Db::name('PluginsPetscmsPets')->insertGetId($data) > 0)
{ {
...@@ -339,9 +384,9 @@ class Service ...@@ -339,9 +384,9 @@ class Service
$data['upd_time'] = time(); $data['upd_time'] = time();
if(Db::name('PluginsPetscmsPets')->where(['id'=>intval($params['id'])])->update($data)) if(Db::name('PluginsPetscmsPets')->where(['id'=>intval($params['id'])])->update($data))
{ {
return DataReturn('编辑成功', 0); return DataReturn($edit_msg_title.'成功', 0);
} }
return DataReturn('编辑失败', -100); return DataReturn($edit_msg_title.'失败', -100);
} }
} }
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<td> <td>
<span>类型:</span> <span>类型:</span>
<select name="type" class="chosen-select" data-placeholder="宠物类型..."> <select name="type" class="chosen-select" data-placeholder="宠物类型...">
<option value="-1">宠物类型...</option> <option value="">宠物类型...</option>
{{if !empty($pets_attribute_type_list)}} {{if !empty($pets_attribute_type_list)}}
{{foreach $pets_attribute_type_list as $v}} {{foreach $pets_attribute_type_list as $v}}
<option value="{{$v.value}}" {{if isset($params['type']) and $params['type'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option> <option value="{{$v.value}}" {{if isset($params['type']) and $params['type'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
...@@ -51,12 +51,12 @@ ...@@ -51,12 +51,12 @@
</select> </select>
</td> </td>
<td> <td>
<span>性别</span> <span>状态</span>
<select name="gender" class="chosen-select" data-placeholder="宠物性别..."> <select name="status" class="chosen-select" data-placeholder="宠物状态...">
<option value="-1">宠物性别...</option> <option value="-1">宠物状态...</option>
{{if !empty($pets_attribute_gender_list)}} {{if !empty($pets_attribute_status_list)}}
{{foreach $pets_attribute_gender_list as $v}} {{foreach $pets_attribute_status_list as $v}}
<option value="{{$v.value}}" {{if isset($params['gender']) and $params['gender'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option> <option value="{{$v.value}}" {{if isset($params['status']) and $params['status'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}} {{/foreach}}
{{/if}} {{/if}}
</select> </select>
...@@ -74,6 +74,20 @@ ...@@ -74,6 +74,20 @@
{{/if}} {{/if}}
</select> </select>
</td> </td>
<td>
<span>性别:</span>
<select name="gender" class="chosen-select" data-placeholder="宠物性别...">
<option value="-1">宠物性别...</option>
{{if !empty($pets_attribute_gender_list)}}
{{foreach $pets_attribute_gender_list as $v}}
<option value="{{$v.value}}" {{if isset($params['gender']) and $params['gender'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
{{/if}}
</select>
</td>
</tr>
<tr>
<td></td>
<td> <td>
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button> <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
<a href="{{:PluginsHomeUrl('petscms', 'pets', 'index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a> <a href="{{:PluginsHomeUrl('petscms', 'pets', 'index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
...@@ -85,7 +99,7 @@ ...@@ -85,7 +99,7 @@
<!-- operation start --> <!-- operation start -->
<div class="am-g operation-nav"> <div class="am-g operation-nav">
<a href="{{:PluginsHomeUrl('petscms', 'pets', 'saveinfo')}}" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus"> 新增</a> <a href="{{:PluginsHomeUrl('petscms', 'pets', 'saveinfo')}}" class="am-btn am-btn-primary am-radius am-btn-xs am-icon-plus"> 新增 / 绑定</a>
</div> </div>
<!-- operation end --> <!-- operation end -->
...@@ -94,15 +108,12 @@ ...@@ -94,15 +108,12 @@
<table class="am-table"> <table class="am-table">
<thead> <thead>
<tr> <tr>
<th>标题</th> <th class="am-hide-sm-only">标题/相册</th>
<th>姓名</th> <th>宠物信息</th>
<th>类型</th> <th class="am-hide-sm-only">主人信息</th>
<th class="am-hide-sm-only">性别</th> <th class="am-hide-sm-only">二维码</th>
<th class="am-hide-sm-only">品种</th> <th>状态</th>
<th class="am-hide-sm-only">是否绝育</th> <th class="am-hide-sm-only">操作时间</th>
<th class="am-hide-sm-only">是否疫苗</th>
<th class="am-hide-sm-only">生日/年龄</th>
<th class="am-hide-sm-only">时间</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
...@@ -110,29 +121,68 @@ ...@@ -110,29 +121,68 @@
{{if !empty($data_list)}} {{if !empty($data_list)}}
{{foreach $data_list as $v}} {{foreach $data_list as $v}}
<tr> <tr>
<td>{{$v.title}}</td> <td class="am-hide-sm-only row-first">
<td>{{$v.name}}</td> <p class="ellipsis">{{$v.title}}</p>
<td>{{$v.type_name}}</td> {{if !empty($v['photo'])}}
<td class="am-hide-sm-only">{{$v.gender_name}}</td> <div data-am-widget="slider" class="am-slider am-slider-a1" data-am-slider='{"directionNav":false, "slideshow":false}' >
<td class="am-hide-sm-only">{{$v.varieties}}</td> <ul class="am-slides">
<td class="am-hide-sm-only">{{$v.sterilization_name}}</td> {{foreach $v.photo as $photo}}
<td class="am-hide-sm-only">{{$v.vaccine_name}}</td> <li>
<img src="{{$photo.images}}" />
</li>
{{/foreach}}
</ul>
</div>
{{/if}}
</td>
<td>
编号:{{if empty($v['pest_no'])}}<span class="items-value-empty">未填写</span>{{else /}}{{$v.pest_no}}{{/if}}<br />
名字:{{if empty($v['name'])}}<span class="items-value-empty">未填写</span>{{else /}}{{$v.name}}{{/if}}<br />
类型:{{if empty($v['type_name'])}}<span class="items-value-empty">未填写</span>{{else /}}{{$v.type_name}}{{/if}}<br />
性别:{{if empty($v['gender_name'])}}<span class="items-value-empty">未填写</span>{{else /}}{{$v.gender_name}}{{/if}}<br />
生日:{{if empty($v['birthday_name'])}}<span class="items-value-empty">未填写</span>{{else /}}{{$v.birthday_name}}{{/if}}<br />
年龄:{{if empty($v['age'])}}<span class="items-value-empty">未填写</span>{{else /}}<span class="am-badge am-radius">{{$v.age}}</span>{{/if}}<br />
品种:{{if empty($v['varieties'])}}<span class="items-value-empty">未填写</span>{{else /}}{{$v.varieties}}{{/if}}<br />
绝育:{{$v.sterilization_name}}<br />
疫苗:{{$v.vaccine_name}}<br />
</td>
<td class="am-hide-sm-only">
姓名:{{if empty($v['person_name'])}}<span class="items-value-empty">未填写</span>{{else /}}{{$v.person_name}}{{/if}}<br />
电话:{{if empty($v['person_tel'])}}<span class="items-value-empty">未填写</span>{{else /}}{{$v.person_tel}}{{/if}}<br />
微信:{{if empty($v['person_weixin'])}}<span class="items-value-empty">未填写</span>{{else /}}{{$v.person_weixin}}{{/if}}<br />
</td>
<td class="am-hide-sm-only row-qucode">
<img src="{{$v.qrcode_url}}" alt="{{$v.title}}" />
<a href="#">
<p><i class="am-icon-cloud-download"></i> 下载二维码</p>
</a>
</td>
<td>{{$v.status_name}}</td>
<td class="am-hide-sm-only"> <td class="am-hide-sm-only">
{{if !empty($v['birthday_name'])}} 添加:{{$v.add_time_time}}
{{$v.birthday_name}}<br /> {{if !empty($v['upd_time_time'])}}
<br />更新:{{$v.upd_time_time}}
{{/if}} {{/if}}
<span class="am-badge am-radius">{{$v.age}}</span>
</td> </td>
<td class="am-hide-sm-only">{{$v.add_time_time}}</td>
<td> <td>
edit <a href="{{:PluginsHomeUrl('petscms', 'pets', 'saveinfo',array_merge($params, ['id'=>$v['id']]))}}" class="am-btn am-btn-secondary am-btn-xs am-radius am-icon-edit am-btn-block"> 编辑</a>
<a href="{{:PluginsHomeUrl('petscms', 'pets', 'saveinfo',array_merge($params, ['id'=>$v['id']]))}}" class="am-btn am-btn-success am-btn-xs am-radius am-icon-newspaper-o am-btn-block"> 详情</a>
</td> </td>
</tr> </tr>
{{/foreach}} {{/foreach}}
{{/if}} {{/if}}
{{if empty($data_list)}} {{if empty($data_list)}}
<tr> <tr>
<td colspan="10"> <td colspan="7">
<div class="table-no"><i class="am-icon-warning"></i> 没有相关数据</div> <div class="table-no"><i class="am-icon-warning"></i> 没有相关数据</div>
</td> </td>
</tr> </tr>
......
此差异已折叠。
...@@ -737,7 +737,7 @@ background:url(../images/ibar_sprites.png) no-repeat;background-position:0px -23 ...@@ -737,7 +737,7 @@ background:url(../images/ibar_sprites.png) no-repeat;background-position:0px -23
/** /**
* 用户中心布局样式 * 用户中心左侧菜单
*/ */
.user-menu {position:fixed;z-index:10;bottom:70px;right:10px;} .user-menu {position:fixed;z-index:10;bottom:70px;right:10px;}
.user-sidebar {width:145px;min-height:100%;float:left;} .user-sidebar {width:145px;min-height:100%;float:left;}
...@@ -817,4 +817,22 @@ button { outline: none !important; } ...@@ -817,4 +817,22 @@ button { outline: none !important; }
padding: 5px 8px; padding: 5px 8px;
border-radius: 3px; border-radius: 3px;
border: 1px solid #ffd4d4; border: 1px solid #ffd4d4;
}
/**
* 公共
*/
legend {
padding-bottom: 0.2rem;
margin-bottom: 1rem;
border-bottom: 1px solid #e5e5e5;
}
legend .legend-title {
font-size: 14px;
}
legend a {
color: #e7747f;
}
.items-value-empty {
color: #999;
} }
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
.time i { position:absolute; margin:4px 0px 0px -15px; } .time i { position:absolute; margin:4px 0px 0px -15px; }
.price input { width:101px !important; } .price input { width:101px !important; }
.time, .time { width:50%; } .time, .time { width:50%; }
.so-list tr+tr>td:first-child { padding-top:10px; } .so-list tr+tr>td { padding-top:10px; }
.so-list .chosen-container { border-radius:2px; } .so-list .chosen-container { border-radius:2px; }
.text-grey { color: #999; } .text-grey { color: #999; }
.chosen-container-single .chosen-single, .so-list select { height: 28px; line-height: 28px; width: 100%; } .chosen-container-single .chosen-single, .so-list select { height: 28px; line-height: 28px; width: 100%; }
......
.user-content-body legend { .user-content-body .dl-content a {
padding-bottom: 0.2rem;
margin-bottom: 1rem;
border-bottom: 1px solid #e5e5e5;
}
.user-content-body .legend-title {
font-size: 16px;
}
.user-content-body a {
color: #e7747f; color: #e7747f;
} }
.user-content-body .items-value-empty {
color: #999;
}
.user-content-body .span-edit { .user-content-body .span-edit {
margin-left: 15px; margin-left: 15px;
} }
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
.time i { position:absolute; margin:4px 0px 0px -15px; } .time i { position:absolute; margin:4px 0px 0px -15px; }
.price input { width:101px !important; } .price input { width:101px !important; }
.time, .time { width:50%; } .time, .time { width:50%; }
.so-list tr+tr>td:first-child { padding-top:10px; } .so-list tr+tr>td { padding-top:10px; }
.so-list .chosen-container { border-radius:2px; } .so-list .chosen-container { border-radius:2px; }
.text-grey { color: #999; } .text-grey { color: #999; }
.chosen-container-single .chosen-single, .so-list select { height: 28px; line-height: 28px; width: 100%; } .chosen-container-single .chosen-single, .so-list select { height: 28px; line-height: 28px; width: 100%; }
......
...@@ -10,13 +10,20 @@ ...@@ -10,13 +10,20 @@
.time i { position:absolute; margin:4px 0px 0px -15px; } .time i { position:absolute; margin:4px 0px 0px -15px; }
.price input { width:101px !important; } .price input { width:101px !important; }
.time, .time { width:50%; } .time, .time { width:50%; }
.so-list tr+tr>td:first-child { padding-top:10px; } .so-list tr+tr>td { padding-top:10px; }
.so-list .chosen-container { border-radius:2px; } .so-list .chosen-container { border-radius:2px; }
.text-grey { color: #999; } .text-grey { color: #999; }
.chosen-container-single .chosen-single, .so-list select { height: 28px; line-height: 28px; width: 100%; } .chosen-container-single .chosen-single, .so-list select { height: 28px; line-height: 28px; width: 100%; }
.reset-submit { margin-left: 20px; } .reset-submit { margin-left: 20px; }
.so-list select { padding: 0 0 0 8px; } .so-list select { padding: 0 0 0 8px; }
.operation-nav { margin-top: 15px; } .operation-nav { margin: 15px 0 10px 0; }
.row-qucode img { max-width: 100px; }
.row-qucode p { margin-top: 5px; }
.row-qucode a:hover, .row-qucode a:focus { text-decoration: none; }
.row-first { width: 20%; }
.row-first p { font-weight: 500; max-width: 240px; }
.row-first .am-slider { max-height: 130px; }
.am-slider .am-slides img { width: auto; max-height: 100%; margin: 0 auto; }
@media only screen and (min-width: 641px){ @media only screen and (min-width: 641px){
.so-list .chosen-container, .so-list select { width:217px !important; display: -webkit-inline-box; } .so-list .chosen-container, .so-list select { width:217px !important; display: -webkit-inline-box; }
.thin_sub:hover { color:#F60; } .thin_sub:hover { color:#F60; }
...@@ -35,4 +42,30 @@ ...@@ -35,4 +42,30 @@
/** /**
* 添加/编辑页面 * 添加/编辑页面
*/ */
.person-view .am-form-group:last-child {border-bottom: 0; } .base-view .am-form-group:last-child, .person-view .am-form-group:last-child, .lose-view .am-form-group:last-child {border-bottom: 0; }
\ No newline at end of file form.form-validation h2 { font-weight: 700; font-size: 14px; }
form.form-validation .am-divider { margin: 10px auto; }
.lose-view { margin-top: 30px; }
form.form-validation .am-alert-secondary { background-color: #f8f8f8; }
form.form-validation .am-alert-warning { background-color: #fffbf7; }
/**
* 地图、联动地址
*/
form.form-validation .map-address {
border-bottom: 0;
padding-bottom: 0;
margin-bottom: 10px;
}
form.form-validation .region-linkage .chosen-select {
display: -webkit-inline-box;
width: calc(33.3% - 3px) !important;
}
form.form-validation .region-linkage .chosen-select .chosen-single {
width: 100%;
}
form.form-validation #map {
width: 100%;
height: 350px;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册