reject.vue 2.6 KB

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