#
whycq
2023-11-22 3913b3c5c8cde03f8c92d1c738d28c4a9bae7e55
pages/business/goBusiness/goBusinessDetil.vue
@@ -14,6 +14,12 @@
            </view>
         </view>
      </view>
      <view class="floor">
         <view class="wran">删除</view>
         <view class="default" v-show="settle == 1">修改</view>
         <view class="primary" @click="submit()">{{subTitle}}</view>
      </view>
   </view>
</template>
@@ -21,6 +27,8 @@
   export default {
      data() {
         return {
            settle: 1,
            subTitle: '申请报销',
            list: [{
               businessTripReasons: '沟通立库事宜',
               businessTransportation$: '交通工具',
@@ -64,16 +72,16 @@
               },
               {
                  label: "结束日期",
                  attribute: "businessStartTimeDay$",
                  attribute: "businessEndTimeDay$",
               },
               
               {
                  label: "出差时长",
                  attribute: "businessStartTimeDay$",
                  attribute: "businessDuration$",
               },
               {
                  label: "出差天数",
                  attribute: "businessEndTimeDay$",
                  attribute: "businessTripDays$",
               },
               {
                  label: "同行人",
@@ -104,13 +112,54 @@
      },
      onLoad(option) {
         let _this = this
         _this.list = []
         const eventChannel = this.getOpenerEventChannel();
         eventChannel.on('busunessDetl', function(data) {
            _this.list.push(data.data)
            console.log(data)
            _this.settle = data.data.settle
            if (data.data.settle == 1) {
               _this.subTitle = '审批'
            }
         })
      },
      methods: {
         submit() {
            if (this.settle == 1) {
               this.approval()
            } else {
            }
         },
         // 审批
         approval() {
            let _this = this
            uni.request({
               url: `${_this.baseUrl}/businessTrip/approval/auth`,
               header: {
                  'token': uni.getStorageSync('token'),
                  'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
               },
               method: 'POST',
               sslVerify: false,
               data: {planId: _this.list[0].id},
               success(res) {
                  res = res.data
                  // console.log(res);
                  if (res.code === 200) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                     setTimeout(()=>{
                        uni.navigateBack({})
                     },1000)
                  } else if (res.code === 500) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                  }
               }
            })
         },
         // 申请报销
         reimburse() {
         },
         back() {
            uni.navigateBack({})
         },
@@ -141,4 +190,37 @@
   .box-single-row {
      display: flex;
   }
   .floor {
      height: 100rpx;
      line-height: 100rpx;
      width: 100%;
      background-color: #fff;
      position: fixed;
      bottom: 0;
      left: 0;
      display: flex;
      align-items: center;
      text-align: center;
      letter-spacing: 10rpx;
   }
   .default {
      flex: 2;
   }
   .default:active {
      background-color: #eff0f1;
   }
   .wran {
      flex: 1;
      background-color: #ff5722;
      color: #fff;
   }
   .primary {
      flex: 2;
      background-color: #2d8cf0;
      color: #fff;
   }
   .primary:active {
      background-color: #007dea;
   }
</style>