detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <view class="detail-page" v-if="info">
  3. <view class="section">
  4. <image :src="statusImg" mode="aspectFill" class="status-img"></image>
  5. <!-- <view class="info-item" v-for="item in infoOpts" :key="item.key">
  6. <view class="label">{{item.name}}</view>
  7. <view class="content">
  8. <text v-if="item.key=='place'">{{info.Province}}{{info.City}}</text>
  9. <text>{{info[item.key]}}</text>
  10. </view>
  11. </view> -->
  12. <view class="info-item">
  13. <view class="label">申请人</view>
  14. <view class="content">
  15. <text>{{info.ApplyRealName}}</text>
  16. </view>
  17. </view>
  18. <view class="info-item">
  19. <view class="label">到达日期</view>
  20. <view class="content">
  21. <text>{{info.ArriveDate}}</text>
  22. </view>
  23. </view>
  24. <view class="info-item">
  25. <view class="label">返程日期</view>
  26. <view class="content">
  27. <text>{{info.ReturnDate}}</text>
  28. </view>
  29. </view>
  30. <view class="info-item">
  31. <view class="label">目的地</view>
  32. <view class="content">
  33. <text>{{info.Province}}{{info.City}}</text>
  34. </view>
  35. </view>
  36. <view class="info-item">
  37. <view class="label">出差事由</view>
  38. <view class="content">
  39. <text>{{info.Reason}}</text>
  40. </view>
  41. </view>
  42. <view class="info-item">
  43. <view class="label">交通工具</view>
  44. <view class="content">
  45. <text>{{info.Transportation.indexOf('其他')!=-1?info.Transportation.split('-')[1]:info.Transportation}}</text>
  46. </view>
  47. </view>
  48. <view class="info-item" v-if="info.PeerPeopleName">
  49. <view class="label">同行人</view>
  50. <view class="content">
  51. <text>{{info.PeerPeopleName}}</text>
  52. </view>
  53. </view>
  54. <view class="info-item">
  55. <view class="label">提交时间</view>
  56. <view class="content">
  57. <text>{{info.CreateTime}}</text>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="section" v-if="info.Status!=='待审批'&&(info.ApproveTime||info.RefuseTime)">
  62. <view class="info-item">
  63. <view class="label">审批时间</view>
  64. <view class="content">{{info.ApproveTime||info.RefuseTime}}</view>
  65. </view>
  66. <view class="info-item" style="color:#C54322" v-if="info.Status==='已驳回'">
  67. <view class="label">驳回理由</view>
  68. <view class="content">{{info.RefuseReason}}</view>
  69. </view>
  70. </view>
  71. <view class="section" v-if="info.Status==='已关闭'">
  72. <view class="info-item">
  73. <view class="label">关闭时间</view>
  74. <view class="content">{{info.CloseTime}}</view>
  75. </view>
  76. <view class="info-item" style="color:#C54322">
  77. <view class="label">关闭理由</view>
  78. <view class="content">{{info.CloseReason}}</view>
  79. </view>
  80. </view>
  81. <view class="fix-bottom-wrap btns-wrap flex" v-if="info.ApplyAdminId==adminId&&info.Status=='待审批'">
  82. <button class="pass-btn" @click="handleRecall">撤回</button>
  83. </view>
  84. <view class="fix-bottom-wrap btns-wrap flex" v-if="info.ApplyAdminId==adminId&&info.Status=='已驳回'">
  85. <button class="pass-btn" @click="handleEdit">重新申请</button>
  86. </view>
  87. <view class="fix-bottom-wrap btns-wrap flex" v-if="info.ApplyAdminId==adminId&&info.Status=='已撤回'">
  88. <button class="refuse-btn" @click="handleDel">删除</button>
  89. <button class="pass-btn" @click="handleEdit">重新申请</button>
  90. </view>
  91. <view class="fix-bottom-wrap btns-wrap flex" v-if="info.IsApprove&&info.Status=='待审批'">
  92. <button class="pass-btn" @click="handlePass">通过</button>
  93. <button class="refuse-btn" @click="handleRefuse">驳回</button>
  94. </view>
  95. <view class="fix-bottom-wrap btns-wrap flex" v-if="info.IsClose&&info.Status=='已通过'&&!NowBigReturnDate">
  96. <button class="refuse-btn" @click="handleClose">关闭</button>
  97. </view>
  98. <van-dialog id="van-dialog" />
  99. </view>
  100. </template>
  101. <script>
  102. import {apiBusinessTripDetail,apiBusinessTripRecall,apiBusinessApplyApprove,apiDelApply} from '@/api/businessTrip/index'
  103. export default {
  104. computed:{
  105. adminId(){
  106. const userInfo=uni.getStorageSync('userInfo');
  107. return userInfo?JSON.parse(userInfo).AdminId:0
  108. },
  109. // 当前时间是否大于等于返回时间
  110. NowBigReturnDate(){
  111. if(!this.info) return
  112. const now=new Date().getTime()
  113. const temt=this.info.ArriveDate.replace('-','/')
  114. const rtime=new Date(temt).getTime()
  115. console.log(now,rtime);
  116. return now>rtime
  117. }
  118. },
  119. data() {
  120. return {
  121. // infoOpts:[
  122. // {name:'申请人',key:'ApplyRealName'},
  123. // {name:'到达日期',key:'ArriveDate'},
  124. // {name:'返程日期',key:'ReturnDate'},
  125. // {name:'目的地',key:'place'},
  126. // {name:'出差事由',key:'Reason'},
  127. // {name:'交通工具',key:'Transportation'},
  128. // {name:'同行人',key:'PeerPeopleName'},
  129. // {name:'提交时间',key:'CreateTime'},
  130. // ],
  131. id:0,
  132. info:null,
  133. statusImg:'',
  134. }
  135. },
  136. onLoad(opt){
  137. this.id=opt.id
  138. },
  139. onShow(){
  140. this.getDetail()
  141. },
  142. methods: {
  143. getDetail(){
  144. this.info=null
  145. this.statusImg=''
  146. apiBusinessTripDetail({BusinessApplyId:this.id}).then(res=>{
  147. if(res.code===200){
  148. this.info=res.data
  149. if(this.info.Status==='已通过'){
  150. this.statusImg= require('../static/pass-icon.png')
  151. }else if(this.info.Status==='已驳回'){
  152. this.statusImg= require('../static/fail-icon.png')
  153. }else if(this.info.Status==='已过期'){
  154. this.statusImg= require('../static/cancel-icon.png')
  155. }else if(this.info.Status==='已撤回'){
  156. this.statusImg= require('../static/recall-icon.png')
  157. }else if(this.info.Status==='已关闭'){
  158. this.statusImg= require('../static/close-icon.png')
  159. }
  160. }
  161. })
  162. },
  163. // 撤回
  164. handleRecall(){
  165. const that=this
  166. uni.showModal({
  167. title: '',
  168. content: '确定要撤回该出差申请吗?',
  169. success: function (res) {
  170. if (res.confirm) {
  171. console.log('用户点击确定');
  172. apiBusinessTripRecall({BusinessApplyId:Number(that.id)}).then(res=>{
  173. if(res.code===200){
  174. uni.$emit('businessApproveListUpdate')
  175. uni.navigateBack({
  176. delta: 1,
  177. fail:()=>{
  178. uni.switchTab({
  179. url: '/pages/index/index'
  180. })
  181. }
  182. });
  183. }
  184. })
  185. } else if (res.cancel) {
  186. console.log('用户点击取消');
  187. }
  188. }
  189. });
  190. },
  191. // 重新申请
  192. handleEdit(){
  193. uni.navigateTo({
  194. url:"/pages-approve/businessTrip/add?id="+this.id
  195. })
  196. },
  197. // 删除
  198. handleDel(){
  199. const that=this
  200. uni.showModal({
  201. title: '',
  202. content: '确定要删除该出差申请吗?',
  203. success: function (res) {
  204. if (res.confirm) {
  205. console.log('用户点击确定');
  206. apiDelApply({BusinessApplyId:Number(that.id)}).then(res=>{
  207. if(res.code===200){
  208. uni.$emit('businessApproveListUpdate')
  209. uni.showToast({
  210. title:"删除成功",
  211. icon:'success'
  212. })
  213. setTimeout(() => {
  214. uni.navigateBack({
  215. delta: 1,
  216. fail:()=>{
  217. uni.switchTab({
  218. url: '/pages/index/index'
  219. })
  220. }
  221. });
  222. }, 1500);
  223. }
  224. })
  225. } else if (res.cancel) {
  226. console.log('用户点击取消');
  227. }
  228. }
  229. });
  230. },
  231. //审批驳回
  232. handleRefuse(){
  233. uni.navigateTo({
  234. url:"./reason?id="+this.id
  235. })
  236. },
  237. // 审批关闭
  238. handleClose(){
  239. const url = `./closeReason?id=${this.id}&shouldCheck=${this.adminId===this.info.ApplyAdminId}`
  240. uni.navigateTo({
  241. url:url
  242. })
  243. },
  244. //审批通过
  245. async handlePass(){
  246. const res=await apiBusinessApplyApprove({
  247. BusinessApplyId:Number(this.id),
  248. ApproveStatus:1,
  249. Remark:''
  250. })
  251. if(res.code===200){
  252. this.$dialog.alert({
  253. title: "处理成功",
  254. confirmButtonColor: "#5890FB",
  255. }).then(() => {
  256. // on close
  257. this.getDetail()
  258. // 更新列表
  259. uni.$emit('businessApproveListUpdate')
  260. });
  261. }
  262. },
  263. },
  264. }
  265. </script>
  266. <style lang="scss" scoped>
  267. .detail-page{
  268. padding-bottom: calc(150rpx + constant(safe-area-inset-bottom));
  269. padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
  270. }
  271. .section{
  272. margin-top: 20rpx;
  273. background-color: #fff;
  274. padding: 30rpx 34rpx;
  275. position: relative;
  276. .status-img{
  277. position: absolute;
  278. width: 222rpx;
  279. height: 222rpx;
  280. right: 0;
  281. top: 150rpx;
  282. z-index: 10;
  283. }
  284. }
  285. .info-item{
  286. font-size: 32rpx;
  287. display: flex;
  288. margin-bottom: 20rpx;
  289. .label{
  290. width: 150rpx;
  291. flex-shrink: 0;
  292. margin-right: 30rpx;
  293. text-align: right;
  294. }
  295. .content{
  296. flex: 1;
  297. }
  298. }
  299. .btns-wrap {
  300. justify-content: center;
  301. button {
  302. width: 260rpx;
  303. height: 70rpx;
  304. border-radius: 28px;
  305. border: none;
  306. margin: 0 15px;
  307. font-size: 15px;
  308. color: #fff;
  309. line-height: 70rpx;
  310. }
  311. .pass-btn {
  312. background-color: #3385FF;
  313. }
  314. .refuse-btn {
  315. background-color: #f55768;
  316. }
  317. }
  318. </style>