index.vue 5.1 KB

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