#
whycq
2023-11-20 81ea5bc4134ec65263adcd340a4534685e8f36c3
pages/business/cstmr/csmtr.vue
@@ -3,7 +3,7 @@
      <view class="status_bar">
         <!-- 这里是状态栏 -->
      </view>
      <uni-nav-bar left-icon="left" title="甲方单位" @clickLeft="back" @clickRight="scan"  :fixed="true"
      <uni-nav-bar left-icon="left" title="信息公海" @clickLeft="back" @clickRight="scan"  :fixed="true"
         :border="false" rightWidth="160rpx" leftWidth="160rpx"
         >
         <block slot="right">
@@ -17,8 +17,11 @@
       </uni-nav-bar>
      <!-- 搜索框 -->
      <view class="search-bg">
         <uni-search-bar placeholder="客户代号/名称" bgColor="#f4f4f4"  @confirm="search" />
         <!-- <uni-search-bar placeholder="客户代号/名称" bgColor="#f4f4f4"  @confirm="search" /> -->
         <u-search placeholder="客户代号/名称" v-model="keyword" :clearabled="true" @custom="search()"></u-search>
      </view>
      <view>
         <!-- 客户列表 -->
         <view class="c-list" @click="getDetails(item.id)" v-for="(item,index) in csmtrList" :key="index">
@@ -52,12 +55,13 @@
   export default { 
      data() {
         return {
            keyword: '',
            csmtrList: [],
            last_id: '',
            user: {
               username: '',
               id: 0,
               type: ''
               type: 'user_id'
            },
            userid: 0,
            reload: false,
@@ -72,21 +76,20 @@
         }
      },
      onShow() {
         let that = this
         uni.$on('isRefresh',function(data){
            console.log(data);
            that.user.username = data.title
            that.user.id = data.id
            that.user.type = data.key
            that.falg = false
         })
         setTimeout(()=> {
            this.getCsmtr1()
         },50)
         if (this.falg) {
            this.getDetail()
         }
         setTimeout(()=> {
            this.getCsmtr1()
         },50)
      },
      onReachBottom() {
         this.status = 'more';
@@ -96,8 +99,11 @@
         async getDetail() {
            let res = await user.getDetail()
            if (res.code === 200) {
               console.log(res);
               this.user.username = res.data.username
               this.user.id = res.data.id
               this.type = res.data.type
            } else if (res.code === 403) {
               this.backLogin(res)
            }
@@ -109,7 +115,6 @@
         },
         open() {
            this.show = true 
            console.log(this.columns);
         },
         getUserTree() {
            let _this = this
@@ -133,6 +138,7 @@
         getCsmtr1(e) {
            let that = this
            that.csmtrList = []
            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}
@@ -147,7 +153,6 @@
               data: param,
               method:'GET',
               success(result) {
                  console.log(result);
                  if (result.statusCode ===  404) {
                     uni.showToast({title: '请重新登录', icon: "none", position: 'top'})
                     return
@@ -178,17 +183,21 @@
                     });
                  }, 1000);
               },
               complete() {
                  uni.hideLoading()
               }
            })
         },
         getCsmtr() {
            let that = this
            uni.showLoading({})
            let param = {curr:that.curr,limit:4,dept_id: 0,user_id: 67}
            if (this.user.type == 'user_id') {
               param = {curr:1,limit:4,user_id: that.user.id}
               param = {curr:that.curr,limit:4,user_id: that.user.id}
            } else if(this.user.type == 'dept_id') {
               param = {curr:1,limit:4,dept_id: that.user.id}
               param = {curr:that.curr,limit:4,dept_id: that.user.id}
            } else {
               param = {curr:1,limit:4}
               param = {curr:that.curr,limit:4}
            }
            uni.request({
               url: that.baseUrl + '/cstmr/page/auth',
@@ -227,6 +236,9 @@
                     });
                  }, 1000);
               },
               complete() {
                  uni.hideLoading()
               }
            })
         },
         getDetails(id) {
@@ -236,7 +248,27 @@
         },
         // ---
         search() {
            let _this = this
            let param = {curr:1,limit:100,conditionName: 'name'}
            if (this.user.type == 'user_id') {
               param['user_id'] = _this.user.id
               param['condition'] = _this.keyword
            } else if(this.user.type == 'dept_id') {
               param['dept_id'] = _this.user.id
               param['condition'] = _this.keyword
            } else {
               param['condition'] = _this.keyword
            }
            uni.request({
               url: `${_this.baseUrl}/cstmr/page/auth`,
               header: {'token' : uni.getStorageSync('token'),},
               data: param,
               success(res) {
                  res = res.data
                  console.log(res);
                  _this.csmtrList = res.data.records
               }
            })
         },
         backLogin(res) {
            uni.showToast({title: res.msg, icon: "none", position: 'top'})
@@ -255,6 +287,8 @@
      height: var(--status-bar-height);
      width: 100%;
      background-color: #FFF;
      position: sticky;
      top: 0;
   }
   
   .uni-nav-bar-text {