pc端会员充值修改

This commit is contained in:
wangh 2024-01-11 13:34:42 +08:00
parent 301be80121
commit d518ecd277
10 changed files with 125 additions and 58 deletions

View File

@ -15,7 +15,7 @@
</el-popover> -->
</div>
<div class="box-size">
{{ this.statisticsData.today_sum ? this.statisticsData.today_sum : 0 }}
{{ this.statisticsData.today_sum ? parseFloat(this.statisticsData.today_sum).toFixed(2) : 0 }}
</div>
<div class="box-but">
@ -41,7 +41,7 @@
<span style="margin-right: 5px">本周流水总额</span>
</div>
<div class="box-size">
{{ this.statisticsData.this_week_sum?this.statisticsData.this_week_sum:0 }}
{{ this.statisticsData.this_week_sum?parseFloat(this.statisticsData.this_week_sum).toFixed(2):0 }}
</div>
<div class="box-but">
@ -70,7 +70,7 @@
<span style="margin-right: 5px">本月流水总额</span>
</div>
<div class="box-size">
{{this.statisticsData.this_month_sum?this.statisticsData.this_month_sum:0}}
{{this.statisticsData.this_month_sum?parseFloat(this.statisticsData.this_month_sum).toFixed(2):0}}
</div>
<div class="box-but">

View File

@ -173,8 +173,9 @@
@click="rechargeCard(cardValueList.length,-1)">
<el-input placeholder="请输入充值金额"
size="medium"
v-model.number="cardValueForm.amount"
v-model="cardValueForm.amount"
@input="valueAmoutChange(cardValueForm.amount)"
oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
>
<template slot="prepend">自定义</template>
<template slot="append"></template>
@ -276,7 +277,8 @@
<div style="width: 7%;line-height: 40px">油品类型</div>
<el-radio-group v-model="tabOilType" style="margin-bottom: 30px;">
<el-radio-button v-for="(item,index) in oilTypeList" :label="item.oilType"
@click.native="tabOilTypeClick(item.status)">{{ item.type }}
@click.native="tabOilTypeClick(item.oilType)">
{{ item.type }}
</el-radio-button>
</el-radio-group>
</div>
@ -343,8 +345,9 @@
<div style="display: flex;margin: 20px 0">
<div style="width: 7%">支付方式</div>
<div>
<el-radio v-for="dict in dict.type.payment_type" v-model="cardFuelDieselForm.paymentType"
:key="dict.value" :label="dict.value" :value="dict.value" border>{{ dict.label }}
<el-radio v-for="dict in payList" v-model="cardFuelDieselForm.paymentType"
v-if="dict.dictValue!=='APPLET_CODE'"
:key="dict.dictValue" :label="dict.dictValue" :value="dict.dictValue" border>{{ dict.dictLabel }}
</el-radio>
</div>
</div>
@ -946,17 +949,19 @@ export default {
this.cardValueList.sort((a, b) => a.rechargeBalance - b.rechargeBalance);
console.log("this.grade.name",this.grade)
})
console.log("this.cardValueList", this.grade)
if (this.cardValueList.length > 0) {
//
if (this.grade && this.grade.name) {
this.cardValueList = this.cardValueList.filter(item => {
return item.membershipLevel.includes(this.grade.name);
return item.groupOriented === "1" || item.membershipLevel.includes(this.grade.id);
});
console.log("this.cardValueList", this.cardValueList)
this.rechargeCard(0);
} else {
this.cardValueList = []
this.cardValueList = this.cardValueList.filter(item => {
return item.groupOriented === "1";
});
}
}
},
@ -967,7 +972,7 @@ export default {
console.log("data17.16", this.cardValueForm.amount)
if (!data) {
this.cardValueForm.amount = 0
this.cardValueForm.amount = ''
} else {
this.cardValueForm.amount = data
@ -1075,7 +1080,7 @@ export default {
},
//
async tabOilTypeClick(data) {
// console.log("aaaaaaaaaaaaaa",data)
console.log("aaaaaaaaaaaaaa",data)
await this.getCardFuelDieselList()
this.cardFuelDieselList = this.sourceCardFuelDieselList.filter(item => {
@ -1087,7 +1092,8 @@ export default {
},
selectOilType(status, oilType) {
this.tabOilType = oilType;
this.tabOilTypeClick(status);
console.log("453",oilType)
this.tabOilTypeClick(oilType);
},
//
@ -1109,7 +1115,7 @@ export default {
this.flag = flag
if (flag === 1) {
if (this.cardValueForm.paymentType == '') {
if (this.cardValueForm.paymentType === '') {
this.$message.error('请选择支付方式');
return
}
@ -1125,7 +1131,7 @@ export default {
this.realyPayBills = this.cardValueForm.rechargeBalance
}
} else if (flag === 2) {
if (this.cardFuelDieselForm.paymentType == '') {
if (this.cardFuelDieselForm.paymentType === '') {
this.$message.error('请选择支付方式');
return
}
@ -1239,12 +1245,15 @@ export default {
let file = {}
//
file = this.cardFuelDieselList[index]
console.log("file",file)
this.cardFuelDieselForm.points = file.points
this.cardFuelDieselForm.rechargeBalance = file.rechargeBalance
this.cardFuelDieselForm.oilType = file.oilType
this.cardFuelDieselForm.type = file.type
this.cardFuelDieselForm.chainStorId = file.chainStorId
this.cardFuelDieselForm.incomeLitres = file.incomeLitres
this.cardFuelDieselForm.lockupPrice = file.lockupPrice
this.cardFuelDieselForm.cardFuelId = file.id
// this.realyPayBills = file.rechargeBalance
@ -1254,12 +1263,11 @@ export default {
let userForm = this.form
if (!this.authCode && this.cardValueForm.paymentType != "CASH") {
this.$message.error('请先扫码');
return
}
if (this.flag === 1) {
if (!this.authCode && this.cardValueForm.paymentType !== "CASH") {
this.$message.error('请先扫码');
return
}
// id
this.cardValueForm.mtUserId = userForm.id
this.cardValueForm.name = userForm.name
@ -1274,33 +1282,30 @@ export default {
if (response.data != null) {
this.loading = true;
id = response.data.id
// if (response.data.payStatus == "paid"){
// this.isPaySuccess = true;
// }
}
});
let this_ = this
//
let timer = setInterval(async () => {
getCheckTheStatusOfYourPaymentApi(id).then(response => {
await getCheckTheStatusOfYourPaymentApi(id).then(response => {
if (response.data != null) {
if (response.data.payStatus == "unpaid") {
const payStatus = response.data.payStatus
if (payStatus === "unpaid") {
this_.isQuery = true;
}
if (response.data.payStatus == "paid") {
}else if (payStatus === "paid") {
//
this_.isPaySuccess = true;
this_.isQuery = false;
}
if (response.data.payStatus == "payFail") {
}else if (payStatus === "payFail") {
this_.isPaySuccess = false;
this_.isQuery = false;
}
}
})
}, 500);
}, 1000);
let timer2 = setInterval(function () {
if (this_.isQuery == false) {
if (!this_.isQuery) {
this_.loading = false;
this_.isPay = false;
clearInterval(timer);
@ -1315,14 +1320,19 @@ export default {
this_.loading = false;
this_.isPay = false;
this.isPaySuccess = false;
}, 30000)
} else if (this.flag === 2) {
// console.log("cardFuelDieselForm",this.cardFuelDieselForm)
if (!this.authCode && this.cardFuelDieselForm.paymentType !== "CASH") {
this.$message.error('请先扫码');
return
}
console.log("cardFuelDieselForm",this.cardFuelDieselForm)
this.cardFuelDieselForm.mtUserId = userForm.id
this.cardFuelDieselForm.name = userForm.name
this.cardFuelDieselForm.mobile = userForm.mobile
this.cardFuelDieselForm.authCode = this.authCode
console.log("this.cardFuelDieselForm",this.cardFuelDieselForm)
let id;
@ -1376,6 +1386,7 @@ export default {
},
//
getPayList() {
// console.log("payment_type1")
getDicts("payment_type").then(response => {

View File

@ -43,14 +43,23 @@
<div v-else>
<el-table ref="tables2" v-loading="loading" :data="fuelList">
<el-table-column align="center" label="所属油站" prop="storeName"/>
<el-table-column align="center" label="变动账户" prop="oilType" />
<el-table-column label="类型" align="center" prop="changeType">
<el-table-column align="center" label="油品" >
<template slot-scope="scope">
<el-tag v-if="scope.row.changeType == 0">减少</el-tag>
<el-tag type="success" v-else>增加</el-tag>
-<span>{{scope.row.type?scope.row.type:' -- '}}</span>
</template>
</el-table-column>
<el-table-column label="类型" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.changeType === '0'">减少</el-tag>
<el-tag type="success" v-else-if="scope.row.changeType === '1' ">增加</el-tag>
<el-tag type="success" v-else>--</el-tag>
</template>
</el-table-column>
<el-table-column label="变动升数" align="center" prop="balance">
<template slot-scope="scope">
<span>{{scope.row.balance?scope.row.balance:"--"}}</span>
</template>
</el-table-column>
<el-table-column label="变动升数" align="center" prop="balance"/>
<el-table-column label="订单号" align="center" prop="orderNo"/>
<el-table-column label="描述" align="center" prop="fromType"/>
<el-table-column label="变动时间" align="center" prop="createTime"/>

View File

@ -133,6 +133,8 @@ public class CardFuelRecord extends BaseEntity {
*/
private String oilName;
private String status; //订单处理状态防止二次执行0是订单未完成1是订单完成不可重复执行

View File

@ -132,6 +132,7 @@
select
ms.name storeName,
cfc.oil_type oilType,
cfc.type type,
cfc.change_type changeType,
cfc.balance balance,
cfc.order_no orderNo,
@ -151,8 +152,8 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into card_fuel_change(user_id, chain_store_id, store_id, change_type, from_type, balance, create_time, create_by, update_time, update_by, type, oil_type, unit)
values (#{userId}, #{chainStoreId}, #{storeId}, #{changeType}, #{fromType}, #{balance}, #{createTime}, #{createBy}, #{updateTime}, #{updateBy}, #{type}, #{oilType}, #{unit})
insert into card_fuel_change(user_id, chain_store_id, store_id, change_type, from_type, balance, create_time, create_by, update_time, update_by, type, oil_type, unit,order_no)
values (#{userId}, #{chainStoreId}, #{storeId}, #{changeType}, #{fromType}, #{balance}, #{createTime}, #{createBy}, #{updateTime}, #{updateBy}, #{type}, #{oilType}, #{unit},#{orderNo})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">

View File

@ -35,7 +35,7 @@
<!--查询单个-->
<select id="queryById" resultMap="CardFuelRecordMap">
select
id, mt_user_id, name, mobile, mt_staff_id, real_name, staff_mobile, card_fuel_id, recharge_balance, income_litres, payment_type, remark, points, growth_value, royalty_type, percentage_commissions, amount_commission, create_by, create_time, update_by, update_time, pay_status, store_id, payment_no, type, oil_type, chain_store_id
id, mt_user_id, name, mobile, mt_staff_id, real_name, staff_mobile, card_fuel_id, recharge_balance, income_litres, payment_type, remark, points, growth_value, royalty_type, percentage_commissions, amount_commission, create_by, create_time, update_by, update_time, pay_status, store_id, payment_no, type, oil_type, chain_store_id,status
from card_fuel_record
where id = #{id}
</select>
@ -217,7 +217,7 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into card_fuel_record(mt_user_id, name, mobile, mt_staff_id, real_name, staff_mobile, card_fuel_id, recharge_balance,lockup_price, income_litres,pay_amount, payment_type, remark, points, growth_value, royalty_type, percentage_commissions, amount_commission, create_by, create_time, update_by, update_time, pay_status, store_id, payment_no, type, oil_type,oil_name,chain_store_id)
values (#{mtUserId}, #{name}, #{mobile}, #{mtStaffId}, #{realName}, #{staffMobile}, #{cardFuelId}, #{rechargeBalance}, #{lockupPrice}, #{incomeLitres}, #{payAmount}, #{paymentType}, #{remark}, #{points}, #{growthValue}, #{royaltyType}, #{percentageCommissions}, #{amountCommission}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{payStatus}, #{storeId}, #{paymentNo}, #{type}, #{oilType},#{oilName}, #{chainStoreId})
values (#{mtUserId}, #{name}, #{mobile}, #{mtStaffId}, #{realName}, #{staffMobile}, #{cardFuelId}, #{rechargeBalance}, #{lockupPrice}, #{incomeLitres}, #{payAmount}, #{paymentType}, #{remark}, #{points}, #{growthValue}, #{royaltyType}, #{percentageCommissions}, #{amountCommission}, #{createBy}, #{createTime}, #{updateBy}, #{createTime}, #{payStatus}, #{storeId}, #{paymentNo}, #{type}, #{oilType},#{oilName}, #{chainStoreId})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
@ -266,6 +266,7 @@
<update id="update">
update card_fuel_record
<set>
update_time = NOW(),
<if test="mtUserId != null">
mt_user_id = #{mtUserId},
</if>
@ -323,9 +324,6 @@
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="payStatus != null and payStatus != ''">
pay_status = #{payStatus},
</if>
@ -341,6 +339,10 @@
<if test="oilType != null and oilType != ''">
oil_type = #{oilType},
</if>
<if test="status != null and status != ''">
status = #{status},
</if>
</set>
where id = #{id}
</update>

View File

@ -1,5 +1,6 @@
package com.fuint.business.marketingActivity.cardFule.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange;
@ -67,8 +68,11 @@ public class CardFuelChangeServiceImpl implements CardFuelChangeService {
*/
@Override
public CardFuelChange insert(CardFuelChange cardFuelChange) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cardFuelChange.setStoreId(nowAccountInfo.getStoreId());
if (ObjectUtil.isEmpty(cardFuelChange.getStoreId())) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cardFuelChange.setStoreId(nowAccountInfo.getStoreId());
}
this.cardFuelChangeMapper.insert(cardFuelChange);
return cardFuelChange;
}

View File

@ -65,7 +65,7 @@ public class CardFuelDieselServiceImpl extends ServiceImpl<CardFuelDieselMapper,
//返回囤油卡状态
for (CardFuelDiesel record : records) {
if (ObjectUtils.isNotEmpty(record.getOilType())){
record.setOilType(oilNameService.selectOilNameById(Integer.parseInt(record.getOilType())).getOilName());
record.setType(record.getType()+" "+oilNameService.selectOilNameById(Integer.parseInt(record.getOilType())).getOilName());
}
record.setStatus(record.getStatus().equals("1") ? "true" : "false");
if(ObjectUtils.isNotEmpty(record.getActiveTime()) && "1".equals(record.getActiveTime())){

View File

@ -45,6 +45,7 @@ import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.util.RedisLock;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -58,6 +59,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* 燃油充值表(CardFuelRecord)表服务实现类
@ -168,6 +170,8 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
return i>0;
}
@Resource
ILJStaffService iljStaffService;
@Override
public CardFuelRecordDTO prepaidFuelTopUp(CardFuelRecordDTO cardFuelRecordDTO) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
@ -186,18 +190,29 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
cardFuelRecordDTO.setPaymentNo(orderNo);
cardFuelRecordDTO.setStoreId(nowAccountInfo.getStoreId());
cardFuelRecordDTO.setChainStoreId(nowAccountInfo.getChainStoreId());
cardFuelRecordDTO.setPayAmount(cardFuelRecordDTO.getRechargeBalance());
if (ObjectUtil.isEmpty(cardFuelRecordDTO.getMtStaffId())) {
cardFuelRecordDTO.setMtStaffId(nowAccountInfo.getStaffId());
}
LJStaff ljStaff = iljStaffService.selectStaffById(cardFuelRecordDTO.getMtStaffId());
if (ObjectUtil.isNotEmpty(ljStaff)) {
cardFuelRecordDTO.setStaffMobile(ljStaff.getMobile());
cardFuelRecordDTO.setRealName(ljStaff.getRealName());
}
cardFuelRecordMapper.insert(cardFuelRecordDTO);
Double theAmountToBePaid = 0.0;
double theAmountToBePaid = 0.0;
boolean flag = false;
System.out.println("cardFuelRecordDTO.getRechargeBalance():"+cardFuelRecordDTO.getRechargeBalance());
double epsilon = 1e-10; // 阈值
if (!ObjectUtil.isEmpty(cardFuelRecordDTO.getRechargeBalance())
&& cardFuelRecordDTO.getRechargeBalance() > epsilon
// && cardFuelRecordDTO.getRechargeBalance() > epsilon
&& cardFuelRecordDTO.getRechargeBalance().compareTo(0.00)>0
&& "unpaid".equals(cardFuelRecordDTO.getPayStatus())){
theAmountToBePaid = cardFuelRecordDTO.getRechargeBalance();
theAmountToBePaid = cardFuelRecordDTO.getRechargeBalance().doubleValue();
flag = true;
}
@ -206,8 +221,6 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
Integer allAmount = (int) (theAmountToBePaid*100);
System.out.println("allAmount1:"+allAmount);
// Integer allAmount = (int) (0.01 * 100);
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(nowAccountInfo.getStoreId());
// 处理支付需要的数据
Map<String, String> map = new HashMap<>();
@ -232,10 +245,22 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
return cardFuelRecordDTO;
}
@Autowired
private RedisLock redisLock;
/**
* 查询支付状态 修改相关关联表
* @param id
* @return
*/
@Override
public CardFuelRecord checkTheStatusOfYourPaymentByFuel(Integer id) {
CardFuelRecord cardFuelRecord = cardFuelRecordMapper.queryById(id);
if ("paid".equals(cardFuelRecord.getPayStatus())){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
String lockKey = "CardFuelRecord"+nowAccountInfo.getStoreId()+id;
Boolean isLock = redisLock.tryLock(lockKey, 5000, TimeUnit.MILLISECONDS);
if (isLock && "paid".equals(cardFuelRecord.getPayStatus()) && "0".equals(cardFuelRecord.getStatus())){
// 查询用户信息
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById2(cardFuelRecord.getMtUserId(),cardFuelRecord.getChainStoreId());
@ -255,6 +280,13 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
IntegralDetail integralDetail = changesInPoints(cardFuelRecord,ljUserVos);
integralDetailService.insert2(integralDetail);
}
CardFuelRecord editCardFuelRecord = new CardFuelRecord();
editCardFuelRecord.setId(id);
editCardFuelRecord.setStatus("1");
cardFuelRecordMapper.update(editCardFuelRecord);
redisLock.unlock(lockKey);
}else {
return cardFuelRecord;
}
@ -265,9 +297,9 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
List<Map<String, String>> refuelMoneyList = new ArrayList<>();
UserBalance userBalance = new UserBalance();
userBalance.setId(ljUserVos.getBalanceId());
if (ObjectUtil.isEmpty(ljUserVos.getRefuelMoney())) {
if (ObjectUtil.isEmpty(ljUserVos.getRefuelMoney()) || ljUserVos.getRefuelMoney().length() < 6) {
// 判断是否存在加油卡
Map<String, String> refuelMoney = new HashMap<>();
// todo 目前没有用id
// refuelMoney.put("oilNumberId",cardFuelRecord.getOilNumberId().toString());
// refuelMoney.put("oilNameId",cardFuelRecord.getType());
refuelMoney.put("type",cardFuelRecord.getType());
@ -321,6 +353,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
cardFuelChange.setBalance(cardFuelRecord.getIncomeLitres());
cardFuelChange.setType(cardFuelRecord.getType());
cardFuelChange.setOilType(cardFuelRecord.getOilType());
cardFuelChange.setOrderNo(cardFuelRecord.getPaymentNo());
return cardFuelChange;
}
@ -333,6 +366,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
BigDecimal bigPoints = new BigDecimal(cardFuelRecord.getPoints());
BigDecimal addPoints = bigPoints.add(new BigDecimal(ljUserVos.getPoints()));
integralDetail.setCurrentPoints(addPoints.intValue());
integralDetail.setCurrentPoints(addPoints.intValue());
integralDetail.setChangeReason("购买油卡赠送");
integralDetail.setStoreId(cardFuelRecord.getStoreId());

View File

@ -327,7 +327,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
theAmountToBePaid = cardValueRecordDTO.getRealyPayBills();
flag = true;
}
// todo
Integer allAmount1 = (int) (theAmountToBePaid*100);
System.out.println("allAmount123:"+allAmount1);
if (flag) {
Integer allAmount = (int) (theAmountToBePaid*100);
System.out.println("allAmount1:"+allAmount);
@ -436,7 +437,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
CardValueRecord updateCardValueRecord = new CardValueRecord();
updateCardValueRecord.setId(id);
updateCardValueRecord.setStatus("1");
cardValueRecord.setStatus("1");
baseMapper.updateById(updateCardValueRecord);
redisLock.unlock(lockKey);
} else {
return cardValueRecord;
}