This commit is contained in:
wangh 2024-02-20 10:58:23 +08:00
parent a0629a80fa
commit e804dff7d5
2 changed files with 65 additions and 27 deletions

View File

@ -157,7 +157,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
public int refund(Map<String, String> map) {
Map<String, String> refund = new HashMap<>();
// try {
AllOrderInfo allOrderInfo = selectAllOrderInfoByOrderNo(map.get("orderNo"));
AllOrderInfo allOrderInfo = selectAllOrderInfoByOrderNo(map.get("orderNo"));
if (ObjectUtil.isEmpty(map.get("type"))) {
throw new RuntimeException("该订单不支持退款,无退款类别!");
@ -192,7 +192,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
throw new RuntimeException("该订单类型不支持退款!");
}
boolean flag = false;
if (!"CASH".equals(allOrderInfo.getPayType()) ) {
if (!"CASH".equals(allOrderInfo.getPayType()) && Double.valueOf(map.get("refundAmt")) > 0) {
try {
refund = fyPayService.refund(map);
} catch (Exception e) {
@ -213,16 +213,18 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
baseMapper.updateById(allOrderInfo);
// 处理油品订单
OilOrder oilOrder = new OilOrder();
if (ObjectUtil.isNotEmpty(map.get("isGoods")) && "true".equals(map.get("isGoods"))) {
if (ObjectUtil.isNotEmpty(map.get("isOil")) && "true".equals(map.get("isOil"))) {
oilOrder = oilOrderService.selectOilOrderByOrderNo(map.get("orderNo"));
}
// 处理商品订单
LJOrder ljOrder = new LJOrder();
if (ObjectUtil.isNotEmpty(map.get("isOil")) && "true".equals(map.get("isOil"))) {
if (ObjectUtil.isNotEmpty(map.get("isGoods")) && "true".equals(map.get("isGoods"))) {
ljOrder = ljOrderService.selectGoodsOrder(map.get("orderNo"));
}
// 处理收银台订单
CashierOrder orderNo = new CashierOrder();
@ -233,12 +235,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
}
if (ObjectUtil.isNotEmpty(oilOrder)) {
// 判断是否推掉优惠卷
boolean ifVou = false;
if (ObjectUtil.isNotEmpty(map.get("isOilVouchers")) && "true".equals(map.get("isOilVouchers"))) {
ifVou = true;
}
disposeOil(oilOrder,map.get("refundOrderNo"),ifVou);
disposeOil(oilOrder,map);
commissionRecordService.addRefundRecord(oilOrder.getOrderNo(),"1",oilOrder.getStaffId(),oilOrder.getStoreId());
}
if (ObjectUtil.isNotEmpty(ljOrder)) {
@ -300,7 +297,10 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
CardFavorableRecordService cardFavorableRecordService;
// 处理油品
private void disposeOil(OilOrder oilOrder,String refundOrderNo, boolean ifVou) {
private void disposeOil(OilOrder oilOrder,Map<String, String> map) {
// map.get("refundOrderNo")
// map.get("isOilVouchers")
// 处理订单状态
oilOrder.setOrderStatus("refund");
oilOrderService.updateById(oilOrder);
@ -321,7 +321,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
oilTracking.setQuantityChange(order.getOilNum());
oilTracking.setStoreId(order.getStoreId());
oilTracking.setTankId(oilGun.getTankId());
oilTracking.setOrderNumber(refundOrderNo);
oilTracking.setOrderNumber(map.get("refundOrderNo"));
OilTracking insert = oilTrackingService.insert(oilTracking);
// 处理储值卡
@ -333,10 +333,13 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
userBalanceService.addUserOil(order.getOils(),order.getUserId(),nowAccountInfo.getChainStoreId(),order.getOilCardAmount());
}
// 处理优惠券
if (ObjectUtil.isNotEmpty(order.getCouponId()) && ifVou) {
cardFavorableRecordService.updateStatus(order.getCouponId());
if (ObjectUtil.isNotEmpty(map.get("isOilVouchers")) && "true".equals(map.get("isOilVouchers"))) {
if (ObjectUtil.isNotEmpty(order.getCouponId())) {
cardFavorableRecordService.updateStatus(order.getCouponId());
}
}
}
}

View File

@ -337,8 +337,19 @@
<span>油品</span>
<el-checkbox v-model="isOil">{{cashierOrder.oilPayAmount}}</el-checkbox>
<el-checkbox v-model="isOilVouchers">优惠卷</el-checkbox>
<template >
<el-checkbox v-if="oilInfo.length > 0" v-model="isOil">
<span v-if="oilInfo[0].payAmount && oilInfo[0].payAmount!='0.00'"> {{cashierOrder.oilPayAmount}}</span>
<span v-if="oilInfo[0].balanceAmount>0">储值卡{{oilInfo[0].balanceAmount}} </span>
<span v-if="oilInfo[0].oilCardAmount>0">屯油卡{{ oilInfo[0].oilCardAmount}} </span>
</el-checkbox>
<el-checkbox v-if="oilInfo.length > 0 && oilInfo[0].couponId" v-model="isOilVouchers">优惠卷</el-checkbox>
<!-- <el-checkbox v-if="oilInfo.length > 0 && oilInfo[0].balanceAmount>0" v-model="isOilCard">储值卡{{oilInfo[0].balanceAmount}}</el-checkbox>-->
<!-- <el-checkbox v-if="oilInfo.length > 0 && oilInfo[0].oilCardAmount>0" v-model="isOilFuel">屯油卡{{ oilInfo[0].oilCardAmount }}</el-checkbox>-->
</template>
<div style="margin: 10px 0">
退款原因<br/>
@ -351,7 +362,7 @@
<div>
<el-input placeholder="请输入退款原因" v-model="refundRemark"></el-input>
<br/>
<span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回优惠券储值卡等原路退回处理</span>
<!-- <span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回优惠券储值卡等原路退回处理</span>-->
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogRefund = false"> </el-button>
@ -433,9 +444,11 @@ import {refundApi} from "@/api/cashier/refund";
import {getLodop} from "@/api/LodopFuncs";
import {getOilNumberGun} from "@/api/cashier/oilGuns";
import {formatDate} from "@/utils";
import ScanPayCodeDialog from "@/views/cashier/components/scanPayCodeDialog.vue";
export default {
name: "order_Cashier",
components: {ScanPayCodeDialog},
data(){
return{
// 退
@ -462,6 +475,8 @@ import {formatDate} from "@/utils";
isOilVouchers:false,
isGoods: false,
isOil: false,
isOilCard: false, //
isOilFuel: false, //
//
isSysDate:false,
//
@ -634,17 +649,20 @@ import {formatDate} from "@/utils";
}).catch(() => {});
},
// 退
handleRefund(id){
async handleRefund(id){
this.dialogRefund = true;
cashierOrder(id).then( response => {
await cashierOrder(id).then( response => {
this.cashierOrder = response.data
if (response.data.status === "refund") {
this.$message({
type: 'info',
message: '该订单已经退款'
});
this.dialogRefund = false;
}
//
this.getOilList(response.data.orderNo)
if (response.data.status === "refund") {
this.$message({
type: 'info',
message: '该订单已经退款'
});
this.dialogRefund = false;
}
})
//退
// this.$confirm('退, ?', '', {
@ -675,7 +693,21 @@ import {formatDate} from "@/utils";
this.dialogRefund = false;
this.loading = true;
console.log("cashierOrder",this.cashierOrder)
// 退
let refundAmt = 0
if (this.isGoods) {
refundAmt += this.cashierOrder.goodsPayAmount
}
if (this.isOil && this.cashierOrder.oilPayAmount > 0) {
refundAmt += this.cashierOrder.oilPayAmount
}
// if (this.isOilCard || this.isOilFuel) {
// this.isOil = true
// }
let map={
orderNo: this.cashierOrder.orderNo,
storeId: this.cashierOrder.storeId,
refundRemark:this.radio1 +"-"+ this.refundRemark,
@ -683,6 +715,9 @@ import {formatDate} from "@/utils";
isOilVouchers:this.isOilVouchers,
isGoods: this.isGoods,
isOil: this.isOil,
isOilCard: this.isOilCard, //
isOilFuel: this.isOilFuel, //
refundAmt: refundAmt
}
await refundApi(map).then(res=>{
this.$message({