New file |
| | |
| | | package com.dsh.activity.controller; |
| | | |
| | | import cn.mb.cloud.common.data.controller.BaseController; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.activity.entity.THuiminCard; |
| | | import com.dsh.activity.entity.TPayHuimin; |
| | | import com.dsh.activity.service.HuiminCardService; |
| | | import com.dsh.activity.service.PayHuiminService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @RequestMapping("/tHuiminCard") |
| | | public class THuiminCardController extends BaseController { |
| | | @Autowired |
| | | private HuiminCardService tHuiminCardService; |
| | | @Autowired |
| | | private PayHuiminService payHuiminService; |
| | | |
| | | |
| | | @GetMapping("/queryPage") |
| | | public Page<THuiminCard> queryPage(Page<THuiminCard> page, THuiminCard tHuiminCard) { |
| | | QueryWrapper<THuiminCard> queryWrapper = new QueryWrapper<>(); |
| | | if (!StringUtils.isEmpty(tHuiminCard.getHuiMinName())){ |
| | | queryWrapper.like("huiMinName",tHuiminCard.getHuiMinName()); |
| | | } |
| | | if (!StringUtils.isEmpty(tHuiminCard.getHuiMinType())){ |
| | | queryWrapper.eq("huiMinType",tHuiminCard.getHuiMinType()); |
| | | } |
| | | if (tHuiminCard.getStartTime() != null && tHuiminCard.getEndTime() != null){ |
| | | queryWrapper.ge("startTime",tHuiminCard.getStartTime()); |
| | | queryWrapper.le("endTime",tHuiminCard.getEndTime()); |
| | | } |
| | | Integer flag = tHuiminCard.getFlag(); |
| | | if (flag != null){ |
| | | Date now = new Date(); |
| | | switch (flag) { |
| | | case 1: |
| | | queryWrapper.le("startTime", now); |
| | | break; |
| | | case 2: |
| | | queryWrapper.ge("startTime", now); |
| | | queryWrapper.le("endTime", now); |
| | | break; |
| | | case 3: |
| | | queryWrapper.lt("endTime", now); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (tHuiminCard.getStatus() != null){ |
| | | queryWrapper.eq("status",tHuiminCard.getStatus()); |
| | | } |
| | | Page<THuiminCard> page1 = tHuiminCardService.page(page, queryWrapper); |
| | | List<THuiminCard> records = page1.getRecords(); |
| | | List<Integer> cardIds = records.stream().map(THuiminCard::getId).collect(Collectors.toList()); |
| | | List<TPayHuimin> list = payHuiminService.list(new LambdaQueryWrapper<TPayHuimin>() |
| | | .in(TPayHuimin::getCardId, cardIds)); |
| | | |
| | | Map<Integer, Long> cardIdCountMap = list.stream() |
| | | .collect(Collectors.groupingBy( |
| | | TPayHuimin::getCardId, |
| | | Collectors.counting() |
| | | )); |
| | | |
| | | |
| | | records.forEach(item -> { |
| | | item.setBuyCount(cardIdCountMap.getOrDefault(item.getId(), 0L).intValue()); |
| | | }); |
| | | return page1; |
| | | } |
| | | |
| | | @GetMapping("/getById") |
| | | public THuiminCard getById(@RequestParam("id") Integer id) { |
| | | return tHuiminCardService.getById(id); |
| | | } |
| | | |
| | | @PostMapping("/save") |
| | | public R<?> save(@RequestBody THuiminCard tHuiminCard) { |
| | | tHuiminCardService.save(tHuiminCard); |
| | | return R.ok(""); |
| | | } |
| | | |
| | | @PostMapping("/updateById") |
| | | public R<?> updateById(@RequestBody THuiminCard tHuiminCard) { |
| | | tHuiminCardService.updateById(tHuiminCard); |
| | | return R.ok(""); |
| | | } |
| | | |
| | | @GetMapping("/deleteById") |
| | | public R<?> deleteById(@RequestParam("id") Integer id) { |
| | | tHuiminCardService.removeById(id); |
| | | return R.ok(""); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | */ |
| | | @PostMapping("/deleteBatchIds") |
| | | public R<?> deleteBatchIds(@RequestBody List<Integer> ids) { |
| | | tHuiminCardService.removeByIds(ids); |
| | | return R.ok(""); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/changeState") |
| | | public String changeState(@RequestParam("id")Integer id, @RequestParam("status") Integer status){ |
| | | THuiminCard tHuiminCard = tHuiminCardService.getById(id); |
| | | tHuiminCard.setStatus(status); |
| | | tHuiminCardService.updateById(tHuiminCard); |
| | | return "success"; |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | * 限购数量 为空表示不限 |
| | | */ |
| | | @ApiModelProperty(value = "限购数量 为空表示不限") |
| | | |
| | | @TableField("limitCount") |
| | | private Integer limitCount; |
| | | /** |
| | |
| | | @ApiModelProperty(value = "轮播图 逗号分隔") |
| | | @TableField("banner") |
| | | private String banner; |
| | | |
| | | /** |
| | | *有效期开始时间 不填表示永久 |
| | | */ |
| | | @TableField("endTime") |
| | | @ApiModelProperty(value = "有效期开始时间 不填表示永久") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | |
| | | /** |
| | | *有效期结束时间 不填表示永久 |
| | | */ |
| | | @TableField("startTime") |
| | | @ApiModelProperty(value = "有效期结束时间 不填表示永久") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | | /** |
| | | *可使用时间段,周,多个逗号分隔 |
| | | */ |
| | |
| | | private String sort; |
| | | |
| | | /** |
| | | *门店id 当使用范围为场地的时候存储门店id |
| | | */ |
| | | @TableField("storeIds") |
| | | private String storeIds; |
| | | /** |
| | | *运营商id |
| | | */ |
| | | @ApiModelProperty(value = "运营商id") |
| | |
| | | @ApiModelProperty(value = "状态 1已上架 2已下架 3已删除 ") |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | *门店ids |
| | | */ |
| | | @ApiModelProperty(value = "门店ids") |
| | | @TableField("storeIds") |
| | | private String storeIds; |
| | | |
| | | @ApiModelProperty("是否购买 0否1是") |
| | | @TableField(exist = false) |
| | |
| | | @ApiModelProperty("立即购买页面的协议列表") |
| | | @TableField(exist = false) |
| | | private List<THuiminAgreementSetting> agreementSettings; |
| | | /** |
| | | * 状态: 1-未开始 2-已开始 3-已结束 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer flag; |
| | | |
| | | /** |
| | | * 已购数量 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer buyCount; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | @TableField("refundNumber") |
| | | private String refundNumber; |
| | | |
| | | /** |
| | | * 已购数量 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer buyCount; |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | package com.dsh.course.feignClient.activity; |
| | | |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.activity.model.THuiminCard; |
| | | import com.dsh.guns.modular.system.model.CoachChangeStateVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author mitao |
| | |
| | | */ |
| | | @FeignClient(value = "mb-cloud-activity") |
| | | public interface HuiminCardClient { |
| | | @PostMapping(value = "/tHuiminCard/save") |
| | | void save(@RequestBody THuiminCard tHuiminCard); |
| | | |
| | | @GetMapping(value = "/tHuiminCard/queryPage") |
| | | Page<THuiminCard> queryPage(@RequestParam("page") Page<THuiminCard>page, |
| | | @RequestParam("tHuiminCard") THuiminCard tHuiminCard); |
| | | |
| | | @GetMapping(value = "/tHuiminCard/getById") |
| | | THuiminCard getById(@RequestParam("id") Integer id); |
| | | |
| | | @PostMapping(value = "/tHuiminCard/updateById") |
| | | void updateById(@RequestBody THuiminCard tHuiminCard); |
| | | |
| | | |
| | | @GetMapping("/tHuiminCard/deleteById") |
| | | void deleteById(@RequestParam("id") Integer id); |
| | | @PostMapping("/tHuiminCard/deleteBatchIds") |
| | | void deleteBatchIds(@RequestBody List<Integer> ids); |
| | | |
| | | @GetMapping("/tHuiminCard/changeState") |
| | | String changeState(@RequestParam("id")Integer id, @RequestParam("status") Integer status); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | |
| | | *有效期 不填表示永久 |
| | | */ |
| | | @TableField("endTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date endTime; |
| | | |
| | | /** |
| | | *有效期结束时间 不填表示永久 |
| | | */ |
| | | @TableField("startTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date startTime; |
| | | /** |
| | | *可使用时间段,周,多个逗号分隔 |
| | | */ |
| | |
| | | /** |
| | | *门店id |
| | | */ |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | @TableField("storeIds") |
| | | private String storeIds; |
| | | /** |
| | | *运营商id |
| | | */ |
| | |
| | | private Integer operatorId; |
| | | |
| | | |
| | | /** |
| | | *状态 1已上架 2已下架 3已删除 |
| | | */ |
| | | @ApiModelProperty(value = "状态 1已上架 2已下架 3已删除 ") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | private String startTimeStr; |
| | | @TableField(exist = false) |
| | | private String endTimeStr; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.dsh.guns.modular.system.model.TCity; |
| | | import com.dsh.guns.modular.system.service.ICityService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/base") |
| | | public class CommontController { |
| | | @Autowired |
| | | private ICityService cityService; |
| | | |
| | | |
| | | /** |
| | | * 获取所有省份 |
| | | */ |
| | | @RequestMapping("/region/getProvince") |
| | | public List<TCity> getProvince() { |
| | | return cityService.list(new LambdaQueryWrapper<TCity>() |
| | | .eq(TCity::getParentId, 0)); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有城市 |
| | | */ |
| | | @RequestMapping("/region/getCity") |
| | | public List<TCity> getCity() { |
| | | return cityService.list(new LambdaQueryWrapper<TCity>() |
| | | .isNotNull(TCity::getCitycode)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.activity.HuiminCardClient; |
| | | import com.dsh.course.feignClient.activity.model.THuiminCard; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.core.page.PageInfoBT; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.service.ITSiteService; |
| | | import com.dsh.guns.modular.system.service.TOperatorService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 惠民卡控制器 |
| | |
| | | |
| | | @Autowired |
| | | private HuiminCardClient huiminCardClient; |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | @Autowired |
| | | private TOperatorService operatorService; |
| | | @Autowired |
| | | private ITSiteService tSiteService; |
| | | |
| | | /** |
| | | * 跳转到惠民卡首页 |
| | |
| | | |
| | | return PREFIX + "tHuiminCard_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到详情页面 |
| | | */ |
| | | @RequestMapping("/tHuiminCard_detail/{id}") |
| | | public String tHuiminCardDetail(@PathVariable("id") Integer id) { |
| | | THuiminCard byId = huiminCardClient.getById(id); |
| | | Date startTime = byId.getStartTime(); |
| | | if (startTime != null){ |
| | | byId.setStartTimeStr(DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | Date endTime = byId.getEndTime(); |
| | | if (endTime != null){ |
| | | byId.setEndTimeStr(DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | String jsonString = JSONObject.toJSONString(byId); |
| | | setAttr("tHuiminCard", jsonString); |
| | | return PREFIX + "tHuiminCard_detail.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取惠民卡列表 |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public PageInfoBT<THuiminCard> list(Page<THuiminCard> page,THuiminCard tHuiminCard) { |
| | | return super.packForBT(huiminCardClient.queryPage(page, tHuiminCard)); |
| | | } |
| | | |
| | | /** |
| | | * 获取门店列表 |
| | | */ |
| | | @RequestMapping(value = "/storeList") |
| | | @ResponseBody |
| | | public Object storeList(Page<TStore> page, HuiminCardStoreQuery query) { |
| | | String storeIds = query.getStoreIds(); |
| | | String[] ids = {}; |
| | | if (!StringUtils.isEmpty(storeIds)){ |
| | | ids = storeIds.split(","); |
| | | } |
| | | |
| | | Page<TStore> storePage = storeService.page(page, new LambdaQueryWrapper<TStore>() |
| | | .in(ids.length > 0, TStore::getId, Arrays.asList(ids)) |
| | | .eq(!StringUtils.isEmpty(query.getProvinceCode()), TStore::getProvinceCode, query.getProvinceCode()) |
| | | .eq(!StringUtils.isEmpty(query.getCityCode()), TStore::getCityCode, query.getCityCode()) |
| | | .eq(query.getOperatorId() != null, TStore::getOperatorId, query.getOperatorId()) |
| | | .like(!StringUtils.isEmpty(query.getStoreName()), TStore::getName, query.getStoreName()) |
| | | .orderByDesc(TStore::getCreateTime)); |
| | | return storePage.convert(tStore -> { |
| | | HuiminCardStoreVO huiminCardStoreVO = new HuiminCardStoreVO(); |
| | | huiminCardStoreVO.setStoreId(tStore.getId()); |
| | | huiminCardStoreVO.setProvince(tStore.getProvince()); |
| | | huiminCardStoreVO.setStoreName(tStore.getName()); |
| | | huiminCardStoreVO.setIds(tStore.getIds()); |
| | | TOperator operator = operatorService.getById(tStore.getOperatorId()); |
| | | if (operator != null){ |
| | | huiminCardStoreVO.setOperatorName(operator.getName()); |
| | | } |
| | | return huiminCardStoreVO; |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 获取场地列表 |
| | | */ |
| | | @RequestMapping(value = "/siteList") |
| | | @ResponseBody |
| | | public Object siteList(Page<TSite> page, HuiminCardStoreQuery query) { |
| | | String storeName = query.getStoreName(); |
| | | List<String> storeIds = new ArrayList<>(); |
| | | if (!StringUtils.isEmpty(storeName)){ |
| | | List<String> storeIdsByName = storeService.listObjs(new LambdaQueryWrapper<TStore>() |
| | | .select(TStore::getId) |
| | | .eq(TStore::getName, storeName), String::valueOf); |
| | | if (storeIdsByName != null && !storeIdsByName.isEmpty()){ |
| | | storeIds.addAll(storeIdsByName); |
| | | }else { |
| | | return null; |
| | | } |
| | | } |
| | | Integer operatorId = query.getOperatorId(); |
| | | if (operatorId != null){ |
| | | List<String> storeIdsByOperatorId = storeService.listObjs(new LambdaQueryWrapper<TStore>() |
| | | .select(TStore::getId) |
| | | .eq(TStore::getOperatorId, operatorId), String::valueOf); |
| | | if (storeIdsByOperatorId != null && !storeIdsByOperatorId.isEmpty()){ |
| | | storeIds.addAll(storeIdsByOperatorId); |
| | | }else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | Page<TSite> sitePage = tSiteService.page(page, new LambdaQueryWrapper<TSite>() |
| | | .eq(!StringUtils.isEmpty(query.getProvinceCode()), TSite::getProvinceCode, query.getProvinceCode()) |
| | | .eq(!StringUtils.isEmpty(query.getCityCode()), TSite::getCityCode, query.getCityCode()) |
| | | .in(!storeIds.isEmpty(), TSite::getStoreId, storeIds)); |
| | | |
| | | |
| | | return sitePage.convert(tSite -> { |
| | | HuiminCardSiteVO huiminCardSiteVO = new HuiminCardSiteVO(); |
| | | huiminCardSiteVO.setSiteId(tSite.getId()); |
| | | huiminCardSiteVO.setProvince(tSite.getProvince()); |
| | | huiminCardSiteVO.setSiteName(tSite.getName()); |
| | | huiminCardSiteVO.setIds(tSite.getIds()); |
| | | |
| | | TStore store = storeService.getById(tSite.getStoreId()); |
| | | if (store != null){ |
| | | huiminCardSiteVO.setStoreName(store.getName()); |
| | | } |
| | | |
| | | TOperator operator = operatorService.getById(tSite.getOperatorId()); |
| | | if (operator != null){ |
| | | huiminCardSiteVO.setOperatorName(operator.getName()); |
| | | } |
| | | return huiminCardSiteVO; |
| | | |
| | | }); |
| | | } |
| | | |
| | | |
| | | @PostMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(THuiminCard tHuiminCard) { |
| | | huiminCardClient.save(tHuiminCard); |
| | | return SUCCESS_TIP; |
| | | } |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(THuiminCard tHuiminCard) { |
| | | huiminCardClient.updateById(tHuiminCard); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam String ids) { |
| | | if (StringUtils.isEmpty(ids)) { |
| | | throw new IllegalArgumentException("参数ids不能为空"); |
| | | } |
| | | String[] idStrings = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(idStrings.length); |
| | | |
| | | for (String idStr : idStrings) { |
| | | idStr = idStr.trim(); |
| | | if (!idStr.isEmpty()) { |
| | | idList.add(Integer.parseInt(idStr)); |
| | | } |
| | | } |
| | | huiminCardClient.deleteBatchIds(idList); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 上下架状态修改 |
| | | */ |
| | | @RequestMapping(value = "/changeState") |
| | | @ResponseBody |
| | | public Object changeState(Integer id, Integer status) { |
| | | String s = huiminCardClient.changeState(id, status); |
| | | System.out.println(s); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | |
| | | /* *//** |
| | | * 跳转到修改惠民卡 |
| | |
| | | return huiminCardClient.selectList(null); |
| | | } |
| | | |
| | | *//** |
| | | * 新增惠民卡 |
| | | *//* |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(THuiminCard tHuiminCard) { |
| | | huiminCardClient.insert(tHuiminCard); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | *//** |
| | | * 删除惠民卡 |
| | | *//* |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tHuiminCardId) { |
| | | huiminCardClient.deleteById(tHuiminCardId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | *//** |
| | | * 修改惠民卡 |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class HuiminCardSiteVO { |
| | | private Integer siteId; |
| | | |
| | | private String province; |
| | | |
| | | private String operatorName; |
| | | |
| | | private String siteName; |
| | | |
| | | private String storeName; |
| | | |
| | | private String ids; |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class HuiminCardStoreQuery { |
| | | /** |
| | | * 省份编号 |
| | | */ |
| | | private String provinceCode; |
| | | |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | private String cityCode; |
| | | |
| | | /** |
| | | * 运营商Id |
| | | */ |
| | | private Integer operatorId; |
| | | |
| | | /** |
| | | * 门店名称 |
| | | */ |
| | | private String storeName; |
| | | |
| | | private String storeIds; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class HuiminCardStoreVO { |
| | | private Integer storeId; |
| | | |
| | | private String province; |
| | | |
| | | private String operatorName; |
| | | |
| | | private String storeName; |
| | | |
| | | private String ids; |
| | | } |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="row" id="app0"> |
| | | <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"> |
| | | <el-form :inline="true" :model="query"> |
| | | <el-form-item label="惠民卡名称:"> |
| | | <el-input v-model="query.name" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="惠民卡类型:"> |
| | | <el-select v-model="query.type" placeholder="全部"> |
| | | <el-option label="全部" value=""></el-option> |
| | | <el-option label="年度卡" value="year"></el-option> |
| | | <el-option label="季度卡" value="quarter"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="有效期:"> |
| | | <el-date-picker |
| | | v-model="query.dateRange" |
| | | type="daterange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="可售状态:"> |
| | | <el-select v-model="query.status" placeholder="全部"> |
| | | <el-option label="全部" value=""></el-option> |
| | | <el-option label="已上架" value="1"></el-option> |
| | | <el-option label="已下架" value="0"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="condition" name="名称" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="THuiminCard.search()"/> |
| | | <div class="col-sm-12"> |
| | | <el-button type="primary" size="mini" v-on:click="handleAdd" icon="el-icon-circle-plus-outline">添加</el-button> |
| | | <el-button type="primary" size="mini" v-on:click="handleEdit" icon="el-icon-edit">编辑</el-button> |
| | | <el-button type="primary" size="mini" v-on:click="handleDelete" icon="el-icon-delete">删除</el-button> |
| | | <el-button type="primary" size="mini" v-on:click="handleShelves(1)" icon="el-icon-upload2">上架</el-button> |
| | | <el-button type="primary" size="mini" v-on:click="handleShelves(2)" icon="el-icon-download">下架</el-button> |
| | | <el-button type="primary" size="mini" v-on:click="handleViewDetail" icon="el-icon-tickets">查看详情</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="THuiminCardTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/tHuiminCard/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="THuiminCard.openAddTHuiminCard()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tHuiminCard/update")){ |
| | | <#button name="修改" icon="fa-edit" clickFun="THuiminCard.openTHuiminCardDetail()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tHuiminCard/delete")){ |
| | | <#button name="删除" icon="fa-remove" clickFun="THuiminCard.delete()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="THuiminCardTable"/> |
| | | <el-table |
| | | :data="tableData" |
| | | stripe |
| | | style="width: 100%" |
| | | v-on:selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="huiMinName" label="惠民卡名称"></el-table-column> |
| | | <el-table-column prop="huiMinType" label="类型"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.huiMinType === '1'">年度卡</span> |
| | | <span v-else-if="scope.row.huiMinType === '2'">年内卡</span> |
| | | <span v-else>未知类型</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="salesMoney" label="售卖金额"> |
| | | <template slot-scope="scope"> |
| | | ¥{{ scope.row.salesMoney }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="date" min-width="200px" label="有效期"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.startTime }}至{{ scope.row.endTime }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="grantCount" label="发放数量"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.grantCount == null ? '无限制' : scope.row.grantCount }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="limitCount" label="限购数量"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.limitCount == null ? '无限制' : scope.row.limitCount }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="buyCount" label="已购数量"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.buyCount == null ? 0 : scope.row.buyCount }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="sort" label="排序"></el-table-column> |
| | | <el-table-column prop="flag" label="活动状态" > |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.flag === '1'">未开始</span> |
| | | <span v-else-if="scope.row.flag === '2'">已开始</span> |
| | | <span v-else-if="scope.row.flag === '3'">已结束</span> |
| | | <span v-else>未知类型</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="status" label="可售状态"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.status === '1'">已上架</span> |
| | | <span v-else-if="scope.row.status === '2'">已下架</span> |
| | | <span v-else-if="scope.row.status === '3'">已删除</span> |
| | | <span v-else>未知类型</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" v-on:click="handleViewDetail(scope.row)">查看详情</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- 分页 --> |
| | | <el-pagination |
| | | v-on:size-change="handleSizeChange" |
| | | v-on:current-change="handleCurrentChange" |
| | | :current-page="currentPage" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | :page-size="pageSize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="total"> |
| | | </el-pagination> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tHuiminCard/tHuiminCard.js"></script> |
| | | <script src="${ctxPath}/js/vue/vue.js"></script> |
| | | <script src="${ctxPath}/js/elementui/index.js"></script> |
| | | <script src="${ctxPath}/modular/system/tHuiminCard/tHuiminCard2.js"></script> |
| | | <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> |
| | | <script src="${ctxPath}/modular/system/tHuiminCard/tHuiminCard.js"></script> |
| | | <script src="${ctxPath}/modular/system/tHuiminAgreement/tHuiminAgreement.js"></script> |
| | | <script> |
| | | |
| | | </script> |
| | | @} |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal"> |
| | | <body> |
| | | <div id="app0" class="form-container"> |
| | | <el-form :rules="rules" label-position="left" ref="formRef" label-width="120px" :model="huiminCard" size="small"> |
| | | <el-form-item label="惠民卡名称" prop="huiMinName"> |
| | | <el-input v-model="huiminCard.huiMinName"></el-input> |
| | | </el-form-item> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#input id="id" name="主键id" underline="true"/> |
| | | <#input id="huiMinName" name="惠民卡名称" underline="true"/> |
| | | <#input id="huiMinType" name="惠民卡类型1年度2年内" underline="true"/> |
| | | <#input id="salesMoney" name="售卖金额" underline="true"/> |
| | | <#input id="buyCover" name="已购买封面" underline="true"/> |
| | | <#input id="unBuyCover" name="未购买封面" underline="true"/> |
| | | <#input id="buyRemark" name="已购买使用说明" underline="true"/> |
| | | <#input id="unBuyRemark" name="未购买使用说明" underline="true"/> |
| | | <#input id="banner" name="轮播图 逗号分隔" underline="true"/> |
| | | <#input id="grantCount" name="发放数量 为空表示不限"/> |
| | | |
| | | <!-- 惠民卡类型 --> |
| | | <el-form-item label="惠民卡类型" prop="huiMinType"> |
| | | <el-radio-group v-model="huiminCard.huiMinType"> |
| | | <el-radio :label="1">年度卡</el-radio> |
| | | <el-radio :label="2">年内卡</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | |
| | | <!-- 售卖金额 --> |
| | | <el-form-item label="售卖金额" prop="salesMoney"> |
| | | <el-input placeholder="请输入内容" v-model="huiminCard.salesMoney"> |
| | | <template slot="append">¥</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | |
| | | <!-- 封面图片 --> |
| | | <el-row> |
| | | <el-form-item label="封面图片2" prop="cover"> |
| | | <el-col :span="12"> |
| | | <div class="upload-area text-center"> |
| | | <el-upload |
| | | :limit="1" |
| | | action="/tCouponManage/uploadPic" |
| | | list-type="picture-card" |
| | | :multiple="false" |
| | | accept="." |
| | | :on-success="handleUnBuyCoverSuccess" |
| | | :before-upload="beforeUpload" |
| | | :on-exceed="handleUnBuyCoverExceed" |
| | | :on-remove="handleUnBuyCoverRemove"> |
| | | <i class="el-icon-plus avatar-uploader-icon"></i> |
| | | </el-upload> |
| | | <span>未购买封面</span> |
| | | </div> |
| | | |
| | | <div class="col-sm-6"> |
| | | <#input id="limitCount" name=" 限购数量 为空表示不限" underline="true"/> |
| | | <#input id="endTime" name="有效期 不填表示永久" underline="true"/> |
| | | <#input id="useWeeks" name="可使用时间段,周,多个逗号分隔" underline="true"/> |
| | | <#input id="useTimes" name="可使用时间段,时分秒,多个逗号分隔" underline="true"/> |
| | | <#input id="unUseTimes" name="不可用时间段,yyyy-MM-dd HH:mm:ss,多个逗号分隔" underline="true"/> |
| | | <#input id="useScope" name="使用范围1门店2场地" underline="true"/> |
| | | <#input id="useIds" name="根据适用范围,存储门店id或场地id,多个逗号分隔" underline="true"/> |
| | | <#input id="introduce" name="惠民卡介绍" underline="true"/> |
| | | <#input id="sort" name="排序" underline="true"/> |
| | | <#input id="storeId" name="门店id" underline="true"/> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <div class="upload-area text-center" style="display: flex"> |
| | | <el-upload |
| | | :limit="1" |
| | | class="avatar-uploader" |
| | | action="/tCouponManage/uploadPic" |
| | | list-type="picture-card" |
| | | :multiple="false" |
| | | accept="." |
| | | :on-success="handleBuyCoverSuccess" |
| | | :before-upload="beforeUpload" |
| | | :on-remove="handleBuyCoverRemove"> |
| | | <i class="el-icon-plus avatar-uploader-icon"></i> |
| | | </el-upload> |
| | | <span>已购买封面</span> |
| | | </div> |
| | | </el-col> |
| | | </el-form-item> |
| | | </el-row> |
| | | |
| | | |
| | | <!-- 使用说明 --> |
| | | <el-form-item label="使用说明" prop="unBuyRemark"> |
| | | <el-input |
| | | type="textarea" |
| | | :autosize="{ minRows: 2, maxRows: 4}" |
| | | placeholder="请输入少于200字使用说明" |
| | | v-model="huiminCard.unBuyRemark"> |
| | | </el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 使用期限 --> |
| | | <el-form-item label="使用期限" prop="buyRemark"> |
| | | <el-input |
| | | type="textarea" |
| | | :autosize="{ minRows: 2, maxRows: 4}" |
| | | placeholder="请输入少于200字使用说明" |
| | | v-model="huiminCard.buyRemark"> |
| | | </el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 轮播介绍图 --> |
| | | <el-form-item label="轮播介绍图" prop="banner"> |
| | | <div class="upload-area"> |
| | | <div class="d-flex align-items-center justify-content-between"> |
| | | <el-upload |
| | | :limit="5" |
| | | class="avatar-uploader" |
| | | action="/tCouponManage/uploadPic" |
| | | list-type="picture-card" |
| | | accept="." |
| | | :on-success="handleSuccess" |
| | | :before-upload="beforeUpload" |
| | | :on-remove="handleRemove"> |
| | | <i class="el-icon-plus avatar-uploader-icon"></i> |
| | | </el-upload> |
| | | <span>点击上传,最多5张</span> |
| | | </div> |
| | | </div> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 发放数量 --> |
| | | <el-form-item label="发放数量"> |
| | | <el-input v-model="huiminCard.grantCount"></el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 限购数量 --> |
| | | <el-form-item label="限购数量"> |
| | | <el-input v-model="huiminCard.limitCount"></el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 有效期 --> |
| | | <el-form-item label="有效期"> |
| | | <el-date-picker |
| | | v-model="huiminCard.endTime" |
| | | type="date" |
| | | placeholder="选择日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 可用时间 --> |
| | | <el-form-item label="可用时间" prop="weeks"> |
| | | <el-card |
| | | shadow="never" |
| | | v-for="(weekGroup, groupIndex) in huiminCard.weeks" |
| | | :key="'weekGroup_' + groupIndex"> |
| | | <div slot="header" |
| | | style="display: flex; |
| | | align-items: center; |
| | | height: 18px; |
| | | padding: 0 16px;"> |
| | | <el-button type="text" v-on:click="addWeek()">添加</el-button> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="THuiminCardInfoDlg.addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="THuiminCardInfoDlg.close()"/> |
| | | <div class="form-group" style="display: flex; justify-content: space-between;"> |
| | | <div |
| | | class="col-md-1" |
| | | style="flex: 1 0 calc(100% / 7);" |
| | | v-for="(day, dayIndex) in weekGroup.days" |
| | | :key="dayIndex"> |
| | | <input |
| | | class="form-check-input" |
| | | type="checkbox" |
| | | :name="'week_'+''+groupIndex" |
| | | :value="day.value" |
| | | v-model="day.checked"> |
| | | <label class="form-check-label"> |
| | | {{ day.label }} |
| | | </label> |
| | | </div> |
| | | </div> |
| | | <!-- 时间输入和删除按钮 --> |
| | | <div class="row g-3"> |
| | | <div class="col-md-6" style="display: flex"> |
| | | <el-time-select |
| | | placeholder="起始时间" |
| | | v-model="weekGroup.startTime" |
| | | :picker-options="{ |
| | | start: '00:00', |
| | | step: '01:00', |
| | | end: '23:00'}" |
| | | > |
| | | </el-time-select> |
| | | <el-time-select |
| | | placeholder="结束时间" |
| | | v-model="weekGroup.endTime" |
| | | :picker-options="{ |
| | | start: '00:00', |
| | | step: '01:00', |
| | | end: '23:00', |
| | | minTime: weekGroup.startTime}"> |
| | | </el-time-select> |
| | | </div> |
| | | <div class="col-md-6"> |
| | | <button |
| | | type="button" |
| | | class="btn btn-danger" |
| | | style="float: right" |
| | | v-on:click="removeWeek(groupIndex)" |
| | | > |
| | | <i class="fa fa-trash"></i> 删除 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </el-form-item> |
| | | |
| | | <!-- 不可用时间 --> |
| | | <el-form-item label="不可用时间" prop="unUseTimes"> |
| | | <el-button type="text" v-on:click="addUnUseTime()">添加</el-button> |
| | | <div v-for="(item, dayIndex) in times" |
| | | :key="dayIndex" |
| | | class="date-picker-item mb-2"> |
| | | <el-date-picker |
| | | type="datetime" |
| | | placeholder="选择日期" |
| | | v-model="item.date"> |
| | | </el-date-picker> |
| | | <button |
| | | type="button" |
| | | class="btn btn-danger btn-sm ml-2" |
| | | v-on:click="removeUnUseTime(dayIndex)"> |
| | | 删除 |
| | | </button> |
| | | </div> |
| | | </el-form-item> |
| | | |
| | | <!-- 适用范围 --> |
| | | <el-form-item label="适用范围" prop="useScope"> |
| | | <el-radio v-model="huiminCard.useScope" label="1">指定门店</el-radio> |
| | | <el-radio v-model="huiminCard.useScope" label="2">指定场地</el-radio> |
| | | </el-form-item> |
| | | |
| | | <!-- 指定门店 --> |
| | | <el-form-item label="指定门店" v-if="huiminCard.useScope === '1'" prop="storeIds"> |
| | | <el-button type="text" v-on:click="handleSelectStore()">选择门店</el-button> |
| | | <el-table |
| | | :data="tableData" |
| | | height="250" |
| | | border> |
| | | <el-table-column |
| | | prop="province" |
| | | label="所在省市"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="operatorName" |
| | | label="所属运营商"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="storeName" |
| | | label="门店名称"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="ids" |
| | | label="闸机ID"> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | v-on:click="handleRemoveStore(scope.$index)" |
| | | icon="el-icon-delete" |
| | | >删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form-item> |
| | | |
| | | <!-- 指定场地 --> |
| | | <el-form-item label="指定场地" v-if="huiminCard.useScope === '2'" prop="siteIds"> |
| | | <el-button type="text" v-on:click="handleSelectStore()">选择场地</el-button> |
| | | <el-table |
| | | :data="tableData" |
| | | height="250" |
| | | border> |
| | | <el-table-column |
| | | prop="province" |
| | | label="所在省市"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="operatorName" |
| | | label="所属运营商"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="storeName" |
| | | label="门店名称"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="ids" |
| | | label="闸机ID"> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | v-on:click="handleRemoveStore(scope.$index)" |
| | | icon="el-icon-delete" |
| | | >删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form-item> |
| | | |
| | | <!-- 惠民卡介绍 --> |
| | | <el-form-item label="惠民卡介绍" prop="introduce"> |
| | | <textarea type="text/plain" v-model="introduces" id="editor_1"></textarea> |
| | | </el-form-item> |
| | | |
| | | <!-- 排序 --> |
| | | <el-form-item label="排序"> |
| | | <el-input v-model="huiminCard.sort"></el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 操作按钮 --> |
| | | <div class="row mt-5"> |
| | | <div class="col-sm-9 offset-sm-3"> |
| | | <button type="button" v-on:click="submitForm('formRef')" class="btn btn-primary px-4">提交保存</button> |
| | | </div> |
| | | </div> |
| | | <!-- 选择门店 --> |
| | | <el-dialog |
| | | title="选择门店" |
| | | :visible.sync="dialogVisible2" |
| | | width="80%" |
| | | :before-close="handleStoreClose"> |
| | | <el-form ref="form" :model="storeForm" label-width="80px"> |
| | | <el-row :gutter="10"> |
| | | <el-col :span="6"> |
| | | <el-form-item label="所在省"> |
| | | <el-select v-model="storeForm.provinceCode" size="mini" filterable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in provinces" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="所在市2"> |
| | | <el-select v-model="storeForm.cityCode" size="mini" filterable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in cities" |
| | | :key="item.citycode" |
| | | :label="item.name" |
| | | :value="item.citycode"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="所属运营商"> |
| | | <el-input size="mini" v-model="storeForm.operatorId" placeholder="请输入内容"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="门店名称"> |
| | | <el-input size="mini" v-model="storeForm.storeName" placeholder="请输入内容"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-button v-on:click="storeList" style="background-color:#1ab394;color: #ffffff" size="mini" icon="el-icon-search"> |
| | | 搜索 |
| | | </el-button> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-table |
| | | v-loading="tableStoreLoading" |
| | | :data="tableStoreData" |
| | | height="250" |
| | | v-on:selection-change="handleSelectionChange" |
| | | border> |
| | | <el-table-column |
| | | type="selection" |
| | | width="55"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="province" |
| | | label="所在省市"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="operatorName" |
| | | label="所属运营商"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="storeName" |
| | | label="门店名称"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="ids" |
| | | label="闸机ID"> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-pagination |
| | | background |
| | | layout="prev, pager, next" |
| | | v-on:pagination="storeList" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | :total="tableStoreTotal"> |
| | | </el-pagination> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button v-on:click="dialogVisible2 = false">取 消</el-button> |
| | | <el-button type="primary" v-on:click="handleStore">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <!-- 选择场地 --> |
| | | <el-dialog |
| | | title="选择场地" |
| | | :visible.sync="dialogVisible3" |
| | | width="80%" |
| | | :before-close="handleSiteClose"> |
| | | |
| | | <el-table |
| | | v-loading="tableSiteLoading" |
| | | :data="tableSiteData" |
| | | height="250" |
| | | v-on:selection-change="handleSelectionChange" |
| | | border> |
| | | <el-table-column |
| | | type="selection" |
| | | width="55"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="province" |
| | | label="所在省市"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="operatorName" |
| | | label="所属运营商"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="storeName" |
| | | label="门店名称"> |
| | | |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="siteName" |
| | | label="场地名称"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="ids" |
| | | label="闸机ID2"> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="tableSiteTotal>0" |
| | | :total="tableSiteTotal" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | v-on:pagination="siteList"></pagination> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button v-on:click="dialogVisible3 = false">取 消</el-button> |
| | | <el-button type="primary" v-on:click="handleSite">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </el-form> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tHuiminCard/tHuiminCard_info.js"></script> |
| | | <style> |
| | | .form-container { |
| | | background: #ffffff; |
| | | border-radius: 12px; |
| | | box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); |
| | | padding: 2rem; |
| | | } |
| | | |
| | | .upload-area { |
| | | border: 2px dashed #dee2e6; |
| | | border-radius: 8px; |
| | | padding: 1.5rem; |
| | | transition: all 0.3s; |
| | | cursor: pointer; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | min-height: 200px; /* 设置一个最小高度,确保有足够的空间 */ |
| | | position: relative; /* 为图片定位提供基准 */ |
| | | overflow: hidden; /* 防止图片溢出 */ |
| | | } |
| | | |
| | | .upload-area:hover { |
| | | border-color: #4a90e2; |
| | | background: #f8f9fa; |
| | | } |
| | | |
| | | .upload-area i { |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | input[type=file] { |
| | | display: none; |
| | | } |
| | | |
| | | |
| | | </style> |
| | | |
| | | <script src="${ctxPath}/modular/system/tHuiminCard/tHuiminCard_info.js"></script> |
| | | <script src="${ctxPath}/js/vue/vue.js"></script> |
| | | <script src="${ctxPath}/js/elementui/index.js"></script> |
| | | <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> |
| | | <script> |
| | | let vue = new Vue({ |
| | | el: '#app0', |
| | | props: { |
| | | // 数量限制 |
| | | limit: { |
| | | type: Number, |
| | | default: 2 |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | storeForm: { |
| | | provinceCode: null, |
| | | cityCode: null, |
| | | operatorId: null, |
| | | storeName: '', |
| | | }, |
| | | |
| | | provinces: [], |
| | | cities: [], |
| | | stores: [], |
| | | operations: [], |
| | | autoUpload: true,//自动上传 |
| | | previewImg: '',//模型数据,用于上传图片完成后图片预览 |
| | | dialogVisible: false, |
| | | dialogVisible2: false, |
| | | dialogVisible3: false, |
| | | times: [{}], |
| | | banners: [], |
| | | introduces: null, |
| | | multipleSelection1: [], |
| | | multipleSelection2: [], |
| | | huiminCard: { |
| | | id: null, |
| | | huiMinName: null, |
| | | huiMinType: null, |
| | | salesMoney: null, |
| | | buyCover: null, |
| | | unBuyCover: null, |
| | | buyRemark: null, |
| | | unBuyRemark: null, |
| | | grantCount: null, |
| | | limitCount: null, |
| | | banner: null, |
| | | endTime: null, |
| | | useWeeks: null, |
| | | useTimes: null, |
| | | introduce: null, |
| | | weeks: [ |
| | | { |
| | | days: [ // 每个星期组的星期选项 |
| | | { |
| | | value: '1', |
| | | label: '星期一', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '2', |
| | | label: '星期二', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '3', |
| | | label: '星期三', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '4', |
| | | label: '星期四', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '5', |
| | | label: '星期五', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '6', |
| | | label: '星期六', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '7', |
| | | label: '星期日', |
| | | checked: false, |
| | | } |
| | | ], |
| | | }, |
| | | ], |
| | | unUseTimes: [ |
| | | {date: null} |
| | | ], |
| | | useScope: '1', |
| | | useIds: null, |
| | | sort: null, |
| | | storeId: null |
| | | }, |
| | | tableData: [], |
| | | tableStoreData: [], |
| | | tableStoreTotal: 0, |
| | | tableStoreLoading: false, |
| | | tableSiteData: [], |
| | | tableSiteTotal: 0, |
| | | tableSiteLoading: false, |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | }, |
| | | |
| | | rules: { |
| | | buyRemark: [{required: true, message: '请输入使用说明', trigger: 'blur'}], |
| | | cover: [{ |
| | | validator: (rule, value, callback) => { |
| | | if (!this.huiminCard.unBuyCover) { |
| | | callback(new Error('请上传未购买封面')); |
| | | } |
| | | if (!this.huiminCard.buyCover) { |
| | | callback(new Error('请上传已购买封面')); |
| | | } |
| | | callback(); |
| | | }, |
| | | trigger: 'blur' |
| | | }], |
| | | buyCover: [{required: true, message: '已购买封面不能为空', trigger: 'blur'}], |
| | | huiMinName: [{required: true, message: '请输入惠民卡名称', trigger: 'blur'}], |
| | | huiMinType: [{required: true, message: '请选择惠民卡类型', trigger: 'change'}], |
| | | salesMoney: [{required: true, message: '请输入售卖金额', trigger: 'blur'}], |
| | | unBuyRemark: [{required: true, message: '请输入使用说明', trigger: 'blur'}], |
| | | banner: [{required: true, message: '请上传轮播图', trigger: 'blur'}], |
| | | limitCount: [{required: true, message: '请输入限购数量', trigger: 'blur'}], |
| | | weeks: [ |
| | | { |
| | | required: true, |
| | | message: '请填写可用时间', |
| | | trigger: 'blur', |
| | | validator: (rule, value, callback) => { |
| | | const everyFalse = this.huiminCard.weeks.every(week => |
| | | week.days.every(day => |
| | | day.checked === false |
| | | ) |
| | | ); |
| | | if (everyFalse) { |
| | | callback(new Error('请选择可用星期')); |
| | | } |
| | | const everyNull = this.huiminCard.weeks.every(obj => |
| | | obj.startTime === null || |
| | | obj.endTime === null |
| | | ); |
| | | if (everyNull) { |
| | | callback(new Error('请选择可用时间')); |
| | | } |
| | | callback(); |
| | | }, |
| | | } |
| | | ], |
| | | storeIds: [ |
| | | { |
| | | required: true, |
| | | trigger: 'blur', |
| | | validator: (rule, value, callback) => { |
| | | if (this.huiminCard.useIds === null || this.huiminCard.useIds.length === 0) { |
| | | callback(new Error('请选择指定门店')); |
| | | } |
| | | callback(); |
| | | }, |
| | | } |
| | | ], |
| | | siteIds: [ |
| | | { |
| | | required: true, |
| | | trigger: 'blur', |
| | | validator: (rule, value, callback) => { |
| | | if (this.huiminCard.useIds === null || this.huiminCard.useIds.length === 0) { |
| | | callback(new Error('请选择指定场地')); |
| | | } |
| | | callback(); |
| | | }, |
| | | } |
| | | ], |
| | | introduce: [ |
| | | { |
| | | required: true, validator: (rule, value, callback) => { |
| | | let content = UE.getEditor('editor_1').getContent(); |
| | | console.log(content) |
| | | if (content.length === 0) { |
| | | callback(new Error('请输入详细介绍')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | } |
| | | } |
| | | ], |
| | | }, |
| | | } |
| | | }, |
| | | methods: { |
| | | handleUnBuyCoverSuccess(res, file) { |
| | | this.huiminCard.unBuyCover = res; |
| | | }, |
| | | handleUnBuyCoverExceed() { |
| | | Feng.error('最多上传一张图片'); |
| | | }, |
| | | handleUnBuyCoverRemove(file, fileList) { |
| | | this.huiminCard.unBuyCover = ''; |
| | | }, |
| | | handleBuyCoverSuccess(res, file) { |
| | | this.huiminCard.buyCover = res; |
| | | }, |
| | | handleBuyCoverRemove(file, fileList) { |
| | | this.huiminCard.buyCover = ''; |
| | | }, |
| | | handleSuccess(res, file) { |
| | | this.banners.push(res) |
| | | this.huiminCard.banner = this.banners.join(','); |
| | | }, |
| | | |
| | | beforeUpload(file) { |
| | | console.log(111111) |
| | | const isLt2M = file.size / 1024 / 1024 < 10; |
| | | if (!isLt2M) { |
| | | Feng.error('上传图片大小不能超过 10MB!'); |
| | | } |
| | | return isLt2M; |
| | | }, |
| | | handleRemove(file, fileList) { |
| | | const fileUrl = file.response; |
| | | this.banners.forEach((item, index) => { |
| | | if (item === fileUrl) { |
| | | this.banners.splice(index, 1); |
| | | } |
| | | }); |
| | | this.huiminCard.banner = this.banners.join(','); |
| | | }, |
| | | addWeek() { |
| | | // 新增一个包含默认星期的组 |
| | | this.huiminCard.weeks.push({ |
| | | days: [ |
| | | { |
| | | value: '1', |
| | | label: '星期一', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '2', |
| | | label: '星期二', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '3', |
| | | label: '星期三', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '4', |
| | | label: '星期四', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '5', |
| | | label: '星期五', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '6', |
| | | label: '星期六', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '7', |
| | | label: '星期日', |
| | | checked: false, |
| | | } |
| | | ], |
| | | }); |
| | | }, |
| | | removeWeek(index) { |
| | | this.huiminCard.weeks.splice(index, 1); |
| | | console.log(this.weeks) |
| | | }, |
| | | addUnUseTime() { |
| | | this.times.push({date: null}); |
| | | }, |
| | | removeUnUseTime(index) { |
| | | this.times.splice(index, 1); |
| | | }, |
| | | storeList() { |
| | | this.tableStoreLoading = true; |
| | | let vm = this; |
| | | let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/storeList", |
| | | (data) => { |
| | | vm.tableStoreData = data.records; // 使用 vm 替代 this |
| | | vm.tableStoreTotal = data.total; |
| | | vm.tableStoreLoading = false; |
| | | console.log('成功获取数据:', vm.tableStoreData); // 验证数据 |
| | | }, |
| | | (data) => { |
| | | vm.tableStoreLoading = false; |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | this.storeForm.pageNum = vm.queryParams.pageNum; |
| | | this.storeForm.pageSize = vm.queryParams.pageSize |
| | | ajax.set(this.storeForm); |
| | | |
| | | ajax.start(); |
| | | }, |
| | | siteList() { |
| | | this.tableSiteLoading = true; |
| | | let vm = this; |
| | | let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/siteList", |
| | | (data) => { |
| | | vm.tableSiteData = data.records; // 使用 vm 替代 this |
| | | vm.tableSiteTotal = data.total; |
| | | vm.tableSiteLoading = false; |
| | | console.log('成功获取数据:', vm.tableSiteData); // 验证数据 |
| | | }, |
| | | (data) => { |
| | | vm.tableSiteLoading = false; |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | ajax.start(); |
| | | }, |
| | | handleStoreClose() { |
| | | this.dialogVisible2 = false; |
| | | }, |
| | | handleSiteClose() { |
| | | this.$confirm('确认关闭?1') |
| | | .then(_ => { |
| | | this.dialogVisible3 = false; |
| | | }) |
| | | .catch(_ => { |
| | | }); |
| | | }, |
| | | handleSelectionChange(val) { |
| | | if (this.huiminCard.useScope === '1') { |
| | | this.multipleSelection1 = val; |
| | | } else if (this.huiminCard.useScope === '2') { |
| | | this.multipleSelection2 = val; |
| | | } |
| | | |
| | | }, |
| | | handleRemoveStore(index) { |
| | | this.tableData.splice(index, 1); |
| | | }, |
| | | handleSelectStore() { |
| | | this.queryParams.pageNum = 1; |
| | | this.queryParams.pageSize = 10; |
| | | if (this.huiminCard.useScope === '1') { |
| | | this.dialogVisible2 = true; |
| | | this.storeList(); |
| | | } else if (this.huiminCard.useScope === '2') { |
| | | this.dialogVisible3 = true; |
| | | this.siteList(); |
| | | } |
| | | }, |
| | | handleStore() { |
| | | if (this.multipleSelection1.length === 0) { |
| | | Feng.info('请选择数据'); |
| | | return; |
| | | } |
| | | this.dialogVisible2 = false |
| | | this.tableData = this.multipleSelection1; |
| | | this.huiminCard.useIds = this.tableData.map(item => item.storeId).join(','); |
| | | }, |
| | | handleSite() { |
| | | if (this.multipleSelection2.length === 0) { |
| | | Feng.info('请选择数据'); |
| | | return; |
| | | } |
| | | this.dialogVisible3 = false |
| | | this.tableData = this.multipleSelection2; |
| | | this.huiminCard.useIds = this.tableData.map(item => item.siteId).join(','); |
| | | }, |
| | | submitForm(formName) { |
| | | this.$refs[formName].validate(valid => { |
| | | console.log(valid) |
| | | if (valid) { |
| | | let data = this.huiminCard; |
| | | let weeks = data.weeks; |
| | | var formatWeekAndTime1 = formatWeekAndTime(weeks); |
| | | data.useTimes = formatWeekAndTime1.useTimes; |
| | | data.useWeeks = formatWeekAndTime1.useWeeks; |
| | | data.unUseTimes = formatUnUseTimes(this.times); |
| | | data.introduce = UE.getEditor('editor_1').getContent(); |
| | | console.log(data.introduce) |
| | | |
| | | let vm = this; |
| | | let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/add", |
| | | (data) => { |
| | | window.parent.THuiminCard.table.refresh(); |
| | | THuiminCardInfoDlg.close(); |
| | | }, |
| | | (data) => { |
| | | vm.tableStoreLoading = false; |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | ajax.set(data) |
| | | ajax.start(); |
| | | } |
| | | }); |
| | | }, |
| | | }, |
| | | created() { |
| | | let editor_1 = UE.getEditor('editor_1'); |
| | | |
| | | |
| | | let ajax = new $ax(Feng.ctxPath + "/base/region/getProvince", |
| | | (data) => { |
| | | this.provinces = data; |
| | | }, |
| | | (data) => { |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | ajax.start(); |
| | | |
| | | let ajax2 = new $ax(Feng.ctxPath + "/base/region/getCity", |
| | | (data) => { |
| | | this.cities = data; |
| | | }, |
| | | (data) => { |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | ajax2.start(); |
| | | |
| | | }, |
| | | }); |
| | | |
| | | function formatWeekAndTime(data) { |
| | | const weekTimeMap = {}; |
| | | |
| | | data.forEach(item => { |
| | | // 确定时间段(优先使用直接字段) |
| | | const startTime = item.startTime || item.time?.startTime || ''; |
| | | const endTime = item.endTime || item.time?.endTime || ''; |
| | | const timePair = startTime + ";" + endTime; |
| | | |
| | | // 遍历days数组,记录每个选中星期对应的时间段 |
| | | item.days.forEach(day => { |
| | | if (day.checked && day.value) { |
| | | weekTimeMap[day.value] = timePair; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 按星期数字排序并生成最终字符串 |
| | | const sortedWeeks = Object.keys(weekTimeMap).sort((a, b) => a - b); |
| | | const useWeeks = sortedWeeks.join(','); |
| | | const useTimes = sortedWeeks.map(week => weekTimeMap[week]).join(','); |
| | | |
| | | return {useWeeks, useTimes}; |
| | | } |
| | | |
| | | function formatUnUseTimes(nUseTimes) { |
| | | if (!nUseTimes) { |
| | | return ""; |
| | | } |
| | | let dates = []; |
| | | nUseTimes.forEach(item => { |
| | | // 格式化 |
| | | const date = item.date; |
| | | const year = date.getFullYear(); |
| | | const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要+1 |
| | | const day = String(date.getDate()).padStart(2, '0'); |
| | | const hours = String(date.getHours()).padStart(2, '0'); |
| | | const minutes = String(date.getMinutes()).padStart(2, '0'); |
| | | const seconds = String(date.getSeconds()).padStart(2, '0'); |
| | | dates.push(year + '-' + month + '-' + day + '-' + hours + ':' + minutes + ':' + seconds) |
| | | }); |
| | | return dates.join(','); |
| | | } |
| | | |
| | | </script> |
| | | |
| | | |
| | | </body> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <body> |
| | | <div id="app0" class="form-container"> |
| | | <el-form :rules="rules" :disabled="huiminCard.id != null && pageType === 'detail'" label-position="left" ref="formRef" label-width="120px" :model="huiminCard" size="small"> |
| | | <el-form-item label="惠民卡名称" prop="huiMinName"> |
| | | <el-input v-model="huiminCard.huiMinName"></el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 惠民卡类型 --> |
| | | <el-form-item label="惠民卡类型" prop="huiMinType"> |
| | | <el-radio-group v-model="huiminCard.huiMinType"> |
| | | <el-radio :label="1">年度卡</el-radio> |
| | | <el-radio :label="2">年内卡</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | |
| | | <!-- 售卖金额 --> |
| | | <el-form-item label="售卖金额" prop="salesMoney"> |
| | | <el-input placeholder="请输入内容" v-model="huiminCard.salesMoney"> |
| | | <template slot="append">¥</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | |
| | | <!-- 封面图片 --> |
| | | <el-row> |
| | | <el-form-item label="封面图片" prop="cover"> |
| | | <el-col :span="12"> |
| | | <div class="upload-area text-center" style="display: flex"> |
| | | <el-upload |
| | | :limit="1" |
| | | class="avatar-uploader" |
| | | action="/tCouponManage/uploadPic" |
| | | list-type="picture-card" |
| | | :multiple="false" |
| | | accept="." |
| | | :on-success="handleUnBuyCoverSuccess" |
| | | :before-upload="beforeUpload" |
| | | :on-remove="handleUnBuyCoverRemove"> |
| | | <img :src="huiminCard.unBuyCover" class="avatar"> |
| | | </el-upload> |
| | | <span>已购买封面</span> |
| | | </div> |
| | | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <div class="upload-area text-center" style="display: flex"> |
| | | <el-upload |
| | | :limit="1" |
| | | class="avatar-uploader" |
| | | action="/tCouponManage/uploadPic" |
| | | list-type="picture-card" |
| | | :multiple="false" |
| | | accept="." |
| | | :on-success="handleBuyCoverSuccess" |
| | | :before-upload="beforeUpload" |
| | | :on-remove="handleBuyCoverRemove"> |
| | | <img :src="huiminCard.buyCover" class="avatar"> |
| | | <i class="el-icon-plus avatar-uploader-icon"></i> |
| | | </el-upload> |
| | | <span>已购买封面</span> |
| | | </div> |
| | | </el-col> |
| | | </el-form-item> |
| | | </el-row> |
| | | |
| | | |
| | | <!-- 使用说明 --> |
| | | <el-form-item label="使用说明" prop="unBuyRemark"> |
| | | <el-input |
| | | type="textarea" |
| | | :autosize="{ minRows: 2, maxRows: 4}" |
| | | placeholder="请输入少于200字使用说明" |
| | | v-model="huiminCard.unBuyRemark"> |
| | | </el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 使用期限 --> |
| | | <el-form-item label="使用期限" prop="buyRemark"> |
| | | <el-input |
| | | type="textarea" |
| | | :autosize="{ minRows: 2, maxRows: 4}" |
| | | placeholder="请输入少于200字使用说明" |
| | | v-model="huiminCard.buyRemark"> |
| | | </el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 轮播介绍图 --> |
| | | <el-form-item label="轮播介绍图" prop="banner"> |
| | | <div class="upload-area"> |
| | | <div class="d-flex align-items-center justify-content-between"> |
| | | <el-upload |
| | | :limit="5" |
| | | class="avatar-uploader" |
| | | action="/tCouponManage/uploadPic" |
| | | list-type="picture-card" |
| | | :file-list="banners" |
| | | accept="." |
| | | :on-success="handleSuccess" |
| | | :before-upload="beforeUpload" |
| | | :on-remove="handleRemove"> |
| | | <i class="el-icon-plus avatar-uploader-icon"></i> |
| | | </el-upload> |
| | | <span>点击上传,最多5张</span> |
| | | </div> |
| | | </div> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 发放数量 --> |
| | | <el-form-item label="发放数量"> |
| | | <el-input v-model="huiminCard.grantCount"></el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 限购数量 --> |
| | | <el-form-item label="限购数量"> |
| | | <el-input v-model="huiminCard.limitCount"></el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 有效期 --> |
| | | <el-form-item label="有效期"> |
| | | <el-date-picker |
| | | v-model="huiminCard.endTime" |
| | | type="date" |
| | | placeholder="选择日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 可用时间 --> |
| | | <el-form-item label="可用时间" prop="weeks"> |
| | | <el-button type="text" v-on:click="addWeek()">添加</el-button> |
| | | <el-card |
| | | shadow="never" |
| | | v-for="(weekGroup, groupIndex) in weeks" |
| | | :key="'weekGroup_' + groupIndex"> |
| | | <div slot="header" |
| | | style="display: flex; |
| | | align-items: center; |
| | | height: 18px; |
| | | padding: 0 16px;"> |
| | | <el-button type="text" v-on:click="addWeek()">添加</el-button> |
| | | </div> |
| | | |
| | | <div class="form-group" style="display: flex; justify-content: space-between;"> |
| | | <div |
| | | class="col-md-1" |
| | | style="flex: 1 0 calc(100% / 7);" |
| | | v-for="(day, dayIndex) in weekGroup.days" |
| | | :key="dayIndex"> |
| | | <input |
| | | class="form-check-input" |
| | | type="checkbox" |
| | | :name="'week_'+''+groupIndex" |
| | | :value="day.value" |
| | | v-model="day.checked"> |
| | | <label class="form-check-label"> |
| | | {{ day.label }} |
| | | </label> |
| | | </div> |
| | | </div> |
| | | <!-- 时间输入和删除按钮 --> |
| | | <div class="row g-3"> |
| | | <div class="col-md-6" style="display: flex"> |
| | | <el-time-select |
| | | placeholder="起始时间" |
| | | v-model="weekGroup.startTime" |
| | | :picker-options="{ |
| | | start: '00:00', |
| | | step: '01:00', |
| | | end: '23:00'}" |
| | | > |
| | | </el-time-select> |
| | | <el-time-select |
| | | placeholder="结束时间" |
| | | v-model="weekGroup.endTime" |
| | | :picker-options="{ |
| | | start: '00:00', |
| | | step: '01:00', |
| | | end: '23:00', |
| | | minTime: weekGroup.startTime}"> |
| | | </el-time-select> |
| | | </div> |
| | | <div class="col-md-6"> |
| | | <button |
| | | type="button" |
| | | class="btn btn-danger" |
| | | style="float: right" |
| | | v-on:click="removeWeek(groupIndex)" |
| | | > |
| | | <i class="fa fa-trash"></i> 删除 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </el-form-item> |
| | | |
| | | <!-- 不可用时间 --> |
| | | <el-form-item label="不可用时间" prop="unUseTimes"> |
| | | <el-button type="text" v-on:click="addUnUseTime()">添加</el-button> |
| | | <div v-for="(item, dayIndex) in times" |
| | | :key="dayIndex" |
| | | class="date-picker-item mb-2"> |
| | | <el-date-picker |
| | | type="datetime" |
| | | placeholder="选择日期" |
| | | v-model="item.date"> |
| | | </el-date-picker> |
| | | <button |
| | | type="button" |
| | | class="btn btn-danger btn-sm ml-2" |
| | | v-on:click="removeUnUseTime(dayIndex)"> |
| | | 删除 |
| | | </button> |
| | | </div> |
| | | </el-form-item> |
| | | |
| | | <!-- 适用范围 --> |
| | | <el-form-item label="适用范围" prop="useScope"> |
| | | <el-radio v-model="huiminCard.useScope" label="1">指定门店</el-radio> |
| | | <el-radio v-model="huiminCard.useScope" label="2">指定场地</el-radio> |
| | | </el-form-item> |
| | | |
| | | <!-- 指定门店 --> |
| | | <el-form-item label="指定门店" v-if="huiminCard.useScope === '1'" prop="storeIds"> |
| | | <el-button type="text" v-on:click="handleSelectStore()">选择门店</el-button> |
| | | <el-table |
| | | :data="tableData" |
| | | height="250" |
| | | border> |
| | | <el-table-column |
| | | prop="province" |
| | | label="所在省市"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="operatorName" |
| | | label="所属运营商"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="storeName" |
| | | label="门店名称"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="ids" |
| | | label="闸机ID"> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | v-on:click="handleRemoveStore(scope.$index)" |
| | | icon="el-icon-delete" |
| | | >删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form-item> |
| | | |
| | | <!-- 指定场地 --> |
| | | <el-form-item label="指定场地" v-if="huiminCard.useScope === '2'" prop="siteIds"> |
| | | <el-button type="text" v-on:click="handleSelectStore()">选择场地</el-button> |
| | | <el-table |
| | | :data="tableData" |
| | | height="250" |
| | | border> |
| | | <el-table-column |
| | | prop="province" |
| | | label="所在省市"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="operatorName" |
| | | label="所属运营商"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="storeName" |
| | | label="门店名称"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="ids" |
| | | label="闸机ID"> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | v-on:click="handleRemoveStore(scope.$index)" |
| | | icon="el-icon-delete" |
| | | >删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form-item> |
| | | |
| | | <!-- 惠民卡介绍 --> |
| | | <el-form-item label="惠民卡介绍" prop="introduce"> |
| | | <textarea type="text/plain" v-model="introduces" id="editor_1"></textarea> |
| | | </el-form-item> |
| | | |
| | | <!-- 排序 --> |
| | | <el-form-item label="排序"> |
| | | <el-input v-model="huiminCard.sort"></el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 操作按钮 --> |
| | | <div class="row mt-5"> |
| | | <div class="col-sm-9 offset-sm-3"> |
| | | <button v-if="pageType === 'edit'" type="button" v-on:click="submitForm('formRef')" class="btn btn-primary px-4">提交保存</button> |
| | | <button type="button" v-on:click="cancelForm()" class="btn btn-primary px-4">取 消</button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 选择门店 --> |
| | | <el-dialog |
| | | title="选择门店" |
| | | :visible.sync="dialogVisible2" |
| | | width="80%" |
| | | :before-close="handleStoreClose"> |
| | | |
| | | <el-table |
| | | v-loading="tableStoreLoading" |
| | | :data="tableStoreData" |
| | | height="250" |
| | | v-on:selection-change="handleSelectionChange" |
| | | border> |
| | | <el-table-column |
| | | type="selection" |
| | | width="55"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="province" |
| | | label="所在省市"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="operatorName" |
| | | label="所属运营商"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="storeName" |
| | | label="门店名称"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="ids" |
| | | label="闸机ID"> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-pagination |
| | | background |
| | | layout="prev, pager, next" |
| | | v-on:pagination="storeList" |
| | | :total="tableStoreTotal"> |
| | | </el-pagination> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button v-on:click="dialogVisible2 = false">取 消</el-button> |
| | | <el-button type="primary" v-on:click="handleStore">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <!-- 选择场地 --> |
| | | <el-dialog |
| | | title="选择场地" |
| | | :visible.sync="dialogVisible3" |
| | | width="80%" |
| | | :before-close="handleSiteClose"> |
| | | |
| | | <el-table |
| | | v-loading="tableSiteLoading" |
| | | :data="tableSiteData" |
| | | height="250" |
| | | v-on:selection-change="handleSelectionChange" |
| | | border> |
| | | <el-table-column |
| | | type="selection" |
| | | width="55"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="province" |
| | | label="所在省市"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="operatorName" |
| | | label="所属运营商"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="storeName" |
| | | label="门店名称"> |
| | | |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="siteName" |
| | | label="场地名称"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="ids" |
| | | label="闸机ID2"> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="tableSiteTotal>0" |
| | | :total="tableSiteTotal" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | v-on:pagination="siteList"></pagination> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button v-on:click="dialogVisible3 = false">取 消</el-button> |
| | | <el-button type="primary" v-on:click="handleSite">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <style> |
| | | .form-container { |
| | | background: #ffffff; |
| | | border-radius: 12px; |
| | | box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); |
| | | padding: 2rem; |
| | | } |
| | | |
| | | .upload-area { |
| | | border: 2px dashed #dee2e6; |
| | | border-radius: 8px; |
| | | padding: 1.5rem; |
| | | transition: all 0.3s; |
| | | cursor: pointer; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | min-height: 200px; /* 设置一个最小高度,确保有足够的空间 */ |
| | | position: relative; /* 为图片定位提供基准 */ |
| | | overflow: hidden; /* 防止图片溢出 */ |
| | | } |
| | | |
| | | .upload-area:hover { |
| | | border-color: #4a90e2; |
| | | background: #f8f9fa; |
| | | } |
| | | |
| | | .upload-area i { |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .avatar-uploader .el-upload { |
| | | border: 1px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | |
| | | .avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | width: 178px; |
| | | height: 178px; |
| | | line-height: 178px; |
| | | text-align: center; |
| | | } |
| | | |
| | | .avatar { |
| | | width: 178px; |
| | | height: 178px; |
| | | display: block; |
| | | } |
| | | |
| | | |
| | | </style> |
| | | |
| | | <script src="${ctxPath}/modular/system/tHuiminCard/tHuiminCard_info.js"></script> |
| | | <script src="${ctxPath}/js/vue/vue.js"></script> |
| | | <script src="${ctxPath}/js/elementui/index.js"></script> |
| | | <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> |
| | | <script> |
| | | let vue = new Vue({ |
| | | el: '#app0', |
| | | props: { |
| | | // 数量限制 |
| | | limit: { |
| | | type: Number, |
| | | default: 2 |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | autoUpload: true,//自动上传 |
| | | previewImg: '',//模型数据,用于上传图片完成后图片预览 |
| | | dialogVisible: false, |
| | | dialogVisible2: false, |
| | | dialogVisible3: false, |
| | | pageType: null, |
| | | times: [ |
| | | { |
| | | |
| | | } |
| | | ], |
| | | banners: [], |
| | | introduces: null, |
| | | multipleSelection1: [], |
| | | multipleSelection2: [], |
| | | weeks: [ |
| | | { |
| | | days: [ // 每个星期组的星期选项 |
| | | { |
| | | value: '1', |
| | | label: '星期一', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '2', |
| | | label: '星期二', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '3', |
| | | label: '星期三', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '4', |
| | | label: '星期四', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '5', |
| | | label: '星期五', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '6', |
| | | label: '星期六', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '7', |
| | | label: '星期日', |
| | | checked: false, |
| | | } |
| | | ], |
| | | }, |
| | | ], |
| | | huiminCard: { |
| | | id: null, |
| | | huiMinName: null, |
| | | huiMinType: null, |
| | | salesMoney: null, |
| | | buyCover: null, |
| | | unBuyCover: null, |
| | | buyRemark: null, |
| | | unBuyRemark: null, |
| | | grantCount: null, |
| | | limitCount: null, |
| | | banner: null, |
| | | endTime: null, |
| | | useWeeks: null, |
| | | useTimes: null, |
| | | introduce: null, |
| | | unUseTimes: [ |
| | | {date: null} |
| | | ], |
| | | useScope: '1', |
| | | useIds: null, |
| | | sort: null, |
| | | storeId: null |
| | | }, |
| | | tableData: [], |
| | | tableStoreData: [], |
| | | tableStoreTotal: 0, |
| | | tableStoreLoading: false, |
| | | tableSiteData: [], |
| | | tableSiteTotal: 0, |
| | | tableSiteLoading: false, |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | }, |
| | | |
| | | rules: { |
| | | buyRemark: [{required: true, message: '请输入使用说明', trigger: 'blur'}], |
| | | cover: [{ |
| | | validator: (rule, value, callback) => { |
| | | if (!this.huiminCard.unBuyCover) { |
| | | callback(new Error('请上传未购买封面')); |
| | | } |
| | | if (!this.huiminCard.buyCover) { |
| | | callback(new Error('请上传已购买封面')); |
| | | } |
| | | callback(); |
| | | }, |
| | | trigger: 'blur' |
| | | }], |
| | | buyCover: [{required: true, message: '已购买封面不能为空', trigger: 'blur'}], |
| | | huiMinName: [{required: true, message: '请输入惠民卡名称', trigger: 'blur'}], |
| | | huiMinType: [{required: true, message: '请选择惠民卡类型', trigger: 'change'}], |
| | | salesMoney: [{required: true, message: '请输入售卖金额', trigger: 'blur'}], |
| | | unBuyRemark: [{required: true, message: '请输入使用说明', trigger: 'blur'}], |
| | | banner: [{required: true, message: '请上传轮播图', trigger: 'blur'}], |
| | | limitCount: [{required: true, message: '请输入限购数量', trigger: 'blur'}], |
| | | weeks: [ |
| | | { |
| | | required: true, |
| | | message: '请填写可用时间', |
| | | trigger: 'blur', |
| | | validator: (rule, value, callback) => { |
| | | const everyFalse = this.weeks.every(week => |
| | | week.days.every(day => |
| | | day.checked === false |
| | | ) |
| | | ); |
| | | if (everyFalse) { |
| | | callback(new Error('请选择可用星期')); |
| | | } |
| | | const everyNull = this.weeks.every(obj => |
| | | obj.startTime === null || |
| | | obj.endTime === null |
| | | ); |
| | | if (everyNull) { |
| | | callback(new Error('请选择可用时间')); |
| | | } |
| | | callback(); |
| | | }, |
| | | } |
| | | ], |
| | | unUseTimes: [{ |
| | | required: true, |
| | | message: '请选择可用时间', |
| | | trigger: 'blur', |
| | | validator: (rule, value, callback) => { |
| | | const everyNull = this.times.every(obj => |
| | | obj.date === null |
| | | ); |
| | | if (everyNull) { |
| | | callback(new Error('请选择可用时间')); |
| | | } |
| | | callback(); |
| | | }, |
| | | }], |
| | | storeIds: [ |
| | | { |
| | | required: true, |
| | | trigger: 'blur', |
| | | validator: (rule, value, callback) => { |
| | | if (this.huiminCard.useIds === null || this.huiminCard.useIds.length === 0) { |
| | | callback(new Error('请选择指定门店')); |
| | | } |
| | | callback(); |
| | | }, |
| | | } |
| | | ], |
| | | siteIds: [ |
| | | { |
| | | required: true, |
| | | trigger: 'blur', |
| | | validator: (rule, value, callback) => { |
| | | if (this.huiminCard.useIds === null || this.huiminCard.useIds.length === 0) { |
| | | callback(new Error('请选择指定场地')); |
| | | } |
| | | callback(); |
| | | }, |
| | | } |
| | | ], |
| | | introduce: [ |
| | | { |
| | | required: true, validator: (rule, value, callback) => { |
| | | let content = UE.getEditor('editor_1').getContent(); |
| | | console.log(content) |
| | | if (content.length === 0) { |
| | | callback(new Error('请输入详细介绍')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | } |
| | | } |
| | | ], |
| | | }, |
| | | } |
| | | }, |
| | | methods: { |
| | | handleUnBuyCoverSuccess(res, file) { |
| | | this.huiminCard.unBuyCover = res; |
| | | }, |
| | | handleUnBuyCoverRemove(file, fileList) { |
| | | this.huiminCard.unBuyCover = ''; |
| | | }, |
| | | handleBuyCoverSuccess(res, file) { |
| | | this.huiminCard.buyCover = res; |
| | | }, |
| | | handleBuyCoverRemove(file, fileList) { |
| | | this.huiminCard.buyCover = ''; |
| | | }, |
| | | handleSuccess(res, file) { |
| | | let banner = this.huiminCard.banner; |
| | | |
| | | if (banner === null) { |
| | | this.huiminCard.banner = res; |
| | | } else { |
| | | let banners = banner.split(','); |
| | | |
| | | banners.push({ |
| | | url: res, |
| | | }); |
| | | this.huiminCard.banner = this.banners.map(item => { |
| | | return item.url; |
| | | }).join(','); |
| | | } |
| | | }, |
| | | |
| | | beforeUpload(file) { |
| | | const isLt2M = file.size / 1024 / 1024 < 10; |
| | | if (!isLt2M) { |
| | | Feng.error('上传图片大小不能超过 10MB!'); |
| | | } |
| | | return isLt2M; |
| | | }, |
| | | handleRemove(file, fileList) { |
| | | const fileUrl = file.response; |
| | | // 1.删除 this.banners中的图片地址 |
| | | this.banners = this.banners.filter(item => { |
| | | return item.url !== fileUrl; |
| | | }); |
| | | //2.重新给this.huiminCard.banner 赋值 |
| | | thi.huiminCard.banner = this.banners.map(item => { |
| | | return item.url; |
| | | }).join(','); |
| | | }, |
| | | addWeek() { |
| | | // 新增一个包含默认星期的组 |
| | | console.log(this.huiminCard) |
| | | this.weeks.push({ |
| | | days: [ |
| | | { |
| | | value: '1', |
| | | label: '星期一', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '2', |
| | | label: '星期二', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '3', |
| | | label: '星期三', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '4', |
| | | label: '星期四', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '5', |
| | | label: '星期五', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '6', |
| | | label: '星期六', |
| | | checked: false, |
| | | }, |
| | | { |
| | | value: '7', |
| | | label: '星期日', |
| | | checked: false, |
| | | } |
| | | ], |
| | | }); |
| | | }, |
| | | removeWeek(index) { |
| | | this.weeks.splice(index, 1); |
| | | }, |
| | | addUnUseTime() { |
| | | this.times.push({date: null}); |
| | | }, |
| | | removeUnUseTime(index) { |
| | | this.times.splice(index, 1); |
| | | }, |
| | | storeList() { |
| | | this.tableStoreLoading = true; |
| | | let vm = this; |
| | | let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/storeList", |
| | | (data) => { |
| | | vm.tableStoreData = data.records; // 使用 vm 替代 this |
| | | vm.tableStoreTotal = data.total; |
| | | vm.tableStoreLoading = false; |
| | | console.log('成功获取数据:', vm.tableStoreData); // 验证数据 |
| | | }, |
| | | (data) => { |
| | | vm.tableStoreLoading = false; |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | ajax.start(); |
| | | }, |
| | | siteList() { |
| | | this.tableSiteLoading = true; |
| | | let vm = this; |
| | | let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/siteList", |
| | | (data) => { |
| | | vm.tableSiteData = data.records; // 使用 vm 替代 this |
| | | vm.tableSiteTotal = data.total; |
| | | vm.tableSiteLoading = false; |
| | | console.log('成功获取数据:', vm.tableSiteData); // 验证数据 |
| | | }, |
| | | (data) => { |
| | | vm.tableSiteLoading = false; |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | ajax.start(); |
| | | }, |
| | | handleStoreClose() { |
| | | this.dialogVisible2 = false; |
| | | }, |
| | | handleSiteClose() { |
| | | this.$confirm('确认关闭?1') |
| | | .then(_ => { |
| | | this.dialogVisible3 = false; |
| | | }) |
| | | .catch(_ => { |
| | | }); |
| | | }, |
| | | handleSelectionChange(val) { |
| | | if (this.huiminCard.useScope === '1') { |
| | | this.multipleSelection1 = val; |
| | | } else if (this.huiminCard.useScope === '2') { |
| | | this.multipleSelection2 = val; |
| | | } |
| | | |
| | | }, |
| | | handleRemoveStore(index) { |
| | | this.tableData.splice(index, 1); |
| | | }, |
| | | handleSelectStore() { |
| | | if (this.huiminCard.useScope === '1') { |
| | | this.dialogVisible2 = true; |
| | | this.storeList(); |
| | | } else if (this.huiminCard.useScope === '2') { |
| | | this.dialogVisible3 = true; |
| | | this.siteList(); |
| | | } |
| | | }, |
| | | handleStore() { |
| | | if (this.multipleSelection1.length === 0) { |
| | | Feng.info('请选择数据'); |
| | | return; |
| | | } |
| | | this.dialogVisible2 = false |
| | | this.tableData = this.multipleSelection1; |
| | | this.huiminCard.useIds = this.tableData.map(item => item.storeId).join(','); |
| | | }, |
| | | handleSite() { |
| | | if (this.multipleSelection2.length === 0) { |
| | | Feng.info('请选择数据'); |
| | | return; |
| | | } |
| | | this.dialogVisible3 = false |
| | | this.tableData = this.multipleSelection2; |
| | | this.huiminCard.useIds = this.tableData.map(item => item.siteId).join(','); |
| | | }, |
| | | submitForm(formName) { |
| | | this.$refs[formName].validate(valid => { |
| | | if (valid) { |
| | | let data = this.huiminCard; |
| | | let weeks = this.weeks; |
| | | console.log(weeks) |
| | | const formatWeekAndTime1 = formatWeekAndTime(weeks); |
| | | data.useTimes = formatWeekAndTime1.useTimes; |
| | | data.useWeeks = formatWeekAndTime1.useWeeks; |
| | | data.unUseTimes = formatUnUseTimes(this.times); |
| | | data.introduce = UE.getEditor('editor_1').getContent(); |
| | | |
| | | let vm = this; |
| | | let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/update", |
| | | (data) => { |
| | | // 正确调用父页面方法 |
| | | window.parent.parentVue.handleSearch(); |
| | | THuiminCardInfoDlg.close(); |
| | | }, |
| | | (data) => { |
| | | vm.tableStoreLoading = false; |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | ajax.set(data) |
| | | ajax.start(); |
| | | } |
| | | }); |
| | | }, |
| | | cancelForm(){ |
| | | parent.layer.close(window.parent.THuiminCard.layerIndex); |
| | | } |
| | | }, |
| | | created() { |
| | | // 初始化编辑器 |
| | | this.editor = UE.getEditor('editor_1'); |
| | | // 设置内容(需在编辑器就绪后调用) |
| | | this.editor.ready(() => { |
| | | this.editor.setContent(this.huiminCard.introduce); |
| | | }); |
| | | const rawData = JSON.parse(`${tHuiminCard}`); |
| | | |
| | | console.log("rawData",rawData) |
| | | this.weeks = parseWeekAndTime(rawData.useWeeks, rawData.useTimes) |
| | | console.log("rawData.banner",rawData.banner) |
| | | // 将原始数据转换为banner数组 |
| | | this.banners = rawData.banner.split(",").map(item => { |
| | | return { |
| | | url: item |
| | | } |
| | | }); |
| | | |
| | | |
| | | // 将原始数据转换为times数组 |
| | | this.times = rawData.unUseTimes.split(",").map(item => { |
| | | const formattedDate = item.replace(/(\d{4}-\d{2}-\d{2})-(\d{2}:\d{2}:\d{2})/, "$1T$2"); |
| | | return { |
| | | original: item, // 原始字符串 |
| | | date: new Date(formattedDate) // 转换后的 Date 对象 |
| | | }; |
| | | }); |
| | | |
| | | let url |
| | | if (rawData.useScope == '1'){ |
| | | url = Feng.ctxPath + "/tHuiminCard/storeList" |
| | | }else { |
| | | url = Feng.ctxPath + "/tHuiminCard/siteList" |
| | | } |
| | | if (rawData.useIds !== '' && rawData.useIds !== null){ |
| | | let vm = this; |
| | | let ajax = new $ax(Feng.ctxPath + url, |
| | | (data) => { |
| | | vm.tableData = data.records; // 使用 vm 替代 this |
| | | }, |
| | | (data) => { |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | ajax.set("storeIds",rawData.useIds) |
| | | ajax.start(); |
| | | } |
| | | |
| | | |
| | | // 将原始数据转换为tableData数组 |
| | | this.huiminCard = { |
| | | ...rawData, |
| | | huiMinType: Number(rawData.huiMinType), |
| | | startTime: rawData.startTimeStr, |
| | | endTime: rawData.endTimeStr, |
| | | } |
| | | |
| | | const urlParams = new URLSearchParams(window.location.search); |
| | | // 直接获取参数值 |
| | | this.pageType = urlParams.get('pageType'); |
| | | }, |
| | | }); |
| | | |
| | | function formatWeekAndTime(data) { |
| | | const weekTimeMap = {}; |
| | | |
| | | data.forEach(item => { |
| | | // 确定时间段(优先使用直接字段) |
| | | const startTime = item.startTime || item.time?.startTime || ''; |
| | | const endTime = item.endTime || item.time?.endTime || ''; |
| | | const timePair = startTime + ";" + endTime; |
| | | |
| | | // 遍历days数组,记录每个选中星期对应的时间段 |
| | | item.days.forEach(day => { |
| | | if (day.checked && day.value) { |
| | | weekTimeMap[day.value] = timePair; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 按星期数字排序并生成最终字符串 |
| | | const sortedWeeks = Object.keys(weekTimeMap).sort((a, b) => a - b); |
| | | const useWeeks = sortedWeeks.join(','); |
| | | const useTimes = sortedWeeks.map(week => weekTimeMap[week]).join(','); |
| | | |
| | | return {useWeeks, useTimes}; |
| | | } |
| | | |
| | | |
| | | function parseWeekAndTime(useWeeks, useTimes) { |
| | | // 将字符串按逗号分割成数组 |
| | | const weeks = useWeeks.split(',').filter(Boolean); // 去除空值 |
| | | const times = useTimes.split(',').filter(Boolean); |
| | | |
| | | // 确保星期和时间段的数量一致 |
| | | if (weeks.length !== times.length) { |
| | | throw new Error("星期和时间段的数量不匹配"); |
| | | } |
| | | |
| | | // 定义完整的 days 数组模板 |
| | | const fullDays = [ |
| | | { value: '1', label: '星期一', checked: false }, |
| | | { value: '2', label: '星期二', checked: false }, |
| | | { value: '3', label: '星期三', checked: false }, |
| | | { value: '4', label: '星期四', checked: false }, |
| | | { value: '5', label: '星期五', checked: false }, |
| | | { value: '6', label: '星期六', checked: false }, |
| | | { value: '7', label: '星期日', checked: false } |
| | | ]; |
| | | |
| | | // 构造还原的数据结构 |
| | | const result = []; |
| | | |
| | | weeks.forEach((week, index) => { |
| | | const [startTime, endTime] = times[index].split(';'); // 分割时间段 |
| | | |
| | | // 查找是否已有相同时间段的项,如果有则复用 |
| | | let existingItem = result.find(item => |
| | | item.startTime === startTime && item.endTime === endTime |
| | | ); |
| | | |
| | | if (!existingItem) { |
| | | // 如果没有找到,则创建新项 |
| | | existingItem = { |
| | | startTime, |
| | | endTime, |
| | | days: JSON.parse(JSON.stringify(fullDays)) // 深拷贝完整 days 数组 |
| | | }; |
| | | result.push(existingItem); |
| | | } |
| | | |
| | | // 更新当前星期的 checked 状态 |
| | | const dayToUpdate = existingItem.days.find(day => day.value === week); |
| | | if (dayToUpdate) { |
| | | dayToUpdate.checked = true; |
| | | } |
| | | }); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | function formatUnUseTimes(nUseTimes) { |
| | | if (!nUseTimes) { |
| | | return ""; |
| | | } |
| | | let dates = []; |
| | | nUseTimes.forEach(item => { |
| | | // 格式化 |
| | | const date = item.date; |
| | | const year = date.getFullYear(); |
| | | const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要+1 |
| | | const day = String(date.getDate()).padStart(2, '0'); |
| | | const hours = String(date.getHours()).padStart(2, '0'); |
| | | const minutes = String(date.getMinutes()).padStart(2, '0'); |
| | | const seconds = String(date.getSeconds()).padStart(2, '0'); |
| | | dates.push(year + '-' + month + '-' + day + '-' + hours + ':' + minutes + ':' + seconds) |
| | | }); |
| | | return dates.join(','); |
| | | } |
| | | |
| | | |
| | | </script> |
| | | |
| | | |
| | | </body> |
| | | @} |
| | |
| | | |
| | | @if(objectType==1){ |
| | | <div class="form-group" style=" margin-left: 17%;" > |
| | | <label class="col-sm-1 control-label">场地说明:</label> |
| | | <label class="col-sm-1 control-label">场地说明222:</label> |
| | | <div class="col-sm-5"> |
| | | <textarea type="text/plain" id="editor" style="height: 300px;width: 800px;"></textarea> |
| | | </div> |
| | |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加惠民卡', |
| | | area: ['800px', '420px'], //宽高 |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tHuiminCard/tHuiminCard_add' |
| | |
| | | /** |
| | | * 打开查看惠民卡详情 |
| | | */ |
| | | THuiminCard.openTHuiminCardDetail = function () { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | THuiminCard.openTHuiminCardDetail = function (id, pageType) { |
| | | console.log(id) |
| | | let index = layer.open({ |
| | | type: 2, |
| | | title: '惠民卡详情', |
| | | area: ['800px', '420px'], //宽高 |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tHuiminCard/tHuiminCard_update/' + THuiminCard.seItem.id |
| | | content: Feng.ctxPath + '/tHuiminCard/tHuiminCard_detail/' + id+'?pageType='+pageType |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询惠民卡列表 |
| | | */ |
| | | THuiminCard.search = function () { |
| | | var queryData = {}; |
| | | queryData['condition'] = $("#condition").val(); |
| | | THuiminCard.table.refresh({query: queryData}); |
| | | |
| | | }; |
| | | |
| | | $(function () { |
| | | var defaultColunms = THuiminCard.initColumn(); |
| | | var table = new BSTable(THuiminCard.id, "/tHuiminCard/list", defaultColunms); |
| | | table.setPaginationType("client"); |
| | | THuiminCard.table = table.init(); |
| | | }); |
New file |
| | |
| | | window.parentVue = new Vue({ |
| | | el: '#app0', |
| | | data() { |
| | | return { |
| | | query: { |
| | | name: '', |
| | | type: '', |
| | | dateRange: [], |
| | | status: '' |
| | | }, |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | | total: 800, |
| | | ids: [], |
| | | tableData: [ |
| | | ] |
| | | } |
| | | }, |
| | | methods: { |
| | | handleSearch() { |
| | | console.log('搜索条件:', this.query) |
| | | // 修复方案:使用箭头函数 + 字段校验 |
| | | const vm = this; // 保留Vue实例引用 |
| | | let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/list", |
| | | (data) => { // 改用箭头函数 |
| | | console.log('原始数据:', data); |
| | | if(data.rows && Array.isArray(data.rows)){ |
| | | vm.tableData = data.rows; |
| | | vm.total = data.total; |
| | | }else{ |
| | | vm.tableData = []; |
| | | vm.total = 0; |
| | | } |
| | | }, |
| | | (data) => { |
| | | Feng.error("搜索失败: " + (data.responseJSON?.message || '服务器异常')); // 错误提示优化 |
| | | }); |
| | | |
| | | // 添加请求参数 |
| | | ajax.set({ |
| | | pageNum: this.currentPage, |
| | | pageSize: this.pageSize, |
| | | ...this.query |
| | | }); |
| | | ajax.start(); |
| | | }, |
| | | handleAdd() { |
| | | // 添加逻辑 |
| | | THuiminCard.openAddTHuiminCard(); |
| | | }, |
| | | handleEdit(id) { |
| | | if (this.ids.length === 0){ |
| | | Feng.info('请选择要操作的数据') |
| | | return |
| | | } |
| | | if (this.ids.length > 1){ |
| | | Feng.info('请选择一条数据') |
| | | return |
| | | } |
| | | THuiminCard.openTHuiminCardDetail(this.ids[0], 'edit') |
| | | }, |
| | | handleDelete() { |
| | | // 删除逻辑 |
| | | console.log(this.ids) |
| | | if (this.ids.length === 0){ |
| | | Feng.info('请选择要操作的数据') |
| | | return |
| | | } |
| | | const mv = this |
| | | this.ids.forEach(id => { |
| | | |
| | | const ajax = new $ax(Feng.ctxPath + "/tHuiminCard/delete", function (data) { |
| | | Feng.success("操作成功!"); |
| | | mv.handleSearch(); |
| | | }, function (data) { |
| | | Feng.error("操作失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("ids",mv.ids.join(",")); |
| | | ajax.start(); |
| | | }) |
| | | }, |
| | | handleShelves(status) { |
| | | // 上架逻辑 |
| | | console.log(this.ids) |
| | | if (this.ids.length === 0){ |
| | | Feng.info('请选择要操作的数据') |
| | | return |
| | | } |
| | | const mv = this |
| | | this.ids.forEach(id => { |
| | | |
| | | const ajax = new $ax(Feng.ctxPath + "/tHuiminCard/changeState", function (data) { |
| | | Feng.success("操作成功!"); |
| | | mv.handleSearch(); |
| | | }, function (data) { |
| | | Feng.error("操作失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("id",id); |
| | | ajax.set("status",status); |
| | | ajax.start(); |
| | | |
| | | |
| | | }) |
| | | |
| | | }, |
| | | handleUnshelve() { |
| | | // 下架逻辑 |
| | | }, |
| | | handleSizeChange(val) { |
| | | this.pageSize = val |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.currentPage = val |
| | | }, |
| | | handleSelectionChange(selection) { |
| | | // 多选处理 |
| | | console.log(11) |
| | | this.ids = selection.map(item => item.id) |
| | | }, |
| | | handleViewDetail(row) { |
| | | if (this.ids.length === 0 && !row){ |
| | | Feng.info('请选择要操作的数据') |
| | | return |
| | | } |
| | | if (this.ids.length > 1 && !row){ |
| | | Feng.info('请选择一条数据') |
| | | return |
| | | } |
| | | // 查看详情 |
| | | let id; |
| | | if (row){ |
| | | id = row.id |
| | | }else { |
| | | id = this.ids[0] |
| | | } |
| | | THuiminCard.openTHuiminCardDetail(id,'detail') |
| | | } |
| | | }, |
| | | created() { |
| | | // 初始化逻辑 |
| | | this.handleSearch() |
| | | } |
| | | }); |
| | |
| | | tHuiminCardInfoData : {} |
| | | }; |
| | | |
| | | let bannerImages = []; |
| | | |
| | | const maxUploadCount = 5; |
| | | |
| | | /** |
| | | * 清除数据 |
| | | */ |
| | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tHuiminCard/add", function(data){ |
| | | Feng.success("添加成功!"); |
| | | window.parent.THuiminCard.table.refresh(); |
| | | THuiminCardInfoDlg.close(); |
| | | },function(data){ |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | |
| | | ajax.set(this.tHuiminCardInfoData); |
| | | ajax.start(); |
| | | } |
| | | |
| | | $(function() { |
| | | |
| | | }); |
| | |
| | | return cityDataAndProvinceDataVos; |
| | | } |
| | | } |
| | | |
| | | } |