diff --git a/frontend/controllers/InsurerController.php b/frontend/controllers/InsurerController.php index 3360495..fb20bc7 100644 --- a/frontend/controllers/InsurerController.php +++ b/frontend/controllers/InsurerController.php @@ -3502,6 +3502,47 @@ class InsurerController extends BaseController } 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) { $result = array(); @@ -3516,7 +3557,6 @@ class InsurerController extends BaseController //礼券 if ($gift_info && $gift_info->type_id == 2) { $pinyin_arr = explode(' ', $gift_info->pinyin_name); -// dd($pinyin_arr); $liquan_str = 'ch'; //获取礼券拼音首字母 foreach ($pinyin_arr as $first) { @@ -3534,13 +3574,12 @@ class InsurerController extends BaseController if ($gift_use) { $liquan_str .= sprintf("%04d", $gift_use->gift_shuzi + 1); $new_gift_use->gift_shuzi = $gift_use->gift_shuzi + 1; - $new_gift_use->code = $liquan_str; } else { $liquan_str .= sprintf("%04d", 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->type_id = $v; //礼券ID $new_gift_use->input_date = date('Y-m-d H:i:s'); @@ -3565,7 +3604,7 @@ class InsurerController extends BaseController if ($shiwu_use) { $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 { $new_shiwu->gift_shuzi = 1; $new_shiwu->code = sprintf("%04d", 1); diff --git a/frontend/views/common/index.php b/frontend/views/common/index.php index 9eb75d2..a4a9689 100644 --- a/frontend/views/common/index.php +++ b/frontend/views/common/index.php @@ -91,6 +91,9 @@ 退出 + + +
diff --git a/frontend/views/insurer/my-list-info.php b/frontend/views/insurer/my-list-info.php index 5a31651..5af01b9 100644 --- a/frontend/views/insurer/my-list-info.php +++ b/frontend/views/insurer/my-list-info.php @@ -195,8 +195,8 @@ use common\models\PriceT; 送单地址 - - + + @@ -213,6 +213,11 @@ use common\models\PriceT; 确认礼品 + gift_status == 1 && $my_id == 1) { ?> + + @@ -345,6 +350,21 @@ use common\models\PriceT; // }); }); + gift_status == 1 && $my_id == 1) { ?> + $('.btn-cancel').click(function () { + parent.layer.confirm('此操作将回滚礼品状态,删除已生成礼物记录,确定继续?', { + btn: ['确认','取消'], //按钮 + shade: false //不显示遮罩 + }, function(){ + $.post('/insurer/gift-cancel',{order_id:id?>},function(data) { + parent.layer.msg(data.msg); + window.location.reload(); + }, 'json'); + }, function(){ + // + }); + }); + }); endBlock(); ?> diff --git a/frontend/views/menu/edit.php b/frontend/views/menu/edit.php index a91852e..837769f 100644 --- a/frontend/views/menu/edit.php +++ b/frontend/views/menu/edit.php @@ -13,12 +13,12 @@ use \common\libs\MyLib;
- -
+ +
- -
+ +
- -
+ +
- -
+ +
diff --git a/frontend/views/permissions/permission.php b/frontend/views/permissions/permission.php index b770c87..fba3055 100644 --- a/frontend/views/permissions/permission.php +++ b/frontend/views/permissions/permission.php @@ -2,71 +2,92 @@ use \common\libs\MyLib; ?> beginBlock('header_css'); ?> - + endBlock(); ?> -
-
-
-
- - - -
-
-
-
-
- -
-
-
-
- menus as $sub_item) { ?> +
+
+
+
+ + + +
+
+
- +
+
+ menus as $sub_item) { ?> +
+
+ +
+
+ +
-
- - -
-
-
- + + +
+
+
+ +
-
beginBlock('footer_js'); ?> - - - - + + + -endBlock(); ?> + +endBlock(); ?> \ No newline at end of file