This commit is contained in:
PQZ 2024-09-30 17:31:18 +08:00
commit 05a6fafbd1
6 changed files with 150 additions and 53 deletions

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.fleet.entity.FleetInfo; import com.fuint.business.fleet.entity.FleetInfo;
import com.fuint.business.fleet.vo.FleetInfoUniVo; import com.fuint.business.fleet.vo.FleetInfoUniVo;
import com.fuint.business.fleet.vo.FleetInfoVo; import com.fuint.business.fleet.vo.FleetInfoVo;
import com.fuint.framework.web.ResponseObject;
import java.util.List; import java.util.List;
@ -98,4 +99,10 @@ public interface FleetInfoService {
* @return * @return
*/ */
int ifFleetAdmin(Integer fleetId); int ifFleetAdmin(Integer fleetId);
/**
* 车队卡支付
* @param orderId
*/
int payFleet(String orderId, Double money);
} }

View File

@ -2,6 +2,7 @@ package com.fuint.business.fleet.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -9,8 +10,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.fleet.entity.FleetConsumeRecord;
import com.fuint.business.fleet.entity.FleetInfo; import com.fuint.business.fleet.entity.FleetInfo;
import com.fuint.business.fleet.entity.FleetMember; import com.fuint.business.fleet.entity.FleetMember;
import com.fuint.business.fleet.mapper.FleetConsumeRecordMapper;
import com.fuint.business.fleet.mapper.FleetInfoMapper; import com.fuint.business.fleet.mapper.FleetInfoMapper;
import com.fuint.business.fleet.mapper.FleetMemberMapper; import com.fuint.business.fleet.mapper.FleetMemberMapper;
import com.fuint.business.fleet.service.FleetInfoService; import com.fuint.business.fleet.service.FleetInfoService;
@ -18,6 +21,8 @@ import com.fuint.business.fleet.vo.FleetInfoUniVo;
import com.fuint.business.fleet.vo.FleetInfoVo; import com.fuint.business.fleet.vo.FleetInfoVo;
import com.fuint.business.member.entity.LJStaff; import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.service.ILJStaffService; import com.fuint.business.member.service.ILJStaffService;
import com.fuint.business.order.entity.AllOrderInfo;
import com.fuint.business.order.mapper.AllOrderInfoMapper;
import com.fuint.business.store.mapper.MtStoreMapper; import com.fuint.business.store.mapper.MtStoreMapper;
import com.fuint.business.storeInformation.entity.LJStore; import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService; import com.fuint.business.storeInformation.service.ILJStoreService;
@ -76,6 +81,12 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper, FleetInfo
@Resource @Resource
private ILJStoreService iljStoreService; private ILJStoreService iljStoreService;
@Autowired
private AllOrderInfoMapper allOrderInfoMapper;
@Autowired
private FleetConsumeRecordMapper fleetConsumeRecordMapper;
@Override @Override
public IPage<FleetInfoVo> queryPage(Page page, FleetInfoVo fleetInfo) { public IPage<FleetInfoVo> queryPage(Page page, FleetInfoVo fleetInfo) {
@ -395,6 +406,64 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper, FleetInfo
return 0; return 0;
} }
/**
* 车队卡支付
*
* @param orderId
*/
@Override
public int payFleet(String orderId, Double money) {
AllOrderInfo allOrderInfo = allOrderInfoMapper.selectOne(new LambdaQueryWrapper<AllOrderInfo>()
.eq(AllOrderInfo::getId, orderId));
if (ObjectUtil.isEmpty(allOrderInfo)) {
throw new RuntimeException("订单不存在");
}
//获取车队订单表的订单信息
FleetConsumeRecord fleetConsumeRecord = fleetConsumeRecordMapper.selectOne(new LambdaQueryWrapper<FleetConsumeRecord>()
.eq(FleetConsumeRecord::getOrderNo, allOrderInfo.getOrderNo()));
if (ObjectUtil.isEmpty(fleetConsumeRecord)) {
throw new RuntimeException("车队订单不存在");
}
// 获取当前车队卡
FleetInfo fleetInfo = baseMapper.selectOne(new LambdaQueryWrapper<FleetInfo>()
.eq(FleetInfo::getId, fleetConsumeRecord.getFleetId()));
//判断支付金额是否超过当前余额
if (money > fleetInfo.getTotalBalance()){
throw new RuntimeException("支付金额超过当前余额");
}
//更新时间
DateTime now = DateUtil.date();
//计算车队的赠送金额与充值金额比例
double recharge = fleetInfo.getRechargeAmount() / fleetInfo.getTotalBalance();
double give = fleetInfo.getGiveAmount() / fleetInfo.getTotalBalance();
//更新当前余额
fleetInfo.setTotalBalance(fleetInfo.getTotalBalance() - money);
//更新赠送金额与充值金额
fleetInfo.setRechargeAmount(fleetInfo.getRechargeAmount() - (money * recharge));
fleetInfo.setGiveAmount(fleetInfo.getGiveAmount() - (money * give));
fleetInfo.setUpdateTime(now);
//更新车队卡余额
baseMapper.updateById(fleetInfo);
//更新订单状态
allOrderInfo.setStatus("paid");
allOrderInfo.setPayTime(now);
allOrderInfo.setUpdateTime(now);
allOrderInfoMapper.updateById(allOrderInfo);
//更新车队订单表
fleetConsumeRecord.setOrderStatus("paid");
fleetConsumeRecord.setPaymentTime(now);
fleetConsumeRecord.setUpdateTime(now);
//计算扣完款后的余额
fleetConsumeRecord.setAfterTheChange(fleetInfo.getTotalBalance());
return fleetConsumeRecordMapper.updateById(fleetConsumeRecord);
}
/** /**
* 创建用户的基础信息 * 创建用户的基础信息

View File

@ -307,10 +307,12 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
// } // }
if (fleetMember.getAdjustType().equals("0")) { if (fleetMember.getAdjustType().equals("0")) {
fleetLinesChange.setRemainingCreditLimit(fleetMember1.getRemainingCreditLimit() + fleetMember.getAdjustLimit()); fleetLinesChange.setRemainingCreditLimit(fleetMember1.getRemainingCreditLimit() + fleetMember.getAdjustLimit());
fleetMember.setSecondaryCardLimit(fleetMember1.getRemainingCreditLimit() + fleetMember.getAdjustLimit()); fleetMember.setSecondaryCardLimit(fleetMember1.getSecondaryCardLimit() + fleetMember.getAdjustLimit());
fleetMember.setRemainingCreditLimit(fleetMember1.getRemainingCreditLimit() + fleetMember.getAdjustLimit());
} else { } else {
fleetLinesChange.setRemainingCreditLimit(fleetMember1.getRemainingCreditLimit() - fleetMember.getAdjustLimit()); fleetLinesChange.setRemainingCreditLimit(fleetMember1.getRemainingCreditLimit() - fleetMember.getAdjustLimit());
fleetMember.setSecondaryCardLimit(fleetMember1.getRemainingCreditLimit() - fleetMember.getAdjustLimit()); fleetMember.setSecondaryCardLimit(fleetMember1.getSecondaryCardLimit() - fleetMember.getAdjustLimit());
fleetMember.setRemainingCreditLimit(fleetMember1.getRemainingCreditLimit() - fleetMember.getAdjustLimit());
} }
} }
fleetLinesChange.setCreateBy(nowAccountInfo.getId().toString()); fleetLinesChange.setCreateBy(nowAccountInfo.getId().toString());

View File

@ -27,7 +27,8 @@
</view> </view>
</view> </view>
<view class="but-sub" @click="show=!show">兑换</view> <!-- <view class="but-sub" @click="show=!show">兑换</view> -->
<view class="but-sub" @click="goExchange">兑换</view>
<u-modal :show="show" :title="title" :content='content' :showCancelButton='true' @confirm="confirm" <u-modal :show="show" :title="title" :content='content' :showCancelButton='true' @confirm="confirm"
@cancel="cancel" confirmColor="#FA6400"></u-modal> @cancel="cancel" confirmColor="#FA6400"></u-modal>
@ -87,7 +88,12 @@
}).then(res => { }).then(res => {
console.log(res, 89) console.log(res, 89)
if (res.code == 200) { if (res.code == 200) {
if(res.data.id){
this.content = '礼品卡已兑换成功,请在礼品卡兑换记录中查看!' this.content = '礼品卡已兑换成功,请在礼品卡兑换记录中查看!'
}else {
this.content = '礼品卡兑换失败。'
}
} else { } else {
this.content = '礼品卡兑换失败。' this.content = '礼品卡兑换失败。'
} }

View File

@ -25,7 +25,11 @@
<view style="width: 85%;"> <view style="width: 85%;">
<view class="right-box"> <view class="right-box">
<view class="l-text">{{item.fromType}}</view> <view class="l-text">{{item.fromType}}</view>
<view class="r-text">{{item.cardPaymentAmount}}</view> <view class="r-text">
<span v-if="item.change_type == 1">+</span>
<span v-else>-</span>
{{item.cardPaymentAmount}}
</view>
</view> </view>
<view class="right-box"> <view class="right-box">
<view class="">{{item.cardType}}</view> <view class="">{{item.cardType}}</view>
@ -39,7 +43,8 @@
</view> </view>
<u-datetime-picker :show="show" v-model="value1" mode="year-month" @cancel="cancel1" <u-datetime-picker :show="show" v-model="value1" mode="year-month" @cancel="cancel1"
@confirm="confirm1"></u-datetime-picker> @confirm="confirm1"></u-datetime-picker>
<u-picker :show="show1" :columns="columnsBalance" keyName="label" @cancel="cancel" @confirm="confirmBalance"></u-picker> <u-picker :show="show1" :columns="columnsBalance" keyName="label" @cancel="cancel"
@confirm="confirmBalance"></u-picker>
</view> </view>
<view v-if="type==1"> <view v-if="type==1">
<view class="tab-bs"> <view class="tab-bs">
@ -105,7 +110,7 @@
show: false, show: false,
show1: false, show1: false,
value1: Number(new Date()), value1: Number(new Date()),
fleetBalance:0, fleetBalance: 0,
columns: [ columns: [
[{ [{
label: '全部类型', label: '全部类型',
@ -120,17 +125,17 @@
], ],
columnsBalance: [ columnsBalance: [
[{ [{
label:'全部类型', label: '全部类型',
type:null type: null
}, { }, {
label:'油品', label: '油品',
type:'油品' type: '油品'
}, { }, {
label:'积分兑换', label: '积分兑换',
type:"积分兑换" type: "积分兑换"
}, { }, {
label:"会员充值", label: "会员充值",
type:'会员充值' type: '会员充值'
}] }]
], ],
queryParams: { queryParams: {
@ -169,7 +174,7 @@
storeId: uni.getStorageSync("storeId"), storeId: uni.getStorageSync("storeId"),
changeReason: "", changeReason: "",
startTime: "", startTime: "",
fromType:null fromType: null
} }
this.getList() this.getList()
}, },
@ -183,7 +188,7 @@
methods: { methods: {
getindex(index) { getindex(index) {
this.type = index this.type = index
this.queryParams.startTime= null this.queryParams.startTime = null
this.value1 = Number(new Date()) this.value1 = Number(new Date())
if (index == 1) { if (index == 1) {
this.getFleetLinesChange() this.getFleetLinesChange()
@ -204,7 +209,7 @@
}) })
}, },
// //
getFleetBalance(){ getFleetBalance() {
request({ request({
url: '/fleetInfo/' + this.queryParams.fleetId, url: '/fleetInfo/' + this.queryParams.fleetId,
@ -262,7 +267,7 @@
} else { } else {
this.queryParams.fromType = e.value[0].type this.queryParams.fromType = e.value[0].type
} }
console.log('this.queryParams:',this.queryParams); console.log('this.queryParams:', this.queryParams);
this.getList() this.getList()
this.show1 = false this.show1 = false
}, },
@ -281,9 +286,9 @@
confirm1(e) { confirm1(e) {
this.queryParams.startTime = this.timestampToString(e.value) this.queryParams.startTime = this.timestampToString(e.value)
this.queryParams.pageNo = 1 this.queryParams.pageNo = 1
if(this.type == 1) { if (this.type == 1) {
this.getFleetLinesChange() this.getFleetLinesChange()
}else{ } else {
this.getList() this.getList()
} }

View File

@ -42,7 +42,7 @@
<view class="but-sub" @click="submitFrom()">确认</view> <view class="but-sub" @click="submitFrom()">确认</view>
<u-picker :show="show" :columns="columns" @cancel="cancel" @confirm="confirm"></u-picker> <u-picker :show="show" :columns="columns" keyName="label" @cancel="cancel" @confirm="confirm"></u-picker>
</view> </view>
</view> </view>
@ -62,7 +62,13 @@
value1: true, value1: true,
show: false, show: false,
columns: [ columns: [
['增加', '扣除'] [{
label:'增加',
value: 0
}, {
label:'扣除',
value: 1
}]
], ],
memberInfo: {}, memberInfo: {},
memberId: '' memberId: ''
@ -91,52 +97,52 @@
}, },
methods: { methods: {
submitFrom(){ submitFrom() {
if (this.memberInfo.adjustType!=''){ if (this.memberInfo.adjustType == '') {
uni.showToast({ uni.showToast({
title:'请选择调整类型', title: '请选择调整类型',
icon:'none' icon: 'none'
}) })
return return
} }
if (!this.memberInfo.adjustLimit){ if (!this.memberInfo.adjustLimit) {
uni.showToast({ uni.showToast({
title:'请输入调整额度', title: '请输入调整额度',
icon:'none' icon: 'none'
}) })
return return
} }
request({ request({
url: 'fleetMember/editLimitPC', url: 'fleetMember/editLimitPC',
method: 'put', method: 'put',
data:this.memberInfo data: this.memberInfo
}).then(res => { }).then(res => {
if (res.data==1){ if (res.data == 1) {
uni.navigateBack() uni.navigateBack()
}else if (res.data==2){ } else if (res.data == 2) {
uni.showToast({ uni.showToast({
title:'共享副卡-不限额,暂不支持修改', title: '共享副卡-不限额,暂不支持修改',
icon:'none' icon: 'none'
}) })
}else if (res.data==3){ } else if (res.data == 3) {
uni.showToast({ uni.showToast({
title:'当前车队卡剩余额度不足,无法扣除', title: '当前车队卡剩余额度不足,无法扣除',
icon:'none' icon: 'none'
}) })
}else if (res.data==4){ } else if (res.data == 4) {
uni.showToast({ uni.showToast({
title:'当前车队卡剩余额度不足,无法扣除', title: '当前车队卡剩余额度不足,无法扣除',
icon:'none' icon: 'none'
}) })
}else if (res.data==5){ } else if (res.data == 5) {
uni.showToast({ uni.showToast({
title:'当前副卡剩余额度不足,无法扣除', title: '当前副卡剩余额度不足,无法扣除',
icon:'none' icon: 'none'
}) })
}else{ } else {
uni.showToast({ uni.showToast({
title:'修改失败,请联系管理员', title: '修改失败,请联系管理员',
icon:'none' icon: 'none'
}) })
} }
}) })
@ -153,8 +159,10 @@
this.show = false this.show = false
}, },
confirm(e) { confirm(e) {
this.memberInfo.adjustType = e.indexs[0] // this.memberInfo.adjustType = e.indexs[0]
console.log(this.memberInfo.adjustType,e.indexs[0],e,130); this.memberInfo.adjustType = e.value[0].value
console.log("this.memberInfo.adjustType",this.memberInfo.adjustType);
console.log(this.memberInfo.adjustType, e.indexs[0], e, 130);
this.show = false this.show = false
}, },
goback() { goback() {