HTML上做表单页面上的开启和冻结切换以及功能实
新手献上的
新手献上的
<script type="text/javascript" src="/min/?g=js_validate">
</script>
<script type="text/javascript" src="/Res/js/autoHeight.js">
</script>
<script type="text/javascript" src="/Res/Platform/js/member/checkLicense.js">
</script>
<script type="text/javascript">
function delete1(id) {
alert(id);
$.post("/Member/deleteCard", {
'id':id
}, function(data) {
data = eval('(' + data + ')');
if (data.code == 1) {
alert("删除成功!");
redirectNav('/Member/base_namecard', 'contentDiv');
}
else {
alert("删除失败!");
redirectNav('/Member/base_namecard', 'contentDiv');
}
});
}
$(function(){
var id= $("#id").val();
ids=id.split(",");
for(var i=0;i<ids.length;i++)
{ var a=$("#"+ids[i]);
a.parent().find("span").remove();
a.parent().prepend("<span>冻结</span>");
a.parent().prepend("<a href='#' id='"+ids[i]+"'>启用/</a>");
a.remove();
}
$("#scard tr td a").click(function(){
if($(this).text() == "冻结"){
var id=$(this).attr("id");
if(null!= id)
{
$.post('/Member/stopCard',
{
id:id
}
,function(data,status)
{
data=eval('('+data+')');
if(data.code==1)
{
var show=$("#"+id);
show.parent().find("span").remove();
show.parent().prepend("<span>冻结</span>");
show.parent().prepend("<a href='#' id='"+id+"'>启用/</a>");
show.remove();
redirectNav('/member/base_namecard','contentDiv','id=51');
return;
}
}
);
}
}
else if($(this).text() == "启用/"){
var id=$(this).attr("id");
if(null!= id)
{
$.post('/Member/startCard',
{
id:id
}
,function(data,status)
{
data=eval('('+data+')');
if(data.code==1)
{
var hide=$("#"+id);
hide.parent().find("span").remove();
hide.parent().prepend("<a href='#' id='"+id+"'>冻结</a>");
hide.parent().prepend("<span>启用/</span>");
hide.remove();
redirectNav('/member/base_namecard','contentDiv','id=51');
return;
}
}
);
}
}
});
});
</script>
<div class="bg">
<div class="vip_old">
<div style="height:28px; border: 1px solid #e9e9e9; background: #f2f2f2;line-height: 28px; font-size: 12px; text-indent: 10px; color: #333; font-weight: bold; margin:0 0 20px;">证照信息</div>
<div class="license_table" id="license">
<table id="scard" style="text-align:center; border-top:1px solid #ccc;" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="7%" style="border-left:1px solid #e6e6e6;">
唯一标识
</th>
<th width="7%" style="border-left:1px solid #e6e6e6;">
卡的类型
</th>
<th width="10%" style="border-left:1px solid #e6e6e6;">
持卡人姓名
</th>
<th width="10%" style="border-left:1px solid #e6e6e6;">
卡的余额
</th>
<th width="10%">
银行卡号
</th>
<th width="10%">
电话
</th>
<th width="7%">
卡的状态
</th>
<th width="10%" style="border-right:1px solid #e6e6e6;">
操作
</th>
<th width="10%">
启动设置
</th>
</tr>
<input style="display: none;" tyep='text' id="id" value="{$id}" />
<?php foreach($card as $c){
?>
<tr>
<td style="border-left:1px solid #e6e6e6;" >
{$c.id}
</td>
<td>
<?php
if($c['type']==1)
{
echo '企业卡';
}
?>
</td>
<td>
{$c.name}
<br/>
</td>
<td>
{$c.account}
</td>
<td>
{$c.idcard}
</td>
<td>
{$c.phone}
</td>
<td>
<?php
if($c['status']==0)
echo '冻结';
if($c['status']==1)
echo '启用';
?>
</td>
<td>
<a href="javascript:redirectNav('/Member/base_onecard?','contentDiv','id={$c.id}');"> 修改</a> <a href="javascript:delete1({$c.id});">删除</a>
</td>
<td>
<span>启用/</span><a id="{$c.id}" href="#">冻结</a>
</td>
</tr>
<?php } ?>
</table>
</div>
</div>
</div>
3. [文件] IcbccardModel.class.php ~ 2KB 下载(8) 跳至 [1] [3] [全屏预览]
<?php
/**
* 联名卡管理
* @author shendoudou
*
*/
import ( '@.Model.Platform.CommonModel' );
class IcbccardModel extends CommonModel {
public function findAllCard(){
$result = $this->select();
if ($result === false)
throw new DBException ( $this->getModelName (), $this->getDbError (), $this->getLastSql () );
return $result;
}
public function findOneCard($id){
$map['id']=$id;
$result = $this->where ($map)->find();
if ($result === false)
throw new DBException ( $this->getModelName (), $this->getDbError (), $this->getLastSql () );
return $result;
}
public function updateCard($id,$data){
$map['id']=$id;
$result = $this->where($map)->save($data);
if ($result === false)
throw new DBException ( $this->getModelName (), $this->getDbError (), $this->getLastSql () );
return $result;
}
public function deleteCard($id){
$map['id']=$id;
$result = $this->where($map)->delete();
if ($result === false)
throw new DBException ( $this->getModelName (), $this->getDbError (), $this->getLastSql () );
return $result;
}
public function findStatusId($status){
$map['status']=$status;
$result = $this->where($map)->field('id')->select();
if ($result === false)
throw new DBException ( $this->getModelName (), $this->getDbError (), $this->getLastSql () );
return $result;
}
public function changeCardStatus($id,$status){
$map['id']=$id;
$map['status']=$status;
$result = $this->save($map);
if ($result === false)
throw new DBException ( $this->getModelName (), $this->getDbError (), $this->getLastSql () );
return $result;
}
}
?>
精彩图集
精彩文章






