add-remark.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="top">
  5. <text class="title">备注</text>
  6. </view>
  7. </view>
  8. <view class="box" style="margin-top: 50px;">
  9. <view class="item">
  10. <view class="l">
  11. <text style="color: red;" v-if="form.needRemark==1">*</text>
  12. 备注:
  13. </view>
  14. <view class="r">
  15. <u-textarea placeholder="备注" v-model="form.remark" clearable>
  16. </u-textarea>
  17. </view>
  18. </view>
  19. </view>
  20. <view style="margin-top: 50px;">
  21. <u-button type="primary" text="确定" @click="saveFn"></u-button>
  22. <u-button type="info" text="重置" @click="form.remark=''" style="margin-top: 20rpx;"></u-button>
  23. </view>
  24. <!-- ---------------------------------------------------------- -->
  25. <view class="bottom-safety"></view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. form: {
  33. id: '',
  34. title: '',
  35. remark: '',
  36. needRemark: 1
  37. }
  38. }
  39. },
  40. onLoad(options) {
  41. this.form = options;
  42. },
  43. methods: {
  44. saveFn() {
  45. let data = this.form;
  46. if (data.mustRemark == 1 && !data.remark) {
  47. this.$common.toast('请填写备注')
  48. return false;
  49. }
  50. console.log(data)
  51. uni.navigateBack({
  52. delta: 1,
  53. success: function (resp) {
  54. uni.$emit('getRemark', data) //触发事件
  55. }
  56. })
  57. }
  58. },
  59. }
  60. </script>
  61. <style lang="scss">
  62. page {
  63. background-color: #fff;
  64. }
  65. .hj {
  66. padding: 50rpx;
  67. font-size: 40rpx;
  68. color: red;
  69. font-weight: bold;
  70. }
  71. .save-btn {
  72. background-color: #ff4200;
  73. height: 88rpx;
  74. display: flex;
  75. justify-content: center;
  76. align-items: center;
  77. margin: 60rpx;
  78. color: #fff;
  79. font-size: 30rpx;
  80. font-weight: bold;
  81. border-radius: 10rpx;
  82. }
  83. @import '@/common/common.scss'
  84. </style>