From 814c0e8a370cbfcc90c9a1308ea0d66092e3f6ae Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 07 Apr 2021 11:42:33 +0800
Subject: [PATCH] 20210407 活动管理

---
 zq-erp/src/main/resources/templates/views/admin/activity/activity-list.html     |  142 +++++++++++++++++++++++++++++++++++
 zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopActivitiesAction.java |   40 ++++-----
 2 files changed, 159 insertions(+), 23 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopActivitiesAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopActivitiesAction.java
index ae33fac..a0b3313 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopActivitiesAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopActivitiesAction.java
@@ -1,29 +1,32 @@
 package com.matrix.system.shopXcx.action;
 
-import com.matrix.core.constance.MatrixConstance;
-import com.matrix.core.constance.SystemMessageCode;
-import com.matrix.core.pojo.PaginationVO;
-import com.matrix.core.tools.*;
-import com.matrix.core.web.BaseAction;
-import com.matrix.core.constance.SystemErrorCode;
 import com.matrix.core.anotations.RemoveRequestToken;
+import com.matrix.core.anotations.SaveRequestToken;
+import com.matrix.core.constance.MatrixConstance;
+import com.matrix.core.constance.SystemErrorCode;
+import com.matrix.core.constance.SystemMessageCode;
+import com.matrix.core.exception.GlobleException;
+import com.matrix.core.pojo.AjaxResult;
+import com.matrix.core.pojo.PaginationVO;
+import com.matrix.core.tools.DateUtil;
+import com.matrix.core.tools.ModelUtils;
+import com.matrix.core.tools.StringUtils;
+import com.matrix.core.tools.WebUtil;
 import com.matrix.system.common.bean.SysUsers;
 import com.matrix.system.hive.plugin.util.CollectionUtils;
 import com.matrix.system.shopXcx.bean.*;
 import com.matrix.system.shopXcx.dao.*;
 import com.matrix.system.shopXcx.dto.SalonDTO;
 import com.matrix.system.shopXcx.dto.SecKillDTO;
-import org.springframework.stereotype.Controller;
-import com.matrix.core.exception.GlobleException;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-import com.matrix.core.anotations.SaveRequestToken;
-import com.matrix.core.pojo.AjaxResult;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
-import java.math.BigDecimal;
-import java.util.Arrays;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
@@ -308,13 +311,8 @@
 
         shopActivitiesDao.deleteById(actId);
         shopActivitiesGroupInfoDao.deleteByActId(actId);
-        int i = shopActivitiesGroupPriceDao.deleteByActId(actId);
-
-        if (i > 0) {
-            return new AjaxResult(AjaxResult.STATUS_SUCCESS, SystemMessageCode.DELETE_SUCCES, i);
-        } else {
-            throw new GlobleException(SystemErrorCode.DATA_DELETE_FAIL);
-        }
+        shopActivitiesGroupPriceDao.deleteByActId(actId);
+        return new AjaxResult(AjaxResult.STATUS_SUCCESS, SystemMessageCode.DELETE_SUCCES);
     }
 
     @RequestMapping(value = "/closeAct")
diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-list.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-list.html
index 697105b..a0a285b 100644
--- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-list.html
@@ -93,8 +93,19 @@
                         <el-table-column
                                 label="状态">
                             <template slot-scope="scope">
-                                <span v-if="scope.row.actStatus == 1">未发布</span>
-                                <span v-if="scope.row.actStatus == 2">未开始</span>
+
+                                <div v-if="scope.row.actType == 4">
+                                    <span v-if="scope.row.actStatus == 1">未发布</span>
+                                </div>
+                                <div v-if="scope.row.actType != 4">
+                                    <span v-if="scope.row.actStatus == 1">开启</span>
+                                </div>
+                                <div v-if="scope.row.actType == 4">
+                                    <span v-if="scope.row.actStatus == 2">未开始</span>
+                                </div>
+                                <div v-if="scope.row.actType != 4">
+                                    <span v-if="scope.row.actStatus == 2">关闭</span>
+                                </div>
                                 <span v-if="scope.row.actStatus == 3">进行中</span>
                                 <span v-if="scope.row.actStatus == 4">已结束</span>
                                 <span v-if="scope.row.actStatus == 5">已删除</span>
@@ -129,6 +140,12 @@
                                     <el-button type="primary" v-if="[3,4,5].includes(scope.row.actStatus)" @click="openSignReceive(scope.row)" size="mini">活动统计</el-button>
                                     <el-button type="primary" v-if="scope.row.actStatus == 3" @click="beClose(scope.row)" size="mini">关闭</el-button>
                                     <el-button type="danger" v-if="scope.row.actStatus != 5" size="mini" @click="delRow(scope.row)">删除</el-button>
+                                </el-row>
+                                <el-row style="display:flex;" v-if="scope.row.actType != 4">
+                                    <el-button type="primary" @click="openEdit(scope.row)" size="mini">编辑</el-button>
+                                    <el-button type="primary" @click="activityStatistics(scope.row)" size="mini">活动统计</el-button>
+                                    <el-button type="primary" @click="closeAct(scope.row)" size="mini">关闭</el-button>
+                                    <el-button type="danger" @click="delAct(scope.row)" size="mini">删除</el-button>
                                 </el-row>
                             </template>
                         </el-table-column>
@@ -197,6 +214,127 @@
                 let _this = this;
                 _this.loadActivitysList();
             },
+            //删除
+            delAct(row){
+                let _this = this;
+                _this.$confirm('确认删除活动吗?', '删除', {
+                    distinguishCancelAndClose: true,//设置关闭按钮和不通过按钮的区别
+                    confirmButtonText: '确认',
+                    cancelButtonText: '取消',
+                    type: 'info'
+                }).then(() => {
+                    //通过
+                    let id = row.id;
+                    $.AjaxProxy().invoke(basePath + "/admin/shopActivities/del?keys="+id, function(loj) {
+                        if (loj[0].result.status == '200') {
+                            _this.loadActivitysList();
+                        }
+                    });
+                }).catch(action => {
+                    //不通过
+                    if(action === 'cancel'){
+                        console.log("cancel");
+                    }else{
+                        //关闭按钮
+                        console.log("close");
+                    }
+                });
+            },
+            //关闭
+            closeAct(row){
+                let _this = this;
+                _this.$confirm('确认关闭活动吗?', '关闭', {
+                    distinguishCancelAndClose: true,//设置关闭按钮和不通过按钮的区别
+                    confirmButtonText: '确认',
+                    cancelButtonText: '取消',
+                    type: 'info'
+                }).then(() => {
+                    //通过
+                    let id = row.id;
+                    $.AjaxProxy().invoke(basePath + "/admin/shopActivities/closeAct?id="+id, function(loj) {
+                        if (loj[0].result.status == '200') {
+                            layer.msg(loj[0].result.info, {
+                                icon: 1
+                            });
+                        }
+                    });
+                    _this.loadActivitysList();
+                }).catch(action => {
+                    //不通过
+                    if(action === 'cancel'){
+                        console.log("cancel");
+                    }else{
+                        //关闭按钮
+                        console.log("close");
+                    }
+                });
+            },
+            // 活动统计
+            activityStatistics(row) {
+                let type = row.actType;
+                let id = row.id;
+                let name = row.actName;
+                console.log("-------");
+                if (type == 2) {
+                    layer.full(layer.open({
+                        type : 2,
+                        title : name + "-活动统计",
+                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
+                        maxmin : true,
+                        content : [ basePath+'/admin/redirect/shop/activities/shopActivitiesSecKill-list?id=' + id]
+                    }));
+                }
+
+                if (type == 1) {
+                    layer.full(layer.open({
+                        type : 2,
+                        title : name + "-活动统计",
+                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
+                        maxmin : true,
+                        content : [ basePath+'/admin/redirect/shop/activities/shopActivitiesGroupBuy-list?id=' + id]
+                    }));
+                }
+
+                if (type == 3) {
+                    layer.full(layer.open({
+                        type : 2,
+                        title : name + "-活动统计",
+                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
+                        maxmin : true,
+                        content : [ basePath+'/admin/redirect/shop/activities/shopActivitiesSalon-list?id=' + id]
+                    }));
+                }
+            },
+            //打开编辑界面
+            openEdit(row) {
+                let type = row.actType;
+                let id = row.id;
+                if (type == 1) {
+                    layer.full(layer.open({
+                        type : 2,
+                        title : "编辑拼团",
+                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
+                        maxmin : true,
+                        content : [ basePath+'/admin/redirect/shop/activities/activitiesGroupBuy-form?id=' + id]
+                    }));
+                } else if (type == 2) {
+                    layer.full(layer.open({
+                        type : 2,
+                        title : "编辑秒杀",
+                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
+                        maxmin : true,
+                        content : [ basePath+'/admin/redirect/shop/activities/activitiesSecKill-form?id=' + id]
+                    }));
+                } else if (type == 3) {
+                    layer.full(layer.open({
+                        type : 2,
+                        title : "编辑沙龙",
+                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
+                        maxmin : true,
+                        content : [ basePath+'/admin/redirect/shop/activities/activitiesSalon-form?id=' + id]
+                    }));
+                }
+            },
             //修改
             beUpdate(row){
                 layer.full(layer.open({

--
Gitblit v1.9.1