This commit is contained in:
cun-nan 2024-10-17 17:46:51 +08:00
parent 8ab3e3780a
commit a9727156f7
5 changed files with 86 additions and 6 deletions

View File

@ -176,7 +176,7 @@
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
:value="Number(item.value)">
</el-option>
</el-select>
</el-form-item>
@ -305,7 +305,7 @@
<el-upload
class="upload-demo"
v-loading="uploading"
action="/dev-api/fleetMember/import"
action="/fuint-application/fleetMember/import"
:headers="headers"
:limit="1"
:on-change="handleChange"
@ -325,7 +325,7 @@
<div style="margin-top: 120px">
<!-- dev-api fuint-application-->
<a style="margin-left: 50px;color: #00A1FF;"
href="/dev-api/fleetMember/export"> 导入模板下载.xlsx </a>
href="/fuint-application/fleetMember/export"> 导入模板下载.xlsx </a>
</div>
</div>

View File

@ -108,4 +108,11 @@ public interface FleetMemberService {
* @return
*/
int signOUTMember(Integer memberId);
/**
* 根据用户id查询车队信息
* @param userId
* @return
*/
FleetMember selectByUserId(Integer userId);
}

View File

@ -245,6 +245,12 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
if (ObjectUtil.isNotEmpty(fleetMember1) && fleetMember1.getId() != fleetMember.getId()) {
return 0;
}
// 如果不限额的话将成员的余额信息改为车队的余额信息
FleetInfo fleetInfo = fleetInfoService.queryById(fleetMember.getFleetId());
if (fleetMember.getSecondaryCardType()==1){
fleetMember.setSecondaryCardLimit(fleetInfo.getTotalBalance());
fleetMember.setRemainingCreditLimit(fleetInfo.getTotalBalance()-fleetMember.getUsedCreditLimit());
}
return baseMapper.updateById(fleetMember);
}
@ -382,6 +388,14 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
return baseMapper.updateById(fleetMember);
}
@Override
public FleetMember selectByUserId(Integer userId) {
return baseMapper.selectOne(new LambdaQueryWrapper<FleetMember>()
.eq(FleetMember::getUserId, userId)
.orderBy(true, true, FleetMember::getCreateTime)
.last("limit 1"));
}
/**
* 创建用户的基础信息
*/

View File

@ -22,7 +22,11 @@ import com.fuint.business.convenienceSore.entity.LJGoods;
import com.fuint.business.convenienceSore.entity.SaleDetail;
import com.fuint.business.convenienceSore.service.LJGoodsService;
import com.fuint.business.convenienceSore.service.SaleDetailService;
import com.fuint.business.fleet.entity.FleetConsumeRecord;
import com.fuint.business.fleet.entity.FleetMember;
import com.fuint.business.fleet.service.FleetConsumeRecordService;
import com.fuint.business.fleet.service.FleetInfoService;
import com.fuint.business.fleet.service.FleetMemberService;
import com.fuint.business.integral.service.IntegralSettingsService;
import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild;
import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountService;
@ -50,6 +54,7 @@ import com.fuint.business.order.entity.*;
import com.fuint.business.order.mapper.LJOrderMapper;
import com.fuint.business.order.mapper.OilOrderMapper;
import com.fuint.business.order.service.*;
import com.fuint.business.order.vo.AllOrderInfoUniVo;
import com.fuint.business.order.vo.Excel.OilOrderExcel;
import com.fuint.business.order.vo.OilOrderVo;
import com.fuint.business.petrolStationManagement.entity.*;
@ -201,6 +206,10 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
private CardValueRuleService cardValueRuleService;
@Autowired
private FleetInfoService fleetInfoService;
@Autowired
private FleetMemberService fleetMemberService;
@Autowired
private FleetConsumeRecordService fleetConsumeRecordService;
@Override
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order) {
@ -469,7 +478,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 支付状态
String payStatus = "unpaid";
if (payType.equals("CASH") || payType.equals("after_pay") || map.get("allAmount").equals("0")) {
if (payType.equals("CASH") || payType.equals("after_pay") || map.get("allAmount").equals("0") || payType.equals("car_card_value")
|| payType.equals("card_value") || payType.equals("fule_card")) {
payStatus = "paid";
} else {
payStatus = "unpaid";
@ -496,6 +506,20 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
return orders;
}
// 查看车队卡余额是否足够付款
FleetMember fleetMember = null;
if (payType.equals("car_card_value")){
if (ObjectUtil.isEmpty(userId)) {
orders.put("error", "请先选择会员信息");
return orders;
}
fleetMember = fleetMemberService.selectByUserId(userId);
if (fleetMember.getRemainingCreditLimit()<oilActualPay){
orders.put("error", "余额不足,请分开支付");
return orders;
}
}
// 查看会员储值卡余额是否足够付款
if (payType.equals("card_value")) {
if (ObjectUtil.isEmpty(userId)) {
@ -617,7 +641,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
if (ObjectUtil.isNotEmpty(jsonObject.get("activeType"))) {
order.setActiveType(jsonObject.get("activeType").toString());
}
if (payType.equals("CASH") || payType.equals("after_pay") || payType.equals("card_value")) {
if (payType.equals("CASH") || payType.equals("after_pay") || payType.equals("card_value") || payType.equals("car_card_value")) {
order.setPayTime(new Date());
order.setOrderStatus("paid");
if (ObjectUtil.isNotEmpty(userId)) this.insertCardBalance(consumeAmount, userId, storeId, orderNo);
@ -667,7 +691,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cashierOrder.setAfterDiscountAmount(oilAmount + goodsAmount - oilDiscount - goodsDiscount);
// 如果金额不等于0调用第三方支付接口
if (!map.get("allAmount").equals("0") && !map.get("payType").equals("CASH") && !payType.equals("after_pay") && !payType.equals("card_value") && !payType.equals("fule_card")) {
if (!map.get("allAmount").equals("0") && !map.get("payType").equals("CASH") && !payType.equals("after_pay")
&& !payType.equals("card_value") && !payType.equals("fule_card") && !payType.equals("car_card_value")) {
Integer allAmount = (int) (Double.valueOf(map.get("allAmount")) * 100);
// 处理支付需要的数据
@ -696,6 +721,9 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
} else {
this.insertAllOrderInfo(orderNo, storeId, oilAmount + goodsAmount, Double.valueOf(map.get("allAmount")), oilDiscount, payType, userId, "PC", "6", "paid");
// 添加车队卡订单信息
if (payType.equals("car_card_value") && ObjectUtil.isNotEmpty(fleetMember)) this.addFleetOrder(orderNo,fleetMember);
// 计算提成
if (ObjectUtil.isNotEmpty(staffId))
staffCommissionService.countStaffCommission(staffId, storeId, goodsAmount, goodsActualPay, "6", orderNo);
@ -722,6 +750,31 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
return orders;
}
/**
* 添加车队卡订单信息
* @param orderNo 订单号
* @param fleetMember 车队成员信息
*/
private void addFleetOrder(String orderNo,FleetMember fleetMember) {
AllOrderInfoUniVo allOrderInfoUniVo = allOrderInfoService.queryByOrderNo(orderNo);
FleetConsumeRecord fleetConsumeRecord = new FleetConsumeRecord();
fleetConsumeRecord.setOrderNo(orderNo);
fleetConsumeRecord.setChainStoreId(TokenUtil.getNowAccountInfo().getChainStoreId());
fleetConsumeRecord.setStoreId(allOrderInfoUniVo.getStoreId());
fleetConsumeRecord.setFleetId(fleetMember.getFleetId());
fleetConsumeRecord.setFleetMemberId(fleetMember.getId());
fleetConsumeRecord.setCardPaymentAmount(allOrderInfoUniVo.getPayMoney());
fleetConsumeRecord.setOrderAmount(allOrderInfoUniVo.getGoodsMoney());
fleetConsumeRecord.setPreferentialAmount(allOrderInfoUniVo.getDiscountAmount());
fleetConsumeRecord.setNetReceiptsAmount(allOrderInfoUniVo.getPayMoney());
fleetConsumeRecord.setOrderStatus(allOrderInfoUniVo.getStatus());
fleetConsumeRecord.setPaymentTime(allOrderInfoUniVo.getPayTime());
fleetConsumeRecord.setChangeType("0");
fleetConsumeRecord.setFromType("油品");
fleetConsumeRecordService.insert(fleetConsumeRecord);
fleetInfoService.payFleet(allOrderInfoUniVo.getId().toString(),allOrderInfoUniVo.getPayMoney());
}
// 添加优惠记录
@Override
public void insertFavorable(OilOrder order, Double oilCardAmount) {

View File

@ -1934,6 +1934,12 @@ export default {
}
this.accountPending = true
}
if (value == 'car_card_value'){
if (!this.userInfo){
this.$message.error("请先选择会员")
return
}
}
console.log('支付方式', value);
this.payType = value
//