瀏覽代碼

业主购买2月10号

guojing 5 年之前
父節點
當前提交
e3e4c58505
共有 3 個文件被更改,包括 134 次插入32 次删除
  1. 2 1
      whepi-doc/group.sql
  2. 122 31
      whepi-ui/templates/home/buy.ftl
  3. 10 0
      whepi-web/src/main/java/com/bofeng/wx/controller/BuyController.java

+ 2 - 1
whepi-doc/group.sql

@@ -3,6 +3,7 @@
 -- ----------------------------
 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 '购买数量',
@@ -12,7 +13,7 @@ create table jm_buy (
     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

+ 122 - 31
whepi-ui/templates/home/buy.ftl

@@ -16,24 +16,56 @@
 
             <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">
+                    <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;">
+                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
+                                蔬菜套餐,猪肉牛肉金针菇等
+                            </div>
+                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
+                                02/02 14:30
+                            </div>
+                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
+                                在团
+                            </div>
+                        </div>
+                    </a>
                 </div>
             </div>
         </div>
         <div class="weui-form-preview"
              id="buyListGroup">
-            <div class="weui-form-preview__label"
-                 style="display:flex; flex-direction: row; justify-content: space-between">
-                <label onclick="a()"
-                       style="box-sizing:border-box; border-radius: 5px; height: 5vh; width: 25%; text-align: center;">标题</label>
-                <label style="box-sizing:border-box; border-radius: 5px; height: 5vh; width: 25%; text-align: center;">已团</label>
-                <label style="box-sizing:border-box; border-radius: 5px; height: 5vh; width: 25%; text-align: center;">截止时间</label>
-                <label style="box-sizing:border-box; border-radius: 5px; height: 5vh; width: 25%; text-align: center;">状态</label>
+            <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="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>
+            </a>-->
         </div>
     </div>
 
@@ -43,27 +75,46 @@
             $('#buy_nav1')[0].style.display = '';
             $('#buyListGroup')[0].style.display = '';
             $('#buy_nav2')[0].style.display = 'none';
-            /*  $.ajax({
-                  url: '',
-                  type: 'get',
-                  data: {},
-                  success: function (data) {
-                      if (data.success) {
-                          if (data.data.length > 0) {
-                              hasData = true;
-                              data.data.forEach(function (v) {
-                                  buyList(v);
-                              });
-                          }
-                          else {
-                          }
+            $('#buyAll')[0].style.display = '';
+            $('#buyAll').empty();//清除节点
+            $.ajax({
+                url: '/home/buy/group',
+                type: 'get',
+                data: {},
+                success: function (data) {
+                    if (data.success) {
+                        if (data.data.length > 0) {
+                            hasData = true;
+                            data.data.forEach(function (v) {
+                                buyList(v);
+                            });
+                        }
+                        else {
+                        }
 
-                      }
-                  },
-              });*/
+                    }
+                },
+            });
         }
 
         function buyList(v) {
+            $('#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">\n' +
+                    '                        蔬菜套餐,猪肉牛肉金针菇等\n' +
+                    '                    </div>\n' +
+                    '                    <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">\n' +
+                    '                        24/100\n' +
+                    '                    </div>\n' +
+                    '                    <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">\n' +
+                    '                        02/02 14:30\n' +
+                    '                    </div>\n' +
+                    '                    <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">\n' +
+                    '                        在团\n' +
+                    '                    </div>\n' +
+                    '                </div>\n' +
+                    '            </a>');
         }
 
 
@@ -71,14 +122,54 @@
         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: '',
+                type: 'get',
+                data: {},
+                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">\n' +
+                    '                                蔬菜套餐,猪肉牛肉金针菇等\n' +
+                    '                            </div>\n' +
+                    '                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">\n' +
+                    '                                02/02 14:30\n' +
+                    '                            </div>\n' +
+                    '                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">\n' +
+                    '                                在团\n' +
+                    '                            </div>\n' +
+                    '                        </div>\n' +
+                    '                    </a>')
         }
 
+        function myBuyClick2(v) {
+            window.location.href = "/home/buytc.html?userId=" + $('#userId').val();
+        }
+
+
         /*居民求助信息*/
-        function a() {
-            window.location.href = "/home/buytc.html?userId="+$('#userId').val();
+        function myBuyClick(v) {
+            window.location.href = "/home/buytc.html?userId=" + $('#userId').val();
         }
 
     </script>

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

@@ -2,6 +2,7 @@ package com.bofeng.wx.controller;
 
 import com.bofeng.entity.Buy;
 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;
@@ -10,12 +11,15 @@ 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 {
 
   @Autowired
   private BuyService buyService;
 
+
   @GetMapping("/home/home/buyGroup")
   public ModelOps buyGroup(Buy buy) {
     return ModelOps.newSuccess(buyService.buyGroup(buy));
@@ -26,4 +30,10 @@ public class BuyController {
     model.put("userId", userId);
     return new ModelAndView("/home/buytc.ftl", model);
   }
+
+  @GetMapping("/home/buy/group")
+  public Model<List<>> group(){
+    return Model.newSuccess();
+  }
+
 }