diff --git a/fuintAdmin/src/api/staff/user/user.js b/fuintAdmin/src/api/staff/user/user.js index 9a4171acb..c780ce0fd 100644 --- a/fuintAdmin/src/api/staff/user/user.js +++ b/fuintAdmin/src/api/staff/user/user.js @@ -42,6 +42,14 @@ export function getUserMobile(data) { data: data }) } +// 根据手机号查询会员详细 +export function getUserPhone(data) { + return request({ + url: '/business/userManager/user/phone' , + method: 'post', + data: data + }) +} // 新增会员 export function addUser(data) { diff --git a/fuintAdmin/src/views/member/fixingLevel.vue b/fuintAdmin/src/views/member/fixingLevel.vue index 372c53b6d..7bf02fcee 100644 --- a/fuintAdmin/src/views/member/fixingLevel.vue +++ b/fuintAdmin/src/views/member/fixingLevel.vue @@ -38,18 +38,18 @@ /> - - - + + + + + + + + + + + + 搜索 @@ -73,18 +73,18 @@ /> - - - + + + + + + + + + + + + 搜索 diff --git a/fuintAdmin/src/views/member/index.vue b/fuintAdmin/src/views/member/index.vue index f5b5950dc..e1bf90fe3 100644 --- a/fuintAdmin/src/views/member/index.vue +++ b/fuintAdmin/src/views/member/index.vue @@ -2,11 +2,11 @@ - - - - - + + + + + { - if(response.data!=null){ + getUserPhone({mobile:this.form.mobile}).then( response => { + if(response.data){ this.$modal.msgError("手机号已存在"); }else { addUser(this.form).then(response => { diff --git a/fuintAdmin/src/views/member/userInfo.vue b/fuintAdmin/src/views/member/userInfo.vue index 581a1758f..b6aee601f 100644 --- a/fuintAdmin/src/views/member/userInfo.vue +++ b/fuintAdmin/src/views/member/userInfo.vue @@ -14,7 +14,7 @@ - + 绑定实体卡 @@ -29,7 +29,7 @@ {{form.name ? form.name : "--"}} {{form.idcard ? form.idcard : "--"}} - -- + @@ -43,10 +43,10 @@ {{ grade.name }} - -- - - 跟随全局总配置 - + + + + {{form.fixingLevel ? fixingLevelinfo(fixingLevelList,form.fixingLevel) : "--"}} @@ -716,6 +716,7 @@ export default { dicts: ['official','zhzt','zcrzdj','payment_type'], data(){ return{ + baseUrl:process.env.VUE_APP_BASE_API, flag:null, fixingLevelList:[], // 充值余额列表 diff --git a/fuintAdmin/src/views/staff/list.vue b/fuintAdmin/src/views/staff/list.vue index b797f9420..a8e53cec6 100644 --- a/fuintAdmin/src/views/staff/list.vue +++ b/fuintAdmin/src/views/staff/list.vue @@ -166,18 +166,18 @@ - - - - - - + v-for="item in roleList" + :key="item.dutyId" + :label="item.dutyName" + :value="item.dutyId" + > + + + + + + @@ -569,7 +569,7 @@ :title="title" :visible.sync="dialogVisible" style="margin-top: 100px" - width="20%"> + width="23%"> @@ -987,8 +987,8 @@ export default { margin-bottom: 20px; } .qrcode{ - width: 200px; - height: 300px; + width: 80%; + margin: 0 auto; margin-top: 15px; } diff --git a/fuintAdmin_zt/src/api/indexBanner/indexBanner.js b/fuintAdmin_zt/src/api/indexBanner/indexBanner.js index 1a6dccc18..22dc0e19f 100644 --- a/fuintAdmin_zt/src/api/indexBanner/indexBanner.js +++ b/fuintAdmin_zt/src/api/indexBanner/indexBanner.js @@ -29,7 +29,7 @@ export function addIndexBanner(data) { // 修改首页轮播图信息 export function updateIndexBanner(data) { return request({ - url: '/business/indexBanner/lists', + url: '/business/indexBanner', method: 'put', data: data }) diff --git a/fuintAdmin_zt/src/views/indexBanner/imgUpload/imgUpload.vue b/fuintAdmin_zt/src/views/indexBanner/imgUpload/imgUpload.vue new file mode 100644 index 000000000..95efb7dde --- /dev/null +++ b/fuintAdmin_zt/src/views/indexBanner/imgUpload/imgUpload.vue @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + 请上传 + 大小不超过 {{ fileSize }}MB + 格式为 {{ fileType.join("/") }} + 的文件 + + + + + + + + + + + + + + + + + + + diff --git a/fuintAdmin_zt/src/views/indexBanner/index.vue b/fuintAdmin_zt/src/views/indexBanner/index.vue index c98fa5f54..ff255dec4 100644 --- a/fuintAdmin_zt/src/views/indexBanner/index.vue +++ b/fuintAdmin_zt/src/views/indexBanner/index.vue @@ -2,19 +2,18 @@ - - + + + + - + {{scope.row.storeId ? storeName(storeList,scope.row.storeId) : "--"}} - + + + -- + + + @@ -57,7 +61,7 @@ size="mini" type="text" icon="el-icon-edit" - @click="handleUpdate(scope.row)" + @click="handleUpdate(scope.row.id)" >修改 - 这是一段信息 + + + + + + + + + + + + + + + + - 取 消 - 确 定 + 取 消 + 确 定 @@ -92,10 +113,18 @@ diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java index 773a411ac..19e37f117 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java @@ -1,5 +1,6 @@ package com.fuint.api.fuyou.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.api.fuyou.entity.FuYouPublicMerchant; @@ -128,7 +129,12 @@ public class MerchantConfigServiceImpl extends ServiceImpl implemen */ @Override public List selectDutyList() { - return baseMapper.selectList(null); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("duty_type","4"); + return baseMapper.selectList(queryWrapper); } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJStaffServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJStaffServiceImpl.java index 45565136a..7ff4952f7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJStaffServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJStaffServiceImpl.java @@ -108,7 +108,7 @@ public class LJStaffServiceImpl extends ServiceImpl impl @Override public void deleteStaffByIds(Integer[] ids) { for (int id : ids){ - baseMapper.deleteById(id); + this.deleteStaffById(id); } } @@ -118,6 +118,8 @@ public class LJStaffServiceImpl extends ServiceImpl impl */ @Override public void deleteStaffById(Integer id) { + LJStaff staff = this.selectStaffById(id); + accountService.deleteAccountByUserName(staff.getMobile()); baseMapper.deleteById(id); } @@ -152,7 +154,7 @@ public class LJStaffServiceImpl extends ServiceImpl impl account.setAccountName(staff.getMobile()); account.setAccountStatus(1); account.setRealName(staff.getRealName()); - account.setRoleIds("0"); + account.setRoleIds(staff.getRoleId()); account.setStaffId(staff1.getId()); account.setCreateTime(new Date()); account.setUpdateTime(new Date()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index 3592729a1..e5280584c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -743,8 +743,8 @@ public class OilOrderServiceImpl extends ServiceImpl i oilOrder.setTankId(tankId); - Map applet = null; - + Map applet = new HashMap<>(); + applet.put("success",""); if (!map.get("payAmount").equals("0")) { // 调用支付接口 // 判断是否开启支付规则 @@ -777,6 +777,7 @@ public class OilOrderServiceImpl extends ServiceImpl i oilOrder.setPayTime(new Date()); oilOrder.setOrderStatus("paid"); baseMapper.updateById(oilOrder); + applet.put("success","ok"); } return applet; } @@ -885,7 +886,7 @@ public class OilOrderServiceImpl extends ServiceImpl i Integer dieselGrowthValue = null; Integer naturalGrowthValue = null; LJStore store = storeService.selectStoreByStoreId(storeId); - UserBalance balance = userBalanceService.selectUserBalanceByStorId(userid,storeId); + UserBalance balance = userBalanceService.selectUserBalance(userid,store.getChainStoreId()); int growth = balance.getGrowthValue(); balance.setRefuelMoney(refuelMoney); // 查询会员等级列表信息 @@ -944,15 +945,18 @@ public class OilOrderServiceImpl extends ServiceImpl i AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); // 根据用户id查询用户余额信息 LJStore store = storeService.selectStoreByStoreId(storeId); - UserBalance balance = userBalanceService.selectUserBalanceByStorId(userId,storeId); -// 修改余额信息 - Double beforeBalance = balance.getCardBalance(); - Double afterBalance = beforeBalance - amount; - balance.setCardBalance(afterBalance); + UserBalance balance = userBalanceService.selectUserBalance(userId,store.getChainStoreId()); + if (ObjectUtil.isNotEmpty(balance)){ + // 修改余额信息 + Double beforeBalance = balance.getCardBalance(); + Double afterBalance = beforeBalance - amount; + balance.setCardBalance(afterBalance); // 修改加油次数 - Integer consumeNum = balance.getConsumeNum(); - balance.setConsumeNum(consumeNum+1); - userBalanceService.updateUserBalance(balance); + Integer consumeNum = balance.getConsumeNum(); + balance.setConsumeNum(consumeNum+1); + userBalanceService.updateUserBalance(balance); + } + // 添加余额记录信息 CardBalanceChange cardBalanceChange = new CardBalanceChange(); cardBalanceChange.setUserId(userId); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/ExportController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/ExportController.java index e1f584a3f..7ce8af284 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/ExportController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/ExportController.java @@ -57,7 +57,7 @@ public class ExportController extends BaseController{ if (list.size() >= 1) { for (int i = 0; i < list.size(); i++) { LJUserVo user = (LJUserVo) list.get(i); - LJUser user1 = service.selectUserByMobile(user.getMobile()); + LJUserVo user1 = service.selectUserByMobileAndChantStoreId(user.getMobile()); if (user1!=null){ repeat += 1; }else { diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserController.java index 263b6be9f..b547f876b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserController.java @@ -113,6 +113,17 @@ public class LJUserController extends BaseController { return getSuccessResult(user); } + /** + * 根据storeId查询会员信息 + * @param storeId + * @return + */ + @GetMapping("/storeUser/{storeId}") + public ResponseObject userVoInfo(@PathVariable Integer storeId){ + LJUserVo user = userService.queryUserByStoreId(storeId); + return getSuccessResult(user); + } + @GetMapping("/getByUniApp") public ResponseObject getByUniApp(Integer chainStoreId){ LJUserVo user = userService.getByUniApp(chainStoreId); @@ -128,6 +139,18 @@ public class LJUserController extends BaseController { return getSuccessResult(userBalanceService.getUserBalance()); } + /** + * 根据手机号查询会员信息 + * @param map + * @return + */ + @PostMapping("/phone") + public ResponseObject userInfoByPhone(@Validated @RequestBody Map map){ + String mobile = map.get("mobile"); + LJUserVo user = userService.selectUserByMobileAndChantStoreId(mobile); + return getSuccessResult(user); + } + /** * 根据手机号查询会员信息 * @param map diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserGradeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserGradeController.java index 5fd7678dd..f3f2f3564 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserGradeController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserGradeController.java @@ -6,16 +6,19 @@ import com.fuint.business.userManager.entity.LJUserGrade; import com.fuint.business.userManager.service.LJUserGradeService; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; import java.util.Map; /** * 会员等级信息 controller层 */ @RestController +@Slf4j @RequestMapping("/business/userManager/userGrade") public class LJUserGradeController extends BaseController { @Autowired @@ -72,13 +75,21 @@ public class LJUserGradeController extends BaseController { /** * 根据id查询会员等级信息 - * @param id + * @param map * @return */ - @GetMapping("/isUse/{id}") - public ResponseObject userGrade(@PathVariable Integer id){ - LJUserGrade userGrade = userGradeService.selectUserGradeByIdIsUse(id); - return getSuccessResult(userGrade); + @PostMapping("/isUse") + public ResponseObject userGrade(@RequestBody Map map){ + Map map1 =new HashMap<>(); + try { + Integer userId = Integer.valueOf(map.get("userId")); + String storeId = map.get("storeId"); + String gradeId = map.get("gradeId"); + map1 = userGradeService.selectUserGradeByIdIsUse(userId, storeId, gradeId); + }catch (Exception e){ + log.error(e.getMessage()); + } + return getSuccessResult(map1); } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/LJUserMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/LJUserMapper.java index 2a860228c..05a76cf3a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/LJUserMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/LJUserMapper.java @@ -28,6 +28,13 @@ public interface LJUserMapper extends BaseMapper { */ public List queryUserList(@Param("storeId") int storeId); + /** + * 根据手机号和连锁店id查询会员信息 + * @param mobile + * @return + */ + public LJUserVo selectUserByMobileAndChantStoreId(@Param("mobile") String mobile,@Param("chainStoreId") int chainStoreId); + /** * 根据id查询用户信息 * @param id @@ -35,6 +42,13 @@ public interface LJUserMapper extends BaseMapper { */ public LJUserVo selectUserById(@Param("id") Integer id); + /** + * 根据连锁店id查询用户信息 + * @param chainStoreId + * @return + */ + public LJUserVo queryUserByChainStoreId(@Param("userId") int userId,@Param("chainStoreId") int chainStoreId); + /** * uniapp使用 * @param id diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml index 3bf11ae1c..18a2feca5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml @@ -4,22 +4,25 @@ select mu.*,mub.grade_id,mub.card_balance,mub.points,mub.consume_num,mub.growth_value,mub.refuel_money, mub.second_card,mub.fixing_level, - mi.storeId,mi.staffId,mi.inviterId,mi.chain_store_id from mt_user mu - left join mt_user_balance mub on mu.id = mub.mt_user_id - left join mt_invitation mi on mu.id = mi.userId + mi.storeId,mi.staffId,mi.inviterId,mub.chain_store_id from mt_user mu + inner join mt_user_balance mub on mu.id = mub.mt_user_id + inner join mt_invitation mi on mu.id = mi.userId + + + select mu.*,mub.grade_id,mub.card_balance,mub.points,mub.consume_num,mub.growth_value,mub.refuel_money, + mub.second_card,mub.fixing_level + FROM mt_user mu + LEFT JOIN mt_user_balance mub ON mu.id = mub.mt_user_id - + - and mi.chain_store_id = #{user.chainStoreId} + and mub.chain_store_id = #{user.chainStoreId} - and mi.storeId = #{user.storeId} - - - and mi.storeId = #{user.storeId} + and mub.store_id = #{user.storeId} and mu.mobile like concat('%', #{user.mobile}, '%') @@ -57,7 +60,7 @@ - + mu.mobile = #{mobile} @@ -70,6 +73,24 @@ + + select mu.*,mub.grade_id,mub.card_balance,mub.points,mub.consume_num,mub.growth_value,mub.refuel_money, + mub.second_card,mub.fixing_level,mub.chain_store_id from mt_user mu + inner join mt_user_balance mub on mu.id = mub.mt_user_id + + mu.mobile = #{mobile} and + mub.chain_store_id = #{chainStoreId} + + + + + + + mu.id = #{userId} and + mub.chain_store_id = #{chainStoreId} + + + select mu.*, mub.id balanceId, diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/CertifiedMemberService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/CertifiedMemberService.java index e3b6969f2..13adbcd48 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/CertifiedMemberService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/CertifiedMemberService.java @@ -24,12 +24,20 @@ public interface CertifiedMemberService extends IService { public CertifiedMember selectCertifiedMemberById(int id); /** - * 根据会员id查询认证会员信息 + * 根据会员id和店铺id查询认证会员信息 * @param userId * @return */ public CertifiedMember selectCertifiedMemberByUserId(int userId); + /** + * 根据会员id和店铺id查询认证会员信息 + * @param userId + * @param storeId + * @return + */ + public CertifiedMember selectCertifiedMemberByUserIdAndStoreId(int userId,String storeId); + /** * 根据固定等级id删除认证会员信息 * @param fixingLevelId 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 844c133d3..8e5c08285 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 @@ -7,6 +7,7 @@ import com.fuint.business.userManager.entity.LJUserGrade; import com.fuint.repository.model.MtUserGrade; import java.util.List; +import java.util.Map; /** * 会员等级信息 业务层 @@ -47,10 +48,12 @@ public interface LJUserGradeService extends IService { /** * 根据id查询会员等级信息是否可使用 - * @param id + * @param userId + * @param storeId + * @param gradeId * @return */ - public LJUserGrade selectUserGradeByIdIsUse(int id); + public Map selectUserGradeByIdIsUse(Integer userId, String storeId, String gradeId); /** * 根据会员等级名称查询会员等级信息 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/LJUserService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/LJUserService.java index 3b076b38a..7ef6b53ce 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/LJUserService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/LJUserService.java @@ -53,6 +53,20 @@ public interface LJUserService extends IService { */ public LJUserVo selectUserById(int id); + /** + * 根据storeId获取连锁店id 根据连锁店id查询用户信息 + * @param storeId + * @return + */ + public LJUserVo queryUserByStoreId(int storeId); + + /** + * 根据手机号和连锁店id查询会员信息 + * @param mobile + * @return + */ + public LJUserVo selectUserByMobileAndChantStoreId(String mobile); + public LJUserVo getByUniApp(Integer chainStoreId); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/CertifiedMemberServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/CertifiedMemberServiceImpl.java index 968db17e7..c5d5c795c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/CertifiedMemberServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/CertifiedMemberServiceImpl.java @@ -1,5 +1,6 @@ package com.fuint.business.userManager.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -10,6 +11,7 @@ import com.fuint.business.userManager.entity.LJUser; import com.fuint.business.userManager.mapper.CertifiedMemberMapper; import com.fuint.business.userManager.service.CertifiedMemberService; import com.fuint.business.userManager.service.LJUserService; +import com.fuint.business.userManager.vo.LJUserVo; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.StringUtils; import com.fuint.common.util.TokenUtil; @@ -57,14 +59,30 @@ public class CertifiedMemberServiceImpl extends ServiceImpl(); queryWrapper.eq("user_id",userId); + queryWrapper.eq("store_id",nowAccountInfo.getStoreId()); + CertifiedMember certifiedMember = baseMapper.selectOne(queryWrapper); + return certifiedMember; + } + + @Override + public CertifiedMember selectCertifiedMemberByUserIdAndStoreId(int userId, String storeId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("user_id",userId); + if (StringUtils.isNotEmpty(storeId)){ + queryWrapper.eq("store_id",storeId); + }else { + queryWrapper.eq("store_id",nowAccountInfo.getStoreId()); + } CertifiedMember certifiedMember = baseMapper.selectOne(queryWrapper); return certifiedMember; } @@ -113,8 +131,8 @@ public class CertifiedMemberServiceImpl extends ServiceImpl(); 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 6fe720dd9..b24b6d8c1 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 @@ -1,5 +1,6 @@ package com.fuint.business.userManager.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -9,10 +10,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.business.storeInformation.entity.LJStore; import com.fuint.business.storeInformation.service.ILJStoreService; +import com.fuint.business.userManager.entity.CertifiedMember; import com.fuint.business.userManager.entity.ChainStoreConfig; +import com.fuint.business.userManager.entity.FixingLevel; import com.fuint.business.userManager.entity.LJUserGrade; import com.fuint.business.userManager.mapper.LJUserGradeMapper; +import com.fuint.business.userManager.service.CertifiedMemberService; import com.fuint.business.userManager.service.ChainStoreConfigService; +import com.fuint.business.userManager.service.FixingLevelService; import com.fuint.business.userManager.service.LJUserGradeService; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.StringUtils; @@ -20,9 +25,12 @@ import com.fuint.common.util.TokenUtil; import com.fuint.repository.model.MtUserGrade; import com.fuint.system.config.service.SysConfigService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import java.util.HashMap; import java.util.List; +import java.util.Map; @Service public class LJUserGradeServiceImpl extends ServiceImpl implements LJUserGradeService { @@ -79,21 +87,40 @@ public class LJUserGradeServiceImpl extends ServiceImpl selectUserGradeByIdIsUse(Integer userId, String storeId, String gradeId) { + Map res = new HashMap<>(); +// 查询此会员是否认证固定等级信息 + CertifiedMember certifiedMember = certifiedMemberService.selectCertifiedMemberByUserIdAndStoreId(userId, storeId); + if (ObjectUtil.isNotEmpty(certifiedMember)){ + FixingLevel fixingLevel = fixingLevelService.selectFixingLevelById(certifiedMember.getFixingLevelId()); + if (fixingLevel.getStatus().equals("qy")){ + res.put("fixingLevel",fixingLevel); + } + }else { + LJStore store = storeService.selectStoreById(); + ChainStoreConfig chainStoreConfig = chainStoreConfigService.selectChainStoreById(store.getChainStoreId()); + String isEnableLevel = chainStoreConfig.getIsEnableLevel(); + if (isEnableLevel.equals("yes")){ + if (StringUtils.isNotEmpty(gradeId)){ + LJUserGrade ljUserGrade = baseMapper.selectById(Integer.valueOf(gradeId)); + if (ljUserGrade.getStatus().equals("qy")){ + res.put("userGrade",baseMapper.selectById(Integer.valueOf(gradeId))); + return res; + }else { + return null; + } + } } } - return null; + return res; } @Override diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java index 69f8b1964..51778de96 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java @@ -130,6 +130,24 @@ public class LJUserServiceImpl extends ServiceImpl impleme return baseMapper.selectUserById(id); } + @Override + public LJUserVo queryUserByStoreId(int storeId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + LJStore store = storeService.selectStoreByStoreId(storeId); + return baseMapper.queryUserByChainStoreId(nowAccountInfo.getId(),store.getChainStoreId()); + } + + @Override + public LJUserVo selectUserByMobileAndChantStoreId(String mobile) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + LJStore store = storeService.selectStoreByStoreId(nowAccountInfo.getStoreId()); + LJUserVo ljUserVo = new LJUserVo(); + if (ObjectUtil.isNotEmpty(store)){ + ljUserVo = baseMapper.selectUserByMobileAndChantStoreId(mobile,store.getChainStoreId()); + } + return ljUserVo; + } + @Resource UserBalanceService userBalanceService; @@ -249,16 +267,24 @@ public class LJUserServiceImpl extends ServiceImpl impleme user1.setStatus(user.getStatus()); user1.setDescription(user.getDescription()); user1.setOfficial(user.getOfficial()); - int row = baseMapper.insert(user1); - -// 查询添加后的用户id + // 查询添加后的用户id LJUser ljUser = this.selectUserByMobile(user.getMobile()); + int row = 0; + if (ObjectUtil.isEmpty(ljUser)){ + row = baseMapper.insert(user1); + ljUser = this.selectUserByMobile(user.getMobile()); + } + +// 根据店铺id查询店铺所对应的连锁店id + LJStore store = storeService.selectStoreByStoreId(storeId); + // 添加用户储值卡信息 UserBalance balance = new UserBalance(); balance.setMtUserId(ljUser.getId()); balance.setCardBalance(user.getCardBalance()); balance.setPoints(user.getPoints()); balance.setStoreId(storeId); + balance.setChainStoreId(store.getChainStoreId()); if (user.getGradeId()!=null){ balance.setGradeId(user.getGradeId()); }else { @@ -270,17 +296,15 @@ public class LJUserServiceImpl extends ServiceImpl impleme balance.setFixingLevel(user.getFixingLevel()); balanceService.insertUserBalance(balance); Integer chainStoreId = null; -// 根据店铺id查询店铺所对应的连锁店id - LJStore store = storeService.selectStoreByStoreId(storeId); - if (!ObjectUtil.isEmpty(store)){ - chainStoreId = store.getChainStoreId(); - } // 添加邀请注册信息 MtInvitation invitation = new MtInvitation(); + if (ObjectUtil.isNotEmpty(store)){ + chainStoreId = store.getChainStoreId(); + invitation.setChainStoreId(chainStoreId); + } invitation.setUserId(ljUser.getId()); invitation.setStoreId(storeId); invitation.setStaffId(nowAccountInfo.getStaffId()); - invitation.setChainStoreId(chainStoreId); invitation.setStatus("qy"); invitationMapper.insert(invitation); return row; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java index 9f0d3bad0..a26173a28 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java @@ -61,6 +61,12 @@ public interface AccountService extends IService { */ TAccount selectAccountByUserName(String accountName); + /** + * 根据用户名删除账户信息 + * @param accountName + */ + void deleteAccountByUserName(String accountName); + /** * 获取账号角色ID * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java index fed4873af..99fc8659b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java @@ -208,6 +208,7 @@ public class AccountServiceImpl extends ServiceImpl im account.setStoreId(tAccount.getStoreId()); account.setDeptId(tAccount.getDeptId()); account.setPassword(tAccount.getPassword()); + account.setStaffId(tAccount.getStaffId()); this.entryptPassword(account); int id = tAccountMapper.insert(account); @@ -234,6 +235,14 @@ public class AccountServiceImpl extends ServiceImpl im return baseMapper.selectOne(queryWrapper); } + @Override + public void deleteAccountByUserName(String accountName) { + TAccount tAccount = this.selectAccountByUserName(accountName); + if (ObjectUtil.isNotEmpty(tAccount)){ + baseMapper.deleteById(tAccount.getAcctId()); + } + } + /** * 获取账号角色ID * diff --git a/fuintBackend/fuint-application/src/main/resources/application.properties b/fuintBackend/fuint-application/src/main/resources/application.properties index ea3374b24..486e6e578 100644 --- a/fuintBackend/fuint-application/src/main/resources/application.properties +++ b/fuintBackend/fuint-application/src/main/resources/application.properties @@ -1,8 +1,8 @@ # \u57FA\u672C\u914D\u7F6E -server.port=8008 +server.port=8080 env.profile=dev #env.properties.path=D:/workspaces/oilSystem/fuintBackend/configure/ -env.properties.path=D:/code/oilSystem/fuintBackend/configure/ +env.properties.path=D:/workspaces/oilSystem/fuintBackend/configure/ diff --git a/fuintCashierWeb/src/api/cashier/user.js b/fuintCashierWeb/src/api/cashier/user.js index dee7cc37d..548f91d6a 100644 --- a/fuintCashierWeb/src/api/cashier/user.js +++ b/fuintCashierWeb/src/api/cashier/user.js @@ -26,6 +26,15 @@ export function getUserVoMobile(data) { }) } +// 根据手机号查询会员详细 +export function getUserInfoMobile(data) { + return request({ + url: '/business/userManager/user/phone', + method: 'post', + data: data + }) +} + // 根据手机号查询会员详细 export function getUserVoName(data) { return request({ diff --git a/fuintCashierWeb/src/api/cashier/usergrade.js b/fuintCashierWeb/src/api/cashier/usergrade.js index b2147500a..5757a43cd 100644 --- a/fuintCashierWeb/src/api/cashier/usergrade.js +++ b/fuintCashierWeb/src/api/cashier/usergrade.js @@ -18,10 +18,11 @@ export function getUserGrade(id) { } // 查询会员等级详细是否能使用 -export function userGradeInfo(id) { +export function userGradeInfo(data) { return request({ - url: '/business/userManager/userGrade/isUse/' + id, - method: 'get' + url: '/business/userManager/userGrade/isUse', + method: 'post', + data:data, }) } diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue index f230f5f0f..5ed28099d 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue @@ -786,7 +786,7 @@ import {getDicts} from "@/api/dict/data"; import {getOilNameList, getOilNumGun, listOilNumGun} from "@/api/cashier/oilnumgun"; import {listgoods} from "@/api/cashier/ljgoods"; - import {getUserVoMobile, getUserVoName} from "@/api/cashier/user"; + import {getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/user"; import {queryStaffs, staffInfo} from "@/api/cashier/staff"; import {addLJGoods, goodsOrder, oilOrder, scanAppletQrCode} from "@/api/cashier/oilorder"; import {getUserGrade, listUserGrade, userGradeInfo} from "@/api/cashier/usergrade"; @@ -1451,228 +1451,456 @@ this.handleChange(); }, // 根据会员等级信息获取等级优惠信息 - getGrade(id){ + getGrade(userId,gradeId){ let _this = this; this.oilDiscount = 0; this.gradeDiscount = []; - userGradeInfo(id).then(response => { + userGradeInfo({userId:userId,gradeId:gradeId,storeId:""}).then(response => { let gasolineDiscount = 0; let dieselDiscount = 0; let naturalGasDiscount = 0; _this.gradeDiscount = []; - if (response.data!=null) { + if (response.data) { _this.oilOrder.forEach(item => { let discount = {type: "", full: 0, reduce: 0, liters: 0} if (item.type == "汽油") { - let gasolineRule = JSON.parse(response.data.gasolineRule).sort((a,b) => a.gasolineRule1 - b.gasolineRule1); - if (response.data.preferential == '自定义优惠' && response.data.status == 'qy') { - if (response.data.gasolineDiscount == "满减优惠") { - let oilDiscount = 0; - discount.type = "满减优惠" - for (let i = 1; i <= gasolineRule.length; i++) { - // 将满减条件加入等级优惠列表 - if (gasolineRule.length > 1) { - if (item.amount >= gasolineRule[gasolineRule.length - 1].gasolineRule1) { - discount.full = gasolineRule[gasolineRule.length - 1].gasolineRule1 - oilDiscount = gasolineRule[gasolineRule.length - 1].gasolineRule2 - discount.reduce = gasolineRule[gasolineRule.length - 1].gasolineRule2 - break; - } - if (item.amount >= gasolineRule[i - 1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1) { - discount.full = gasolineRule[i - 1].gasolineRule1 - oilDiscount = gasolineRule[i - 1].gasolineRule2 - discount.reduce = gasolineRule[i - 1].gasolineRule2 - } - } else { - if (item.amount >= gasolineRule[i - 1].gasolineRule1) { - discount.full = gasolineRule[i - 1].gasolineRule1 - oilDiscount = gasolineRule[i - 1].gasolineRule2 - discount.reduce = gasolineRule[i - 1].gasolineRule2 + if (response.data.fixingLevel){ + let gasolineRule = JSON.parse(response.data.fixingLevel.gasolineRule).sort((a, b) => a.gasolineRule1 - b.gasolineRule1); + if (response.data.fixingLevel.discountType == '自定义优惠' && response.data.fixingLevel.status == 'qy') { + if (response.data.fixingLevel.gasolineDiscount == "满减优惠") { + let oilDiscount = 0; + discount.type = "满减优惠" + for (let i = 1; i <= gasolineRule.length; i++) { + // 将满减条件加入等级优惠列表 + if (gasolineRule.length > 1) { + if (item.amount >= gasolineRule[gasolineRule.length - 1].gasolineRule1) { + discount.full = gasolineRule[gasolineRule.length - 1].gasolineRule1 + oilDiscount = gasolineRule[gasolineRule.length - 1].gasolineRule2 + discount.reduce = gasolineRule[gasolineRule.length - 1].gasolineRule2 + break; + } + if (item.amount >= gasolineRule[i - 1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1) { + discount.full = gasolineRule[i - 1].gasolineRule1 + oilDiscount = gasolineRule[i - 1].gasolineRule2 + discount.reduce = gasolineRule[i - 1].gasolineRule2 + } + } else { + if (item.amount >= gasolineRule[i - 1].gasolineRule1) { + discount.full = gasolineRule[i - 1].gasolineRule1 + oilDiscount = gasolineRule[i - 1].gasolineRule2 + discount.reduce = gasolineRule[i - 1].gasolineRule2 + } } } - } - if (discount.reduce != 0) { - _this.gradeDiscount.push(discount) - _this.checkedCities2.push('满减优惠') - } - gasolineDiscount += +oilDiscount - } else if (response.data.gasolineDiscount == "每升优惠") { - discount.type = "每升优惠" - let oilDiscount = 0; - for (let i = 1; i <= gasolineRule.length; i++) { - // 将满减条件加入等级优惠列表 - if (gasolineRule.length > 1) { - if (item.amount >= gasolineRule[gasolineRule.length - 1].gasolineRule1) { - discount.full = gasolineRule[gasolineRule.length - 1].gasolineRule1 - oilDiscount = (item.liters * gasolineRule[gasolineRule.length - 1].gasolineRule3).toFixed(2); - discount.reduce = (item.liters * gasolineRule[gasolineRule.length - 1].gasolineRule3).toFixed(2); - discount.liters = gasolineRule[i - 1].gasolineRule3 - break; - } - if (item.amount >= gasolineRule[i - 1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1) { - discount.full = gasolineRule[i - 1].gasolineRule1 - oilDiscount = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) - discount.reduce = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) - discount.liters = gasolineRule[i - 1].gasolineRule3 - } - } else { - if (item.amount >= gasolineRule[i - 1].gasolineRule1) { - discount.full = gasolineRule[i - 1].gasolineRule1 - oilDiscount = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) - discount.reduce = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) - discount.liters = gasolineRule[i - 1].gasolineRule3 + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('满减优惠') + } + gasolineDiscount += +oilDiscount + } else if (response.data.fixingLevel.gasolineDiscount == "每升优惠") { + discount.type = "每升优惠" + let oilDiscount = 0; + for (let i = 1; i <= gasolineRule.length; i++) { + // 将满减条件加入等级优惠列表 + if (gasolineRule.length > 1) { + if (item.amount >= gasolineRule[gasolineRule.length - 1].gasolineRule1) { + discount.full = gasolineRule[gasolineRule.length - 1].gasolineRule1 + oilDiscount = (item.liters * gasolineRule[gasolineRule.length - 1].gasolineRule3).toFixed(2); + discount.reduce = (item.liters * gasolineRule[gasolineRule.length - 1].gasolineRule3).toFixed(2); + discount.liters = gasolineRule[i - 1].gasolineRule3 + break; + } + if (item.amount >= gasolineRule[i - 1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1) { + discount.full = gasolineRule[i - 1].gasolineRule1 + oilDiscount = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) + discount.reduce = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) + discount.liters = gasolineRule[i - 1].gasolineRule3 + } + } else { + if (item.amount >= gasolineRule[i - 1].gasolineRule1) { + discount.full = gasolineRule[i - 1].gasolineRule1 + oilDiscount = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) + discount.reduce = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) + discount.liters = gasolineRule[i - 1].gasolineRule3 + } } } + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('每升优惠') + } + gasolineDiscount += +oilDiscount + } else { + gasolineDiscount = 0; } - if (discount.reduce != 0) { - _this.gradeDiscount.push(discount) - _this.checkedCities2.push('每升优惠') + } + + }else { + if (response.data.userGrade) { + let gasolineRule = JSON.parse(response.data.userGrade.gasolineRule).sort((a, b) => a.gasolineRule1 - b.gasolineRule1); + if (response.data.userGrade.preferential == '自定义优惠' && response.data.userGrade.status == 'qy') { + if (response.data.userGrade.gasolineDiscount == "满减优惠") { + let oilDiscount = 0; + discount.type = "满减优惠" + for (let i = 1; i <= gasolineRule.length; i++) { + // 将满减条件加入等级优惠列表 + if (gasolineRule.length > 1) { + if (item.amount >= gasolineRule[gasolineRule.length - 1].gasolineRule1) { + discount.full = gasolineRule[gasolineRule.length - 1].gasolineRule1 + oilDiscount = gasolineRule[gasolineRule.length - 1].gasolineRule2 + discount.reduce = gasolineRule[gasolineRule.length - 1].gasolineRule2 + break; + } + if (item.amount >= gasolineRule[i - 1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1) { + discount.full = gasolineRule[i - 1].gasolineRule1 + oilDiscount = gasolineRule[i - 1].gasolineRule2 + discount.reduce = gasolineRule[i - 1].gasolineRule2 + } + } else { + if (item.amount >= gasolineRule[i - 1].gasolineRule1) { + discount.full = gasolineRule[i - 1].gasolineRule1 + oilDiscount = gasolineRule[i - 1].gasolineRule2 + discount.reduce = gasolineRule[i - 1].gasolineRule2 + } + } + } + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('满减优惠') + } + gasolineDiscount += +oilDiscount + } else if (response.data.userGrade.gasolineDiscount == "每升优惠") { + discount.type = "每升优惠" + let oilDiscount = 0; + for (let i = 1; i <= gasolineRule.length; i++) { + // 将满减条件加入等级优惠列表 + if (gasolineRule.length > 1) { + if (item.amount >= gasolineRule[gasolineRule.length - 1].gasolineRule1) { + discount.full = gasolineRule[gasolineRule.length - 1].gasolineRule1 + oilDiscount = (item.liters * gasolineRule[gasolineRule.length - 1].gasolineRule3).toFixed(2); + discount.reduce = (item.liters * gasolineRule[gasolineRule.length - 1].gasolineRule3).toFixed(2); + discount.liters = gasolineRule[i - 1].gasolineRule3 + break; + } + if (item.amount >= gasolineRule[i - 1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1) { + discount.full = gasolineRule[i - 1].gasolineRule1 + oilDiscount = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) + discount.reduce = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) + discount.liters = gasolineRule[i - 1].gasolineRule3 + } + } else { + if (item.amount >= gasolineRule[i - 1].gasolineRule1) { + discount.full = gasolineRule[i - 1].gasolineRule1 + oilDiscount = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) + discount.reduce = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) + discount.liters = gasolineRule[i - 1].gasolineRule3 + } + } + } + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('每升优惠') + } + gasolineDiscount += +oilDiscount + } else { + gasolineDiscount = 0; + } } - gasolineDiscount += +oilDiscount - } else { - gasolineDiscount = 0; + } } } if (item.type == "柴油") { - let dieselRule = JSON.parse(response.data.dieselRule).sort((a,b) => a.dieselRule1 - b.dieselRule1); - if (response.data.preferential == '自定义优惠' && response.data.status == 'qy') { - if (response.data.dieselDiscount == "满减优惠") { - let oilDiscount = 0; - discount.type = "满减优惠" - for (let i = 1; i <= dieselRule.length; i++) { - // 将满减条件加入等级优惠列表 - if (dieselRule.length > 1) { - if (item.amount >= dieselRule[dieselRule.length - 1].dieselRule1) { - discount.full = dieselRule[dieselRule.length - 1].dieselRule1 - oilDiscount = dieselRule[dieselRule.length - 1].dieselRule2 - discount.reduce = dieselRule[dieselRule.length - 1].dieselRule2 - break; - } - if (item.amount >= dieselRule[i - 1].dieselRule1 && item.amount < dieselRule[i].dieselRule1) { + if (response.data.fixingLevel){ + let dieselRule = JSON.parse(response.data.fixingLevel.dieselRule).sort((a, b) => a.dieselRule1 - b.dieselRule1); + if (response.data.fixingLevel.discountType == '自定义优惠' && response.data.fixingLevel.status == 'qy') { + if (response.data.fixingLevel.dieselDiscount == "满减优惠") { + let oilDiscount = 0; + discount.type = "满减优惠" + for (let i = 1; i <= dieselRule.length; i++) { + // 将满减条件加入等级优惠列表 + if (dieselRule.length > 1) { + if (item.amount >= dieselRule[dieselRule.length - 1].dieselRule1) { + discount.full = dieselRule[dieselRule.length - 1].dieselRule1 + oilDiscount = dieselRule[dieselRule.length - 1].dieselRule2 + discount.reduce = dieselRule[dieselRule.length - 1].dieselRule2 + break; + } + if (item.amount >= dieselRule[i - 1].dieselRule1 && item.amount < dieselRule[i].dieselRule1) { + discount.full = dieselRule[i - 1].dieselRule1 + oilDiscount = dieselRule[i - 1].dieselRule2 + discount.reduce = dieselRule[i - 1].dieselRule2 + } + } else { discount.full = dieselRule[i - 1].dieselRule1 - oilDiscount = dieselRule[i - 1].dieselRule2 - discount.reduce = dieselRule[i - 1].dieselRule2 - } - } else { - discount.full = dieselRule[i - 1].dieselRule1 - if (item.amount >= dieselRule[i - 1].dieselRule1) { - oilDiscount = dieselRule[i - 1].dieselRule2 - discount.reduce = dieselRule[i - 1].dieselRule2 + if (item.amount >= dieselRule[i - 1].dieselRule1) { + oilDiscount = dieselRule[i - 1].dieselRule2 + discount.reduce = dieselRule[i - 1].dieselRule2 + } } } - } - if (discount.reduce != 0) { - _this.gradeDiscount.push(discount) - _this.checkedCities2.push('满减优惠') - } - dieselDiscount += +oilDiscount - } else if (response.data.dieselDiscount == "每升优惠") { - let oilDiscount = 0; - for (let i = 1; i <= dieselRule.length; i++) { - discount.type = "每升优惠" - // 将满减条件加入等级优惠列表 - if (dieselRule.length > 1) { - if (item.amount >= dieselRule[dieselRule.length - 1].dieselRule1) { - discount.full = dieselRule[dieselRule.length - 1].dieselRule1 - oilDiscount = (item.liters * dieselRule[dieselRule.length - 1].dieselRule3).toFixed(2); - discount.reduce = (item.liters * dieselRule[dieselRule.length - 1].dieselRule3).toFixed(2); - discount.liters = dieselRule[dieselRule.length - 1].dieselRule3 - break; - } - if (item.amount >= dieselRule[i - 1].dieselRule1 && item.amount < dieselRule[i].dieselRule1) { + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('满减优惠') + } + dieselDiscount += +oilDiscount + } else if (response.data.fixingLevel.dieselDiscount == "每升优惠") { + let oilDiscount = 0; + for (let i = 1; i <= dieselRule.length; i++) { + discount.type = "每升优惠" + // 将满减条件加入等级优惠列表 + if (dieselRule.length > 1) { + if (item.amount >= dieselRule[dieselRule.length - 1].dieselRule1) { + discount.full = dieselRule[dieselRule.length - 1].dieselRule1 + oilDiscount = (item.liters * dieselRule[dieselRule.length - 1].dieselRule3).toFixed(2); + discount.reduce = (item.liters * dieselRule[dieselRule.length - 1].dieselRule3).toFixed(2); + discount.liters = dieselRule[dieselRule.length - 1].dieselRule3 + break; + } + if (item.amount >= dieselRule[i - 1].dieselRule1 && item.amount < dieselRule[i].dieselRule1) { + discount.full = dieselRule[i - 1].dieselRule1 + oilDiscount = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) + discount.reduce = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) + discount.liters = dieselRule[i - 1].dieselRule3 + } + } else { discount.full = dieselRule[i - 1].dieselRule1 - oilDiscount = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) - discount.reduce = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) - discount.liters = dieselRule[i - 1].dieselRule3 - } - } else { - discount.full = dieselRule[i - 1].dieselRule1 - if (item.amount >= dieselRule[i - 1].dieselRule1) { - oilDiscount = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) - discount.reduce = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) - discount.liters = dieselRule[i - 1].dieselRule3 + if (item.amount >= dieselRule[i - 1].dieselRule1) { + oilDiscount = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) + discount.reduce = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) + discount.liters = dieselRule[i - 1].dieselRule3 + } } } + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('每升优惠') + } + dieselDiscount += +oilDiscount + } else { + dieselDiscount = 0; } - if (discount.reduce != 0) { - _this.gradeDiscount.push(discount) - _this.checkedCities2.push('每升优惠') + } + + }else { + if (response.data.userGrade) { + let dieselRule = JSON.parse(response.data.userGrade.dieselRule).sort((a, b) => a.dieselRule1 - b.dieselRule1); + if (response.data.userGrade.preferential == '自定义优惠' && response.data.userGrade.status == 'qy') { + if (response.data.userGrade.dieselDiscount == "满减优惠") { + let oilDiscount = 0; + discount.type = "满减优惠" + for (let i = 1; i <= dieselRule.length; i++) { + // 将满减条件加入等级优惠列表 + if (dieselRule.length > 1) { + if (item.amount >= dieselRule[dieselRule.length - 1].dieselRule1) { + discount.full = dieselRule[dieselRule.length - 1].dieselRule1 + oilDiscount = dieselRule[dieselRule.length - 1].dieselRule2 + discount.reduce = dieselRule[dieselRule.length - 1].dieselRule2 + break; + } + if (item.amount >= dieselRule[i - 1].dieselRule1 && item.amount < dieselRule[i].dieselRule1) { + discount.full = dieselRule[i - 1].dieselRule1 + oilDiscount = dieselRule[i - 1].dieselRule2 + discount.reduce = dieselRule[i - 1].dieselRule2 + } + } else { + discount.full = dieselRule[i - 1].dieselRule1 + if (item.amount >= dieselRule[i - 1].dieselRule1) { + oilDiscount = dieselRule[i - 1].dieselRule2 + discount.reduce = dieselRule[i - 1].dieselRule2 + } + } + } + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('满减优惠') + } + dieselDiscount += +oilDiscount + } else if (response.data.userGrade.dieselDiscount == "每升优惠") { + let oilDiscount = 0; + for (let i = 1; i <= dieselRule.length; i++) { + discount.type = "每升优惠" + // 将满减条件加入等级优惠列表 + if (dieselRule.length > 1) { + if (item.amount >= dieselRule[dieselRule.length - 1].dieselRule1) { + discount.full = dieselRule[dieselRule.length - 1].dieselRule1 + oilDiscount = (item.liters * dieselRule[dieselRule.length - 1].dieselRule3).toFixed(2); + discount.reduce = (item.liters * dieselRule[dieselRule.length - 1].dieselRule3).toFixed(2); + discount.liters = dieselRule[dieselRule.length - 1].dieselRule3 + break; + } + if (item.amount >= dieselRule[i - 1].dieselRule1 && item.amount < dieselRule[i].dieselRule1) { + discount.full = dieselRule[i - 1].dieselRule1 + oilDiscount = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) + discount.reduce = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) + discount.liters = dieselRule[i - 1].dieselRule3 + } + } else { + discount.full = dieselRule[i - 1].dieselRule1 + if (item.amount >= dieselRule[i - 1].dieselRule1) { + oilDiscount = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) + discount.reduce = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) + discount.liters = dieselRule[i - 1].dieselRule3 + } + } + } + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('每升优惠') + } + dieselDiscount += +oilDiscount + } else { + dieselDiscount = 0; + } } - dieselDiscount += +oilDiscount - } else { - dieselDiscount = 0; + } } } if (item.type == "天然气") { - let naturalGasRule = JSON.parse(response.data.naturalGasRule).sort((a,b) => a.naturalGasRule1 - b.naturalGasRule1); - if (response.data.preferential == '自定义优惠' && response.data.status == 'qy') { - if (response.data.naturalGasDiscount == "满减优惠") { - let oilDiscount = 0; - discount.type = "满减优惠" - for (let i = 1; i <= naturalGasRule.length; i++) { - // 将满减条件加入等级优惠列表 - if (naturalGasRule.length > 1) { - if (item.amount >= naturalGasRule[naturalGasRule.length - 1].naturalGasRule1) { - discount.full = naturalGasRule[naturalGasRule.length - 1].naturalGasRule1 - oilDiscount = naturalGasRule[naturalGasRule.length - 1].naturalGasRule2; - discount.reduce = naturalGasRule[naturalGasRule.length - 1].naturalGasRule2 - break; - } - if (item.amount >= naturalGasRule[i - 1].naturalGasRule1 && item.amount < naturalGasRule[i].naturalGasRule1) { - discount.full = naturalGasRule[i - 1].naturalGasRule1 - oilDiscount = naturalGasRule[i - 1].naturalGasRule2 - discount.reduce = naturalGasRule[i - 1].naturalGasRule2 - } - } else { - if (item.amount >= naturalGasRule[i - 1].naturalGasRule1) { - discount.full = naturalGasRule[i - 1].naturalGasRule1 - oilDiscount = naturalGasRule[i - 1].naturalGasRule2 - discount.reduce = naturalGasRule[i - 1].naturalGasRule2 + if (response.data.fixingLevel){ + let naturalGasRule = JSON.parse(response.data.fixingLevel.naturalGasRule).sort((a, b) => a.naturalGasRule1 - b.naturalGasRule1); + if (response.data.fixingLevel.discountType == '自定义优惠' && response.data.fixingLevel.status == 'qy') { + if (response.data.fixingLevel.naturalGasDiscount == "满减优惠") { + let oilDiscount = 0; + discount.type = "满减优惠" + for (let i = 1; i <= naturalGasRule.length; i++) { + // 将满减条件加入等级优惠列表 + if (naturalGasRule.length > 1) { + if (item.amount >= naturalGasRule[naturalGasRule.length - 1].naturalGasRule1) { + discount.full = naturalGasRule[naturalGasRule.length - 1].naturalGasRule1 + oilDiscount = naturalGasRule[naturalGasRule.length - 1].naturalGasRule2; + discount.reduce = naturalGasRule[naturalGasRule.length - 1].naturalGasRule2 + break; + } + if (item.amount >= naturalGasRule[i - 1].naturalGasRule1 && item.amount < naturalGasRule[i].naturalGasRule1) { + discount.full = naturalGasRule[i - 1].naturalGasRule1 + oilDiscount = naturalGasRule[i - 1].naturalGasRule2 + discount.reduce = naturalGasRule[i - 1].naturalGasRule2 + } + } else { + if (item.amount >= naturalGasRule[i - 1].naturalGasRule1) { + discount.full = naturalGasRule[i - 1].naturalGasRule1 + oilDiscount = naturalGasRule[i - 1].naturalGasRule2 + discount.reduce = naturalGasRule[i - 1].naturalGasRule2 + } } } - } - if (discount.reduce != 0) { - _this.gradeDiscount.push(discount) - _this.checkedCities2.push('满减优惠') - } - naturalGasDiscount += +oilDiscount - } else if (response.data.naturalGasDiscount == "每单位优惠") { - let oilDiscount = 0; - discount.type = "每单位优惠" - for (let i = 1; i <= naturalGasRule.length; i++) { - // 将满减条件加入等级优惠列表 - if (naturalGasRule.length > 1) { - if (item.amount >= naturalGasRule[naturalGasRule.length - 1].naturalGasRule1) { - discount.full = naturalGasRule[naturalGasRule.length - 1].naturalGasRule1 - oilDiscount = (item.liters * naturalGasRule[gasolineRule.length - 1].naturalGasRule3).toFixed(2) - discount.reduce = (item.liters * naturalGasRule[gasolineRule.length - 1].naturalGasRule3).toFixed(2) - discount.liters = naturalGasRule[naturalGasRule.length - 1].naturalGasRule3 - break; - } - if (item.amount >= naturalGasRule[i - 1].naturalGasRule1 && item.amount < naturalGasRule[i].naturalGasRule1) { - discount.full = naturalGasRule[i - 1].naturalGasRule1 - oilDiscount = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) - discount.reduce = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) - discount.liters = naturalGasRule[i - 1].naturalGasRule3 - } - } else { - if (item.amount >= naturalGasRule[i - 1].naturalGasRule1) { - discount.full = naturalGasRule[i - 1].naturalGasRule1 - oilDiscount = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) - discount.reduce = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) - discount.liters = naturalGasRule[i - 1].naturalGasRule3 + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('满减优惠') + } + naturalGasDiscount += +oilDiscount + } else if (response.data.fixingLevel.naturalGasDiscount == "每单位优惠") { + let oilDiscount = 0; + discount.type = "每单位优惠" + for (let i = 1; i <= naturalGasRule.length; i++) { + // 将满减条件加入等级优惠列表 + if (naturalGasRule.length > 1) { + if (item.amount >= naturalGasRule[naturalGasRule.length - 1].naturalGasRule1) { + discount.full = naturalGasRule[naturalGasRule.length - 1].naturalGasRule1 + oilDiscount = (item.liters * naturalGasRule[gasolineRule.length - 1].naturalGasRule3).toFixed(2) + discount.reduce = (item.liters * naturalGasRule[gasolineRule.length - 1].naturalGasRule3).toFixed(2) + discount.liters = naturalGasRule[naturalGasRule.length - 1].naturalGasRule3 + break; + } + if (item.amount >= naturalGasRule[i - 1].naturalGasRule1 && item.amount < naturalGasRule[i].naturalGasRule1) { + discount.full = naturalGasRule[i - 1].naturalGasRule1 + oilDiscount = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) + discount.reduce = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) + discount.liters = naturalGasRule[i - 1].naturalGasRule3 + } + } else { + if (item.amount >= naturalGasRule[i - 1].naturalGasRule1) { + discount.full = naturalGasRule[i - 1].naturalGasRule1 + oilDiscount = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) + discount.reduce = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) + discount.liters = naturalGasRule[i - 1].naturalGasRule3 + } } } + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('每单位优惠') + } + naturalGasDiscount += +oilDiscount + } else { + naturalGasDiscount = 0; } - if (discount.reduce != 0) { - _this.gradeDiscount.push(discount) - _this.checkedCities2.push('每单位优惠') + } + + }else { + if (response.data.userGrade.userGrade) { + let naturalGasRule = JSON.parse(response.data.userGrade.naturalGasRule).sort((a, b) => a.naturalGasRule1 - b.naturalGasRule1); + if (response.data.userGrade.preferential == '自定义优惠' && response.data.userGrade.status == 'qy') { + if (response.data.userGrade.naturalGasDiscount == "满减优惠") { + let oilDiscount = 0; + discount.type = "满减优惠" + for (let i = 1; i <= naturalGasRule.length; i++) { + // 将满减条件加入等级优惠列表 + if (naturalGasRule.length > 1) { + if (item.amount >= naturalGasRule[naturalGasRule.length - 1].naturalGasRule1) { + discount.full = naturalGasRule[naturalGasRule.length - 1].naturalGasRule1 + oilDiscount = naturalGasRule[naturalGasRule.length - 1].naturalGasRule2; + discount.reduce = naturalGasRule[naturalGasRule.length - 1].naturalGasRule2 + break; + } + if (item.amount >= naturalGasRule[i - 1].naturalGasRule1 && item.amount < naturalGasRule[i].naturalGasRule1) { + discount.full = naturalGasRule[i - 1].naturalGasRule1 + oilDiscount = naturalGasRule[i - 1].naturalGasRule2 + discount.reduce = naturalGasRule[i - 1].naturalGasRule2 + } + } else { + if (item.amount >= naturalGasRule[i - 1].naturalGasRule1) { + discount.full = naturalGasRule[i - 1].naturalGasRule1 + oilDiscount = naturalGasRule[i - 1].naturalGasRule2 + discount.reduce = naturalGasRule[i - 1].naturalGasRule2 + } + } + } + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('满减优惠') + } + naturalGasDiscount += +oilDiscount + } else if (response.data.userGrade.naturalGasDiscount == "每单位优惠") { + let oilDiscount = 0; + discount.type = "每单位优惠" + for (let i = 1; i <= naturalGasRule.length; i++) { + // 将满减条件加入等级优惠列表 + if (naturalGasRule.length > 1) { + if (item.amount >= naturalGasRule[naturalGasRule.length - 1].naturalGasRule1) { + discount.full = naturalGasRule[naturalGasRule.length - 1].naturalGasRule1 + oilDiscount = (item.liters * naturalGasRule[gasolineRule.length - 1].naturalGasRule3).toFixed(2) + discount.reduce = (item.liters * naturalGasRule[gasolineRule.length - 1].naturalGasRule3).toFixed(2) + discount.liters = naturalGasRule[naturalGasRule.length - 1].naturalGasRule3 + break; + } + if (item.amount >= naturalGasRule[i - 1].naturalGasRule1 && item.amount < naturalGasRule[i].naturalGasRule1) { + discount.full = naturalGasRule[i - 1].naturalGasRule1 + oilDiscount = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) + discount.reduce = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) + discount.liters = naturalGasRule[i - 1].naturalGasRule3 + } + } else { + if (item.amount >= naturalGasRule[i - 1].naturalGasRule1) { + discount.full = naturalGasRule[i - 1].naturalGasRule1 + oilDiscount = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) + discount.reduce = (item.liters * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) + discount.liters = naturalGasRule[i - 1].naturalGasRule3 + } + } + } + if (discount.reduce != 0) { + _this.gradeDiscount.push(discount) + _this.checkedCities2.push('每单位优惠') + } + naturalGasDiscount += +oilDiscount + } else { + naturalGasDiscount = 0; + } } - naturalGasDiscount += +oilDiscount - } else { - naturalGasDiscount = 0; + } } } @@ -1690,7 +1918,7 @@ this.map.payUser = data.mobile; this.map.userId = data.id; this.balance = this.member.cardBalance; - this.getGrade(data.gradeId) + this.getGrade(data.id,data.gradeId) this.changeRefuelMoney(); this.handleChange(); this.preferentialData.storeId = data.storeId; @@ -2114,7 +2342,7 @@ this.oilTotal = this.oilOrder.length; this.select = "元"; if (this.isMember){ - this.getGrade(this.member.gradeId) + this.getGrade(this.member.id,this.member.gradeId) this.changeRefuelMoney(); if (this.oilOrder.length>0){ this.preferential(); @@ -2211,7 +2439,7 @@ // 根据手机号查询会员信息 getUser(){ if(this.select1=="会员手机号"){ - getUserVoMobile({mobile:this.userNo}).then( response => { + getUserInfoMobile({mobile:this.userNo}).then( response => { if (response.data!=null){ this.member = response.data }else { diff --git a/gasStation-uni/pages/index/index.vue b/gasStation-uni/pages/index/index.vue index b0765999a..5511c243b 100644 --- a/gasStation-uni/pages/index/index.vue +++ b/gasStation-uni/pages/index/index.vue @@ -196,7 +196,7 @@ let str = q.split("?")[1]; let arr = str.split("&"); - let storeId = "21"; + let storeId = "19"; let staffId = ""; arr.forEach(item => { @@ -214,9 +214,7 @@ if (uni.getStorageSync("storeId")) { this.storeId = uni.getStorageSync("storeId") } else { - - let storeId = "21"; - + let storeId = "24"; uni.setStorageSync("storeId", storeId) } } diff --git a/gasStation-uni/pages/refuel/refuel.vue b/gasStation-uni/pages/refuel/refuel.vue index c0dd6b585..428c1a20c 100644 --- a/gasStation-uni/pages/refuel/refuel.vue +++ b/gasStation-uni/pages/refuel/refuel.vue @@ -117,7 +117,7 @@ show: false, pic: 0, hindex: 0, - qindex: null, + qindex: 0, aindex: null, sindex: null, // 店铺信息 @@ -168,7 +168,7 @@ }, onLoad(query) { const q = decodeURIComponent(query.q) // 获取到二维码原始链接内容 - if (q == undefined) { + if (query.q) { let str = q.split("?")[1]; let arr = str.split("&"); let storeId = ""; @@ -184,6 +184,9 @@ uni.setStorageSync("inviteStaffId", staffId) this.storeId = uni.getStorageSync("storeId") this.staffId = uni.getStorageSync("inviteStaffId") + uni.showLoading({ + title:storeId +"++"+staffId + }) } }, onShow() { diff --git a/gasStation-uni/pagesMy/myorder/myorder.vue b/gasStation-uni/pagesMy/myorder/myorder.vue index d26338c7e..589fcea8f 100644 --- a/gasStation-uni/pagesMy/myorder/myorder.vue +++ b/gasStation-uni/pagesMy/myorder/myorder.vue @@ -137,7 +137,7 @@ map: { page: 1, pageSize: 10, - storeId: "", + storeId: uni.getStorageSync("storeId"), orderStatus: "", remark: "", }, diff --git a/gasStation-uni/pagesRefuel/orderDetail/index.vue b/gasStation-uni/pagesRefuel/orderDetail/index.vue index b3148b855..d8ca9b86f 100644 --- a/gasStation-uni/pagesRefuel/orderDetail/index.vue +++ b/gasStation-uni/pagesRefuel/orderDetail/index.vue @@ -58,7 +58,7 @@ - + 活动优惠 @@ -81,12 +81,13 @@ 会员等级优惠 - ({{userGrade.name}}) + -¥{{gradeRedece}} + 无优惠 注:囤油卡不参与任何优惠活动 @@ -184,17 +185,21 @@ isStoreValueCard:false, // 是否存在可使用的等级优惠 isGradePreferential:false, + // 是否存在可使用的满减或折扣优惠 + isFullPreferential:false, transferDTO:{ type:0, amount:0, oilId:"", mtUserLevel:"", - } + storeId:uni.getStorageSync("storeId") + }, + fixingLevel:{}, } }, onLoad(e) { this.orderNo = e.orderNo - // this.orderNo = "234520231229140854e4c4ca" + // this.orderNo = "234520240104104141863b59" }, onShow() { this.getOilOrder(); @@ -225,13 +230,19 @@ method: 'post', data: map, }).then(res => { - console.log(res,_this.appltType) + // console.log(res,_this.appltType) let payProvider = "wxpay" if (_this.appltType== "WECHAT"){ payProvider = "wxpay" }else{ payProvider = "alipay" } + if(res.data.success == "ok"){ + uni.reLaunch({ + url: '/pagesRefuel/orderSuccess/index' + }) + return; + } if (res.data.data.reservedPayInfo){ _this.orderInfo = JSON.parse(res.data.data.reservedPayInfo); uni.requestPayment({ @@ -310,7 +321,7 @@ }) if (falg == false) { this.chooseCardBalance(0) - this.chooseGrade(this.user.gradeId) + this.chooseGrade(this.user.id,this.user.gradeId) } }, // 查看是否有可使用的储值卡金额 @@ -326,7 +337,6 @@ this.deductAmount = this.oilOrder.orderAmount - this.balanceRedece this.payAmount = this.oilOrder.orderAmount - this.balanceRedece } - this.preferential.amount = this.deductAmount }else{ // 使用囤油卡 // 扣除囤油卡金额后需要支付的金额 @@ -344,152 +354,297 @@ } }, // 查看是否有可使用的会员等级优惠 - chooseGrade(id){ + chooseGrade(userId,gradeId){ let that = this; request({ - url: "business/userManager/userGrade/isUse/" + id, - method: 'get', + url: "business/userManager/userGrade/isUse", + method: 'post', + data:{userId:userId,gradeId:gradeId,storeId:that.oilOrder.storeId} }).then((res) => { - if (res.data != null && res.data != ""){ - that.userGrade = res.data - that.chooseFullOrCoupon(); - if (res.data.preferential== "自定义优惠"){ - if (that.oilType == "汽油"){ - // 将数组按照金额从小到大排序 - let gasolineRule = JSON.parse(res.data.gasolineRule).sort((a,b) => a.gasolineRule1 - b.gasolineRule1); - if (res.data.gasolineDiscount == "满减优惠"){ - if (gasolineRule.length > 1){ - for (let i = 1; i a.gasolineRule1 - b.gasolineRule1); + if (res.data.fixingLevel.gasolineDiscount == "满减优惠"){ + if (gasolineRule.length > 1){ + for (let i = 1; i= gasolineRule[gasolineRule.length-1].gasolineRule1){ + that.gradeRedece = gasolineRule[gasolineRule.length-1].gasolineRule2 + that.isGradePreferential = true + break; + } + if (that.deductAmount >= gasolineRule[i - 1].gasolineRule1 && that.deductAmount < gasolineRule[i].gasolineRule1) { + that.gradeRedece = gasolineRule[i - 1].gasolineRule2 + that.isGradePreferential = true + } + } + }else{ if (that.deductAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ that.gradeRedece = gasolineRule[gasolineRule.length-1].gasolineRule2 that.isGradePreferential = true - break; } - if (that.deductAmount >= gasolineRule[i - 1].gasolineRule1 && that.deductAmount < gasolineRule[i].gasolineRule1) { - that.gradeRedece = gasolineRule[i - 1].gasolineRule2 - that.isGradePreferential = true - } - } - }else{ - if (that.deductAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ - that.gradeRedece = gasolineRule[gasolineRule.length-1].gasolineRule2 - that.isGradePreferential = true } } - } - if (res.data.gasolineDiscount == "每升优惠"){ - if (gasolineRule.length > 1){ - for (let i = 1; i 1){ + for (let i = 1; i= gasolineRule[gasolineRule.length-1].gasolineRule1){ + // 计算升数 和 优惠金额 + that.gradeRedece = (that.deductAmount/that.oilPrice * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2) + that.isGradePreferential = true + break; + } + if (that.deductAmount >= gasolineRule[i - 1].gasolineRule1 && that.deductAmount < gasolineRule[i].gasolineRule1) { + that.gradeRedece = (that.deductAmount/that.oilPrice * gasolineRule[i - 1].gasolineRule3).toFixed(2) + that.isGradePreferential = true + } + } + }else{ if (that.deductAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ - // 计算升数 和 优惠金额 that.gradeRedece = (that.deductAmount/that.oilPrice * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2) that.isGradePreferential = true - break; } - if (that.deductAmount >= gasolineRule[i - 1].gasolineRule1 && that.deductAmount < gasolineRule[i].gasolineRule1) { - that.gradeRedece = (that.deductAmount/that.oilPrice * gasolineRule[i - 1].gasolineRule3).toFixed(2) - that.isGradePreferential = true - } - } - }else{ - if (that.deductAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ - that.gradeRedece = (that.deductAmount/that.oilPrice * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2) - that.isGradePreferential = true } } } - } - if (that.oilType == "柴油"){ - // 将数组按照金额从小到大排序 - let dieselRule = JSON.parse(res.data.dieselRule).sort((a,b) => a.dieselRule1 - b.dieselRule1); - if (res.data.dieselDiscount == "满减优惠"){ - if (dieselRule.length > 1){ - for (let i = 1; i a.dieselRule1 - b.dieselRule1); + if (res.data.fixingLevel.dieselDiscount == "满减优惠"){ + if (dieselRule.length > 1){ + for (let i = 1; i= dieselRule[dieselRule.length-1].dieselRule1){ + that.gradeRedece = dieselRule[dieselRule.length-1].dieselRule2 + that.isGradePreferential = true + break; + } + if (that.deductAmount >= dieselRule[i - 1].dieselRule1 && that.deductAmount < dieselRule[i].dieselRule1) { + that.gradeRedece = dieselRule[i - 1].dieselRule2 + that.isGradePreferential = true + } + } + }else{ if (that.deductAmount >= dieselRule[dieselRule.length-1].dieselRule1){ that.gradeRedece = dieselRule[dieselRule.length-1].dieselRule2 that.isGradePreferential = true - break; } - if (that.deductAmount >= dieselRule[i - 1].dieselRule1 && that.deductAmount < dieselRule[i].dieselRule1) { - that.gradeRedece = dieselRule[i - 1].dieselRule2 - that.isGradePreferential = true - } - } - }else{ - if (that.deductAmount >= dieselRule[dieselRule.length-1].dieselRule1){ - that.gradeRedece = dieselRule[dieselRule.length-1].dieselRule2 - that.isGradePreferential = true } } - } - if (res.data.dieselDiscount == "每升优惠"){ - if (dieselRule.length > 1){ - for (let i = 1; i 1){ + for (let i = 1; i= dieselRule[dieselRule.length-1].dieselRule1){ + // 计算升数 和 优惠金额 + that.gradeRedece = (that.deductAmount/that.oilPrice * dieselRule[dieselRule.length-1].dieselRule3).toFixed(2) + that.isGradePreferential = true + break; + } + if (that.deductAmount >= dieselRule[i - 1].dieselRule1 && that.deductAmount < dieselRule[i].dieselRule1) { + that.gradeRedece = (that.deductAmount/that.oilPrice * dieselRule[i - 1].dieselRule3).toFixed(2) + that.isGradePreferential = true + } + } + }else{ if (that.deductAmount >= dieselRule[dieselRule.length-1].dieselRule1){ - // 计算升数 和 优惠金额 that.gradeRedece = (that.deductAmount/that.oilPrice * dieselRule[dieselRule.length-1].dieselRule3).toFixed(2) that.isGradePreferential = true - break; } - if (that.deductAmount >= dieselRule[i - 1].dieselRule1 && that.deductAmount < dieselRule[i].dieselRule1) { - that.gradeRedece = (that.deductAmount/that.oilPrice * dieselRule[i - 1].dieselRule3).toFixed(2) - that.isGradePreferential = true - } - } - }else{ - if (that.deductAmount >= dieselRule[dieselRule.length-1].dieselRule1){ - that.gradeRedece = (that.deductAmount/that.oilPrice * dieselRule[dieselRule.length-1].dieselRule3).toFixed(2) - that.isGradePreferential = true } } } - } - if (that.oilType == "天然气"){ - // 将数组按照金额从小到大排序 - let naturalGasRule = JSON.parse(res.data.naturalGasRule).sort((a,b) => a.naturalGasRule1 - b.naturalGasRule1); - if (res.data.naturalGasDiscount == "满减优惠"){ - if (naturalGasRule.length > 1){ - for (let i = 1; i a.naturalGasRule1 - b.naturalGasRule1); + if (res.data.fixingLevel.naturalGasDiscount == "满减优惠"){ + if (naturalGasRule.length > 1){ + for (let i = 1; i= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ + that.gradeRedece = naturalGasRule[naturalGasRule.length-1].naturalGasRule2 + that.isGradePreferential = true + break; + } + if (that.deductAmount >= naturalGasRule[i - 1].naturalGasRule1 && that.deductAmount < naturalGasRule[i].naturalGasRule1) { + that.gradeRedece = naturalGasRule[i - 1].naturalGasRule2 + that.isGradePreferential = true + } + } + }else{ if (that.deductAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ that.gradeRedece = naturalGasRule[naturalGasRule.length-1].naturalGasRule2 that.isGradePreferential = true - break; } - if (that.deductAmount >= naturalGasRule[i - 1].naturalGasRule1 && that.deductAmount < naturalGasRule[i].naturalGasRule1) { - that.gradeRedece = naturalGasRule[i - 1].naturalGasRule2 - that.isGradePreferential = true - } - } - }else{ - if (that.deductAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ - that.gradeRedece = naturalGasRule[naturalGasRule.length-1].naturalGasRule2 - that.isGradePreferential = true } } - } - if (res.data.naturalGasDiscount == "每升优惠"){ - if (naturalGasRule.length > 1){ - for (let i = 1; i 1){ + for (let i = 1; i= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ + // 计算升数 和 优惠金额 + that.gradeRedece = (that.deductAmount/that.oilPrice * naturalGasRule[naturalGasRule.length-1].naturalGasRule3).toFixed(2) + that.isGradePreferential = true + break; + } + if (that.deductAmount >= naturalGasRule[i - 1].naturalGasRule1 && that.deductAmount < naturalGasRule[i].naturalGasRule1) { + that.gradeRedece = (that.deductAmount/that.oilPrice * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) + that.isGradePreferential = true + } + } + }else{ if (that.deductAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ - // 计算升数 和 优惠金额 that.gradeRedece = (that.deductAmount/that.oilPrice * naturalGasRule[naturalGasRule.length-1].naturalGasRule3).toFixed(2) that.isGradePreferential = true - break; } - if (that.deductAmount >= naturalGasRule[i - 1].naturalGasRule1 && that.deductAmount < naturalGasRule[i].naturalGasRule1) { - that.gradeRedece = (that.deductAmount/that.oilPrice * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) - that.isGradePreferential = true - } - } - }else{ - if (that.deductAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ - that.gradeRedece = (that.deductAmount/that.oilPrice * naturalGasRule[naturalGasRule.length-1].naturalGasRule3).toFixed(2) - that.isGradePreferential = true } } } } + }else{ + if(res.data.userGrade){ + that.userGrade = res.data.userGrade + that.chooseFullOrCoupon(); + if (res.data.userGrade.preferential== "自定义优惠"){ + if (that.oilType == "汽油"){ + // 将数组按照金额从小到大排序 + let gasolineRule = JSON.parse(res.data.userGrade.gasolineRule).sort((a,b) => a.gasolineRule1 - b.gasolineRule1); + if (res.data.userGrade.gasolineDiscount == "满减优惠"){ + if (gasolineRule.length > 1){ + for (let i = 1; i= gasolineRule[gasolineRule.length-1].gasolineRule1){ + that.gradeRedece = gasolineRule[gasolineRule.length-1].gasolineRule2 + that.isGradePreferential = true + break; + } + if (that.deductAmount >= gasolineRule[i - 1].gasolineRule1 && that.deductAmount < gasolineRule[i].gasolineRule1) { + that.gradeRedece = gasolineRule[i - 1].gasolineRule2 + that.isGradePreferential = true + } + } + }else{ + if (that.deductAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ + that.gradeRedece = gasolineRule[gasolineRule.length-1].gasolineRule2 + that.isGradePreferential = true + } + } + } + if (res.data.userGrade.gasolineDiscount == "每升优惠"){ + if (gasolineRule.length > 1){ + for (let i = 1; i= gasolineRule[gasolineRule.length-1].gasolineRule1){ + // 计算升数 和 优惠金额 + that.gradeRedece = (that.deductAmount/that.oilPrice * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2) + that.isGradePreferential = true + break; + } + if (that.deductAmount >= gasolineRule[i - 1].gasolineRule1 && that.deductAmount < gasolineRule[i].gasolineRule1) { + that.gradeRedece = (that.deductAmount/that.oilPrice * gasolineRule[i - 1].gasolineRule3).toFixed(2) + that.isGradePreferential = true + } + } + }else{ + if (that.deductAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ + that.gradeRedece = (that.deductAmount/that.oilPrice * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2) + that.isGradePreferential = true + } + } + } + } + if (that.oilType == "柴油"){ + // 将数组按照金额从小到大排序 + let dieselRule = JSON.parse(res.data.userGrade.dieselRule).sort((a,b) => a.dieselRule1 - b.dieselRule1); + if (res.data.userGrade.dieselDiscount == "满减优惠"){ + if (dieselRule.length > 1){ + for (let i = 1; i= dieselRule[dieselRule.length-1].dieselRule1){ + that.gradeRedece = dieselRule[dieselRule.length-1].dieselRule2 + that.isGradePreferential = true + break; + } + if (that.deductAmount >= dieselRule[i - 1].dieselRule1 && that.deductAmount < dieselRule[i].dieselRule1) { + that.gradeRedece = dieselRule[i - 1].dieselRule2 + that.isGradePreferential = true + } + } + }else{ + if (that.deductAmount >= dieselRule[dieselRule.length-1].dieselRule1){ + that.gradeRedece = dieselRule[dieselRule.length-1].dieselRule2 + that.isGradePreferential = true + } + } + } + if (res.data.userGrade.dieselDiscount == "每升优惠"){ + if (dieselRule.length > 1){ + for (let i = 1; i= dieselRule[dieselRule.length-1].dieselRule1){ + // 计算升数 和 优惠金额 + that.gradeRedece = (that.deductAmount/that.oilPrice * dieselRule[dieselRule.length-1].dieselRule3).toFixed(2) + that.isGradePreferential = true + break; + } + if (that.deductAmount >= dieselRule[i - 1].dieselRule1 && that.deductAmount < dieselRule[i].dieselRule1) { + that.gradeRedece = (that.deductAmount/that.oilPrice * dieselRule[i - 1].dieselRule3).toFixed(2) + that.isGradePreferential = true + } + } + }else{ + if (that.deductAmount >= dieselRule[dieselRule.length-1].dieselRule1){ + that.gradeRedece = (that.deductAmount/that.oilPrice * dieselRule[dieselRule.length-1].dieselRule3).toFixed(2) + that.isGradePreferential = true + } + } + } + } + if (that.oilType == "天然气"){ + // 将数组按照金额从小到大排序 + let naturalGasRule = JSON.parse(res.data.userGrade.naturalGasRule).sort((a,b) => a.naturalGasRule1 - b.naturalGasRule1); + if (res.data.userGrade.naturalGasDiscount == "满减优惠"){ + if (naturalGasRule.length > 1){ + for (let i = 1; i= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ + that.gradeRedece = naturalGasRule[naturalGasRule.length-1].naturalGasRule2 + that.isGradePreferential = true + break; + } + if (that.deductAmount >= naturalGasRule[i - 1].naturalGasRule1 && that.deductAmount < naturalGasRule[i].naturalGasRule1) { + that.gradeRedece = naturalGasRule[i - 1].naturalGasRule2 + that.isGradePreferential = true + } + } + }else{ + if (that.deductAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ + that.gradeRedece = naturalGasRule[naturalGasRule.length-1].naturalGasRule2 + that.isGradePreferential = true + } + } + } + if (res.data.userGrade.naturalGasDiscount == "每升优惠"){ + if (naturalGasRule.length > 1){ + for (let i = 1; i= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ + // 计算升数 和 优惠金额 + that.gradeRedece = (that.deductAmount/that.oilPrice * naturalGasRule[naturalGasRule.length-1].naturalGasRule3).toFixed(2) + that.isGradePreferential = true + break; + } + if (that.deductAmount >= naturalGasRule[i - 1].naturalGasRule1 && that.deductAmount < naturalGasRule[i].naturalGasRule1) { + that.gradeRedece = (that.deductAmount/that.oilPrice * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) + that.isGradePreferential = true + } + } + }else{ + if (that.deductAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ + that.gradeRedece = (that.deductAmount/that.oilPrice * naturalGasRule[naturalGasRule.length-1].naturalGasRule3).toFixed(2) + that.isGradePreferential = true + } + } + } + } + } + } + } + that.countPayMent() } }) @@ -499,17 +654,17 @@ this.transferDTO.amount = this.deductAmount this.transferDTO.mtUserLevel = this.userGrade.id this.transferDTO.oilId = this.oilId - console.log(this.transferDTO) let _this = this; request({ url: "business/marketingActivity/activeExchange/test", method: 'post', data:_this.transferDTO, }).then((res) => { - console.log(res) - if (res.data.amount!=0){ + // console.log(res) + if (res.data.amount>0){ _this.payAmount = res.data.amount - _this.gradeRedece _this.fullRedece = res.data.favorableAmount + _this.isFullPreferential = true } }) }, @@ -523,7 +678,7 @@ getUser(id){ let _this = this; request({ - url: "business/userManager/user/" + id, + url: "business/userManager/user/storeUser/" + _this.oilOrder.storeId, method: 'get', }).then((res) => { _this.user = res.data; diff --git a/gasStation-uni/pagesRefuel/orderSuccess/index.vue b/gasStation-uni/pagesRefuel/orderSuccess/index.vue index 018a404d6..01890dbb7 100644 --- a/gasStation-uni/pagesRefuel/orderSuccess/index.vue +++ b/gasStation-uni/pagesRefuel/orderSuccess/index.vue @@ -27,7 +27,7 @@ export default { data() { return { - timestamp:5, + timestamp:3, } }, onLoad() { @@ -44,7 +44,7 @@ if(_this.timestamp === 0) { _this.goBack() clearInterval(timer) - _this.timestamp = 5 + _this.timestamp = 3 } }, 1000); },