#
whycq
2023-11-20 f14e736c5448da6a5433da12be8f7e64617cf0f7
pages/business/goBusiness/goBusiness.vue
@@ -40,14 +40,16 @@
</template>
<script>
   import user from '@/pages/api/user/user.js'
   export default {
      data() {
         return {
            user: {
               username: '杨成强',
               username: '',
               id: 0,
               type: ''
            },
            falg: true,
            list: [{
                  businessTripReasons: '沟通立库事宜',
                  businessTransportation$: '交通工具',
@@ -72,9 +74,32 @@
         }
      },
      onShow() {
         this.getBusinessTrip()
         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.getBusinessTrip()
         },50)
         if (this.falg) {
            this.getDetail()
         }
      },
      methods: {
         async getDetail() {
            let res = await user.getDetail()
            console.log(res);
            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',
@@ -87,11 +112,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) {