소스 검색

Merge remote-tracking branch 'origin/master'

yuliang 5 년 전
부모
커밋
872cd042ec

+ 1 - 1
whepi-doc/group.sql

@@ -9,7 +9,7 @@ create table jm_buy (
     buy_count       int(11)         NOT NULL DEFAULT 0          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完成',
+    buy_status      int(11)         NOT NULL DEFAULT 1          COMMENT '状态 1 在团 2 撤单',
     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 '新增时间(订单提交时间)',

+ 73 - 14
whepi-ui/templates/groupBuying/groupBuyingCx.ftl

@@ -3,38 +3,97 @@
 
 <div class="page__bd">
     <div class="weui-tab">
-        <header class="demos-header">
-            <h1 class="demos-title">团购</h1>
-        </header>
+<#--        <header class="demos-header">-->
+<#--            <h1 class="demos-title">团购</h1>-->
+<#--        </header>-->
+        <div class="weui-btn-area" style="display: flex; flex-direction: row;">
+            <a class="weui-btn weui-btn_primary" href="javascript:goback();" style="width: 25vw; height: 6vh; line-height: 6vh;">返回</a>
+            <div style="width: 65%;"></div>
+        </div>
         <div class="weui-loadmore weui-loadmore_line" style="width: 100%">
             <span class="weui-loadmore__tips">团购信息</span>
             <div class="weui-media-box__bd">
-                <h3>萝卜青椒大白菜</h3>
+                <h3>${ tgItem.tgTitle }</h3>
             </div>
         </div>
         <div>
-            <p style="text-indent: -0em;margin-left: 2em;">供应商:&nbsp;&nbsp;接口的法国红酒返回打撒借款方和德生科技发送到返回的是否合适看警方海口市</p>
+            <p style="text-indent: -0em;margin-left: 2em;">供应商:&nbsp;&nbsp;${ tgItem.tgSupplier }</p>
             &nbsp;
-            <p style="text-indent: -0em;margin-left: 2em;">套&nbsp;&nbsp;&nbsp;&nbsp;餐:&nbsp;&nbsp;没有套餐</p>
+            <p style="text-indent: -0em;margin-left: 2em;">套&nbsp;&nbsp;&nbsp;&nbsp;餐:&nbsp;&nbsp;${ tgItem.tgGoods }</p>
             &nbsp;
-            <p style="text-indent: -0em;margin-left: 2em;">单&nbsp;&nbsp;&nbsp;&nbsp;价:&nbsp;&nbsp;10</p>
+            <p style="text-indent: -0em;margin-left: 2em;">单&nbsp;&nbsp;&nbsp;&nbsp;价:&nbsp;&nbsp;${ tgItem.tgPrice }</p>
             &nbsp;
-            <p style="text-indent: -0em;margin-left: 2em;">最新起定量(份):&nbsp;&nbsp;20</p>
+            <p style="text-indent: -0em;margin-left: 2em;">最新起定量(份):&nbsp;&nbsp;${ tgItem.tgMinNum }</p>
             &nbsp;
-            <p style="text-indent: -0em;margin-left: 2em;">截止时间:&nbsp;&nbsp;2020-02-11</p>
+            <p id="cx_p_endTime" style="text-indent: -0em;margin-left: 2em;">截止时间:&nbsp;&nbsp;</p>
             &nbsp;
-            <p style="text-indent: -0em;margin-left: 2em;">预计送货时间:&nbsp;&nbsp;2020-02-10</p>
+            <p id="cx_p_deliverTime"style="text-indent: -0em;margin-left: 2em;">预计送货时间:&nbsp;&nbsp;</p>
             &nbsp;
-            <p style="text-indent: -0em;margin-left: 2em;">服务电话:&nbsp;&nbsp;12345678912</p>
+            <p style="text-indent: -0em;margin-left: 2em;">服务电话:&nbsp;&nbsp;${ tgItem.tgPhoneNumber }</p>
         </div>
         <div class="weui-loadmore weui-loadmore_line" style="width: 100%">
             <br/>
-            <textarea class="weui-input" autofocus="" type="text" placeholder="填写撤销原因或增补修订的内容" maxlength="200" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 20vh; width: 85%;"></textarea>
+            <textarea id="cx_remark" class="weui-input" autofocus="" type="text" placeholder="填写撤销原因或增补修订的内容" maxlength="200" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 20vh; width: 85%;"></textarea>
         </div>
         <div class="weui-btn-area"  style="display: grid;">
-            <p id="" class="weui-btn weui-btn_primary">确&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;定</p>
+            <a id="cx_sure" class="weui-btn weui-btn_primary">确&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;定</a>
         </div>
 
 
     </div>
-<#include "/home/frag.foot.ftl" />
+</div>
+<#include "/home/frag.foot.ftl" />
+<script>
+    var userId = ${userId};
+    var tgItem = ${tgItemJson};
+
+    var operation = ${operation};
+
+
+    $('#cx_p_endTime').append(tgItem.tgEndTime);
+    $('#cx_p_deliverTime').append(tgItem.tgDeliverTime);
+
+    if (tgItem.remark.length > 0) {
+        $('#cx_remark').val(tgItem.remark);
+    }
+
+    $('#cx_sure').on('click', function () {
+        console.log("确定");
+        let inputValue = $('#cx_remark').val();
+        if (inputValue.length <= 0){
+            $.alert('请输入内容');
+            return;
+        }
+
+        let sendData = {
+            jmId: tgItem.jmId,
+            remark: inputValue
+        };
+
+        if (operation === 'cancel') {
+            sendData.status = 4;
+        }
+
+        $.ajax({
+            url: '/yeweihui/groupBuyingCx/remark/add.json',
+            type: 'post',
+            data: sendData,
+            success: function (data) {
+                if (data.success) {
+                    $.alert("操作成功");
+                    window.location.href = "/yeweihui/groupBuyingXx.html?jmId=" + tgItem.jmId + "&userId=" + userId;
+                }
+                else  {
+                    $.alert("操作失败");
+                }
+            },
+            error: function () {
+                $.alert("网络异常");
+            }
+        });
+    });
+
+    function goback() {
+        window.location.href = "/yeweihui/groupBuyingXx.html?jmId=" + tgItem.jmId + "&userId=" + userId;
+    }
+</script>

+ 118 - 40
whepi-ui/templates/groupBuying/groupBuyingXx.ftl

@@ -2,53 +2,131 @@
 <#include "/home/frag.head.ftl" />
 
 <div class="page__bd">
-<div class="weui-tab">
-    <header class="demos-header">
-        <h1 class="demos-title">团购</h1>
-    </header>
-    <div class="weui-loadmore weui-loadmore_line" style="width: 100%">
-        <span class="weui-loadmore__tips">团购信息</span>
-        <div class="weui-media-box__bd">
-            <h3>萝卜青椒大白菜</h3>
+    <div class="weui-tab">
+<#--        <header class="demos-header">-->
+<#--            <h1 class="demos-title">团购</h1>-->
+<#--        </header>-->
+        <div class="weui-btn-area" style="display: flex; flex-direction: row;">
+            <a class="weui-btn weui-btn_primary" href="javascript:goback();" style="width: 25vw; height: 6vh; line-height: 6vh;">返回</a>
+            <div style="width: 65%;"></div>
         </div>
-    </div>
-    <div>
-
-    <p style="text-indent: -0em;margin-left: 2em;">供应商:&nbsp;&nbsp;接口的法国红酒返回打撒借款方和德生科技发送到返回的是否合适看警方海口市</p>
-    &nbsp;
-    <p style="text-indent: -0em;margin-left: 2em;">套&nbsp;&nbsp;&nbsp;&nbsp;餐:&nbsp;&nbsp;没有套餐</p>
-    &nbsp;
-    <p style="text-indent: -0em;margin-left: 2em;">单&nbsp;&nbsp;&nbsp;&nbsp;价:&nbsp;&nbsp;10</p>
-    &nbsp;
-    <p style="text-indent: -0em;margin-left: 2em;">最新起定量(份):&nbsp;&nbsp;20</p>
-    &nbsp;
-    <p style="text-indent: -0em;margin-left: 2em;">截止时间:&nbsp;&nbsp;2020-02-11</p>
-    &nbsp;
-    <p style="text-indent: -0em;margin-left: 2em;">预计送货时间:&nbsp;&nbsp;2020-02-10</p>
-    &nbsp;
-    <p style="text-indent: -0em;margin-left: 2em;">服务电话:&nbsp;&nbsp;12345678912</p>
-    </div>
-    <div class="weui-loadmore weui-loadmore_line" style="width: 100%">
-        <span class="weui-loadmore__tips">参团情况</span>
-        <div class="weui-cells__title">当前参团43/100</div>
-    </div>
 
-    <div class="weui-btn-area">
-        <p id="zb" class="weui-btn weui-btn_primary">增补修订</p>
-        <p id="qc" class="weui-btn weui-btn_primary">取消团购</p>
-        <p id="wc" class="weui-btn weui-btn_primary">完成团购</p>
-        <p id="ck" class="weui-btn weui-btn_primary">查看参团信息</p>
-    </div>
+        <div class="weui-loadmore weui-loadmore_line" style="width: 100%">
+            <span class="weui-loadmore__tips">团购信息</span>
+            <div class="weui-media-box__bd">
+                <h3>${ tgItem.tgTitle }</h3>
+            </div>
+        </div>
+        <div>
 
+        <p style="text-indent: -0em;margin-left: 2em;">供应商:&nbsp;&nbsp;${ tgItem.tgSupplier }</p>
+        &nbsp;
+        <p style="text-indent: -0em;margin-left: 2em;">套&nbsp;&nbsp;&nbsp;&nbsp;餐:&nbsp;&nbsp;${ tgItem.tgGoods }</p>
+        &nbsp;
+        <p style="text-indent: -0em;margin-left: 2em;">单&nbsp;&nbsp;&nbsp;&nbsp;价:&nbsp;&nbsp;${ tgItem.tgPrice }</p>
+        &nbsp;
+        <p style="text-indent: -0em;margin-left: 2em;">最新起定量(份):&nbsp;&nbsp;${ tgItem.tgMinNum }</p>
+        &nbsp;
+        <p id="p_endTime" style="text-indent: -0em;margin-left: 2em;">截止时间:&nbsp;&nbsp;</p>
+        &nbsp;
+        <p id="p_deliverTime" style="text-indent: -0em;margin-left: 2em;">预计送货时间:&nbsp;&nbsp;</p>
+        &nbsp;
+        <p style="text-indent: -0em;margin-left: 2em;">服务电话:&nbsp;&nbsp;${ tgItem.tgPhoneNumber }</p>
+        </div>
+        <div class="weui-loadmore weui-loadmore_line" style="width: 100%">
+            <span class="weui-loadmore__tips">参团情况</span>
+            <div class="weui-cells__title">当前参团${ tgItem.currentNum }/${ tgItem.tgMinNum }</div>
+        </div>
+        <#if isMine=='mine' && tgItem.tgStatus==1>
+            <div class="weui-btn-area">
+                <p id="gb_zb" class="weui-btn weui-btn_primary">增补修订</p>
+                <p id="gb_qx" class="weui-btn weui-btn_primary">取消团购</p>
+                <p id="gb_wc" class="weui-btn weui-btn_primary">完成团购</p>
+                <p id="gb_ck" class="weui-btn weui-btn_primary">查看参团信息</p>
+            </div>
+        </#if>
+        <#if isMine!='mine' && tgItem.tgStatus==1>
+            <div class="weui-btn-area">
+                <div class="weui-loadmore weui-loadmore_line" style="width: 100%">
+                    <span class="weui-loadmore__tips">参团状态</span>
+                    <div class="weui-cells__title">在团</div>
+                </div>
+            </div>
+        </#if>
+        <#if tgItem.tgStatus==2>
+            <div class="weui-btn-area">
+                <div class="weui-loadmore weui-loadmore_line" style="width: 100%">
+                    <span class="weui-loadmore__tips">参团状态</span>
+                    <div class="weui-cells__title">发货</div>
+                </div>
+            </div>
+        </#if>
+        <#if tgItem.tgStatus==3>
+            <div class="weui-btn-area">
+                <div class="weui-loadmore weui-loadmore_line" style="width: 100%">
+                    <span class="weui-loadmore__tips">参团状态</span>
+                    <div class="weui-cells__title">完成</div>
+                </div>
+            </div>
+        </#if>
+        <#if tgItem.tgStatus==4>
+            <div class="weui-btn-area">
+                <div class="weui-loadmore weui-loadmore_line" style="width: 100%">
+                    <span class="weui-loadmore__tips">参团状态</span>
+                    <div class="weui-cells__title">取消</div>
+                </div>
+            </div>
+        </#if>
+    </div>
 </div>
+
 <#include "/home/frag.foot.ftl" />
 
-    <script>
-        $('#zb').on('click', function () {
-            window.location.href = "/groupBuying/groupBuyingCx.html"
-        });
+<script>
+
+    var userId = ${userId};
+    var tgItem = ${tgItemJson};
 
+    $('#p_endTime').append(tgItem.tgEndTime);
+    $('#p_deliverTime').append(tgItem.tgDeliverTime);
 
+    $('#gb_zb').on('click', function () {
+        window.location.href = "/yeweihui/groupBuyingCx.html?operation=remark&jmId=" + tgItem.jmId + "&userId=" + userId;
+    });
+
+    $('#gb_qx').on('click', function () {
+        window.location.href = "/yeweihui/groupBuyingCx.html?operation=cancel&jmId=" + tgItem.jmId + "&userId=" + userId;
+    });
+
+    $('#gb_wc').on('click', function () {
+        let sendData = {
+            jmId: tgItem.jmId,
+            status: 3
+        };
+        $.ajax({
+            url: '/yeweihui/groupBuyingCx/remark/add.json',
+            type: 'post',
+            data: sendData,
+            success: function (data) {
+                if (data.success) {
+                    $.alert("操作成功");
+                    goback();
+                }
+                else  {
+                    $.alert("操作失败");
+                }
+            },
+            error: function () {
+                $.alert("网络异常");
+            }
+        });
+    });
 
+    $('#gb_ck').on('click', function () {
+        console.log("查看");
+    });
 
-    </script>
+    function goback() {
+        window.location.href = "/yeweihui/home.html?show=tuangou&userId=" + userId;
+    }
+</script>

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

@@ -91,7 +91,7 @@
                     '                    <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 style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">' + getStatus(v.tgStatus) + '</div>\n' +
                     '                </div>\n' +
                     '            </a>');
         }
@@ -130,19 +130,21 @@
                     '                        <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>')
+                    '                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">' + getStatus(v.tgStatus) + '</div>\n' +
+                    '                        </div>\n' + '                    </a>')
         }
 
         function myBuyClick2(v) {
-            window.location.href = "/home/buytc.html?userId=" + $('#userId').val()+ "&jmId=" + v.jmId+"&type="+2;
+            if (v.buyStatus != 1) {
+                return $.alert("该订单已经取消");
+            }
+            window.location.href = "/home/buytc.html?userId=" + $('#userId').val() + "&jmId=" + v.jmId + "&type=" + 2 + "&tgStatus=" + v.tgStatus;
         }
 
 
         /*居民求助信息*/
         function myBuyClick(v) {
-            window.location.href = "/home/buytc.html?userId=" + $('#userId').val() + "&jmId=" + v.jmId+"&type="+1;
+            window.location.href = "/home/buytc.html?userId=" + $('#userId').val() + "&jmId=" + v.jmId + "&type=" + 1 + "&tgStatus=" + v.tgStatus;
         }
 
 
@@ -155,4 +157,17 @@
                 return "<span style='color:green;'>已完成</span>";
             }
         }
+
+        //1 在团 2 发货 3完成 4取消',
+        function getStatus(v) {
+            if (v == 1) {
+                return "<span style='color:green;'>在团</span>";
+            } else if (v == 2) {
+                return "<span style='color:Black;'>发货</span>";
+            } else if (v == 3) {
+                return "完成";
+            } else if (v == 4) {
+                return "<span style='color:red;'>取消</span>";
+            }
+        }
     </script>

+ 89 - 89
whepi-ui/templates/home/buyClient.ftl

@@ -2,26 +2,29 @@
     <div style="display:flex; flex-direction: row; justify-content: space-between">
         <div class="weui-flex__item">
             <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" 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 style="display: inline;align-items: flex-start" id="Buycount"></div>
         </div>
     </div>
+
+    <div class="weui-flex__item">
+        <div style="display: inline;align-items: flex-end">状&nbsp;&nbsp;&nbsp;&nbsp;态:</div>
+        <div style="display: inline;" id="myStatus"></div>
+    </div>
+
     <div class="weui-flex" style="display:flex; flex-direction: row; justify-content: space-between">
         <div class="weui-flex__item">
             <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-]+/,'');">
+                       maxlength="3" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');" min="1"
+                       onchange="changeBuy()">
             </div>
         </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__item" >
+        <div style="display: inline;">金&nbsp;&nbsp;&nbsp;&nbsp;额¥:</div>
+        <div style="display: inline;" id="myMenory"></div>
     </div>
     <div class="weui-flex">
         <div class="weui-flex__item">
@@ -40,47 +43,74 @@
     </div>
     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh; margin-bottom: 5vh;">
     <#if type==1>
-      <a id="buyBack" onclick="buyBack()" href="javascript:;" class="weui-btn weui-btn_default"
-         style="width: 30%;">返回</a>
+        <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 ($) {
+        $.ajax({
+            url: '/query/getAll/status',
+            data: {
+                jmId: $('#jmBuy').val(),
+            },
+            type: 'GET',
+            success: function (data) {
+                console.log(data);
+                $("#Buycount").html(data.data.count)
+                $("#myStatus").html(getStatus(data.data.tgStatus))
+                /* $("#myMenory").html(data.data.tgPrice)*/
+            },
+            error: function () {
+            }
+        });
+    })(jQuery);
+
+
+
     <#--返回-->
     function buyBack() {
         window.location.href = "/user/homeIndex.html?userId=" + $('#buyuserId').val() + "&userType=" + 1 + '#tab3';
     }
 
     /*撤销*/
-    /*   function MybuyBack() {
-           $.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 MybuyBack() {
+        $.ajax({
+            url: '/home/back/buyBack',
+            data: {
+                userId: $('#buyuserId').val(),
+                buyCount: $('#buyCount').val(),
+                phone: $('#myPhone').val(),
+                myRemark: $('#Myremarks').val(),
+                buyMoney: $('#myMenory').text(),
+                jmId: $('#jmBuy').val(),
+            },
+            type: 'GET',
+            success: function (data) {
+                console.log(data);
+                if (data.data == 1) {
+                    buyBack();
+                } else {
+                    $.alert("该套餐已过截止日期或者已发货中不允许撤单");
+                }
+
+            },
+            error: function () {
+            }
+        });
+
+    }
 
     //提交
     function buyCommit() {
@@ -92,23 +122,23 @@
             $.alert("请填写联系电话");
             return;
         }
-        if ($('#Myremarks').val() == undefined || $('#Myremarks').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(),
+                myRemark: $('#Myremarks').val(),
                 buyMoney: $('#myMenory').text(),
                 jmId: $('#jmBuy').val(),
             },
             type: 'GET',
             success: function (data) {
-                console.log(data);
+                console.log(data.data);
                 buyBack();
             },
             error: function () {
@@ -116,64 +146,34 @@
         });
     }
 
-    (function ($) {
-   /*     $.ajax({
-            url: '/home/querysj/buytj',
+    //输入购买的数量
+    function changeBuy() {
+        $.ajax({
+            url: '/query/getAll/status',
             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>')
+                console.log(data);
+                $("#myMenory").html($('#buyCount').val() * data.data.tgPrice)
             },
             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);
+        });
+    }
 
 
+    //1 在团 2 发货 3完成 4取消',
+    function getStatus(v) {
+        if (v == 1) {
+            return "<span style='color:green;'>在团</span>";
+        } else if (v == 2) {
+            return "<span style='color:Black;'>发货</span>";
+        } else if (v == 3) {
+            return "完成";
+        } else if (v == 4) {
+            return "<span style='color:red;'>取消</span>";
+        }
+    }
 </script>

+ 64 - 57
whepi-ui/templates/home/buytc.ftl

@@ -4,43 +4,27 @@
 <div class="weui-tab__panel">
     <input id="buyuserId" type="text" hidden="hidden" value=${userId}>
     <input id="jmBuy" type="text" hidden="hidden" value=${jmId}>
+    <input id="tgStatusBuy" type="text" hidden="hidden" value=${tgStatus}>
 <#-- <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 class="page__bd">
+        <div class="weui-tab">
+        <#--业委会的套餐-->
+            <div id="details">
+                <div id="myyw">
                 </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">
+            <#--团购详情页面的展示-->
+                <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>
     </div>
@@ -57,34 +41,37 @@
             },
             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>')*/
+                var v = data.data;
+                console.log(v)
+                $('#myyw').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>' + v.tgTitle + '</h3>\n' +
+                        '            </div>\n' +
+                        '        </div>\n' +
+                        '        <div>\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">供应商:&nbsp;&nbsp;' + v.tgSupplier + '</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">套&nbsp;&nbsp;&nbsp;&nbsp;餐:&nbsp;&nbsp;' + v.tgGoods + '</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">单&nbsp;&nbsp;&nbsp;&nbsp;价:&nbsp;&nbsp;' + v.tgPrice + '</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">最新起定量(份):&nbsp;&nbsp;' + v.tgMinNum + '</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">截止时间:&nbsp;&nbsp;' + timestampToTime(v.tgEndTime) + '</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">预计送货时间:&nbsp;&nbsp;' + timestampToTime(v.tgDeliverTime) + '</div>\n' +
+                        '\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">服务电话:&nbsp;&nbsp;' + v.tgPhoneNumber + '</div>\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">备&nbsp;&nbsp;&nbsp;&nbsp;注:&nbsp;&nbsp;' + v.remark + '</div>\n'+
+                        '     </div>\n' +
+                        '    </div>')
             },
             error: function () {
             }
         });
+
      <#if type==2>
      $.ajax({
          url: '/home/queryGroup/buyGroup',
@@ -96,15 +83,35 @@
          success: function (data) {
              $('#buyCount').val(data.data.buyCount);
              $('#myPhone').val(data.data.phone);
-             $('#Myremarks').val(data.data.myRemark);
+             $('#Myremarks').text(data.data.myRemark);
              $('#myMenory').text(data.data.buyMoney);
-
          },
          error: function () {
          }
      });
+     //自己的列表的也不允许修改
+     /*if () {
+
+     }*/
      </#if>
+        //套餐不在团不允许添加修改
+        if ($('#tgStatusBuy').val() != 1) {
+            $('#buyCount').attr("disabled", "disabled");
+            $('#myPhone').attr("disabled", "disabled");
+            $('#Myremarks').attr("disabled", "disabled");
+        }
 
     })(jQuery);
 
+    function timestampToTime(timestamp) {
+        var date = new Date(timestamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
+        var Y = date.getFullYear() + '/';
+        var M = ((date.getMonth() + 1) < 10) ? ('0' + (date.getMonth() + 1) + '/') : ((date.getMonth() + 1) + '/');
+        var D = (date.getDate() < 10) ? ('0' + date.getDate() + ' ') : (date.getDate() + ' ');
+        var h = (date.getHours() < 10) ? ('0' + date.getHours() + ':') : (date.getHours() + ':');
+        var m = (date.getMinutes() < 10) ? ('0' + date.getMinutes() + ':') : (date.getMinutes() + ':');
+        var s = (date.getSeconds() < 10) ? ('0' + date.getSeconds()) : (date.getSeconds());
+        return Y + M + D + h + m + s;
+    }
+
 </script>

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

@@ -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">
+        <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>
     <#--<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>-->

+ 3 - 3
whepi-ui/templates/yeweihui/home.ftl

@@ -13,9 +13,9 @@
         </div>
         <div id="tab2" class="weui-tab__bd-item">
             <#include "/yeweihui/qiuzhu.ftl" /></div>
-        <#--<div id="tab3" class="weui-tab__bd-item">-->
-            <#--<#include "/yeweihui/tuangou.ftl" />-->
-        <#--</div>-->
+        <div id="tab3" class="weui-tab__bd-item">
+            <#include "/yeweihui/tuangou.ftl" />
+        </div>
     <#--<div id="tab3" class="weui-tab__bd-item">-->
     <#--<h1>页面三</h1> </div>-->
     <#--<div id="tab4" class="weui-tab__bd-item">-->

+ 119 - 10
whepi-ui/templates/yeweihui/tgPublish.ftl

@@ -8,16 +8,28 @@
     </div>
 
     <div class="weui-btn-area">
-
-        <p class="weui-media-box__desc">求助标题</p>
-        <h4 class="weui-media-box__title">sss</h4>
-        <br>
-        <p class="weui-media-box__desc">求助对象</p>
-        <h4 class="weui-media-box__title">sasa</h4>
-        <br>
-        <p class="weui-media-box__desc">求助内容</p>
-        <h4 class="weui-media-box__title">fda</h4>
-        <br>
+        <p class="weui-media-box__desc">组团标题:</p>
+        <input id="tg_input_title" class="weui-input" autofocus="" type="text" placeholder="请输入" maxlength="20" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">供应商:</p>
+        <input id="tg_input_supplier" class="weui-input" autofocus="" type="text" placeholder="请输入" maxlength="20" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">套餐:</p>
+        <input id="tg_input_goods" class="weui-input" autofocus="" type="text" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">单价(元):</p>
+        <input id="tg_input_price" class="weui-input" autofocus="" type="number" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">最小起订量(份):</p>
+        <input id="tg_input_mixnum" class="weui-input" autofocus="" type="number" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">截止时间:</p>
+        <input id="tg_input_end_time" type="text" placeholder="请选择时间" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;"/>
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">预计送货时间:</p>
+        <input id="tg_input_deliver_time" type="text" placeholder="请选择时间" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;"/>
+        前
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">服务电话:</p>
+        <input id="tg_input_phone_number" class="weui-input" autofocus="" type="text" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <div class="weui-btn-area">
+            <a id="tg_publish" class="weui-btn weui-btn_primary" style="width: 30%;">
+                发布
+            </a>
+        </div>
     </div>
 </div>
 
@@ -26,7 +38,104 @@
 <script>
     var userId = ${userId};
 
+    $("#tg_input_end_time").datetimePicker();
+    $("#tg_input_deliver_time").datetimePicker();
+
     function goback() {
         window.location.href = "/yeweihui/home.html?show=tuangou&userId=" + userId;
     }
+
+    $("#tg_publish").on('click', function () {
+
+        let title = $("#tg_input_title").val();
+        if (title.length <= 0) {
+            alert("请输入组团标题");
+            return;
+        }
+
+        let supplier = $("#tg_input_supplier").val();
+        if (supplier.length <= 0) {
+            alert("请输入供应商名称");
+            return;
+        }
+
+        let goods = $("#tg_input_goods").val();
+        if (goods.length <= 0) {
+            alert("请输入套餐内容");
+            return;
+        }
+
+        let price = $("#tg_input_price").val();
+        if (price.length <= 0) {
+            alert("请输入套餐单价");
+            return;
+        }
+
+        let mixnum = $("#tg_input_mixnum").val();
+        if (mixnum.length <= 0) {
+            alert("请输入最小起订量");
+            return;
+        }
+
+        let end_time = $("#tg_input_end_time").val();
+        if (end_time.length <= 0) {
+            alert("请选择截止时间");
+            return;
+        }
+
+        let deliver_time = $("#tg_input_deliver_time").val();
+        if (deliver_time.length <= 0) {
+            alert("请选择送货时间");
+            return;
+        }
+
+        let phone_number = $("#tg_input_phone_number").val();
+        if (phone_number.length <= 0) {
+            alert("请输入服务电话");
+            return;
+        }
+
+        console.log(
+            "发布",
+            title + "---" +
+            supplier + "---" +
+            goods + "---" +
+            price + "---" +
+            mixnum + "---" +
+            end_time + "---" +
+            deliver_time + "---" +
+            phone_number
+        );
+
+        let sendData = {
+            userId: userId,
+            tgTitle: title,
+            tgSupplier: supplier,
+            tgGoods: goods,
+            tgPrice: price,
+            tgMinNum: mixnum,
+            endTime: end_time,
+            deliverTime: deliver_time,
+            tgPhoneNumber: phone_number,
+
+        };
+
+        $.ajax({
+            url: '/yeweihui/tgPublish.json',
+            type: 'post',
+            data: sendData,
+            success: function (data) {
+                // console.log(data);
+                if (data.success) {
+                    window.location.href = "/yeweihui/home.html?show=tuangou&userId=" + userId;
+                }
+                else  {
+                    $.alert(data.data);
+                }
+            },
+            error: function () {
+                $.alert("网络异常");
+            }
+        });
+    })
 </script>

+ 27 - 103
whepi-ui/templates/yeweihui/tuangou.ftl

@@ -31,102 +31,25 @@
                         <div style="width: 15%; text-align: center;">状态</div>
                     </div>
                     <div id="tg_list1" class="weui-panel__bd">
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                            <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                            <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                            <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                            <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
+<#--                        <a href="javascript:void(0);" style="color: grey;">-->
+<#--                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">-->
+<#--                            <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>-->
+<#--                            <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>-->
+<#--                            <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>-->
+<#--                            <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>-->
+<#--                        </div>-->
+<#--                        </a>-->
+<#--                        <a href="javascript:void(0);" style="color: grey;">-->
+<#--                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">-->
+<#--                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>-->
+<#--                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>-->
+<#--                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>-->
+<#--                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>-->
+<#--                            </div>-->
+<#--                        </a>-->
+                        <div class="weui-loadmore weui-loadmore_line">
+                            <span class="weui-loadmore__tips">暂无数据</span>
                         </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
                     </div>
                     <div class="weui-btn-area">
                         <a id="tg_publish" class="weui-btn weui-btn_primary">
@@ -150,15 +73,16 @@
                 </div>
 
                 <div class="weui-panel weui-panel_access">
+                    <div style="display: flex; flex-direction: row; color: grey; font-size: medium; line-height: 7vh;">
+                        <div style="width: 40%; text-align: center;">标题</div>
+                        <div style="width: 15%; text-align: center;">已团</div>
+                        <div style="width: 30%; text-align: center;">截止时间</div>
+                        <div style="width: 15%; text-align: center;">状态</div>
+                    </div>
                     <div id="tg_list2" class="weui-panel__bd">
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
+                        <div class="weui-loadmore weui-loadmore_line">
+                            <span class="weui-loadmore__tips">暂无数据</span>
+                        </div>
                     </div>
                     <div class="weui-btn-area">
                         <a id="tg_publish" class="weui-btn weui-btn_primary">

+ 145 - 1
whepi-ui/templates/yeweihui/tuangou.js

@@ -2,4 +2,148 @@ function tuangou_init(tt) {
     $('#tg_publish').on('click', function () {
         window.location.href = "/yeweihui/tgPublish.html?userId=" + $('#userId').val();
     });
-};
+
+    $('#tg_btnQZ1').on('click', function () {
+        getListData();
+    });
+
+    $('#tg_btnQZ2').on('click', function () {
+        getMyPbListData();
+    });
+
+    getListData();
+    getMyPbListData();
+};
+
+function getListData() {
+
+    let searchTitle = $('#tg_searchNum1').val();
+
+    $.ajax({
+        url: '/yeweihui/tuangou/list/query.json',
+        type: 'post',
+        data: {
+            userId: $('#userId').val(),
+            title: searchTitle
+        },
+        success: function (data) {
+            if (data.success) {
+                makeList(data.data);
+            }
+            else  {
+                $.alert("操作失败");
+            }
+        },
+        error: function () {
+            $.alert("网络异常");
+        }
+    });
+
+}
+
+function getMyPbListData() {
+
+    let searchTitle = $('#tg_searchNum2').val();
+
+    $.ajax({
+        url: '/yeweihui/tuangou/mylist/query.json',
+        type: 'post',
+        data: {
+            userId: $('#userId').val(),
+            title: searchTitle
+        },
+        success: function (data) {
+            if (data.success) {
+                makeMyPublishList(data.data);
+            }
+            else  {
+                $.alert("操作失败");
+            }
+        },
+        error: function () {
+            $.alert("网络异常");
+        }
+    });
+
+}
+
+function makeList(list) {
+    $('#tg_list1').empty();
+
+    if (list == undefined || list.length <= 0) {
+        $('#tg_list1').append('<div class="weui-loadmore weui-loadmore_line">\n' +
+            '    <span class="weui-loadmore__tips">暂无数据</span>\n' +
+            '</div>');
+        return;
+    }
+
+    for (let i = 0; i < list.length; i++) {
+        let item = list[i];
+        let status = '';
+        if (item.tgStatus == 1) {
+            status = "在团";
+        }
+        else if (item.tgStatus == 2) {
+            status = "发货";
+        }
+        else if (item.tgStatus == 3) {
+            status = "完成";
+        }
+        else if (item.tgStatus == 4) {
+            status = "取消";
+        }
+        $('#tg_list1').append($('<a href="javascript:tgItemSelect(' + "'" + item.jmId + "'" + ');" style="color: grey;">\n' +
+            '                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">\n' +
+            '                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.tgTitle + '</div>\n' +
+            '                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.currentNum + '/' + item.tgMinNum + '</div>\n' +
+            '                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.tgEndTime.toString() + '</div>\n' +
+            '                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + status + '</div>\n' +
+            '                            </div>\n' +
+            '                        </a>'));
+    }
+}
+
+function makeMyPublishList(list) {
+
+    $('#tg_list2').empty();
+
+    if (list == undefined || list.length <= 0) {
+        $('#tg_list2').append('<div class="weui-loadmore weui-loadmore_line">\n' +
+            '    <span class="weui-loadmore__tips">暂无数据</span>\n' +
+            '</div>');
+        return;
+    }
+
+    for (let i = 0; i < list.length; i++) {
+        let item = list[i];
+        let status = '';
+        if (item.tgStatus == 1) {
+            status = "在团";
+        }
+        else if (item.tgStatus == 2) {
+            status = "发货";
+        }
+        else if (item.tgStatus == 3) {
+            status = "完成";
+        }
+        else if (item.tgStatus == 4) {
+            status = "取消";
+        }
+        $('#tg_list2').append($('<a href="javascript:tgMyItemSelect(' + "'" + item.jmId + "'" + ');" style="color: grey;">\n' +
+            '                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">\n' +
+            '                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.tgTitle + '</div>\n' +
+            '                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.currentNum + '/' + item.tgMinNum + '</div>\n' +
+            '                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.tgEndTime.toString() + '</div>\n' +
+            '                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + status + '</div>\n' +
+            '                            </div>\n' +
+            '                        </a>'));
+    }
+}
+
+function tgItemSelect(jmId) {
+    window.location.href = "/yeweihui/groupBuyingXx.html?jmId=" + jmId + "&userId=" + $('#userId').val();
+}
+
+function tgMyItemSelect(jmId) {
+    window.location.href = "/yeweihui/groupBuyingXx.html?jmId=" + jmId + "&userId=" + $('#userId').val();
+}

+ 6 - 2
whepi-web/src/main/java/com/bofeng/dao/BuyMapper.java

@@ -13,11 +13,15 @@ import java.util.List;
 @Repository
 public interface BuyMapper extends BaseMapper<Buy> {
 
+  Buy selectBuyOne(@Param("userId") Long userId, @Param("jmId") Long jmId);
+
   List<JmTuangou> group(@Param("userId") Long userId);
 
   List<Buy> MyGroup(@Param("userId") Long userId);
 
-  Buy queryGroup(@Param("userId") Long userId,@Param("jmId")Long jmId);
+  Buy queryGroup(@Param("userId") Long userId, @Param("jmId") Long jmId);
+
+  JmTuangou selectGroup(@Param("userId") Long userId, @Param("jmId") Long jmId);
 
-  JmTuangou selectGroup(@Param("userId") Long userId,@Param("jmId")Long jmId);
+  Buy status(@Param("jmId") Long jmId);
 }

+ 30 - 0
whepi-web/src/main/java/com/bofeng/dao/JmTuangouDao.java

@@ -0,0 +1,30 @@
+package com.bofeng.dao;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+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 JmTuangouDao extends BaseMapper<JmTuangou> {
+
+    List<JmTuangou> queryTuangouListByUptownId (@Param("uptownId") Long uptownId);
+
+    List<JmTuangou> queryTuangouListByUptownIdAndTitle (@Param("uptownId") Long uptownId, @Param("title") String title);
+
+    List<JmTuangou> queryTuangouListByUserId (@Param("userId") Long userId);
+
+    List<JmTuangou> queryTuangouListByUserIdAndTitle (@Param("userId") Long userId, @Param("title") String title);
+
+    JmTuangou selectJmTuangouByJmId(@Param("JmId") Long JmId);
+
+    Integer updateRemarkByJmId(@Param("JmId") Long JmId, @Param("remark") String remark);
+
+    Integer updateStatusByJmId(@Param("JmId") Long JmId, @Param("status") Long status);
+
+    Integer updateStatusRemarkByJmId(@Param("JmId") Long JmId, @Param("status") Long status, @Param("remark") String remark);
+}

+ 4 - 0
whepi-web/src/main/java/com/bofeng/entity/Buy.java

@@ -49,5 +49,9 @@ public class Buy {
 
   @TableField(exist = false)
   private Integer tgStatus;
+  @TableField(exist = false)
+  private Integer count;
+  @TableField(exist = false)
+  private String tgPrice;
 
 }

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

@@ -1,5 +1,7 @@
 package com.bofeng.entity;
 
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -51,16 +53,27 @@ public class JmTuangou implements Serializable {
      */
     private Integer tgMinNum;
 
+    @TableField(exist = false)
+    private Integer currentNum;
+
     /**
      * 团购截止时间
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
     private Date tgEndTime;
 
+    @TableField(exist = false)
+    private String endTime;
+
     /**
      * 预计送货时间
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
     private Date tgDeliverTime;
 
+    @TableField(exist = false)
+    private String deliverTime;
+
     /**
      * 联系人电话
      */

+ 25 - 7
whepi-web/src/main/java/com/bofeng/service/BuyService.java

@@ -21,14 +21,14 @@ public class BuyService {
 
   @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
   public int buyGroup(Buy buy) {
-
+    Buy buy1 = buyMapper.selectBuyOne(buy.getUserId(), buy.getJmId());
+    if (buy1 != null) {
+      buy.setBuyId(buy1.getBuyId());
+      return buyMapper.updateById(buy);
+    }
     buy.setBuyId(IdWorker.getId());
     buy.setUserCreate(buy.getUserId());
     buy.setTimeCreate(new DateTime());
-    //在添加的时候 进行检测该团购是否在规定时间里 已经达到了最小起订量的要求
-/*    if () {
-
-    }*/
     buy.setBuyStatus(1);//在团
     return buyMapper.insert(buy);
   }
@@ -46,7 +46,25 @@ public class BuyService {
   }
 
 
-  public JmTuangou selectGroup(Long userId,Long jmId){
-    return buyMapper.selectGroup(userId,jmId);
+  public JmTuangou selectGroup(Long userId, Long jmId) {
+    return buyMapper.selectGroup(userId, jmId);
+  }
+
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+  public int buyBack(Buy buy) {
+    //在该套餐截止日期之前 并且是在团状态的才能撤单
+    JmTuangou jmTuangou = buyMapper.selectGroup(buy.getUserId(), buy.getJmId());
+    if (jmTuangou.getTgEndTime().getTime() >= new DateTime().getMillis() && jmTuangou.getTgStatus() == 1) {
+      Buy buy1 = buyMapper.selectBuyOne(buy.getUserId(), buy.getJmId());
+      buy.setBuyId(buy1.getBuyId());
+      buy.setBuyStatus(2);//撤单
+      return buyMapper.updateById(buy);
+    }
+    //不允许更改
+    return 2;
+  }
+
+  public Buy status(Buy buy) {
+    return buyMapper.status(buy.getJmId());
   }
 }

+ 93 - 0
whepi-web/src/main/java/com/bofeng/service/JmTuangouService.java

@@ -0,0 +1,93 @@
+package com.bofeng.service;
+
+import com.baomidou.mybatisplus.toolkit.IdWorker;
+import com.bofeng.dao.JmTuangouDao;
+import com.bofeng.dao.YeweihuiSysOwnerMapper;
+import com.bofeng.dao.YeweihuiUserRoleMapper;
+import com.bofeng.entity.JmTuangou;
+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.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@Service
+@Transactional(readOnly = true)
+public class JmTuangouService {
+
+    @Autowired
+    private JmTuangouDao jmTuangouDao;
+
+    @Autowired
+    private YeweihuiUserRoleMapper yeweihuiUserRoleMapper;
+
+    @Autowired
+    private YeweihuiSysOwnerMapper yeweihuiSysOwnerMapper;
+
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public Integer tuangouPublish(JmTuangou jmTuangou) {
+
+        jmTuangou.setJmId(IdWorker.getId());
+
+        Long propertyId = yeweihuiUserRoleMapper.queryPropertyIdByUserId(jmTuangou.getUserId());
+        Long uptownId = yeweihuiSysOwnerMapper.queryUptownIdByUserId(propertyId);
+        jmTuangou.setUptownId(uptownId);
+
+        jmTuangou.setTgStatus(1);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+
+        Date tgEndTime = new Date();
+        Date tgDeliverTime = new Date();
+        try {
+            tgEndTime = sdf.parse(jmTuangou.getEndTime());
+            tgDeliverTime = sdf.parse(jmTuangou.getDeliverTime());
+        }
+        catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+        jmTuangou.setTgEndTime(tgEndTime);
+        jmTuangou.setTgDeliverTime(tgDeliverTime);
+
+        return jmTuangouDao.insert(jmTuangou);
+    }
+
+    public List<JmTuangou> queryTuangouListByTitle(Long userId, String title) {
+
+        Long propertyId = yeweihuiUserRoleMapper.queryPropertyIdByUserId(userId);
+        Long uptownId = yeweihuiSysOwnerMapper.queryUptownIdByUserId(propertyId);
+
+        if (title.equals("")) {
+            return jmTuangouDao.queryTuangouListByUptownId(uptownId);
+        }
+        return jmTuangouDao.queryTuangouListByUptownIdAndTitle(uptownId, title);
+    }
+
+    public List<JmTuangou> queryTuangouMyListByTitle(Long userId, String title) {
+
+        if (title.equals("")) {
+            return jmTuangouDao.queryTuangouListByUserId(userId);
+        }
+        return jmTuangouDao.queryTuangouListByUserIdAndTitle(userId, title);
+    }
+
+    public JmTuangou queryByJmId(Long jmId) {
+        return jmTuangouDao.selectJmTuangouByJmId(jmId);
+    }
+
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public Integer updateRemarkByJmId(Long jmId, Long status, String remark) {
+        if (status == 0) {
+            return jmTuangouDao.updateRemarkByJmId(jmId, remark);
+        }
+        if (remark.equals("")) {
+
+        }
+        return jmTuangouDao.updateStatusRemarkByJmId(jmId, status, remark);
+    }
+}

+ 14 - 13
whepi-web/src/main/java/com/bofeng/wx/controller/BuyController.java

@@ -28,10 +28,11 @@ public class BuyController {
 
   @GetMapping("/home/buytc.html")
   public ModelAndView buytc(@Pd(name = "userId") Long userId, @Pd(name = "jmId") Long jmId,
-                            @Pd(name = "type") Integer type, ModelMap model) {
+                            @Pd(name = "type") Integer type, @Pd(name = "tgStatus") Integer tgStatus, ModelMap model) {
     model.put("userId", userId);
     model.put("jmId", jmId);
     model.put("type", type);
+    model.put("tgStatus", tgStatus);
     return new ModelAndView("/home/buytc.ftl", model);
   }
 
@@ -52,17 +53,17 @@ public class BuyController {
   }
 
   @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);
+  public Model<JmTuangou> buytj(@Pd(name = "userId") Long userId, @Pd(name = "jmId") Long jmId, ModelMap model) {
+    return Model.newSuccess(buyService.selectGroup(userId, jmId));
+  }
+
+  @GetMapping("/home/back/buyBack")
+  public ModelOps buyBack(Buy buy) {
+    return ModelOps.newSuccess(buyService.buyBack(buy));
+  }
+
+  @GetMapping("/query/getAll/status")
+  public Model<Buy> status(Buy buy) {
+    return Model.newSuccess(buyService.status(buy));
   }
 }

+ 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() + "\"");

+ 81 - 7
whepi-web/src/main/java/com/bofeng/wx/controller/YeWeiHuiController.java

@@ -4,10 +4,7 @@ import com.bofeng.dao.RbMapper;
 import com.bofeng.dao.UptownMapper;
 import com.bofeng.entity.*;
 import com.bofeng.excel.ExcelUtils;
-import com.bofeng.service.HomeService;
-import com.bofeng.service.QzTaskReplyService;
-import com.bofeng.service.QzTaskService;
-import com.bofeng.service.RbService;
+import com.bofeng.service.*;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
@@ -48,13 +45,16 @@ public class YeWeiHuiController {
     private HomeService homeService;
 
     @Autowired
+    private JmTuangouService jmTuangouService;
+
+    @Autowired
     private UptownMapper uptownMapper;
 
     @Autowired
     private RbMapper rbMapper;
 
     @GetMapping("/yeweihui/home.html")
-    public ModelAndView yeweihui(ModelMap model,@RequestParam(value = "userId") Long userId, @RequestParam(value = "showQZ", required = false, defaultValue = "-") String showQZ) {
+    public ModelAndView yeweihui(ModelMap model,@RequestParam(value = "userId") Long userId, @RequestParam(value = "show", required = false, defaultValue = "-") String show) {
 
 //        List<QzTask> taskList = qzTaskService.selectAll(1225321682867105793L);
 //        List<sysUptownUnit> rbList = rbService.selectAll(1225321682867105793L);
@@ -63,7 +63,7 @@ public class YeWeiHuiController {
         model.put("taskList", YvanUtil.toJsonPretty(taskList));
         model.put("rbList", YvanUtil.toJsonPretty(rbList));
         model.put("user_id", "\""+userId+"\"");
-        model.put("showQZ", "\""+showQZ+"\"");
+        model.put("show", "\""+show+"\"");
 
         return new ModelAndView("/yeweihui/home.ftl", model);
     }
@@ -268,12 +268,86 @@ public class YeWeiHuiController {
     }
 
     @GetMapping("/yeweihui/tgPublish.html")
-    public ModelAndView tuangouPublish(@Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
+    public ModelAndView tgPublish(@Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
         model.put("userId", "\""+userId+"\"");
 
         return new ModelAndView("/yeweihui/tgPublish.ftl", model);
     }
 
+    @GetMapping("/yeweihui/groupBuyingCx.html")
+    public ModelAndView groupBuyingCx(@Pd(name = "jmId") Long jmId, @Pd(name = "userId") Long userId, @Pd(name = "operation") String operation, ModelMap model) throws JsonProcessingException {
+
+        JmTuangou item = jmTuangouService.queryByJmId(jmId);
+        model.put("tgItemJson", new JsonWapper(item));
+        model.put("tgItem", item);
+
+        model.put("userId", "\""+userId+"\"");
+
+        model.put("operation", "\""+operation+"\"");
+
+        return new ModelAndView("/groupBuying/groupBuyingCx.ftl", model);
+    }
+
+    @GetMapping("/yeweihui/groupBuyingXx.html")
+    public ModelAndView groupBuyingXx(@Pd(name = "jmId") Long jmId, @Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
+
+        JmTuangou item = jmTuangouService.queryByJmId(jmId);
+
+        if (item.getUserId().equals(userId)) {
+            model.put("isMine", "mine");
+        }
+        else {
+            model.put("isMine", "notMine");
+        }
+
+        model.put("userId", "\""+userId+"\"");
+        model.put("tgItemJson", new JsonWapper(item));
+        model.put("tgItem", item);
+
+        return new ModelAndView("/groupBuying/groupBuyingXx.ftl", model);
+    }
+
+    @PostMapping("/yeweihui/groupBuyingCx/remark/add.json")
+    public Model groupBuyingCxRemarkAdd(@Pd(name = "jmId") Long jmId, @Pd(name = "status", required = false, defaultValue = "0") Long status, @Pd(name = "remark", required = false) String remark) {
+
+        Integer success = jmTuangouService.updateRemarkByJmId(jmId, status, remark);
+
+        if (success == 1) {
+            return Model.newSuccess("操作成功");
+        }
+        else {
+            return Model.newFail("操作失败");
+        }
+    }
+
+    @PostMapping("/yeweihui/tgPublish.json")
+    public Model tuangouPublish(JmTuangou jmTuangou) {
+
+        Integer success = jmTuangouService.tuangouPublish(jmTuangou);
+        if (success == 1) {
+            return Model.newSuccess("操作成功");
+        }
+        else {
+            return Model.newFail("操作失败");
+        }
+    }
+
+    @PostMapping("/yeweihui/tuangou/list/query.json")
+    public Model queryTuangouListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
+
+        List<JmTuangou> list = jmTuangouService.queryTuangouListByTitle(userId, title);
+
+        return Model.newSuccess(list);
+    }
+
+    @PostMapping("/yeweihui/tuangou/mylist/query.json")
+    public Model queryTuangouMyListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
+
+        List<JmTuangou> myList = jmTuangouService.queryTuangouMyListByTitle(userId, title);
+
+        return Model.newSuccess(myList);
+    }
+
     @PostMapping("/whepi/getAllUptown")
     public Model<List<Uptown>> getAllUptown(HttpParameterParser parser, PageDb pageDb) {
         return Model.newSuccess(pageDb, uptownMapper.getUptowns(pageDb, parser.getMap()));

+ 1 - 1
whepi-web/src/main/resources/application.yml

@@ -43,7 +43,7 @@ endpoints:
 #  whitelabel.enabled: false
 
 spring:
-  profiles.active: dev
+  profiles.active: lll
 
   application:
     name: bofeng-web

+ 15 - 3
whepi-web/src/main/resources/mapper/BuyMapper.xml

@@ -2,9 +2,14 @@
 <!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="selectBuyOne" resultType="com.bofeng.entity.Buy">
+        select * from jm_buy where user_id=#{userId} and jm_id=#{jmId}  and buy_status=1 limit 1
+    </select>
+
     <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
+       IFNULL((select SUM(jb.buy_count) FROM jm_buy jb where jb.jm_id=jt.jm_id and buy_status=1),0) as count
        FROM jm_tuangou jt
        where jt.uptown_id =(select c.uptown_id
        from sys_user_role a
@@ -14,10 +19,10 @@
     </select>
 
     <select id="MyGroup" resultType="com.bofeng.entity.Buy">
-        select DISTINCT a.tg_title,b.time_create,a.tg_status,a.jm_id
+        select DISTINCT a.tg_title,b.time_create,a.tg_status,a.jm_id,b.buy_status
         from  jm_tuangou a
         INNER JOIN jm_buy b on a.jm_id=b.jm_id
-        where a.user_id=#{userId}
+        where a.user_id=#{userId} and buy_status=1
     </select>
 
 
@@ -29,5 +34,12 @@
         select * from jm_tuangou where jm_id=#{jmId} limit 1
     </select>
 
+    <select id="status" resultType="com.bofeng.entity.Buy">
+       SELECT a.tg_status,a.tg_price,
+       IFNULL(( SELECT SUM(b.buy_count)
+      FROM jm_buy b WHERE a.jm_id = b.jm_id and buy_status=1), 0 ) AS count
+      FROM jm_tuangou a
+      WHERE a.jm_id = #{jmId} limit 1
+    </select>
 
 </mapper>

+ 48 - 0
whepi-web/src/main/resources/mapper/JmTuangouMapper.xml

@@ -0,0 +1,48 @@
+<?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.bofeng.dao.JmTuangouDao">
+
+    <select id="queryTuangouListByUptownId" resultType="com.bofeng.entity.JmTuangou">
+        select a.*, (select count(1) from jm_buy where jm_id=a.jm_id) as currentNum
+        from jm_tuangou a
+        where uptown_id=#{uptownId}
+    </select>
+
+    <select id="queryTuangouListByUptownIdAndTitle" resultType="com.bofeng.entity.JmTuangou">
+        select a.*, (select count(1) from jm_buy where jm_id=a.jm_id) as currentNum
+        from jm_tuangou a
+        where uptown_id=#{uptownId} and tg_title like concat('%', #{title}, '%')
+    </select>
+
+    <select id="queryTuangouListByUserId" resultType="com.bofeng.entity.JmTuangou">
+        select a.*, (select count(1) from jm_buy where jm_id=a.jm_id) as currentNum
+        from jm_tuangou a
+        where user_id=#{userId}
+    </select>
+
+    <select id="queryTuangouListByUserIdAndTitle" resultType="com.bofeng.entity.JmTuangou">
+        select a.*, (select count(1) from jm_buy where jm_id=a.jm_id) as currentNum
+        from jm_tuangou a
+        where user_id=#{userId} and tg_title like concat('%', #{title}, '%')
+    </select>
+
+    <select id="selectJmTuangouByJmId" resultType="com.bofeng.entity.JmTuangou">
+
+        select a.*, (select count(1) from jm_buy where jm_id=a.jm_id) as currentNum
+        from jm_tuangou a
+        where jm_id=#{JmId}
+
+    </select>
+
+    <update id="updateRemarkByJmId">
+        update jm_tuangou set remark=#{remark} where jm_id=#{JmId}
+    </update>
+
+    <update id="updateStatusByJmId">
+        update jm_tuangou set tg_status=#{status} where jm_id=#{JmId}
+    </update>
+
+    <update id="updateStatusRemarkByJmId">
+        update jm_tuangou set tg_status=#{status},remark=#{remark} where jm_id=#{JmId}
+    </update>
+</mapper>