disagree.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="disagree-page">
  3. <scroll-view class="scroll-y" scroll-y="true">
  4. <view class="textarea-box">
  5. <view class="label-view">
  6. <text>原因</text>
  7. </view>
  8. <textarea class="textarea"
  9. placeholder="请输入"
  10. placeholder-style="color: #B8BECC"
  11. :maxlength="500"
  12. :disabled="disabled"
  13. auto-height
  14. :value="value"
  15. @input="changeValue"
  16. />
  17. </view>
  18. </scroll-view>
  19. <view class="fixed-buttom-btn"
  20. v-if="!disabled"
  21. @click="sure">
  22. <text class="btn-text">确定</text>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. // 不认可原因
  28. export default {
  29. props: {
  30. // 是否禁用
  31. disabled: {
  32. type: Boolean,
  33. default: false
  34. },
  35. // 详情回显的数据
  36. values: {
  37. type: Object,
  38. default: () => {
  39. return {}
  40. }
  41. },
  42. // 按钮信息 (包过请求的key)
  43. btnInfo: {
  44. type: Object,
  45. default: () => {
  46. return {}
  47. }
  48. },
  49. // 任务详情
  50. missionDetails: {
  51. type: Object,
  52. default: () => {
  53. return {}
  54. }
  55. }
  56. },
  57. data(){
  58. return {
  59. value: ''
  60. }
  61. },
  62. created() {
  63. uni.setNavigationBarTitle({
  64. title: '原因'
  65. });
  66. if(this.disabled) {
  67. this.value = this.values['textarea'];
  68. }
  69. },
  70. methods: {
  71. changeValue(e) {
  72. this.value = e.detail.value;
  73. },
  74. sure() {
  75. if(this.value.length<2){
  76. //限制最小输入内容
  77. uni.showModal({
  78. title: '提示',
  79. showCancel:false,
  80. content: '请输入原因,至少2个字符以上!'
  81. });
  82. return;
  83. }
  84. const { params } = this.btnInfo;
  85. let requestParams = {};
  86. console.log('this.btnInfo',this.btnInfo);
  87. this.btnInfo.params.map(item => {
  88. if(item.valueKey){
  89. requestParams[item.paramsKey] = (
  90. item.isOutvalueKey
  91. ? this.missionDetails
  92. : this.btnInfo
  93. )[item.valueKey];
  94. }else if(item.value){
  95. requestParams[item.paramsKey] = item.value;
  96. }else {
  97. requestParams[item.paramsKey] = this.value;
  98. }
  99. });
  100. console.log({'2':requestParams});
  101. this.$emit('comRequest', requestParams);
  102. }
  103. }
  104. }
  105. </script>
  106. <style lang="less">
  107. .disagree-page {
  108. height: 100%;
  109. .scroll-y {
  110. height: calc(100% - 87.5rpx);
  111. padding-top: 15rpx;
  112. .textarea-box {
  113. display: flex;
  114. width: 100%;
  115. background-color: #fff;
  116. padding: 25rpx 0;
  117. padding-left: 25rpx;
  118. .label-view {
  119. width: 175rpx;
  120. line-height: 37.5rpx;
  121. >text {
  122. font-size: 22.5rpx;
  123. color: #666F80;
  124. }
  125. }
  126. .textarea {
  127. flex: 1;
  128. min-height: 768.75rpx;
  129. padding: 0 25rpx;
  130. line-height: 37.5rpx;
  131. font-size: 22.5rpx;
  132. color: #525866;
  133. box-sizing: border-box;
  134. }
  135. }
  136. }
  137. }
  138. </style>