estimate.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="layout">
  3. <view class="assessHead">
  4. <span style="padding-right: 10upx;">评价</span>
  5. <van-rate
  6. :value="valueNumber"
  7. :size="20"
  8. void-color="#eee"
  9. void-icon="star"
  10. color="#ee0a24"
  11. @change="changestar"
  12. />
  13. </view>
  14. <TextArea :tips="tips" @submitValue="submitValue"/>
  15. <view>
  16. <view>添加图片(最多3张)</view>
  17. <uploadImage @getImg="getImg" />
  18. </view>
  19. <view class="submitRemin" @click="submitRemin">提交</view>
  20. </view>
  21. </template>
  22. <script>
  23. import TextArea from '@/component/textarea.vue'
  24. import uploadImage from '@/component/uploadImage.vue'
  25. export default {
  26. components: {
  27. TextArea,
  28. uploadImage
  29. },
  30. data() {
  31. return{
  32. order_id:'',
  33. valueNumber: 0,
  34. imageList:'',
  35. size: 25,
  36. goodComment:'',
  37. tips: '五星好评超过20个字就有机会获得积分'
  38. }
  39. },
  40. onUnload() {
  41. },
  42. onLoad(e) {
  43. this.order_id = e.order_id;
  44. },
  45. methods: {
  46. changestar(e) {
  47. this.valueNumber = e.detail;
  48. },
  49. getImg(e) {
  50. console.log(e);
  51. this.imageList = e.join(',');
  52. },
  53. submitValue(e) {
  54. this.goodComment = e.detail.value;
  55. },
  56. submitRemin() {
  57. if(this.valueNumber == 0) {
  58. this.$msg("请完成星级评价");
  59. return;
  60. }else if(this.goodComment == '') {
  61. this.$msg("请填写反馈内容");
  62. return;
  63. }else {
  64. this.request({
  65. url: '/v2/order/evaluate',
  66. method: 'post',
  67. data: {
  68. order_id: this.order_id,
  69. score: this.valueNumber,
  70. content: this.goodComment,
  71. img_list: this.imageList
  72. },
  73. success: (res) => {
  74. uni.$emit('finshesitmate');
  75. setTimeout(()=> {
  76. uni.navigateBack()
  77. }, 2000)
  78. }
  79. })
  80. }
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss">
  86. .layout {
  87. padding: 0 32upx;
  88. .assessHead {
  89. padding: 20upx 0;
  90. }
  91. .deepHeight {
  92. height: 108upx;
  93. width: 108upx;
  94. }
  95. }
  96. </style>