index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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. }
  79. .name {
  80. font-size: 30px;
  81. color: #fff;
  82. }
  83. }
  84. .page-content {
  85. width: 1200px;
  86. margin-left: auto;
  87. margin-right: auto;
  88. box-sizing: border-box;
  89. background-color: #fff;
  90. .control {
  91. display: block;
  92. width: 100%;
  93. height: 280px;
  94. border: 1px solid #d8d8d8;
  95. outline: none;
  96. box-sizing: border-box;
  97. font-size: 16px;
  98. color: #101010;
  99. }
  100. .submit {
  101. text-align: center;
  102. line-height: 46px;
  103. width: 326px;
  104. height: 46px;
  105. margin-left: auto;
  106. margin-right: auto;
  107. border-radius: 4px;
  108. font-size: 16px;
  109. background-color: #bc1724;
  110. color: #fff;
  111. transition: all 0.2s;
  112. cursor: pointer;
  113. &:hover {
  114. background-color: #a50613;
  115. }
  116. &.disabled {
  117. background-color: #d8d8d8 !important;
  118. }
  119. }
  120. }
  121. .dialog {
  122. width: 380px;
  123. padding-top: 40px;
  124. border-radius: 0;
  125. .dialog-content {
  126. width: 100%;
  127. height: 100%;
  128. display: flex;
  129. justify-content: center;
  130. align-items: center;
  131. flex-direction: column;
  132. .title {
  133. font-size: 24px;
  134. color: #101010;
  135. margin: 28px 0 12px;
  136. }
  137. .tip {
  138. color: #404040;
  139. font-size: 16px;
  140. }
  141. .line {
  142. width: 340px;
  143. height: 1px;
  144. margin: 0 auto;
  145. margin-top: 28px;
  146. background: #d8d8d8;
  147. }
  148. .feedback-icon {
  149. width: 140px;
  150. }
  151. }
  152. }
  153. }
  154. // 移动 端
  155. @media screen and (max-width: 768px) {
  156. .page-top {
  157. height: 46vw;
  158. background: url(https://static.caimei365.com/www/authentic/h5/bg-feedback.png);
  159. background-size: auto 46vw;
  160. .logo {
  161. display: block;
  162. width: 14.8vw;
  163. height: 14.8vw;
  164. border-radius: 50%;
  165. }
  166. .name {
  167. font-size: 4vw;
  168. color: #fff;
  169. }
  170. }
  171. .page-content {
  172. .control {
  173. display: block;
  174. width: 100%;
  175. height: 56vw;
  176. border: 0.1vw solid #d8d8d8;
  177. outline: none;
  178. box-sizing: border-box;
  179. font-size: 3.2vw;
  180. color: #101010;
  181. }
  182. .submit {
  183. text-align: center;
  184. line-height: 11.6vw;
  185. width: 100%;
  186. height: 11.6vw;
  187. border-radius: 0.2vw;
  188. font-size: 4vw;
  189. background-color: #bc1724;
  190. color: #fff;
  191. &.disabled {
  192. background-color: #d8d8d8;
  193. }
  194. }
  195. }
  196. .feedback-icon {
  197. display: block;
  198. width: 26vw;
  199. }
  200. .dialog {
  201. width: 76vw;
  202. border-radius: 0;
  203. .dialog-content {
  204. width: 100%;
  205. height: 100%;
  206. display: flex;
  207. justify-content: center;
  208. align-items: center;
  209. flex-direction: column;
  210. .title {
  211. font-size: 4.6vw;
  212. color: #101010;
  213. margin: 3.2vw 0;
  214. }
  215. .tip {
  216. color: #404040;
  217. font-size: 3.2vw;
  218. }
  219. }
  220. }
  221. }
  222. </style>