edit_expiretime.html 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <form action="{:U('user/edit_expiretime')}" method="post" id="expireFrom" class="form-horizontal form-validate" enctype="multipart/form-data">
  2. <input type="hidden" name="id" value="<?php echo $member['member_id'];?>" />
  3. <input type="hidden" name="is_post" value="1" />
  4. <div class="layui-fluid">
  5. <div class="layui-card">
  6. <div class="layui-form-item">
  7. <label class="layui-form-label">到期时间</label>
  8. <div class="layui-input-block">
  9. <input type="text" class="layui-input" name="expire_time" id="expire_time" placeholder="yyyy-MM-dd HH:mm:ss" value="<?php echo date('Y-m-d H:i:s',$member['card_end_time']); ?>" readonly>
  10. </div>
  11. </div>
  12. </div>
  13. <div class="layui-form-item">
  14. <label class="layui-form-label"> </label>
  15. <div class="layui-input-block">
  16. <input type="button" value="确定修改" class="btn btn-primary expireBtn" />
  17. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  18. <a class="btn btn-default cancelBtn" style='margin-left:10px;'>取消</a>
  19. </div>
  20. </div>
  21. </div>
  22. </form>
  23. <?php $time = date('Y-m-d H:i:s'); ?>
  24. <script>
  25. layui.use('laydate', function(){
  26. var laydate = layui.laydate;
  27. laydate.render({
  28. elem: '#expire_time'
  29. ,type: 'datetime'
  30. ,min: '<?php echo $time;?>'
  31. });
  32. $('.cancelBtn').click(function(){
  33. layer.closeAll();
  34. });
  35. //监听提交
  36. $('.expireBtn').click(function(){
  37. var expire_time = $('#expire_time').val();
  38. if(expire_time == ''){
  39. layer.msg("请选择到期时间",{icon: 1,time: 2000});
  40. return false;
  41. }else{
  42. var s_data = $('#expireFrom').serialize();
  43. $.ajax({
  44. url: "{:U('user/edit_expiretime')}",
  45. type:'post',
  46. dataType:'json',
  47. data:s_data,
  48. success:function(info){
  49. if(info.status == 0)
  50. {
  51. layer.msg(info.result.message,{icon: 1,time: 2000});
  52. }else if(info.status == 1){
  53. var go_url = location.href;
  54. if( info.result.hasOwnProperty("url") )
  55. {
  56. go_url = info.result.url;
  57. }
  58. layer.msg('操作成功',{time: 1000,
  59. end:function(){
  60. location.href = info.result.url;
  61. }
  62. });
  63. }
  64. }
  65. })
  66. }
  67. });
  68. });
  69. </script>