123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342 |
- <template>
- <view class="detail-page" v-if="info">
- <view class="section">
- <image :src="statusImg" mode="aspectFill" class="status-img"></image>
- <!-- <view class="info-item" v-for="item in infoOpts" :key="item.key">
- <view class="label">{{item.name}}</view>
- <view class="content">
- <text v-if="item.key=='place'">{{info.Province}}{{info.City}}</text>
- <text>{{info[item.key]}}</text>
- </view>
- </view> -->
- <view class="info-item">
- <view class="label">申请人</view>
- <view class="content">
- <text>{{info.ApplyRealName}}</text>
- </view>
- </view>
- <view class="info-item">
- <view class="label">到达日期</view>
- <view class="content">
- <text>{{info.ArriveDate}}</text>
- </view>
- </view>
- <view class="info-item">
- <view class="label">返程日期</view>
- <view class="content">
- <text>{{info.ReturnDate}}</text>
- </view>
- </view>
- <view class="info-item">
- <view class="label">目的地</view>
- <view class="content">
- <text>{{info.Province}}{{info.City}}</text>
- </view>
- </view>
- <view class="info-item">
- <view class="label">出差事由</view>
- <view class="content">
- <text>{{info.Reason}}</text>
- </view>
- </view>
- <view class="info-item">
- <view class="label">交通工具</view>
- <view class="content">
- <text>{{info.Transportation.indexOf('其他')!=-1?info.Transportation.split('-')[1]:info.Transportation}}</text>
- </view>
- </view>
- <view class="info-item">
- <view class="label">行程说明</view>
- <view class="content">
- <text>{{info.Itinerary}}</text>
- </view>
- </view>
- <view class="info-item" v-if="info.PeerPeopleName">
- <view class="label">同行人</view>
- <view class="content">
- <text>{{info.PeerPeopleName}}</text>
- </view>
- </view>
- <view class="info-item">
- <view class="label">提交时间</view>
- <view class="content">
- <text>{{info.CreateTime}}</text>
- </view>
- </view>
- </view>
- <view class="section" v-if="info.Status!=='待审批'&&(info.ApproveTime||info.RefuseTime)">
- <view class="info-item">
- <view class="label">审批时间</view>
- <view class="content">{{info.ApproveTime||info.RefuseTime}}</view>
- </view>
- <view class="info-item" style="color:#C54322" v-if="info.Status==='已驳回'">
- <view class="label">驳回理由</view>
- <view class="content">{{info.RefuseReason}}</view>
- </view>
-
- </view>
- <view class="section" v-if="info.Status==='已关闭'">
- <view class="info-item">
- <view class="label">关闭时间</view>
- <view class="content">{{info.CloseTime}}</view>
- </view>
- <view class="info-item" style="color:#C54322">
- <view class="label">关闭理由</view>
- <view class="content">{{info.CloseReason}}</view>
- </view>
- </view>
-
- <view class="fix-bottom-wrap btns-wrap flex" v-if="info.ApplyAdminId==adminId&&info.Status=='待审批'">
- <button class="pass-btn" @click="handleRecall">撤回</button>
- </view>
- <view class="fix-bottom-wrap btns-wrap flex" v-if="info.ApplyAdminId==adminId&&info.Status=='已驳回'">
- <button class="pass-btn" @click="handleEdit">重新申请</button>
- </view>
- <view class="fix-bottom-wrap btns-wrap flex" v-if="info.ApplyAdminId==adminId&&info.Status=='已撤回'">
- <button class="refuse-btn" @click="handleDel">删除</button>
- <button class="pass-btn" @click="handleEdit">重新申请</button>
- </view>
- <view class="fix-bottom-wrap btns-wrap flex" v-if="info.IsApprove&&info.Status=='待审批'">
- <button class="pass-btn" @click="handlePass">通过</button>
- <button class="refuse-btn" @click="handleRefuse">驳回</button>
- </view>
- <view class="fix-bottom-wrap btns-wrap flex" v-if="info.IsClose&&info.Status=='已通过'&&!NowBigReturnDate">
- <button class="refuse-btn" @click="handleClose">关闭</button>
- </view>
- <van-dialog id="van-dialog" />
- </view>
-
- </template>
- <script>
- import {apiBusinessTripDetail,apiBusinessTripRecall,apiBusinessApplyApprove,apiDelApply} from '@/api/businessTrip/index'
- export default {
- computed:{
- adminId(){
- const userInfo=uni.getStorageSync('userInfo');
- return userInfo?JSON.parse(userInfo).AdminId:0
- },
- // 当前时间是否大于等于返回时间
- NowBigReturnDate(){
- if(!this.info) return
- const now=new Date().getTime()
- const temt=this.info.ArriveDate.replace('-','/')
- const rtime=new Date(temt).getTime()
- console.log(now,rtime);
- return now>rtime
- }
- },
- data() {
- return {
- // infoOpts:[
- // {name:'申请人',key:'ApplyRealName'},
- // {name:'到达日期',key:'ArriveDate'},
- // {name:'返程日期',key:'ReturnDate'},
- // {name:'目的地',key:'place'},
- // {name:'出差事由',key:'Reason'},
- // {name:'交通工具',key:'Transportation'},
- // {name:'同行人',key:'PeerPeopleName'},
- // {name:'提交时间',key:'CreateTime'},
- // ],
- id:0,
- info:null,
- statusImg:'',
- }
- },
- onLoad(opt){
- this.id=opt.id
- },
- onShow(){
- this.getDetail()
- },
- methods: {
- getDetail(){
- this.info=null
- this.statusImg=''
- apiBusinessTripDetail({BusinessApplyId:this.id}).then(res=>{
- if(res.code===200){
- this.info=res.data
- if(this.info.Status==='已通过'){
- this.statusImg= require('../static/pass-icon.png')
- }else if(this.info.Status==='已驳回'){
- this.statusImg= require('../static/fail-icon.png')
- }else if(this.info.Status==='已过期'){
- this.statusImg= require('../static/cancel-icon.png')
- }else if(this.info.Status==='已撤回'){
- this.statusImg= require('../static/recall-icon.png')
- }else if(this.info.Status==='已关闭'){
- this.statusImg= require('../static/close-icon.png')
- }
- }
- })
- },
- // 撤回
- handleRecall(){
- const that=this
- uni.showModal({
- title: '',
- content: '确定要撤回该出差申请吗?',
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定');
- apiBusinessTripRecall({BusinessApplyId:Number(that.id)}).then(res=>{
- if(res.code===200){
- uni.$emit('businessApproveListUpdate')
- uni.navigateBack({
- delta: 1,
- fail:()=>{
- uni.switchTab({
- url: '/pages/index/index'
- })
- }
- });
-
- }
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- },
- // 重新申请
- handleEdit(){
- uni.navigateTo({
- url:"/pages-approve/businessTrip/add?id="+this.id
- })
- },
- // 删除
- handleDel(){
- const that=this
- uni.showModal({
- title: '',
- content: '确定要删除该出差申请吗?',
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定');
- apiDelApply({BusinessApplyId:Number(that.id)}).then(res=>{
- if(res.code===200){
- uni.$emit('businessApproveListUpdate')
- uni.showToast({
- title:"删除成功",
- icon:'success'
- })
- setTimeout(() => {
- uni.navigateBack({
- delta: 1,
- fail:()=>{
- uni.switchTab({
- url: '/pages/index/index'
- })
- }
- });
- }, 1500);
- }
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- },
- //审批驳回
- handleRefuse(){
- uni.navigateTo({
- url:"./reason?id="+this.id
- })
- },
- // 审批关闭
- handleClose(){
- const url = `./closeReason?id=${this.id}&shouldCheck=${this.adminId===this.info.ApplyAdminId}`
- uni.navigateTo({
- url:url
- })
- },
- //审批通过
- async handlePass(){
- const res=await apiBusinessApplyApprove({
- BusinessApplyId:Number(this.id),
- ApproveStatus:1,
- Remark:''
- })
- if(res.code===200){
- this.$dialog.alert({
- title: "处理成功",
- confirmButtonColor: "#5890FB",
- }).then(() => {
- // on close
- this.getDetail()
- // 更新列表
- uni.$emit('businessApproveListUpdate')
- });
- }
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- .detail-page{
- padding-bottom: calc(150rpx + constant(safe-area-inset-bottom));
- padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
- }
- .section{
- margin-top: 20rpx;
- background-color: #fff;
- padding: 30rpx 34rpx;
- position: relative;
- .status-img{
- position: absolute;
- width: 222rpx;
- height: 222rpx;
- right: 0;
- top: 150rpx;
- z-index: 10;
- }
- }
- .info-item{
- font-size: 32rpx;
- display: flex;
- margin-bottom: 20rpx;
- .label{
- width: 150rpx;
- flex-shrink: 0;
- margin-right: 30rpx;
- text-align: right;
- }
- .content{
- flex: 1;
- }
- }
- .btns-wrap {
- justify-content: center;
- button {
- width: 260rpx;
- height: 70rpx;
- border-radius: 28px;
- border: none;
- margin: 0 15px;
- font-size: 15px;
- color: #fff;
- line-height: 70rpx;
- }
- .pass-btn {
- background-color: #3385FF;
- }
- .refuse-btn {
- background-color: #f55768;
- }
- }
- </style>
|