index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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']),
  40. isEmpty() {
  41. return this.content.length === 0
  42. },
  43. },
  44. async created() {
  45. try {
  46. await this.$http.api.checkToken()
  47. } catch (error) {
  48. console.log(error)
  49. }
  50. },
  51. methods: {
  52. async onSubmit() {
  53. const { clubUserId } = this.userInfo
  54. if (this.isEmpty) {
  55. this.$toast('留言不能为空')
  56. return
  57. }
  58. try {
  59. await this.$http.api.feedback({ clubUserId, content: this.content })
  60. this.showModal = true
  61. this.content = ''
  62. } catch (error) {
  63. console.log(error)
  64. }
  65. },
  66. onConfirm() {
  67. this.showModal = false
  68. this.$router.replace('/ph')
  69. },
  70. },
  71. }
  72. </script>
  73. <style scoped lang="scss">
  74. // pc 端
  75. @media screen and (min-width: 768px) {
  76. .page-top {
  77. height: 360px;
  78. background: url(https://static.caimei365.com/www/authentic/pc/bg-doc.png);
  79. background-size: auto 360px;
  80. .logo {
  81. display: block;
  82. width: 120px;
  83. height: 120px;
  84. border-radius: 50%;
  85. }
  86. .name {
  87. font-size: 30px;
  88. color: #fff;
  89. }
  90. }
  91. .page-content {
  92. width: 1200px;
  93. margin-left: auto;
  94. margin-right: auto;
  95. box-sizing: border-box;
  96. background-color: #fff;
  97. .control {
  98. display: block;
  99. width: 100%;
  100. height: 280px;
  101. border: 1px solid #d8d8d8;
  102. outline: none;
  103. box-sizing: border-box;
  104. font-size: 16px;
  105. color: #101010;
  106. }
  107. .submit {
  108. text-align: center;
  109. line-height: 46px;
  110. width: 326px;
  111. height: 46px;
  112. margin-left: auto;
  113. margin-right: auto;
  114. border-radius: 4px;
  115. font-size: 16px;
  116. background-color: #bc1724;
  117. color: #fff;
  118. transition: all 0.2s;
  119. cursor: pointer;
  120. &:hover {
  121. background-color: #a50613;
  122. }
  123. &.disabled {
  124. background-color: #d8d8d8 !important;
  125. }
  126. }
  127. }
  128. .dialog {
  129. width: 380px;
  130. padding-top: 40px;
  131. border-radius: 0;
  132. .dialog-content {
  133. width: 100%;
  134. height: 100%;
  135. display: flex;
  136. justify-content: center;
  137. align-items: center;
  138. flex-direction: column;
  139. .title {
  140. font-size: 24px;
  141. color: #101010;
  142. margin: 28px 0 12px;
  143. }
  144. .tip {
  145. color: #404040;
  146. font-size: 16px;
  147. }
  148. .line {
  149. width: 340px;
  150. height: 1px;
  151. margin: 0 auto;
  152. margin-top: 28px;
  153. background: #d8d8d8;
  154. }
  155. .feedback-icon {
  156. width: 140px;
  157. }
  158. }
  159. }
  160. }
  161. // 移动 端
  162. @media screen and (max-width: 768px) {
  163. .page-top {
  164. height: 46vw;
  165. background: url(https://static.caimei365.com/www/authentic/h5/bg-feedback.png);
  166. background-size: auto 46vw;
  167. .logo {
  168. display: block;
  169. width: 14.8vw;
  170. height: 14.8vw;
  171. border-radius: 50%;
  172. }
  173. .name {
  174. font-size: 4vw;
  175. color: #fff;
  176. }
  177. }
  178. .page-content {
  179. .control {
  180. display: block;
  181. width: 100%;
  182. height: 56vw;
  183. border: 0.1vw solid #d8d8d8;
  184. outline: none;
  185. box-sizing: border-box;
  186. font-size: 3.2vw;
  187. color: #101010;
  188. }
  189. .submit {
  190. text-align: center;
  191. line-height: 11.6vw;
  192. width: 100%;
  193. height: 11.6vw;
  194. border-radius: 0.2vw;
  195. font-size: 4vw;
  196. background-color: #bc1724;
  197. color: #fff;
  198. &.disabled {
  199. background-color: #d8d8d8;
  200. }
  201. }
  202. }
  203. .feedback-icon {
  204. display: block;
  205. width: 26vw;
  206. }
  207. .dialog {
  208. width: 76vw;
  209. border-radius: 0;
  210. .dialog-content {
  211. width: 100%;
  212. height: 100%;
  213. display: flex;
  214. justify-content: center;
  215. align-items: center;
  216. flex-direction: column;
  217. .title {
  218. font-size: 4.6vw;
  219. color: #101010;
  220. margin: 3.2vw 0;
  221. }
  222. .tip {
  223. color: #404040;
  224. font-size: 3.2vw;
  225. }
  226. }
  227. }
  228. }
  229. </style>