index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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. <div class="image-icon"></div>
  18. <div class="title">提价成功</div>
  19. <div class="tip">您的反馈信息已提交,感谢您的宝贵意见。</div>
  20. <div class="line" />
  21. </div>
  22. </van-dialog>
  23. </div>
  24. </template>
  25. <script>
  26. import { mapGetters } from 'vuex'
  27. export default {
  28. layout: 'app',
  29. data() {
  30. return {
  31. content: '',
  32. showModal: false,
  33. }
  34. },
  35. computed: {
  36. ...mapGetters(['supplierInfo', 'userInfo', 'routePrefix']),
  37. isEmpty() {
  38. return this.content.length === 0
  39. },
  40. },
  41. methods: {
  42. async onSubmit() {
  43. const { clubUserId } = this.userInfo
  44. if (this.isEmpty) {
  45. this.$toast('留言不能为空')
  46. return
  47. }
  48. try {
  49. await this.$http.api.feedback({ clubUserId, content: this.content })
  50. this.showModal = true
  51. this.content = ''
  52. } catch (error) {
  53. console.log(error)
  54. }
  55. },
  56. onConfirm() {
  57. this.showModal = false
  58. this.$router.push(this.routePrefix)
  59. },
  60. },
  61. }
  62. </script>
  63. <style scoped lang="scss">
  64. // pc 端
  65. @media screen and (min-width: 768px) {
  66. .page-top {
  67. height: 360px;
  68. @include themify($themes) {
  69. background: themed('pc-banner-feedback');
  70. }
  71. background-size: auto 360px;
  72. .logo {
  73. display: block;
  74. width: 120px;
  75. height: 120px;
  76. border-radius: 50%;
  77. background: #fff;
  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. @include themify($themes) {
  110. background-color: themed('color');
  111. }
  112. color: #fff;
  113. transition: all 0.2s;
  114. cursor: pointer;
  115. &:hover {
  116. @include themify($themes) {
  117. background-color: themed('hover-color');
  118. }
  119. }
  120. &.disabled {
  121. background-color: #d8d8d8 !important;
  122. }
  123. }
  124. }
  125. .dialog {
  126. width: 380px;
  127. padding-top: 40px;
  128. border-radius: 0;
  129. .dialog-content {
  130. width: 100%;
  131. height: 100%;
  132. display: flex;
  133. justify-content: center;
  134. align-items: center;
  135. flex-direction: column;
  136. .title {
  137. font-size: 24px;
  138. color: #101010;
  139. margin: 28px 0 12px;
  140. }
  141. .tip {
  142. color: #404040;
  143. font-size: 16px;
  144. }
  145. .line {
  146. width: 340px;
  147. height: 1px;
  148. margin: 0 auto;
  149. margin-top: 28px;
  150. background: #d8d8d8;
  151. }
  152. .image-icon {
  153. width: 140px;
  154. height: 100px;
  155. @include themify($themes) {
  156. background: themed('pc-icon-feedback-submit') no-repeat center;
  157. background-size: 140px 100px;
  158. }
  159. }
  160. }
  161. }
  162. }
  163. // 移动 端
  164. @media screen and (max-width: 768px) {
  165. .page-top {
  166. height: 46vw;
  167. @include themify($themes) {
  168. background: themed('h5-banner-feedback');
  169. }
  170. background-size: auto 46vw;
  171. .logo {
  172. display: block;
  173. width: 14.8vw;
  174. height: 14.8vw;
  175. border-radius: 50%;
  176. background: #fff;
  177. }
  178. .name {
  179. font-size: 4vw;
  180. color: #fff;
  181. }
  182. }
  183. .page-content {
  184. .control {
  185. display: block;
  186. width: 100%;
  187. height: 56vw;
  188. border: 0.1vw solid #d8d8d8;
  189. outline: none;
  190. box-sizing: border-box;
  191. font-size: 3.2vw;
  192. color: #101010;
  193. }
  194. .submit {
  195. text-align: center;
  196. line-height: 11.6vw;
  197. width: 100%;
  198. height: 11.6vw;
  199. border-radius: 0.2vw;
  200. font-size: 4vw;
  201. @include themify($themes) {
  202. background-color: themed('color');
  203. }
  204. color: #fff;
  205. &.disabled {
  206. background-color: #d8d8d8;
  207. }
  208. }
  209. }
  210. .dialog {
  211. width: 76vw;
  212. border-radius: 0;
  213. .dialog-content {
  214. padding-top: 3.2vw;
  215. width: 100%;
  216. height: 100%;
  217. display: flex;
  218. justify-content: center;
  219. align-items: center;
  220. flex-direction: column;
  221. .title {
  222. font-size: 4.6vw;
  223. color: #101010;
  224. margin: 3.2vw 0;
  225. }
  226. .tip {
  227. color: #404040;
  228. font-size: 3.2vw;
  229. }
  230. .image-icon {
  231. width: 30vw;
  232. height: 20vw;
  233. @include themify($themes) {
  234. background: themed('pc-icon-feedback-submit') no-repeat center;
  235. background-size: 30vw 20vw;
  236. }
  237. }
  238. }
  239. }
  240. }
  241. </style>