浏览代码

Merge remote-tracking branch 'origin/master'

peiguo 5 年之前
父节点
当前提交
a5e7c84645

+ 4 - 3
whepi-doc/group.sql

@@ -3,16 +3,17 @@
 -- ----------------------------
 drop table if exists jm_buy;
 create table jm_buy (
+    buy_id          bigint(20)      NOT NULL DEFAULT 0          COMMENT '购买流水id',
     jm_id           bigint(20)      NOT NULL DEFAULT 0          COMMENT '团购参团id',
     user_id         bigint(20)      NOT NULL DEFAULT 0          COMMENT '居民id',
     buy_count       int(11)         NOT NULL DEFAULT 0          COMMENT '购买数量',
-    buy_money       Decimal(4,2)    NOT NULL DEFAULT 0.00       COMMENT '购买金额',
+    buy_money       varchar(6)      NOT NULL DEFAULT 0.00       COMMENT '购买金额',
     phone           varchar(20)     NOT NULL DEFAULT ''         COMMENT '联系电话',
     buy_status      int(11)         NOT NULL DEFAULT 0          COMMENT '状态 1 在团 2 发货 3取消 4撤销 5完成',
-    remark          varchar(200)    NOT NULL DEFAULT ''         COMMENT '备注',
+    my_remark       varchar(200)    NOT NULL DEFAULT ''         COMMENT '备注',
     user_create     bigint(20)      NOT NULL DEFAULT 0          COMMENT '新增人',
     time_create     datetime(0)     NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间(订单提交时间)',
-    PRIMARY KEY (jm_id) USING BTREE,
+    PRIMARY KEY (buy_id) USING BTREE,
     INDEX user_id(user_id) USING BTREE
 )
 ENGINE = InnoDB

+ 96 - 34
whepi-ui/templates/home/buy.ftl

@@ -16,50 +16,59 @@
 
             <div id="buy_nav2" style="display: none"><#--我的团购信息-->
                 <div class="weui-form-preview">
-                    <div class="weui-form-preview__label">
-                        <label class="weui-form-preview__label">我的订单&emsp;&emsp;&emsp;&emsp;提交时间&emsp;&emsp;&emsp;&emsp;订单状态</label>
+                    <div style="display: flex; flex-direction: row; color: grey; font-size: medium;">
+                        <div style="width: 33%; text-align: center;color: #0a001f">我的订单</div>
+                        <div style="width: 33%; text-align: center;color: #0a001f">提交时间</div>
+                        <div style="width: 33%; text-align: center;color: #0a001f">订单状态</div>
                     </div>
-                    <div id="MyBuyAll"></div>
+                </div>
+                <div id="MyBuyAll">
                 </div>
             </div>
         </div>
-        <div class="weui-form-preview" style="display: " id="buyListGroup">
-            <div class="weui-form-preview__label">
-                <label class="weui-form-preview__label">标题&emsp;&emsp;&emsp;&emsp;已团&emsp;&emsp;&emsp;&emsp;截止时间&emsp;&emsp;&emsp;&emsp;状态</label>
+        <div class="weui-form-preview"
+             id="buyListGroup">
+            <div style="display: flex; flex-direction: row; color: grey; font-size: medium;">
+                <div style="width: 40%; text-align: center;color: #0a001f">标题</div>
+                <div style="width: 15%; text-align: center;color: #0a001f">已团</div>
+                <div style="width: 30%; text-align: center;color: #0a001f">截止时间</div>
+                <div style="width: 15%; text-align: center;color: #0a001f">状态</div>
             </div>
-            <div id="buyAll"></div>
         </div>
-
-    <#--业委会的套餐-->
-        <div id="details">
-            <div id="myyw">
-
-            </div>
-        <#--团购详情页面的展示-->
-            <div class="weui-btn-area">
-                <br>
-                <div style="text-align: center;size: 20px">
-                    我的团购
-                </div>
-            <#--居民自己填写的-->
-                <div id="client">
-            <#include "/home/buyClient.ftl" />
+        <div id="buyAll" class="weui-panel__bd">
+        <#--   <a href="javascript:void(0);" style="color: grey;font-size: large">
+                <div style="display: flex; flex-direction: row; text-align: center; font-size: x-small; line-height: 5vh;"
+                     onclick=" myBuyClick()">
+                    <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
+                        蔬菜套餐,猪肉牛肉金针菇等
+                    </div>
+                    <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
+                        24/100
+                    </div>
+                    <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
+                        02/02 14:30
+                    </div>
+                    <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
+                        在团
+                    </div>
                 </div>
-            </div>
+            </a>-->
         </div>
     </div>
 
     <script>
         //商品的团购信息的展示
         function buyGroup() {
+            console.log('商品团购')
             $('#buy_nav1')[0].style.display = '';
             $('#buyListGroup')[0].style.display = '';
-            $('#details')[0].style.display = '';
-
+            $('#buy_nav2')[0].style.display = 'none';
+            $('#buyAll')[0].style.display = '';
+            $('#buyAll').empty();//清除节点
             $.ajax({
-                url: '',
+                url: '/home/buy/group',
                 type: 'get',
-                data: {},
+                data: {userId: $('#userId').val()},
                 success: function (data) {
                     if (data.success) {
                         if (data.data.length > 0) {
@@ -70,18 +79,21 @@
                         }
                         else {
                         }
-
                     }
                 },
             });
         }
 
         function buyList(v) {
-        }
-
-        /*我的团购数量的填写*/
-        function myBuy() {
-
+            $('#buyAll').append(' <a href="javascript:void(0);" style="color: grey;font-size: large" data-id="form"\n' +
+                    '                                             onclick=\'myBuyClick(' + JSON.stringify(v) + ')\'>\n' +
+                    '                <div style="display: flex; flex-direction: row; text-align: center; font-size: x-small; line-height: 5vh;">\n' +
+                    '                    <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">' + v.tgTitle + '</div>\n' +
+                    '                    <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">\n' + v.count + '/' + v.tgMinNum + '</div>\n' +
+                    '                    <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">' + timestampToTime(v.tgEndTime) + '</div>\n' +
+                    '                    <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">' + v.tgStatus + '</div>\n' +
+                    '                </div>\n' +
+                    '            </a>');
         }
 
 
@@ -89,8 +101,58 @@
         function buyGroup2() {
             $('#buy_nav1')[0].style.display = 'none';
             $('#buyListGroup')[0].style.display = 'none';
-            $('#details')[0].style.display = 'none';
+            $('#buyAll')[0].style.display = 'none';
             $('#buy_nav2')[0].style.display = '';
+            $('#MyBuyAll').empty();
+            $.ajax({
+                url: '/home/Mygroup/group',
+                type: 'get',
+                data: {userId: $('#userId').val()},
+                success: function (data) {
+                    if (data.success) {
+                        if (data.data.length > 0) {
+                            hasData = true;
+                            data.data.forEach(function (v) {
+                                MybuyList(v);
+                            });
+                        }
+                        else {
+                        }
+
+                    }
+                },
+            });
+
+        }
+
+        function MybuyList(v) {
+            $('#MyBuyAll').append('<a href="javascript:void(0);" style="color: grey;font-size: large" data-id="form" onclick=\'myBuyClick2(' + JSON.stringify(v) + ')\'>\n' +
+                    '                        <div style="display: flex; flex-direction: row; text-align: center; font-size: x-small; line-height: 5vh;">\n' +
+                    '                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">' + v.tgTitle + '</div>\n' +
+                    '                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">' + timestampToTime(v.timeCreate) + '</div>\n' +
+                    '                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">' + v.tgStatus + '</div>\n' +
+                    '                        </div>\n' +
+                    '                    </a>')
+        }
+
+        function myBuyClick2(v) {
+            window.location.href = "/home/buytc.html?userId=" + $('#userId').val()+ "&jmId=" + v.jmId+"&type="+2;
+        }
+
+
+        /*居民求助信息*/
+        function myBuyClick(v) {
+            window.location.href = "/home/buytc.html?userId=" + $('#userId').val() + "&jmId=" + v.jmId+"&type="+1;
+        }
+
 
+        function tugouStatus(status) {
+            if (status == 1) {
+                return "<span style='color:Black;'>在团</span>";
+            } else if (status == 2) {
+                return "<span style='color:Black;'>处理中</span>";
+            } else {
+                return "<span style='color:green;'>已完成</span>";
+            }
         }
     </script>

+ 120 - 41
whepi-ui/templates/home/buyClient.ftl

@@ -1,26 +1,26 @@
 <div class="weui-btn-area">
-    <div>
+    <div style="display:flex; flex-direction: row; justify-content: space-between">
         <div class="weui-flex__item">
-            <div class="placeholder" style="display: inline;float: left">当前参团:</div>
-            <div style="display: inline;">107</div>
+            <div class="placeholder" style="display: inline;align-items: flex-start">当前参团:</div>
+            <div style="display: inline;align-items: flex-start">107</div>
         </div>
-        <div class="weui-flex__item">
-            <div style="display: inline;" class="placeholder">状态:</div>
-            <div style="display: inline;">在团</div>
+        <div class="weui-flex__item" style="display:flex; flex-direction: row; justify-content: space-between">
+            <div style="display: inline;align-items: flex-end">状态:</div>
+            <div style="align-items: flex-end">在团</div>
         </div>
     </div>
-    <div class="weui-flex">
+    <div class="weui-flex" style="display:flex; flex-direction: row; justify-content: space-between">
         <div class="weui-flex__item">
-            <div style="display: inline;text-align: center;">我的团购:</div>
+            <div style="display: inline;align-items: flex-start">我的团购:</div>
             <div style="display: inline;">
                 <input type="text" id="buyCount"
                        style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh; width: 20%;"
                        maxlength="3" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');">
             </div>
         </div>
-        <div class="weui-flex__item">
-            <div style="display: inline;">金额¥:</div>
-            <div style="display: inline;" id="myMenory">107</div>
+        <div class="weui-flex__item" style="display:flex; flex-direction: row; justify-content: space-between">
+            <div style="display: inline;align-items: flex-end">金额¥:</div>
+            <div style="display: inline;align-items: flex-end" id="myMenory">金额钱啊</div>
         </div>
     </div>
     <div class="weui-flex">
@@ -39,48 +39,37 @@
                   style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; margin-top: 1vh;"></textarea>
     </div>
     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh; margin-bottom: 5vh;">
-        <a id="buyBack" onclick="buyBack()" href="javascript:;" class="weui-btn weui-btn_default"
-           style="width: 30%;">返回</a>
-        <a id="buyRepeal" onclick="buyBack()" href="javascript:;" class="weui-btn weui-btn_default"
-           style="width: 30%;display: none">撤销</a>
+    <#if type==1>
+      <a id="buyBack" onclick="buyBack()" href="javascript:;" class="weui-btn weui-btn_default"
+         style="width: 30%;">返回</a>
+    <#else>
+      <a id="MybuyRepeal" onclick="MybuyBack()" href="javascript:;" class="weui-btn weui-btn_default"
+         style="width: 30%;">撤销</a>
+    </#if>
         <a id="buyCommit" onclick="buyCommit()" href="javascript:;" class="weui-btn weui-btn_primary"
            style="margin-top: 0;width: 30%;">提交</a>
     </div>
 
 </div>
-
-
-
+<#include "/home/frag.foot.ftl" />
 <script>
 
     <#--返回-->
     function buyBack() {
-        $('#details')[0].style.display = 'none';
+        window.location.href = "/user/homeIndex.html?userId=" + $('#buyuserId').val() + "&userType=" + 1 + '#tab3';
     }
 
-    //提交
-    function buyCommit() {
-        if ($('#buyCount').val() == '' || $('#buyCount').val() == undefined) {
-            $.alert("请填写团购数量");
-            return;
-        }
-        if ($('#myPhone').val() == undefined || $('#myPhone').val() == '') {
-            $.alert("请填写联系电话");
-            return;
-        }
-        if ($('#Myremarks').val() == undefined || $('#Myremarks').val() == '') {
-            $.alert("请填写备注");
-            return;
-        }
-        /*   $.ajax({
+    /*撤销*/
+    /*   function MybuyBack() {
+           $.ajax({
                url: '/home/home/buyGroup',
                data: {
-                   userId: $('#userId').val(),
+                   userId: $('#buyuserId').val(),
                    buyCount: $('#buyCount').val(),
                    phone: $('#myPhone').val(),
                    remark: $('#Myremarks').val(),
                    buyMoney: $('#myMenory').text(),
-
+                   jmId: $('#jmBuy').val(),
                },
                type: 'GET',
                success: function (data) {
@@ -89,12 +78,102 @@
                },
                error: function () {
                }
-           });*/
+           });
+
+       }*/
+
+    //提交
+    function buyCommit() {
+        if ($('#buyCount').val() == '' || $('#buyCount').val() == undefined) {
+            $.alert("请填写团购数量");
+            return;
+        }
+        if ($('#myPhone').val() == undefined || $('#myPhone').val() == '') {
+            $.alert("请填写联系电话");
+            return;
+        }
+        if ($('#Myremarks').val() == undefined || $('#Myremarks').val() == '') {
+            $.alert("请填写备注");
+            return;
+        }
+        $.ajax({
+            url: '/home/home/buyGroup',
+            data: {
+                userId: $('#buyuserId').val(),
+                buyCount: $('#buyCount').val(),
+                phone: $('#myPhone').val(),
+                remark: $('#Myremarks').val(),
+                buyMoney: $('#myMenory').text(),
+                jmId: $('#jmBuy').val(),
+            },
+            type: 'GET',
+            success: function (data) {
+                console.log(data);
+                buyBack();
+            },
+            error: function () {
+            }
+        });
     }
 
-    /* //输入数量自动结算金额
-     function menory() {
-      $('#myMenory').val($('#buyCount').val()*6)
-     }*/
+    (function ($) {
+   /*     $.ajax({
+            url: '/home/querysj/buytj',
+            data: {
+                userId: $('#buyuserId').val(),
+                jmId: $('#jmBuy').val(),
+            },
+            type: 'GET',
+            success: function (data) {
+              var v=data.data;
+                $('#details').append('<div id="myyw">\n' +
+                        '            <div class="weui-loadmore weui-loadmore_line" style="text-align: center;size: 20px">\n' +
+                        '            <span class="weui-loadmore__tips">团购信息</span>\n' +
+                        '            <div class="weui-media-box__bd">\n' +
+                        '                <h3>青菜套餐</h3>\n' +
+                        '            </div>\n' +
+                        '        </div>\n' +
+                        '        <div>\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">供应商:&nbsp;&nbsp;</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">套&nbsp;&nbsp;&nbsp;&nbsp;餐:&nbsp;&nbsp;没有套餐</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">单&nbsp;&nbsp;&nbsp;&nbsp;价:&nbsp;&nbsp;10</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">最新起定量(份):&nbsp;&nbsp;20</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">截止时间:&nbsp;&nbsp;2020-02-11</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">预计送货时间:&nbsp;&nbsp;2020-02-10</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">服务电话:&nbsp;&nbsp;12345678912</div>\n' +
+                        '        </div>\n' +
+                        '    </div>')
+            },
+            error: function () {
+            }
+        });*/
+     <#if type==2>
+     $.ajax({
+         url: '/home/queryGroup/buyGroup',
+         data: {
+             userId: $('#buyuserId').val(),
+             jmId: $('#jmBuy').val(),
+         },
+         type: 'GET',
+         success: function (data) {
+             $('#buyCount').val(data.data.buyCount);
+             $('#myPhone').val(data.data.phone);
+             $('#Myremarks').val(data.data.myRemark);
+             $('#myMenory').text(data.data.buyMoney);
+
+         },
+         error: function () {
+         }
+     });
+     </#if>
+
+    })(jQuery);
+
 
 </script>

+ 110 - 0
whepi-ui/templates/home/buytc.ftl

@@ -0,0 +1,110 @@
+<#assign title="居民团购详情"/>
+<#include "/home/frag.head.ftl" />
+
+<div class="weui-tab__panel">
+    <input id="buyuserId" type="text" hidden="hidden" value=${userId}>
+    <input id="jmBuy" type="text" hidden="hidden" value=${jmId}>
+<#-- <div style="text-align: center ">
+     团购信息
+ </div>-->
+
+<#--业委会的套餐-->
+    <div id="details">
+        <div id="myyw">
+            <div class="weui-loadmore weui-loadmore_line" style="text-align: center;size: 20px">
+                <span class="weui-loadmore__tips">团购信息</span>
+                <div class="weui-media-box__bd">
+                    <h3>青菜套餐</h3>
+                </div>
+            </div>
+            <div>
+                <div style="text-indent: -0em;margin-left: 2em;">供应商:&nbsp;&nbsp;</div>
+
+                <div style="text-indent: -0em;margin-left: 2em;">套&nbsp;&nbsp;&nbsp;&nbsp;餐:&nbsp;&nbsp;没有套餐</div>
+
+                <div style="text-indent: -0em;margin-left: 2em;">单&nbsp;&nbsp;&nbsp;&nbsp;价:&nbsp;&nbsp;10</div>
+
+                <div style="text-indent: -0em;margin-left: 2em;">最新起定量(份):&nbsp;&nbsp;20</div>
+
+                <div style="text-indent: -0em;margin-left: 2em;">截止时间:&nbsp;&nbsp;2020-02-11</div>
+
+                <div style="text-indent: -0em;margin-left: 2em;">预计送货时间:&nbsp;&nbsp;2020-02-10</div>
+
+                <div style="text-indent: -0em;margin-left: 2em;">服务电话:&nbsp;&nbsp;12345678912</div>
+            </div>
+        </div>
+    <#--团购详情页面的展示-->
+        <div class="weui-btn-area">
+            <div style="text-align: center;size: 20px" class="weui-loadmore weui-loadmore_line">
+                <span class="weui-loadmore__tips">我的团购</span>
+            </div>
+        <#--居民自己填写的-->
+            <div id="client">
+            <#include "/home/buyClient.ftl"/>
+            </div>
+        </div>
+    </div>
+</div>
+<#include "/home/frag.foot.ftl"/>
+
+<script>
+    (function ($) {
+        $.ajax({
+            url: '/home/querysj/buytj',
+            data: {
+                userId: $('#buyuserId').val(),
+                jmId: $('#jmBuy').val(),
+            },
+            type: 'GET',
+            success: function (data) {
+                /* var v = data.data;
+                 $('#details').append('<div id="myyw">\n' +
+                         '            <div class="weui-loadmore weui-loadmore_line" style="text-align: center;size: 20px">\n' +
+                         '            <span class="weui-loadmore__tips">团购信息</span>\n' +
+                         '            <div class="weui-media-box__bd">\n' +
+                         '                <h3>青菜套餐</h3>\n' +
+                         '            </div>\n' +
+                         '        </div>\n' +
+                         '        <div>\n' +
+                         '            <div style="text-indent: -0em;margin-left: 2em;">供应商:&nbsp;&nbsp;</div>\n' +
+                         '\n' +
+                         '            <div style="text-indent: -0em;margin-left: 2em;">套&nbsp;&nbsp;&nbsp;&nbsp;餐:&nbsp;&nbsp;没有套餐</div>\n' +
+                         '\n' +
+                         '            <div style="text-indent: -0em;margin-left: 2em;">单&nbsp;&nbsp;&nbsp;&nbsp;价:&nbsp;&nbsp;10</div>\n' +
+                         '\n' +
+                         '            <div style="text-indent: -0em;margin-left: 2em;">最新起定量(份):&nbsp;&nbsp;20</div>\n' +
+                         '\n' +
+                         '            <div style="text-indent: -0em;margin-left: 2em;">截止时间:&nbsp;&nbsp;2020-02-11</div>\n' +
+                         '\n' +
+                         '            <div style="text-indent: -0em;margin-left: 2em;">预计送货时间:&nbsp;&nbsp;2020-02-10</div>\n' +
+                         '\n' +
+                         '            <div style="text-indent: -0em;margin-left: 2em;">服务电话:&nbsp;&nbsp;12345678912</div>\n' +
+                         '        </div>\n' +
+                         '    </div>')*/
+            },
+            error: function () {
+            }
+        });
+     <#if type==2>
+     $.ajax({
+         url: '/home/queryGroup/buyGroup',
+         data: {
+             userId: $('#buyuserId').val(),
+             jmId: $('#jmBuy').val(),
+         },
+         type: 'GET',
+         success: function (data) {
+             $('#buyCount').val(data.data.buyCount);
+             $('#myPhone').val(data.data.phone);
+             $('#Myremarks').val(data.data.myRemark);
+             $('#myMenory').text(data.data.buyMoney);
+
+         },
+         error: function () {
+         }
+     });
+     </#if>
+
+    })(jQuery);
+
+</script>

+ 6 - 6
whepi-ui/templates/home/home.ftl

@@ -8,8 +8,8 @@
             <#include "/home/ribao.ftl" /></div>
         <div id="tab2" class="weui-tab__bd-item">
             <#include "/home/qiuzhu.ftl" /></div>
-        <#--<div id="tab3" class="weui-tab__bd-item">-->
-           <#--<#include "/home/buy.ftl" /></div>-->
+        <div id="tab3" class="weui-tab__bd-item">
+           <#include "/home/buy.ftl" /></div>
     <#--<div id="tab4" class="weui-tab__bd-item">-->
     <#--<h1>页面四</h1> </div>-->
     </div>
@@ -22,10 +22,10 @@
             <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
             <p class="weui-tabbar__label" onclick="familyClick()">家庭求助</p>
         </a>
-        <#--<a href="#tab3" class="weui-tabbar__item">-->
-            <#--<div class="weui-tabbar__icon"><img src="/static/images/wx/upload.png" alt=""></div>-->
-            <#--<p class="weui-tabbar__label" onclick="buyGroup()">商品团购</p>-->
-        <#--</a>-->
+        <#--<a href="#tab3" class="weui-tabbar__item">
+            <div class="weui-tabbar__icon"><img src="/static/images/wx/upload.png" alt=""></div>
+            <p class="weui-tabbar__label" onclick="buyGroup()">商品团购</p>
+        </a>-->
     <#--<a href="#tab4" class="weui-tabbar__item">-->
     <#--<div class="weui-tabbar__icon"> <img src="./images/icon_nav_cell.png" alt=""> </div>-->
     <#--<p class="weui-tabbar__label">我</p>-->

+ 1 - 1
whepi-ui/templates/home/qiuzhu.js

@@ -6,7 +6,7 @@ function shValue(v) {
   $('#qzHS').append($('<a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">\n' +
     '                <div class="weui-media-box__bd">\n' +
     '                    <div style="display: flex; flex-direction: row; justify-content: space-between;">\n' +
-    '                        <p class="weui-media-box__desc">'+v.nickName+'</p>\n' +
+    '                        <p class="weui-media-box__desc">' + v.nickName + '</p>\n' +
     '                        <p class="weui-media-box__desc">' + timestampToTime(v.timeUpdate) + '</p>\n' +
     '                    </div>\n' +
     '                    <div class="weui-cell ">\n' +

+ 12 - 0
whepi-web/src/main/java/com/bofeng/dao/BuyMapper.java

@@ -2,10 +2,22 @@ package com.bofeng.dao;
 
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.bofeng.entity.Buy;
+import com.bofeng.entity.JmTuangou;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Mapper
 @Repository
 public interface BuyMapper extends BaseMapper<Buy> {
+
+  List<JmTuangou> group(@Param("userId") Long userId);
+
+  List<Buy> MyGroup(@Param("userId") Long userId);
+
+  Buy queryGroup(@Param("userId") Long userId,@Param("jmId")Long jmId);
+
+  JmTuangou selectGroup(@Param("userId") Long userId,@Param("jmId")Long jmId);
 }

+ 11 - 2
whepi-web/src/main/java/com/bofeng/entity/Buy.java

@@ -14,12 +14,15 @@ import java.math.BigDecimal;
 @TableName("jm_buy")
 public class Buy {
 
-  @TableId("jm_id")
+  @TableId("buy_id")
+  private Long buyId;
+
+  @TableField("jm_id")
   private Long jmId;
 
   @TableField("user_id")
   private Long userId;
-  
+
   @TableField("buy_count")
   private Integer buyCount;
 
@@ -41,4 +44,10 @@ public class Buy {
   @TableField("time_create")
   private DateTime timeCreate;
 
+  @TableField(exist = false)
+  private String tgTitle;
+
+  @TableField(exist = false)
+  private Integer tgStatus;
+
 }

+ 2 - 0
whepi-web/src/main/java/com/bofeng/entity/JmTuangou.java

@@ -76,5 +76,7 @@ public class JmTuangou implements Serializable {
      */
     private Integer tgStatus;
 
+    private Integer count;
+
     private static final long serialVersionUID = 1L;
 }

+ 31 - 2
whepi-web/src/main/java/com/bofeng/service/BuyService.java

@@ -3,21 +3,50 @@ package com.bofeng.service;
 import com.baomidou.mybatisplus.toolkit.IdWorker;
 import com.bofeng.dao.BuyMapper;
 import com.bofeng.entity.Buy;
+import com.bofeng.entity.JmTuangou;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
 
 @Service
+@Transactional(readOnly = true)
 public class BuyService {
 
   @Autowired
   private BuyMapper buyMapper;
 
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
   public int buyGroup(Buy buy) {
-    buy.setJmId(IdWorker.getId());
+
+    buy.setBuyId(IdWorker.getId());
     buy.setUserCreate(buy.getUserId());
     buy.setTimeCreate(new DateTime());
+    //在添加的时候 进行检测该团购是否在规定时间里 已经达到了最小起订量的要求
+/*    if () {
+
+    }*/
+    buy.setBuyStatus(1);//在团
+    return buyMapper.insert(buy);
+  }
+
+  public List<JmTuangou> group(Long userId) {
+    return buyMapper.group(userId);
+  }
+
+  public List<Buy> MyGroup(Long userId) {
+    return buyMapper.MyGroup(userId);
+  }
+
+  public Buy queryGroup(Long userId, Long jmId) {
+    return buyMapper.queryGroup(userId, jmId);
+  }
+
 
-    return 1;
+  public JmTuangou selectGroup(Long userId,Long jmId){
+    return buyMapper.selectGroup(userId,jmId);
   }
 }

+ 48 - 0
whepi-web/src/main/java/com/bofeng/wx/controller/BuyController.java

@@ -1,11 +1,18 @@
 package com.bofeng.wx.controller;
 
 import com.bofeng.entity.Buy;
+import com.bofeng.entity.JmTuangou;
 import com.bofeng.service.BuyService;
+import com.yvan.Model;
 import com.yvan.ModelOps;
+import com.yvan.mvc.Pd;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.util.List;
 
 @RestController
 public class BuyController {
@@ -13,8 +20,49 @@ public class BuyController {
   @Autowired
   private BuyService buyService;
 
+
   @GetMapping("/home/home/buyGroup")
   public ModelOps buyGroup(Buy buy) {
     return ModelOps.newSuccess(buyService.buyGroup(buy));
   }
+
+  @GetMapping("/home/buytc.html")
+  public ModelAndView buytc(@Pd(name = "userId") Long userId, @Pd(name = "jmId") Long jmId,
+                            @Pd(name = "type") Integer type, ModelMap model) {
+    model.put("userId", userId);
+    model.put("jmId", jmId);
+    model.put("type", type);
+    return new ModelAndView("/home/buytc.ftl", model);
+  }
+
+  @GetMapping("/home/buy/group")
+  public Model<List<JmTuangou>> group(@Pd(name = "userId") Long userId) {
+    return Model.newSuccess(buyService.group(userId));
+  }
+
+  @GetMapping("/home/Mygroup/group")
+  public Model<List<Buy>> MyGroup(@Pd(name = "userId") Long userId) {
+    return Model.newSuccess(buyService.MyGroup(userId));
+  }
+
+
+  @GetMapping("/home/queryGroup/buyGroup")
+  public Model<Buy> queryGroup(@Pd(name = "userId") Long userId, @Pd(name = "jmId") Long jmId) {
+    return Model.newSuccess(buyService.queryGroup(userId, jmId));
+  }
+
+  @GetMapping("/home/querysj/buytj")
+  public ModelAndView buytj(@Pd(name = "userId") Long userId, @Pd(name = "jmId") Long jmId,ModelMap model){
+    JmTuangou jmTuangou = buyService.selectGroup(userId, jmId);
+    model.put("userId", userId);
+    model.put("jmId", jmId);
+    model.put("tgSupplier", jmTuangou.getTgSupplier());
+    model.put("tgGoods", jmTuangou.getTgGoods());
+    model.put("tgPrice", jmTuangou.getTgPrice());
+    model.put("tgMinNum", jmTuangou.getTgMinNum());
+    model.put("tgEndTime", jmTuangou.getTgEndTime());
+    model.put("tgDeliverTime", jmTuangou.getTgDeliverTime());
+    model.put("tgPhoneNumber", jmTuangou.getTgPhoneNumber());
+    return new ModelAndView("/home/buytc.ftl", model);
+  }
 }

+ 4 - 4
whepi-web/src/main/java/com/bofeng/wx/controller/UserOpenController.java

@@ -64,10 +64,10 @@ public class UserOpenController {
                              @RequestParam(value = "userType", required = false,defaultValue = "0") Integer userType) throws JsonProcessingException {
         List<UserRole> list = new ArrayList<>();
         if (userId == 0) {
-            UserOpen userOpen = homeService.getUserOpen();
-            list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
-//            list = userRoleMapper.getUserRoleByUserId(1225321682867105793L);
-//            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
+           /* UserOpen userOpen = homeService.getUserOpen();
+            list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());*/
+            list = userRoleMapper.getUserRoleByUserId(1225321682867105793L);
+            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
             userId = userOpen.getUserId();
             model.put("user", userOpen);
             model.put("user_id", "\""+userOpen.getUserId()+"\"");

+ 28 - 0
whepi-web/src/main/resources/mapper/BuyMapper.xml

@@ -2,4 +2,32 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.bofeng.dao.BuyMapper">
 
+    <select id="group" resultType="com.bofeng.entity.JmTuangou">
+       select *,
+       (select SUM(jb.buy_count) FROM jm_buy jb where jb.jm_id=jt.jm_id) as count
+       FROM jm_tuangou jt
+       where jt.uptown_id =(select c.uptown_id
+       from sys_user_role a
+       INNER JOIN sys_uptown_house b on a.property_id=b.house_id
+       INNER JOIN sys_uptown_unit c on b.unit_id=c.unit_id
+       where a.user_id=#{userId} and a.role_id=1)
+    </select>
+
+    <select id="MyGroup" resultType="com.bofeng.entity.Buy">
+        select DISTINCT a.tg_title,b.time_create,a.tg_status,a.jm_id
+        from  jm_tuangou a
+        INNER JOIN jm_buy b on a.jm_id=b.jm_id
+        where a.user_id=#{userId}
+    </select>
+
+
+    <select id="queryGroup" resultType="com.bofeng.entity.Buy">
+        select * from jm_buy where user_id=#{userId} and jm_id=#{jmId} limit 1
+    </select>
+
+    <select id="selectGroup" resultType="com.bofeng.entity.JmTuangou">
+        select * from jm_tuangou where jm_id=#{jmId} limit 1
+    </select>
+
+
 </mapper>