普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

269 lines
6.5 KiB

2 months ago
  1. <template>
  2. <view class="page__view">
  3. <navbar title="立即评价" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#F3F2F7" />
  4. <view class="main form">
  5. <uv-form
  6. ref="form"
  7. :model="form"
  8. :rules="rules"
  9. errorType="toast"
  10. >
  11. <view class="card info">
  12. <view class="card-header">评价信息</view>
  13. <view class="form-item">
  14. <uv-form-item prop="content" :customStyle="formItemStyle">
  15. <view class="form-item-label">评价内容</view>
  16. <view class="form-item-content">
  17. <formTextarea v-model="form.content"></formTextarea>
  18. </view>
  19. </uv-form-item>
  20. </view>
  21. <view class="form-item">
  22. <uv-form-item prop="images" :customStyle="formItemStyle">
  23. <view class="form-item-label">上传图片/视频选填</view>
  24. <view class="form-item-content">
  25. <formUpload v-model="form.images"></formUpload>
  26. </view>
  27. </uv-form-item>
  28. </view>
  29. </view>
  30. <view class="card">
  31. <view class="form-item">
  32. <uv-form-item prop="productNum" :customStyle="formItemStyle">
  33. <view class="flex row">
  34. <view class="form-item-label">产品服务度</view>
  35. <view class="form-item-content">
  36. <uv-rate v-model="form.productNum" size="48rpx" gutter="16rpx" activeColor="#F7BA1E" :allowHalf="true" :minCount="0.5" ></uv-rate>
  37. </view>
  38. </view>
  39. </uv-form-item>
  40. </view>
  41. <view class="form-item">
  42. <uv-form-item prop="paperNum" :customStyle="formItemStyle">
  43. <view class="flex row">
  44. <view class="form-item-label">问卷体验</view>
  45. <view class="form-item-content">
  46. <uv-rate v-model="form.paperNum" size="48rpx" gutter="16rpx" activeColor="#F7BA1E" :allowHalf="true" :minCount="0.5" ></uv-rate>
  47. </view>
  48. </view>
  49. </uv-form-item>
  50. </view>
  51. <view class="form-item">
  52. <uv-form-item prop="logisticsNum" :customStyle="formItemStyle">
  53. <view class="flex row">
  54. <view class="form-item-label">物流速度</view>
  55. <view class="form-item-content">
  56. <uv-rate v-model="form.logisticsNum" size="48rpx" gutter="16rpx" activeColor="#F7BA1E" :allowHalf="true" :minCount="0.5" ></uv-rate>
  57. </view>
  58. </view>
  59. </uv-form-item>
  60. </view>
  61. </view>
  62. </uv-form>
  63. </view>
  64. <view class="bottom">
  65. <button class="btn" @click="onSubmit">提交申请</button>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. import { mapState } from 'vuex'
  71. import formTextarea from '@/pages_order/components/formTextarea.vue'
  72. import formUpload from '@/pages_order/components/formUpload.vue'
  73. export default {
  74. components: {
  75. formTextarea,
  76. formUpload,
  77. },
  78. data() {
  79. return {
  80. orderId: null,
  81. form: {
  82. content: null,
  83. images: [],
  84. productNum: null,
  85. paperNum: null,
  86. logisticsNum: null,
  87. },
  88. rules: {
  89. 'content': {
  90. type: 'string',
  91. required: true,
  92. message: '请输入评价',
  93. },
  94. 'productNum': {
  95. type: 'number',
  96. required: true,
  97. message: '请为【产品服务度】打分',
  98. },
  99. 'paperNum': {
  100. type: 'number',
  101. required: true,
  102. message: '请为【问卷体验】打分',
  103. },
  104. 'logisticsNum': {
  105. type: 'number',
  106. required: true,
  107. message: '请为【物流速度】打分',
  108. },
  109. },
  110. formItemStyle: { padding: 0 },
  111. }
  112. },
  113. computed: {
  114. ...mapState(['userInfo']),
  115. },
  116. onLoad(arg) {
  117. const { orderId } = arg
  118. this.orderId = orderId
  119. },
  120. methods: {
  121. async onSubmit() {
  122. try {
  123. await this.$refs.form.validate()
  124. const {
  125. content,
  126. images,
  127. productNum,
  128. paperNum,
  129. logisticsNum,
  130. } = this.form
  131. const params = {
  132. orderId: this.orderId,
  133. content,
  134. image: images.join(','),
  135. productNum,
  136. paperNum,
  137. logisticsNum,
  138. }
  139. await this.$fetch('evaluateOrder', params)
  140. uni.showToast({
  141. icon: 'success',
  142. title: '提交成功',
  143. });
  144. setTimeout(() => {
  145. this.$utils.navigateBack()
  146. }, 800)
  147. } catch (err) {
  148. console.log('onSubmit err', err)
  149. }
  150. },
  151. },
  152. }
  153. </script>
  154. <style scoped lang="scss">
  155. .page__view {
  156. width: 100vw;
  157. min-height: 100vh;
  158. background-color: $uni-bg-color;
  159. position: relative;
  160. /deep/ .nav-bar__view {
  161. position: fixed;
  162. top: 0;
  163. left: 0;
  164. }
  165. }
  166. .main {
  167. padding: calc(var(--status-bar-height) + 144rpx) 32rpx 236rpx 32rpx;
  168. }
  169. .card {
  170. padding: 32rpx;
  171. background: #FAFAFF;
  172. border: 2rpx solid #FFFFFF;
  173. border-radius: 32rpx;
  174. & + & {
  175. margin-top: 40rpx;
  176. }
  177. &-header {
  178. font-family: PingFang SC;
  179. font-weight: 500;
  180. font-size: 36rpx;
  181. line-height: 1.4;
  182. color: #252545;
  183. margin-bottom: 32rpx;
  184. }
  185. }
  186. .form {
  187. &-item {
  188. border-bottom: 2rpx solid #EEEEEE;
  189. &:last-child {
  190. border: none;
  191. }
  192. & + & {
  193. margin-top: 32rpx;
  194. }
  195. &-label {
  196. font-family: PingFang SC;
  197. font-weight: 400;
  198. font-size: 26rpx;
  199. line-height: 1.4;
  200. color: #181818;
  201. }
  202. }
  203. }
  204. .info {
  205. .form-item + .form-item {
  206. margin-top: 40rpx;
  207. }
  208. .form-item-content {
  209. margin-top: 16rpx;
  210. }
  211. }
  212. .row {
  213. justify-content: space-between;
  214. }
  215. .bottom {
  216. position: fixed;
  217. left: 0;
  218. bottom: 0;
  219. width: 100vw;
  220. // height: 200rpx;
  221. padding: 24rpx 40rpx;
  222. padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
  223. background: #FFFFFF;
  224. box-sizing: border-box;
  225. .btn {
  226. width: 100%;
  227. padding: 16rpx 0;
  228. box-sizing: border-box;
  229. font-family: PingFang SC;
  230. font-weight: 500;
  231. font-size: 36rpx;
  232. line-height: 1;
  233. color: #FFFFFF;
  234. background-image: linear-gradient(to right, #4B348F, #845CFA);
  235. border-radius: 41rpx;
  236. }
  237. }
  238. </style>