detail.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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>
  13. <view class="section" v-if="info.Status!=='待审批'&&(info.ApproveTime||info.RefuseTime)">
  14. <view class="info-item">
  15. <view class="label">审批时间</view>
  16. <view class="content">{{info.ApproveTime||info.RefuseTime}}</view>
  17. </view>
  18. <view class="info-item" style="color:#C54322" v-if="info.Status==='已驳回'">
  19. <view class="label">驳回理由</view>
  20. <view class="content">{{info.RefuseReason}}</view>
  21. </view>
  22. </view>
  23. <view class="fix-bottom-wrap btns-wrap flex" v-if="info.ApplyAdminId==adminId&&info.Status=='待审批'">
  24. <button class="pass-btn" @click="handleRecall">撤回</button>
  25. </view>
  26. <view class="fix-bottom-wrap btns-wrap flex" v-if="info.ApplyAdminId==adminId&&info.Status=='已驳回'">
  27. <button class="pass-btn" @click="handleEdit">重新申请</button>
  28. </view>
  29. <view class="fix-bottom-wrap btns-wrap flex" v-if="info.ApplyAdminId==adminId&&info.Status=='已撤回'">
  30. <button class="refuse-btn" @click="handleDel">删除</button>
  31. <button class="pass-btn" @click="handleEdit">重新申请</button>
  32. </view>
  33. <view class="fix-bottom-wrap btns-wrap flex" v-if="info.IsApprove&&info.Status=='待审批'">
  34. <button class="pass-btn" @click="handlePass">通过</button>
  35. <button class="refuse-btn" @click="handleRefuse">驳回</button>
  36. </view>
  37. <van-dialog id="van-dialog" />
  38. </view>
  39. </template>
  40. <script>
  41. import {apiBusinessTripDetail,apiBusinessTripRecall,apiBusinessApplyApprove,apiDelApply} from '@/api/businessTrip/index'
  42. export default {
  43. computed:{
  44. adminId(){
  45. const userInfo=uni.getStorageSync('userInfo');
  46. return userInfo?JSON.parse(userInfo).AdminId:0
  47. }
  48. },
  49. data() {
  50. return {
  51. infoOpts:[
  52. {name:'申请人',key:'ApplyRealName'},
  53. {name:'到达日期',key:'ArriveDate'},
  54. {name:'返程日期',key:'ReturnDate'},
  55. {name:'目的地',key:'place'},
  56. {name:'出差事由',key:'Reason'},
  57. {name:'交通工具',key:'Transportation'},
  58. {name:'同行人',key:'PeerPeopleName'},
  59. {name:'提交时间',key:'CreateTime'},
  60. ],
  61. id:0,
  62. info:null,
  63. statusImg:'',
  64. }
  65. },
  66. onLoad(opt){
  67. this.id=opt.id
  68. },
  69. onShow(){
  70. this.getDetail()
  71. },
  72. methods: {
  73. getDetail(){
  74. this.info=null
  75. this.statusImg=''
  76. apiBusinessTripDetail({BusinessApplyId:this.id}).then(res=>{
  77. if(res.code===200){
  78. this.info=res.data
  79. if(this.info.Status==='已审批'){
  80. this.statusImg= require('../static/pass-icon.png')
  81. }else if(this.info.Status==='已驳回'){
  82. this.statusImg= require('../static/fail-icon.png')
  83. }else if(this.info.Status==='已过期'){
  84. this.statusImg= require('../static/cancel-icon.png')
  85. }else if(this.info.Status==='已撤回'){
  86. this.statusImg= require('../static/recall-icon.png')
  87. }
  88. }
  89. })
  90. },
  91. // 撤回
  92. handleRecall(){
  93. const that=this
  94. uni.showModal({
  95. title: '',
  96. content: '确定要撤回该出差申请吗?',
  97. success: function (res) {
  98. if (res.confirm) {
  99. console.log('用户点击确定');
  100. apiBusinessTripRecall({BusinessApplyId:Number(that.id)}).then(res=>{
  101. if(res.code===200){
  102. uni.$emit('businessApproveListUpdate')
  103. uni.navigateBack({
  104. delta: 1,
  105. fail:()=>{
  106. uni.switchTab({
  107. url: '/pages/index/index'
  108. })
  109. }
  110. });
  111. }
  112. })
  113. } else if (res.cancel) {
  114. console.log('用户点击取消');
  115. }
  116. }
  117. });
  118. },
  119. // 重新申请
  120. handleEdit(){
  121. uni.navigateTo({
  122. url:"/pages-approve/businessTrip/add?id="+this.id
  123. })
  124. },
  125. // 删除
  126. handleDel(){
  127. const that=this
  128. uni.showModal({
  129. title: '',
  130. content: '确定要删除该出差申请吗?',
  131. success: function (res) {
  132. if (res.confirm) {
  133. console.log('用户点击确定');
  134. apiDelApply({BusinessApplyId:Number(that.id)}).then(res=>{
  135. if(res.code===200){
  136. uni.$emit('businessApproveListUpdate')
  137. uni.showToast({
  138. title:"删除成功",
  139. icon:'success'
  140. })
  141. setTimeout(() => {
  142. uni.navigateBack({
  143. delta: 1,
  144. fail:()=>{
  145. uni.switchTab({
  146. url: '/pages/index/index'
  147. })
  148. }
  149. });
  150. }, 1500);
  151. }
  152. })
  153. } else if (res.cancel) {
  154. console.log('用户点击取消');
  155. }
  156. }
  157. });
  158. },
  159. //审批驳回
  160. handleRefuse(){
  161. uni.navigateTo({
  162. url:"./reason?id="+this.id
  163. })
  164. },
  165. //审批通过
  166. async handlePass(){
  167. const res=await apiBusinessApplyApprove({
  168. BusinessApplyId:Number(this.id),
  169. ApproveStatus:1,
  170. Remark:''
  171. })
  172. if(res.code===200){
  173. this.$dialog.alert({
  174. title: "处理成功",
  175. confirmButtonColor: "#5890FB",
  176. }).then(() => {
  177. // on close
  178. this.getDetail()
  179. // 更新列表
  180. uni.$emit('businessApproveListUpdate')
  181. });
  182. }
  183. },
  184. },
  185. }
  186. </script>
  187. <style lang="scss" scoped>
  188. .detail-page{
  189. padding-bottom: calc(150rpx + constant(safe-area-inset-bottom));
  190. padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
  191. }
  192. .section{
  193. margin-top: 20rpx;
  194. background-color: #fff;
  195. padding: 30rpx 34rpx;
  196. position: relative;
  197. .status-img{
  198. position: absolute;
  199. width: 222rpx;
  200. height: 222rpx;
  201. right: 0;
  202. top: 150rpx;
  203. z-index: 10;
  204. }
  205. }
  206. .info-item{
  207. font-size: 32rpx;
  208. display: flex;
  209. margin-bottom: 20rpx;
  210. .label{
  211. width: 150rpx;
  212. flex-shrink: 0;
  213. margin-right: 30rpx;
  214. text-align: right;
  215. }
  216. .content{
  217. flex: 1;
  218. }
  219. }
  220. .btns-wrap {
  221. justify-content: center;
  222. button {
  223. width: 260rpx;
  224. height: 70rpx;
  225. border-radius: 28px;
  226. border: none;
  227. margin: 0 15px;
  228. font-size: 15px;
  229. color: #fff;
  230. line-height: 70rpx;
  231. }
  232. .pass-btn {
  233. background-color: #3385FF;
  234. }
  235. .refuse-btn {
  236. background-color: #f55768;
  237. }
  238. }
  239. </style>