diff --git a/fuintAdmin/src/api/staff/user/cardvaluechild.js b/fuintAdmin/src/api/staff/user/cardvaluechild.js new file mode 100644 index 000000000..4fce8f88c --- /dev/null +++ b/fuintAdmin/src/api/staff/user/cardvaluechild.js @@ -0,0 +1,45 @@ +import request from '@/utils/request' + +// 查询子卡信息列表 +export function listCardValueChild(id) { + return request({ + url: 'cardValudChildrens/listPC/'+id, + method: 'get', + }) +} + +// 根据id查询子卡信息 +export function cardValueChildInfo(id) { + return request({ + url: 'cardValudChildrens/'+id, + method: 'get', + }) +} + +// 添加子卡信息 +export function addCardValueChild(data) { + return request({ + url: 'cardValudChildrens', + method: 'post', + data: data, + }) +} + + +// 修改子卡信息 +export function editCardValueChild(data) { + return request({ + url: 'cardValudChildrens/edit', + method: 'put', + data: data, + }) +} + +// 查询子卡订单信息 +export function listCardValueChildOrder(query) { + return request({ + url: 'business/order/cardValueChildOrder/list', + method: 'get', + params:query, + }) +} diff --git a/fuintAdmin/src/views/member/userInfo.vue b/fuintAdmin/src/views/member/userInfo.vue index ec8695382..6dc1e5f1e 100644 --- a/fuintAdmin/src/views/member/userInfo.vue +++ b/fuintAdmin/src/views/member/userInfo.vue @@ -439,7 +439,7 @@ - + 手机号更换后,旧手机号将无法使用,更换后实时生效 @@ -539,101 +539,9 @@ - - - - -
-
会员信息:{{ form.mobile }}
- 新增子卡 -
-
- - - - - - - - - - - - - - - - - -
- - -
- -
-
- - - - - - - - - - - - - - - 新增子卡 - - - - -
-
-
- - - - - - - - - - - -
- - -
-
+ + + @@ -718,6 +626,7 @@ import pointsRecord from "@/views/member/userInfoOrder/pointsRecord.vue"; import couponList from "@/views/member/userInfoOrder/couponList.vue"; import growthValueRecord from "@/views/member/userInfoOrder/growthValueRecord.vue"; import refuelMoneyRecord from "@/views/member/userInfoOrder/refuelMoneyRecord.vue"; +import cardValueChild from "@/views/member/userInfoOrder/cardValueChild.vue"; import {allFixingLevel, getFixingLevel} from "@/api/staff/user/fixinglevel"; export default { @@ -730,6 +639,7 @@ export default { couponList, growthValueRecord, refuelMoneyRecord, + cardValueChild, }, computed: { item() { @@ -1017,6 +927,7 @@ export default { const commissionAmount = totalAmount.multipliedBy(percentageCommissions).dividedBy(100).decimalPlaces(2); this.cardValueForm.amountCommission = commissionAmount } + } }) } diff --git a/fuintAdmin/src/views/member/userInfoOrder/cardValueChild.vue b/fuintAdmin/src/views/member/userInfoOrder/cardValueChild.vue new file mode 100644 index 000000000..d931fb4e2 --- /dev/null +++ b/fuintAdmin/src/views/member/userInfoOrder/cardValueChild.vue @@ -0,0 +1,298 @@ + + + + + diff --git a/fuintAdmin/src/views/userGrade/index.vue b/fuintAdmin/src/views/userGrade/index.vue index 85d06c5a5..4638c45a0 100644 --- a/fuintAdmin/src/views/userGrade/index.vue +++ b/fuintAdmin/src/views/userGrade/index.vue @@ -779,9 +779,17 @@ export default { this.form.naturalGasRule = JSON.stringify(this.naturalGasPreferential) if (this.form.id) { updateUserGrade(this.form).then(response => { - this.$modal.msgSuccess("修改成功"); - this.open = false; - this.getList(); + if (response.data==1) { + this.$modal.msgSuccess("修改成功"); + this.open = false; + this.getList(); + }else if (response.data==2) { + this.$modal.msgError("修改失败,已存在当前等级的会员等级信息"); + }else if (response.data==3) { + this.$modal.msgError("修改失败,会员等级名称已存在"); + }else { + this.$modal.msgError("修改失败,已存在当前成长值的会员等级"); + } }); } else { queryUserGrade({name:this.form.name}).then( response => { diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java index d4d6cf1cf..b4a538567 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java @@ -421,7 +421,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { if (activeDiscountPayVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) && activeDiscountPayVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){ if (activeDiscountPayVO.getAmount().multiply(activeDiscountPayVO.getDiscount()).compareTo(amount) > 0){ - amount = paymentActiveDTO.getAmount().subtract(((b.subtract(activeDiscountPayVO.getDiscount())).multiply(activeDiscountPayVO.getAmount()).multiply(a))); + amount = paymentActiveDTO.getAmount().subtract(((b.subtract(activeDiscountPayVO.getDiscount())).multiply(paymentActiveDTO.getAmount()).multiply(a))); paymentActiveVO.setActiveId(activeDiscountPayVO.getActiveId()); paymentActiveVO.setAmount(amount); paymentActiveVO.setFavorableAmount((b.subtract(activeDiscountPayVO.getDiscount())).multiply(activeDiscountPayVO.getAmount()).multiply(a)); @@ -439,10 +439,10 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { if ((paymentActiveDTO.getAmount()).compareTo(activeDiscountPayVO.getAmount()) >= 0){ fullAmount = paymentActiveDTO.getAmount().subtract(activeDiscountPayVO.getDiscount()); if (amount.compareTo(fullAmount) > 0){ - amount = paymentActiveDTO.getAmount().subtract(fullAmount); + amount = paymentActiveDTO.getAmount().subtract(activeDiscountPayVO.getDiscount()); paymentActiveVO.setActiveId(activeDiscountPayVO.getActiveId()); paymentActiveVO.setAmount(amount); - paymentActiveVO.setFavorableAmount(paymentActiveDTO.getAmount().subtract(activeDiscountPayVO.getDiscount())); + paymentActiveVO.setFavorableAmount(paymentActiveDTO.getAmount().subtract(fullAmount)); } } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/controller/CardValudChildrensController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/controller/CardValudChildrensController.java index 46b0ab1ee..9515660f2 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/controller/CardValudChildrensController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/controller/CardValudChildrensController.java @@ -71,7 +71,26 @@ public class CardValudChildrensController extends BaseController { */ @GetMapping("/list/{storeId}") public ResponseObject list(@PathVariable Integer storeId){ - return getSuccessResult(cardValudChildrensService.selectCardValudChildrensByUserId(storeId)); + return getSuccessResult(cardValudChildrensService.selectCardValudChildrensByUserId(null,storeId)); + } + + /** + * 根据用户id查询子卡列表信息 + * @return + */ + @GetMapping("/listPC/{userId}") + public ResponseObject list1(@PathVariable Integer userId){ + return getSuccessResult(cardValudChildrensService.selectCardValudChildrensByUserIdAndStoreId(userId)); + } + + /** + * 修改子卡信息 + * @param cardValudChildrens + * @return + */ + @PutMapping("/edit") + public ResponseObject edit(@RequestBody CardValudChildrens cardValudChildrens){ + return getSuccessResult(cardValudChildrensService.edit(cardValudChildrens)); } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/service/CardValudChildrensService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/service/CardValudChildrensService.java index 96e8c6e26..e29200057 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/service/CardValudChildrensService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/service/CardValudChildrensService.java @@ -22,10 +22,23 @@ public interface CardValudChildrensService extends IService Map add(CardValudChildrens cardValudChildrens); /** - * 查询当前用户的子卡信息 + * 修改数据 + * @param cardValudChildrens * @return */ - List selectCardValudChildrensByUserId(Integer storeId); + int edit(CardValudChildrens cardValudChildrens); + + /** + * 查询当前用户的子卡信息 小程序 + * @return + */ + List selectCardValudChildrensByUserId(Integer userId,Integer storeId); + + /** + * 查询当前用户的子卡信息 PC + * @return + */ + List selectCardValudChildrensByUserIdAndStoreId(Integer userId); /** * 根据店铺id和子卡手机号查询子卡信息 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/service/impl/CardValudChildrensServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/service/impl/CardValudChildrensServiceImpl.java index b5d7ffaaa..b31af868b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/service/impl/CardValudChildrensServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueChildrens/service/impl/CardValudChildrensServiceImpl.java @@ -50,18 +50,26 @@ public class CardValudChildrensServiceImpl extends ServiceImpl add(CardValudChildrens cardValudChildrens) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Integer storeId = cardValudChildrens.getStoreId(); + Integer userId = cardValudChildrens.getUserId(); + if (cardValudChildrens.getStoreId()==null){ + storeId = nowAccountInfo.getStoreId(); + } + if (cardValudChildrens.getUserId()==null){ + userId = nowAccountInfo.getId(); + } Map res = new HashMap<>(); if (ObjectUtils.isNotEmpty(cardValudChildrens)){ - LJUser user = userService.queryUserByUserId(nowAccountInfo.getId()); - LJStore store = storeService.selectStoreByStoreId(cardValudChildrens.getStoreId()); - UserBalance balance = userBalanceService.selectUserBalance(nowAccountInfo.getId(), store.getChainStoreId()); + LJUser user = userService.queryUserByUserId(userId); + LJStore store = storeService.selectStoreByStoreId(storeId); + UserBalance balance = userBalanceService.selectUserBalance(userId, store.getChainStoreId()); if (user.getMobile().equals(cardValudChildrens.getCardChildPhones())){ res.put("error","添加失败,子卡手机号不能与主卡手机号一样!"); return res; } cardValudChildrens.setCardValueId(balance.getId()); - List list = this.selectCardValudChildrensByUserId(cardValudChildrens.getStoreId()); + List list = this.selectCardValudChildrensByUserId(userId,storeId); if (list.size()>=2){ res.put("error","添加失败,最多只能添加两张子卡!"); return res; @@ -78,7 +86,8 @@ public class CardValudChildrensServiceImpl extends ServiceImpl selectCardValudChildrensByUserId(Integer storeId) { + public int edit(CardValudChildrens cardValudChildrens) { + int row = 0; + boolean flag = false; + String mobile = ""; + List list = this.selectCardValudChildrensByUserId(cardValudChildrens.getUserId(),cardValudChildrens.getStoreId()); + for (CardValudChildrens valudChildrens : list) { + if (cardValudChildrens.getCardChildPhones().equals(valudChildrens.getCardChildPhones())){ + if (cardValudChildrens.getId()!=valudChildrens.getId()){ + flag = true; + } + } + if (cardValudChildrens.getId()==valudChildrens.getId()){ + mobile = valudChildrens.getCardChildPhones(); + } + } + if (flag){ + row = 0; + return row; + } + LJUser user = userService.selectUserByMobile(mobile); + if (ObjectUtils.isNotEmpty(user)){ + user.setMobile(cardValudChildrens.getCardChildPhones()); + userService.updateById(user); + } + row = baseMapper.updateById(cardValudChildrens); + return row; + } + + @Override + public List selectCardValudChildrensByUserId(Integer userId,Integer storeId) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + if (userId==null){ + userId = nowAccountInfo.getId(); + } + if (storeId==null){ + storeId = nowAccountInfo.getStoreId(); + } LJStore store = storeService.selectStoreByStoreId(storeId); - UserBalance balance = userBalanceService.selectUserBalance(nowAccountInfo.getId(), store.getChainStoreId()); + UserBalance balance = userBalanceService.selectUserBalance(userId, store.getChainStoreId()); List list = null; if (ObjectUtils.isNotEmpty(balance)){ QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -101,6 +145,21 @@ public class CardValudChildrensServiceImpl extends ServiceImpl selectCardValudChildrensByUserIdAndStoreId(Integer userId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + LJStore store = storeService.selectStoreByStoreId(nowAccountInfo.getStoreId()); + UserBalance balance = userBalanceService.selectUserBalance(userId, store.getChainStoreId()); + List list = null; + if (ObjectUtils.isNotEmpty(balance)){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("card_value_id",balance.getId()); + queryWrapper.eq("store_id",nowAccountInfo.getStoreId()); + list = baseMapper.selectList(queryWrapper); + } + return list; + } + @Override public CardValudChildrens selectCardValueChildrenByMobileAndStoreId(String mobile, Integer storeId) { QueryWrapper queryWrapper = new QueryWrapper<>(); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml index 96cbe3bf3..78d808298 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml @@ -354,6 +354,7 @@ LEFT JOIN active_discount_child adc ON ad.id = adc.active_discount_id where ad.store_id = #{storeId} and adc.amount <= #{amount} + and ad.status = 0 - store_id = #{userGrade.storeId} + chain_store_id = #{userGrade.chainStoreId} order by grade diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/LJUserGradeService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/LJUserGradeService.java index 2c4ae4cf5..54779223e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/LJUserGradeService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/LJUserGradeService.java @@ -95,6 +95,8 @@ public interface LJUserGradeService extends IService { */ public int insertUserGrade(LJUserGrade userGrade,Integer storeId); + List selectUserGradeByChainStoreId(Integer chainStoreId); + /** * 修改会员等级信息 * @param userGrade diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserGradeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserGradeServiceImpl.java index 1800e49be..d70954804 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserGradeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserGradeServiceImpl.java @@ -34,11 +34,15 @@ import java.util.Map; @Service public class LJUserGradeServiceImpl extends ServiceImpl implements LJUserGradeService { + @Autowired + private ILJStoreService storeService; + @Override public IPage selectUserGradeList(Page page, LJUserGrade userGrade) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); Integer storeId = nowAccountInfo.getStoreId(); - userGrade.setStoreId(storeId); + LJStore store = storeService.selectStoreByStoreId(storeId); + userGrade.setChainStoreId(store.getChainStoreId()); IPage ljUserGradeIPage = baseMapper.selectUserGradeList(page, userGrade); for (LJUserGrade record : ljUserGradeIPage.getRecords()) { if (StringUtils.isNotEmpty(record.getGasolineRule())){ @@ -56,9 +60,10 @@ public class LJUserGradeServiceImpl extends ServiceImpl selectUserGradeAll(int storeId) { + LJStore store = storeService.selectStoreByStoreId(storeId); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("status","qy"); - queryWrapper.eq("store_id",storeId); + queryWrapper.eq("chain_store_id",store.getChainStoreId()); return baseMapper.selectList(queryWrapper); } @@ -71,9 +76,10 @@ public class LJUserGradeServiceImpl extends ServiceImpl selectUserGradeAllByStoreId(int storeId) { + LJStore store = storeService.selectStoreByStoreId(storeId); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("status","qy"); - queryWrapper.eq("store_id",storeId); + queryWrapper.eq("chain_store_id",store.getChainStoreId()); queryWrapper.orderByAsc("grade"); return baseMapper.selectList(queryWrapper); } @@ -86,14 +92,13 @@ public class LJUserGradeServiceImpl extends ServiceImpl(); - queryWrapper.eq("store_id",nowAccountInfo.getStoreId()); + queryWrapper.eq("chain_store_id",store.getChainStoreId()); queryWrapper.eq("id",id); return baseMapper.selectOne(queryWrapper); } - @Autowired - private ILJStoreService storeService; @Autowired private ChainStoreConfigService chainStoreConfigService; @Autowired @@ -145,8 +150,9 @@ public class LJUserGradeServiceImpl extends ServiceImpl(); - queryWrapper.eq("store_id",storeId); + queryWrapper.eq("chain_store_id",store.getChainStoreId()); queryWrapper.orderByAsc("grade"); List list = baseMapper.selectList(queryWrapper); return list.get(0); @@ -183,11 +189,14 @@ public class LJUserGradeServiceImpl extends ServiceImpl selectUserGradeByChainStoreId(Integer chainStoreId) { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("chain_store_id",chainStoreId); + return baseMapper.selectList(queryWrapper); + } + @Override public int updateUserGrade(LJUserGrade userGrade) { - int row = baseMapper.updateById(userGrade); + int row = 0; + boolean flag = false; + LJStore store = storeService.selectStoreByStoreId(userGrade.getStoreId()); + List ljUserGrades = this.selectUserGradeByChainStoreId(store.getChainStoreId()); + for (LJUserGrade ljUserGrade : ljUserGrades) { + if (ljUserGrade.getGrade().equals(userGrade.getGrade()) && ljUserGrade.getId()!=userGrade.getId()){ + row = 2; + flag = true; + } + if (ljUserGrade.getName().equals(userGrade.getName()) && ljUserGrade.getId()!=userGrade.getId()){ + row = 3; + flag = true; + } + if (ljUserGrade.getGrowthValue().equals(userGrade.getGrowthValue()) && ljUserGrade.getId()!=userGrade.getId()){ + row = 4; + flag = true; + } + } + if (flag) { + return row; + } + row = baseMapper.updateById(userGrade); return row; } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java index 265ce6b59..bf8725bff 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java @@ -253,20 +253,27 @@ public class SysDeptServiceImpl extends ServiceImpl imple QRCode qrCode = new QRCode(); iqrCodeService.insertQRCode(qrCode,store.getId()); - LJUserGrade userGrade = new LJUserGrade(); - userGrade.setStoreId(store.getId()); - userGrade.setGrade(1); - userGrade.setName("普通会员"); - userGrade.setStatus("qy"); - userGrade.setGrowthValue(1); - userGrade.setPreferential("自定义优惠"); - userGrade.setGasolineDiscount("无优惠"); - userGrade.setGasolineRule("[{\"gasolineRule1\":1,\"gasolineRule2\":1,\"gasolineRule3\":1}]"); - userGrade.setDieselDiscount("无优惠"); - userGrade.setDieselRule("[{\"dieselRule1\":1,\"dieselRule2\":1,\"dieselRule3\":1}]"); - userGrade.setNaturalGasDiscount("无优惠"); - userGrade.setNaturalGasRule("[{\"naturalGas1\":1,\"naturalGas2\":1,\"naturalGas3\":1}]"); - userGradeService.insertUserGrade(userGrade,store.getId()); + +// 判断当前连锁店是否存在会员等级信息 不存在则添加一个默认的等级 + List ljUserGrades = userGradeService.selectUserGradeByChainStoreId(chainStoreInfo.getId()); + if (ljUserGrades.size()==0){ + LJUserGrade userGrade = new LJUserGrade(); + userGrade.setStoreId(store.getId()); + userGrade.setChainStoreId(chainStoreInfo.getId()); + userGrade.setGrade(1); + userGrade.setName("普通会员"); + userGrade.setStatus("qy"); + userGrade.setGrowthValue(1); + userGrade.setPreferential("自定义优惠"); + userGrade.setGasolineDiscount("无优惠"); + userGrade.setGasolineRule("[{\"gasolineRule1\":1,\"gasolineRule2\":1,\"gasolineRule3\":1}]"); + userGrade.setDieselDiscount("无优惠"); + userGrade.setDieselRule("[{\"dieselRule1\":1,\"dieselRule2\":1,\"dieselRule3\":1}]"); + userGrade.setNaturalGasDiscount("无优惠"); + userGrade.setNaturalGasRule("[{\"naturalGas1\":1,\"naturalGas2\":1,\"naturalGas3\":1}]"); + userGradeService.insertUserGrade(userGrade,store.getId()); + } + }else { throw new Exception("数据有误,请联系管理员"); diff --git a/gasStation-uni/pagesRefuel/orderDetail/index.vue b/gasStation-uni/pagesRefuel/orderDetail/index.vue index 1938d284a..5a537442e 100644 --- a/gasStation-uni/pagesRefuel/orderDetail/index.vue +++ b/gasStation-uni/pagesRefuel/orderDetail/index.vue @@ -691,6 +691,7 @@ } _this.user = res.data.userVo; _this.user = res.data.userVo; + console.log(res.data.userVo.refuelMoney); if (res.data.userVo.refuelMoney!=null && res.data.userVo.refuelMoney!=""){ _this.refuelMoney = JSON.parse(res.data.userVo.refuelMoney) _this.chooseRefuelMoney()