reason.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view>
  3. <view class="textarea-wrap white-wrap">
  4. <textarea :placeholder="`请输入${type === 'del' ? '删除' : '拒绝'}理由`" v-model="reason" maxlength="-1" @input="formatSpace"></textarea>
  5. </view>
  6. <view class="btns-wrap flex">
  7. <button class="cancel-btn" @click="handleCancel">取消</button>
  8. <button class="confirm-btn" @click="handleSubmit">提交</button>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. import {apiRoadShowReject} from '@/api/approve/activity.js'
  14. import { delActivity } from '@/api/roadshow/index.js';
  15. export default {
  16. data() {
  17. return {
  18. type: '',
  19. reason: '',
  20. RsCalendarId:null,
  21. RsCalendarResearcherId:null,
  22. }
  23. },
  24. onLoad(options) {
  25. const { RsCalendarId,RsCalendarResearcherId,type } = options;
  26. this.type = type;
  27. this.RsCalendarId=RsCalendarId;
  28. this.RsCalendarResearcherId=RsCalendarResearcherId;
  29. uni.setNavigationBarTitle({
  30. title: type==='del' ? '删除理由' : '拒绝理由'
  31. })
  32. },
  33. methods: {
  34. async handleSubmit() {
  35. if(!this.reason){
  36. uni.showToast({
  37. title:'请填写理由',
  38. icon:"none"
  39. })
  40. return
  41. }
  42. const res = this.type==='del' ? await delActivity({
  43. DeleteReason: this.reason,
  44. RsCalendarId:Number(this.RsCalendarId),
  45. RsCalendarResearcherId:Number(this.RsCalendarResearcherId),
  46. }) : await apiRoadShowReject({
  47. RsCalendarId:Number(this.RsCalendarId),
  48. RsCalendarResearcherId:Number(this.RsCalendarResearcherId),
  49. RefuseReason:this.reason
  50. })
  51. if(res.code===200){
  52. uni.showToast({
  53. title:"审批成功",
  54. icon:'success'
  55. })
  56. uni.$emit('activityApproveListUpdate',{
  57. RsCalendarId:this.RsCalendarId,
  58. RsCalendarResearcherId:this.RsCalendarResearcherId
  59. })
  60. setTimeout(()=>{
  61. this.handleCancel()
  62. },1000)
  63. }
  64. },
  65. handleCancel(){
  66. uni.navigateBack({
  67. delta:1
  68. })
  69. },
  70. /* 过滤空格 */
  71. formatSpace({detail}) {
  72. this.reason = detail.value.replace(/\s+/g,'');
  73. }
  74. },
  75. }
  76. </script>
  77. <style lang="scss">
  78. .textarea-wrap {
  79. padding: 17px;
  80. textarea {
  81. resize: none;
  82. display: block;
  83. box-sizing: border-box;
  84. width: 100%;
  85. height: 200px;
  86. border: none;
  87. font-size: 14px;
  88. /* no */
  89. }
  90. }
  91. .btns-wrap {
  92. justify-content: center;
  93. padding-top: 50px;
  94. padding-bottom: 50px;
  95. button {
  96. width: 90px;
  97. height: 28px;
  98. border-radius: 28px;
  99. border: none;
  100. margin: 0 10px;
  101. font-size: 14px;
  102. /* no */
  103. color: #fff;
  104. line-height: 28px;
  105. }
  106. .confirm-btn {
  107. background-color: #5890fb;
  108. }
  109. .cancel-btn {
  110. border: 1px solid #5890fb;
  111. color: #5890fb;
  112. background-color: #fff;
  113. }
  114. }
  115. </style>