index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div class="page">
  3. <div class="page-top flex flex-col justify-center items-center">
  4. <img class="logo" :src="supplierInfo.logo" />
  5. <div class="name mt-2" v-text="supplierInfo.shopName + '意见反馈'"></div>
  6. </div>
  7. <div class="page-content p-4 md:my-4">
  8. <textarea
  9. class="control p-2"
  10. placeholder="请在此处输入您的宝贵意见(限200字)"
  11. v-model="content"
  12. ></textarea>
  13. <div class="submit mt-6" @click="onSubmit">提交</div>
  14. </div>
  15. <van-dialog v-model="showModal" class="dialog" @confirm="onConfirm">
  16. <div class="dialog-content">
  17. <img
  18. class="feedback-icon"
  19. :src="$store.getters.static + '/icon-submit-success.png'"
  20. />
  21. <div class="title">提价成功</div>
  22. <div class="tip">您的反馈信息已提交,感谢您的宝贵意见。</div>
  23. <div class="line" />
  24. </div>
  25. </van-dialog>
  26. </div>
  27. </template>
  28. <script>
  29. import { mapGetters } from 'vuex'
  30. export default {
  31. layout: 'app',
  32. data() {
  33. return {
  34. content: '',
  35. showModal: false,
  36. }
  37. },
  38. computed: {
  39. ...mapGetters(['supplierInfo', 'userInfo', 'routeProfix']),
  40. isEmpty() {
  41. return this.content.length === 0
  42. },
  43. },
  44. methods: {
  45. async onSubmit() {
  46. const { clubUserId } = this.userInfo
  47. if (this.isEmpty) {
  48. this.$toast('留言不能为空')
  49. return
  50. }
  51. try {
  52. await this.$http.api.feedback({ clubUserId, content: this.content })
  53. this.showModal = true
  54. this.content = ''
  55. } catch (error) {
  56. console.log(error)
  57. }
  58. },
  59. onConfirm() {
  60. this.showModal = false
  61. this.$router.push(this.routeProfix)
  62. },
  63. },
  64. }
  65. </script>
  66. <style scoped lang="scss">
  67. // pc 端
  68. @media screen and (min-width: 768px) {
  69. .page-top {
  70. height: 360px;
  71. background: url(https://static.caimei365.com/www/authentic/pc/bg-doc.png);
  72. background-size: auto 360px;
  73. .logo {
  74. display: block;
  75. width: 120px;
  76. height: 120px;
  77. border-radius: 50%;
  78. background: #fff;
  79. }
  80. .name {
  81. font-size: 30px;
  82. color: #fff;
  83. }
  84. }
  85. .page-content {
  86. width: 1200px;
  87. margin-left: auto;
  88. margin-right: auto;
  89. box-sizing: border-box;
  90. background-color: #fff;
  91. .control {
  92. display: block;
  93. width: 100%;
  94. height: 280px;
  95. border: 1px solid #d8d8d8;
  96. outline: none;
  97. box-sizing: border-box;
  98. font-size: 16px;
  99. color: #101010;
  100. }
  101. .submit {
  102. text-align: center;
  103. line-height: 46px;
  104. width: 326px;
  105. height: 46px;
  106. margin-left: auto;
  107. margin-right: auto;
  108. border-radius: 4px;
  109. font-size: 16px;
  110. background-color: #bc1724;
  111. color: #fff;
  112. transition: all 0.2s;
  113. cursor: pointer;
  114. &:hover {
  115. background-color: #a50613;
  116. }
  117. &.disabled {
  118. background-color: #d8d8d8 !important;
  119. }
  120. }
  121. }
  122. .dialog {
  123. width: 380px;
  124. padding-top: 40px;
  125. border-radius: 0;
  126. .dialog-content {
  127. width: 100%;
  128. height: 100%;
  129. display: flex;
  130. justify-content: center;
  131. align-items: center;
  132. flex-direction: column;
  133. .title {
  134. font-size: 24px;
  135. color: #101010;
  136. margin: 28px 0 12px;
  137. }
  138. .tip {
  139. color: #404040;
  140. font-size: 16px;
  141. }
  142. .line {
  143. width: 340px;
  144. height: 1px;
  145. margin: 0 auto;
  146. margin-top: 28px;
  147. background: #d8d8d8;
  148. }
  149. .feedback-icon {
  150. width: 140px;
  151. }
  152. }
  153. }
  154. }
  155. // 移动 端
  156. @media screen and (max-width: 768px) {
  157. .page-top {
  158. height: 46vw;
  159. background: url(https://static.caimei365.com/www/authentic/h5/bg-feedback.png);
  160. background-size: auto 46vw;
  161. .logo {
  162. display: block;
  163. width: 14.8vw;
  164. height: 14.8vw;
  165. border-radius: 50%;
  166. background: #fff;
  167. }
  168. .name {
  169. font-size: 4vw;
  170. color: #fff;
  171. }
  172. }
  173. .page-content {
  174. .control {
  175. display: block;
  176. width: 100%;
  177. height: 56vw;
  178. border: 0.1vw solid #d8d8d8;
  179. outline: none;
  180. box-sizing: border-box;
  181. font-size: 3.2vw;
  182. color: #101010;
  183. }
  184. .submit {
  185. text-align: center;
  186. line-height: 11.6vw;
  187. width: 100%;
  188. height: 11.6vw;
  189. border-radius: 0.2vw;
  190. font-size: 4vw;
  191. background-color: #bc1724;
  192. color: #fff;
  193. &.disabled {
  194. background-color: #d8d8d8;
  195. }
  196. }
  197. }
  198. .feedback-icon {
  199. display: block;
  200. width: 26vw;
  201. }
  202. .dialog {
  203. width: 76vw;
  204. border-radius: 0;
  205. .dialog-content {
  206. width: 100%;
  207. height: 100%;
  208. display: flex;
  209. justify-content: center;
  210. align-items: center;
  211. flex-direction: column;
  212. .title {
  213. font-size: 4.6vw;
  214. color: #101010;
  215. margin: 3.2vw 0;
  216. }
  217. .tip {
  218. color: #404040;
  219. font-size: 3.2vw;
  220. }
  221. }
  222. }
  223. }
  224. </style>