userComment.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view>
  3. 服务评价
  4. <up-image :show-loading="true" :src="src" width="80px" height="80px" @click="click"></up-image>
  5. <view>
  6. <view>
  7. <text>服务礼仪:</text>
  8. <template>
  9. <up-rate :count="count" v-model="IfonForm.protocolScore"></up-rate>
  10. </template>
  11. </view>
  12. <view>
  13. <text>着装整洁:</text>
  14. <template>
  15. <up-rate :count="count" v-model="IfonForm.clothingScore"></up-rate>
  16. </template>
  17. </view>
  18. <view>
  19. <text>专业能力:</text>
  20. <template>
  21. <up-rate :count="count" v-model="IfonForm.abilityScore"></up-rate>
  22. </template>
  23. </view>
  24. <view>
  25. <text>服务质量:</text>
  26. <template>
  27. <up-rate :count="count" v-model="IfonForm.qualityScore"></up-rate>
  28. </template>
  29. </view>
  30. </view>
  31. <!-- <up-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
  32. :maxCount="10"></up-upload> -->
  33. <view class="service-info order-card">
  34. <!-- <view class="font-title">图片上传</view> -->
  35. <!-- 回顯 -->
  36. <view class="upload-box">
  37. <view class="upload-img-item" v-for="(item, index) in fileList" :key="item.url">
  38. <view class="delete-icon" @click="deletePic(index)"><up-icon name="close-circle-fill"
  39. color="#f64a1f" size="18"></up-icon></view>
  40. <img class="upload-img" :src="item.url" :alt="item.fileName" srcset="">
  41. </view>
  42. <img src="/static/img/upload.png" alt="" class="upload-img" @click="uploadClick('img')"
  43. v-if="fileList.length < 10">
  44. </view>
  45. </view>
  46. <up-textarea v-model="IfonForm.userReview" placeholder="请输入评论内容"></up-textarea>
  47. <up-button type="primary" text="发布" @click="handlButClick"></up-button>
  48. </view>
  49. </template>
  50. <!-- /** 评分 */
  51. @Excel(name = "服务礼仪")
  52. @ApiModelProperty("服务礼仪")
  53. private Integer protocolScore;
  54. /** 评分 */
  55. @Excel(name = "服装整洁")
  56. @ApiModelProperty("服装整洁")
  57. private Integer clothingScore;
  58. /** 评分 */
  59. @Excel(name = "专业能力")
  60. @ApiModelProperty("专业能力")
  61. private Integer abilityScore;
  62. /** 评分 */
  63. @Excel(name = "服务质量")
  64. @ApiModelProperty("服务质量")
  65. private Integer qualityScore; -->
  66. <script setup>
  67. import {
  68. onMounted,
  69. ref
  70. } from 'vue';
  71. import {
  72. usersUserFinishOrder
  73. } from "@/api/userList.js";
  74. import {
  75. onLoad,
  76. } from '@dcloudio/uni-app';
  77. import {
  78. wxUploadFile
  79. } from '@/utils/wxRequest.js'
  80. const count = ref(4);
  81. const fileList = ref([]);
  82. const src = ref('https://cdn.uviewui.com/uview/album/1.jpg');
  83. const IfonForm = ref({
  84. protocolScore: 0, //服务礼仪
  85. clothingScore: 0, //服装整洁
  86. abilityScore: 0, //专业能力
  87. qualityScore: 0, //服务质量
  88. userReview: '',
  89. serviceOnePrice: 0,
  90. })
  91. // 删除图片
  92. const deletePic = (event) => {
  93. fileList.value.splice(event.index, 1);
  94. };
  95. const uploadClick = async (type) => {
  96. const res = await wxUploadFile(type);
  97. fileList.value = [...fileList.value, ...res];
  98. console.log('xxxxres', res, fileList.value);
  99. }
  100. const handlButClick = async () => {
  101. // 提取所有图片的 URL
  102. const imageUrls = fileList.value.map(item => item.url);
  103. try {
  104. const params = {
  105. ...IfonForm.value,
  106. images: imageUrls,
  107. }
  108. console.log(params, 'params>>>')
  109. const res = await usersUserFinishOrder(params)
  110. console.log(res, 'usersUserFinishOrder>>>>>')
  111. uni.showToast({
  112. title: '评价提交成功',
  113. icon: 'success'
  114. });
  115. } catch (e) {
  116. uni.showToast({
  117. title: '提交失败,请重试',
  118. icon: 'error'
  119. });
  120. }
  121. }
  122. </script>
  123. <style>
  124. </style>