Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0
| | |
| | | //查询协议配置 |
| | | List<THuiminAgreementSetting> tHuiminAgreementSettingList = huiminAgreementSettingService.list(new LambdaQueryWrapper<THuiminAgreementSetting>() |
| | | .eq(THuiminAgreementSetting::getAgreementId, huiminAgreement.getId())); |
| | | huiminAgreement.setTHuiminAgreementSettingList(tHuiminAgreementSettingList); |
| | | huiminAgreement.setSettingList(tHuiminAgreementSettingList); |
| | | } |
| | | return huiminAgreement; |
| | | } |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void insert(@RequestBody THuiminAgreement tHuiminAgreement){ |
| | | Integer operatorId = tHuiminAgreement.getOperatorId(); |
| | | if (tHuiminAgreement.getObjectType().equals(1)) { |
| | | tHuiminAgreement.setOperatorId(null); |
| | | } |
| | | huiminAgreementService.saveOrUpdate(tHuiminAgreement); |
| | | List<THuiminAgreementSetting> tHuiminAgreementSettingList = tHuiminAgreement.getTHuiminAgreementSettingList(); |
| | | if (CollUtil.isNotEmpty(tHuiminAgreementSettingList)) { |
| | | if (tHuiminAgreement.getObjectType().equals(2) || tHuiminAgreement.getObjectType().equals(1) && Objects.isNull(operatorId)) { |
| | | //删除之前的协议配置 |
| | | huiminAgreementSettingService.remove(new LambdaQueryWrapper<THuiminAgreementSetting>().eq(THuiminAgreementSetting::getAgreementId, tHuiminAgreement.getId())); |
| | | //保存协议配置 |
| | | tHuiminAgreementSettingList.forEach(t -> { |
| | | t.setAgreementId(tHuiminAgreement.getId()); |
| | | }); |
| | | huiminAgreementSettingService.saveBatch(tHuiminAgreementSettingList); |
| | | } else { |
| | | THuiminAgreement agreement = huiminAgreementService.lambdaQuery() |
| | | .eq(THuiminAgreement::getOperatorId, operatorId) |
| | | .last("LIMIT 1").one(); |
| | | if (Objects.isNull(agreement)) { |
| | | agreement = new THuiminAgreement(); |
| | | agreement.setOperatorId(operatorId); |
| | | huiminAgreementService.save(agreement); |
| | | } |
| | | //删除之前的协议配置 |
| | | huiminAgreementSettingService.remove(new LambdaQueryWrapper<THuiminAgreementSetting>() |
| | | .eq(THuiminAgreementSetting::getAgreementId, agreement.getId())); |
| | | //保存协议配置 |
| | | THuiminAgreement finalAgreement = agreement; |
| | | tHuiminAgreementSettingList.forEach(t -> { |
| | | t.setAgreementId(finalAgreement.getId()); |
| | | }); |
| | | huiminAgreementSettingService.saveBatch(tHuiminAgreementSettingList); |
| | | //如果是平台账号,需要设置operatorId为null |
| | | List<THuiminAgreementSetting> tHuiminAgreementSettingList = tHuiminAgreement.getSettingList(); |
| | | //如果是运营商账号或平台账号默认配置 |
| | | if (tHuiminAgreement.getObjectType().equals(2) || tHuiminAgreement.getObjectType().equals(1) && Objects.isNull(operatorId)) { |
| | | if (tHuiminAgreement.getObjectType().equals(1)) { |
| | | tHuiminAgreement.setOperatorId(null); |
| | | } |
| | | |
| | | huiminAgreementService.saveOrUpdate(tHuiminAgreement); |
| | | //删除之前的协议配置 |
| | | huiminAgreementSettingService.remove(new LambdaQueryWrapper<THuiminAgreementSetting>().eq(THuiminAgreementSetting::getAgreementId, tHuiminAgreement.getId())); |
| | | //保存协议配置 |
| | | tHuiminAgreementSettingList.forEach(t -> { |
| | | t.setAgreementId(tHuiminAgreement.getId()); |
| | | }); |
| | | } else { |
| | | //平台配置运营商的协议配置 |
| | | THuiminAgreement agreement = huiminAgreementService.lambdaQuery() |
| | | .eq(THuiminAgreement::getOperatorId, operatorId) |
| | | .last("LIMIT 1").one(); |
| | | if (Objects.isNull(agreement)) { |
| | | agreement = new THuiminAgreement(); |
| | | agreement.setOperatorId(operatorId); |
| | | } |
| | | agreement.setStoreNoHuiminCardIntro(tHuiminAgreement.getStoreNoHuiminCardIntro()); |
| | | huiminAgreementService.saveOrUpdate(agreement); |
| | | //删除之前的协议配置 |
| | | huiminAgreementSettingService.remove(new LambdaQueryWrapper<THuiminAgreementSetting>() |
| | | .eq(THuiminAgreementSetting::getAgreementId, agreement.getId())); |
| | | //保存协议配置 |
| | | THuiminAgreement finalAgreement = agreement; |
| | | tHuiminAgreementSettingList.forEach(t -> { |
| | | t.setAgreementId(finalAgreement.getId()); |
| | | }); |
| | | } |
| | | if (CollUtil.isNotEmpty(tHuiminAgreementSettingList)) { |
| | | huiminAgreementSettingService.saveBatch(tHuiminAgreementSettingList); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.dsh.activity.entity.HuiminPayQuery; |
| | | import com.dsh.activity.model.response.SalesDetailVO; |
| | | import com.dsh.activity.service.PayHuiminService; |
| | | import com.dsh.activity.util.ResultUtil; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | * 退款惠民卡 |
| | | * @param id |
| | | */ |
| | | @GetMapping("/base/tPayHuimin/refund/{id}") |
| | | public ResultUtil<?> refund(@PathVariable("id") Integer id){ |
| | | @PostMapping("/base/tPayHuimin/refund") |
| | | public void refund(Integer id){ |
| | | try { |
| | | return payHuiminService.refund(id); |
| | | payHuiminService.refund(id); |
| | | } catch (AlipayApiException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | private PayHuiminService payHuiminService; |
| | | |
| | | |
| | | @GetMapping("/queryPage") |
| | | public Page<THuiminCard> queryPage(Page<THuiminCard> page, THuiminCard tHuiminCard) { |
| | | @PostMapping("/queryPage") |
| | | public Page<THuiminCard> queryPage(@RequestBody THuiminCard tHuiminCard) { |
| | | QueryWrapper<THuiminCard> queryWrapper = new QueryWrapper<>(); |
| | | |
| | | |
| | | Integer objectType = tHuiminCard.getObjectType(); |
| | | Integer objectId = tHuiminCard.getObjectId(); |
| | | if (objectType == 2){ |
| | | queryWrapper.eq("operatorId",objectId); |
| | | } |
| | | if (objectType == 3){ |
| | | queryWrapper.apply("FIND_IN_SET("+objectId+",storeIds)"); |
| | | } |
| | | |
| | | if (!StringUtils.isEmpty(tHuiminCard.getHuiMinName())){ |
| | | queryWrapper.like("huiMinName",tHuiminCard.getHuiMinName()); |
| | | } |
| | |
| | | queryWrapper.ge("startTime",tHuiminCard.getStartTime()); |
| | | queryWrapper.le("endTime",tHuiminCard.getEndTime()); |
| | | } |
| | | Integer flag = tHuiminCard.getFlag(); |
| | | if (flag != null){ |
| | | Integer huiMinStatus = tHuiminCard.getHuiMinStatus(); |
| | | // 惠民卡状态:1未开始 2已开始 3已结束 |
| | | if (huiMinStatus != null){ |
| | | Date now = new Date(); |
| | | switch (flag) { |
| | | switch (huiMinStatus) { |
| | | case 1: |
| | | queryWrapper.le("startTime", now); |
| | | queryWrapper.gt("startTime", now); |
| | | break; |
| | | case 2: |
| | | queryWrapper.ge("startTime", now); |
| | | case 2: |
| | | queryWrapper.apply("(startTime <= now() AND endTime >= now()) OR(startTime IS NULL AND endTime IS NULL)"); |
| | | break; |
| | | case 3: |
| | | queryWrapper.le("endTime", now); |
| | | break; |
| | | case 3: |
| | | queryWrapper.lt("endTime", now); |
| | | break; |
| | | } |
| | | } |
| | |
| | | if (tHuiminCard.getStatus() != null){ |
| | | queryWrapper.eq("status",tHuiminCard.getStatus()); |
| | | } |
| | | Page<THuiminCard> page = new Page<>(); |
| | | page.setCurrent(tHuiminCard.getCurrent()); |
| | | page.setSize(tHuiminCard.getSize()); |
| | | Page<THuiminCard> page1 = tHuiminCardService.page(page, queryWrapper); |
| | | List<THuiminCard> records = page1.getRecords(); |
| | | if (records.isEmpty()){ |
| | | return page1; |
| | | } |
| | | List<Integer> cardIds = records.stream().map(THuiminCard::getId).collect(Collectors.toList()); |
| | | List<TPayHuimin> list = payHuiminService.list(new LambdaQueryWrapper<TPayHuimin>() |
| | | .in(TPayHuimin::getCardId, cardIds)); |
| | |
| | | |
| | | records.forEach(item -> { |
| | | item.setBuyCount(cardIdCountMap.getOrDefault(item.getId(), 0L).intValue()); |
| | | |
| | | // 惠民卡状态计算逻辑 |
| | | Date startTime = item.getStartTime(); |
| | | Date endTime = item.getEndTime(); |
| | | |
| | | Date now = new Date(); |
| | | if (startTime == null || endTime == null) { |
| | | // 时间字段未填写时默认状态为「已开始」 |
| | | item.setHuiMinStatus(2); |
| | | } else { |
| | | if (startTime.after(now)) { |
| | | item.setHuiMinStatus(1); // 未开始 |
| | | } else if (endTime.before(now)) { |
| | | item.setHuiMinStatus(3); // 已结束 |
| | | } else { |
| | | item.setHuiMinStatus(2); // 已开始 |
| | | } |
| | | } |
| | | |
| | | }); |
| | | return page1; |
| | | } |
| | |
| | | |
| | | @PostMapping("/updateById") |
| | | public R<?> updateById(@RequestBody THuiminCard tHuiminCard) { |
| | | String unUseTimes = tHuiminCard.getUnUseTimes(); |
| | | tHuiminCardService.updateById(tHuiminCard); |
| | | return R.ok(""); |
| | | } |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | |
| | | // 时间范围 |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date paymentTimeStart; // 支付时间-开始 |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date paymentTimeEnd; // 支付时间-结束 |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTimeStart; // 结束时间-开始 |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTimeEnd; // 结束时间-结束 |
| | | |
| | | // 状态查询 |
| | |
| | | */ |
| | | @TableField("storeNoHuiminCardIntro") |
| | | @ApiModelProperty("门店无惠民卡介绍页") |
| | | |
| | | private String storeNoHuiminCardIntro; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer objectType; |
| | | |
| | | @TableField(exist = false) |
| | | private List<THuiminAgreementSetting> tHuiminAgreementSettingList; |
| | | private List<THuiminAgreementSetting> settingList; |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | @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") |
| | | @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; |
| | | /** |
| | |
| | | */ |
| | | @TableField("useScope") |
| | | @ApiModelProperty(value = "使用范围1门店2场地") |
| | | |
| | | private Integer useScope; |
| | | /** |
| | | *根据适用范围,存储门店id或场地id,多个逗号分隔 |
| | |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer buyCount; |
| | | @TableField(exist = false) |
| | | private Long current; |
| | | @TableField(exist = false) |
| | | private Long size; |
| | | /** |
| | | * 惠民卡状态:1未开始 2已开始 3已结束 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer huiMinStatus; |
| | | |
| | | /** |
| | | * 1=平台,2=城市管理员,3=门店 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer objectType; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer objectId; |
| | | |
| | | |
| | | @Override |
| | |
| | | package com.dsh.activity.model.response; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | // 关联信息 |
| | | private Integer operatorId; |
| | | private String operatorName; // 所属运营商 |
| | | private Integer storeId; |
| | | private String storeIds; |
| | | private String storeName; // 可用门店 |
| | | private Integer appUserId; // 购买用户ID |
| | | private String userName; // 购买用户 |
| | |
| | | |
| | | // 时间信息 |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date paymentTime; // 购买时间[1,8](@ref) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; // 有效期 |
| | | |
| | | // 使用信息 |
| | |
| | | */ |
| | | @Override |
| | | public List<SalesDetailVO> exportData(HuiminPayQuery query) { |
| | | return baseMapper.exportData(query); |
| | | List<SalesDetailVO> records = baseMapper.exportData(query); |
| | | if (CollUtil.isNotEmpty(records)){ |
| | | List<Integer> appUserIdList = records.stream().map(SalesDetailVO::getAppUserId).collect(Collectors.toList()); |
| | | List<AppUser> appUserList = appUserClient.queryAppUserBatch(appUserIdList); |
| | | Map<Integer, AppUser> appUserMap = appUserList.stream().collect(Collectors.toMap(AppUser::getId, appUser -> appUser)); |
| | | records.forEach(item->{ |
| | | AppUser appUser = appUserMap.get(item.getAppUserId()); |
| | | if (Objects.nonNull(appUser)){ |
| | | item.setUserName(appUser.getName()); |
| | | item.setPhone(appUser.getPhone()); |
| | | } |
| | | List<TStudent> studentList = studentClient.getStudentByIds(item.getStudentId()); |
| | | if (CollUtil.isNotEmpty(studentList)){ |
| | | item.setStudentName(studentList.stream().map(TStudent::getName).collect(Collectors.joining(","))); |
| | | } |
| | | }); |
| | | } |
| | | return records; |
| | | } |
| | | } |
| | |
| | | thc.huiMinType, |
| | | thc.salesMoney, |
| | | thc.operatorId, |
| | | thc.storeId, |
| | | thc.storeIds, |
| | | tph.appUserId, |
| | | tph.paymentTime, |
| | | thc.endTime, |
| | |
| | | LEFT JOIN t_huimin_card thc ON tph.cardId = thc.id |
| | | LEFT JOIN t_huimin_record thr ON tph.appUserId= thr.appUserId AND tph.cardId= thr.huiminCardId |
| | | <where> |
| | | tph.id IS NOT NULL |
| | | <if test="query.huiMinName !=null and query.huiMinName != ''"> |
| | | AND thc.huiMinName LIKE CONCAT('%',#{query.huiMinName},'%') |
| | | </if> |
| | |
| | | </choose> |
| | | </if> |
| | | </where> |
| | | GROUP BY tph.id |
| | | ORDER BY tph.insertTime DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | @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); |
| | | @PostMapping(value = "/tHuiminCard/queryPage") |
| | | Page<THuiminCard> queryPage(@RequestBody THuiminCard tHuiminCard); |
| | | |
| | | @GetMapping(value = "/tHuiminCard/getById") |
| | | THuiminCard getById(@RequestParam("id") Integer id); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.activity.model.HuiminPayQuery; |
| | | import com.dsh.guns.modular.system.model.SalesDetailVO; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | 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; |
| | | |
| | |
| | | * 退款惠民卡 |
| | | * @param id |
| | | */ |
| | | @GetMapping("/base/tPayHuimin/refund/{id}") |
| | | ResultUtil<?> refund(Integer id); |
| | | @PostMapping("/base/tPayHuimin/refund") |
| | | void refund(Integer id); |
| | | |
| | | @PostMapping("/base/tPayHuimin/export-data") |
| | | List<SalesDetailVO> exportData(@RequestBody HuiminPayQuery query); |
| | |
| | | package com.dsh.course.feignClient.activity.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | |
| | | // 时间范围 |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date paymentTimeStart; // 支付时间-开始 |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date paymentTimeEnd; // 支付时间-结束 |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTimeStart; // 结束时间-开始 |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTimeEnd; // 结束时间-结束 |
| | | |
| | | // 状态查询 |
| | |
| | | |
| | | private String agreementSettings; |
| | | |
| | | private List<THuiminAgreementSetting> tHuiminAgreementSettingList; |
| | | private List<THuiminAgreementSetting> settingList; |
| | | private Integer objectType; |
| | | @Override |
| | | protected Serializable pkVal() { |
| | |
| | | * 协议名称 |
| | | */ |
| | | @TableField("agreementName") |
| | | @JSONField(name = "title") |
| | | private String agreementName; |
| | | /** |
| | | *协议内容 |
| | | */ |
| | | @TableField("agreementContent") |
| | | @JSONField(name = "content") |
| | | private String agreementContent; |
| | | |
| | | @Override |
| | |
| | | private String startTimeStr; |
| | | @TableField(exist = false) |
| | | private String endTimeStr; |
| | | @TableField(exist = false) |
| | | private Long current; |
| | | @TableField(exist = false) |
| | | private Long size; |
| | | /** |
| | | * 惠民卡状态:1未开始 2已开始 3已结束 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer huiMinStatus; |
| | | |
| | | /** |
| | | * 1=平台,2=城市管理员,3=门店 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer objectType; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer objectId; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | |
| | | THuiminAgreement huiminAgreement = huiminAgreementClient.selectByObjectType(huiminAgreementQuery); |
| | | model.addAttribute("objectType", objectType); |
| | | model.addAttribute("item", huiminAgreement); |
| | | model.addAttribute("tHuiminAgreementSettingList", Objects.nonNull(huiminAgreement) ? JSONArray.toJSONString(huiminAgreement.getTHuiminAgreementSettingList()) : ""); |
| | | //查询运营商列表 |
| | | model.addAttribute("operatorList", operatorService.list(new QueryWrapper<TOperator>().eq("state", 1))); |
| | | model.addAttribute("operatorId", operatorId); |
| | |
| | | tHuiminAgreement.setObjectType(UserExt.getUser().getObjectType()); |
| | | String agreementSettings = tHuiminAgreement.getAgreementSettings(); |
| | | List<THuiminAgreementSetting> tHuiminAgreementSettings = JSONArray.parseArray(agreementSettings, THuiminAgreementSetting.class); |
| | | tHuiminAgreement.setTHuiminAgreementSettingList(tHuiminAgreementSettings); |
| | | tHuiminAgreement.setSettingList(tHuiminAgreementSettings); |
| | | huiminAgreementClient.insert(tHuiminAgreement); |
| | | return SUCCESS_TIP; |
| | | } |
| | | @RequestMapping(value = "/selectAgreementByOperationId") |
| | | @ResponseBody |
| | | public ResultUtil<String> selectAgreementByOperationId(Integer operatorId) { |
| | | String tHuiminAgreementSettings = ""; |
| | | public ResultUtil<THuiminAgreement> selectAgreementByOperationId(Integer operatorId) { |
| | | HuiminAgreementQuery huiminAgreementQuery = new HuiminAgreementQuery(); |
| | | huiminAgreementQuery.setOperatorId(operatorId); |
| | | huiminAgreementQuery.setObjectType(Objects.isNull(operatorId) ? 1 : 2); |
| | | THuiminAgreement huiminAgreement = huiminAgreementClient.selectByObjectType(huiminAgreementQuery); |
| | | if (Objects.nonNull(huiminAgreement)) { |
| | | //查询协议配置 |
| | | tHuiminAgreementSettings = JSONArray.toJSONString(huiminAgreement.getTHuiminAgreementSettingList()); |
| | | } |
| | | return ResultUtil.success(tHuiminAgreementSettings); |
| | | return ResultUtil.success(huiminAgreement); |
| | | } |
| | | /* |
| | | *//** |
| | |
| | | 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.config.UserExt; |
| | | 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.TOperatorService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | 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; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 惠民卡控制器 |
| | |
| | | * 跳转到添加惠民卡 |
| | | */ |
| | | @RequestMapping("/tHuiminCard_add") |
| | | public String tHuiminCardAdd() { |
| | | |
| | | public String tHuiminCardAdd(Model model) { |
| | | User user = UserExt.getUser(); |
| | | model.addAttribute("objectType", user.getObjectType()); |
| | | return PREFIX + "tHuiminCard_add.html"; |
| | | } |
| | | |
| | |
| | | * 跳转到详情页面 |
| | | */ |
| | | @RequestMapping("/tHuiminCard_detail/{id}") |
| | | public String tHuiminCardDetail(@PathVariable("id") Integer id) { |
| | | public String tHuiminCardDetail(@PathVariable("id") Integer id,Model model) { |
| | | User user = UserExt.getUser(); |
| | | model.addAttribute("objectType", user.getObjectType()); |
| | | return PREFIX + "tHuiminCard_detail.html"; |
| | | } |
| | | |
| | |
| | | */ |
| | | @RequestMapping("/getDetail") |
| | | @ResponseBody |
| | | public THuiminCard getDetail(Integer id) { |
| | | public THuiminCard getDetail(Integer id,Model model) { |
| | | User user = UserExt.getUser(); |
| | | model.addAttribute("objectType", user.getObjectType()); |
| | | return huiminCardClient.getById(id); |
| | | } |
| | | |
| | |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public PageInfoBT<THuiminCard> list(Page<THuiminCard> page,THuiminCard tHuiminCard) { |
| | | return super.packForBT(huiminCardClient.queryPage(page, tHuiminCard)); |
| | | public PageInfoBT<THuiminCard> list(THuiminCard tHuiminCard) { |
| | | User user = UserExt.getUser(); |
| | | if(user == null){ |
| | | return null; |
| | | } |
| | | Integer objectType = user.getObjectType(); |
| | | tHuiminCard.setObjectType(objectType); |
| | | Integer objectId = user.getObjectId(); |
| | | tHuiminCard.setObjectId(objectId); |
| | | return super.packForBT(huiminCardClient.queryPage(tHuiminCard)); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (!StringUtils.isEmpty(storeIds)){ |
| | | ids = storeIds.split(","); |
| | | } |
| | | |
| | | User user = UserExt.getUser(); |
| | | if(user == null){ |
| | | return null; |
| | | } |
| | | Integer objectType = user.getObjectType(); |
| | | if (objectType != 1 && objectType != 2){ |
| | | throw new RuntimeException("权限不足"); |
| | | } |
| | | if (objectType == 2){ |
| | | query.setOperatorId(user.getObjectId()); |
| | | } |
| | | Page<TStore> storePage = storeService.page(page, new LambdaQueryWrapper<TStore>() |
| | | .eq(TStore::getState, 1) |
| | | .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()) |
| | |
| | | TOperator operator = operatorService.getById(tStore.getOperatorId()); |
| | | if (operator != null){ |
| | | huiminCardStoreVO.setOperatorName(operator.getName()); |
| | | huiminCardStoreVO.setOperatorId(tStore.getOperatorId()); |
| | | } |
| | | return huiminCardStoreVO; |
| | | }); |
| | |
| | | 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; |
| | | } |
| | | |
| | | // 收集storeName条件的storeIds(不提前返回null) |
| | | if (!StringUtils.isEmpty(storeName)) { |
| | | List<String> storeIdsByName = storeService.listObjs( |
| | | new LambdaQueryWrapper<TStore>() |
| | | .select(TStore::getId) |
| | | .eq(TStore::getName, storeName), |
| | | String::valueOf); |
| | | storeIds.addAll(storeIdsByName); |
| | | } |
| | | |
| | | // 收集operatorId条件的storeIds(不提前返回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; |
| | | } |
| | | if (operatorId != null) { |
| | | List<String> storeIdsByOperatorId = storeService.listObjs( |
| | | new LambdaQueryWrapper<TStore>() |
| | | .select(TStore::getId) |
| | | .eq(TStore::getOperatorId, operatorId), |
| | | String::valueOf); |
| | | storeIds.addAll(storeIdsByOperatorId); |
| | | } |
| | | |
| | | 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)); |
| | | // 处理用户权限过滤(objectType为2) |
| | | User user = UserExt.getUser(); |
| | | if (user != null && user.getObjectType() == 2) { |
| | | List<String> authorizedStoreIds = storeService.listObjs( |
| | | new LambdaQueryWrapper<TStore>() |
| | | .select(TStore::getId) |
| | | .eq(TStore::getOperatorId, user.getObjectId()), |
| | | String::valueOf); |
| | | if (authorizedStoreIds.isEmpty()) { |
| | | new Page(); |
| | | } |
| | | if (storeIds.isEmpty()){ |
| | | storeIds.addAll(authorizedStoreIds); |
| | | }else { |
| | | storeIds.retainAll(new HashSet<>(authorizedStoreIds)); |
| | | } |
| | | |
| | | }else if (user != null && user.getObjectType() == 3){ |
| | | storeIds = new ArrayList<>(); |
| | | storeIds.add(String.valueOf(user.getObjectId())); |
| | | } |
| | | |
| | | |
| | | |
| | | // 最终查询条件:storeIds为空时会返回空Page |
| | | 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)); |
| | | |
| | | // 批量查询store和operator,避免N+1问题 |
| | | List<TSite> sites = sitePage.getRecords(); |
| | | if (sites.isEmpty()) { |
| | | return sitePage.convert(t -> null); // 返回空Page |
| | | } |
| | | |
| | | // 收集需要的storeId和operatorId |
| | | List<Integer> storeIdsForVO = sites.stream().map(TSite::getStoreId).distinct().collect(Collectors.toList()); |
| | | List<Integer> operatorIdsForVO = sites.stream().map(TSite::getOperatorId).distinct().collect(Collectors.toList()); |
| | | |
| | | // 批量查询并缓存结果 |
| | | Map<Integer, TStore> storeMap = storeService.listByIds(storeIdsForVO) |
| | | .stream() |
| | | .collect(Collectors.toMap(TStore::getId, Function.identity())); |
| | | |
| | | Map<Integer, TOperator> operatorMap = operatorService.listByIds(operatorIdsForVO) |
| | | .stream() |
| | | .collect(Collectors.toMap(TOperator::getId, Function.identity())); |
| | | |
| | | // 转换VO时直接使用缓存结果 |
| | | return sitePage.convert(tSite -> { |
| | | HuiminCardSiteVO huiminCardSiteVO = new HuiminCardSiteVO(); |
| | | huiminCardSiteVO.setSiteId(tSite.getId()); |
| | | huiminCardSiteVO.setProvince(tSite.getProvince()); |
| | | huiminCardSiteVO.setSiteName(tSite.getName()); |
| | | huiminCardSiteVO.setIds(tSite.getIds()); |
| | | HuiminCardSiteVO vo = new HuiminCardSiteVO(); |
| | | vo.setSiteId(tSite.getId()); |
| | | vo.setProvince(tSite.getProvince()); |
| | | vo.setSiteName(tSite.getName()); |
| | | vo.setIds(tSite.getIds()); |
| | | |
| | | TStore store = storeService.getById(tSite.getStoreId()); |
| | | if (store != null){ |
| | | huiminCardSiteVO.setStoreName(store.getName()); |
| | | TStore store = storeMap.get(tSite.getStoreId()); |
| | | if (store != null) { |
| | | vo.setStoreName(store.getName()); |
| | | } |
| | | |
| | | TOperator operator = operatorService.getById(tSite.getOperatorId()); |
| | | if (operator != null){ |
| | | huiminCardSiteVO.setOperatorName(operator.getName()); |
| | | TOperator operator = operatorMap.get(tSite.getOperatorId()); |
| | | if (operator != null) { |
| | | vo.setOperatorName(operator.getName()); |
| | | } |
| | | return huiminCardSiteVO; |
| | | |
| | | return vo; |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(THuiminCard tHuiminCard) { |
| | | int a = 0; |
| | | String useIds = tHuiminCard.getUseIds(); |
| | | String[] useIdArr = useIds.split(","); |
| | | if (tHuiminCard.getUseScope()==1){ |
| | | tHuiminCard.setStoreIds(tHuiminCard.getUseIds()); |
| | | tHuiminCard.setStoreIds(useIds); |
| | | String useId = useIdArr[0]; |
| | | TStore store = storeService.getById(useId); |
| | | tHuiminCard.setOperatorId(store.getOperatorId()); |
| | | }else{ |
| | | StringBuilder storeIds = new StringBuilder(); |
| | | for (String s : tHuiminCard.getUseIds().split(",")) { |
| | | for (String s : useIdArr) { |
| | | TSite site = tSiteService.getById(s); |
| | | if (site!=null){ |
| | | storeIds.append(site.getStoreId()).append(","); |
| | |
| | | } |
| | | StringBuilder stringBuilder = storeIds.deleteCharAt(storeIds.length() - 1); |
| | | tHuiminCard.setStoreIds(stringBuilder.toString()); |
| | | |
| | | String useId = useIdArr[0]; |
| | | TSite site = tSiteService.getById(useId); |
| | | tHuiminCard.setOperatorId(site.getOperatorId()); |
| | | } |
| | | |
| | | huiminCardClient.save(tHuiminCard); |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | import com.dsh.course.feignClient.activity.PayHuiminClient; |
| | | import com.dsh.course.feignClient.activity.model.HuiminPayQuery; |
| | | import com.dsh.course.feignClient.activity.model.TPayHuimin; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.core.common.constant.factory.PageFactory; |
| | | import com.dsh.guns.modular.system.model.AppUserByNameAndPhoneDTO; |
| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.math.BigDecimal; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer operatorId = null; |
| | | if (objectType.equals(2)){ |
| | | //查询运营商 |
| | | TOperator operator = operatorService.getOne(new QueryWrapper<TOperator>() |
| | | .eq("userId", UserExt.getUser().getId()) |
| | | .ne("state", 3) |
| | | .last("LIMIT 1")); |
| | | if (Objects.nonNull(operator)) { |
| | | operatorId = operator.getId(); |
| | | } |
| | | } |
| | | //查询运营商列表 |
| | | model.addAttribute("operatorList", operatorService.list(new QueryWrapper<TOperator>().eq("state", 1))); |
| | | model.addAttribute("operatorList", operatorService.list(new QueryWrapper<TOperator>().eq(Objects.nonNull(operatorId), "id",operatorId).eq("state", 1))); |
| | | model.addAttribute("storeList", storeService.list(new QueryWrapper<TStore>().eq("state", 1))); |
| | | return PREFIX + "tPayHuimin.html"; |
| | | } |
| | |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(HuiminPayQuery query) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | if (objectType.equals(2)){ |
| | | //查询运营商 |
| | | TOperator operator = operatorService.getOne(new QueryWrapper<TOperator>() |
| | | .eq("userId", UserExt.getUser().getId()) |
| | | .ne("state", 3) |
| | | .last("LIMIT 1")); |
| | | if (Objects.nonNull(operator)) { |
| | | query.setOperatorId(Long.valueOf(operator.getId())); |
| | | } |
| | | } |
| | | Page<TPayHuimin> tPayHuiminPage = new PageFactory<TPayHuimin>().defaultPage(); |
| | | query.setCurrent(tPayHuiminPage.getCurrent()); |
| | | query.setSize(tPayHuiminPage.getSize()); |
| | |
| | | List<Integer> operatorIdList = records.stream() |
| | | .map(SalesDetailVO::getOperatorId) |
| | | .collect(Collectors.toList()); |
| | | List<Integer> storeIdList = records.stream() |
| | | .map(SalesDetailVO::getStoreId) |
| | | .collect(Collectors.toList()); |
| | | Map<Integer, String> operatorMap = operatorService.listByIds(operatorIdList).stream() |
| | | .collect(Collectors.toMap(TOperator::getId, TOperator::getName)); |
| | | Map<Integer, String> storeMap = storeService.listByIds(storeIdList).stream() |
| | | Map<Integer, String> storeMap = storeService.list().stream() |
| | | .collect(Collectors.toMap(TStore::getId, TStore::getName)); |
| | | records.forEach(item->{ |
| | | item.setOperatorName(operatorMap.getOrDefault(item.getOperatorId(),"")); |
| | | item.setStoreName(storeMap.getOrDefault(item.getStoreId(),"")); |
| | | StringBuilder sb = new StringBuilder(); |
| | | Arrays.stream(item.getStoreIds().split(",")).map(Integer::parseInt).forEach(s->{ |
| | | sb.append( storeMap.getOrDefault(s, "")); |
| | | sb.append(","); |
| | | }); |
| | | //sb去除最后一个逗号 |
| | | sb.deleteCharAt(sb.length() - 1); |
| | | item.setStoreName(sb.toString()); |
| | | }); |
| | | } |
| | | return super.packForBT(salesDetailVOPage); |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("/refund/{id}") |
| | | @PostMapping("/refund") |
| | | @ResponseBody |
| | | public ResultUtil<?> refund(@PathVariable("id") Integer id) { |
| | | return payHuiminClient.refund(id); |
| | | public ResultUtil<?> refund(Integer id) { |
| | | payHuiminClient.refund(id); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | |
| | | List<Integer> operatorIdList = records.stream() |
| | | .map(SalesDetailVO::getOperatorId) |
| | | .collect(Collectors.toList()); |
| | | List<Integer> storeIdList = records.stream() |
| | | .map(SalesDetailVO::getStoreId) |
| | | .collect(Collectors.toList()); |
| | | Map<Integer, String> operatorMap = operatorService.listByIds(operatorIdList).stream() |
| | | .collect(Collectors.toMap(TOperator::getId, TOperator::getName)); |
| | | Map<Integer, String> storeMap = storeService.listByIds(storeIdList).stream() |
| | | Map<Integer, String> storeMap = storeService.list().stream() |
| | | .collect(Collectors.toMap(TStore::getId, TStore::getName)); |
| | | records.forEach(item -> { |
| | | item.setOperatorName(operatorMap.getOrDefault(item.getOperatorId(), "")); |
| | | item.setStoreName(storeMap.getOrDefault(item.getStoreId(), "")); |
| | | records.forEach(item->{ |
| | | item.setOperatorName(operatorMap.getOrDefault(item.getOperatorId(),"")); |
| | | StringBuilder sb = new StringBuilder(); |
| | | Arrays.stream(item.getStoreIds().split(",")).map(Integer::parseInt).forEach(s->{ |
| | | sb.append( storeMap.getOrDefault(s, "")); |
| | | sb.append(","); |
| | | }); |
| | | //sb去除最后一个逗号 |
| | | sb.deleteCharAt(sb.length() - 1); |
| | | item.setStoreName(sb.toString()); |
| | | }); |
| | | } |
| | | String[] titleArr = {"惠民卡名称", "惠民卡类型", "售卖金额", "所属运营商", "可用门店", "购买用户", "联系电话", "购买时间", "绑定人员", "已用次数", "有效期", "状态"}; |
| | |
| | | |
| | | private String operatorName; |
| | | |
| | | private Integer operatorId; |
| | | |
| | | private String storeName; |
| | | |
| | | private String ids; |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | // 关联信息 |
| | | private Integer operatorId; |
| | | private String operatorName; // 所属运营商 |
| | | private Integer storeId; |
| | | private String storeIds; |
| | | private String storeName; // 可用门店 |
| | | private Integer appUserId; // 购买用户ID |
| | | private String userName; // 购买用户 |
| | |
| | | |
| | | // 时间信息 |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date paymentTime; // 购买时间[1,8](@ref) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; // 有效期 |
| | | |
| | | // 使用信息 |
| | |
| | | <div id="tab-1" class="tab-pane active"> |
| | | <div class="panel-body"> |
| | | <textarea id="editor_1" type="text/plain" style="width:1200px;height:400px;">${item.addUserRemark!}</textarea> |
| | | <!--<div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5"> |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun=""/> |
| | | </div> |
| | | </div>--> |
| | | </div> |
| | | </div> |
| | | <div id="tab-2" class="tab-pane"> |
| | | <div class="panel-body"> |
| | | <textarea type="text/plain" id="editor_2" style="width:1200px;height:400px;"${item.selectUserRemark!}</textarea> |
| | | <!--<div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun=""/> |
| | | </div> |
| | | </div>--> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | editor_2 = UE.getEditor('editor_2'); |
| | | editor_3 = UE.getEditor('editor_3'); |
| | | |
| | | // 改用全局方法处理删除 |
| | | window.deleteTab = function(counter) { |
| | | console.log("全局删除方法被调用,counter =", counter); |
| | | deleteEditor(parseInt(counter)); |
| | | }; |
| | | |
| | | // 绑定添加按钮的点击事件 |
| | | $("#agreementAdd").click(function() { |
| | | var title = $("#agreement").val().trim(); |
| | |
| | | $("#agreement").val(""); |
| | | }); |
| | | |
| | | //协议配置回显 |
| | | let settingList = '${tHuiminAgreementSettingList}'; |
| | | if (settingList != "" && typeof settingList != "undefined"){ |
| | | let settingArr = JSON.parse(settingList); |
| | | review(settingArr); |
| | | } |
| | | |
| | | // 确保编辑器初始化完成后再获取数据 |
| | | editor_3.ready(function() { |
| | | console.log("编辑器初始化完成,准备加载数据"); |
| | | |
| | | // 页面初始化时通过AJAX请求获取协议配置数据 |
| | | var operatorId = $("#operator").val(); |
| | | console.log("页面初始化,当前运营商ID:", operatorId); |
| | | |
| | | // 调用接口获取协议配置数据(只回显协议配置,不回显门店无惠民卡介绍页) |
| | | var ajax = new $ax(Feng.ctxPath + "/tHuiminAgreement/selectAgreementByOperationId", function(data){ |
| | | console.log("获取到的惠民卡数据:", data); |
| | | if (data.data != null){ |
| | | // 只更新协议配置 |
| | | if (data.data.settingList && data.data.settingList.length > 0) { |
| | | console.log("协议配置数据:", data.data.settingList); |
| | | review(data.data.settingList); |
| | | } |
| | | } |
| | | },function(data){ |
| | | console.error("获取惠民卡数据失败:", data); |
| | | Feng.error("获取惠民卡数据失败!"); |
| | | }); |
| | | ajax.set("operatorId", operatorId); |
| | | ajax.start(); |
| | | }); |
| | | |
| | | //经营商切换事件 |
| | | $("#operator").change(function() { |
| | | console.log("运营商切换事件触发,选择的运营商ID:", $("#operator").val()); |
| | | |
| | | // 先主动清空编辑器内容 |
| | | if(editor_3 && editor_3.body) { |
| | | editor_3.setContent(""); |
| | | console.log("主动清空门店无惠民卡介绍页内容"); |
| | | } |
| | | |
| | | //清空协议配置 |
| | | removeAll() |
| | | removeAll(); |
| | | //调用接口获取协议配置数据 |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tHuiminAgreement/selectAgreementByOperationId", function(data){ |
| | | if (data.data != "" && data.data != null){ |
| | | console.log("协议配置数据:"+data.data); |
| | | let settingArr = JSON.parse(data.data); |
| | | review(settingArr); |
| | | console.log("获取到的惠民卡数据:", data); |
| | | if (data.data != null){ |
| | | // 更新门店无惠民卡介绍页内容 |
| | | try { |
| | | var introContent = ""; |
| | | // 严格判断内容是否存在且非空 |
| | | if(data.data.storeNoHuiminCardIntro !== null && |
| | | data.data.storeNoHuiminCardIntro !== undefined && |
| | | data.data.storeNoHuiminCardIntro !== "") { |
| | | introContent = data.data.storeNoHuiminCardIntro; |
| | | } |
| | | |
| | | // 确保编辑器实例存在且已初始化 |
| | | if(editor_3 && editor_3.body) { |
| | | // 设置编辑器内容(空内容会清空编辑器) |
| | | editor_3.setContent(introContent); |
| | | console.log("已更新门店无惠民卡介绍页内容:", introContent ? "有内容" : "内容为空"); |
| | | } else { |
| | | console.error("编辑器未准备好,无法设置内容"); |
| | | // 延迟设置内容 |
| | | setTimeout(function() { |
| | | try { |
| | | if(editor_3) { |
| | | editor_3.setContent(introContent); |
| | | console.log("延迟更新门店无惠民卡介绍页内容成功"); |
| | | } |
| | | } catch(e) { |
| | | console.error("延迟设置编辑器内容出错:", e); |
| | | } |
| | | }, 1000); |
| | | } |
| | | } catch(e) { |
| | | console.error("设置编辑器内容出错:", e); |
| | | } |
| | | |
| | | // 更新协议配置 |
| | | if (data.data.settingList && data.data.settingList.length > 0) { |
| | | console.log("协议配置数据:", data.data.settingList); |
| | | review(data.data.settingList); |
| | | } |
| | | } |
| | | },function(data){ |
| | | console.error("获取惠民卡数据失败:", data); |
| | | Feng.error("获取惠民卡数据失败!"); |
| | | }); |
| | | ajax.set("operatorId",$("#operator").val()); |
| | | ajax.start(); |
| | |
| | | function review(settingArr){ |
| | | if (typeof settingArr !== 'undefined' && settingArr.length > 0) { |
| | | settingArr.forEach(function(item) { |
| | | addNewEditor(item.title, item.content || ""); |
| | | // 详细记录每个配置项 |
| | | console.log("处理协议配置项:", item); |
| | | |
| | | // 获取标题和内容,兼容不同字段名 |
| | | var title = item.agreementName || item.title || ""; |
| | | var content = item.agreementContent || item.content || ""; |
| | | |
| | | console.log("使用标题:", title, "内容长度:", content.length, "内容前20字符:", content.substring(0, 20)); |
| | | addNewEditor(title, content); |
| | | }); |
| | | } |
| | | } |
| | |
| | | // 添加新的编辑器函数 - 修改为接受内容参数 |
| | | function addNewEditor(title, content) { |
| | | editorCounter++; |
| | | var editorId = "dynamic-editor-" + editorCounter; |
| | | var tabId = "agreement-tab-" + editorCounter; |
| | | // 立即捕获当前counter值,防止闭包问题 |
| | | var currentCounter = editorCounter; |
| | | |
| | | var editorId = "dynamic-editor-" + currentCounter; |
| | | var tabId = "agreement-tab-" + currentCounter; |
| | | var isFirstTab = (dynamicEditors.length === 0); |
| | | |
| | | // 如果是第一个编辑器,显示tabs容器 |
| | |
| | | $("#agreement-content .tab-pane").removeClass("active"); |
| | | |
| | | // 创建新的Tab - 始终设置为激活状态 |
| | | var tabHtml = '<li class="active" id="tab-li-' + editorCounter + '">' + |
| | | '<a data-toggle="tab" href="#' + tabId + '" aria-expanded="true">' + title + |
| | | ' <i class="fa fa-times-circle delete-tab" data-editor-id="' + editorId + '" ' + |
| | | 'data-tab-id="' + tabId + '" data-counter="' + editorCounter + '"></i></a></li>'; |
| | | // 修改删除按钮DOM结构,确保按钮在标题右侧 |
| | | var tabHtml = '<li class="active" id="tab-li-' + currentCounter + '" style="position:relative;">' + |
| | | '<a data-toggle="tab" href="#' + tabId + '" aria-expanded="true" style="padding-right:25px;">' + title + '</a>' + |
| | | '<span onclick="deleteTab(' + currentCounter + ')" ' + |
| | | 'style="position:absolute;right:5px;top:10px;cursor:pointer;color:#f00;z-index:100;">' + |
| | | '<i class="fa fa-times-circle"></i></span></li>'; |
| | | |
| | | // 记录创建的按钮信息,辅助调试 |
| | | console.log("创建删除按钮, counter =", currentCounter, "title =", title); |
| | | |
| | | // 创建Tab内容 - 始终设置为激活状态 |
| | | var contentHtml = '<div id="' + tabId + '" class="tab-pane active">' + |
| | |
| | | autoFloatEnabled: false |
| | | }); |
| | | |
| | | // 确保编辑器已准备好 |
| | | editor.ready(function() { |
| | | try { |
| | | // 检查编辑器是否已准备好接收内容 |
| | | if(editor.body) { |
| | | // 初始化内容 |
| | | editor.setContent(content || ""); |
| | | } else { |
| | | // 如果编辑器body未准备好,延迟设置内容 |
| | | setTimeout(function() { |
| | | try { |
| | | editor.setContent(content || ""); |
| | | } catch(e) { |
| | | console.error("延迟设置编辑器内容出错:", e); |
| | | } |
| | | }, 500); |
| | | // 确保编辑器已准备好,使用立即执行函数捕获当前counter值 |
| | | (function(capturedCounter, editorId, tabId, titleText, contentText) { |
| | | editor.ready(function() { |
| | | try { |
| | | // 检查编辑器是否已准备好接收内容 |
| | | if(editor.body) { |
| | | // 初始化内容 |
| | | editor.setContent(contentText || ""); |
| | | } else { |
| | | // 如果编辑器body未准备好,延迟设置内容 |
| | | setTimeout(function() { |
| | | try { |
| | | editor.setContent(contentText || ""); |
| | | } catch(e) { |
| | | console.error("延迟设置编辑器内容出错:", e); |
| | | } |
| | | }, 500); |
| | | } |
| | | |
| | | // 存储编辑器实例和标题信息,使用捕获的counter |
| | | dynamicEditors.push({ |
| | | id: editorId, |
| | | tabId: tabId, |
| | | counter: capturedCounter, // 使用捕获的值,而不是外部变量 |
| | | title: titleText, |
| | | editor: editor, |
| | | content: contentText || "" |
| | | }); |
| | | |
| | | console.log("编辑器准备完成,添加到dynamicEditors,counter =", capturedCounter); |
| | | |
| | | // 不再需要在这里绑定事件,因为已经使用事件委托 |
| | | } catch(e) { |
| | | console.error("编辑器初始化出错:", e); |
| | | } |
| | | |
| | | // 存储编辑器实例和标题信息 |
| | | dynamicEditors.push({ |
| | | id: editorId, |
| | | tabId: tabId, |
| | | counter: editorCounter, |
| | | title: title, |
| | | editor: editor, |
| | | content: content || "" |
| | | }); |
| | | |
| | | // 绑定删除按钮事件 |
| | | $(".delete-tab[data-editor-id='" + editorId + "']").click(function(e) { |
| | | e.preventDefault(); |
| | | e.stopPropagation(); |
| | | deleteEditor($(this).data("counter")); |
| | | }); |
| | | } catch(e) { |
| | | console.error("编辑器初始化出错:", e); |
| | | } |
| | | }); |
| | | }); |
| | | })(currentCounter, editorId, tabId, title, content); |
| | | |
| | | // 手动激活新添加的标签页 |
| | | $('#agreement-tabs a[href="#' + tabId + '"]').tab('show'); |
| | | } |
| | | |
| | | // 删除编辑器函数 |
| | | // 删除编辑器函数 - 优化标签页激活逻辑 |
| | | function deleteEditor(counter) { |
| | | // 确保counter是整数 |
| | | counter = parseInt(counter); |
| | | |
| | | var index = -1; |
| | | var isActive = $("#tab-li-" + counter).hasClass("active"); |
| | | var nextActive = null; |
| | | |
| | | // 输出当前所有编辑器的counter值,辅助调试 |
| | | console.log("当前所有编辑器的counter值:", dynamicEditors.map(function(item) { return item.counter; })); |
| | | console.log("完整的dynamicEditors数组:", JSON.stringify(dynamicEditors.map(function(item) { |
| | | return { |
| | | counter: item.counter, |
| | | title: item.title, |
| | | tabId: item.tabId, |
| | | id: item.id |
| | | }; |
| | | }))); |
| | | |
| | | // 查找编辑器索引 |
| | | for(var i = 0; i < dynamicEditors.length; i++) { |
| | | if(dynamicEditors[i].counter == counter) { |
| | | console.log("检查编辑器", i, "counter =", dynamicEditors[i].counter, "要删除的counter =", counter); |
| | | // 使用严格的整数比较 |
| | | if(parseInt(dynamicEditors[i].counter) === counter) { |
| | | index = i; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if(index === -1) return; |
| | | |
| | | // 销毁编辑器实例 |
| | | if(dynamicEditors[index].editor) { |
| | | dynamicEditors[index].editor.destroy(); |
| | | if(index === -1) { |
| | | console.error("找不到要删除的编辑器:", counter); |
| | | // 尝试遍历DOM查找是否存在该元素 |
| | | console.log("尝试检查DOM元素是否存在:", "#tab-li-" + counter); |
| | | console.log("DOM元素存在:", $("#tab-li-" + counter).length > 0); |
| | | return; |
| | | } |
| | | |
| | | // 如果删除的是当前活跃tab,需要激活另一个tab |
| | | console.log("删除编辑器", counter, "索引:", index, "是否当前活跃:", isActive); |
| | | |
| | | // 确定删除后需要激活哪个标签页 |
| | | if(isActive && dynamicEditors.length > 1) { |
| | | // 优先选择下一个,如果没有则选择上一个 |
| | | if(index < dynamicEditors.length - 1) { |
| | | nextActive = dynamicEditors[index + 1].tabId; |
| | | console.log("将激活下一个标签页:", nextActive); |
| | | } else { |
| | | nextActive = dynamicEditors[index - 1].tabId; |
| | | console.log("将激活上一个标签页:", nextActive); |
| | | } |
| | | } |
| | | |
| | | // 完全清理DOM元素 |
| | | $("#tab-li-" + counter).remove(); |
| | | $("#" + dynamicEditors[index].tabId).remove(); |
| | | // 如果是当前活跃标签,先激活另一个标签,再删除当前标签 |
| | | if(isActive && nextActive) { |
| | | try { |
| | | console.log("先激活其他标签页:", nextActive); |
| | | $('a[href="#' + nextActive + '"]').tab('show'); |
| | | } catch(e) { |
| | | console.error("激活其他标签页失败:", e); |
| | | } |
| | | } |
| | | |
| | | // 确保UEditor容器被完全移除 |
| | | $("#" + dynamicEditors[index].id).parents(".edui-default").remove(); |
| | | $("#" + dynamicEditors[index].id).remove(); |
| | | // 销毁编辑器实例 |
| | | try { |
| | | if(dynamicEditors[index].editor) { |
| | | dynamicEditors[index].editor.destroy(); |
| | | } |
| | | } catch(e) { |
| | | console.error("销毁编辑器出错:", e); |
| | | } |
| | | |
| | | // 完全清理DOM元素 |
| | | try { |
| | | $("#tab-li-" + counter).remove(); |
| | | $("#" + dynamicEditors[index].tabId).remove(); |
| | | |
| | | // 确保UEditor容器被完全移除 |
| | | $("#" + dynamicEditors[index].id).parents(".edui-default").remove(); |
| | | $("#" + dynamicEditors[index].id).remove(); |
| | | } catch(e) { |
| | | console.error("清理DOM元素出错:", e); |
| | | } |
| | | |
| | | // 从数组中移除 |
| | | dynamicEditors.splice(index, 1); |
| | | console.log("删除后的编辑器列表:", dynamicEditors.map(function(item) { return item.title; })); |
| | | |
| | | // 如果没有编辑器了,清空并隐藏tabs容器 |
| | | if(dynamicEditors.length === 0) { |
| | |
| | | // 彻底清空容器内容,确保没有残留 |
| | | $("#agreement-tabs").empty(); |
| | | $("#agreement-content").empty(); |
| | | } else if(nextActive) { |
| | | // 激活下一个tab |
| | | $('a[href="#' + nextActive + '"]').tab('show'); |
| | | } |
| | | // 不再需要这个逻辑,因为我们在删除前已经激活了其他标签 |
| | | } |
| | | |
| | | //收集动态编辑器内容 |
| | |
| | | content = dynamicEditors[i].content || ""; |
| | | } |
| | | |
| | | // 使用与后端一致的字段名 |
| | | agreements.push({ |
| | | title: dynamicEditors[i].title, |
| | | content: content |
| | | agreementName: dynamicEditors[i].title, |
| | | agreementContent: content |
| | | }); |
| | | } |
| | | console.log("收集到的协议配置数据:", agreements); |
| | | return agreements; |
| | | }; |
| | | |
| | |
| | | <div class="ibox-content"> |
| | | <el-form :inline="true" :model="query"> |
| | | <el-form-item label="惠民卡名称:"> |
| | | <el-input v-model="query.name" placeholder="请输入"></el-input> |
| | | <el-input v-model="query.huiMinName" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="惠民卡类型:"> |
| | | <el-select v-model="query.type" placeholder="全部"> |
| | | <el-select v-model="query.huiMinType" placeholder="全部"> |
| | | <el-option label="全部" value=""></el-option> |
| | | <el-option label="年度卡" value="year"></el-option> |
| | | <el-option label="季度卡" value="quarter"></el-option> |
| | |
| | | <el-form-item label="有效期:"> |
| | | <el-date-picker |
| | | v-model="query.dateRange" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | type="daterange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="惠民卡状态:"> |
| | | <el-select v-model="query.huiMinStatus" placeholder="全部"> |
| | | <el-option label="全部" value=""></el-option> |
| | | <el-option label="未开始" value="1"></el-option> |
| | | <el-option label="已开始" value="2"></el-option> |
| | | <el-option label="已结束" value="3"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="可售状态:"> |
| | |
| | | </el-form> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <el-button type="primary" size="medium" style="background-color:#1ab394;color: #ffffff;border:#1ab394;" v-on:click="handleSearch" icon="el-icon-search">搜索</el-button> |
| | | <el-button type="primary" size="medium" style="background-color:#1ab394;color: #ffffff;border:#1ab394;" v-on:click="handleAdd" icon="el-icon-circle-plus-outline">添加</el-button> |
| | | <el-button type="primary" size="medium" style="background-color:#1ab394;color: #ffffff;border:#1ab394;" v-on:click="handleEdit" icon="el-icon-edit">编辑</el-button> |
| | | <el-button type="primary" size="medium" style="background-color:#1ab394;color: #ffffff;border:#1ab394;" v-on:click="handleDelete" icon="el-icon-delete">删除</el-button> |
| | | <el-button type="primary" size="medium" style="background-color:#1ab394;color: #ffffff;border:#1ab394;" v-on:click="handleShelves(1)" icon="el-icon-upload2">上架</el-button> |
| | | <el-button type="primary" size="medium" style="background-color:#1ab394;color: #ffffff;border:#1ab394;" v-on:click="handleShelves(2)" icon="el-icon-download">下架</el-button> |
| | | <el-button type="primary" size="medium" style="background-color:#1ab394;color: #ffffff;border:#1ab394;" v-on:click="handleViewDetail" icon="el-icon-tickets">查看详情</el-button> |
| | | <button type="button" class="btn btn-primary" v-on:click="handleSearch"> |
| | | <i class="fa fa-search"></i> |
| | | 搜索 |
| | | </button> |
| | | <button type="button" class="btn btn-primary" v-on:click="handleAdd"> |
| | | <i class="fa fa-plus"></i> |
| | | 添加 |
| | | </button> |
| | | <button type="button" class="btn btn-primary" v-on:click="handleEdit"> |
| | | <i class="fa fa-edit"></i> |
| | | 编辑 |
| | | </button> |
| | | <button type="button" class="btn btn-primary" v-on:click="handleDelete"> |
| | | <i class="fa fa-remove"></i> |
| | | 删除 |
| | | </button> |
| | | <button type="button" class="btn btn-primary" v-on:click="handleShelves(1)"> |
| | | <i class="fa fa-check"></i> |
| | | 上架 |
| | | </button> |
| | | <button type="button" class="btn btn-primary" v-on:click="handleShelves(2)"> |
| | | <i class="fa fa-remove"></i> |
| | | 下架 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | <el-table |
| | |
| | | <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-if="scope.row.huiMinStatus === 1">未开始</span> |
| | | <span v-else-if="scope.row.huiMinStatus === 2">已开始</span> |
| | | <span v-else-if="scope.row.huiMinStatus === 3">已结束</span> |
| | | <span v-else>未知类型</span> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <!-- 时间输入和删除按钮 --> |
| | | <div class="row g-3"> |
| | | <div class="col-md-6" style="display: flex"> |
| | | <el-time-select |
| | | placeholder="起始时间" |
| | | <el-time-picker |
| | | v-model="weekGroup.startTime" |
| | | :picker-options="{ |
| | | start: '00:00', |
| | | step: '01:00', |
| | | end: '23:00'}" |
| | | > |
| | | </el-time-select> |
| | | <el-time-select |
| | | placeholder="结束时间" |
| | | format="HH:mm" |
| | | value-format="HH:mm" |
| | | placeholder="开始时间"> |
| | | </el-time-picker> |
| | | <el-time-picker |
| | | format="HH:mm" |
| | | value-format="HH:mm" |
| | | v-model="weekGroup.endTime" |
| | | :picker-options="{ |
| | | start: '00:00', |
| | | step: '01:00', |
| | | end: '23:00', |
| | | minTime: weekGroup.startTime}"> |
| | | </el-time-select> |
| | | placeholder="结束时间"> |
| | | </el-time-picker> |
| | | </div> |
| | | <div class="col-md-6"> |
| | | <button |
| | |
| | | </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 label="适用范围" prop="useScope" > |
| | | <el-radio v-if="objectType !=='3'" v-model="huiminCard.useScope" v-on:change="useScopeChange()" label="1">指定门店</el-radio> |
| | | <el-radio v-model="huiminCard.useScope" v-on:change="useScopeChange()" label="2">指定场地</el-radio> |
| | | </el-form-item> |
| | | |
| | | <!-- 指定门店 --> |
| | | <el-form-item label="指定门店" v-if="huiminCard.useScope === '1'" prop="storeIds"> |
| | | <el-form-item label="指定门店" v-if="huiminCard.useScope === '1' && objectType !=='3'" prop="storeIds"> |
| | | <el-button type="text" v-on:click="handleSelectStore()">选择门店</el-button> |
| | | <el-table |
| | | :data="tableData" |
| | |
| | | </el-table> |
| | | </el-form-item> |
| | | |
| | | |
| | | <!-- 惠民卡介绍 --> |
| | | <el-form-item label="惠民卡介绍" prop="introduce"> |
| | | <textarea type="text/plain" v-model="introduces" id="editor_1"></textarea> |
| | |
| | | <el-select v-model="storeForm.provinceCode" size="mini" clearable filterable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in provinces" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code"> |
| | | </el-option> |
| | |
| | | <el-select v-model="storeForm.cityCode" clearable size="mini" filterable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in cities" |
| | | :key="item.citycode" |
| | | :label="item.name" |
| | | :value="item.citycode"> |
| | | </el-option> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="所属运营商"> |
| | | <el-form-item label="所属运营商" label-width="100px"> |
| | | <el-select v-model="storeForm.operatorId" clearable size="mini" filterable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in operations" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | |
| | | </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"> |
| | | v-on:size-change="handleStoreSizeChange" |
| | | v-on:current-change="handleStoreCurrentChange" |
| | | :current-page="currentStorePage" |
| | | :page-sizes="[10, 50, 100, 200]" |
| | | :page-size="pageStoreSize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="storeTotal"> |
| | | </el-pagination> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button v-on:click="dialogVisible2 = false">取 消</el-button> |
| | |
| | | <el-select v-model="siteForm.provinceCode" size="mini" clearable filterable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in provinces" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code"> |
| | | </el-option> |
| | |
| | | <el-select v-model="siteForm.cityCode" clearable size="mini" filterable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in cities" |
| | | :key="item.citycode" |
| | | :label="item.name" |
| | | :value="item.citycode"> |
| | | </el-option> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="所属运营商"> |
| | | <el-form-item label="所属运营商" label-width="100px"> |
| | | <el-select v-model="siteForm.operatorId" clearable size="mini" filterable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in operations" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | |
| | | </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> |
| | | |
| | | <el-pagination |
| | | v-on:size-change="handleSiteSizeChange" |
| | | v-on:current-change="handleSiteCurrentChange" |
| | | :current-page="currentSitePage" |
| | | :page-sizes="[10, 50, 100, 200]" |
| | | :page-size="pageSiteSize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="siteTotal"> |
| | | </el-pagination> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button v-on:click="dialogVisible3 = false">取 消</el-button> |
| | |
| | | introduces: null, |
| | | multipleSelection1: [], |
| | | multipleSelection2: [], |
| | | currentSitePage: 1, |
| | | pageSiteSize: 10, |
| | | currentStorePage: 1, |
| | | pageStoreSize: 10, |
| | | siteTotal: 0, |
| | | storeTotal: 0, |
| | | objectType: null, |
| | | unUseTimes: [ |
| | | {} |
| | | ], |
| | |
| | | }, |
| | | tableData: [], |
| | | tableStoreData: [], |
| | | tableStoreTotal: 0, |
| | | tableStoreLoading: false, |
| | | tableSiteData: [], |
| | | tableSiteTotal: 0, |
| | |
| | | return isLt2M; |
| | | }, |
| | | handleRemove(file, fileList) { |
| | | const fileUrl = file.response; |
| | | const fileUrl = file.url; |
| | | this.banners.forEach((item, index) => { |
| | | if (item === fileUrl) { |
| | | this.banners.splice(index, 1); |
| | |
| | | let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/storeList", |
| | | (data) => { |
| | | vm.tableStoreData = data.records; // 使用 vm 替代 this |
| | | vm.tableStoreTotal = data.total; |
| | | vm.storeTotal = data.total; |
| | | vm.tableStoreLoading = false; |
| | | console.log('成功获取数据:', vm.tableStoreData); // 验证数据 |
| | | }, |
| | |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | this.storeForm.pageNum = vm.queryParams.pageNum; |
| | | this.storeForm.pageSize = vm.queryParams.pageSize |
| | | this.storeForm.pageNum = vm.currentStorePage; |
| | | this.storeForm.pageSize = vm.pageStoreSize |
| | | ajax.set(this.storeForm); |
| | | |
| | | ajax.start(); |
| | |
| | | vm.tableSiteData = data.records; // 使用 vm 替代 this |
| | | vm.tableSiteTotal = data.total; |
| | | vm.tableSiteLoading = false; |
| | | vm.currentStorePage = data.current; |
| | | vm.pageStoreSize = data.size; |
| | | vm.siteTotal = data.total; |
| | | console.log('成功获取数据:', vm.tableSiteData); // 验证数据 |
| | | }, |
| | | (data) => { |
| | |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | this.siteForm.pageNum = vm.queryParams.pageNum; |
| | | this.siteForm.pageSize = vm.queryParams.pageSize |
| | | this.siteForm.current = vm.currentSitePage; |
| | | this.siteForm.size = vm.pageSiteSize |
| | | ajax.set(this.siteForm); |
| | | ajax.start(); |
| | | }, |
| | |
| | | this.dialogVisible2 = false; |
| | | }, |
| | | handleSiteClose() { |
| | | this.$confirm('确认关闭?1') |
| | | .then(_ => { |
| | | this.dialogVisible3 = false; |
| | | }) |
| | | .catch(_ => { |
| | | }); |
| | | this.dialogVisible3 = false; |
| | | }, |
| | | handleSelectionChange(val) { |
| | | |
| | | if (this.huiminCard.useScope === '1') { |
| | | this.multipleSelection1 = val; |
| | | } else if (this.huiminCard.useScope === '2') { |
| | |
| | | Feng.info('请选择数据'); |
| | | return; |
| | | } |
| | | this.dialogVisible2 = false |
| | | this.tableData = this.multipleSelection1; |
| | | |
| | | // 新增:检查所有新选中的门店是否属于同一运营商 |
| | | const firstOperator = this.multipleSelection1[0].operatorId; |
| | | if (this.multipleSelection1.some(item => item.operatorId !== firstOperator)) { |
| | | Feng.info('请选择同一运营商'); |
| | | return; |
| | | } |
| | | |
| | | // 检查新选门店与已有门店的运营商是否一致(如果需要) |
| | | if (this.tableData.length > 0) { |
| | | const existingOperator = this.tableData[0].operatorId; |
| | | if (firstOperator !== existingOperator) { |
| | | Feng.info('新选门店的运营商需与已有门店一致'); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | this.multipleSelection1.forEach((item) => { |
| | | if (!this.tableData.some(item1 => item1.storeId === item.storeId)) { |
| | | this.tableData.push(item); |
| | | } |
| | | }); |
| | | |
| | | this.dialogVisible2 = false; |
| | | this.huiminCard.useIds = this.tableData.map(item => item.storeId).join(','); |
| | | }, |
| | | handleSite() { |
| | |
| | | this.dialogVisible3 = false |
| | | this.tableData = this.multipleSelection2; |
| | | this.huiminCard.useIds = this.tableData.map(item => item.siteId).join(','); |
| | | }, |
| | | useScopeChange() { |
| | | this.tableData = []; |
| | | }, |
| | | submitForm(formName) { |
| | | this.$refs[formName].validate(valid => { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | handleSiteSizeChange(val){ |
| | | this.pageSiteSize = val; |
| | | this.siteList(); |
| | | }, |
| | | handleSiteCurrentChange(val){ |
| | | this.currentSitePage = val; |
| | | this.siteList(); |
| | | }, |
| | | handleStoreSizeChange(val){ |
| | | this.pageSiteSize = val; |
| | | this.storeList(); |
| | | }, |
| | | handleStoreCurrentChange(val){ |
| | | this.currentSitePage = val; |
| | | this.storeList(); |
| | | }, |
| | | }, |
| | | created() { |
| | | let editor_1 = UE.getEditor('editor_1'); |
| | | |
| | | this.objectType = `${objectType}` |
| | | if (this.objectType === '3'){ |
| | | this.huiminCard.useScope = '2' |
| | | } |
| | | |
| | | let ajax = new $ax(Feng.ctxPath + "/base/region/getProvince", |
| | | (data) => { |
| | |
| | | |
| | | <!-- 不可用时间 --> |
| | | <el-form-item label="不可用时间" prop="unUseTimes"> |
| | | <el-button type="text" v-on:click="addUnUseTime()">添加</el-button> |
| | | <el-button typ e="text" v-on:click="addUnUseTime()">添加</el-button> |
| | | <div v-for="(item, dayIndex) in unUseTimes" |
| | | :key="dayIndex" |
| | | class="date-picker-item mb-2"> |
| | |
| | | |
| | | <!-- 适用范围 --> |
| | | <el-form-item label="适用范围" prop="useScope"> |
| | | <el-radio v-model="huiminCard.useScope" label="1">指定门店</el-radio> |
| | | <el-radio v-if="objectType !=='3'" 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-form-item label="指定门店" v-if="huiminCard.useScope === '1' && objectType !=='3'" prop="storeIds"> |
| | | <el-button type="text" v-on:click="handleSelectStore()">选择门店</el-button> |
| | | <el-table |
| | | :data="tableData" |
| | |
| | | <el-row :gutter="10"> |
| | | <el-col :span="6"> |
| | | <el-form-item label="所在省"> |
| | | <el-select v-model="siteForm.provinceCode" size="mini" clearable filterable |
| | | placeholder="请选择"> |
| | | <el-select v-model="siteForm.provinceCode" size="mini" clearable filterable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in provinces" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code"> |
| | | </el-option> |
| | |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="所在市"> |
| | | <el-select v-model="siteForm.cityCode" clearable size="mini" filterable |
| | | placeholder="请选择"> |
| | | <el-select v-model="siteForm.cityCode" clearable size="mini" filterable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in cities" |
| | | :key="item.citycode" |
| | | :label="item.name" |
| | | :value="item.citycode"> |
| | | </el-option> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="所属运营商"> |
| | | <el-select v-model="siteForm.operatorId" clearable size="mini" filterable |
| | | placeholder="请选择"> |
| | | <el-form-item label="所属运营商" label-width="100px"> |
| | | <el-select v-model="siteForm.operatorId" clearable size="mini" filterable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in operations" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-button v-on:click="siteList" style="background-color:#1ab394;color: #ffffff" size="mini" |
| | | icon="el-icon-search"> |
| | | <el-button v-on:click="siteList" style="background-color:#1ab394;color: #ffffff" size="mini" icon="el-icon-search"> |
| | | 搜索 |
| | | </el-button> |
| | | </el-col> |
| | |
| | | </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> |
| | | |
| | | <el-pagination |
| | | v-on:size-change="handleSiteSizeChange" |
| | | v-on:current-change="handleSiteCurrentChange" |
| | | :current-page="currentSitePage" |
| | | :page-sizes="[10, 50, 100, 200]" |
| | | :page-size="pageSiteSize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="siteTotal"> |
| | | </el-pagination> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button v-on:click="dialogVisible3 = false">取 消</el-button> |
| | |
| | | operatorId: null, |
| | | storeName: '', |
| | | }, |
| | | objectType: null, |
| | | currentSitePage: 1, |
| | | pageSiteSize: 10, |
| | | currentStorePage: 1, |
| | | pageStoreSize: 10, |
| | | siteTotal: 0, |
| | | storeTotal: 0, |
| | | unBuyCoverFileList: [], |
| | | buyCoverFileList: [], |
| | | bannerFileList: [], |
| | |
| | | return isLt2M; |
| | | }, |
| | | handleRemove(file, fileList) { |
| | | const fileUrl = file.response; |
| | | |
| | | const fileUrl = file.url; |
| | | this.banners.forEach((item, index) => { |
| | | if (item === fileUrl) { |
| | | this.banners.splice(index, 1); |
| | |
| | | let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/storeList", |
| | | (data) => { |
| | | vm.tableStoreData = data.records; // 使用 vm 替代 this |
| | | vm.tableStoreTotal = data.total; |
| | | vm.storeTotal = data.total; |
| | | vm.tableStoreLoading = false; |
| | | console.log('成功获取数据:', vm.tableStoreData); // 验证数据 |
| | | }, |
| | |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | this.storeForm.pageNum = vm.queryParams.pageNum; |
| | | this.storeForm.pageSize = vm.queryParams.pageSize |
| | | this.storeForm.pageNum = vm.currentStorePage; |
| | | this.storeForm.pageSize = vm.pageStoreSize |
| | | ajax.set(this.storeForm); |
| | | |
| | | ajax.start(); |
| | |
| | | vm.tableSiteData = data.records; // 使用 vm 替代 this |
| | | vm.tableSiteTotal = data.total; |
| | | vm.tableSiteLoading = false; |
| | | vm.currentStorePage = data.current; |
| | | vm.pageStoreSize = data.size; |
| | | vm.siteTotal = data.total; |
| | | console.log('成功获取数据:', vm.tableSiteData); // 验证数据 |
| | | }, |
| | | (data) => { |
| | |
| | | Feng.error("请求失败: " + data.responseJSON.message); |
| | | } |
| | | ); |
| | | this.siteForm.pageNum = vm.queryParams.pageNum; |
| | | this.siteForm.pageSize = vm.queryParams.pageSize |
| | | this.siteForm.current = vm.currentSitePage; |
| | | this.siteForm.size = vm.pageSiteSize |
| | | ajax.set(this.siteForm); |
| | | ajax.start(); |
| | | }, |
| | |
| | | this.dialogVisible2 = false; |
| | | }, |
| | | handleSiteClose() { |
| | | this.$confirm('确认关闭?1') |
| | | .then(_ => { |
| | | this.dialogVisible3 = false; |
| | | }) |
| | | .catch(_ => { |
| | | }); |
| | | this.dialogVisible3 = false; |
| | | }, |
| | | handleSelectionChange(val) { |
| | | if (this.huiminCard.useScope === '1') { |
| | |
| | | }, |
| | | cancelForm(){ |
| | | parent.layer.close(window.parent.THuiminCard.layerIndex); |
| | | } |
| | | }, |
| | | handleSiteSizeChange(val){ |
| | | this.pageSiteSize = val; |
| | | this.siteList(); |
| | | }, |
| | | handleSiteCurrentChange(val){ |
| | | this.currentSitePage = val; |
| | | this.siteList(); |
| | | }, |
| | | handleStoreSizeChange(val){ |
| | | this.pageSiteSize = val; |
| | | this.storeList(); |
| | | }, |
| | | handleStoreCurrentChange(val){ |
| | | this.currentSitePage = val; |
| | | this.storeList(); |
| | | }, |
| | | }, |
| | | created() { |
| | | let editor_1 = UE.getEditor('editor_1'); |
| | | this.objectType = `${objectType}` |
| | | |
| | | const urlParams = new URLSearchParams(window.location.search); |
| | | this.pageType = urlParams.get('pageType'); |
| | |
| | | |
| | | this.periodOfValidity = [data.startTime, data.endTime] |
| | | |
| | | console.log("data.useScope",data.useScope) |
| | | |
| | | this.huiminCard = { |
| | | ...data, |
| | | unUseTimes: data.unUseTimes == null? {}: JSON.parse(data.unUseTimes), |
| | | huiMinType: Number(data.huiMinType), |
| | | startTime: data.startTimeStr, |
| | | endTime: data.endTimeStr, |
| | | useScope: data.useScope+"", |
| | | } |
| | | this.unUseTimes = data.unUseTimes == null? {}: JSON.parse(data.unUseTimes), |
| | | // 设置内容(需在编辑器就绪后调用) |
| | | editor_1.ready(() => { |
| | | editor_1.setContent(this.huiminCard.introduce); |
| | |
| | | data() { |
| | | return { |
| | | query: { |
| | | name: '', |
| | | type: '', |
| | | huiMinName: '', |
| | | huiMinType: '', |
| | | dateRange: [], |
| | | status: '' |
| | | status: '', |
| | | huiMinStatus: '', |
| | | }, |
| | | loading: false, |
| | | currentPage: 1, |
| | |
| | | |
| | | // 添加请求参数 |
| | | ajax.set({ |
| | | pageNum: this.currentPage, |
| | | pageSize: this.pageSize, |
| | | current: this.currentPage, |
| | | size: this.pageSize, |
| | | startTime: this.query.dateRange.length > 0 ? this.query.dateRange[0] : null, |
| | | endTime: this.query.dateRange.length > 0 ? this.query.dateRange[1] : null, |
| | | ...this.query |
| | | }); |
| | | ajax.start(); |
| | |
| | | }, |
| | | handleSizeChange(val) { |
| | | this.pageSize = val |
| | | this.handleSearch() |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.currentPage = val |
| | | this.handleSearch() |
| | | }, |
| | | handleSelectionChange(selection) { |
| | | // 多选处理 |
| | |
| | | }}, |
| | | {title: '售卖金额', field: 'salesMoney', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '所属运营商', field: 'operatorName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '可用门店', field: 'storeName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '可用门店', field: 'storeName', visible: true, align: 'center', valign: 'middle', |
| | | cellStyle:formatTableUnit, |
| | | formatter :paramsMatter |
| | | }, |
| | | {title: '购买用户', field: 'userName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '联系电话', field: 'phone', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '购买时间', field: 'paymentTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '绑定人员', field: 'studentName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '已用次数', field: 'useTimes', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '有效期', field: 'endTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '有效期', field: 'endTime', visible: true, align: 'center', valign: 'middle',formatter:function(value,row,index){ |
| | | if (!value){ |
| | | return "永久"; |
| | | }else { |
| | | return value; |
| | | } |
| | | }}, |
| | | {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle', |
| | | formatter:function(value,row,index){ |
| | | return {2: '使用中', 3: '已退款'}[value]; |
| | | }} |
| | | ]; |
| | | }; |
| | | |
| | | //表格超出宽度鼠标悬停显示td内容 |
| | | function paramsMatter(value,row,index) { |
| | | var span=document.createElement("span"); |
| | | span.setAttribute("title",value); |
| | | span.innerHTML = value; |
| | | return span.outerHTML; |
| | | } |
| | | //td宽度以及内容超过宽度隐藏 |
| | | function formatTableUnit(value, row, index) { |
| | | return { |
| | | css: { |
| | | "white-space": "nowrap", |
| | | "text-overflow": "ellipsis", |
| | | "overflow": "hidden", |
| | | "max-width":"150px" |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | |
| | | } |
| | | TPayHuimin.refund = function (){ |
| | | if (this.check()) { |
| | | if (TPayHuimin.seItem.refundStatus != 1){ |
| | | if (TPayHuimin.seItem.status == 3){ |
| | | Feng.error("该商品已退款"); |
| | | return; |
| | | } |
| | |
| | | queryData['phone'] = $("#phone").val(); |
| | | let paymentTimeStr = $("#paymentTimeStr").val(); |
| | | if (paymentTimeStr){ |
| | | queryData['paymentTimeStart'] = paymentTimeStr.split('~')[0]+' 00:00:00'; |
| | | queryData['paymentTimeStart'] = paymentTimeStr.split('~')[0]+'00:00:00'; |
| | | queryData['paymentTimeEnd'] = paymentTimeStr.split('~')[1]+' 23:59:59'; |
| | | } |
| | | let endTimeStr = $("#endTimeStr").val(); |
| | | if (endTimeStr){ |
| | | queryData['endTimeStart'] = endTimeStr.split('~')[0]+' 00:00:00'; |
| | | queryData['endTimeStart'] = endTimeStr.split('~')[0]+'00:00:00'; |
| | | queryData['endTimeEnd'] = endTimeStr.split('~')[1]+' 23:59:59'; |
| | | } |
| | | queryData['status'] = $("#status").val(); |
| | |
| | | TPayHuimin.getStaticsData(); |
| | | }; |
| | | TPayHuimin.resetSearch = function () { |
| | | var queryData = {}; |
| | | $("#huiMinName").val(''); |
| | | $("#huiMinType option:first").prop("selected", true); |
| | | $("#operatorId option:first").prop("selected", true); |
| | | $("#useId option:first").prop("selected", true); |
| | | $("#status option:first").prop("selected", true); |
| | | $("#userName").val(''); |
| | | $("#phone").val(''); |
| | | $("#paymentTimeStr").val(''); |
| | | $("#endTimeStr").val(''); |
| | | $("#status option:first").prop("selected", true); |
| | | TPayHuimin.search(); |
| | | $('#TPayHuiminTable').bootstrapTable('destroy'); |
| | | TPayHuimin.initTable(); |
| | | TPayHuimin.getStaticsData(); |
| | | }; |
| | | $(function () { |
| | | TPayHuimin.initTable = function () { |
| | | var defaultColunms = TPayHuimin.initColumn(); |
| | | var table = new BSTable(TPayHuimin.id, "/tPayHuimin/list", defaultColunms); |
| | | table.setPaginationType("server"); |
| | | TPayHuimin.table = table.init(); |
| | | TPayHuimin.getStaticsData(); |
| | | }; |
| | | $(function () { |
| | | TPayHuimin.initTable(); |
| | | }); |