approve.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <!-- 不通过原因 -->
  2. <template>
  3. <view id="approve">
  4. <view class="approve-title">驳回原因</view>
  5. <textarea v-model="rejectCause" placeholder="请输入未通过原因" maxlength="50"></textarea>
  6. <view class="button-view" @click="accessButtonClick">提交</view>
  7. </view>
  8. </template>
  9. <script>
  10. import {
  11. laboratoryApply
  12. } from '@/api/apiDemo/index.js'
  13. import {
  14. laboratoryAppletEditApp
  15. } from '@/pages_manage/api/index.js'
  16. export default {
  17. data() {
  18. return {
  19. itemData: {},
  20. rejectCause: "",
  21. checkList: [],
  22. }
  23. },
  24. onLoad(option) {
  25. let self = this;
  26. console.log(this.itemData)
  27. this.itemData = JSON.parse(decodeURIComponent(option.item));
  28. for (let i = 0; i < self.itemData.rejectCause.length; i++) {
  29. self.itemData.rejectCause[i].type = false
  30. }
  31. // this.itemData = JSON.parse(decodeURIComponent(option.item));
  32. },
  33. methods: {
  34. accessButtonClick() {
  35. let self = this;
  36. let num = 0;
  37. this.$set(this, 'checkList', [])
  38. for (let i = 0; i < self.itemData.rejectCause.length; i++) {
  39. if (self.itemData.rejectCause[i].type) {
  40. num++
  41. this.checkList.push(self.itemData.rejectCause[i].materialId);
  42. }
  43. }
  44. if (!self.rejectCause) {
  45. uni.showToast({
  46. title: '请输入驳回原因',
  47. icon: "none",
  48. mask: true,
  49. duration: 2000
  50. });
  51. return
  52. }
  53. uni.showModal({
  54. content: '确认拒绝通过吗?',
  55. cancelColor: "#999",
  56. confirmColor: "#0183FA",
  57. success: function(res) {
  58. if (res.confirm) {
  59. self.laboratoryApply();
  60. console.log('用户点击确定');
  61. } else if (res.cancel) {
  62. console.log('用户点击取消');
  63. }
  64. }
  65. });
  66. },
  67. //审核接口
  68. async laboratoryApply() {
  69. let obj = {
  70. applyId: this.itemData.applyId,
  71. auditStatus: 1,
  72. rejectCause: this.rejectCause,
  73. //rejectMaterial: this.checkList + '',
  74. };
  75. const {
  76. data
  77. } = await laboratoryAppletEditApp(obj)
  78. if (data.code == 200) {
  79. uni.showToast({
  80. title: '提交成功!',
  81. icon: "none",
  82. mask: true,
  83. duration: 2000
  84. });
  85. let homeType = false;
  86. let list = getCurrentPages();
  87. for(let i=0;i<list.length;i++){
  88. if(list[i].route.indexOf('home') != -1){
  89. homeType = true;
  90. }
  91. }
  92. if(homeType){
  93. setTimeout(function() {
  94. uni.navigateBack({
  95. delta: 2
  96. });
  97. }, 2000);
  98. }else{
  99. setTimeout(function() {
  100. uni.reLaunch({
  101. url: '/pages/views/home/home',
  102. });
  103. }, 2000);
  104. }
  105. }
  106. },
  107. checkItem(item) {
  108. item.type = !item.type;
  109. this.$forceUpdate();
  110. },
  111. }
  112. }
  113. </script>
  114. <style lang="stylus" scoped>
  115. #approve {
  116. height: 100%;
  117. background #fff;
  118. overflow hidden;
  119. textarea {
  120. width: 670rpx;
  121. height: 200rpx;
  122. margin: 20rpx 30rpx 0;
  123. font-size: 28rpx;
  124. border: 1rpx solid #E0E0E0;
  125. border-radius: 10rpx;
  126. padding: 20rpx;
  127. }
  128. .approve-title {
  129. font-weight: 700;
  130. color: #333;
  131. font-size: 30rpx;
  132. font-weight: 700;
  133. margin: 20rpx 30rpx;
  134. }
  135. .approve-for-box {
  136. display flex;
  137. height: 60rpx;
  138. padding-left: 40rpx;
  139. img {
  140. width: 30rpx;
  141. height: 30rpx;
  142. margin: 15rpx;
  143. }
  144. view {
  145. font-size: 28rpx;
  146. height: 60rpx;
  147. line-height: 60rpx;
  148. }
  149. }
  150. .button-view {
  151. width: 600rpx;
  152. height: 80rpx;
  153. background: #0183FA;
  154. border-radius: 20rpx;
  155. font-size: 30rpx;
  156. line-height: 80rpx;
  157. text-align center;
  158. color: #fff;
  159. margin: 90rpx auto;
  160. }
  161. }
  162. </style>