appraise.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view class="flex-common-css">
  3. <Nav title="评价" titleColor="#333" bgckgroundBox='#fff'></Nav>
  4. <scroll-view :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  5. <view class="content-box">
  6. <view class="fc-FB3D03 fs-24 mb-28 text-align-center">
  7. 提交好评或建议,帮助骑手和商家做的更好
  8. </view>
  9. <view class="bgc-f p-24 b-rad-20 mb-18 box-sizing-border">
  10. <view class="flex-justify-space">
  11. <view class="fs-36 fw-600 fc-3">
  12. 你对商家满意吗?
  13. </view>
  14. <view class="align-items-center mb-24" @click="clickShopCheck">
  15. <uni-icons v-if="formData.is_anonymous == 1" color="#41ABF5" type="checkbox-filled"
  16. size="20"></uni-icons>
  17. <uni-icons v-else color="#ccc" type="circle" size="20"></uni-icons>
  18. <view class="ml-2 fs-24 fc-6">
  19. 匿名提交
  20. </view>
  21. </view>
  22. </view>
  23. <view class="shop-box align-items-center mb-48">
  24. <image class="shop-img mr-20" :src="shopLogo" mode=""></image>
  25. <view class="fs-30 fc-3">
  26. {{shopName}}
  27. </view>
  28. </view>
  29. <view class="align-items-center">
  30. <view class="fs-30 fw-600 fc-0 mr-10">
  31. 评分
  32. </view>
  33. <uni-rate v-model="formData.grade" margin="10" active-color="#FF7F00" color="#F1F1F1" />
  34. <view class="fc-FF7F00 fs-28 ml-40">
  35. {{formData.grade == 1?'非常差':formData.grade == 2?'一般':formData.grade == 3?'好':formData.grade == 4?'很棒':'非常棒'}}
  36. </view>
  37. </view>
  38. </view>
  39. <view class="bgc-f p-24 b-rad-20 mb-18 box-sizing-border">
  40. <view class="fs-36 fw-600 fc-3 mb-8">
  41. 请输入你的评价内容
  42. </view>
  43. <view class="textarea-box">
  44. <textarea class="textarea" v-model="formData.content" placeholder-style="color:#ccc" auto-height maxlength='100'
  45. placeholder="请输入" />
  46. </view>
  47. <view class="up-img-box align-items-center flex-wrap-wrap">
  48. <view class="up-img" v-for="(item, index) in formData.images" :key="index">
  49. <image class="img" :src="item" mode="aspectFill"></image>
  50. <uni-icons @click="deleteImg(index)" class="delete-icons" color="#000" type="clear"
  51. size="20"></uni-icons>
  52. </view>
  53. <view @click="upImg" v-if="formData.images.length<= 5"
  54. class="add-img-box flex-direction flex-justify-center align-items-center bgc-F6F6F6">
  55. <image class="add-img" src="@/static/img/my/sc.png" mode=""></image>
  56. <view class="fs-24 fc-9">
  57. 上传照片
  58. </view>
  59. <view class="fs-24 fc-9">
  60. (最多6张)
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </scroll-view>
  67. <view class="bot-box bgc-f">
  68. <view class="bot-but fc-f fs-32 text-align-center" :class="formType?'bgc-4FB3EF':'bgc-B3DDFB'"
  69. @click="submit">
  70. 提交评价
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import {
  77. commentCreate
  78. } from '@/api/comment.js'
  79. import tools from '@/service/tools';
  80. import {
  81. upLoadingFileOss
  82. } from "@/service/upLoadingFile.js"
  83. export default {
  84. components: {},
  85. data() {
  86. return {
  87. formType: true,
  88. formData: {
  89. grade: 5, //总体
  90. is_anonymous: 0, //匿名
  91. content: '',
  92. images: [],
  93. order_id: ''
  94. },
  95. shopName: '',
  96. shopLogo: ''
  97. };
  98. },
  99. onLoad(data) {
  100. console.log(data);
  101. if (data) {
  102. this.formData.order_id = data.orderId
  103. this.shopName = data.shopName
  104. this.shopLogo = data.shopLogo
  105. }
  106. },
  107. mounted() {},
  108. methods: {
  109. submit() {
  110. commentCreate(this.formData).then((res) => {
  111. if (res.code == 1) {
  112. tools.success(res.msg)
  113. setTimeout(() => {
  114. uni.navigateBack({
  115. delta: 1
  116. })
  117. }, 1000)
  118. } else {
  119. tools.error(res.msg)
  120. }
  121. })
  122. },
  123. deleteImg(index) {
  124. this.formData.images.splice(index, 1)
  125. },
  126. upImg() {
  127. uni.chooseImage({
  128. count: 6,
  129. sizeType: ["compressed", "camera"],
  130. sourceType: ["album", "camera"],
  131. success: (res) => {
  132. res.tempFiles.forEach((file) => {
  133. this.uploadingFile(file);
  134. })
  135. }
  136. })
  137. },
  138. uploadingFile(file) {
  139. upLoadingFileOss(file.path).then((res) => {
  140. if (res) {
  141. this.formData.images.push(res)
  142. } else {
  143. tools.error('图片上传失败')
  144. }
  145. })
  146. },
  147. clickShopCheck() {
  148. if (this.formData.is_anonymous == 0) {
  149. this.formData.is_anonymous = 1
  150. } else {
  151. this.formData.is_anonymous = 0
  152. }
  153. },
  154. scrolltolower() {
  155. console.log('触底');
  156. },
  157. },
  158. }
  159. </script>
  160. <style lang="scss" scoped>
  161. .content-box {
  162. padding: 24rpx;
  163. box-sizing: border-box;
  164. }
  165. .bot-box {
  166. width: 100%;
  167. padding: 12rpx 32rpx;
  168. box-sizing: border-box;
  169. }
  170. .bot-but {
  171. width: 100%;
  172. height: 92rpx;
  173. line-height: 92rpx;
  174. border-radius: 200rpx;
  175. }
  176. .shop-img {
  177. width: 88rpx;
  178. height: 88rpx;
  179. border-radius: 8rpx;
  180. }
  181. .goods-img {
  182. width: 108rpx;
  183. height: 108rpx;
  184. border-radius: 8rpx;
  185. }
  186. .rider-img {
  187. width: 80rpx;
  188. height: 80rpx;
  189. border-radius: 8rpx;
  190. }
  191. .rider-rate-img {
  192. width: 48rpx;
  193. height: 48rpx;
  194. }
  195. .rider-rate-but {
  196. padding: 16rpx 0;
  197. }
  198. .textarea-box {
  199. width: 100%;
  200. height: 200rpx;
  201. }
  202. .textarea{
  203. height: 180rpx !important;
  204. }
  205. .up-img {
  206. width: 204rpx;
  207. height: 204rpx;
  208. margin: 0 8rpx 8rpx 0;
  209. position: relative;
  210. .img {
  211. width: 100%;
  212. height: 100%;
  213. border-radius: 4rpx;
  214. }
  215. .delete-icons {
  216. position: absolute;
  217. right: 0;
  218. top: 0;
  219. }
  220. }
  221. .add-img-box {
  222. width: 204rpx;
  223. height: 204rpx;
  224. border: 1px dashed #666;
  225. .add-img {
  226. width: 56rpx;
  227. height: 56rpx;
  228. }
  229. }
  230. </style>