reject.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view class="mx3" style="padding-bottom: 100rpx">
  3. <view class="main-color-bg" style="height: 100rpx; margin: 0 -30rpx"></view>
  4. <view
  5. class="p3 bg-color-white"
  6. style="margin-top: -50rpx; border-radius: 20rpx"
  7. >
  8. <u-form :model="form" ref="uForm" :label-width="180">
  9. <u-form-item label="拒单理由" required prop="refuseRemark">
  10. <u-input type="textarea" v-model="form.refuseRemark" />
  11. </u-form-item>
  12. </u-form>
  13. <view class="p-fixed d-flex j-around a-center footer">
  14. <view
  15. class="main-color-bg text-color-white common"
  16. :loading="confirmLoading"
  17. @tap="submit"
  18. >提交</view
  19. >
  20. </view>
  21. </view>
  22. <u-toast ref="uToast" />
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. form: {
  30. id: '',
  31. refuseRemark: '',
  32. },
  33. rules: {
  34. refuseRemark: [
  35. {
  36. required: true,
  37. message: '拒单理由不能为空',
  38. trigger: 'blur'
  39. }
  40. ]
  41. },
  42. confirmLoading: false
  43. };
  44. },
  45. onReady() {
  46. this.$refs.uForm.setRules(this.rules);
  47. },
  48. onLoad(options) {
  49. this.form = {
  50. ...this.form,
  51. ...options
  52. }
  53. },
  54. methods: {
  55. // 提交
  56. submit() {
  57. this.$refs.uForm.validate(valid => {
  58. if (valid) {
  59. this.$Http.rejectRepair(this.form)
  60. .then((res) => {
  61. this.confirmLoading = false
  62. this.$refs.uToast.show({
  63. title: '提交成功!',
  64. type: 'success',
  65. back : true
  66. })
  67. }).catch(() => {
  68. this.confirmLoading = false
  69. })
  70. } else {
  71. console.log('验证失败');
  72. }
  73. });
  74. },
  75. }
  76. };
  77. </script>
  78. <style lang="less">
  79. page {
  80. background-color: #f4f4f4;
  81. }
  82. .footer {
  83. bottom: 0;
  84. left: 0;
  85. right: 0;
  86. background-color: #fff;
  87. z-index: 10000;
  88. border-top: 1rpx solid #f4f4f4;
  89. height: 100rpx;
  90. .common {
  91. padding: 15rpx 200rpx;
  92. border-radius: 30rpx;
  93. background-color: #0082ff;
  94. color: #fff;
  95. }
  96. }
  97. </style>