evaluate.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="container">
  3. <!-- 处理时效区域 -->
  4. <view class="score">
  5. <text>处理时效</text>
  6. <uni-rate activeColor="#FF5733" allowHalf size="30" value="0" @change="onChange" />
  7. </view>
  8. <!-- 服务评价区域 -->
  9. <view class="evaluate">
  10. 服务评价
  11. <textarea placeholder-style="color:#CCCCCC" placeholder="您宝贵的评价对我们很重要哦" v-model="textareaValue"></textarea>
  12. </view>
  13. <!-- 确认提交区域 -->
  14. <view class="btn" @click="handleSub">确认提交</view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. // 评分数据
  22. score: 0,
  23. // 输入框绑定数据
  24. textareaValue: '',
  25. // 订单的Id
  26. recordId: ''
  27. }
  28. },
  29. onLoad(options) {
  30. this.recordId = options.recordId
  31. },
  32. methods: {
  33. // 评分改变回调
  34. onChange(e) {
  35. // console.log(e)
  36. this.score = e.value
  37. },
  38. // 确认提交按钮回调
  39. async handleSub() {
  40. if (this.score === 0) {
  41. uni.showToast({
  42. title: '请您给此次服务评分',
  43. icon: 'none'
  44. })
  45. return
  46. }
  47. // if (!this.textareaValue) {
  48. // uni.showToast({
  49. // title: '请输入服务评价',
  50. // icon: 'none'
  51. // })
  52. // return
  53. // }
  54. const res = await this.$myRequest_repairs({
  55. url: '/repairEvaluate/insertRepairEvaluate',
  56. method: 'post',
  57. data: {
  58. recordId: this.recordId,
  59. star: this.score,
  60. content: this.textareaValue
  61. }
  62. })
  63. // console.log(res)
  64. if (res.code === '200') {
  65. uni.showToast({
  66. title: '评价成功',
  67. icon: 'success'
  68. })
  69. setTimeout(() => {
  70. uni.redirectTo({
  71. url: '/pagesRepairs/box/box'
  72. })
  73. }, 1500)
  74. }
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .container {
  81. position: relative;
  82. padding-left: 30rpx;
  83. width: 100vw;
  84. height: 100vh;
  85. .score {
  86. display: flex;
  87. align-items: center;
  88. height: 172rpx;
  89. font-size: 28rpx;
  90. text {
  91. margin-right: 25rpx;
  92. }
  93. }
  94. .evaluate {
  95. display: flex;
  96. font-size: 28rpx;
  97. textarea {
  98. box-sizing: border-box;
  99. margin-left: 28rpx;
  100. padding: 14rpx 20rpx;
  101. width: 550rpx;
  102. height: 298rpx;
  103. font-size: 28rpx;
  104. border-radius: 11rpx;
  105. border: 1rpx solid #e6e6e6;
  106. }
  107. }
  108. .btn {
  109. position: absolute;
  110. left: 30rpx;
  111. bottom: 65rpx;
  112. display: flex;
  113. justify-content: center;
  114. align-items: center;
  115. width: 690rpx;
  116. height: 100rpx;
  117. color: #fff;
  118. font-size: 32rpx;
  119. border-radius: 12rpx;
  120. background-color: #6fb6b8;
  121. }
  122. }
  123. </style>