Merge branch 'dev' into wanfang

dev
曾超新 5 years ago
commit dbc85adb1c
  1. 47
      frontend/controllers/InsurerController.php
  2. 3
      frontend/views/common/index.php
  3. 24
      frontend/views/insurer/my-list-info.php
  4. 20
      frontend/views/menu/edit.php
  5. 121
      frontend/views/permissions/permission.php

@ -3502,6 +3502,47 @@ class InsurerController extends BaseController
} }
return $result; return $result;
} }
public function actionGiftCancel()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
if ($request->isPost && $this->my->id == 1) {
$id = $request->post('order_id', 0);
$order_info = OrderT::findOne($id);
if (!$order_info) {
$result['msg'] = '订单不存在';
return $result;
}
$tran = OrderT::getDb()->beginTransaction();
try {
// 删除礼品/券库信息
GiftTicketTUse::deleteAll('order_id=' . $order_info->id);
// 修改订单礼品/券信息
OrderGiftT::updateAll(['gift_src'=>''],['order_id'=>$order_info->id]);
// 修改订单状态
$order_info->gift_status = 0;
$order_info->save();
$result['success'] = true;
$result['msg'] = '保存成功';
$tran->commit();
} catch (\Exception $e) {
$tran->rollBack();
$result['msg'] = $e->getMessage();
}
}else {
$result['msg'] = '当前用户无此权限';
}
return $result;
}
public function getGift($k, $v, $car_no, $order_info, $order_gift_id) public function getGift($k, $v, $car_no, $order_info, $order_gift_id)
{ {
$result = array(); $result = array();
@ -3516,7 +3557,6 @@ class InsurerController extends BaseController
//礼券 //礼券
if ($gift_info && $gift_info->type_id == 2) { if ($gift_info && $gift_info->type_id == 2) {
$pinyin_arr = explode(' ', $gift_info->pinyin_name); $pinyin_arr = explode(' ', $gift_info->pinyin_name);
// dd($pinyin_arr);
$liquan_str = 'ch'; $liquan_str = 'ch';
//获取礼券拼音首字母 //获取礼券拼音首字母
foreach ($pinyin_arr as $first) { foreach ($pinyin_arr as $first) {
@ -3534,13 +3574,12 @@ class InsurerController extends BaseController
if ($gift_use) { if ($gift_use) {
$liquan_str .= sprintf("%04d", $gift_use->gift_shuzi + 1); $liquan_str .= sprintf("%04d", $gift_use->gift_shuzi + 1);
$new_gift_use->gift_shuzi = $gift_use->gift_shuzi + 1; $new_gift_use->gift_shuzi = $gift_use->gift_shuzi + 1;
$new_gift_use->code = $liquan_str;
} else { } else {
$liquan_str .= sprintf("%04d", 1); $liquan_str .= sprintf("%04d", 1);
$new_gift_use->gift_shuzi = 1; $new_gift_use->gift_shuzi = 1;
$new_gift_use->code = strtoupper($liquan_str);
} }
$new_gift_use->code = strtoupper($liquan_str);
$new_gift_use->op_id = $this->my->id; $new_gift_use->op_id = $this->my->id;
$new_gift_use->type_id = $v; //礼券ID $new_gift_use->type_id = $v; //礼券ID
$new_gift_use->input_date = date('Y-m-d H:i:s'); $new_gift_use->input_date = date('Y-m-d H:i:s');
@ -3565,7 +3604,7 @@ class InsurerController extends BaseController
if ($shiwu_use) { if ($shiwu_use) {
$new_shiwu->gift_shuzi = $shiwu_use->gift_shuzi + 1; $new_shiwu->gift_shuzi = $shiwu_use->gift_shuzi + 1;
$new_shiwu->code = sprintf("%04d", $gift_use->gift_shuzi + 1); $new_shiwu->code = sprintf("%04d", $shiwu_use->gift_shuzi + 1);
} else { } else {
$new_shiwu->gift_shuzi = 1; $new_shiwu->gift_shuzi = 1;
$new_shiwu->code = sprintf("%04d", 1); $new_shiwu->code = sprintf("%04d", 1);

@ -91,6 +91,9 @@
</ul> </ul>
</div> </div>
<a href="/common/logout" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a> <a href="/common/logout" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
<a class="navbar-minimalize minimalize-styl-2 btn btn-success roll-right" href="#" style="position:fixed;bottom:40px;">
<i class="fa fa-bars"></i>
</a>
</div> </div>
<div class="row J_mainContent" id="content-main"> <div class="row J_mainContent" id="content-main">
<iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="/common/welcome" frameborder="0" data-id="index_v1.html" seamless></iframe> <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="/common/welcome" frameborder="0" data-id="index_v1.html" seamless></iframe>

@ -195,8 +195,8 @@ use common\models\PriceT;
<tr> <tr>
<th class="bg-warning">送单地址</th> <th class="bg-warning">送单地址</th>
<td colspan="5" class="form-inline"> <td colspan="5" class="form-inline">
<label><?=$order_info->sendCity->name?></label> <label><?=$order_info->sendCity?$order_info->sendCity->name:''?></label>
<label><?=$order_info->sendDistrict->name?></label> <label><?=$order_info->sendDistrict?$order_info->sendDistrict->name:''?></label>
<label><?=$order_info->send_address?></label> <label><?=$order_info->send_address?></label>
</td> </td>
</tr> </tr>
@ -213,6 +213,11 @@ use common\models\PriceT;
<strong>确认礼品</strong> <strong>确认礼品</strong>
</button> </button>
<?php } ?> <?php } ?>
<?php if($order_info->gift_status == 1 && $my_id == 1) { ?>
<button type="button" class="btn btn-primary btn-cancel" type="button">
<strong>取消确认</strong>
</button>
<?php } ?>
<button type="button" class="btn btn-primary btn-back" type="button"> <button type="button" class="btn btn-primary btn-back" type="button">
<strong>返 回</strong> <strong>返 回</strong>
</button> </button>
@ -345,6 +350,21 @@ use common\models\PriceT;
// //
}); });
}); });
<?php if($order_info->gift_status == 1 && $my_id == 1) { ?>
$('.btn-cancel').click(function () {
parent.layer.confirm('此操作将回滚礼品状态,删除已生成礼物记录,确定继续?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
$.post('/insurer/gift-cancel',{order_id:<?=$order_info->id?>},function(data) {
parent.layer.msg(data.msg);
window.location.reload();
}, 'json');
}, function(){
//
});
});
<?php } ?>
}); });
</script> </script>
<?php $this->endBlock(); ?> <?php $this->endBlock(); ?>

@ -13,12 +13,12 @@ use \common\libs\MyLib;
<form role="form" class="form-horizontal data-from" id="theFrm"> <form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="id" value="<?=intval($info->id)?>"> <input type="hidden" name="id" value="<?=intval($info->id)?>">
<div class="form-group"> <div class="form-group">
<label class="col-sm-1 control-label">菜单名称</label> <label class="col-sm-2 control-label">菜单名称</label>
<div class="col-sm-3"> <div class="col-sm-4">
<input type="text" name="name" value="<?=$info->name?>" class="form-control"> <input type="text" name="name" value="<?=$info->name?>" class="form-control">
</div> </div>
<label class="col-sm-1 control-label">上级菜单</label> <label class="col-sm-2 control-label">上级菜单</label>
<div class="col-sm-3"> <div class="col-sm-4">
<select name="parent_id" class="form-control"> <select name="parent_id" class="form-control">
<option value="0"></option> <option value="0"></option>
<?php <?php
@ -33,18 +33,18 @@ use \common\libs\MyLib;
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-1 control-label">图标</label> <label class="col-sm-2 control-label">图标</label>
<div class="col-sm-3"> <div class="col-sm-4">
<input type="text" name="icon" value="<?=$info->icon?>" class="form-control"> <input type="text" name="icon" value="<?=$info->icon?>" class="form-control">
</div> </div>
<label class="col-sm-1 control-label">路径</label> <label class="col-sm-2 control-label">路径</label>
<div class="col-sm-3"> <div class="col-sm-4">
<input type="text" name="path" value="<?=$info->path?>" class="form-control"> <input type="text" name="path" value="<?=$info->path?>" class="form-control">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-1 control-label">排序</label> <label class="col-sm-2 control-label">排序</label>
<div class="col-sm-3"> <div class="col-sm-4">
<input type="text" name="order_id" value="<?=$info->order_id?>" class="form-control"> <input type="text" name="order_id" value="<?=$info->order_id?>" class="form-control">
</div> </div>
</div> </div>

@ -2,71 +2,92 @@
use \common\libs\MyLib; use \common\libs\MyLib;
?> ?>
<?php $this->beginBlock('header_css'); ?> <?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"> <link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?> <?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight"> <div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins"> <div class="ibox float-e-margins">
<div class="ibox-content"> <div class="ibox-content">
<div class="row"> <div class="row">
<form id="theFrm"> <form id="theFrm">
<input type="hidden" name="group_id" value="<?=$permissions_id?>"> <input type="hidden" name="group_id" value="<?=$permissions_id?>">
<?php foreach($menu_items as $item) { ?> <?php foreach($menu_items as $item) { ?>
<div class="col-sm-2"> <div class="col-sm-2">
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"> <div class="panel-heading">
<div class="row">
<div class="col-sm-12">
<label class="i-checks">
<input type="checkbox" name="menu_ids[]" value="<?=$item->id?>" <?=in_array($item->id, $menu_ids)?'checked':''?>><i></i> <?=$item->name?>
</label>
</div>
</div>
</div>
<div class="panel-body">
<?php foreach($item->menus as $sub_item) { ?>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<label class="i-checks"> <label class="i-checks">
<input type="checkbox" name="menu_ids[]" value="<?=$sub_item->id?>" <?=in_array($sub_item->id, $menu_ids)?'checked':''?>><i></i> <?=$sub_item->name?> <input type="checkbox" class="parent_checkbox" name="menu_ids[]" value="<?=$item->id?>" <?=in_array($item->id, $menu_ids)?'checked':''?>><i></i> <?=$item->name?>
</label> </label>
</div> </div>
</div> </div>
<?php } ?> </div>
<div class="panel-body">
<?php foreach($item->menus as $sub_item) { ?>
<div class="row">
<div class="col-sm-12">
<label class="i-checks">
<input type="checkbox" class="sub_checkbox" name="menu_ids[]" value="<?=$sub_item->id?>" <?=in_array($sub_item->id, $menu_ids)?'checked':''?>><i></i> <?=$sub_item->name?>
</label>
</div>
</div>
<?php } ?>
</div>
</div> </div>
</div> </div>
</div> <?php } ?>
<?php } ?> </form>
</form> </div>
</div> <div class="row">
<div class="row"> <div class="col-sm-5 col-sm-offset-5">
<div class="col-sm-5 col-sm-offset-5"> <button class="btn btn-primary btn-save" type="button">
<button class="btn btn-primary btn-save" type="button"> <strong>保 存</strong>
<strong>保 存</strong> </button>
</button> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<?php $this->beginBlock('footer_js'); ?> <?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script> <script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script> <script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script> <script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script> <script>
$(function(){ $(function(){
$('.btn-save').click(function(){ $('.btn-save').click(function(){
var params = $('#theFrm').serialize(); var params = $('#theFrm').serialize();
$.post('/permissions/permission',params,function(obj){ $.post('/permissions/permission',params,function(obj){
if(obj.success) { if(obj.success) {
parent.layer.msg('保存成功'); parent.layer.msg('保存成功');
layer_close(); layer_close();
} else { } else {
parent.layer.msg(data.msg); parent.layer.msg(data.msg);
}
},'json');
});
//处理自动选择功能
$('.parent_checkbox').click(function() {
var checked = $(this).prop('checked');
var subs = $(this).parent().parent().parent().parent().next().find('.sub_checkbox');
for(var i = 0; i < subs.length; i++) {
if(checked) {
$(subs[i]).prop('checked', 'checked');
} else {
$(subs[i]).prop('checked', '');
}
} }
},'json'); });
$('.sub_checkbox').click(function() {
var checked = $(this).prop('checked');
var subs = $(this).parent().parent().parent().parent().prev().find('.parent_checkbox');
for(var i = 0; i < subs.length; i++) {
if(checked) {
$(subs[i]).prop('checked', 'checked');
}
}
});
}); });
}); </script>
</script> <?php $this->endBlock(); ?>
<?php $this->endBlock(); ?>
Loading…
Cancel
Save