From 75e3d37778902c5f7f74a5d7bfade734ec68e514 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Fri, 24 Nov 2023 16:10:26 +0800
Subject: [PATCH] 匹配

---
 src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyInfoVo.java                   |    2 
 src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java |    3 +
 src/main/resources/templates/febs/views/modules/news/productBuyList.html      |   98 +++++++++++++++++++++++++++----------------------
 3 files changed, 57 insertions(+), 46 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
index d5d9174..6324278 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
@@ -134,7 +134,8 @@
         mallProductBuy.setState(ProductEnum.PRODUCT_BUY_ON_GOING.getValue());
         mallProductBuy.setMateState(ProductEnum.PRODUCT_BUY_MATE_STATE_FAIL.getValue());
         mallProductBuy.setNftTotal(mallProductNft.getPriceNft());
-        mallProductBuy.setNftAva(BigDecimal.ZERO);
+        mallProductBuy.setNftAva(mallProductNft.getPriceNft());
+//        mallProductBuy.setNftAva(BigDecimal.ZERO);
         mallProductBuyMapper.insert(mallProductBuy);
         //令牌 可用减少,冻结增加
         mallMemberAmount.setTokenAva(mallMemberAmount.getTokenAva().subtract(priceToken));
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyInfoVo.java
index 315d045..63dc41c 100644
--- a/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyInfoVo.java
+++ b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyInfoVo.java
@@ -16,7 +16,7 @@
     private String orderNo;
     @ApiModelProperty(value = "预约状态  0:失败 1:进行中 2:超时  3:已完成")
     private int state;//预约状态  0:失败 1:进行中 2:超时  3:已完成
-    @ApiModelProperty(value = "匹配状态0:失败 1:匹配中 2:待支付 3:已支付 4:对方已确认 5:已完成")
+    @ApiModelProperty(value = "转换卖单状态 0:未转换 1:已转换")
     private int mateState;//匹配状态0:失败 1:匹配中 2:待支付 3:已支付 4:对方已确认 5:已完成
     @ApiModelProperty(value = "nft预约额度")
     private BigDecimal nftTotal;//nft预约额度
diff --git a/src/main/resources/templates/febs/views/modules/news/productBuyList.html b/src/main/resources/templates/febs/views/modules/news/productBuyList.html
index 122126a..e401bda 100644
--- a/src/main/resources/templates/febs/views/modules/news/productBuyList.html
+++ b/src/main/resources/templates/febs/views/modules/news/productBuyList.html
@@ -57,9 +57,9 @@
 </script>
 <script type="text/html" id="isBuyMateState">
     {{# if(d.mateState === 0) { }}
-    <span class="layui-badge febs-bg-red">失败</span>
+    <span class="layui-badge febs-bg-red">未转换</span>
     {{# } else if(d.mateState === 1) { }}
-    <span class="layui-badge febs-bg-blue">匹配中</span>
+    <span class="layui-badge febs-bg-blue">已转换</span>
     {{# } else if(d.mateState === 2) { }}
     <span class="layui-badge febs-bg-orange">待支付</span>
     {{# } else if(d.mateState === 3) { }}
@@ -79,6 +79,17 @@
     <a lay-event="edit" shiro:hasPermission="user:update"><i
             class="layui-icon febs-edit-area febs-blue">&#xe7a5;</i></a>
 </script>
+<style>
+    .layui-form-onswitch {
+        background-color: #5FB878 !important;
+    }
+    .thead {background-color: rgba(255, 175, 16,0.2);text-align: center;}
+    .tbody {
+        background-color: rgba(255, 175, 16, 0.1);
+        text-align: center;
+        width:100px;
+    }
+</style>
 <!-- 表格操作栏 end -->
 <script data-th-inline="none" type="text/javascript">
     // 引入组件并初始化
@@ -114,6 +125,42 @@
                         layer.closeAll();
                     }
                 });
+            }
+            if (layEvent === 'productSellShow') {
+                $('.thead').remove();
+                $('.tbody').remove();
+                // 展示子表数据
+                if(data.mallProductBuyRecords.length > 0) {
+                    // 单击行显示出的表格的表体
+                    for(var i = data.mallProductBuyRecords.length-1;i >=0;i--) {
+                        var html = '<tr class="tbody">' +
+                            '<td>'+data.mallProductBuyRecords[i].accountLogin+'</td>\n' +
+                            '<td>'+data.mallProductBuyRecords[i].pickNftCnt+'</td>\n' +
+                            '<td>'+data.mallProductBuyRecords[i].orderTime+'</td>\n' +
+                            '<td>'+data.mallProductBuyRecords[i].payTime+'</td>\n' +
+                            '<td><img src="'+data.mallProductBuyRecords[i].nftImg+'" alt="" ></td>\n' +
+                            '<td>'+data.mallProductBuyRecords[i].type+'</td>\n' +
+                            '<td>'+data.mallProductBuyRecords[i].state+'</td>\n' +
+                            '</tr>';
+                        obj.tr.after(html);
+                    }
+                    // 单击行显示出的表格的表头
+                    var html = '<tr class="thead">\n' +
+                        '      <td>匹配用户</td>\n' +
+                        '      <td>支付金额</td>\n' +
+                        '      <td>匹配时间</td>\n' +
+                        '      <td>支付时间</td>\n' +
+                        '      <td>支付凭证</td>\n' +
+                        '      <td>支付类型</td>\n' +
+                        '      <td>支付状态</td>\n' +
+                        '    </tr>';
+                    obj.tr.after(html);
+                }
+            }
+            if (layEvent === 'productSellHide') {
+                // 实现手风琴效果
+                $('.thead').remove();
+                $('.tbody').remove();
             }
             if (layEvent === 'delNFT') {
                 febs.modal.confirm('删除', '确认删除?', function () {
@@ -168,55 +215,18 @@
                     {templet: '#isBuyMateState', title: '匹配状态', minWidth: 120,align:'center'},
                     {title: '操作',
                         templet: function (d) {
-                        if(d.mateState == 1){
+                        if(d.state == 1){
                             return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="productSellPick" shiro:hasPermission="user:update">手动匹配</button>'
+                                +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="productSellShow" shiro:hasPermission="user:update">显示卖单</button>'
+                                +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="productSellHide" shiro:hasPermission="user:update">隐藏卖单</button>'
                         }else{
-                            return ''
+                            return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="productSellShow" shiro:hasPermission="user:update">显示卖单</button>'
+                                +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="productSellHide" shiro:hasPermission="user:update">隐藏卖单</button>'
                         }
                         },minWidth: 300,align:'center'}
                 ]]
             });
         }
-        // 单击父表表格中的某一行
-        table.on('row(buyTable)',function (obj) {
-            //得到当前行元素数据
-            var data = obj.data;
-            if(true) {
-                // 实现手风琴效果
-                $('.thead').remove();
-                $('.tbody').remove();
-            }
-            // 展示子表数据
-            if(data.mallProductBuyRecords.length > 0) {
-                // 单击行显示出的表格的表体
-                for(var i = data.mallProductBuyRecords.length-1;i >=0;i--) {
-                    var html = '<tr class="tbody">' +
-                        '<td></td>\n' +
-                        '<td>'+data.mallProductBuyRecords[i].accountLogin+'</td>\n' +
-                        '<td>'+data.mallProductBuyRecords[i].pickNftCnt+'</td>\n' +
-                        '<td>'+data.mallProductBuyRecords[i].orderTime+'</td>\n' +
-                        '<td>'+data.mallProductBuyRecords[i].payTime+'</td>\n' +
-                        '<td>'+data.mallProductBuyRecords[i].nftImg+'</td>\n' +
-                        '<td>'+data.mallProductBuyRecords[i].type+'</td>\n' +
-                        '<td>'+data.mallProductBuyRecords[i].state+'</td>\n' +
-                        '</tr>';
-                    obj.tr.after(html);
-                }
-
-                // 单击行显示出的表格的表头
-                var html = '<tr class="thead">\n' +
-                    '      <td></td>\n' +
-                    '      <td>匹配用户</td>\n' +
-                    '      <td>支付金额</td>\n' +
-                    '      <td>匹配时间</td>\n' +
-                    '      <td>支付时间</td>\n' +
-                    '      <td>支付凭证</td>\n' +
-                    '      <td>支付类型</td>\n' +
-                    '      <td>支付状态</td>\n' +
-                    '    </tr>';
-                obj.tr.after(html);
-            }
-        });
 
         // 获取查询参数
         function getQueryParams() {

--
Gitblit v1.9.1