123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <div class="page__bd">
- <div class="weui-tab">
- <div class="weui-navbar">
- <a class="weui-navbar__item weui-bar__item_on" target="#buy_nav1" module="buy_zhu" onclick="buyGroup()">
- 团购信息
- </a>
- <a class="weui-navbar__item" target="#buy_nav2" module="buy_zhu" id="buy_help" onclick="buyGroup2()">
- 我的团购
- </a>
- </div>
- <div class="weui-tab__panel"><#--团购信息的列表-->
- <div id="buy_nav1" style="text-align: center ">
- 团购信息
- <div class="container">
- <div class="weui-form-preview"
- id="buyListGroup">
- <div style="display: flex; flex-direction: row; color: grey; font-size: medium;">
- <div style="width: 38%; text-align: center;color: #0a001f">标题</div>
- <div style="width: 12%; text-align: center;color: #0a001f">已团</div>
- <div style="width: 35%; text-align: center;color: #0a001f">截止时间</div>
- <div style="width: 15%; text-align: center;color: #0a001f">状态</div>
- </div>
- </div>
- </div>
- <div class="container">
- <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 style="height: 20vh"></div>
- </div>
- </div>
- <div id="buy_nav2" style="display: none"><#--我的团购信息-->
- <div class="weui-form-preview">
- <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>
- <div class="container">
- <div id="MyBuyAll">
- </div>
- <div style="height: 20vh"></div>
- </div>
- </div>
- </div>
- </div>
- <script>
- //商品的团购信息的展示
- function buyGroup() {
- console.log('商品团购')
- $('#buy_nav1')[0].style.display = '';
- $('#buyListGroup')[0].style.display = '';
- $('#buy_nav2')[0].style.display = 'none';
- $('#buyAll')[0].style.display = '';
- $('#buyAll').empty();//清除节点
- $.ajax({
- url: '/home/buy/group',
- type: 'get',
- data: {userId: $('#userId').val()},
- success: function (data) {
- if (data.success) {
- if (data.data.length > 0) {
- hasData = true;
- data.data.forEach(function (v) {
- 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: 4vh;">\n' +
- ' <div style="width: 38%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px;text-align: left;">' + v.tgTitle + '</div>\n' +
- ' <div style="width: 12%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">\n' + v.count + '</div>\n' +
- ' <div style="width: 35%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + sub(v.tgEndTime) + '</div>\n' +
- ' <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + getStatus(v.tgStatus) + '</div>\n' +
- ' <div class="weui-textarea-counter">\n' + '</div></div>\n' +
- ' </a>');
- }
- //点击我的团购按钮
- function buyGroup2() {
- $('#buy_nav1')[0].style.display = 'none';
- $('#buyListGroup')[0].style.display = 'none';
- $('#buyAll')[0].style.display = 'none';
- $('#buy_nav2')[0].style.display = '';
- $('#MyBuyAll').empty();
- $.ajax({
- url: '/home/Mygroup/group',
- type: 'get',
- data: {userId: $('#userId').val()},
- success: function (data) {
- if (data.success) {
- if (data.data.length > 0) {
- hasData = true;
- data.data.forEach(function (v) {
- MybuyList(v);
- });
- }
- else {
- }
- }
- },
- });
- }
- function MybuyList(v) {
- $('#MyBuyAll').append('<a href="javascript:void(0);" style="color: grey;font-size: large" data-id="form" onclick=\'myBuyClick2(' + JSON.stringify(v) + ')\'>\n' +
- ' <div style="display: flex; flex-direction: row; text-align: center; font-size: x-small; line-height: 4vh;">\n' +
- ' <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px;text-align: left;">' + v.tgTitle + '</div>\n' +
- ' <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + timestampY(v.timeCreate) + '</div>\n' +
- ' <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + getStatus(v.tgStatus) + '</div>\n' +
- ' </div>\n' + ' </a>')
- }
- function myBuyClick2(v) {
- if (v.buyStatus != 1) {
- return $.alert("该订单已经取消");
- }
- window.location.href = "/home/buytc.html?userId=" + $('#userId').val() + "&jmId=" + v.jmId + "&type=" + 2 + "&tgStatus=" + v.tgStatus + "&buyId=" + v.buyId;
- }
- /*居民求助信息*/
- function myBuyClick(v) {
- window.location.href = "/home/buytc.html?userId=" + $('#userId').val() + "&jmId=" + v.jmId + "&type=" + 1 + "&tgStatus=" + v.tgStatus + "&buyId=" + 1;
- }
- function tugouStatus(status) {
- if (status == 1) {
- return "<span style='color:Black;'>在团</span>";
- } else if (status == 2) {
- return "<span style='color:Black;'>处理中</span>";
- } else {
- return "<span style='color:green;'>已完成</span>";
- }
- }
- //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>";
- }
- }
- function timestampY(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 M + D + h + m;
- }
- //保留月日时间
- function sub(v) {
- return v.substring(5, v.length);
- }
- //角色
- function type(v) {
- if (v == 0) {
- return "管理员";
- } else {
- return "指挥部";
- }
- }
- </script>
|