Browse Source

我的求购筛选调整

huangb 7 years ago
parent
commit
b7cc9fe247

+ 62 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/seek_purchase_ctrl.js

@@ -29,6 +29,10 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
             } else {
                 $scope.tab = 'waitOffer';
             }
+
+          // 发布时间
+          $scope.dateArea = 'ALL';
+
           // 更换待报价状态
           $scope.vendorType = 'all'
           $scope.onVendorTypeChange = function () {
@@ -90,7 +94,6 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
                         //     }
                         // }
                       $scope.seekListData = data;
-                      console.log($scope.seekListData)
                     }).error(function (response) {
                       toaster.pop('error', response);
                     });
@@ -1169,5 +1172,63 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
             })
           }
           });
+            // 筛选
+            var _formatDate = function (date, fmt) {
+                if (!date) {
+                    return null;
+                }
+                if (typeof date === 'string') {
+                    date = new Date(Date.parse(date.replace(/-/g, '/')));
+                }
+                var o = {
+                    'M+': date.getMonth() + 1, // 月份
+                    'd+': date.getDate(), // 日
+                    'h+': date.getHours(), // 小时
+                    'm+': date.getMinutes(), // 分
+                    's+': date.getSeconds(), // 秒
+                    'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
+                    'S': date.getMilliseconds() // 毫秒
+                }
+                if (/(y+)/.test(fmt)) {
+                    fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
+                }
+                for (var k in o) {
+                    if (new RegExp('(' + k + ')').test(fmt)) {
+                        fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)));
+                    }
+                }
+                return fmt;
+            }
+
+            var _getClearDay = function (date) {
+                return new Date(_formatDate(date, 'yyyy-MM-dd')).getTime() - 8 * 60 * 60 * 1000
+            }
+
+            $scope.setFilters = function (type, val) {
+                $scope[type] = val;
+                if (type == 'dateArea') {
+                    // 时间筛选
+                    var currentTime = _getClearDay(new Date());
+                    var endDate = new Date(currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
+                    if (val == 'ALL' || val == 'autoDay') {
+                        $scope.startDate = null;
+                        $scope.endDate = null;
+                    } else if (val == 'oneDay') {
+                        $scope.startDate = new Date(currentTime - 24 * 60 * 60 * 1000);
+                        $scope.endDate = endDate;
+                    } else if (val == 'threeDay') {
+                        $scope.startDate = new Date(currentTime - 3 * 24 * 60 * 60 * 1000);
+                        $scope.endDate = endDate;
+                    } else if (val == 'sevenDay') {
+                        $scope.startDate = new Date(currentTime - 7 * 24 * 60 * 60 * 1000);
+                        $scope.endDate = endDate;
+                    } else {
+                        $scope.startDate = null;
+                        $scope.endDate = null;
+                    }
+                }
+                $scope.seekPurchaseTableParams.page(1);
+                $scope.seekPurchaseTableParams.reload();
+            }
         }]);
 });

+ 154 - 43
src/main/webapp/resources/view/usercenter/forstore/seekPurchase.html

@@ -125,14 +125,14 @@
         line-height: 32px;
         clear: both;
         background: #f5f8fe;
-        height: 40px;
+        /*height: 40px;*/
         margin-bottom: 15px;
         padding-top: 4px;
         padding-right: 13px;
     }
-    .seek-purchase .screen .fl {
-        margin-left: 14px;
-    }
+    /*.seek-purchase .screen .fl {*/
+        /*margin-left: 14px;*/
+    /*}*/
     .seek-purchase .screen .fl select{
         width: 88px;
         height: 32px;
@@ -149,11 +149,11 @@
     .seek-purchase .screen .sreach input{
         border: #5078cb 1px solid;
         height: 32px;
-        width: 267px;
+        width: 193px;
         box-shadow: none;
     }
     .seek-purchase .screen .sreach .date{
-        margin-right: 6px;
+        margin-right: 42px;
     }
     .seek-purchase .screen .sreach .date input{
         width: 117px;
@@ -919,6 +919,32 @@
         border: 1px solid #5078cb;
         color: #333;
     }
+    /*筛选按钮*/
+    .check-filter {
+        height: auto;
+        line-height: 30px;
+        padding-left: 22px;
+        margin-top: 0;
+    }
+    .check-filter .sreach input {
+        width: 147px;
+    }
+    .check-filter .radio-block {
+        display: inline-block;
+        font-size: 14px;
+        width: 33.3%;
+    }
+    .check-filter .radio-block.date-radio {
+        width: 45%;
+    }
+    .check-filter .radio-block .com-check-radio {
+        font-weight: normal;
+        color: #666;
+        margin-right: 13px;
+    }
+    .check-filter .radio-block .com-check-radio:last-child {
+        margin-right: 0;
+    }
 </style>
 <div class="user_right fr seek-purchase">
     <!--求购询价-->
@@ -1006,56 +1032,141 @@
         </div>
         <div class="empty-line"></div>
         <!--搜索时间筛选-->
-        <div class="screen">
-            <div class="fl">
-                <!--
-                <label class="com-check-box">
-                    <input type="checkbox" id="1" ng-model="isMallGoods" ng-change="onSearch()">
-                    <label for="1"></label>
-                </label>&nbsp;有现货&nbsp;&nbsp;-->
-                <!--
-                截止时间&nbsp;
-                <select class="form-control select-adder" ng-model="overdue" ng-change="onSearch()" ng-init="overdue='0'">
-                    <option value="0">全部</option>
-                    <option value="1">已截止</option>
-                    <option value="正在生效">正在生效</option>
-                </select>
-                -->
+        <div>
+            <!--<div class="screen">-->
+                <!--<div class="fl">-->
+                    <!--&lt;!&ndash;-->
+                    <!--<label class="com-check-box">-->
+                        <!--<input type="checkbox" id="1" ng-model="isMallGoods" ng-change="onSearch()">-->
+                        <!--<label for="1"></label>-->
+                    <!--</label>&nbsp;有现货&nbsp;&nbsp;&ndash;&gt;-->
+                    <!--&lt;!&ndash;-->
+                    <!--截止时间&nbsp;-->
+                    <!--<select class="form-control select-adder" ng-model="overdue" ng-change="onSearch()" ng-init="overdue='0'">-->
+                        <!--<option value="0">全部</option>-->
+                        <!--<option value="1">已截止</option>-->
+                        <!--<option value="正在生效">正在生效</option>-->
+                    <!--</select>-->
+                    <!--&ndash;&gt;-->
+                <!--</div>-->
+                <!--<div>-->
+
+                <!--</div>-->
+                <!--<div class="sreach fr">-->
+                    <!--<span ng-show="tab == 'waitOffer'">求购筛选</span>-->
+                    <!--<select ng-show="tab == 'waitOffer'" class="form-control select-adder vendor-type" ng-model="vendorType" ng-change="onVendorTypeChange(vendorType)">-->
+                        <!--<option value="all">全部</option>-->
+                        <!--<option value="self">未截止</option>-->
+                        <!--<option value="end">已截止</option>-->
+                    <!--</select>-->
+                    <!--<span>发布时间&nbsp;</span>-->
+                    <!--<div class="date fl">-->
+                        <!--<div class="data-input">-->
+                            <!--<input type="text" ng-model="startDate"-->
+                                   <!--class="form-control select-adder" placeholder="起始时间"-->
+                                   <!--datepicker-popup="yyyy-MM-dd"-->
+                                   <!--is-open="condition.startDateOpen"-->
+                                   <!--max-date="endDate" current-text="今天" clear-text="清除" close-text="关闭"-->
+                                   <!--ng-click="openDatePicker($event, condition, 'startDateOpen',1)"-->
+                                   <!--datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"-->
+                                   <!--ng-change="vaildDate(true)"-->
+                            <!--/>-->
+                            <!--<button class="open" ng-click="openDatePicker($event, condition, 'startDateOpen')"></button>-->
+                        <!--</div>-->
+
+                        <!--<em>–</em>-->
+                        <!--<div class="data-input">-->
+                            <!--<input type="text" ng-model="endDate"-->
+                                   <!--class="form-control select-adder" placeholder="结束时间"-->
+                                   <!--datepicker-popup="yyyy-MM-dd"-->
+                                   <!--is-open="condition.endDateOpen"-->
+                                   <!--min-date="startDate" current-text="今天" clear-text="清除" close-text="关闭"-->
+                                   <!--ng-click="openDatePicker($event, condition, 'endDateOpen',2)"-->
+                                   <!--datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"-->
+                                   <!--ng-change="changeEndDate()"-->
+                            <!--/>-->
+                            <!--<button class="open" ng-click="openDatePicker($event, condition, 'endDateOpen')"></button>-->
+                        <!--</div>-->
+                    <!--</div>-->
+                    <!--<div class="sreach-input fr">-->
+                        <!--<input type="search" placeholder="品牌/物料名称/型号" class="form-control" ng-model="keyWord" ng-search="onSearch()"/>-->
+                        <!--<a class="seek" href="javascript:void(0)" ng-click="onSearch()">搜索</a>-->
+                    <!--</div>-->
+                <!--</div>-->
+            <!--</div>-->
+        </div>
+        <div class="screen check-filter">
+            <div class="radio-block" ng-show="tab == 'waitOffer'" style="display: block;">
+                求购筛选:
+                <label class="com-check-radio">
+                    <input type="radio" id="methodAll" name="method" ng-click="setFilters('vendorType', 'all')" ng-checked="vendorType == 'all'">
+                    <label for="methodAll"></label>
+                    全部
+                </label>
+                <label class="com-check-radio">
+                    <input type="radio" id="forSeller" name="method" ng-click="setFilters('vendorType', 'self')" ng-checked="vendorType == 'self'">
+                    <label for="forSeller"></label>
+                    未截止
+                </label>
+                <label class="com-check-radio">
+                    <input type="radio" id="forPlatform" name="method" ng-click="setFilters('vendorType', 'end')" ng-checked="vendorType == 'end'">
+                    <label for="forPlatform"></label>
+                    已截止
+                </label>
+            </div>
+            <div class="radio-block date-radio">
+                发布时间:
+                <label class="com-check-radio">
+                    <input type="radio" id="dateAll" name="date" ng-click="setFilters('dateArea', 'ALL')" ng-checked="dateArea == 'ALL'">
+                    <label for="dateAll"></label>
+                    全部
+                </label>
+                <label class="com-check-radio">
+                    <input type="radio" id="oneDay" name="date" ng-click="setFilters('dateArea', 'oneDay')" ng-checked="dateArea == 'oneDay'">
+                    <label for="oneDay"></label>
+                    近1天
+                </label>
+                <label class="com-check-radio">
+                    <input type="radio" id="threeDay" name="date" ng-click="setFilters('dateArea', 'threeDay')" ng-checked="dateArea == 'threeDay'">
+                    <label for="threeDay"></label>
+                    近3天
+                </label>
+                <label class="com-check-radio">
+                    <input type="radio" id="sevenDay" name="date" ng-click="setFilters('dateArea', 'sevenDay')" ng-checked="dateArea == 'sevenDay'">
+                    <label for="sevenDay"></label>
+                    近7天
+                </label>
+                <label class="com-check-radio">
+                    <input type="radio" id="autoDay" name="date" ng-click="setFilters('dateArea', 'autoDay')" ng-checked="dateArea == 'autoDay'">
+                    <label for="autoDay"></label>
+                    自定义
+                </label>
             </div>
             <div class="sreach fr">
-                <span ng-show="tab == 'waitOffer'">求购筛选</span>
-                <select ng-show="tab == 'waitOffer'" class="form-control select-adder vendor-type" ng-model="vendorType" ng-change="onVendorTypeChange(vendorType)">
-                    <option value="all">全部</option>
-                    <option value="self">未截止</option>
-                    <option value="end">已截止</option>
-                </select>
-                <span>发布时间&nbsp;</span>
-                <div class="date fl">
+                <div class="date fl" ng-show="dateArea == 'autoDay'">
                     <div class="data-input">
-                        <input type="text" ng-model="startDate"
+                        <input id="start" type="text" ng-model="startDate" readonly="readonly"
                                class="form-control select-adder" placeholder="起始时间"
                                datepicker-popup="yyyy-MM-dd"
-                               is-open="condition.startDateOpen"
-                               max-date="endDate" current-text="今天" clear-text="清除" close-text="关闭"
-                               ng-click="openDatePicker($event, condition, 'startDateOpen',1)"
+                               is-open="condition[0].open"
+                               current-text="今天" clear-text="清除" close-text="关闭"
                                datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-                               ng-change="vaildDate(true)"
-                        />
-                        <button class="open" ng-click="openDatePicker($event, condition, 'startDateOpen')"></button>
+                               ng-click="openDatePicker($event, condition, 0,1)"
+                               ng-change="onDateCondition(1)"/>
+                        <button class="open" ng-click="openDatePicker($event, condition, 0)"></button>
                     </div>
 
                     <em>–</em>
                     <div class="data-input">
-                        <input type="text" ng-model="endDate"
+                        <input id="end" type="text" ng-model="endDate" readonly="readonly"
                                class="form-control select-adder" placeholder="结束时间"
                                datepicker-popup="yyyy-MM-dd"
-                               is-open="condition.endDateOpen"
-                               min-date="startDate" current-text="今天" clear-text="清除" close-text="关闭"
-                               ng-click="openDatePicker($event, condition, 'endDateOpen',2)"
+                               is-open="condition[1].open"
+                               current-text="今天" clear-text="清除" close-text="关闭"
                                datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-                               ng-change="changeEndDate()"
-                        />
-                        <button class="open" ng-click="openDatePicker($event, condition, 'endDateOpen')"></button>
+                               ng-click="openDatePicker($event, condition, 1, 2)"
+                               ng-change="onDateCondition(2)"/>
+                        <button class="open" ng-click="openDatePicker($event, condition, 1)"></button>
                     </div>
                 </div>
                 <div class="sreach-input fr">