#
zjj
2024-04-07 e6a02c8b09a796e436a501e9b87d19e25c34c9d1
pages/business/plan/plan.vue
@@ -101,6 +101,7 @@
      <view class="fxbtn">
         <uni-icons type="plusempty" color="#fff" @click="gotoggle()" ></uni-icons>
      </view>
      <uni-load-more :status="status" :icon-size="16" :content-text="contentText" />
   </view>
</template>
@@ -113,7 +114,7 @@
            user: {
               username: '',
               id: 0,
               type: 'user_id'
               type: ''
            },
            falg: true,
            csmtrList: [],
@@ -153,7 +154,12 @@
                  name:'平库',
                  value: 6
               },
            ]
               {
                  name:'其他',
                  value: 7
               },
            ],
            param: {curr:1,limit:4}
         }
      },
      onLoad() {
@@ -171,7 +177,7 @@
            this.getDetail()
         }
         setTimeout(()=> {
            this.getCsmtr1()
            this.getList()
         },50)
      },
      onReachBottom() {
@@ -192,23 +198,79 @@
            this.toggle('right')
         },
         add(val) {
            let addPlan = 'addPlan'
            let addPlan = 'addPlan',_this = this
            if (val > 1) {
               addPlan = 'addPlan' + val
            }
            uni.navigateTo({
               url:'/pages/business/plan/' + addPlan,
               success() {
                  _this.$refs.popup.close()
               }
            })
         },
         toggle(type) {
            this.type = type
            // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
            this.$refs.popup.open(type)
         },
         getList() {
            let that = this
            that.csmtrList = []
            uni.showLoading()
            if (this.user.type == 'user_id') {
               that.param = {curr:1,limit:4,user_id: that.user.id}
            } else if(this.user.type == 'dept_id') {
               that.param = {curr:1,limit:4,dept_id: that.user.id}
            }
            uni.request({
               url: that.baseUrl + '/plan/page/auth',
               header: {'token' : uni.getStorageSync('token'),},
               data: that.param,
               method:'GET',
               success(result) {
                  console.log(result);
                  if (result.statusCode ===  404) {
                     uni.showToast({title: '请重新登录', icon: "none", position: 'top'})
                     return
                  }
                  var res = result.data
                  if (res.code === 200) {
                     let list = res.data.records
                     that.csmtrList = that.reload ? list : that.csmtrList.concat(list);
                     if (res.data.records.length == 0) {
                        that.status = 'noMore'
                     }
                  } else if (res.code === 403) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../../login/login'
                        });
                     }, 1000);
                  } else {
                     uni.showToast({title: res.msg, icon: "none",position: 'top'})
                  }
               },
               fail(result) {
                  uni.showToast({title: '请求失败'})
                  setTimeout(() => {
                     uni.reLaunch({
                        url: '../../login/login'
                     });
                  }, 1000);
               },
               complete() {
                  uni.hideLoading()
               }
            })
         },
         getCsmtr1(e) {
            let that = this
            that.csmtrList = []
            uni.showLoading({})
            uni.showLoading()
            let param = {curr:1,limit:4,dept_id: 0,user_id: 67}
            if (this.user.type == 'user_id') {
               param = {curr:1,limit:4,user_id: that.user.id}
@@ -217,12 +279,14 @@
            } else {
               param = {curr:1,limit:4}
            }
            param = {curr:1,limit:4}
            uni.request({
               url: that.baseUrl + '/plan/page/auth',
               header: {'token' : uni.getStorageSync('token'),},
               data: param,
               method:'GET',
               success(result) {
                  console.log(result);
                  if (result.statusCode ===  404) {
                     uni.showToast({title: '请重新登录', icon: "none", position: 'top'})
                     return
@@ -275,6 +339,7 @@
               data: param,
               method:'GET',
               success(result) {
                  console.log(result);
                  if (result.statusCode ===  404) {
                     uni.showToast({title: '请重新登录', icon: "none", position: 'top'})
                     return
@@ -283,7 +348,10 @@
                  if (res.code === 200) {
                     let list = res.data.records
                     that.csmtrList = that.reload ? list : that.csmtrList.concat(list);
                     that.curr = that.curr + 1
                     console.log(list);
                     if (list.length > 0) {
                        that.curr = that.curr + 1
                     }
                     if (res.data.records.length == 0) {
                        that.status = 'noMore'
                     }