From 7ec55c0386ae6e8fc5de497baf9d70f7e4088f2b Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Mon, 20 Nov 2023 19:53:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E9=93=B6=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/controller/HangBillController.java | 2 +- .../order/mapper/xml/HangBillMapper.xml | 2 +- .../order/service/CreditUnitService.java | 13 + .../order/service/HangBillService.java | 2 +- .../service/impl/CreditUnitServiceImpl.java | 12 + .../service/impl/HangBillServiceImpl.java | 51 ++- .../fuint/business/order/vo/HangBillVo.java | 2 + .../src/api/cashier/preferential.js | 2 +- .../views/cashier/NewComponents/credit.vue | 15 +- .../views/cashier/NewComponents/homeindex.vue | 400 ++++++++++++++++-- 10 files changed, 468 insertions(+), 33 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HangBillController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HangBillController.java index 4fcb1018d..1cdbf7ae3 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HangBillController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HangBillController.java @@ -64,7 +64,7 @@ public class HangBillController extends BaseController { * @return */ @PostMapping - public ResponseObject add(@Validated @RequestBody HangBill hangBill){ + public ResponseObject add(@Validated @RequestBody HangBillVo hangBill){ return getSuccessResult(hangBillService.insertHangBill(hangBill)); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/HangBillMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/HangBillMapper.xml index 71e6a4a86..1fa0f42ba 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/HangBillMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/HangBillMapper.xml @@ -2,7 +2,7 @@ - select hb.*,ms.real_name,ms.mobile,cu.unit_name,cu.person_credit,cu.contact_mobile + select hb.*,ms.real_name,ms.mobile,cu.unit_name,cu.person_credit,cu.contact_mobile,cu.credit_limit from hang_bill hb inner join mt_staff ms on hb.staff_id = ms.id inner join credit_unit cu on hb.credit_unit_id = cu.id diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/CreditUnitService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/CreditUnitService.java index cce47c2d6..3c2e6ca1c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/CreditUnitService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/CreditUnitService.java @@ -15,10 +15,23 @@ public interface CreditUnitService extends IService { */ public List selectCreditUnitList(); + /** + * 根据id查询挂账单位信息 + * @return + */ + public CreditUnit selectCreditUnitListById(int id); + /** * 添加挂账单位信息 * @param creditUnit * @return */ public int insertCreditUnit(CreditUnit creditUnit); + + /** + * 修改挂账单位信息 + * @param creditUnit + * @return + */ + public int updateCreditUnit(CreditUnit creditUnit); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HangBillService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HangBillService.java index 885cd0652..639224599 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HangBillService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HangBillService.java @@ -46,7 +46,7 @@ public interface HangBillService extends IService { * @param hangBill * @return */ - public int insertHangBill(HangBill hangBill); + public int insertHangBill(HangBillVo hangBill); /** * 修改挂账记录 并收款 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CreditUnitServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CreditUnitServiceImpl.java index 49d496742..fa6dd35f1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CreditUnitServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CreditUnitServiceImpl.java @@ -19,9 +19,21 @@ public class CreditUnitServiceImpl extends ServiceImpl implements HangBillService { + @Autowired + private CreditUnitService creditUnitService; + @Override public IPage selectHangBillList(Page page, HangBillVo hangBill) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); @@ -60,9 +65,25 @@ public class HangBillServiceImpl extends ServiceImpl i } @Override - public int insertHangBill(HangBill hangBill) { + public int insertHangBill(HangBillVo hangBillVo) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); Integer storeId = nowAccountInfo.getStoreId(); +// 根据挂账单位id查询挂账单位信息 + CreditUnit creditUnit = creditUnitService.selectCreditUnitListById(hangBillVo.getCreditUnitId()); +// 挂账单位限额的数据删减 + if (creditUnit.getCreditLimit()!=0){ + Double creditLimit = creditUnit.getCreditLimit(); +// 判断修改之后的挂账单位限额金额是否小于0 + if (creditLimit-hangBillVo.getAmount()>=0){ + creditUnit.setCreditLimit(creditLimit-hangBillVo.getAmount()); + creditUnitService.updateCreditUnit(creditUnit); + }else { + return 0; + } + } + +// 创建挂账记录对象 + HangBill hangBill = new HangBill(); hangBill.setStoreId(storeId); // 根据日期生成订单号 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); @@ -70,10 +91,17 @@ public class HangBillServiceImpl extends ServiceImpl i String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6); String orderNo = timestamp+randomString; Integer staffId = nowAccountInfo.getStaffId(); + hangBill.setStaffId(staffId); hangBill.setOrderNo(orderNo); - hangBill.setOutstandAmount(hangBill.getAmount()); + hangBill.setOutstandAmount(hangBillVo.getAmount()); hangBill.setRepaidAmount(0.0); + hangBill.setCreditUnitId(hangBillVo.getCreditUnitId()); + hangBill.setStatus("0"); + hangBill.setReturnType("0"); + hangBill.setAmount(hangBillVo.getAmount()); + hangBill.setRemark(hangBillVo.getRemark()); + hangBill.setPayStatus("unpaid"); int row = baseMapper.insert(hangBill); return row; } @@ -96,6 +124,14 @@ public class HangBillServiceImpl extends ServiceImpl i if (payType.equals("CASH")){ hangBill.setPayStatus("paid"); } + + // 根据挂账单位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")); // 支付成功后修改挂账信息 @@ -114,6 +150,8 @@ public class HangBillServiceImpl extends ServiceImpl i }else { hangBill.setStatus("2"); } +// 修改挂账单位余额信息 + creditUnitService.updateCreditUnit(creditUnit); } row = baseMapper.updateById(hangBill); return baseMapper.selectById(Integer.parseInt(map.get("id"))); @@ -127,6 +165,7 @@ public class HangBillServiceImpl extends ServiceImpl i 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")); @@ -196,6 +235,14 @@ public class HangBillServiceImpl extends ServiceImpl i }else { hangBill.setStatus("2"); } + // 根据挂账单位id查询挂账单位信息 + CreditUnit creditUnit = creditUnitService.selectCreditUnitListById(hangBill.getCreditUnitId()); + if (creditUnit.getCreditLimit()!=0){ + Double creditLimit = creditUnit.getCreditLimit(); + creditUnit.setCreditLimit(creditLimit+repaidAmount1); + } + // 修改挂账单位余额信息 + creditUnitService.updateCreditUnit(creditUnit); return hangBill; } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/HangBillVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/HangBillVo.java index 59dd51789..3d1ddc462 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/HangBillVo.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/HangBillVo.java @@ -15,4 +15,6 @@ public class HangBillVo extends HangBill { private String personCredit; // 联系电话 private String contactMobile; +// 挂账额度 + private String creditLimit; } diff --git a/fuintCashierWeb/src/api/cashier/preferential.js b/fuintCashierWeb/src/api/cashier/preferential.js index f782629f2..ec56b0b25 100644 --- a/fuintCashierWeb/src/api/cashier/preferential.js +++ b/fuintCashierWeb/src/api/cashier/preferential.js @@ -1,6 +1,6 @@ import request from '@/utils/request' -// 扫码支付接口 +// 优惠活动信息 export function selectPreferential(data) { return request({ url: '/business/marketingActivity/activeExchange/selectConsumptionList', diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue b/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue index f1ade4335..09cc3d68f 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue @@ -270,6 +270,11 @@ +
+ + 当前挂账为普通挂账方式,如需挂账油品交易等信息的账目,请前往收银台挂账 + +
取 消 确 定 @@ -825,9 +830,13 @@ import {getDicts} from "@/api/dict/data"; _this.form2.repaidAmount = _this.payAmount; _this.form2.authCode = _this.authCode; editHangBill(this.form2).then(response => { - if (response.data.payStatus == 'paid'){ - _this.isPaySuccess = true; - _this.isPay = false; + if (response.data==null){ + + }else { + if (response.data.payStatus == 'paid'){ + _this.isPaySuccess = true; + _this.isPay = false; + } } }) _this.loading = true; diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue index 79c0eaba2..966e1e8b5 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue @@ -61,12 +61,13 @@ trigger="click">
- +
-
{{city}}
+
{{item.type}}
-
-¥1.56
-
满100元每升优惠0.2元
+
-¥{{ fullReduction }}
+
满{{ item.full }}元,打{{ item.discount }}折
+
满{{ item.full }}元,减{{ item.reduce }}元
@@ -232,6 +233,9 @@ :value="item.dictValue"> {{ item.dictLabel }}
+
+ 挂账 +
@@ -665,12 +669,125 @@
+ + + + + + + + + + 新增挂账单位 + + + + + + + + + + + + 可用额度为挂账人的最大可用额度,如挂账金额大于可用额度,将无法进行挂账,0为不限额 + + + + + + + + + + + + + + + + + + + 取 消 + 确 定 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0为不限额,额度为当前单位最大可挂账金额,如已挂账金额归还,额度将也同步返还 + + + + + + + + + + + + 启用 + 禁用 + + + + + + + 取 消 + 确 定 + +