New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.controller.util.MyQrCodeUtil; |
| | | import com.stylefeng.guns.modular.system.controller.util.QRCodeUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ISysCouponRecordService; |
| | | import com.stylefeng.guns.modular.system.service.ITActivityGeneralizationService; |
| | | import com.stylefeng.guns.modular.system.util.GaoDeMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.system.util.UUIDUtil; |
| | | import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ByteArrayResource; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * todo 新增推广活动设置控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-17 20:51:18 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/generalization") |
| | | public class GeneralizationActivityController extends BaseController { |
| | | @Autowired |
| | | private ITActivityGeneralizationService activityGeneralizationService; |
| | | @Autowired |
| | | private ISysCouponRecordService sysCouponRecordService; |
| | | private String PREFIX = "/system/generalization/"; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("/activity") |
| | | public String index() { |
| | | return PREFIX + "generalization.html"; |
| | | } |
| | | /** |
| | | * 跳转到选择优惠券页面 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/sysCouponRecord") |
| | | public String sysCouponRecord() { |
| | | return PREFIX + "sysCouponRecord.html"; |
| | | } |
| | | @RequestMapping("/addHtml") |
| | | public String addHtml() { |
| | | return PREFIX + "addHtml.html"; |
| | | } |
| | | @RequestMapping("/editHtml/{id}") |
| | | public String editHtml(Model model,@PathVariable("id") Integer id) { |
| | | TActivityGeneralization data = activityGeneralizationService.selectById(id); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | model.addAttribute("startTime", sdf.format(data.getStartTime())); |
| | | model.addAttribute("endTime", sdf.format(data.getEndTime())); |
| | | model.addAttribute("item",data); |
| | | List<SysCouponRecord> siteList = sysCouponRecordService.selectList(new EntityWrapper<SysCouponRecord>() |
| | | .eq("id",data.getCouponId())); |
| | | model.addAttribute("siteList",siteList); |
| | | return PREFIX + "editHtml.html"; |
| | | } |
| | | @RequestMapping("/generalization_detail/{id}") |
| | | public String generalization_detail(Model model,@PathVariable("id") Integer id) { |
| | | TActivityGeneralization data = activityGeneralizationService.selectById(id); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | model.addAttribute("startTime", sdf.format(data.getStartTime())); |
| | | model.addAttribute("endTime", sdf.format(data.getEndTime())); |
| | | model.addAttribute("item",data); |
| | | List<SysCouponRecord> siteList = sysCouponRecordService.selectList(new EntityWrapper<SysCouponRecord>() |
| | | .eq("id",data.getCouponId())); |
| | | model.addAttribute("siteList",siteList); |
| | | return PREFIX + "generalization_detail.html"; |
| | | } |
| | | |
| | | @RequestMapping("/qrCodeHtml/{id}") |
| | | public String qrCodeHtml(Model model,@PathVariable("id") Integer id) { |
| | | TActivityGeneralization data = activityGeneralizationService.selectById(id); |
| | | model.addAttribute("qrCode",data.getQrCode()); |
| | | return PREFIX + "qrCodeHtml.html"; |
| | | } |
| | | |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime,String activityName,Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(activityGeneralizationService.getList(page,beginTime,endTime,activityName,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增推广活动 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TActivityGeneralization tActivityGeneralization) throws Exception { |
| | | |
| | | // 判断状态 |
| | | if(new Date().after(tActivityGeneralization.getStartTime()) && new Date().before(tActivityGeneralization.getEndTime())){ |
| | | tActivityGeneralization.setState(1); |
| | | } |
| | | if(new Date().after(tActivityGeneralization.getEndTime())){ |
| | | tActivityGeneralization.setState(3); |
| | | } |
| | | if(new Date().before(tActivityGeneralization.getStartTime())){ |
| | | tActivityGeneralization.setState(2); |
| | | } |
| | | activityGeneralizationService.insert(tActivityGeneralization); |
| | | |
| | | // 生成二维码,上传到服务器 |
| | | MyQrCodeUtil.createCodeToFile("https://www.baidu.com?id=" + tActivityGeneralization.getId()); |
| | | BufferedImage qrCodeImage = QRCodeUtil.createImage("https://www.baidu.com?id=" + tActivityGeneralization.getId()); |
| | | MultipartFile qrCodeFile = convert(qrCodeImage, new Date().getTime()+ UUIDUtil.getRandomCode(3)+".PNG"); |
| | | String picture = OssUploadUtil.ossUpload(qrCodeFile); |
| | | System.err.println("二维码:"+ picture); |
| | | tActivityGeneralization.setQrCode(picture); |
| | | activityGeneralizationService.updateById(tActivityGeneralization); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 编辑推广活动 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TActivityGeneralization tActivityGeneralization) { |
| | | |
| | | // 判断状态 |
| | | if(new Date().after(tActivityGeneralization.getStartTime()) && new Date().before(tActivityGeneralization.getEndTime())){ |
| | | tActivityGeneralization.setState(1); |
| | | } |
| | | if(new Date().after(tActivityGeneralization.getEndTime())){ |
| | | tActivityGeneralization.setState(3); |
| | | } |
| | | if(new Date().before(tActivityGeneralization.getStartTime())){ |
| | | tActivityGeneralization.setState(2); |
| | | } |
| | | activityGeneralizationService.updateById(tActivityGeneralization); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除推广活动 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(Integer tActivityGeneralizationId) { |
| | | TActivityGeneralization activityGeneralization = activityGeneralizationService.selectById(tActivityGeneralizationId); |
| | | activityGeneralization.setIsDelete(2); |
| | | activityGeneralizationService.updateById(activityGeneralization); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 启动/暂停 |
| | | */ |
| | | @RequestMapping(value = "/updateStatus") |
| | | @ResponseBody |
| | | public Object updateStatus(Integer id, Integer status) { |
| | | TActivityGeneralization tActivityGeneralization = activityGeneralizationService.selectById(id); |
| | | if(status == 1){ |
| | | if(new Date().after(tActivityGeneralization.getStartTime()) && new Date().before(tActivityGeneralization.getEndTime())){ |
| | | tActivityGeneralization.setState(1); |
| | | } |
| | | if(new Date().after(tActivityGeneralization.getEndTime())){ |
| | | tActivityGeneralization.setState(3); |
| | | } |
| | | if(new Date().before(tActivityGeneralization.getStartTime())){ |
| | | tActivityGeneralization.setState(2); |
| | | } |
| | | }else { |
| | | tActivityGeneralization.setState(status); |
| | | } |
| | | activityGeneralizationService.updateById(tActivityGeneralization); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 启动/暂停 |
| | | */ |
| | | @RequestMapping(value = "/downQrcode") |
| | | @ResponseBody |
| | | public Object downQrcode(HttpServletResponse response, String imgURL) throws Exception { |
| | | File localFile = new File("D://qrCode"); |
| | | File file = new File(imgURL); |
| | | |
| | | |
| | | // 创建File对象 |
| | | File downloadedFile = new File(localFile.getAbsolutePath()); |
| | | |
| | | System.out.println("文件已下载到: " + downloadedFile.getAbsolutePath()); |
| | | |
| | | // 设置响应头 |
| | | response.reset(); |
| | | response.setContentType("image/png"); // 根据图片类型调整 |
| | | response.setHeader("Content-Disposition", "attachment; filename=二维码.png"); |
| | | |
| | | // 输出文件内容到响应输出流 |
| | | FileInputStream fis = new FileInputStream(file); |
| | | OutputStream os = response.getOutputStream(); |
| | | |
| | | byte[] buffer = new byte[1024]; |
| | | int bytesRead; |
| | | while ((bytesRead = fis.read(buffer)) != -1) { |
| | | os.write(buffer, 0, bytesRead); |
| | | } |
| | | // 关闭流 |
| | | os.flush(); |
| | | os.close(); |
| | | fis.close(); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | public static MultipartFile convert(BufferedImage bufferedImage, String fileName) throws IOException { |
| | | // 将 BufferedImage 转换为字节数组 |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | ImageIO.write(bufferedImage, "png", baos); |
| | | byte[] bytes = baos.toByteArray(); |
| | | |
| | | // 创建 ByteArrayResource |
| | | ByteArrayResource resource = new ByteArrayResource(bytes); |
| | | |
| | | // 创建 MockMultipartFile |
| | | MockMultipartFile multipartFile = new MockMultipartFile( |
| | | "file", |
| | | fileName, |
| | | "image/png", |
| | | resource.getInputStream() |
| | | ); |
| | | |
| | | return multipartFile; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.util; |
| | | |
| | | import com.google.zxing.BarcodeFormat; |
| | | import com.google.zxing.EncodeHintType; |
| | | import com.google.zxing.MultiFormatWriter; |
| | | import com.google.zxing.WriterException; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.OutputStream; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class MyQrCodeUtil { |
| | | //CODE_WIDTH:二维码宽度,单位像素 |
| | | private static final int CODE_WIDTH = 400; |
| | | //CODE_HEIGHT:二维码高度,单位像素 |
| | | private static final int CODE_HEIGHT = 400; |
| | | //FRONT_COLOR:二维码前景色,0x000000 表示黑色 |
| | | private static final int FRONT_COLOR = 0x000000; |
| | | //BACKGROUND_COLOR:二维码背景色,0xFFFFFF 表示白色 |
| | | //演示用 16 进制表示,和前端页面 CSS 的取色是一样的,注意前后景颜色应该对比明显,如常见的黑白 |
| | | private static final int BACKGROUND_COLOR = 0xFFFFFF; |
| | | public static BufferedImage createCodeToFile(String content) { |
| | | try { |
| | | content = content.trim(); |
| | | //核心代码-生成二维码 |
| | | BufferedImage bufferedImage = getBufferedImage(content); |
| | | |
| | | return bufferedImage; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | * 生成二维码并输出到输出流, 通常用于输出到网页上进行显示,输出到网页与输出到磁盘上的文件中,区别在于最后一句 ImageIO.write |
| | | * write(RenderedImage im,String formatName,File output):写到文件中 |
| | | * write(RenderedImage im,String formatName,OutputStream output):输出到输出流中 |
| | | * @param content :二维码内容 |
| | | * @param outputStream :输出流,比如 HttpServletResponse 的 getOutputStream |
| | | */ |
| | | public static void createCodeToOutputStream(String content, OutputStream outputStream) { |
| | | try { |
| | | if (!StringUtils.hasLength(content)) { |
| | | return; |
| | | } |
| | | content = content.trim(); |
| | | //核心代码-生成二维码 |
| | | BufferedImage bufferedImage = getBufferedImage(content); |
| | | //区别就是这一句,输出到输出流中,如果第三个参数是 File,则输出到文件中 |
| | | ImageIO.write(bufferedImage, "png", outputStream); |
| | | System.out.println("二维码图片生成到输出流成功..."); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //核心代码-生成二维码 |
| | | private static BufferedImage getBufferedImage(String content) throws WriterException { |
| | | //com.google.zxing.EncodeHintType:编码提示类型,枚举类型 |
| | | Map<EncodeHintType, Object> hints = new HashMap(); |
| | | //EncodeHintType.CHARACTER_SET:设置字符编码类型 |
| | | hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); |
| | | //EncodeHintType.ERROR_CORRECTION:设置误差校正 |
| | | //ErrorCorrectionLevel:误差校正等级,L = ~7% correction、M = ~15% correction、Q = ~25% correction、H = ~30% correction |
| | | //不设置时,默认为 L 等级,等级不一样,生成的图案不同,但扫描的结果是一样的 |
| | | hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); |
| | | //EncodeHintType.MARGIN:设置二维码边距,单位像素,值越小,二维码距离四周越近 |
| | | hints.put(EncodeHintType.MARGIN, 1); |
| | | MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); |
| | | BitMatrix bitMatrix = multiFormatWriter.encode(content, BarcodeFormat.QR_CODE, CODE_WIDTH, CODE_HEIGHT, hints); |
| | | BufferedImage bufferedImage = new BufferedImage(CODE_WIDTH, CODE_HEIGHT, BufferedImage.TYPE_INT_BGR); |
| | | for (int x = 0; x < CODE_WIDTH; x++) { |
| | | for (int y = 0; y < CODE_HEIGHT; y++) { |
| | | bufferedImage.setRGB(x, y, bitMatrix.get(x, y) ? FRONT_COLOR : BACKGROUND_COLOR); |
| | | } |
| | | } |
| | | return bufferedImage; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String param = "{\n" + |
| | | " \"scan_type\": 1,\n" + |
| | | " \"space_id\": 2,\n" + |
| | | " \"sutu_id\": 3\n" + |
| | | "}"; |
| | | createCodeToFile(param); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.util; |
| | | |
| | | import com.google.zxing.BarcodeFormat; |
| | | import com.google.zxing.EncodeHintType; |
| | | import com.google.zxing.MultiFormatWriter; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.util.Hashtable; |
| | | |
| | | /** |
| | | * @author chengst |
| | | * @date 2019/11/4 |
| | | **/ |
| | | public class QRCodeUtil { |
| | | |
| | | private final static String CHARSET = "utf-8"; |
| | | |
| | | private final static int QRSIZEE = 300; |
| | | |
| | | // 二维码颜色 |
| | | private static final int BLACK = 0xFF000000; |
| | | // 二维码颜色 |
| | | private static final int WHITE = 0xFFFFFFFF; |
| | | |
| | | public static BufferedImage createImage(String content){ |
| | | Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>(); |
| | | hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); |
| | | hints.put(EncodeHintType.CHARACTER_SET, CHARSET); |
| | | hints.put(EncodeHintType.MARGIN, 1); |
| | | BitMatrix bitMatrix = null; |
| | | try { |
| | | bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, QRSIZEE, QRSIZEE,hints); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | int width = bitMatrix.getWidth(); |
| | | int height = bitMatrix.getHeight(); |
| | | BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); |
| | | |
| | | for (int x = 0; x < width; x++) { |
| | | for (int y = 0; y < height; y++) { |
| | | image.setRGB(x, y, bitMatrix.get(x, y) ? BLACK : WHITE); |
| | | } |
| | | } |
| | | return image; |
| | | } |
| | | } |
| | | |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.modular.system.model.TActivityGeneralization; |
| | | import com.stylefeng.guns.modular.system.model.TOrderTape; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author 吕雪 |
| | | * @since 2020-06-09 |
| | | */ |
| | | @Mapper |
| | | public interface TActivityGeneralizationMapper extends BaseMapper<TActivityGeneralization> { |
| | | |
| | | List<Map<String, Object>> getList(@Param("page") Page<Map<String, Object>> page, |
| | | @Param("beginTime")String beginTime, |
| | | @Param("endTime") String endTime, |
| | | @Param("activityName")String activityName, |
| | | @Param("state")Integer state); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.TOpenCitySite; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author 吕雪 |
| | | * @since 2020-06-02 |
| | | */ |
| | | @Mapper |
| | | public interface TOpenCitySiteMapper extends BaseMapper<TOpenCitySite> { |
| | | |
| | | |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, activityName, participateCount, startTime, endTime, couponId, userGrantCount, monthUseCount, useExplain, isDelete |
| | | </sql> |
| | | <select id="getList" resultType="java.util.Map"> |
| | | select a.id,a.insertTime,a.activityName,CONCAT(DATE_FORMAT(a.startTime, '%Y-%m-%d')," — ",DATE_FORMAT(a.endTime, '%Y-%m-%d')) as `time`, |
| | | a.qrCode, |
| | | a.participateCount,a.state,IFNULL(b.count, 0) AS `count` |
| | | from t_activity_generalization a |
| | | LEFT join (SELECT userId,couponActivityId, activityType,COUNT(*) AS `count` FROM t_user_coupon_record where activityType = 5 GROUP BY userId) b |
| | | ON a.id = b.couponActivityId |
| | | WHERE a.isDelete = 1 |
| | | <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> |
| | | and (a.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) |
| | | </if> |
| | | <if test="activityName != null and activityName !=''"> |
| | | and a.activityName like CONCAT('%',#{activityName},'%') |
| | | </if> |
| | | <if test="state != null"> |
| | | and a.state=#{state} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | @ApiModelProperty(value = "最多参与人数") |
| | | @TableField(value = "participateCount") |
| | | private Integer participateCount; |
| | | @ApiModelProperty(value = "状态 1=已开启 2=未开启 3=已结束 4=暂停") |
| | | @TableField(value = "state") |
| | | private Integer state; |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | @ApiModelProperty(value = "添加时间") |
| | | @TableField(value = "insertTime") |
| | | private Date insertTime; |
| | | |
| | | @ApiModelProperty(value = "二维码链接") |
| | | @TableField(value = "qrCode") |
| | | private String qrCode; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField(value = "startTime") |
| | |
| | | @TableField(value = "isDelete") |
| | | private Integer isDelete; |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | public String getQrCode() { |
| | | return qrCode; |
| | | } |
| | | |
| | | public void setQrCode(String qrCode) { |
| | | this.qrCode = qrCode; |
| | | } |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.TActivityGeneralization; |
| | | import com.stylefeng.guns.modular.system.model.TOrderTape; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface ITActivityGeneralizationService extends IService<TActivityGeneralization> { |
| | | |
| | | List<Map<String, Object>> getList(Page<Map<String, Object>> page, String beginTime, String endTime, String activityName, Integer state); |
| | | |
| | | |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.TActivityGeneralizationMapper; |
| | | import com.stylefeng.guns.modular.system.dao.TOrderTapeMapper; |
| | |
| | | import com.stylefeng.guns.modular.system.service.ITActivityGeneralizationService; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderTapeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TActivityGeneralizationServiceImpl extends ServiceImpl<TActivityGeneralizationMapper, TActivityGeneralization> implements ITActivityGeneralizationService { |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getList(Page<Map<String, Object>> page, |
| | | String beginTime, String endTime, |
| | | String activityName, Integer state) { |
| | | return this.baseMapper.getList(page,beginTime,endTime,activityName,state); |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | private IGDInterfaceService gdInterfaceService; |
| | | |
| | | private String key = "ca723c3c8a78962a7751129ae035dc9d"; |
| | | private String key = "8fc6a7da12d64696e9727605d81f72de"; |
| | | |
| | | private JSONArray jsonArray = new JSONArray(); |
| | | |
| | |
| | | @Component |
| | | public class GDMapGeocodingUtil { |
| | | |
| | | private String key = "ca723c3c8a78962a7751129ae035dc9d"; |
| | | private String key = "8fc6a7da12d64696e9727605d81f72de"; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | |
| | | |
| | | try { |
| | | // 拼接请求高德的url |
| | | String url = "http://restapi.amap.com/v3/geocode/geo?address=" + address + "&output=JSON&key=" + "ca723c3c8a78962a7751129ae035dc9d"; |
| | | String url = "http://restapi.amap.com/v3/geocode/geo?address=" + address + "&output=JSON&key=" + "8fc6a7da12d64696e9727605d81f72de"; |
| | | // 请求高德接口 |
| | | String result = sendHttpGet(url); |
| | | JSONObject resultJOSN = JSONObject.parseObject(result); |
| | |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | public static String ossUpload(MultipartFile file) throws IOException{ |
| | | //CommonsMultipartFile file = (CommonsMultipartFile)multipartFile; |
| | | String fileName = ""; |
| | | if(file!=null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename()!=null){ |
| | | InputStream content = file.getInputStream();//获得指定文件的输入流 |
| | | ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata |
| | | meta.setContentLength(file.getSize()); // 必须设置ContentLength |
| | | String originalFilename = file.getOriginalFilename(); |
| | | fileName = UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | ossClient.putObject(bucketName,"img/"+fileName,content,meta);// 上传Object. |
| | | if(fileName != null && !"".equals(fileName)){ |
| | | System.out.println(fileName); |
| | | fileName = oss_domain+"img/"+fileName; |
| | | } |
| | | } |
| | | return fileName; |
| | | } |
| | | } |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .newWidth, .single-line{ |
| | | max-width:150px !important;display: initial !important; |
| | | } |
| | | </style> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="ibox-title"> |
| | | <h5>添加推广活动</h5> |
| | | </div> |
| | | <div class="ibox-content" id="activityGeneralizationInfoForm"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <input hidden id="areaId" value=""> |
| | | |
| | | <div class="col-sm-12" style="cursor: pointer;text-align: right;"> |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >活动名称:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="activityName" name="activityName" type="text" maxlength="40" style="height: 30px;width: 300px" class="form-control" placeholder="请输入活动名称" required="required"> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >最多可参与人数:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="participateCount" name="participateCount" type="number" max="1000000" min="1" class="form-control" style="height: 30px;width: 300px" placeholder="请输入最多可参与人数" required="required"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >活动时间:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <input type="text" id="startTime" name="startTime" class="form-control" style="max-width:400px !important;display: initial !important;" placeholder="请选择活动时间"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >优惠券:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <button type="button" class="btn btn-primary " onclick="GeneralizationInfoDlg.toSelectCouponOpt()" id="selectCoupon"> |
| | | <i class="fa fa-plus"></i> 选择优惠券 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="col-sm-10"> |
| | | <div style="height: 200px; border: 1px solid #e5e6e7;overflow-y: auto;"> |
| | | <table class="table table-striped table-bordered table-hover table-condensed"> |
| | | <thead> |
| | | <tr> |
| | | <th style="width: 300px;">添加时间</th> |
| | | <th style="width: 300px;">优惠券类型</th> |
| | | <th style="width: 300px;">优惠金额</th> |
| | | <th style="width: 300px;">有效期</th> |
| | | <th style="width: 300px;">领取人数</th> |
| | | <th style="width: 300px;">操作</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody id="site"> |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >每个人发放:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="userGrantCount" name="userGrantCount" type="number" maxlength="11" style="height: 30px;width: 300px" class="form-control" required="required"> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >张</label> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >每个月可用:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="monthUseCount" name="monthUseCount" type="number" maxlength="11" class="form-control" style="height: 30px;width: 300px" required="required"> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >张</label> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >使用说明:</label> |
| | | </div> |
| | | <div class="text-area-container initialLevel col-sm-9 control-label form-group" > |
| | | <textarea type="text/plain" name="useExplain" id="useExplain" class="form-control" style="width:100%;height:150px;"></textarea> |
| | | <div id="charCount" class="char-count">0/300</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10" style="text-align: center"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="GeneralizationInfoDlg.addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="GeneralizationInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/generalization/generalization_info.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/generalization/sysCouponRecord.js"></script> |
| | | <style type="text/css"> |
| | | #useExplain { |
| | | width: 100%; |
| | | height: 100px; /* 根据需要调整高度 */ |
| | | resize: none; /* 禁止用户调整文本域大小 */ |
| | | } |
| | | |
| | | .char-count { |
| | | position: absolute; |
| | | bottom: 5px; /* 根据需要调整距离底部的位置 */ |
| | | right: 10px; /* 根据需要调整距离右侧的位置 */ |
| | | font-size: 12px; /* 根据需要调整字体大小 */ |
| | | } |
| | | </style> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#startTime' |
| | | ,type: 'date' |
| | | ,range: true |
| | | ,min: 'new Date()' //最小值今天 |
| | | }); |
| | | |
| | | var textarea = document.getElementById('useExplain'); |
| | | var charCount = document.getElementById('charCount'); |
| | | var maxLength = 300; // 设置最大字数限制 |
| | | |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .newWidth, .single-line{ |
| | | max-width:150px !important;display: initial !important; |
| | | } |
| | | </style> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="ibox-title"> |
| | | <h5>添加推广活动</h5> |
| | | </div> |
| | | <div class="ibox-content" id="activityGeneralizationInfoForm"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <input hidden id="id" value="${item.id}"> |
| | | |
| | | <div class="col-sm-12" style="cursor: pointer;text-align: right;"> |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >活动名称:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="activityName" name="activityName" value="${item.activityName}" type="text" maxlength="40" style="height: 30px;width: 300px" class="form-control" placeholder="请输入活动名称" required="required"> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >最多可参与人数:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="participateCount" name="participateCount" value="${item.participateCount}" type="number" max="1000000" min="1" class="form-control" style="height: 30px;width: 300px" placeholder="请输入最多可参与人数" required="required"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >活动时间:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <input type="text" id="startTime" name="startTime" value="${item.startTime}" class="form-control" style="max-width:400px !important;display: initial !important;" placeholder="请选择活动时间"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >优惠券:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <button type="button" class="btn btn-primary " onclick="GeneralizationInfoDlg.toSelectCouponOpt()" id="selectCoupon"> |
| | | <i class="fa fa-plus"></i> 选择优惠券 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="col-sm-10"> |
| | | <div style="height: 200px; border: 1px solid #e5e6e7;overflow-y: auto;"> |
| | | <table class="table table-striped table-bordered table-hover table-condensed"> |
| | | <thead> |
| | | <tr> |
| | | <th style="width: 300px;">添加时间</th> |
| | | <th style="width: 300px;">优惠券类型</th> |
| | | <th style="width: 300px;">优惠金额</th> |
| | | <th style="width: 300px;">有效期</th> |
| | | <th style="width: 300px;">领取人数</th> |
| | | <th style="width: 300px;">操作</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody id="site"> |
| | | @for(obj in siteList){ |
| | | <tr class="siteClass"> |
| | | <td><input type="hidden" name="id" value="${obj.id}"> |
| | | <input type="hidden" id="insertTime" name="insertTime" value="${obj.insertTime}">${obj.insertTime}</td> |
| | | @if(obj.couponUseType == 0){ |
| | | <td><input type="hidden" id="couponUseType" name="couponUseType" value="0">通用券</td> |
| | | @}else if(obj.couponUseType == 1){ |
| | | <td><input type="hidden" id="couponUseType" name="couponUseType" value="1">专车券</td> |
| | | @}else if(obj.couponUseType == 2){ |
| | | <td><input type="hidden" id="couponUseType" name="couponUseType" value="2">出租券</td> |
| | | @}else if(obj.couponUseType == 3){ |
| | | <td><input type="hidden" id="couponUseType" name="couponUseType" value="3">直通车出行券</td> |
| | | @}else{ |
| | | <td><input type="hidden" id="couponUseType" name="couponUseType" value="7">接送机出行券</td> |
| | | @} |
| | | <td><input type="hidden" id="money" name="money" value="${obj.money}">${obj.money}</td> |
| | | <td><input type="hidden" id="effective" name="effective" value="${obj.effective}">${obj.effective}天</td> |
| | | <td><input type="hidden" id="receive" name="receive">-</td> |
| | | <td><button onclick="deleteSub(this)">移除</button></td></td> |
| | | </tr> |
| | | @} |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >每个人发放:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="userGrantCount" name="userGrantCount" value="${item.userGrantCount}" type="number" maxlength="11" style="height: 30px;width: 300px" class="form-control" required="required"> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >张</label> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >每个月可用:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="monthUseCount" name="monthUseCount" value="${item.monthUseCount}" type="number" maxlength="11" class="form-control" style="height: 30px;width: 300px" required="required"> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >张</label> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >使用说明:</label> |
| | | </div> |
| | | <div class="text-area-container initialLevel col-sm-9 control-label form-group" > |
| | | <textarea type="text/plain" name="useExplain" id="useExplain" class="form-control" style="width:100%;height:150px;">${item.useExplain}</textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10" style="text-align: center"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="GeneralizationInfoDlg.editSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="GeneralizationInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/generalization/generalization_info.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/generalization/sysCouponRecord.js"></script> |
| | | <style type="text/css"> |
| | | #useExplain { |
| | | width: 100%; |
| | | height: 100px; /* 根据需要调整高度 */ |
| | | resize: none; /* 禁止用户调整文本域大小 */ |
| | | } |
| | | |
| | | .char-count { |
| | | position: absolute; |
| | | bottom: 5px; /* 根据需要调整距离底部的位置 */ |
| | | right: 10px; /* 根据需要调整距离右侧的位置 */ |
| | | font-size: 12px; /* 根据需要调整字体大小 */ |
| | | } |
| | | </style> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#startTime' |
| | | ,type: 'date' |
| | | ,range: true |
| | | ,min: 'new Date()' //最小值今天 |
| | | }); |
| | | $("#startTime").val("${startTime} - ${endTime}") |
| | | |
| | | var textarea = document.getElementById('useExplain'); |
| | | var charCount = document.getElementById('charCount'); |
| | | var maxLength = 300; // 设置最大字数限制 |
| | | |
| | | $(function() { |
| | | var button = document.getElementById('selectCoupon'); |
| | | button.disabled = true; |
| | | }) |
| | | |
| | | |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#TimeCon id="createTime" name="添加时间" isTime="false"/> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="activityName" name="活动名称" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#SelectCon id="state" name="状态" > |
| | | <option value="">全部</option> |
| | | <option value="1">已开启</option> |
| | | <option value="2">未开启</option> |
| | | <option value="3">已过期</option> |
| | | <option value="4">暂停</option> |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="Generalization.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="Generalization.resetSearch()" space="true"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="GeneralizationTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/generalization/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="Generalization.openAddGeneralization()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/generalization/updateStatus")){ |
| | | <#button name="启动/暂停" icon="" clickFun="Generalization.updateStatus()" space="true"/> |
| | | @} |
| | | |
| | | </div> |
| | | <#table id="GeneralizationTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/generalization/generalization.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#createTime' |
| | | ,range: true |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .newWidth, .single-line{ |
| | | max-width:150px !important;display: initial !important; |
| | | } |
| | | </style> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="ibox-title"> |
| | | <h5>推广活动详情</h5> |
| | | </div> |
| | | <div class="ibox-content" id="activityGeneralizationInfoForm"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <input hidden id="id" value="${item.id}"> |
| | | |
| | | <div class="col-sm-12" style="cursor: pointer;text-align: right;"> |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >活动名称:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="activityName" name="activityName" value="${item.activityName}" type="text" maxlength="40" style="height: 30px;width: 300px" class="form-control" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >最多可参与人数:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="participateCount" name="participateCount" value="${item.participateCount}" type="number" max="1000000" min="1" class="form-control" style="height: 30px;width: 300px" disabled> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >活动时间:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <input type="text" id="startTime" name="startTime" value="${item.startTime}" class="form-control" style="max-width:400px !important;display: initial !important;" disabled/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >优惠券:</label> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="col-sm-10"> |
| | | <div style="height: 200px; border: 1px solid #e5e6e7;overflow-y: auto;"> |
| | | <table class="table table-striped table-bordered table-hover table-condensed"> |
| | | <thead> |
| | | <tr> |
| | | <th style="width: 300px;">添加时间</th> |
| | | <th style="width: 300px;">优惠券类型</th> |
| | | <th style="width: 300px;">优惠金额</th> |
| | | <th style="width: 300px;">有效期</th> |
| | | <th style="width: 300px;">领取人数</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody id="site"> |
| | | @for(obj in siteList){ |
| | | <tr class="siteClass"> |
| | | <td><input type="hidden" name="id" value="${obj.id}"> |
| | | <input type="hidden" id="insertTime" name="insertTime" value="${obj.insertTime}">${obj.insertTime}</td> |
| | | @if(obj.couponUseType == 0){ |
| | | <td><input type="hidden" id="couponUseType" name="couponUseType" value="0">通用券</td> |
| | | @}else if(obj.couponUseType == 1){ |
| | | <td><input type="hidden" id="couponUseType" name="couponUseType" value="1">专车券</td> |
| | | @}else if(obj.couponUseType == 2){ |
| | | <td><input type="hidden" id="couponUseType" name="couponUseType" value="2">出租券</td> |
| | | @}else if(obj.couponUseType == 3){ |
| | | <td><input type="hidden" id="couponUseType" name="couponUseType" value="3">直通车出行券</td> |
| | | @}else{ |
| | | <td><input type="hidden" id="couponUseType" name="couponUseType" value="7">接送机出行券</td> |
| | | @} |
| | | <td><input type="hidden" id="money" name="money" value="${obj.money}">${obj.money}</td> |
| | | <td><input type="hidden" id="effective" name="effective" value="${obj.effective}">${obj.effective}天</td> |
| | | <td><input type="hidden" id="receive" name="receive" >-</td> |
| | | </tr> |
| | | @} |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >每个人发放:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="userGrantCount" name="userGrantCount" value="${item.userGrantCount}" type="number" maxlength="11" style="height: 30px;width: 300px" class="form-control" disabled> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >张</label> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >每个月可用:</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <input id="monthUseCount" name="monthUseCount" value="${item.monthUseCount}" type="number" maxlength="11" class="form-control" style="height: 30px;width: 300px" disabled> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >张</label> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >使用说明:</label> |
| | | </div> |
| | | <div class="text-area-container initialLevel col-sm-9 control-label form-group" > |
| | | <textarea type="text/plain" name="useExplain" id="useExplain" class="form-control" style="width:100%;height:150px;" disabled>${item.useExplain}</textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10" style="text-align: center"> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="GeneralizationInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/generalization/generalization_info.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/generalization/sysCouponRecord.js"></script> |
| | | <style type="text/css"> |
| | | #useExplain { |
| | | width: 100%; |
| | | height: 100px; /* 根据需要调整高度 */ |
| | | resize: none; /* 禁止用户调整文本域大小 */ |
| | | } |
| | | |
| | | .char-count { |
| | | position: absolute; |
| | | bottom: 5px; /* 根据需要调整距离底部的位置 */ |
| | | right: 10px; /* 根据需要调整距离右侧的位置 */ |
| | | font-size: 12px; /* 根据需要调整字体大小 */ |
| | | } |
| | | </style> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#startTime' |
| | | ,type: 'date' |
| | | ,range: true |
| | | ,min: 'new Date()' //最小值今天 |
| | | }); |
| | | $("#startTime").val("${startTime} - ${endTime}") |
| | | |
| | | var textarea = document.getElementById('useExplain'); |
| | | var charCount = document.getElementById('charCount'); |
| | | var maxLength = 300; // 设置最大字数限制 |
| | | |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .newWidth, .single-line{ |
| | | max-width:150px !important;display: initial !important; |
| | | } |
| | | </style> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="ibox-content" id="activityGeneralizationInfoForm"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="col-sm-12" style="cursor: pointer;text-align: right;"> |
| | | <div class="initialLevel col-sm-12 control-label form-group" style="text-align: center;" > |
| | | <img src="${qrCode}" id="qrCode" style="height: 250px;width: 250px" disabled="disabled"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-12" style="text-align: center"> |
| | | <#button btnCss="info" name="下载二维码" id="ensure" icon="fa-check" clickFun="Generalization.downQrCode()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/generalization/generalization.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/generalization/generalization_info.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/generalization/sysCouponRecord.js"></script> |
| | | <script> |
| | | |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>优惠券管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#TimeCon id="createTime" name="添加时间" isTime="false"/> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#SelectCon id="couponUseType" name="优惠券类型" > |
| | | <option value="">全部</option> |
| | | <option value="0">通用券</option> |
| | | <option value="1">专车券</option> |
| | | <option value="2">出租券</option> |
| | | <option value="3">直通车出行券</option> |
| | | <option value="7">接送机出行券</option> |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="SysCouponRecord.search()"/> |
| | | <#button name="重置" icon="fa-search" clickFun="SysCouponRecord.resetSearch()"/> |
| | | <#button btnCss="info" name="确定" id="ensure" icon="fa-check" clickFun="SysCouponRecord.selectCouponOpt()" space="true"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="SysCouponRecord.close()" space="true"/> |
| | | |
| | | </div> |
| | | </div> |
| | | <#table id="SysCouponRecordTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/generalization/sysCouponRecord.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#createTime' |
| | | ,range: true |
| | | }); |
| | | </script> |
| | | @} |
| | |
| | | <option value="1">专车券</option> |
| | | <!--<option value="2">出租车券</option>--> |
| | | <option value="3">直通车券</option> |
| | | <option value="7">接送机券</option> |
| | | <option value="0">通用券</option> |
| | | </#select> |
| | | <#input id="money" name="金额" underline="true" placeholder="最多4位数字"/> |
| | |
| | | <div class="row"> |
| | | <div class="col-sm-11"> |
| | | <div class="col-sm-2 control-label"> |
| | | <input type="checkbox" class="js-switch1" id="isOpen" onchange="isOpen(this.checked)"/> |
| | | <input type="checkbox" class="js-switch1" id="isOpen" value="0" onchange="isOpen(this.checked)"/> |
| | | </div> |
| | | <div class="col-sm-3 control-label" hidden id="sortByDiv"> |
| | | <input type="number" class="form-control newWidth" id="sortBy" name="sortBy" placeholder="请设置排序值"> <span style="color: #0d8ddb">(注:排序值越大,排序越靠前)</span> |
| | |
| | | <h2 class="h3Class" style="font-weight: 700;">行程录音</h2> |
| | | </div> |
| | | <div class="col-sm-10"> |
| | | <audio id="audio" src="http://www.w3capi.com/upload/audio/audio_example.mp3" controls muted data-enabled="false"> |
| | | <!-- <source src="${item.routeRecord}" type="audio/mpeg">--> |
| | | </audio> |
| | | @if(isNotEmpty(routeRecordList)){ |
| | | @for(obj in routeRecordList){ |
| | | <audio id="audio" src="${obj.routeRecord}" controls muted data-enabled="false"></audio> |
| | | @} |
| | | @} |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <h2 class="h3Class" style="font-weight: 700;">行程录音</h2> |
| | | </div> |
| | | <div class="col-sm-10"> |
| | | <audio id="audio" src="http://www.w3capi.com/upload/audio/audio_example.mp3" controls muted data-enabled="false"> |
| | | <!-- <source src="${item.routeRecord}" type="audio/mpeg">--> |
| | | </audio> |
| | | @if(isNotEmpty(routeRecordList)){ |
| | | @for(obj in routeRecordList){ |
| | | <audio id="audio" src="${obj.routeRecord}" controls muted data-enabled="false"></audio> |
| | | @} |
| | | @} |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <h2 class="h3Class" style="font-weight: 700;">行程录音</h2> |
| | | </div> |
| | | <div class="col-sm-10"> |
| | | <audio id="audio" src="http://www.w3capi.com/upload/audio/audio_example.mp3" controls muted data-enabled="false"> |
| | | <!-- <source src="${item.routeRecord}" type="audio/mpeg">--> |
| | | </audio> |
| | | @if(isNotEmpty(routeRecordList)){ |
| | | @for(obj in routeRecordList){ |
| | | <audio id="audio" src="${obj.routeRecord}" controls muted data-enabled="false"></audio> |
| | | @} |
| | | @} |
| | | </div> |
| | | </div> |
| | | |
New file |
| | |
| | | /** |
| | | * 管理初始化 |
| | | */ |
| | | var Generalization = { |
| | | id: "GeneralizationTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1 |
| | | }; |
| | | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | Generalization.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', radio: true}, |
| | | {title: '主键id', field: 'id', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '添加时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '活动名称', field: 'activityName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '活动时间', field: 'time', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '最多可参与人数', field: 'participateCount', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '当前参与人数', field: 'count', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | return '<a href="#" style="color:cornflowerblue">'+row.count+'</a>' +' ' +' '+' '+' '+' '+ |
| | | '<a href="#" onclick="Generalization.activityRecord('+row.id+')" style="color:cornflowerblue">查看领取记录</a>' +' ' |
| | | } |
| | | }, |
| | | {title: '当前状态', field: 'state', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if(value==1){ |
| | | return "已开启"; |
| | | }else if(value==2){ |
| | | return "未开启"; |
| | | }else if(value==3){ |
| | | return "已结束"; |
| | | }else if(value==4){ |
| | | return "已暂停"; |
| | | } |
| | | } |
| | | }, |
| | | {title: '操作', visible: true, align: 'center', valign: 'middle',width:'16%', |
| | | formatter: function (value, row) { |
| | | if(row.state==1){ |
| | | return '<a href="#" onclick="Generalization.openQrCodeGeneralization('+row.id+')" style="color:cornflowerblue">二维码</a>' +' ' + |
| | | '<a href="#" onclick="Generalization.openGeneralizationDetail('+row.id+')" style="color:cornflowerblue">详情</a>' +' ' + |
| | | '<a href="#" onclick="Generalization.openUpdateGeneralization('+row.id+')" style="color:cornflowerblue">编辑</a>' +' ' + |
| | | '<a href="#" onclick="Generalization.delete('+row.id+')" style="color:cornflowerblue">删除</a>' |
| | | }else{ |
| | | return '<a href="#" onclick="Generalization.openQrCodeGeneralization('+row.id+')" style="color:cornflowerblue">二维码</a>' +' ' + |
| | | '<a href="#" onclick="Generalization.openGeneralizationDetail('+row.id+')" style="color:cornflowerblue">详情</a>' +' ' + |
| | | '<a href="#" onclick="Generalization.delete('+row.id+')" style="color:cornflowerblue">删除</a>' |
| | | } |
| | | } |
| | | } |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | Generalization.check = function (type) { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | //验证类型null删除,1=审核,2=编辑,3=启动/暂停 |
| | | if(type==null){ |
| | | Generalization.seItem = selected[0]; |
| | | return true; |
| | | }else if(type==3 && selected[0].state==3){ |
| | | Feng.info("当前状态不能暂停/启动!"); |
| | | return false; |
| | | } |
| | | Generalization.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 点击添加 |
| | | */ |
| | | Generalization.openAddGeneralization = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加推广活动', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/generalization/addHtml' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | /** |
| | | * 打开编辑 |
| | | */ |
| | | Generalization.openUpdateGeneralization = function (id) { |
| | | console.log("111222211==="+id); |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '编辑推广活动', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/generalization/editHtml/' + id |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | /** |
| | | * 打开二维码 |
| | | */ |
| | | Generalization.openQrCodeGeneralization = function (id) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '推广二维码', |
| | | area: ['50%', '50%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/generalization/qrCodeHtml/' + id |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | /** |
| | | * 下载二维码 |
| | | */ |
| | | Generalization.downQrCode = function () { |
| | | var imgElement = document.getElementById('qrCode'); |
| | | var imgURL = imgElement.src; |
| | | console.log(imgURL) |
| | | // var downloadLink = document.createElement('a'); |
| | | // downloadLink.href = imgURL; |
| | | // downloadLink.download = '二维码.png'; // 自定义下载文件名 |
| | | // // 将链接添加到文档中(可以是隐藏的) |
| | | // document.body.appendChild(downloadLink); |
| | | // // 触发点击 |
| | | // downloadLink.click(); |
| | | // // 清理,可选 |
| | | // document.body.removeChild(downloadLink); |
| | | // GeneralizationInfoDlg.close(); |
| | | |
| | | var ajax = new $ax(Feng.ctxPath + "/generalization/downQrcode", function(data){ |
| | | Feng.success("下载成功!"); |
| | | GeneralizationInfoDlg.close(); |
| | | },function(data){ |
| | | Feng.error("下载失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("imgURL",imgURL); |
| | | ajax.start(); |
| | | |
| | | }; |
| | | |
| | | /** |
| | | * 打开查看详情 |
| | | */ |
| | | Generalization.openGeneralizationDetail = function (id) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '详情', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/generalization/generalization_detail/' + id |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | Generalization.delete = function (id) { |
| | | var ajax = new $ax(Feng.ctxPath + "/generalization/delete", function (data) { |
| | | Feng.success("删除成功!"); |
| | | Generalization.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("删除失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("tActivityGeneralizationId",id); |
| | | ajax.start(); |
| | | }; |
| | | |
| | | /** |
| | | * 启动/暂停 |
| | | */ |
| | | Generalization.updateStatus = function () { |
| | | if (this.check(3)) { |
| | | var ajax = new $ax(Feng.ctxPath + "/generalization/updateStatus", function (data) { |
| | | Feng.success("启动/暂停成功!"); |
| | | Generalization.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("启动/暂停失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("id",this.seItem.id); |
| | | ajax.set("status",this.seItem.state==4?1:4); |
| | | ajax.start(); |
| | | } |
| | | }; |
| | | /** |
| | | * 领取记录 |
| | | */ |
| | | Generalization.receiveRecord= function () { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '领取记录', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/generalization/receiveRecord?activityId='+ Generalization.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | Generalization.search = function () { |
| | | var queryData = {}; |
| | | queryData['createTime'] = $("#createTime").val(); |
| | | queryData['activityName'] = $("#activityName").val(); |
| | | queryData['state'] = $("#state").val(); |
| | | Generalization.table.refresh({query: queryData}); |
| | | }; |
| | | Generalization.resetSearch = function () { |
| | | $("#createTime").val(""); |
| | | $("#activityName").val(""); |
| | | $("#state").val(""); |
| | | Generalization.search(); |
| | | }; |
| | | $(function () { |
| | | var defaultColunms = Generalization.initColumn(); |
| | | var table = new BSTable(Generalization.id, "/generalization/list", defaultColunms); |
| | | table.setPaginationType("server"); |
| | | Generalization.table = table.init(); |
| | | }); |
New file |
| | |
| | | /** |
| | | * 初始化详情对话框 |
| | | */ |
| | | var GeneralizationInfoDlg = { |
| | | GeneralizationInfoData : {}, |
| | | validateFields: { |
| | | activityName: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '请输入活动名称' |
| | | } |
| | | } |
| | | }, |
| | | participateCount: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '请输入最多参与人数' |
| | | } |
| | | } |
| | | }, |
| | | startTime: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '请选择活动时间' |
| | | } |
| | | } |
| | | }, |
| | | userGrantCount: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '请输入发放数量' |
| | | } |
| | | } |
| | | }, |
| | | monthUseCount: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '请输入每月可用数量' |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 验证数据是否为空 |
| | | */ |
| | | GeneralizationInfoDlg.validate = function () { |
| | | $('#activityGeneralizationInfoForm').data("bootstrapValidator").resetForm(); |
| | | $('#activityGeneralizationInfoForm').bootstrapValidator('validate'); |
| | | return $("#activityGeneralizationInfoForm").data('bootstrapValidator').isValid(); |
| | | }; |
| | | |
| | | /** |
| | | * 清除数据 |
| | | */ |
| | | GeneralizationInfoDlg.clearData = function() { |
| | | this.generalizationInfoData = {}; |
| | | } |
| | | |
| | | /** |
| | | * 设置对话框中的数据 |
| | | * |
| | | * @param key 数据的名称 |
| | | * @param val 数据的具体值 |
| | | */ |
| | | GeneralizationInfoDlg.set = function(key, val) { |
| | | this.generalizationInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 设置对话框中的数据 |
| | | * |
| | | * @param key 数据的名称 |
| | | * @param val 数据的具体值 |
| | | */ |
| | | GeneralizationInfoDlg.get = function(key) { |
| | | return $("#" + key).val(); |
| | | } |
| | | |
| | | /** |
| | | * 关闭此对话框 |
| | | */ |
| | | GeneralizationInfoDlg.close = function() { |
| | | parent.layer.close(window.parent.Generalization.layerIndex); |
| | | } |
| | | |
| | | /** |
| | | * 收集数据 |
| | | */ |
| | | GeneralizationInfoDlg.collectData = function() { |
| | | this |
| | | .set('id') |
| | | .set('activityName') |
| | | .set('participateCount') |
| | | .set('startTime') |
| | | .set('endTime') |
| | | .set('couponId') |
| | | .set('userGrantCount') |
| | | .set('monthUseCount') |
| | | .set('useExplain') |
| | | .set('state') |
| | | .set('qrCode') |
| | | .set('insertTime'); |
| | | } |
| | | |
| | | /** |
| | | * 提交添加 |
| | | */ |
| | | GeneralizationInfoDlg.addSubmit = function() { |
| | | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | var couponId=null; |
| | | $(".siteClass").each(function () { |
| | | couponId = $(this).find("input[name*='id']").val() |
| | | }); |
| | | |
| | | var startTime1 = $("#startTime").val(); |
| | | var time = startTime1.split(" - "); |
| | | var startTime = time[0] + " 00:00:00"; |
| | | var endTime = time[1] + " 23:59:59"; |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/generalization/add", function(data){ |
| | | Feng.success("添加成功!"); |
| | | window.parent.Generalization.table.refresh(); |
| | | GeneralizationInfoDlg.close(); |
| | | },function(data){ |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | this.set('couponId',couponId); |
| | | this.set('startTime',startTime); |
| | | this.set('endTime',endTime); |
| | | ajax.set(this.generalizationInfoData); |
| | | ajax.start(); |
| | | } |
| | | |
| | | /** |
| | | * 提交修改 |
| | | */ |
| | | GeneralizationInfoDlg.editSubmit = function() { |
| | | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | var couponId=null; |
| | | $(".siteClass").each(function () { |
| | | couponId = $(this).find("input[name*='id']").val() |
| | | }); |
| | | |
| | | var startTime1 = $("#startTime").val(); |
| | | console.log(startTime1) |
| | | var time = startTime1.split(" - "); |
| | | var startTime = time[0] + " 00:00:00"; |
| | | var endTime = time[1] + " 23:59:59"; |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/generalization/update", function(data){ |
| | | Feng.success("修改成功!"); |
| | | window.parent.Generalization.table.refresh(); |
| | | GeneralizationInfoDlg.close(); |
| | | },function(data){ |
| | | Feng.error("修改失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | console.log(this.generalizationInfoData) |
| | | this.set('couponId',couponId); |
| | | this.set('startTime',startTime); |
| | | this.set('endTime',endTime); |
| | | ajax.set(this.generalizationInfoData); |
| | | ajax.start(); |
| | | } |
| | | /** |
| | | * 立即处理 |
| | | */ |
| | | GeneralizationInfoDlg.immediately = function(){ |
| | | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | |
| | | var remark = $("#remark").val(); |
| | | if (remark.length > 250){ |
| | | Feng.info("备注不能超过250个字"); |
| | | return; |
| | | } |
| | | var state = $("input[name='state']:checked").val(); |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/userActivity/immediately", function(data){ |
| | | Feng.success("处理成功!"); |
| | | window.parent.Generalization.table.refresh(); |
| | | GeneralizationInfoDlg.close(); |
| | | },function(data){ |
| | | Feng.error("处理失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("id",$("#id").val()); |
| | | ajax.set("state",state); |
| | | ajax.set("remark",$("#remark").val()); |
| | | ajax.start(); |
| | | } |
| | | |
| | | /** |
| | | * 跳转到选择优惠券页面 |
| | | */ |
| | | GeneralizationInfoDlg.toSelectCouponOpt = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '选择优惠券', |
| | | area: ['90%', '80%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/generalization/sysCouponRecord' |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | |
| | | /** |
| | | * 选择优惠券后数据回显 |
| | | * @param id |
| | | * @param couponUseType |
| | | * @param couponType |
| | | * @param money |
| | | */ |
| | | GeneralizationInfoDlg.selectCouponOpt9=function(id,insertTime,couponUseType,money,effective,receive){ |
| | | if(receive == null || receive == "" || receive == undefined){ |
| | | receive = "-"; |
| | | } |
| | | |
| | | // 0="通用券" 1="专车券" 2="出租券" 3="直通车出行券" 7="接送机出行券" |
| | | var type = ""; |
| | | if(couponUseType == 0){ |
| | | type = '<td><input type="hidden" id="couponUseType" name="couponUseType" value="'+couponUseType+'">通用券</td>'; |
| | | }else if(couponUseType == 1){ |
| | | type = '<td><input type="hidden" id="couponUseType" name="couponUseType" value="'+couponUseType+'">专车券</td>'; |
| | | }else if(couponUseType == 2){ |
| | | type = '<td><input type="hidden" id="couponUseType" name="couponUseType" value="'+couponUseType+'">出租券</td>'; |
| | | }else if(couponUseType == 3){ |
| | | type = '<td><input type="hidden" id="couponUseType" name="couponUseType" value="'+couponUseType+'">直通车出行券</td>'; |
| | | }else{ |
| | | type = '<td><input type="hidden" id="couponUseType" name="couponUseType" value="'+couponUseType+'">接送机出行券</td>'; |
| | | } |
| | | |
| | | var str = '<tr class="siteClass">' + |
| | | '<td><input type="hidden" id="id" name="id" value="'+id+'">' + |
| | | '<input type="hidden" id="insertTime" name="insertTime" value="'+insertTime+'">' + insertTime + '</td>' + |
| | | type + |
| | | '<td><input type="hidden" id="money" name="money" value="'+money+'">' + money + '</td>' + |
| | | '<td><input type="hidden" id="effective" name="effective" value="'+effective+'">' + effective + "天"+'</td>' + |
| | | '<td><input type="hidden" id="receive" name="receive" value="'+receive+'">' + receive + '</td>' + |
| | | // '</tr>'; |
| | | '<td><button onclick="deleteSub(this)">移除</button></td></tr>'; |
| | | $("#site").append(str); |
| | | var button = document.getElementById('selectCoupon'); |
| | | button.disabled = true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到选择优惠券页面 |
| | | */ |
| | | GeneralizationInfoDlg.toSelectCouponOpt1 = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '选择优惠券', |
| | | area: ['90%', '80%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/userActivity/sysCouponRecord1' |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | |
| | | /** |
| | | * 选择优惠券后数据回显 |
| | | * @param id |
| | | * @param couponUseType |
| | | * @param couponType |
| | | * @param money |
| | | */ |
| | | GeneralizationInfoDlg.selectCouponOpt1=function(id,couponUseType,couponType,money,name){ |
| | | $("#content3Num2").val(couponUseType==0?"通用券":couponUseType==1?"专车券":couponUseType==2?"出租券":"直通车出行券"); |
| | | $("#content3Num3").val(couponType==1?"抵扣":"满减"); |
| | | $("#content3Num4").val(money); |
| | | $("#content3CouponId").val(id); |
| | | $("#content3Num1").val(name); |
| | | } |
| | | /** |
| | | * 跳转到选择优惠券页面 |
| | | */ |
| | | GeneralizationInfoDlg.toSelectRedOpt = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '选择红包', |
| | | area: ['90%', '80%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/userActivity/sysRedPacketRecord' |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | |
| | | /** |
| | | * 选择优惠券后数据回显 |
| | | * @param id |
| | | * @param couponUseType |
| | | * @param couponType |
| | | * @param money |
| | | */ |
| | | GeneralizationInfoDlg.selectRedOpt=function(id,type,totalMoney,money,startMoney,endMoney,effective){ |
| | | $("#content6Num1").val(type==1?"固定金额":"随机金额"); |
| | | $("#content6Num3").val(type==1?money:startMoney+"-"+endMoney); |
| | | $("#content6Num4").val(effective); |
| | | $("#content6RedId").val(id); |
| | | $("#content6Num2").val(totalMoney); |
| | | } |
| | | /** |
| | | * 跳转添加充值送优惠券页面 |
| | | */ |
| | | GeneralizationInfoDlg.toAddRegistOpt = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '充值赠送优惠券', |
| | | area: ['90%', '80%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/userActivity/addRegist' |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | GeneralizationInfoDlg.addRegistOpt = function (num1,num2,num3,num4,num5,num6,num7,num8,num9,num10,num11,id1,id2,id3,id4) { |
| | | var str = '<tr class="timeClass">' + |
| | | '<td><input type="hidden" id="id1" name="id1" value="'+id1+'"><input type="hidden" id="num1" name="num1" value="'+num1+'">' + num1 + '</td>' + |
| | | '<td><input type="hidden" id="id2" name="id2" value="'+id2+'"><input type="hidden" id="num10" name="num10" value="'+num10+'">' + num10 + '</td>' + |
| | | '<td><input type="hidden" id="num11" name="num11" value="'+num11+'">' + num11 + '</td>' + |
| | | '<td><input type="hidden" id="id3" name="id3" value="'+id3+'"><input type="hidden" id="num3" name="num3" value="'+num3+'">' + num3 + '</td>' + |
| | | '<td><input type="hidden" id="id4" name="id4" value="'+id4+'"><input type="hidden" id="num2" name="num2" value="'+num2+'">' + num2 + '</td>' + |
| | | '<td><input type="hidden" id="num5" name="num5" value="'+num5+'">' + num5 + '</td>' + |
| | | '<td><input type="hidden" id="num4" name="num4" value="'+num4+'">' + num4 + '</td>' + |
| | | '<td><input type="hidden" id="num7" name="num7" value="'+num7+'">' + num7 + '</td>' + |
| | | '<td><input type="hidden" id="num6" name="num6" value="'+num6+'">' + num6 + '</td>' + |
| | | '<td><input type="hidden" id="num9" name="num9" value="'+num9+'">' + num9 + '</td>' + |
| | | '<td><input type="hidden" id="num8" name="num8" value="'+num8+'">' + num8 + '</td>' + |
| | | '<td><button onclick="deleteSub(this)">移除</button></td></tr>'; |
| | | $("#coun").append(str); |
| | | } |
| | | function deleteSub(e) { |
| | | $(e).parent().parent().remove(); |
| | | var button = document.getElementById('selectCoupon'); |
| | | button.disabled = false; |
| | | } |
| | | |
| | | $(function() { |
| | | Feng.initValidator("activityGeneralizationInfoForm", GeneralizationInfoDlg.validateFields); |
| | | }); |
New file |
| | |
| | | /** |
| | | * 管理初始化 |
| | | */ |
| | | var SysCouponRecord = { |
| | | id: "SysCouponRecordTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1 |
| | | }; |
| | | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | SysCouponRecord.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', radio: true}, |
| | | {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle',width:'8%'}, |
| | | {title: '添加时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '优惠券类型', field: 'couponUseType', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if(value==0){ |
| | | return "通用券"; |
| | | }else if(value==1){ |
| | | return "专车券"; |
| | | }else if(value==2){ |
| | | return "出租券"; |
| | | }else if(value==3){ |
| | | return "直通车出行券"; |
| | | }else if(value==7){ |
| | | return "接送机出行券"; |
| | | }else{ |
| | | return ""; |
| | | } |
| | | } |
| | | }, |
| | | {title: '优惠金额', field: 'money', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '有效期', field: 'effective', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | return value+"天"; |
| | | } |
| | | }, |
| | | {title: '领取人数', field: 'receive', visible: true, align: 'center', valign: 'middle'}, |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | SysCouponRecord.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | SysCouponRecord.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 关闭选择用户页面 |
| | | */ |
| | | SysCouponRecord.close = function () { |
| | | parent.layer.close(window.parent.GeneralizationInfoDlg.layerIndex); |
| | | } |
| | | SysCouponRecord.close1 = function () { |
| | | parent.layer.close(window.parent.RegistInfoDlg.layerIndex); |
| | | } |
| | | |
| | | /** |
| | | * 确认选择 |
| | | */ |
| | | SysCouponRecord.selectCouponOpt = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if (selected.length == 0) { |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | } |
| | | var id = selected[0].id; |
| | | var insertTime = selected[0].insertTime; |
| | | |
| | | var couponUseType = selected[0].couponUseType; |
| | | var couponType = selected[0].couponType; |
| | | var money = selected[0].money; |
| | | var name = selected[0].name; |
| | | var effective = selected[0].effective; |
| | | var receive = selected[0].receive; |
| | | if ("" == id || null == id || undefined == id){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return ; |
| | | } |
| | | var obj = $("#obj").val(); |
| | | window.parent.GeneralizationInfoDlg.selectCouponOpt9(id,insertTime,couponUseType,money,effective,receive); |
| | | SysCouponRecord.close(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 确认选择 |
| | | */ |
| | | SysCouponRecord.selectCouponOpt1 = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if (selected.length == 0) { |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | } |
| | | var id = selected[0].id; |
| | | var couponUseType = selected[0].couponUseType; |
| | | var couponType = selected[0].couponType; |
| | | var money = selected[0].money; |
| | | var name = selected[0].name; |
| | | if ("" == id || null == id || undefined == id){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return ; |
| | | } |
| | | var obj = $("#obj").val(); |
| | | window.parent.GeneralizationInfoDlg.selectCouponOpt1(id,couponUseType,couponType,money,name); |
| | | SysCouponRecord.close(); |
| | | } |
| | | /** |
| | | * 确认选择 |
| | | */ |
| | | SysCouponRecord.selectCouponOpt2 = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if (selected.length == 0) { |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | } |
| | | var id = selected[0].id; |
| | | var money = selected[0].money; |
| | | var couponUseType = selected[0].couponUseType; |
| | | if ("" == id || null == id || undefined == id){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return ; |
| | | } |
| | | var obj = $("#obj").val(); |
| | | window.parent.RegistInfoDlg.selectCouponOpt(id,money,couponUseType); |
| | | parent.layer.close(window.parent.RegistInfoDlg.layerIndex); |
| | | } |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | SysCouponRecord.search = function () { |
| | | var queryData = {}; |
| | | queryData['createTime'] = $("#createTime").val(); |
| | | queryData['couponUseType'] = $("#couponUseType").val(); |
| | | SysCouponRecord.table.refresh({query: queryData}); |
| | | }; |
| | | SysCouponRecord.resetSearch = function () { |
| | | $("#createTime").val(""); |
| | | $("#couponUseType").val(""); |
| | | SysCouponRecord.search(); |
| | | }; |
| | | $(function () { |
| | | var defaultColunms = SysCouponRecord.initColumn(); |
| | | var table = new BSTable(SysCouponRecord.id, "/sysCouponRecord/list", defaultColunms); |
| | | table.setPaginationType("server"); |
| | | var queryData = {}; |
| | | queryData['couponUseType'] = $("#couponUseType").val(); |
| | | table.setQueryParams(queryData); |
| | | SysCouponRecord.table = table.init(); |
| | | }); |
| | |
| | | return "出租券"; |
| | | }else if(value==3){ |
| | | return "直通车出行券"; |
| | | }else if(value==7){ |
| | | return "接送机出行券"; |
| | | }else{ |
| | | return ""; |
| | | } |