hrjy 2 anos atrás
pai
commit
b727daaa28

+ 16 - 0
app/admin/controller/ump/StoreCouponUser.php

@@ -3,6 +3,7 @@
 namespace app\admin\controller\ump;
 
 use app\admin\controller\AuthController;
+use app\admin\model\article\Article as ArticleModel;
 use app\admin\model\wechat\WechatUser;
 use crmeb\services\UtilService as Util;
 use crmeb\services\JsonService as Json;
@@ -114,4 +115,19 @@ class StoreCouponUser extends AuthController
             return Json::successful('发放成功!');
     }
 
+
+    /**
+     * 删除图文
+     * @param $id
+     * @return \think\response\Json
+     */
+    public function delete($id)
+    {
+        $res = CouponUserModel::del($id);
+        if (!$res)
+            return Json::fail('删除失败,请稍候再试!');
+        else
+            return Json::successful('删除成功!');
+    }
+
 }

+ 35 - 0
app/admin/view/ump/store_coupon_user/index.php

@@ -43,9 +43,11 @@
                             <th class="text-center">优惠券最低消费</th>
                             <th class="text-center">优惠券开始使用时间</th>
                             <th class="text-center">优惠券结束使用时间</th>
+                            <th class="text-center">优惠券使用时间</th>
                             <th class="text-center">获取放方式</th>
                             <th class="text-center">是否可用</th>
                             <th class="text-center">状态</th>
+                            <th class="text-center">操作</th>
                         </tr>
                         </thead>
                         <tbody class="">
@@ -83,6 +85,15 @@
                                 {$vo.end_time|date='Y-m-d H:i:s'}
                                 {/if}
 
+                            </td>
+                            <td class="text-center">
+                                {if ($vo.use_time == 0)}
+                                未使用
+                                {/if}
+                                {if ($vo.use_time > 0)}
+                                {$vo.use_time|date='Y-m-d H:i:s'}
+                                {/if}
+
                             </td>
                             <td class="text-center">
                                 {$vo.type == 'send' ? '后台发放' : '手动领取'}
@@ -103,6 +114,9 @@
                                 未使用
                                 {/if}
                             </td>
+                            <td class="text-center">
+                                <button  style="margin-top: 5px;" class="btn btn-danger btn-xs del_news_one" data-id="{$vo.id}" type="button" data-url="{:Url('delete',array('id'=>$vo['id']))}" ><i class="fa fa-times"></i> 删除</button>
+                            </td>
                         </tr>
                         {/volist}
                         </tbody>
@@ -114,3 +128,24 @@
     </div>
 </div>
 {/block}
+{block name="script"}
+<script>
+
+    $('.del_news_one').on('click',function(){
+        window.t = $(this);
+        var _this = $(this),url =_this.data('url');
+        $eb.$swal('delete',function(){
+            $eb.axios.get(url).then(function(res){
+                console.log(res);
+                if(res.status == 200 && res.data.code == 200) {
+                    $eb.$swal('success',res.data.msg);
+                    _this.parents('tr').remove();
+                }else
+                    return Promise.reject(res.data.msg || '删除失败')
+            }).catch(function(err){
+                $eb.$swal('error',err);
+            });
+        })
+    });
+</script>
+{/block}