退款
This commit is contained in:
parent
a0629a80fa
commit
e804dff7d5
@ -157,7 +157,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
|
|||||||
public int refund(Map<String, String> map) {
|
public int refund(Map<String, String> map) {
|
||||||
Map<String, String> refund = new HashMap<>();
|
Map<String, String> refund = new HashMap<>();
|
||||||
// try {
|
// try {
|
||||||
AllOrderInfo allOrderInfo = selectAllOrderInfoByOrderNo(map.get("orderNo"));
|
AllOrderInfo allOrderInfo = selectAllOrderInfoByOrderNo(map.get("orderNo"));
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(map.get("type"))) {
|
if (ObjectUtil.isEmpty(map.get("type"))) {
|
||||||
throw new RuntimeException("该订单不支持退款,无退款类别!");
|
throw new RuntimeException("该订单不支持退款,无退款类别!");
|
||||||
@ -192,7 +192,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
|
|||||||
throw new RuntimeException("该订单类型不支持退款!");
|
throw new RuntimeException("该订单类型不支持退款!");
|
||||||
}
|
}
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
if (!"CASH".equals(allOrderInfo.getPayType()) ) {
|
if (!"CASH".equals(allOrderInfo.getPayType()) && Double.valueOf(map.get("refundAmt")) > 0) {
|
||||||
try {
|
try {
|
||||||
refund = fyPayService.refund(map);
|
refund = fyPayService.refund(map);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -213,16 +213,18 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
|
|||||||
baseMapper.updateById(allOrderInfo);
|
baseMapper.updateById(allOrderInfo);
|
||||||
// 处理油品订单
|
// 处理油品订单
|
||||||
OilOrder oilOrder = new OilOrder();
|
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"));
|
oilOrder = oilOrderService.selectOilOrderByOrderNo(map.get("orderNo"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理商品订单
|
// 处理商品订单
|
||||||
LJOrder ljOrder = new LJOrder();
|
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"));
|
ljOrder = ljOrderService.selectGoodsOrder(map.get("orderNo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 处理收银台订单
|
// 处理收银台订单
|
||||||
CashierOrder orderNo = new CashierOrder();
|
CashierOrder orderNo = new CashierOrder();
|
||||||
|
|
||||||
@ -233,12 +235,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
|
|||||||
}
|
}
|
||||||
if (ObjectUtil.isNotEmpty(oilOrder)) {
|
if (ObjectUtil.isNotEmpty(oilOrder)) {
|
||||||
// 判断是否推掉优惠卷
|
// 判断是否推掉优惠卷
|
||||||
boolean ifVou = false;
|
disposeOil(oilOrder,map);
|
||||||
if (ObjectUtil.isNotEmpty(map.get("isOilVouchers")) && "true".equals(map.get("isOilVouchers"))) {
|
|
||||||
ifVou = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
disposeOil(oilOrder,map.get("refundOrderNo"),ifVou);
|
|
||||||
commissionRecordService.addRefundRecord(oilOrder.getOrderNo(),"1",oilOrder.getStaffId(),oilOrder.getStoreId());
|
commissionRecordService.addRefundRecord(oilOrder.getOrderNo(),"1",oilOrder.getStaffId(),oilOrder.getStoreId());
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotEmpty(ljOrder)) {
|
if (ObjectUtil.isNotEmpty(ljOrder)) {
|
||||||
@ -300,7 +297,10 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
|
|||||||
CardFavorableRecordService cardFavorableRecordService;
|
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");
|
oilOrder.setOrderStatus("refund");
|
||||||
oilOrderService.updateById(oilOrder);
|
oilOrderService.updateById(oilOrder);
|
||||||
@ -321,7 +321,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
|
|||||||
oilTracking.setQuantityChange(order.getOilNum());
|
oilTracking.setQuantityChange(order.getOilNum());
|
||||||
oilTracking.setStoreId(order.getStoreId());
|
oilTracking.setStoreId(order.getStoreId());
|
||||||
oilTracking.setTankId(oilGun.getTankId());
|
oilTracking.setTankId(oilGun.getTankId());
|
||||||
oilTracking.setOrderNumber(refundOrderNo);
|
oilTracking.setOrderNumber(map.get("refundOrderNo"));
|
||||||
OilTracking insert = oilTrackingService.insert(oilTracking);
|
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());
|
userBalanceService.addUserOil(order.getOils(),order.getUserId(),nowAccountInfo.getChainStoreId(),order.getOilCardAmount());
|
||||||
}
|
}
|
||||||
// 处理优惠券
|
// 处理优惠券
|
||||||
if (ObjectUtil.isNotEmpty(order.getCouponId()) && ifVou) {
|
if (ObjectUtil.isNotEmpty(map.get("isOilVouchers")) && "true".equals(map.get("isOilVouchers"))) {
|
||||||
cardFavorableRecordService.updateStatus(order.getCouponId());
|
if (ObjectUtil.isNotEmpty(order.getCouponId())) {
|
||||||
|
cardFavorableRecordService.updateStatus(order.getCouponId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -337,8 +337,19 @@
|
|||||||
|
|
||||||
|
|
||||||
<span>油品:</span>
|
<span>油品:</span>
|
||||||
<el-checkbox v-model="isOil">¥{{cashierOrder.oilPayAmount}}</el-checkbox>
|
<template >
|
||||||
<el-checkbox v-model="isOilVouchers">优惠卷</el-checkbox>
|
<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">
|
<div style="margin: 10px 0">
|
||||||
退款原因<br/>
|
退款原因<br/>
|
||||||
@ -351,7 +362,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-input placeholder="请输入退款原因" v-model="refundRemark"></el-input>
|
<el-input placeholder="请输入退款原因" v-model="refundRemark"></el-input>
|
||||||
<br/>
|
<br/>
|
||||||
<span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、储值卡等原路退回处理</span>
|
<!-- <span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、储值卡等原路退回处理</span>-->
|
||||||
</div>
|
</div>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button @click="dialogRefund = false">取 消</el-button>
|
<el-button @click="dialogRefund = false">取 消</el-button>
|
||||||
@ -433,9 +444,11 @@ import {refundApi} from "@/api/cashier/refund";
|
|||||||
import {getLodop} from "@/api/LodopFuncs";
|
import {getLodop} from "@/api/LodopFuncs";
|
||||||
import {getOilNumberGun} from "@/api/cashier/oilGuns";
|
import {getOilNumberGun} from "@/api/cashier/oilGuns";
|
||||||
import {formatDate} from "@/utils";
|
import {formatDate} from "@/utils";
|
||||||
|
import ScanPayCodeDialog from "@/views/cashier/components/scanPayCodeDialog.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "order_Cashier",
|
name: "order_Cashier",
|
||||||
|
components: {ScanPayCodeDialog},
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
// 退款备注
|
// 退款备注
|
||||||
@ -462,6 +475,8 @@ import {formatDate} from "@/utils";
|
|||||||
isOilVouchers:false,
|
isOilVouchers:false,
|
||||||
isGoods: false,
|
isGoods: false,
|
||||||
isOil: false,
|
isOil: false,
|
||||||
|
isOilCard: false, // 是否推掉油卡
|
||||||
|
isOilFuel: false, //是否推掉储值卡
|
||||||
// 是否为当天时间
|
// 是否为当天时间
|
||||||
isSysDate:false,
|
isSysDate:false,
|
||||||
// 收银台订单列表
|
// 收银台订单列表
|
||||||
@ -634,17 +649,20 @@ import {formatDate} from "@/utils";
|
|||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
// 退款
|
// 退款
|
||||||
handleRefund(id){
|
async handleRefund(id){
|
||||||
this.dialogRefund = true;
|
this.dialogRefund = true;
|
||||||
cashierOrder(id).then( response => {
|
await cashierOrder(id).then( response => {
|
||||||
this.cashierOrder = response.data
|
this.cashierOrder = response.data
|
||||||
if (response.data.status === "refund") {
|
|
||||||
this.$message({
|
//
|
||||||
type: 'info',
|
this.getOilList(response.data.orderNo)
|
||||||
message: '该订单已经退款'
|
if (response.data.status === "refund") {
|
||||||
});
|
this.$message({
|
||||||
this.dialogRefund = false;
|
type: 'info',
|
||||||
}
|
message: '该订单已经退款'
|
||||||
|
});
|
||||||
|
this.dialogRefund = false;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
//退款确定
|
//退款确定
|
||||||
// this.$confirm('是否将该收银台下的订单全部退款, 是否继续?', '提示', {
|
// this.$confirm('是否将该收银台下的订单全部退款, 是否继续?', '提示', {
|
||||||
@ -675,7 +693,21 @@ import {formatDate} from "@/utils";
|
|||||||
this.dialogRefund = false;
|
this.dialogRefund = false;
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
console.log("cashierOrder",this.cashierOrder)
|
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={
|
let map={
|
||||||
|
|
||||||
orderNo: this.cashierOrder.orderNo,
|
orderNo: this.cashierOrder.orderNo,
|
||||||
storeId: this.cashierOrder.storeId,
|
storeId: this.cashierOrder.storeId,
|
||||||
refundRemark:this.radio1 +"-"+ this.refundRemark,
|
refundRemark:this.radio1 +"-"+ this.refundRemark,
|
||||||
@ -683,6 +715,9 @@ import {formatDate} from "@/utils";
|
|||||||
isOilVouchers:this.isOilVouchers,
|
isOilVouchers:this.isOilVouchers,
|
||||||
isGoods: this.isGoods,
|
isGoods: this.isGoods,
|
||||||
isOil: this.isOil,
|
isOil: this.isOil,
|
||||||
|
isOilCard: this.isOilCard, // 是否推掉油卡
|
||||||
|
isOilFuel: this.isOilFuel, //是否推掉储值卡
|
||||||
|
refundAmt: refundAmt
|
||||||
}
|
}
|
||||||
await refundApi(map).then(res=>{
|
await refundApi(map).then(res=>{
|
||||||
this.$message({
|
this.$message({
|
||||||
|
Loading…
Reference in New Issue
Block a user