gx
queenwuli
2021-01-15 4b80c98ef5fda8d6358778f2efe8bb35cb20ccf9
hive-app/pages/workbench/orderList.vue
@@ -45,9 +45,13 @@
                     </view>
                  </view>
               </navigator>
               <view class="list-footer" v-if="item.orderStatus!=='已取消'">
               <view class="list-footer" v-if="item.orderStatus!=='已取消' && $utils.hasPermission('ddgl.cancel')">
                  <text class="blue-btn small-btn" @click="cancelOrder(item.orderId)">取消订单</text>
               </view>
            </view>
            <no-record :isShow="!list.length" txt="暂无订单记录"></no-record>
            <view v-if="list.length">
               <uni-load-more :status="loadStatus" color="#a5abaf"></uni-load-more>
            </view>
         </view>
      </view>
@@ -57,13 +61,16 @@
<script>
   import HTabs from "@/components/liuyuno-tabs/liuyuno-tabs.vue";
   import searchBar from '../../components/searchBar/index.vue';
   import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
   export default {
      components: {
          HTabs,
         searchBar
         searchBar,
         uniLoadMore
      },
      data() {
         return {
            queryKey: '',
            orderStatus: 0,
            tabs:[
               {
@@ -83,13 +90,39 @@
                  name: '欠款'
               },
            ],
            list: []
            list: [],
            loadStatus: 'more',
            pageNum: 1
         }  
      },
      onLoad(options) {
         if(options.status){
            this.orderStatus = Number(options.status);
         }
         if(options.queryKey){
            this.queryKey = options.queryKey;
         }
         this.loadList()
         // 判断权限
         // #ifdef APP-PLUS
         if(!this.$utils.hasPermission('ddgl.add')){
            let webView = this.$mp.page.$getAppWebview();
            webView.setTitleNViewButtonStyle(0, {
                width: 0,
            });
         }
         // #endif
      },
      onPullDownRefresh(){
         this.reloadData();
         let timer = setTimeout(function () {
            uni.startPullDownRefresh();
            clearTimeout(timer);
            timer = null;
         }, 800);
      },
      onReachBottom(){
         this.loadList()
      },
      onNavigationBarButtonTap(Object){
@@ -100,28 +133,44 @@
         }
      },
      methods:{
         reloadData(){
            this.list = [];
            this.pageNum = 1;
            this.loadStatus = 'more';
            this.loadList();
         },
         loadList(){
            if(this.loadStatus!=='more'){
               return;
            }
            this.$httpUtils.request('/api/order/findOrderList', {
               pageNum: 1,
               pageSize: 100,
               pageNum: this.pageNum,
               pageSize: 10,
               queryKey: this.queryKey,
               orderStatus: this.orderStatus
            }, 'POST').then((res) => {
               if(res.status == 200){
                  this.list = res.rows;
                  let result = res.rows;
                  if(result.length < 10){
                     this.loadStatus = 'noMore';
                  } else {
                     this.pageNum ++ ;
                     this.loadStatus = 'more';
                  }
                  this.list = this.list.concat(result);
               }
            })
         },
         search(val){
            this.queryKey = val;
            this.loadList();
            this.reloadData();
         },
         tabChange(index){
            if(this.orderStatus === index){
               return;
            }
            this.orderStatus = index;
            this.loadList();
            this.reloadData();
         },
         caculateColor(status){
            if(status==='待付款'){
@@ -140,10 +189,9 @@
                content: '确定取消订单吗?',
                success: (res) => {
                    if (res.confirm) {
                        console.log('用户点击确定');
                     this.$httpUtils.request('/api/order/cancelOrder/'+id).then((res) => {
                        if(res.status == 200){
                           this.loadList()
                           this.reloadData()
                        }
                        this.$toast.info(res.info);
                     })