index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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', 'authUserId', 'type']),
  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. const url = `/${this.type}`
  62. this.$router.push(url)
  63. },
  64. },
  65. }
  66. </script>
  67. <style scoped lang="scss">
  68. // pc 端
  69. @media screen and (min-width: 768px) {
  70. .page-top {
  71. height: 360px;
  72. background: url(https://static.caimei365.com/www/authentic/pc/bg-doc.png);
  73. background-size: auto 360px;
  74. .logo {
  75. display: block;
  76. width: 120px;
  77. height: 120px;
  78. border-radius: 50%;
  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. }
  167. .name {
  168. font-size: 4vw;
  169. color: #fff;
  170. }
  171. }
  172. .page-content {
  173. .control {
  174. display: block;
  175. width: 100%;
  176. height: 56vw;
  177. border: 0.1vw solid #d8d8d8;
  178. outline: none;
  179. box-sizing: border-box;
  180. font-size: 3.2vw;
  181. color: #101010;
  182. }
  183. .submit {
  184. text-align: center;
  185. line-height: 11.6vw;
  186. width: 100%;
  187. height: 11.6vw;
  188. border-radius: 0.2vw;
  189. font-size: 4vw;
  190. background-color: #bc1724;
  191. color: #fff;
  192. &.disabled {
  193. background-color: #d8d8d8;
  194. }
  195. }
  196. }
  197. .feedback-icon {
  198. display: block;
  199. width: 26vw;
  200. }
  201. .dialog {
  202. width: 76vw;
  203. border-radius: 0;
  204. .dialog-content {
  205. width: 100%;
  206. height: 100%;
  207. display: flex;
  208. justify-content: center;
  209. align-items: center;
  210. flex-direction: column;
  211. .title {
  212. font-size: 4.6vw;
  213. color: #101010;
  214. margin: 3.2vw 0;
  215. }
  216. .tip {
  217. color: #404040;
  218. font-size: 3.2vw;
  219. }
  220. }
  221. }
  222. }
  223. </style>