feedBack.vue 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <div class="page_feedBack">
  3. <van-sticky>
  4. <div class="feedBackTitle">
  5. <i class="iconfont icon-zuojiantou jiantou" @click="$router.go(-1)"></i>
  6. <span class="titleName">意见反馈</span>
  7. </div>
  8. </van-sticky>
  9. <div class="feedBackTip">问题类型</div>
  10. <div class="typeBox">
  11. <p :class="Num == 1 ? 'active' : ''" @click="onClick(1)">使用操作</p>
  12. <p :class="Num == 2 ? 'active' : ''" @click="onClick(2)">产品建议</p>
  13. <p :class="Num == 3 ? 'active' : ''" @click="onClick(3)">产品缺陷</p>
  14. <p :class="Num == 4 ? 'active' : ''" @click="onClick(4)">投诉</p>
  15. </div>
  16. <div class="feedBackTip">反馈标题</div>
  17. <div>
  18. <van-field
  19. v-model="form.title"
  20. type="text"
  21. maxlength="30"
  22. placeholder="请填写标题30个字以内"
  23. />
  24. </div>
  25. <div class="feedBackTip">
  26. 反馈内容
  27. <span style="font-size: .75rem;color:#ABABAB">(最多上传6张图片)</span>
  28. </div>
  29. <div class="feedBox">
  30. <van-field
  31. v-model="form.content"
  32. rows="3"
  33. autosize
  34. type="textarea"
  35. maxlength="50"
  36. placeholder="请输入反馈信息..."
  37. show-word-limit
  38. />
  39. <div class="uploaderBox">
  40. <van-uploader
  41. v-model="fileList"
  42. multiple
  43. :max-count="6"
  44. :data="uploadFileData"
  45. :before-read="beforeRead"
  46. :after-read="afterRead"
  47. />
  48. </div>
  49. </div>
  50. <div class="feedBackTip">
  51. 联系方式(手机号)
  52. <span style="color:#FF5400">*</span>
  53. </div>
  54. <div>
  55. <van-field v-model="form.phone" type="tel" placeholder="请输入联系方式" />
  56. </div>
  57. <div class="feedBackTip">接受电话处理时间</div>
  58. <div class="typeBox1">
  59. <p :class="time == 1 ? 'active' : ''" @click="clickTime(1)">任何时间</p>
  60. <p :class="time == 2 ? 'active' : ''" @click="clickTime(2)">
  61. 09:00~12:00
  62. </p>
  63. <p :class="time == 3 ? 'active' : ''" @click="clickTime(3)">
  64. 13:00~18:00
  65. </p>
  66. <p :class="time == 4 ? 'active' : ''" @click="clickTime(4)">从不接受</p>
  67. </div>
  68. <div>
  69. <div class="submitBtn" v-show="show">提交反馈</div>
  70. <div class="submitBtnSuccess" @click="submitFeed">提交反馈</div>
  71. </div>
  72. </div>
  73. </template>
  74. <script>
  75. import { submitFeed } from "@/api/patient/patient";
  76. import { getToken } from "@/api/qiniu";
  77. import { getFileExtension } from "@/utils/tools";
  78. export default {
  79. data() {
  80. return {
  81. message: "",
  82. fileList: [],
  83. tel: "",
  84. Num: 1,
  85. time: 1,
  86. show: false,
  87. form: {
  88. admin_user_id: "",
  89. title: "",
  90. content: "",
  91. phone: "",
  92. time: "",
  93. images: ""
  94. },
  95. qiniuDomain: "https://images.shengws.com/",
  96. uploadFileData: { token: "", key: "" }
  97. };
  98. },
  99. methods: {
  100. onClick(id) {
  101. if (id == 1) {
  102. this.Num = 1;
  103. } else if (id == 2) {
  104. this.Num = 2;
  105. } else if (id == 3) {
  106. this.Num = 3;
  107. } else if (id == 4) {
  108. this.Num = 4;
  109. }
  110. },
  111. clickTime(id) {
  112. if (id == 1) {
  113. this.time = 1;
  114. } else if (id == 2) {
  115. this.time = 2;
  116. } else if (id == 3) {
  117. this.time = 3;
  118. } else if (id == 4) {
  119. this.time = 4;
  120. }
  121. },
  122. submitFeed() {
  123. if (this.form.phone === "") {
  124. this.$toast("手机号不能为空");
  125. return false;
  126. }
  127. const params = {
  128. question: this.Num,
  129. title: this.form.title,
  130. content: this.form.content,
  131. phone: this.form.phone,
  132. time: this.time,
  133. admin_user_id: this.form.admin_user_id
  134. };
  135. submitFeed(params).then(response => {
  136. if (response.data.state === 1) {
  137. var feedback = response.data.data.feedback;
  138. this.$toast("保存成功");
  139. this.form.title = "";
  140. this.form.content = "";
  141. this.form.phone = "";
  142. this.$router.push("/newMy");
  143. }
  144. });
  145. },
  146. afterRead(file) {
  147. console.log("file", file);
  148. },
  149. // beforeRead(file) {
  150. // console.log("上传", file);
  151. // console.log(file.name);
  152. // this.form.images = this.qiniuDomain + file.name;
  153. // console.log("图片", this.form.images);
  154. // },
  155. beforeRead(file) {
  156. console.log("file", file);
  157. var date = new Date();
  158. var ext = getFileExtension(file.name);
  159. var key =
  160. date.getFullYear() +
  161. (date.getMonth() + 1) +
  162. date.getDate() +
  163. date.getHours() +
  164. date.getMinutes() +
  165. date.getSeconds() +
  166. "_o_" +
  167. file.lastModified +
  168. "." +
  169. ext;
  170. const _self = this;
  171. return new Promise((resolve, reject) => {
  172. getToken()
  173. .then(response => {
  174. const token = response.data.data.uptoken;
  175. console.log("token2是什么?", token);
  176. _self._data.uploadFileData.token = token;
  177. _self._data.uploadFileData.key = key;
  178. resolve(true);
  179. })
  180. .catch(err => {
  181. reject(false);
  182. });
  183. });
  184. }
  185. },
  186. created() {
  187. var id = this.$route.query.id;
  188. this.form.admin_user_id = id;
  189. }
  190. };
  191. </script>
  192. <style lang="scss" scoped>
  193. .page_feedBack {
  194. height: 100%;
  195. overflow: hidden;
  196. overflow-y: auto;
  197. background: #eeeeee;
  198. .feedBackTitle {
  199. background: #fff;
  200. padding: 0 1.125rem;
  201. height: 3.125rem;
  202. display: flex;
  203. align-items: center;
  204. }
  205. .jiantou {
  206. font-size: 1.5rem;
  207. font-weight: 600;
  208. margin-right: 7rem;
  209. }
  210. .titleName {
  211. font-size: 1.125rem;
  212. font-weight: 600;
  213. }
  214. .aboutImg {
  215. padding: 0 0.75rem;
  216. height: 10.0625rem;
  217. margin: 1rem 0 0.3125rem;
  218. img {
  219. width: 100%;
  220. height: 100%;
  221. }
  222. }
  223. .feedBackTip {
  224. height: 2.375rem;
  225. line-height: 2.375rem;
  226. padding-left: 0.75rem;
  227. font-size: 0.875rem;
  228. color: #696969;
  229. }
  230. .feedBox {
  231. min-height: 11.875rem;
  232. background: #fff;
  233. .uploaderBox {
  234. margin: 1.25rem 0 0 1rem;
  235. }
  236. }
  237. .typeBox {
  238. display: flex;
  239. justify-content: space-around;
  240. p {
  241. width: 5rem;
  242. height: 1.875rem;
  243. line-height: 1.875rem;
  244. text-align: center;
  245. border: 1px solid rgba(204, 204, 204, 1);
  246. font-size: 0.875rem;
  247. color: #696969;
  248. border-radius: 5px;
  249. cursor: pointer;
  250. }
  251. .active {
  252. background: rgba(51, 138, 251, 1);
  253. color: #fff;
  254. border: 1px solid #338afb;
  255. }
  256. }
  257. .typeBox1 {
  258. display: flex;
  259. justify-content: space-around;
  260. p {
  261. // width: 5rem;
  262. // height: 1.875rem;
  263. // line-height: 1.875rem;
  264. padding: 8px 6px;
  265. text-align: center;
  266. border: 1px solid rgba(204, 204, 204, 1);
  267. font-size: 0.875rem;
  268. color: #696969;
  269. border-radius: 5px;
  270. cursor: pointer;
  271. }
  272. .active {
  273. background: rgba(51, 138, 251, 1);
  274. color: #fff;
  275. border: 1px solid #338afb;
  276. }
  277. }
  278. .submitBtn {
  279. width: 80%;
  280. height: 2.75rem;
  281. line-height: 2.75rem;
  282. text-align: center;
  283. background: #c5c5c5;
  284. color: #fff;
  285. margin: 1.25rem auto;
  286. border-radius: 1.875rem;
  287. }
  288. .submitBtnSuccess {
  289. width: 80%;
  290. height: 2.75rem;
  291. line-height: 2.75rem;
  292. text-align: center;
  293. background: #338afb;
  294. color: #fff;
  295. margin: 1.25rem auto;
  296. border-radius: 1.875rem;
  297. }
  298. }
  299. ::-webkit-scrollbar {
  300. width: 0;
  301. }
  302. </style>