收银台
This commit is contained in:
parent
d68f87b29b
commit
302a7850fe
@ -36,4 +36,16 @@ public class FyPayController {
|
||||
Map<String, String> map = payService.queryOrder(map1);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款 成功 result_msg 显示success
|
||||
* result_code显示000000
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/refund")
|
||||
public Map<String, String> refund(Map<String, String> map1) throws Exception {
|
||||
Map<String, String> map = payService.refund(map1);
|
||||
return map;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class Builder {
|
||||
}
|
||||
|
||||
/**
|
||||
* 条码支付下单查询
|
||||
* 条码支付下单 查询订单是否支付成功
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ -71,4 +71,34 @@ public class Builder {
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, String> buildFuiou24() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
map.put("version", Const.version);
|
||||
map.put("ins_cd", Const.ins_cd);
|
||||
map.put("mchnt_cd", Const.mchnt_cd);
|
||||
map.put("term_id", Const.term_id);
|
||||
map.put("random_str", randomNumberGenerator.nextBytes().toHex());
|
||||
map.put("sign", "");
|
||||
map.put("order_type", Const.order_type);
|
||||
map.put("mchnt_order_no", "");
|
||||
// 商户退款单号
|
||||
map.put("refund_order_no", "");
|
||||
// 总金额
|
||||
map.put("total_amt", "");
|
||||
// 退款金额
|
||||
map.put("refund_amt", "");
|
||||
map.put("operator_id", "");
|
||||
map.put("reserved_fy_term_id", "");
|
||||
map.put("reserved_origi_dt", "");
|
||||
map.put("reserved_addn_inf", "");
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
@ -16,4 +16,11 @@ public interface FyPayService {
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> queryOrder(Map<String, String> map) throws Exception;
|
||||
|
||||
/**
|
||||
* 退款
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> refund(Map<String, String> map) throws Exception;
|
||||
}
|
||||
|
@ -11,16 +11,12 @@ import com.fuint.api.fuyou.service.FyPayService;
|
||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||
import com.fuint.api.fuyou.util.Utils;
|
||||
import com.fuint.business.integral.service.IntegralOrdersService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
|
||||
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
|
||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
|
||||
import com.fuint.business.order.entity.CashierOrder;
|
||||
import com.fuint.business.order.entity.HangBill;
|
||||
import com.fuint.business.order.entity.LJOrder;
|
||||
import com.fuint.business.order.entity.OilOrder;
|
||||
import com.fuint.business.order.service.CashierOrderService;
|
||||
import com.fuint.business.order.service.HangBillService;
|
||||
import com.fuint.business.order.service.LJOrderService;
|
||||
import com.fuint.business.order.service.OilOrderService;
|
||||
import com.fuint.business.order.entity.*;
|
||||
import com.fuint.business.order.service.*;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import io.swagger.models.auth.In;
|
||||
@ -83,7 +79,6 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
|
||||
String str = resMap.get("sign");
|
||||
if (Utils.verifySign(resMap, str)){
|
||||
String resultCode = resMap.get("result_code");
|
||||
ThreadUtil.execAsync(() -> {
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@ -110,6 +105,10 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
private MerchantConfigService merchantConfigService;
|
||||
@Autowired
|
||||
private HangBillService hangBillService;
|
||||
@Autowired
|
||||
private ReturnRecordService returnRecordService;
|
||||
@Autowired
|
||||
private CardFavorableRecordService cardFavorableRecordService;
|
||||
|
||||
@Override
|
||||
public Map<String, String> queryOrder(Map<String, String> map1) throws Exception {
|
||||
@ -148,24 +147,43 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
LJOrder goodsOrder = goodsOrderService.selectGoodsOrder(orderNo);
|
||||
CashierOrder cashierOrder = cashierOrderService.selectCashierOrder(orderNo);
|
||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
|
||||
HangBill hangBill = hangBillService.selectHangBillByOrderNo(orderNo);
|
||||
List<ReturnRecord> returnRecords = returnRecordService.selectReturnRecordByOrderNo(orderNo);
|
||||
Date date = new Date();
|
||||
if (reqMap.get("trans_stat").equals("SUCCESS")){
|
||||
if (!ObjectUtil.isEmpty(oilOrder)){
|
||||
// 油品订单
|
||||
oilOrder.setOrderStatus("paid");
|
||||
oilOrder.setPayTime(date);
|
||||
// 修改优惠券使用状态
|
||||
CardFavorableRecord byId = cardFavorableRecordService.getById(oilOrder.getCouponId());
|
||||
if (!ObjectUtil.isEmpty(byId)){
|
||||
byId.setStatus("1");
|
||||
cardFavorableRecordService.updateById(byId);
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(goodsOrder)){
|
||||
// 商品订单
|
||||
goodsOrder.setStatus("paid");
|
||||
goodsOrder.setPayTime(date);
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(cashierOrder)){
|
||||
// 收银台订单
|
||||
cashierOrder.setStatus("paid");
|
||||
cashierOrder.setPayTime(date);
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(hangBill)){
|
||||
hangBillService.updateHangBills(hangBill,allAmount,"paid");
|
||||
if (!ArrayUtil.isEmpty(returnRecords)){
|
||||
for (ReturnRecord returnRecord : returnRecords) {
|
||||
// 挂账归还信息
|
||||
returnRecord.setReturnType("1");
|
||||
returnRecord.setPayStatus("paid");
|
||||
returnRecord.setPayTime(date);
|
||||
hangBillService.updateHangBill(returnRecord.getHangBillId(), returnRecord.getAmount());
|
||||
returnRecordService.updateReturnRecord(returnRecord);
|
||||
}
|
||||
}
|
||||
if (ArrayUtil.isEmpty(list)){
|
||||
if (!ArrayUtil.isEmpty(list)){
|
||||
for (OilOrder order : list) {
|
||||
// 添加多个油品订单
|
||||
order.setOrderStatus("paid");
|
||||
order.setPayTime(date);
|
||||
oilOrderService.updateOilOrder(order);
|
||||
@ -200,9 +218,12 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
if (!ObjectUtil.isEmpty(cashierOrder)){
|
||||
cashierOrder.setStatus("payFail");
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(hangBill)){
|
||||
hangBill.setPayStatus("payFail");
|
||||
hangBillService.updateById(hangBill);
|
||||
if (!ArrayUtil.isEmpty(returnRecords)){
|
||||
for (ReturnRecord returnRecord : returnRecords) {
|
||||
returnRecord.setReturnType("0");
|
||||
returnRecord.setPayStatus("payFail");
|
||||
returnRecordService.updateReturnRecord(returnRecord);
|
||||
}
|
||||
}
|
||||
if (!ArrayUtil.isEmpty(list)){
|
||||
for (OilOrder order : list) {
|
||||
@ -254,4 +275,37 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
return resMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> refund(Map<String, String> map1) throws Exception {
|
||||
String orderNo = map1.get("orderNo");
|
||||
String refundOrderNo = map1.get("refundOrderNo");
|
||||
String payType = map1.get("payType");
|
||||
String allAmount = map1.get("allAmount");
|
||||
String insCd = map1.get("insCd");
|
||||
String mchntCd = map1.get("mchntCd");
|
||||
Map<String, String> map = Builder.buildFuiou24();
|
||||
map.put("mchnt_order_no",orderNo);
|
||||
map.put("order_type",payType);
|
||||
map.put("total_amt", allAmount);
|
||||
map.put("refund_amt", allAmount);
|
||||
map.put("ins_cd", insCd);
|
||||
map.put("mchnt_cd", mchntCd);
|
||||
map.put("refund_order_no", refundOrderNo);
|
||||
|
||||
|
||||
// 请求报文
|
||||
String reqBody = Message.requestMsg(map);
|
||||
// 响应报文
|
||||
String rspXml = Message.responseMsg(reqBody,Const.fuiou_24_url);
|
||||
|
||||
//响应报文验签
|
||||
Map<String, String> resMap = Utils.xmlStr2Map(rspXml);
|
||||
|
||||
String str = resMap.get("sign");
|
||||
if (Utils.verifySign(resMap, str)){
|
||||
|
||||
}
|
||||
return resMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,8 +75,7 @@ public class HangBillController extends BaseController {
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject edit(@Validated @RequestBody Map<String,String> map){
|
||||
HangBill hangBill = hangBillService.updateHangBill(map);
|
||||
return getSuccessResult(hangBill);
|
||||
return getSuccessResult(hangBillService.collection(map));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,8 +85,7 @@ public class HangBillController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/batch")
|
||||
public ResponseObject batchUpdate(@Validated @RequestBody Map<String,String> map){
|
||||
int row = hangBillService.batchUpdate(map);
|
||||
return getSuccessResult(row);
|
||||
return getSuccessResult(hangBillService.batchUpdate(map));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,60 @@
|
||||
package com.fuint.business.order.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.order.service.ReturnRecordService;
|
||||
import com.fuint.business.order.vo.ReturnRecordVo;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 归还记录信息 controller层
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/returnRecord")
|
||||
public class ReturnRecordController extends BaseController {
|
||||
@Autowired
|
||||
private ReturnRecordService returnRecordService;
|
||||
|
||||
/**
|
||||
* 根据挂账记录id查询归还记录信息
|
||||
* @param returnRecordVo
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public ResponseObject list(ReturnRecordVo returnRecordVo,
|
||||
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
|
||||
Page page =new Page(pageNo,pageSize);
|
||||
IPage<ReturnRecordVo> returnRecordVoIPage = returnRecordService.selectReturnRecordList(page, returnRecordVo);
|
||||
return getSuccessResult(returnRecordVoIPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询挂账归还信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public ResponseObject info(@PathVariable Integer id){
|
||||
return getSuccessResult(returnRecordService.selectReturnRecordById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单号查询挂账归还信息
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/order")
|
||||
public ResponseObject infoByOrderNo(@Validated @RequestBody Map<String,String> map){
|
||||
String orderNo = map.get("orderNo");
|
||||
return getSuccessResult(returnRecordService.selectReturnRecordByOrderNo(orderNo));
|
||||
}
|
||||
}
|
@ -54,6 +54,10 @@ public class CashierOrder extends BaseEntity implements Serializable {
|
||||
* 订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 退款订单号
|
||||
*/
|
||||
private String refundOrderNo;
|
||||
/**
|
||||
* 油品订单金额
|
||||
*/
|
||||
|
@ -0,0 +1,82 @@
|
||||
package com.fuint.business.order.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fuint.framework.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 归还记录表(ReturnRecord)实体类
|
||||
*/
|
||||
@Data
|
||||
@TableName("return_record")
|
||||
@ApiModel(value = "ReturnRecord对象", description = "归还记录表")
|
||||
public class ReturnRecord extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("自增ID")
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 挂账记录id
|
||||
*/
|
||||
private Integer hangBillId;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer storeId;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 挂账单位id
|
||||
*/
|
||||
private Integer creditUnitId;
|
||||
/**
|
||||
* 订单状态:0未归还,1已归还
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 归还状态:0挂账,1归还
|
||||
*/
|
||||
private String returnType;
|
||||
/**
|
||||
* 挂账金额
|
||||
*/
|
||||
private Double amount;
|
||||
/**
|
||||
* 收款金额
|
||||
*/
|
||||
private Double collectAmount;
|
||||
/**
|
||||
* 找零金额
|
||||
*/
|
||||
private Double seekZero;
|
||||
/**
|
||||
* 操作员工id
|
||||
*/
|
||||
private Integer staffId;
|
||||
/**
|
||||
* 单据备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 支付状态:已支付,未支付,支付失败
|
||||
*/
|
||||
private String payStatus;
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
private Date payTime;
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.fuint.business.order.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.order.entity.ReturnRecord;
|
||||
import com.fuint.business.order.vo.ReturnRecordVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 挂账归还记录表 mapper层
|
||||
*/
|
||||
public interface ReturnRecordMapper extends BaseMapper<ReturnRecord> {
|
||||
/**
|
||||
* 根据挂账记录id查询归还信息
|
||||
* @param page
|
||||
* @param returnRecord
|
||||
* @return
|
||||
*/
|
||||
public IPage<ReturnRecordVo> selectReturnRecordList(Page page, @Param("returnRecord") ReturnRecordVo returnRecord);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuint.business.order.mapper.ReturnRecordMapper">
|
||||
<sql id="selectReturnRecord">
|
||||
select rd.*,ms.real_name,ms.mobile,cu.unit_name,cu.person_credit,cu.contact_mobile,cu.credit_limit
|
||||
from return_record rd
|
||||
left join credit_unit cu on cu.id = rd.credit_unit_id
|
||||
left join mt_staff ms on rd.staff_id = ms.id
|
||||
</sql>
|
||||
|
||||
<select id="selectReturnRecordList" resultType="com.fuint.business.order.vo.ReturnRecordVo">
|
||||
<include refid="selectReturnRecord"></include>
|
||||
<where>
|
||||
rd.hang_bill_id = #{returnRecord.hangBillId}
|
||||
</where>
|
||||
</select>
|
||||
<!-- <select id="selectHangBillById" resultType="com.fuint.business.order.vo.HangBillVo" parameterType="int">-->
|
||||
<!-- <include refid="selectHangBill"></include>-->
|
||||
<!-- <where>-->
|
||||
<!-- hb.id = #{id}-->
|
||||
<!-- </where>-->
|
||||
<!-- </select>-->
|
||||
<!-- <select id="selectHangBills" resultType="com.fuint.business.order.vo.HangBillVo" parameterType="int">-->
|
||||
<!-- <include refid="selectHangBill"></include>-->
|
||||
<!-- <where>-->
|
||||
<!-- hb.store_id = #{storeId}-->
|
||||
<!-- </where>-->
|
||||
<!-- </select>-->
|
||||
</mapper>
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.order.entity.HangBill;
|
||||
import com.fuint.business.order.entity.ReturnRecord;
|
||||
import com.fuint.business.order.vo.HangBillVo;
|
||||
|
||||
import java.util.List;
|
||||
@ -49,18 +50,26 @@ public interface HangBillService extends IService<HangBill> {
|
||||
public int insertHangBill(HangBillVo hangBill);
|
||||
|
||||
/**
|
||||
* 修改挂账记录 并收款
|
||||
* 修改挂账记录信息
|
||||
* @param id
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public int updateHangBill(int id,Double amount);
|
||||
|
||||
/**
|
||||
* 添加归还信息并收款
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
public HangBill updateHangBill(Map<String,String> map);
|
||||
public String collection(Map<String,String> map);
|
||||
|
||||
/**
|
||||
* 批量归还挂账金额
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
public int batchUpdate(Map<String,String> map);
|
||||
public String batchUpdate(Map<String,String> map);
|
||||
|
||||
/**
|
||||
* 修改挂账信息
|
||||
|
@ -0,0 +1,50 @@
|
||||
package com.fuint.business.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.order.entity.ReturnRecord;
|
||||
import com.fuint.business.order.vo.ReturnRecordVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂账归还记录表 业务层
|
||||
*/
|
||||
public interface ReturnRecordService extends IService<ReturnRecord> {
|
||||
/**
|
||||
* 根据挂账记录id查询归还信息
|
||||
* @param page
|
||||
* @param returnRecord
|
||||
* @return
|
||||
*/
|
||||
public IPage<ReturnRecordVo> selectReturnRecordList(Page page,ReturnRecordVo returnRecord);
|
||||
|
||||
/**
|
||||
* 根据id查询归还记录信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public ReturnRecord selectReturnRecordById(int id);
|
||||
|
||||
/**
|
||||
* 根据订单号查询归还记录信息
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
public List<ReturnRecord> selectReturnRecordByOrderNo(String orderNo);
|
||||
|
||||
/**
|
||||
* 添加挂账归还信息 并返回订单号
|
||||
* @param returnRecord
|
||||
* @return
|
||||
*/
|
||||
public String insertReturnRecord(ReturnRecord returnRecord);
|
||||
|
||||
/**
|
||||
* 修改挂账归还信息
|
||||
* @param returnRecord
|
||||
* @return
|
||||
*/
|
||||
public int updateReturnRecord(ReturnRecord returnRecord);
|
||||
}
|
@ -13,9 +13,11 @@ import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||
import com.fuint.api.fuyou.service.OilConfigService;
|
||||
import com.fuint.business.order.entity.CreditUnit;
|
||||
import com.fuint.business.order.entity.HangBill;
|
||||
import com.fuint.business.order.entity.ReturnRecord;
|
||||
import com.fuint.business.order.mapper.HangBillMapper;
|
||||
import com.fuint.business.order.service.CreditUnitService;
|
||||
import com.fuint.business.order.service.HangBillService;
|
||||
import com.fuint.business.order.service.ReturnRecordService;
|
||||
import com.fuint.business.order.vo.HangBillVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
@ -114,72 +116,109 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
|
||||
private OilConfigService oilConfigService;
|
||||
|
||||
@Override
|
||||
public HangBill updateHangBill(Map<String,String> map) {
|
||||
HangBill hangBill1 = this.selectHangBillByOrderNo(map.get("orderNo"));
|
||||
hangBill1.setPayStatus("unpaid");
|
||||
baseMapper.updateById(hangBill1);
|
||||
String payType = map.get("payType");
|
||||
// 调用支付接口
|
||||
this.pay(map);
|
||||
|
||||
// 根据id查询挂账信息
|
||||
HangBill hangBill = baseMapper.selectById(Integer.parseInt(map.get("id")));
|
||||
if (payType.equals("CASH")){
|
||||
public int updateHangBill(int id,Double amount) {
|
||||
HangBill hangBill = baseMapper.selectById(id);
|
||||
Double repaidAmount = hangBill.getRepaidAmount();
|
||||
Double outstandAmount = hangBill.getOutstandAmount();
|
||||
// 修改变化金额
|
||||
Double repaidAmountAfter = repaidAmount+amount;
|
||||
Double outstandAmountAfter = outstandAmount-amount;
|
||||
hangBill.setRepaidAmount(repaidAmountAfter);
|
||||
hangBill.setOutstandAmount(outstandAmountAfter);
|
||||
// 修改状态
|
||||
if (repaidAmountAfter.equals(hangBill.getAmount()) && outstandAmountAfter.equals(0.0)){
|
||||
hangBill.setStatus("1");
|
||||
hangBill.setReturnType("1");
|
||||
hangBill.setPayStatus("paid");
|
||||
}else {
|
||||
hangBill.setStatus("2");
|
||||
}
|
||||
|
||||
// 根据挂账单位id查询挂账单位信息
|
||||
// 根据挂账单位id查询挂账单位信息
|
||||
CreditUnit creditUnit = creditUnitService.selectCreditUnitListById(hangBill.getCreditUnitId());
|
||||
if (creditUnit.getCreditLimit()!=0){
|
||||
Double creditLimit = creditUnit.getCreditLimit();
|
||||
creditUnit.setCreditLimit(creditLimit+Double.valueOf(map.get("repaidAmount")));
|
||||
}
|
||||
|
||||
int row = 0;
|
||||
hangBill.setRemark(map.get("remark"));
|
||||
// 支付成功后修改挂账信息
|
||||
if (hangBill.getPayStatus().equals("paid")){
|
||||
Double repaidAmount1 = Double.valueOf(map.get("repaidAmount"));
|
||||
Double amount = hangBill.getAmount();
|
||||
Double repaidAmount = hangBill.getRepaidAmount();
|
||||
Double outstandAmount = hangBill.getOutstandAmount();
|
||||
Double repaidAmountAfter = repaidAmount+repaidAmount1;
|
||||
// 修改挂账信息
|
||||
hangBill.setRepaidAmount(repaidAmountAfter);
|
||||
hangBill.setOutstandAmount(amount-repaidAmountAfter);
|
||||
if (amount.equals(repaidAmountAfter)){
|
||||
hangBill.setStatus("1");
|
||||
hangBill.setReturnType("1");
|
||||
}else {
|
||||
hangBill.setStatus("2");
|
||||
}
|
||||
// 修改挂账单位余额信息
|
||||
// 挂账单位限额的数据添加
|
||||
Double creditLimit = creditUnit.getCreditLimit();
|
||||
if (creditLimit!=0) {
|
||||
creditUnit.setCreditLimit(creditLimit+amount);
|
||||
creditUnitService.updateCreditUnit(creditUnit);
|
||||
}
|
||||
row = baseMapper.updateById(hangBill);
|
||||
return baseMapper.selectById(Integer.parseInt(map.get("id")));
|
||||
int row = baseMapper.updateById(hangBill);
|
||||
return row;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ReturnRecordService returnRecordService;
|
||||
|
||||
@Override
|
||||
public String collection(Map<String, String> map) {
|
||||
// 添加归还账单信息
|
||||
ReturnRecord returnRecord = new ReturnRecord();
|
||||
returnRecord.setHangBillId(Integer.valueOf(map.get("id")));
|
||||
returnRecord.setStoreId(Integer.valueOf(map.get("storeId")));
|
||||
returnRecord.setCreditUnitId(Integer.valueOf(map.get("creditUnitId")));
|
||||
returnRecord.setStaffId(Integer.valueOf(map.get("staffId")));
|
||||
returnRecord.setStatus(map.get("payType"));
|
||||
returnRecord.setRemark(map.get("remark"));
|
||||
returnRecord.setAmount(Double.valueOf(map.get("repaidAmount")));
|
||||
if (map.get("payType").equals("CASH")){
|
||||
returnRecord.setCollectAmount(Double.valueOf(map.get("authCode")));
|
||||
returnRecord.setSeekZero(Double.valueOf(map.get("seekZero")));
|
||||
returnRecord.setPayStatus("paid");
|
||||
returnRecord.setReturnType("1");
|
||||
returnRecord.setPayTime(new Date());
|
||||
Double amount = Double.valueOf(map.get("authCode")) - Double.valueOf(map.get("seekZero"));
|
||||
this.updateHangBill(returnRecord.getHangBillId(), amount);
|
||||
}else {
|
||||
returnRecord.setCollectAmount(Double.valueOf(map.get("repaidAmount")));
|
||||
returnRecord.setReturnType("0");
|
||||
returnRecord.setPayStatus("unpaid");
|
||||
}
|
||||
String orderNo = returnRecordService.insertReturnRecord(returnRecord);
|
||||
|
||||
// 调用支付接口
|
||||
this.pay(map,orderNo);
|
||||
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchUpdate(Map<String, String> map) {
|
||||
this.pay(map);
|
||||
public String batchUpdate(Map<String, String> map) {
|
||||
List<JSONObject> jsonObjects = JSONArray.parseArray(map.get("list"), JSONObject.class);
|
||||
int row = 0;
|
||||
// 根据日期生成归还订单号
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String timestamp = dateFormat.format(new Date());
|
||||
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
||||
String orderNo = "H"+timestamp+randomString;
|
||||
for (JSONObject jsonObject : jsonObjects) {
|
||||
// 现将需要修改的支付状态改为未支付
|
||||
HangBill hangBill1 = baseMapper.selectById((Integer) jsonObject.get("id"));
|
||||
|
||||
hangBill1.setPayStatus("unpaid");
|
||||
baseMapper.updateById(hangBill1);
|
||||
HangBill hangBill = baseMapper.selectById((Integer) jsonObject.get("id"));
|
||||
// 添加归还记录信息
|
||||
ReturnRecord returnRecord = new ReturnRecord();
|
||||
returnRecord.setOrderNo(orderNo);
|
||||
returnRecord.setHangBillId((Integer) jsonObject.get("id"));
|
||||
returnRecord.setStoreId((Integer) jsonObject.get("storeId"));
|
||||
returnRecord.setCreditUnitId((Integer) jsonObject.get("creditUnitId"));
|
||||
returnRecord.setStaffId((Integer) jsonObject.get("staffId"));
|
||||
returnRecord.setStatus(map.get("payType"));
|
||||
returnRecord.setRemark((String) jsonObject.get("remark"));
|
||||
returnRecord.setAmount(Double.valueOf(jsonObject.get("repaidAmount").toString()));
|
||||
if (map.get("payType").equals("CASH")){
|
||||
HangBill hangBill2 = this.updateStatus(hangBill, Double.valueOf(jsonObject.get("repaidAmount").toString()));
|
||||
hangBill2.setPayStatus("paid");
|
||||
hangBill2.setRemark(map.get("remark"));
|
||||
row = baseMapper.updateById(hangBill2);
|
||||
returnRecord.setCollectAmount(Double.valueOf(map.get("authCode")));
|
||||
returnRecord.setSeekZero(Double.valueOf(map.get("seekZero")));
|
||||
returnRecord.setPayStatus("paid");
|
||||
returnRecord.setReturnType("1");
|
||||
returnRecord.setPayTime(new Date());
|
||||
Double amount = Double.valueOf(jsonObject.get("repaidAmount").toString());
|
||||
this.updateHangBill(returnRecord.getHangBillId(), amount);
|
||||
}else {
|
||||
returnRecord.setCollectAmount(Double.valueOf(jsonObject.get("repaidAmount").toString()));
|
||||
returnRecord.setReturnType("0");
|
||||
returnRecord.setPayStatus("unpaid");
|
||||
}
|
||||
returnRecordService.insertReturnRecord(returnRecord);
|
||||
}
|
||||
return row;
|
||||
// 调用支付接口
|
||||
this.pay(map,orderNo);
|
||||
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -194,7 +233,8 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
|
||||
* 调用支付接口
|
||||
* @param map
|
||||
*/
|
||||
private void pay(Map<String,String> map){
|
||||
private void pay(Map<String,String> map,String orderNo){
|
||||
// 先将支付状态改为未支付
|
||||
String payType = map.get("payType");
|
||||
if (!map.get("repaidAmount").equals("0") && !payType.equals("CASH")){
|
||||
Integer allAmount = (int) (Double.valueOf(map.get("repaidAmount"))*100);
|
||||
@ -209,7 +249,7 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
|
||||
Map<String,String> map1 = new HashMap<>();
|
||||
map1.put("authCode",map.get("authCode"));
|
||||
map1.put("allAmount",allAmount.toString());
|
||||
map1.put("orderNo",map.get("orderNo"));
|
||||
map1.put("orderNo",orderNo);
|
||||
map1.put("payType",payType);
|
||||
map1.put("insCd",merchantConfig.getInsCd());
|
||||
map1.put("mchntCd",merchantConfig.getMchntCd());
|
||||
|
@ -0,0 +1,60 @@
|
||||
package com.fuint.business.order.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.order.entity.ReturnRecord;
|
||||
import com.fuint.business.order.mapper.ReturnRecordMapper;
|
||||
import com.fuint.business.order.service.ReturnRecordService;
|
||||
import com.fuint.business.order.vo.ReturnRecordVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 挂账归还记录表 业务层
|
||||
*/
|
||||
@Service
|
||||
public class ReturnRecordServiceImpl extends ServiceImpl<ReturnRecordMapper, ReturnRecord> implements ReturnRecordService {
|
||||
@Override
|
||||
public IPage<ReturnRecordVo> selectReturnRecordList(Page page, ReturnRecordVo returnRecord) {
|
||||
return baseMapper.selectReturnRecordList(page,returnRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReturnRecord selectReturnRecordById(int id) {
|
||||
return baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReturnRecord> selectReturnRecordByOrderNo(String orderNo) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_no",orderNo);
|
||||
List<ReturnRecord> list = baseMapper.selectList(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String insertReturnRecord(ReturnRecord returnRecord) {
|
||||
if (StrUtil.isEmpty(returnRecord.getOrderNo())){
|
||||
// 根据日期生成归还订单号
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String timestamp = dateFormat.format(new Date());
|
||||
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
||||
String orderNo = "H"+timestamp+randomString;
|
||||
returnRecord.setOrderNo(orderNo);
|
||||
}
|
||||
baseMapper.insert(returnRecord);
|
||||
return returnRecord.getOrderNo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateReturnRecord(ReturnRecord returnRecord) {
|
||||
return baseMapper.updateById(returnRecord);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.fuint.business.order.vo;
|
||||
|
||||
import com.fuint.business.order.entity.ReturnRecord;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ReturnRecordVo extends ReturnRecord {
|
||||
// 操作人名称
|
||||
private String realName;
|
||||
// 操作人手机号
|
||||
private String mobile;
|
||||
// 单位名称
|
||||
private String unitName;
|
||||
// 挂账人
|
||||
private String personCredit;
|
||||
// 联系电话
|
||||
private String contactMobile;
|
||||
// 挂账额度
|
||||
private String creditLimit;
|
||||
}
|
27
fuintCashierWeb/src/api/cashier/returnrecord.js
Normal file
27
fuintCashierWeb/src/api/cashier/returnrecord.js
Normal file
@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 根据挂账记录id查询归还记录信息
|
||||
export function listReturnRecord(query) {
|
||||
return request({
|
||||
url: '/business/returnRecord/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 根据id查询挂账归还信息
|
||||
export function returnRecordInfo(id) {
|
||||
return request({
|
||||
url: '/business/returnRecord/' + id,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 根据订单号查询挂账归还信息
|
||||
export function returnRecordByOrderNo(data) {
|
||||
return request({
|
||||
url: '/business/returnRecord/order',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
@ -139,69 +139,35 @@
|
||||
</el-form>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="orderNo"
|
||||
label="单据号"
|
||||
width="200">
|
||||
</el-table-column>
|
||||
<el-table-column prop="orderNo" label="单据号" width="200"></el-table-column>
|
||||
<el-table-column label="挂账单位">
|
||||
<el-table-column
|
||||
prop="unitName"
|
||||
label="单位名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="personCredit"
|
||||
label="挂账人">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="contactMobile"
|
||||
label="联系电话">
|
||||
</el-table-column>
|
||||
<el-table-column prop="unitName" label="单位名称"> </el-table-column>
|
||||
<el-table-column prop="personCredit" label="挂账人"> </el-table-column>
|
||||
<el-table-column prop="contactMobile" label="联系电话"> </el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="记录明细">
|
||||
<el-table-column
|
||||
prop="returnType"
|
||||
label="类型">
|
||||
<el-table-column prop="returnType" label="类型">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.returnType == 0">挂账</el-tag>
|
||||
<el-tag v-else type="success">归还</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="amount"
|
||||
label="金额">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="status"
|
||||
label="状态">
|
||||
<el-table-column prop="amount" label="金额"> </el-table-column>
|
||||
<el-table-column prop="status" label="状态">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.status == 0">未归还</span>
|
||||
<span v-else-if="scope.row.status == 1" type="success">已归还</span>
|
||||
<span v-else type="success">部分归还</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="outstandAmount"
|
||||
label="未归还金额">
|
||||
</el-table-column>
|
||||
<el-table-column prop="outstandAmount" label="未归还金额"> </el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="realName"
|
||||
label="操作人">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createTime"
|
||||
label="创建时间"
|
||||
width="220">
|
||||
<el-table-column prop="realName" label="操作人"> </el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" width="220">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column-->
|
||||
<!-- prop="zip"-->
|
||||
<!-- label="操作"-->
|
||||
<!-- width="220">-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-button-->
|
||||
@ -209,17 +175,17 @@
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-edit"-->
|
||||
<!-- >修改</el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-delete"-->
|
||||
<!-- >删除</el-button>-->
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
:disabled="scope.row.status == 1"
|
||||
@click="repay(scope.row.id)"
|
||||
>归还</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="returnRecord(scope.row.id)"
|
||||
>归还详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@ -238,6 +204,90 @@
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 归还记录信息-->
|
||||
<el-drawer
|
||||
title="归还详情"
|
||||
:visible.sync="drawer"
|
||||
direction="rtl"
|
||||
size="55%"
|
||||
:before-close="handleClose">
|
||||
<div style="display: grid; place-items: center;">
|
||||
<el-card style="background-color: #f5f5f5;width: 90%">
|
||||
<div slot="header" class="clearfix">
|
||||
<div style="position: relative;">
|
||||
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
|
||||
<h2>单据号:{{record.orderNo}}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<span>操作员工:</span>
|
||||
<span>{{ record.realName }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div >
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<span>挂账单位</span>
|
||||
<span>{{record.unitName}}</span>
|
||||
</div>
|
||||
<div style="display: flex; justify-content: space-between;margin: 10px 0">
|
||||
<span>挂账人</span>
|
||||
<span>{{record.personCredit}}</span>
|
||||
</div>
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<span>联系电话</span>
|
||||
<span>{{record.contactMobile}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="margin-top: 15px;width: 90%">
|
||||
<el-table ref="tables"
|
||||
v-loading="loading"
|
||||
:data="returnRecordList">
|
||||
<el-table-column label="单据号" align="center" prop="orderNo" width="200"></el-table-column>
|
||||
<el-table-column label="类型" align="center" prop="returnType">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.returnType == 0">挂账</el-tag>
|
||||
<el-tag v-else type="success">归还</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="归还金额" align="center" prop="amount" />
|
||||
<el-table-column label="找零金额" align="center" prop="seekZero" />
|
||||
<el-table-column label="归还方式" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ getPayMeth(payList,scope.row.status) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="支付状态" align="center" prop="payStatus">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.payStatus == 'unpaid'">未支付</el-tag>
|
||||
<el-tag type="success" v-else-if="scope.row.payStatus == 'paid'">已支付</el-tag>
|
||||
<el-tag type="danger" v-else>支付失败</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作人" align="center" prop="realName" />
|
||||
<el-table-column label="支付时间" align="center" prop="payTime" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.payTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-box">
|
||||
<el-pagination
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
v-show="total2>0"
|
||||
:total="total2"
|
||||
:page.sync="queryParams1.page"
|
||||
:limit.sync="queryParams1.pageSize"
|
||||
@current-change="getRecordList">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</el-drawer>
|
||||
|
||||
<!-- 新增挂账记录-->
|
||||
<el-dialog title="新增挂账记录" :visible.sync="open" width="700px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
@ -620,6 +670,7 @@ import {
|
||||
} from "@/api/cashier/hangbill";
|
||||
import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit";
|
||||
import {getDicts} from "@/api/dict/data";
|
||||
import {listReturnRecord, returnRecordByOrderNo, returnRecordInfo} from "@/api/cashier/returnrecord";
|
||||
|
||||
export default {
|
||||
name: "credit",
|
||||
@ -643,6 +694,7 @@ import {getDicts} from "@/api/dict/data";
|
||||
isPay:true,
|
||||
isPaySuccess:false,
|
||||
loading: false,
|
||||
drawer: false,
|
||||
// 弹出框标题
|
||||
title:'',
|
||||
// 支付方式列表
|
||||
@ -664,6 +716,8 @@ import {getDicts} from "@/api/dict/data";
|
||||
form2:{payType:"WECHAT"},
|
||||
form3:{},
|
||||
form4:{payType:"WECHAT"},
|
||||
// 挂账信息
|
||||
record:{},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
page: 1,
|
||||
@ -673,13 +727,21 @@ import {getDicts} from "@/api/dict/data";
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
queryParams1: {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
hangBillId:"",
|
||||
},
|
||||
// 日期范围
|
||||
dateRange: [],
|
||||
// 挂账记录列表
|
||||
hangBillList:[],
|
||||
// 归还记录列表
|
||||
returnRecordList:[],
|
||||
// 总条数
|
||||
total: 0,
|
||||
total1: 0,
|
||||
total2: 0,
|
||||
// 是否开启提示框
|
||||
open:false,
|
||||
open1:false,
|
||||
@ -693,6 +755,7 @@ import {getDicts} from "@/api/dict/data";
|
||||
isBatch:false,
|
||||
timer:"",
|
||||
unitName:"",
|
||||
orderNo:"",
|
||||
// 表单校验
|
||||
rules: {
|
||||
unitName: [ { required: true, message: "请选择挂账单位", trigger: "blur" }, ],
|
||||
@ -769,6 +832,42 @@ import {getDicts} from "@/api/dict/data";
|
||||
this.getLists();
|
||||
},
|
||||
methods:{
|
||||
getPayMeth(list,val){
|
||||
let name = "";
|
||||
if (list!=null && list!=""){
|
||||
list.forEach(item => {
|
||||
if (item.dictValue == val){
|
||||
name = item.dictLabel
|
||||
}
|
||||
})
|
||||
}
|
||||
return name;
|
||||
},
|
||||
// 是否关闭弹框
|
||||
handleClose(done) {
|
||||
done();
|
||||
},
|
||||
// 归还记录详情弹框
|
||||
returnRecord(id){
|
||||
this.record = {}
|
||||
this.drawer = true
|
||||
hangBillInfo(id).then(response => {
|
||||
this.record = response.data
|
||||
})
|
||||
this.getRecordList(id,1);
|
||||
},
|
||||
getRecordList(id,val){
|
||||
if (val!=1){
|
||||
this.queryParams1.page = id
|
||||
this.queryParams1.hangBillId = this.record.id
|
||||
}else {
|
||||
this.queryParams1.hangBillId = id
|
||||
}
|
||||
listReturnRecord(this.queryParams1).then(response => {
|
||||
this.returnRecordList = response.data.records
|
||||
this.total2 = response.data.total
|
||||
})
|
||||
},
|
||||
changePayType(val){
|
||||
this.payType = val
|
||||
},
|
||||
@ -778,17 +877,19 @@ import {getDicts} from "@/api/dict/data";
|
||||
},
|
||||
// 计算找零金额
|
||||
changeSeekZero(){
|
||||
this.seekZero = this.authCode - this.oilActualPay - this.goodsActualPay
|
||||
this.seekZero = (this.authCode - this.payAmount).toFixed(2)
|
||||
},
|
||||
batchSub(){
|
||||
this.form4.list = JSON.stringify(this.tableList);
|
||||
this.form4.repaidAmount = this.repaidAmount;
|
||||
this.form4.payType = "WECHAT"
|
||||
this.open4 = true;
|
||||
},
|
||||
batchReturn(){
|
||||
this.open3 = true
|
||||
this.repayList = [];
|
||||
this.unitName = ""
|
||||
this.getLists();
|
||||
},
|
||||
getRepayList(){
|
||||
let result = [];
|
||||
@ -854,37 +955,48 @@ import {getDicts} from "@/api/dict/data";
|
||||
this.getList();
|
||||
},
|
||||
// 收款
|
||||
collection(){
|
||||
collection(val){
|
||||
if (this.payType=="CASH"){
|
||||
if (this.authCode==undefined || this.authCode=="" || this.seekZero<0){
|
||||
this.$modal.msgError("请输入正确的金额变化");
|
||||
return;
|
||||
}
|
||||
}
|
||||
let _this = this;
|
||||
if (this.isBatch){
|
||||
// 批量归还
|
||||
_this.form4.repaidAmount = _this.payAmount;
|
||||
_this.form4.authCode = _this.authCode;
|
||||
_this.form4.orderNo = _this.tableList[0].orderNo;
|
||||
_this.form4.seekZero = _this.seekZero
|
||||
batchHangBill(_this.form4).then(response => {
|
||||
if (response.data!=0){
|
||||
_this.isPaySuccess = true;
|
||||
_this.isPay = false;
|
||||
this.getList();
|
||||
}
|
||||
// 返回订单号信息
|
||||
_this.orderNo = response.data
|
||||
})
|
||||
_this.loading = true;
|
||||
_this.queryPayStatus();
|
||||
let timer = setInterval(function () {
|
||||
if (_this.isQuery == false) {
|
||||
_this.loading = false;
|
||||
_this.isPay = false;
|
||||
clearInterval(_this.timer);
|
||||
}
|
||||
},1000)
|
||||
setTimeout(function (){
|
||||
_this.loading = false;
|
||||
clearInterval(timer);
|
||||
},30000)
|
||||
this.open3 = false;
|
||||
this.open4 = false;
|
||||
this.getLists();
|
||||
this.getList();
|
||||
}else {
|
||||
// 单个归还
|
||||
_this.form2.repaidAmount = _this.payAmount;
|
||||
_this.form2.authCode = _this.authCode;
|
||||
_this.form2.seekZero = _this.seekZero
|
||||
editHangBill(this.form2).then(response => {
|
||||
console.log(response)
|
||||
if (response.data==null){
|
||||
|
||||
}else {
|
||||
if (response.data.payStatus == 'paid'){
|
||||
_this.isPaySuccess = true;
|
||||
_this.isPay = false;
|
||||
}
|
||||
}
|
||||
// 返回订单号信息
|
||||
_this.orderNo = response.data
|
||||
})
|
||||
_this.loading = true;
|
||||
_this.queryPayStatus();
|
||||
@ -907,20 +1019,22 @@ import {getDicts} from "@/api/dict/data";
|
||||
queryPayStatus(){
|
||||
let _this = this;
|
||||
_this.timer = setInterval(function (){
|
||||
queryHangBill({orderNo:_this.form2.orderNo}).then(response => {
|
||||
if (response.data.payStatus == "unpaid"){
|
||||
_this.isQuery = true;
|
||||
}
|
||||
if (response.data.payStatus == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
_this.isQuery = false;
|
||||
}
|
||||
if (response.data.payStatus == "payFail"){
|
||||
_this.isPaySuccess = false;
|
||||
_this.isQuery = false;
|
||||
}
|
||||
returnRecordByOrderNo({orderNo:_this.orderNo}).then(response => {
|
||||
response.data.forEach(item => {
|
||||
if (item.payStatus == "unpaid"){
|
||||
_this.isQuery = true;
|
||||
}
|
||||
if (item.payStatus == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
_this.isQuery = false;
|
||||
}
|
||||
if (item.payStatus == "payFail"){
|
||||
_this.isPaySuccess = false;
|
||||
_this.isQuery = false;
|
||||
}
|
||||
})
|
||||
})
|
||||
},1000)
|
||||
},1001)
|
||||
},
|
||||
submitReturn(){
|
||||
this.isPay = true;
|
||||
@ -937,8 +1051,10 @@ import {getDicts} from "@/api/dict/data";
|
||||
submitReturn1(){
|
||||
this.isPay = true;
|
||||
this.isBatch = true;
|
||||
this.loading = false;
|
||||
this.payAmount = this.form4.repaidAmount;
|
||||
this.authCode = this.form4.authCode;
|
||||
this.authCode = "";
|
||||
// this.authCode = this.form4.authCode;
|
||||
if (this.form4.payType!="CASH"){
|
||||
this.title = "扫码付款";
|
||||
}else {
|
||||
@ -954,6 +1070,7 @@ import {getDicts} from "@/api/dict/data";
|
||||
},
|
||||
// 归还
|
||||
repay(id){
|
||||
this.payType = "WECHAT"
|
||||
hangBillInfo(id).then( response => {
|
||||
this.open2 = true;
|
||||
this.form2 = response.data
|
||||
@ -1047,7 +1164,10 @@ import {getDicts} from "@/api/dict/data";
|
||||
})
|
||||
},
|
||||
// 获取列表信息
|
||||
getList(){
|
||||
getList(val){
|
||||
if (val!=undefined){
|
||||
this.queryParams.page = val
|
||||
}
|
||||
listHangBill(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
|
||||
this.hangBillList = response.data.records
|
||||
this.total = response.data.total;
|
||||
|
@ -152,8 +152,20 @@
|
||||
width="400"
|
||||
trigger="click">
|
||||
<div>
|
||||
<el-checkbox-group v-model="checkedCities5" @change="handleCheckedCitiesChange5">
|
||||
<el-checkbox v-for="(item,index) in couponDiscount" :label="item.name" :key="index">
|
||||
<!-- <el-checkbox-group v-model="checkedCities5" @change="handleCheckedCitiesChange5">-->
|
||||
<!-- <el-checkbox v-for="(item,index) in couponDiscount" :label="item.name" :key="index">-->
|
||||
<!-- <div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">-->
|
||||
<!-- <div style="width: 200px">{{item.name}}</div>-->
|
||||
<!-- <div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">-->
|
||||
<!-- <div style="color: red">-¥{{ item.reduce }}</div>-->
|
||||
<!-- <div style="color: grey">满{{ item.full }}元,减{{ item.reduce }}元</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-checkbox>-->
|
||||
<!-- </el-checkbox-group>-->
|
||||
<el-radio-group v-model="checkedCities5" @input="handleCheckedCitiesChange5">
|
||||
<el-radio v-for="(item,index) in couponDiscount"
|
||||
:label="item.name" :key="index" style="display: flex;">
|
||||
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">
|
||||
<div style="width: 200px">{{item.name}}</div>
|
||||
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">
|
||||
@ -161,8 +173,8 @@
|
||||
<div style="color: grey">满{{ item.full }}元,减{{ item.reduce }}元</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div slot="reference">
|
||||
<el-checkbox
|
||||
@ -808,7 +820,7 @@
|
||||
// 优惠券全选
|
||||
checkAll5: false,
|
||||
isIndeterminate5: true,
|
||||
checkedCities5: [],
|
||||
checkedCities5: "",
|
||||
cities5: cityOptions,
|
||||
couponDiscount: [],
|
||||
// 优惠券列表
|
||||
@ -939,6 +951,10 @@
|
||||
isMember: false,
|
||||
// 员工信息
|
||||
staff:"",
|
||||
// 优惠券id
|
||||
couponIds:[],
|
||||
// 使用的优惠券id
|
||||
useCouponIds:[],
|
||||
map:{
|
||||
allAmount:0,
|
||||
// 用户支付条码信息
|
||||
@ -1271,48 +1287,53 @@
|
||||
this.checkAll1 = false;
|
||||
this.fullReduction = 0;
|
||||
this.isUseFull = true;
|
||||
this.checkedCities5 = this.couponDiscount[0].name;
|
||||
}else {
|
||||
this.isUseFull = false;
|
||||
this.checkedCities5 = ""
|
||||
}
|
||||
}else if (this.exclusion == 0){
|
||||
if (val){
|
||||
this.checkAll4 = false;
|
||||
this.consumeAmount = 0;
|
||||
this.isUseBalance = true;
|
||||
this.checkedCities5 = this.couponDiscount[0].name;
|
||||
}else {
|
||||
this.isUseBalance = false;
|
||||
this.checkedCities5 = ""
|
||||
}
|
||||
}
|
||||
let list = []
|
||||
this.couponDiscount.forEach(item => {
|
||||
list.push(item.name)
|
||||
})
|
||||
if (val){
|
||||
this.couponAmount = 0
|
||||
this.couponDiscount.forEach(item2 => {
|
||||
this.couponAmount += item2.reduce
|
||||
this.couponAmount = this.couponDiscount[0].reduce
|
||||
this.useCouponIds = ""
|
||||
this.couponIds.forEach(item => {
|
||||
if (item.name = this.couponDiscount[0].name){
|
||||
this.useCouponIds = item.id
|
||||
}
|
||||
})
|
||||
this.checkedCities5 = this.couponDiscount[0].name;
|
||||
}else {
|
||||
this.useCouponIds = ""
|
||||
this.couponAmount = 0
|
||||
this.checkedCities5 = ""
|
||||
}
|
||||
this.checkedCities5 = val ? list : [];
|
||||
this.isIndeterminate5 = false;
|
||||
this.isExclusion();
|
||||
},
|
||||
handleCheckedCitiesChange5(value) {
|
||||
this.couponAmount = 0;
|
||||
this.couponDiscount.forEach(item => {
|
||||
let reduces = 0
|
||||
for (let i = 0; i < value.length; i++){
|
||||
if (item.name == value[i]){
|
||||
reduces = item.reduce
|
||||
}
|
||||
if (item.name == value){
|
||||
this.couponAmount = item.reduce
|
||||
}
|
||||
this.couponAmount += reduces
|
||||
})
|
||||
let checkedCount = value.length;
|
||||
this.checkAll5 = checkedCount === this.couponDiscount.length;
|
||||
this.isIndeterminate5 = checkedCount > 0 && checkedCount < this.couponDiscount.length;
|
||||
this.useCouponIds = ""
|
||||
this.couponIds.forEach(item => {
|
||||
if (item.name == value){
|
||||
this.useCouponIds = item.id
|
||||
}
|
||||
})
|
||||
this.checkAll5 = true;
|
||||
this.isExclusion();
|
||||
},
|
||||
// 模糊查询商品信息
|
||||
@ -1646,10 +1667,13 @@
|
||||
_this.preferentialData.oilPrice = item1.oilPrice;
|
||||
_this.preferentialData.oilLiters = item1.liters;
|
||||
_this.couponDiscount =[];
|
||||
_this.couponIds = [],
|
||||
selectCoupon(_this.preferentialData).then(response => {
|
||||
_this.couponAmount = 0;
|
||||
_this.couponIds = response.data
|
||||
if (response.data.length>0){
|
||||
response.data.forEach(item => {
|
||||
_this.useCouponIds.push(item.id)
|
||||
let discount = {type:item.type,discountType:item.discountType,name:item.name,oilName:item1.oilName,full:0,reduce:0,discount:0}
|
||||
discount.full = item.satisfiedAmount
|
||||
if (item.type==0){
|
||||
@ -1688,12 +1712,19 @@
|
||||
_this.couponDiscount.forEach(item2 => {
|
||||
if (item2.oilName!=discount.oilName) {
|
||||
_this.couponDiscount.push(discount)
|
||||
_this.checkedCities5.push(item.name)
|
||||
_this.checkedCities5 = item.name
|
||||
_this.couponAmount = discount.reduce
|
||||
}
|
||||
if (item2.name!=discount.name && item2.oilName==discount.oilName) {
|
||||
_this.couponDiscount.push(discount)
|
||||
_this.checkedCities5 = item.name
|
||||
_this.couponAmount = discount.reduce
|
||||
}
|
||||
})
|
||||
}else {
|
||||
_this.couponDiscount.push(discount)
|
||||
_this.checkedCities5.push(item.name)
|
||||
_this.checkedCities5 = item.name
|
||||
_this.couponAmount = discount.reduce
|
||||
}
|
||||
}
|
||||
if (item.exclusiveFunction == 0){
|
||||
@ -1712,12 +1743,7 @@
|
||||
_this.exclusion = item.exclusiveFunction
|
||||
})
|
||||
}
|
||||
let couponAmount = 0;
|
||||
_this.couponDiscount.forEach(item2 => {
|
||||
couponAmount += item2.reduce
|
||||
_this.checkAll5 = true;
|
||||
})
|
||||
_this.couponAmount = couponAmount
|
||||
_this.checkAll5 = true;
|
||||
_this.isExclusion();
|
||||
})
|
||||
})
|
||||
@ -1763,6 +1789,11 @@
|
||||
// 判断互斥限制
|
||||
isExclusion(){
|
||||
if (this.exclusion == 1){
|
||||
// 不使用满减
|
||||
if (this.isUseBalance){
|
||||
this.countAmountFull()
|
||||
return;
|
||||
}
|
||||
// 储值卡互斥
|
||||
if (this.isUseBalance){
|
||||
this.countAmountUnBalance()
|
||||
@ -1773,6 +1804,11 @@
|
||||
}
|
||||
}else if (this.exclusion == 0){
|
||||
// 满减互斥
|
||||
// 不使用储值卡
|
||||
if (this.isUseBalance){
|
||||
this.countAmountUnBalance()
|
||||
return;
|
||||
}
|
||||
if (this.isUseFull){
|
||||
this.countAmountFull()
|
||||
return;
|
||||
@ -1848,17 +1884,6 @@
|
||||
_this.fullReduction = 0
|
||||
}
|
||||
_this.isExclusion();
|
||||
// if (_this.isUseFull){
|
||||
// _this.checkAll1 = false;
|
||||
// _this.fullReduction = 0;
|
||||
// _this.checkedCities1 = []
|
||||
// _this.countAmountFull()
|
||||
// return;
|
||||
// }else {
|
||||
// _this.countAmountBalance()
|
||||
// return;
|
||||
// }
|
||||
// _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.fullReduction - _this.balance
|
||||
})
|
||||
})
|
||||
},
|
||||
@ -1994,11 +2019,6 @@
|
||||
this.oilAmount += +item.amount
|
||||
})
|
||||
|
||||
// if (this.select == "元"){
|
||||
// this.oilAmount = +this.form.amount + this.oilAmount;
|
||||
// }else {
|
||||
// this.oilAmount = this.form.amount + this.oilAmount;
|
||||
// }
|
||||
this.oilActualPay = this.oilAmount - this.oilDiscount;
|
||||
this.oilTotal = this.oilOrder.length;
|
||||
this.select = "元";
|
||||
@ -2174,6 +2194,7 @@
|
||||
this.map.consumeAmount = this.consumeAmount;
|
||||
this.updateRefuelMoney();
|
||||
this.map.refuelMoney = JSON.stringify(this.refuelMoney)
|
||||
this.map.couponId = this.useCouponIds
|
||||
|
||||
let _this = this;
|
||||
addLJGoods(_this.map).then( response => {
|
||||
|
Loading…
Reference in New Issue
Block a user