作者 刘朕
1 个管道 的构建 通过 耗费 1 秒

表单类型收集功能添加,前台逻辑验证添加

@@ -195,4 +195,54 @@ class OrderSortController extends AdminBaseController @@ -195,4 +195,54 @@ class OrderSortController extends AdminBaseController
195 } 195 }
196 $this->success('删除成功'); 196 $this->success('删除成功');
197 } 197 }
  198 +
  199 + /**
  200 + * 修改类型收集状态
  201 + * @adminMenu(
  202 + * 'name' => '修改类型收集状态',
  203 + * 'parent' => 'index',
  204 + * 'display'=> false,
  205 + * 'hasView'=> false,
  206 + * 'order' => 6,
  207 + * 'icon' => '',
  208 + * 'remark' => '修改类型收集状态',
  209 + * 'param' => ''
  210 + * )
  211 + */
  212 + public function stop()
  213 + {
  214 + $param = $this->request->param();
  215 + $msg = '';
  216 +
  217 + if (isset($param['ids']) && isset($param["is_stop"])) {
  218 + $stop = $param["is_stop"];
  219 + $ids = $this->request->param('ids/a');
  220 +
  221 + $this->order_sort_model->where(['id' => ['in', $ids]])->update(['is_stop' => $stop, 'update_time' => time()]);
  222 +
  223 + if($stop == 0) {
  224 + $msg = "开启收集成功!";
  225 + }
  226 + if($stop == 1) {
  227 + $msg = "停止收集成功!";
  228 + }
  229 + $this->success($msg, '');
  230 +
  231 + }
  232 + if (isset($param['id']) && isset($param["is_stop"])) {
  233 + $stop = $param["is_stop"];
  234 + $id = $this->request->param('id');
  235 +
  236 + $this->order_sort_model->where(['id' => $id])->update(['is_stop' => $stop, 'update_time' => time()]);
  237 +
  238 + if($stop == 0) {
  239 + $msg = "开启收集成功!";
  240 + }
  241 + if($stop == 1) {
  242 + $msg = "停止收集成功!";
  243 + }
  244 + $this->success($msg,'');
  245 +
  246 + }
  247 + }
198 } 248 }
@@ -123,7 +123,7 @@ class MemberSalesController extends HomeBaseController @@ -123,7 +123,7 @@ class MemberSalesController extends HomeBaseController
123 ]; 123 ];
124 $allow_order = Db::name('MemberSales')->where($where)->value('allow_order'); 124 $allow_order = Db::name('MemberSales')->where($where)->value('allow_order');
125 $allow_order_array = explode(',',$allow_order); 125 $allow_order_array = explode(',',$allow_order);
126 - $typeList = $this->singleData($this->table,['id'=>['in',$allow_order_array],'delete_time'=>0],1); 126 + $typeList = $this->singleData($this->table,['id'=>['in',$allow_order_array],'is_stop'=>0,'delete_time'=>0],1);
127 $this->assign('typeList',$typeList); 127 $this->assign('typeList',$typeList);
128 return $this->fetch(); 128 return $this->fetch();
129 } 129 }
@@ -141,6 +141,12 @@ class MemberSalesController extends HomeBaseController @@ -141,6 +141,12 @@ class MemberSalesController extends HomeBaseController
141 'delete_time' => 0 141 'delete_time' => 0
142 ]; 142 ];
143 $typeInfo = $this->singleData($this->table,$where); 143 $typeInfo = $this->singleData($this->table,$where);
  144 + if(empty($typeInfo)) {
  145 + $this->error('该表单类型不存在');
  146 + }
  147 + if($typeInfo['is_stop'] == 1) {
  148 + $this->error('该表单类型已关闭,无法添加电子订单');
  149 + }
144 $typeInfo['options'] = json_decode($typeInfo['options'],true); 150 $typeInfo['options'] = json_decode($typeInfo['options'],true);
145 $goodsList = []; 151 $goodsList = [];
146 $default = 0; 152 $default = 0;
@@ -34,9 +34,10 @@ @@ -34,9 +34,10 @@
34 <th width="50">ID</th> 34 <th width="50">ID</th>
35 <th>类型名称</th> 35 <th>类型名称</th>
36 <th>图标</th> 36 <th>图标</th>
  37 + <th>收集状态</th>
37 <th width="130">更新时间</th> 38 <th width="130">更新时间</th>
38 <th width="130">发布时间</th> 39 <th width="130">发布时间</th>
39 - <th width="120">操作</th> 40 + <th width="150">操作</th>
40 </tr> 41 </tr>
41 </thead> 42 </thead>
42 <foreach name="list" item="vo"> 43 <foreach name="list" item="vo">
@@ -52,11 +53,18 @@ @@ -52,11 +53,18 @@
52 <img src="{:cmf_get_image_preview_url($vo.icon)}" width="50"/> 53 <img src="{:cmf_get_image_preview_url($vo.icon)}" width="50"/>
53 </a> 54 </a>
54 </td> 55 </td>
  56 + <td><eq name="vo.is_stop" value="0">收集中</eq><eq name="vo.is_stop" value="1">已停止</eq></td>
55 <td>{:date('Y-m-d H:i',$vo.create_time)}</td> 57 <td>{:date('Y-m-d H:i',$vo.create_time)}</td>
56 <td>{:date('Y-m-d H:i',$vo.update_time)}</td> 58 <td>{:date('Y-m-d H:i',$vo.update_time)}</td>
57 <td> 59 <td>
58 <!--<a href="{:url('OrderSort/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>--> 60 <!--<a href="{:url('OrderSort/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>-->
59 <a href="javascript:parent.openIframeDialog('{:url('Order/index_sort',['sort_id'=>$vo['id']])}','电子订单列表',{width:'1300px',height:'750px'});">查看订单</a> 61 <a href="javascript:parent.openIframeDialog('{:url('Order/index_sort',['sort_id'=>$vo['id']])}','电子订单列表',{width:'1300px',height:'750px'});">查看订单</a>
  62 + <eq name="vo.is_stop" value="0">
  63 + <a href="{:url('OrderSort/stop',array('id'=>$vo['id'],'is_stop'=>1))}" class="js-ajax-dialog-btn" data-msg="确定停止收集吗?">停止</a>
  64 + </eq>
  65 + <eq name="vo.is_stop" value="1">
  66 + <a href="{:url('OrderSort/stop',array('id'=>$vo['id'],'is_stop'=>0))}" class="js-ajax-dialog-btn" data-msg="确定开启收集吗?">收集</a>
  67 + </eq>
60 <a href="{:url('OrderSort/delete',['id'=>$vo['id']])}" class="js-ajax-delete">{:lang('DELETE')}</a> 68 <a href="{:url('OrderSort/delete',['id'=>$vo['id']])}" class="js-ajax-delete">{:lang('DELETE')}</a>
61 </td> 69 </td>
62 </tr> 70 </tr>
@@ -68,6 +76,7 @@ @@ -68,6 +76,7 @@
68 <th width="50">ID</th> 76 <th width="50">ID</th>
69 <th>类型名称</th> 77 <th>类型名称</th>
70 <th>图标</th> 78 <th>图标</th>
  79 + <th>收集状态</th>
71 <th width="130">更新时间</th> 80 <th width="130">更新时间</th>
72 <th width="130">发布时间</th> 81 <th width="130">发布时间</th>
73 <th width="90">操作</th> 82 <th width="90">操作</th>