From b47491974d81fce3bc059791ba8ae41ee8f5e99b Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 17 Mar 2023 10:48:01 +0800
Subject: [PATCH] 后台修改

---
 src/main/java/cc/mrbird/febs/mall/vo/OrderListVo.java                           |    3 +++
 src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html          |    2 +-
 src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java |    8 +++++++-
 src/main/resources/templates/febs/views/modules/order/orderList.html            |    8 ++++++--
 src/main/resources/templates/febs/views/modules/goods/goodsList.html            |    7 +++++--
 5 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
index 8bd18c8..f27f44e 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
@@ -854,6 +854,8 @@
                 BigDecimal amount = sku.getPresentPrice().multiply(BigDecimal.valueOf(item.getCnt()));
                 total = total.add(amount);
         }
+
+        BigDecimal score = ObjectUtil.isEmpty(addOrderDto.getScore()) ? BigDecimal.ZERO : addOrderDto.getScore();
         if(hasTc){
             //系统设置的个人贡献点最大值
             DataDictionaryCustom starGetDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
@@ -868,6 +870,10 @@
                 if(starGet.compareTo(star) <= 0){
                     throw new FebsException("无法购买套餐");
                 }
+                BigDecimal prizeScore = mallMemberWallet.getPrizeScore();
+                if(prizeScore.compareTo(score) < 0){
+                    throw new FebsException("积分不足");
+                }
             }
         }
         /**
@@ -881,7 +887,7 @@
                 DataDictionaryEnum.SCORE_CHANGE.getType(),
                 DataDictionaryEnum.SCORE_CHANGE.getCode()
         );
-        BigDecimal score = ObjectUtil.isEmpty(addOrderDto.getScore()) ? BigDecimal.ZERO : addOrderDto.getScore();
+
         if(ObjectUtil.isNotEmpty(scorePercentDic)){
             //商品的现金折扣比例
             BigDecimal scorePercent = new BigDecimal(scorePercentDic.getValue()).multiply(BigDecimal.valueOf(0.01));
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/OrderListVo.java b/src/main/java/cc/mrbird/febs/mall/vo/OrderListVo.java
index 4ec2948..f7a7c1e 100644
--- a/src/main/java/cc/mrbird/febs/mall/vo/OrderListVo.java
+++ b/src/main/java/cc/mrbird/febs/mall/vo/OrderListVo.java
@@ -31,6 +31,9 @@
     @ApiModelProperty(value = "订单金额")
     private BigDecimal amount;
 
+    @ApiModelProperty(value = "积分抵扣金额")
+    private BigDecimal scoreAmount;
+
     @ApiModelProperty(value = "订单明细")
     private List<OrderItemVo> items;
 
diff --git a/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html b/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
index b43fa63..e13398f 100644
--- a/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
+++ b/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -91,7 +91,7 @@
                                         <div class="layui-form-item febs-hide tc-set">
                                             <label class="layui-form-label">贡献值:</label>
                                             <div class="layui-input-block">
-                                                <input type="text" name="star" lay-verify="required|integer"  placeholder="请输入贡献值" autocomplete="off" class="layui-input">
+                                                <input type="text" name="star" placeholder="请输入贡献值" autocomplete="off" class="layui-input">
                                                 <div class="layui-form-mid layui-word-aux">支付后,用户获取对应的贡献值</div>
                                             </div>
                                         </div>
diff --git a/src/main/resources/templates/febs/views/modules/goods/goodsList.html b/src/main/resources/templates/febs/views/modules/goods/goodsList.html
index e5e0519..a56a05d 100644
--- a/src/main/resources/templates/febs/views/modules/goods/goodsList.html
+++ b/src/main/resources/templates/febs/views/modules/goods/goodsList.html
@@ -104,6 +104,9 @@
             tableIns;
 
         form.render();
+        let currPageGoods = 1;//首先默认值为1,防止出错
+        //获取当前页
+        currPageGoods = $view.find(".layui-laypage-em").next().html();
 
         // 表格初始化
         initTable();
@@ -194,14 +197,14 @@
         // 查询按钮
         $query.on('click', function () {
             var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
-            tableIns.reload({where: params, page: {curr: 1}});
+            tableIns.reload({where: params, page: {curr: currPageGoods}});
         });
 
         // 刷新按钮
         $reset.on('click', function () {
             $searchForm[0].reset();
             sortObject.type = 'null';
-            tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject});
+            tableIns.reload({where: getQueryParams(), page: {curr: currPageGoods}, initSort: sortObject});
         });
 
         $add.on('click', function () {
diff --git a/src/main/resources/templates/febs/views/modules/order/orderList.html b/src/main/resources/templates/febs/views/modules/order/orderList.html
index a59b8ca..bb91673 100644
--- a/src/main/resources/templates/febs/views/modules/order/orderList.html
+++ b/src/main/resources/templates/febs/views/modules/order/orderList.html
@@ -138,6 +138,10 @@
 
         form.render();
 
+        let currPageGoods = 1;//首先默认值为1,防止出错
+        //获取当前页
+        currPageGoods = $view.find(".layui-laypage-em").next().html();
+
         // 表格初始化
         initTable();
 
@@ -238,14 +242,14 @@
         // 查询按钮
         $query.on('click', function () {
             var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
-            tableIns.reload({where: params, page: {curr: 1}});
+            tableIns.reload({where: params, page: {curr: currPageGoods}});
         });
 
         // 刷新按钮
         $reset.on('click', function () {
             $searchForm[0].reset();
             sortObject.type = 'null';
-            tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject});
+            tableIns.reload({where: getQueryParams(), page: {curr: currPageGoods}, initSort: sortObject});
         });
 
         $add.on('click', function () {

--
Gitblit v1.9.1