修改bug
This commit is contained in:
parent
93e3d51e5b
commit
4fa7be30bd
@ -14,9 +14,9 @@
|
||||
<el-select v-model="queryParams.oilType" clearable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="dict in oilList"
|
||||
:key="dict.oilName"
|
||||
:key="dict.id"
|
||||
:label="dict.oilName"
|
||||
:value="dict.oilName">
|
||||
:value="dict.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="queryParams.activeStatus" placeholder="请选择" style="margin:0px 20px">
|
||||
@ -167,10 +167,8 @@
|
||||
<el-select v-model="ruleForm.oilType" placeholder="请选择" >
|
||||
<el-option
|
||||
v-for="dict in oilList"
|
||||
|
||||
:key="dict.id.toString()"
|
||||
:label="dict.oilName"
|
||||
|
||||
:value="dict.id.toString()">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
@ -50,6 +50,21 @@ public class CardFuelDieselController extends BaseController {
|
||||
return getSuccessResult(this.cardFuelDieselService.select(page, cardFuelDiesel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询所有数据(小程序端)
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param cardFuelDiesel
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("selectAllApplet")
|
||||
public ResponseObject selectAllApplet(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("cardFuelDiesel") CardFuelDiesel cardFuelDiesel) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
return getSuccessResult(this.cardFuelDieselService.selectAllApplet(page, cardFuelDiesel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
|
@ -165,7 +165,5 @@ public class CardFuelRecordController extends BaseController {
|
||||
return getSuccessResult(iPageList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -11,5 +11,9 @@ public class CardFuelRecordDTO extends CardFuelRecord {
|
||||
private Double realyPayBills;
|
||||
//付款类型 1.微信 2.支付宝
|
||||
private String payType;
|
||||
//优惠券id
|
||||
private Integer cardFavorableId;
|
||||
//卡券领取记录id
|
||||
private Integer cardRecordId;
|
||||
|
||||
}
|
||||
|
@ -24,5 +24,7 @@ public interface CardFuelDieselService extends IService<CardFuelDiesel> {
|
||||
* @return
|
||||
*/
|
||||
IPage select(Page page, CardFuelDiesel cardFuelDiesel);
|
||||
|
||||
IPage selectAllApplet(Page page, CardFuelDiesel cardFuelDiesel);
|
||||
}
|
||||
|
||||
|
@ -80,5 +80,49 @@ public class CardFuelDieselServiceImpl extends ServiceImpl<CardFuelDieselMapper,
|
||||
}
|
||||
return page1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询所有数据(小程序端)
|
||||
* @param page
|
||||
* @param cardFuelDiesel
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage selectAllApplet(Page page, CardFuelDiesel cardFuelDiesel) {
|
||||
//构建查询条件
|
||||
LambdaQueryWrapper<CardFuelDiesel> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(ObjectUtils.isNotEmpty(cardFuelDiesel.getOilType())){
|
||||
queryWrapper.eq(CardFuelDiesel::getOilType,cardFuelDiesel.getOilType());
|
||||
}
|
||||
queryWrapper.eq(CardFuelDiesel::getStoreId,cardFuelDiesel.getStoreId());
|
||||
if (ObjectUtils.isNotEmpty(cardFuelDiesel.getActiveStatus())){
|
||||
queryWrapper.eq(CardFuelDiesel::getActiveStatus,cardFuelDiesel.getActiveStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardFuelDiesel.getType())) {
|
||||
queryWrapper.eq(CardFuelDiesel::getType,cardFuelDiesel.getType());
|
||||
}
|
||||
queryWrapper.orderByDesc(CardFuelDiesel::getCreateTime);
|
||||
IPage page1 = page(page, queryWrapper);
|
||||
List<CardFuelDiesel> records = page1.getRecords();
|
||||
//返回囤油卡状态
|
||||
for (CardFuelDiesel record : records) {
|
||||
record.setOilType(oilNameService.selectOilNameById(Integer.parseInt(record.getOilType())).getOilName());
|
||||
record.setStatus(record.getStatus().equals("1") ? "true" : "false");
|
||||
if(ObjectUtils.isNotEmpty(record.getActiveTime()) && "1".equals(record.getActiveTime())){
|
||||
record.setActivityProgress("1");
|
||||
}
|
||||
//活动进度状态
|
||||
if (ObjectUtils.isNotEmpty(record.getStartTime()) &&
|
||||
ObjectUtils.isNotEmpty(record.getEndTime()) &&
|
||||
record.getActiveTime().equals("2")){
|
||||
record.setActivityProgress(record.getStartTime().getTime() > new Date().getTime() ? "0" : "");
|
||||
if(ObjectUtils.isEmpty(record.getActivityProgress())){
|
||||
record.setActivityProgress(record.getEndTime().getTime() > new Date().getTime() ? "1" : "2");
|
||||
}
|
||||
}
|
||||
}
|
||||
return page1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,6 +370,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public ReturnParameter addFuleCarRecords(CardFuelRecordDTO cardFuelRecordDTO) throws Exception {
|
||||
Double cardFavorableValue = 0.0;
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
@ -399,7 +400,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
//付款类型
|
||||
cardFuleOrders.setPayType(cardFuelRecordDTO.getPayType());
|
||||
//用户信息
|
||||
cardFuleOrders.setStoreId(ljUserVo.getStoreId());
|
||||
cardFuleOrders.setStoreId(cardFuelRecordDTO.getStoreId());
|
||||
cardFuleOrders.setMtUserId(ljUserVo.getId());
|
||||
cardFuleOrders.setName(ljUserVo.getName());
|
||||
cardFuleOrders.setMobile(ljUserVo.getMobile());
|
||||
@ -426,7 +427,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
//封装支付参数
|
||||
receiveParameter.setOrderNo(orderNo);
|
||||
receiveParameter.setType("5");
|
||||
receiveParameter.setStoreId(nowAccountInfo.getStoreId());
|
||||
receiveParameter.setStoreId(cardFuelRecordDTO.getStoreId());
|
||||
receiveParameter.setGoodsMoney(cardFuleOrders.getPayAmount());
|
||||
receiveParameter.setPayType(cardFuleOrders.getPayType());
|
||||
receiveParameter.setUserId(nowAccountInfo.getId());
|
||||
@ -457,7 +458,6 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
*/
|
||||
@Transactional
|
||||
public void fuleRechargeFinallDeal(String orderNo) throws JsonProcessingException {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
UserBalance userBalance1 = new UserBalance();
|
||||
CardFuelRecord cardFuelRecord = new CardFuelRecord();
|
||||
OilBalanceChange oilBalanceChange = new OilBalanceChange();
|
||||
@ -469,7 +469,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
cardFuleOrders.setPayTime(new Date());
|
||||
cardFuleOrdersService.updateById(cardFuleOrders);
|
||||
//用户余额
|
||||
UserBalance userBalance = userBalanceService.selectUserBalance(cardFuleOrders.getMtUserId());
|
||||
UserBalance userBalance = userBalanceService.selectUserBalanceByStorId(cardFuleOrders.getMtUserId(),cardFuleOrders.getStoreId());
|
||||
//用户 (新用户新建 老用户叠加)
|
||||
if (ObjectUtils.isNotEmpty(userBalance)){
|
||||
//积分
|
||||
@ -477,45 +477,61 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
userBalance.setPoints(userBalance.getPoints() + cardFuleOrders.getPoints());
|
||||
}
|
||||
//屯油卡余油
|
||||
if (ObjectUtils.isNotEmpty(userBalance.getRefuelMoney()) && ObjectUtils.isNotEmpty(cardFuleOrders.getIncomeLitres())
|
||||
if (ObjectUtils.isNotEmpty(cardFuleOrders.getIncomeLitres())
|
||||
&& ObjectUtils.isNotEmpty(cardFuleOrders.getType()) && ObjectUtils.isNotEmpty(cardFuleOrders.getOilType())){
|
||||
String refuelMoney = userBalance.getRefuelMoney();
|
||||
List<JSONObject> jsonObjectList = JSONArray.parseArray(refuelMoney, JSONObject.class);
|
||||
for (JSONObject jsonObject : jsonObjectList) {
|
||||
if (cardFuleOrders.getOilType().equals(jsonObject.getString("oilType"))){
|
||||
double refuelMoney1 = jsonObject.getDouble("refuelMoney");
|
||||
refuelMoney1 = (cardFuleOrders.getIncomeLitres() + refuelMoney1);
|
||||
jsonObject.put("refuelMoney", refuelMoney1).toString();
|
||||
|
||||
}else {
|
||||
if (ObjectUtils.isNotEmpty(refuelMoney)){
|
||||
List<JSONObject> jsonObjectList = JSONArray.parseArray(refuelMoney, JSONObject.class);
|
||||
ArrayList<String> oilTypeList= new ArrayList<>();
|
||||
for (JSONObject jsonObject : jsonObjectList) {
|
||||
String oilType = jsonObject.getString("oilType");
|
||||
if (ObjectUtils.isNotEmpty(oilType)){
|
||||
oilTypeList.add(oilType);
|
||||
}
|
||||
}
|
||||
//如果油品类型包括所加的油品,叠加,不包括,新增
|
||||
if (oilTypeList.contains(cardFuleOrders.getOilType())){
|
||||
for (JSONObject jsonObject : jsonObjectList) {
|
||||
if (cardFuleOrders.getOilType().equals(jsonObject.getString("oilType"))){
|
||||
double incomeLitres = jsonObject.getDouble("incomeLitres");
|
||||
incomeLitres = (cardFuleOrders.getIncomeLitres() + incomeLitres);
|
||||
jsonObject.put("incomeLitres", incomeLitres);
|
||||
String userBnlancce = jsonObjectList.toString();
|
||||
userBalance.setRefuelMoney(userBnlancce);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("type",cardFuleOrders.getType());
|
||||
jsonObject1.put("oilType",cardFuleOrders.getOilType());
|
||||
jsonObject1.put("incomeLitres",cardFuleOrders.getIncomeLitres());
|
||||
jsonObjectList.add(jsonObject1);
|
||||
String userBnlancce = jsonObjectList.toString();
|
||||
userBalance.setRefuelMoney(userBnlancce);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
ArrayList<JSONObject> jsonObjects = new ArrayList<>();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("type",cardFuleOrders.getType());
|
||||
jsonObject.put("oilType",cardFuleOrders.getOilType());
|
||||
jsonObject.put("incomeLitres",cardFuleOrders.getIncomeLitres());
|
||||
jsonObjects.add(jsonObject);
|
||||
userBalance.setRefuelMoney(jsonObjects.toString());
|
||||
}
|
||||
String userBnlancce = jsonObjectList.toString();
|
||||
userBalance.setRefuelMoney(userBnlancce);
|
||||
}
|
||||
userBalanceService.updateUserBalance(userBalance);
|
||||
}else {
|
||||
userBalance1.setMtUserId(cardFuleOrders.getMtUserId());
|
||||
userBalance1.setStoreId(cardFuleOrders.getStoreId());
|
||||
userBalance1.setChainStoreId(nowAccountInfo.getChainStoreId());
|
||||
//积分
|
||||
if (ObjectUtils.isNotEmpty(cardFuleOrders.getPoints())){
|
||||
userBalance1.setPoints(cardFuleOrders.getPoints());
|
||||
}
|
||||
//油量
|
||||
/*if (ObjectUtils.isNotEmpty(userBalance.getRefuelMoney()) && ObjectUtils.isNotEmpty(cardValueOrders.getAmount())){
|
||||
userBalance.setCardBalance(userBalance.getCardBalance() + cardValueOrders.getAmount());
|
||||
}*/
|
||||
userBalanceService.save(userBalance1);
|
||||
}
|
||||
//用户余额变化记录
|
||||
//用户余油变化记录
|
||||
oilBalanceChange.setUserId(cardFuleOrders.getMtUserId());
|
||||
oilBalanceChange.setChainStoreId(nowAccountInfo.getChainStoreId());
|
||||
oilBalanceChange.setStoreId(cardFuleOrders.getStoreId());
|
||||
oilBalanceChange.setChangeType("1");
|
||||
oilBalanceChange.setFromType("囤油卡充值");
|
||||
@ -541,7 +557,6 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
cardFuelRecord.setPayStatus("paid");
|
||||
cardFuelRecord.setStoreId(cardFuleOrders.getStoreId());
|
||||
cardFuelRecord.setPaymentNo(cardFuleOrders.getOrderNo());
|
||||
cardFuelRecord.setChainStoreId(nowAccountInfo.getChainStoreId());
|
||||
cardFuelRecord.setType(cardFuleOrders.getType());
|
||||
cardFuelRecord.setOilType(cardFuleOrders.getOilType());
|
||||
cardFuelRecordMapper.insert(cardFuelRecord);
|
||||
|
@ -64,7 +64,7 @@
|
||||
<view class="boxback" v-if="actinput == 1">
|
||||
<view class="box-cz">
|
||||
<view class="box-jg" :class="{ 'actbox' : actindex == index }" v-for="(item,index) in cardFuleList"
|
||||
:key="index" @click="fuleindex(index,item.rechargeBalance,item.points)">
|
||||
:key="index" @click="fuleindex(index,item.rechargeBalance,item.points,item.id)">
|
||||
<view class="s-title" :class="{ 'actsize' : actindex == index }">油品:{{item.type}}
|
||||
</view>
|
||||
<view class="s-title" :class="{ 'actsize' : actindex == index }">油号:{{item.oilType}}
|
||||
@ -93,7 +93,7 @@
|
||||
|
||||
<!-- 底部 -->
|
||||
<view class="bottom-box">
|
||||
<view class="anniu" @click="addValueCarRecords()">
|
||||
<view class="anniu" @click="addFuleCarRecords()">
|
||||
<text>立即充值</text>
|
||||
</view>
|
||||
<view class="dibu" @click="goRechargeRecords()">
|
||||
@ -154,6 +154,7 @@
|
||||
storeId: '',
|
||||
staffId: '',
|
||||
carValueId: '',
|
||||
cardFuleId: '',
|
||||
shows: false,
|
||||
money: '',
|
||||
message: '',
|
||||
@ -194,9 +195,7 @@
|
||||
actinput: 0,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
||||
},
|
||||
components: {},
|
||||
onLoad(option) {
|
||||
this.storeId = uni.getStorageSync("storeId")
|
||||
this.actinput = option.id
|
||||
@ -209,12 +208,67 @@
|
||||
if (option.id == 1) {
|
||||
console.log("囤油");
|
||||
this.getFuelCars();
|
||||
|
||||
}
|
||||
this.getStaffList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
//囤油卡充值
|
||||
addFuleCarRecords() {
|
||||
if (this.staffId == '') {
|
||||
uni.showToast({
|
||||
title: "员工为必填项",
|
||||
icon: Error
|
||||
})
|
||||
return
|
||||
}
|
||||
console.log("2222222222", this.carValueId)
|
||||
if (this.carValueId == '') {
|
||||
uni.showToast({
|
||||
title: "囤油卡为必填项",
|
||||
icon: Error
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
request({
|
||||
url: 'business/marketingActivity/cardFuelRecord/addFuleCarRecords',
|
||||
method: 'post',
|
||||
data: {
|
||||
payType: 'WECHAT',
|
||||
mtStaffId: this.staffId,
|
||||
id: this.carValueId,
|
||||
storeId: this.storeId,
|
||||
cardFavorableId: this.cardFavorableId,
|
||||
cardRecordId: this.cardRecordId
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code === 200) {
|
||||
let _this = this
|
||||
console.log(res)
|
||||
let payProvider = "wxpay"
|
||||
_this.orderInfo = JSON.parse(res.data.reservedPayInfo);
|
||||
uni.requestPayment({
|
||||
// 微信支付provider: 'wxpay' 支付宝支付 'alipay'
|
||||
provider: payProvider,
|
||||
timeStamp: _this.orderInfo.timeStamp,
|
||||
nonceStr: _this.orderInfo.nonceStr,
|
||||
package: _this.orderInfo.package,
|
||||
signType: 'MD5',
|
||||
paySign: _this.orderInfo.paySign,
|
||||
success: function(res) {
|
||||
console.log('success:', res);
|
||||
uni.reLaunch({
|
||||
url: '/pagesRefuel/orderSuccess/index'
|
||||
})
|
||||
},
|
||||
fail: function(err) {}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
//储值卡充值
|
||||
addValueCarRecords() {
|
||||
if (this.staffId == '') {
|
||||
@ -321,8 +375,10 @@
|
||||
}
|
||||
this.actindex = index
|
||||
},
|
||||
fuleindex(index, text, points, ) {
|
||||
this.shuomingFList = []
|
||||
fuleindex(index, text, points, id) {
|
||||
this.shuomingFList = [];
|
||||
this.carValueId = id;
|
||||
console.log("1111111111", this.carValueId)
|
||||
console.log(this.shuomingFList);
|
||||
if (text) {
|
||||
this.text = text
|
||||
@ -368,17 +424,18 @@
|
||||
//囤油卡
|
||||
getFuelCars() {
|
||||
request({
|
||||
url: 'business/marketingActivity/cardFuelDiesel',
|
||||
url: 'business/marketingActivity/cardFuelDiesel/selectAllApplet',
|
||||
method: 'get',
|
||||
data: {
|
||||
activeStatus: '1'
|
||||
activeStatus: '1',
|
||||
storeId: this.storeId,
|
||||
},
|
||||
}).then(res => {
|
||||
this.cardValueList = []
|
||||
if (res.code == 200) {
|
||||
this.cardFuleList = res.data.records
|
||||
|
||||
this.fuleindex(0, res.data.records[0].rechargeBalance, res.data.records[0].points)
|
||||
this.fuleindex(0, res.data.records[0].rechargeBalance, res.data.records[0].points, res.data
|
||||
.records[0].id)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user