#
whycq
2023-11-22 3913b3c5c8cde03f8c92d1c738d28c4a9bae7e55
pages/business/goBusiness/goBusiness.vue
@@ -14,6 +14,11 @@
            </view>
         </block>
      </uni-nav-bar>
      <!-- 搜索框 -->
      <view class="search-bg">
         <u-search placeholder="输入" v-model="keyword" :clearabled="true" @custom="search()" @search="search()"></u-search>
      </view>
      <view class="main-box">
         <view class="box" v-for="item in list" @click="goDetl(item)">
@@ -29,6 +34,11 @@
            </view>
         </view>
      </view>
      <u-empty v-if="true" icon="../../../static/image/emptyList.png" v-show="list.length <= 0" />
      <view class="fxbtn">
         <uni-icons type="plusempty" color="#fff" @click="add()" ></uni-icons>
      </view>
      <!-- 垫底 -->
      <view style="height: 120rpx;"></view>
@@ -36,14 +46,17 @@
</template>
<script>
   import user from '@/pages/api/user/user.js'
   export default {
      data() {
         return {
            keyword: '',
            user: {
               username: '杨成强',
               username: '',
               id: 0,
               type: ''
            },
            falg: true,
            list: [{
                  businessTripReasons: '沟通立库事宜',
                  businessTransportation$: '交通工具',
@@ -68,9 +81,30 @@
         }
      },
      onShow() {
         this.getBusinessTrip()
         let that = this
         uni.$on('isRefresh',function(data){
            that.user.username = data.title
            that.user.id = data.id
            that.user.type = data.key
            that.falg = false
         })
         setTimeout(()=> {
            this.getBusinessTrip()
         },50)
         if (this.falg) {
            this.getDetail()
         }
      },
      methods: {
         async getDetail() {
            let res = await user.getDetail()
            if (res.code === 200) {
               this.user.username = res.data.username
               this.user.id = res.data.id
            } else if (res.code === 403) {
               this.backLogin(res)
            }
         },
         goDetl(e) {
            uni.navigateTo({
               url: '/pages/business/goBusiness/goBusinessDetil',
@@ -83,11 +117,20 @@
         },
         getBusinessTrip() {
            let _this = this
            let param = {curr:1,limit:16,dept_id: 0,user_id: 67}
            if (_this.user.type == 'user_id') {
               param = {curr:1,limit:16,user_id: _this.user.id}
            } else if(_this.user.type == 'dept_id') {
               param = {curr:1,limit:16,dept_id: _this.user.id}
            } else {
               param = {curr:1,limit:16}
            }
            uni.request({
               url: `${_this.baseUrl}/businessTrip/list/auth`,
               header: {
                  'token': uni.getStorageSync('token')
               },
               data: param,
               success(res) {
                  res = res.data
                  if (res.code === 200) {
@@ -104,6 +147,17 @@
               }
            })
         },
         // 出差申请
         add() {
            uni.navigateTo({
               url: '/pages/business/goBusiness/addgoBusiness',
               success: function(res) {
                  res.eventChannel.emit('goBusinessDel', {
                     data: 'add'
                  })
               }
            })
         },
         back() {
            uni.navigateBack({})
         },