Administrator 4 лет назад
Родитель
Сommit
c651ad73e2

+ 1 - 1
src/main/resources/static/css/supplier-center/message.css

@@ -20,7 +20,7 @@ li{list-style:none}
     .content .section .section-content .new-list .text p{line-height: 36px;font-size: 14px;color: #627386;float: left;width: 600px;overflow: hidden;word-wrap: normal;vertical-align: middle;text-overflow: ellipsis}
     .content .section .section-content .new-list .time{line-height: 36px;font-size: 14px;color: #b8bfca;float: right;}
     .check{float: left;margin: 8px}
-    .notclick{pointer-events: none;opacity: .6}
+    .notclick{opacity: .6}
 }
 
 /**

+ 1 - 1
src/main/resources/static/css/user-center/message.css

@@ -21,7 +21,7 @@ li{list-style:none}
     .content .section .section-content .new-list .text p{width: 600px;line-height: 36px;font-size: 14px;color: #627386;float: left;overflow: hidden;text-overflow: ellipsis;}
     .content .section .section-content .new-list .time{line-height: 36px;font-size: 14px;color: #b8bfca;float: right;}
     .check{float: left;margin: 8px}
-    .notclick{pointer-events: none;opacity: .6}
+    .notclick{opacity: .6}
 }
 
 /**

+ 79 - 5
src/main/resources/static/js/supplier-center/message.js

@@ -4,23 +4,71 @@ var helpSuggestion = new Vue({
     data: {
         btnLoading: false,
         isRequset:false,
-        userID: 0,
+        listQuery:{
+            userId: '',
+            pageNum:1,
+            pageSize:10,
+        },
+        noMore:false,
+        listRecord: 0,
+        pageInput: '1',
         degree:'',
         isCheckedAll:false,
         messagesList:[],//新闻动态
         check:false,
         checklist:[],
         msgId:'',
+    },
+     computed: {
+        pageTotal: function () {
+            var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
+            return total > 0 ? total : 1;
+        },
+        showPageBtn: function () {
+            var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
+            total = total > 0 ? total : 1;
+            var index = this.listQuery.pageNum, arr = [];
+            if (total <= 6) {
+                for (var i = 1; i <= total; i++) {
+                    arr.push(i);
+                }
+                return arr;
+            }
+            if (index <= 3) return [1, 2, 3, 4, 5, 0, total];
+            if (index >= total - 2) return [1, 0, total - 4, total - 3, total - 2, total - 1, total];
+            return [1, 0, index - 2, index - 1, index, index + 1, index + 2, 0, total];
+        }
     },
     methods: {
+         toPagination: function (pageNum) {//点击切换分页
+            if (pageNum <= this.pageTotal) {
+                this.listQuery.pageNum = pageNum;
+                this. GetMyPcMymessageInfo();
+            }
+        },
+        checkNum: function () {//输入跳转分页
+            if (this.pageInput > this.pageTotal) {
+                this.pageInput = this.pageTotal;
+            } else if (this.pageInput < 1) {
+                this.pageInput = 1;
+            }
+        },
         GetMyPcCenterInfo:function(){
             var _self = this;
-           SupplierApi.GetMymessageList({userId:_self.userID},function (response) {
+           SupplierApi.GetMymessageList(_self.listQuery,function (response) {
                 if(response.code == 0){
-                    _self.messagesList = response.data;
-                    _self.isRequset = false;
+                var data = response.data;
+                  if (data.results.length>0){
+                         _self.messagesList = data.results;
+                         _self.listRecord =  data.totalRecord;
+                         _self.requestFlag = true;
+                     }else {
+                     _self.requestFlag = false;
+                      _self.listRecord =  data.totalRecord;
+                     }
                 }else{
                     CAIMEI.Alert(response.msg, '确定', false);
+                    _self.requestFlag = false;
                 }
             })
         },
@@ -107,8 +155,34 @@ var helpSuggestion = new Vue({
     },
     mounted: function () {
         if(globalUserData){
-            this.userID = globalUserData.userId;
+            this.listQuery.userId = globalUserData.userId;
             this.GetMyPcCenterInfo();
         }
+         if(!isPC){
+            $('footer').addClass("noneImportant");
+            //移动端上垃加载更多
+            $(window).on('scroll', function(){
+                var scrollTop = $(this).scrollTop();
+                var scrollHeight = $(document).height();
+                var windowHeight = window.innerHeight;
+                if (scrollTop + windowHeight >= scrollHeight) {
+                    //此处是滚动条到底部时候触发的事件,在这里写要加载的数据,或者是拉动滚动条的操作
+                    var totalPage = Math.ceil(_self.listRecord / _self.listQuery.pageSize)?Math.ceil(_self.listRecord / _self.listQuery.pageSize):1;
+                    var next = _self.listQuery.pageNum+1;
+                    if(next <= totalPage){
+                        if (_self.requestFlag){
+                            _self.listQuery.pageNum = next;
+                            // 获取列表数据
+                            _self.GetMyPcMymessageInfo();
+                        }
+                        _self.requestFlag = false;
+                    }else{
+                        //到底了
+                        _self.noMore = true;
+                        $('footer').removeClass("noneImportant");
+                    }
+                }
+            });
+        }
     }
 });

+ 86 - 8
src/main/resources/static/js/user-center/message.js

@@ -4,25 +4,74 @@ var helpSuggestion = new Vue({
     data: {
         btnLoading: false,
         isRequset:true,
-        userId: '',
+        listQuery:{
+            userId: '',
+            pageNum:1,
+            pageSize:10,
+        },
+        noMore:false,
+        listRecord: 0,
+        pageInput: '1',
         degree:'',
         isCheckedAll:false,
         messagesList:[],//消息列表
         check:false,
         checklist:[],
         msgId:'',
+    },
+     computed: {
+        pageTotal: function () {
+            var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
+            return total > 0 ? total : 1;
+        },
+        showPageBtn: function () {
+            var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
+            total = total > 0 ? total : 1;
+            var index = this.listQuery.pageNum, arr = [];
+            if (total <= 6) {
+                for (var i = 1; i <= total; i++) {
+                    arr.push(i);
+                }
+                return arr;
+            }
+            if (index <= 3) return [1, 2, 3, 4, 5, 0, total];
+            if (index >= total - 2) return [1, 0, total - 4, total - 3, total - 2, total - 1, total];
+            return [1, 0, index - 2, index - 1, index, index + 1, index + 2, 0, total];
+        }
     },
     methods: {
+         toPagination: function (pageNum) {//点击切换分页
+            if (pageNum <= this.pageTotal) {
+                this.listQuery.pageNum = pageNum;
+                this. GetMyPcMymessageInfo();
+            }
+        },
+        checkNum: function () {//输入跳转分页
+            if (this.pageInput > this.pageTotal) {
+                this.pageInput = this.pageTotal;
+            } else if (this.pageInput < 1) {
+                this.pageInput = 1;
+            }
+        },
+
         GetMyPcMymessageInfo:function(){
             var _self = this;
-            UserApi.GetMymessageList({userId:_self.userId},function (response) {
+            UserApi.GetMymessageList(_self.listQuery,function (response) {
                 if(response.code == 0){
-                    var data = response.data;
-                    _self.messagesList = response.data;
+                     if (response.data.results.length>0){
+                      var data = response.data;
+                         _self.messagesList = data.results;
+                         _self.listRecord =  data.totalRecord;
+                         _self.requestFlag = true;
+                     }else {
+                     _self.requestFlag = false;
+                      _self.listRecord =  data.totalRecord;
+                     }
 
-                    _self.isRequset = false;
+                     _self.isRequset = false;
                 }else{
                     CAIMEI.Alert(response.msg, '确定', false);
+                     _self.requestFlag = false;
                 }
             })
         },
@@ -69,7 +118,8 @@ var helpSuggestion = new Vue({
              }else {
                 PublicApi.deleteMessage({messageIds:_this.msgId},function (res) {
                     if (res.code==0){
-                      CAIMEI.dialog('刪除成功')
+                      CAIMEI.dialog('刪除成功');
+                       location.reload()
                     }else {
                       CAIMEI.Alert(res.msg, '确定', false);
                     }
@@ -87,7 +137,8 @@ var helpSuggestion = new Vue({
             }else {
                      PublicApi.markAsRead({messageIds:_this.msgId},function (res) {
                     if(res.code==0){
-                     CAIMEI.dialog('已读成功')
+                     CAIMEI.dialog('已读成功');
+                     location.reload()
                     }else {
                      CAIMEI.Alert(res.msg, '确定', false);
                     }
@@ -106,9 +157,36 @@ var helpSuggestion = new Vue({
 
     },
     mounted: function () {
+        var _self=this;
         if(globalUserData){
-            this.userId = globalUserData.userId;
+            this.listQuery.userId = globalUserData.userId;
             this.GetMyPcMymessageInfo();
         }
+        if(!isPC){
+            $('footer').addClass("noneImportant");
+            //移动端上垃加载更多
+            $(window).on('scroll', function(){
+                var scrollTop = $(this).scrollTop();
+                var scrollHeight = $(document).height();
+                var windowHeight = window.innerHeight;
+                if (scrollTop + windowHeight >= scrollHeight) {
+                    //此处是滚动条到底部时候触发的事件,在这里写要加载的数据,或者是拉动滚动条的操作
+                    var totalPage = Math.ceil(_self.listRecord / _self.listQuery.pageSize)?Math.ceil(_self.listRecord / _self.listQuery.pageSize):1;
+                    var next = _self.listQuery.pageNum+1;
+                    if(next <= totalPage){
+                        if (_self.requestFlag){
+                            _self.listQuery.pageNum = next;
+                            // 获取列表数据
+                            _self.GetMyPcMymessageInfo();
+                        }
+                        _self.requestFlag = false;
+                    }else{
+                        //到底了
+                        _self.noMore = true;
+                        $('footer').removeClass("noneImportant");
+                    }
+                }
+            });
+        }
     }
 });

+ 1 - 1
src/main/resources/static/js/user-center/repair/repair.js

@@ -46,7 +46,7 @@ var repairForm = new Vue({
                   console.log(_self.postData)
                  UserApi.Maintenance(_self.postData,function (res) {
                         if(res.code==0){
-                         CAIMEI.dialog('申请成功')
+                         CAIMEI.dialog('提交成功, 客服会在1-2个工作日内与您联系,请保持电话畅通')
                         }else {
                          CAIMEI.Alert(res.msg, '确定', false);
                         }

+ 1 - 1
src/main/resources/templates/supplier-center/message/list.html

@@ -37,7 +37,7 @@
                             </div>
                         </div>
                         <div class="section-content" v-if="messagesList.length > 0">
-                            <div class="new-list" v-for="(item, index) in messagesList" :key="index" :class="item.readFlag?'notclick':''">
+                            <div class="new-list" v-for="(item, index) in messagesList" :key="index" :class="item.readFlag==1?'notclick':''">
                                 <div class="text">
                                  <input type="checkbox"  class="check" v-model="item.check" @change="checkedItemFn(item)" />
                                     <p>{{item.content}}</p>

+ 15 - 1
src/main/resources/templates/user-center/message/list.html

@@ -40,7 +40,7 @@
                             </div>
                         </div>
                         <div class="section-content" v-if="messagesList.length > 0">
-                            <div class="new-list" v-for="(item, index) in messagesList" :key="index" :class="item.readFlag?'notclick':''">
+                            <div class="new-list" v-for="(item, index) in messagesList" :key="index" :class="item.readFlag==1?'notclick':''">
                                 <div class="text">
                                     <input type="checkbox"  class="check" v-model="item.check" @change="checkedItemFn(item)" />
                                     <p>{{item.content}}</p>
@@ -64,6 +64,20 @@
                          <a href="javascript:void(0);" class="btn" @click="deleteMessageFn">删除</a>
                     </div>
                  </div>
+                 <div v-if="(!isPC) && noMore" class="noMore">---- 没有更多了 ----</div>
+                <div v-if="isPC && pageTotal>1" class="pageWrap clear">
+                    <a v-if="listQuery.pageNum>1" class="prev" @click="toPagination(listQuery.pageNum*1-1)" href="javascript:void(0);"></a>
+                    <template v-for="n in showPageBtn">
+                        <a v-if="n" :class="{'on':(n==listQuery.pageNum)}" @click="toPagination(n)" href="javascript:void(0);" v-text="n"></a>
+                        <span v-else>···</span>
+                    </template>
+                    <a v-if="listQuery.pageNum<pageTotal" class="next" @click="toPagination(listQuery.pageNum*1+1)" href="javascript:void(0);"></a>
+                    <span>共<b v-text="pageTotal>1?pageTotal:1"></b>页</span>
+                    <span>跳至</span>
+                    <input v-model="pageInput" @blur="checkNum()"/>
+                    <span>页</span>&nbsp;
+                    <a class="btn" href="javascript:void(0);" @click="toPagination(pageInput)">点击跳转</a>
+                </div>
             </div>
         </div>
     </div>

+ 1 - 0
src/main/resources/templates/user-center/order/logistics.html

@@ -74,6 +74,7 @@
                          </div>
                     </div>
                 </div>
+
             </div>
         </div>
     </div>