afterVisitList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <div class="visitList">
  3. <!-- <m-header v-if="headerStatus" /> -->
  4. <van-dropdown-menu :close-on-click-outside="false" active-color="#01C1B5">
  5. <van-dropdown-item v-model="value1" @change="onTypeChange" title="回访类型" :options="option1" />
  6. <van-dropdown-item
  7. v-model="value2"
  8. @change="onPurposeChange"
  9. :disabled="purposeStatus"
  10. title="回访目的"
  11. :options="option2"
  12. />
  13. <van-dropdown-item title="回访时间" ref="item" class="visitTime">
  14. <van-cell title="开始时间" is-link @click="onChangeDate('showStart')" :value="formatStartTime"></van-cell>
  15. <van-cell title="结束时间" is-link @click="onChangeDate('showEnd')" :value="formatEndTime"></van-cell>
  16. <div class="btnWrap">
  17. <div class="cancelBtn" @click="cancelBtn">重置</div>
  18. <div class="okBtn" @click="okBtn">确定</div>
  19. </div>
  20. </van-dropdown-item>
  21. </van-dropdown-menu>
  22. <van-popup v-model="dataForm.status" position="bottom" :style="{ height: '40%' }">
  23. <van-datetime-picker
  24. v-model="dataForm.currentDate"
  25. :min-date="dataForm.minDate"
  26. :max-date="dataForm.maxDate"
  27. :formatter="formatter"
  28. @cancel="dataForm.status = false"
  29. type="date"
  30. @confirm="chioseDate"
  31. />
  32. </van-popup>
  33. <van-list
  34. v-model="loading"
  35. v-if="dataShow"
  36. :finished="finished"
  37. finished-text="- 没有更多了 -"
  38. @load="getList"
  39. >
  40. <van-cell
  41. v-for="(item, index) in list"
  42. :key="index"
  43. class="cellGroup"
  44. title-class="sectionTitle"
  45. value-class="sectionValue"
  46. is-link
  47. @click="onHref(item)"
  48. >
  49. <template slot="title">
  50. <p >{{ item.type }}</p>
  51. <p class="type">{{ item.studentName }}</p>
  52. </template>
  53. <template solt="default">
  54. <p class="content van-ellipsis">{{ item.purpose }}</p>
  55. <p class="time">{{ item.visitTime }}</p>
  56. </template>
  57. </van-cell>
  58. </van-list>
  59. <m-empty v-else msg="暂无回访记录" />
  60. <van-icon name="plus" class="addVisit" @click="onAdd" />
  61. </div>
  62. </template>
  63. <script>
  64. import MHeader from "@/components/MHeader";
  65. import MEmpty from '@/components/MEmpty';
  66. import dayjs from "dayjs";
  67. import { browser } from "@/common/common";
  68. import { geteduVisitList } from "@/api/teacher";
  69. export default {
  70. components: { MHeader, MEmpty },
  71. data() {
  72. return {
  73. // addImg: require("@/assets/images/add_icon.png"),
  74. headerStatus: true,
  75. dataForm: {
  76. // 时间下拉框
  77. type: null,
  78. status: false,
  79. minDate: new Date(2000, 0, 1),
  80. maxDate: new Date(2025, 10, 1),
  81. currentDate: new Date(),
  82. },
  83. value1: "全部",
  84. value2: "全部",
  85. purposeStatus: true,
  86. option1: [
  87. { text: "全部", value: "全部" },
  88. { text: "课程推荐", value: "课程推荐" },
  89. { text: "常规回访", value: "常规回访" },
  90. { text: "云教练", value: "云教练" },
  91. { text: "其它", value: "其它" },
  92. ],
  93. option2: [],
  94. startDate: null,
  95. endDate: null,
  96. showStart: false,
  97. showEnd: false,
  98. formatEndTime: null,
  99. formatStartTime: null,
  100. list: [],
  101. loading: false,
  102. finished: false,
  103. params: {
  104. page: 1,
  105. rows: 20,
  106. },
  107. dataShow: true,
  108. };
  109. },
  110. mounted() {
  111. let params = this.$route.query;
  112. if (params.Authorization) {
  113. localStorage.setItem("Authorization", decodeURI(params.Authorization));
  114. localStorage.setItem("userInfo", decodeURI(params.Authorization));
  115. }
  116. if (browser().android || browser().iPhone) {
  117. this.headerStatus = false;
  118. }
  119. document.title = '回访记录'
  120. // this.getList()
  121. },
  122. methods: {
  123. onResetList() {
  124. this.list = [];
  125. this.params.page = 1;
  126. this.dataShow = true;
  127. this.loading = true;
  128. this.finished = false;
  129. this.getList()
  130. },
  131. onHref(item) {
  132. this.$router.push({
  133. path: '/addVisit',
  134. query: {
  135. id: item.id,
  136. name: '回访记录详情'
  137. }
  138. })
  139. },
  140. cancelBtn() {
  141. this.formatStartTime = null;
  142. this.formatEndTime = null;
  143. this.onResetList()
  144. this.$refs.item.toggle();
  145. },
  146. okBtn() {
  147. if(this.formatStartTime && this.formatEndTime) {
  148. this.onResetList()
  149. }
  150. this.$refs.item.toggle();
  151. },
  152. onChangeDate(type) {
  153. let dataForm = this.dataForm
  154. if(type == 'showEnd') {
  155. if(this.formatStartTime) {
  156. dataForm.minDate = new Date(dayjs(this.formatStartTime))
  157. }
  158. setTimeout(() => {
  159. dataForm.currentDate = this.formatEndTime ? new Date(dayjs(this.formatEndTime)) : new Date()
  160. }, 500)
  161. } else if(type == 'showStart') {
  162. dataForm.minDate = new Date(2000, 0, 1)
  163. setTimeout(() => {
  164. dataForm.currentDate = this.formatStartTime ? new Date(dayjs(this.formatStartTime)) : new Date()
  165. }, 500)
  166. }
  167. dataForm.status = true
  168. dataForm.type = type
  169. },
  170. chioseDate(value) {
  171. let dataForm = this.dataForm
  172. if(dataForm.type == 'showStart') {
  173. this.formatStartTime = dayjs(value).format('YYYY/MM/DD')
  174. if(this.formatEndTime && dayjs(value).unix() > dayjs(this.formatEndTime).unix()) {
  175. this.formatEndTime = null
  176. }
  177. } else if(dataForm.type == 'showEnd') {
  178. this.formatEndTime = dayjs(value).format('YYYY/MM/DD')
  179. }
  180. dataForm.status = false
  181. },
  182. onTypeChange() {
  183. if (this.value1 == "全部") {
  184. this.purposeStatus = true;
  185. this.value2 = "全部";
  186. } else if (this.value1 == "课程推荐") {
  187. this.purposeStatus = false;
  188. this.option2 = [
  189. { text: "全部", value: "全部" },
  190. { text: "新课推荐", value: "新课推荐" },
  191. { text: "续费提醒", value: "续费提醒" },
  192. ];
  193. } else if (this.value1 == "常规回访") {
  194. this.purposeStatus = false;
  195. this.option2 = [
  196. { text: "全部", value: "全部" },
  197. { text: "课后及作业回访", value: "课后及作业回访" },
  198. { text: "练习及乐团表现", value: "练习及乐团表现" },
  199. { text: "教学内容未达标", value: "教学内容未达标" },
  200. ];
  201. } else if (this.value1 == "云教练") {
  202. this.purposeStatus = false;
  203. this.option2 = [{ text: "体验回访", value: "体验回访" }];
  204. } else if (this.value1 == "其它") {
  205. this.purposeStatus = false;
  206. this.option2 = [{ text: "其它", value: "其它" }];
  207. }
  208. this.onResetList()
  209. },
  210. onPurposeChange() {
  211. this.onResetList()
  212. },
  213. getList() {
  214. let params = this.params;
  215. params.type = this.value1 == "全部" ? null : this.value1;
  216. params.purpose = this.value2 == "全部" ? null : this.value2;
  217. if(this.formatStartTime && this.formatEndTime) {
  218. params.startTime = dayjs(new Date(this.formatStartTime)).format("YYYY-MM-DD")
  219. params.endTime = dayjs(new Date(this.formatEndTime)).format("YYYY-MM-DD")
  220. } else {
  221. params.startTime = null
  222. params.endTime = null
  223. }
  224. geteduVisitList(params).then((res) => {
  225. let result = res.data;
  226. this.loading = false;
  227. if (result.code == 200) {
  228. params.page = result.data.pageNo;
  229. result.data.rows.forEach((item) => {
  230. item.visitTime = dayjs(item.visitTime).format("YYYY/MM/DD");
  231. });
  232. this.list = this.list.concat(result.data.rows);
  233. if (params.page >= result.data.totalPage) {
  234. this.finished = true;
  235. }
  236. this.params.page++;
  237. } else {
  238. this.finished = true;
  239. }
  240. // 判断是否有数据
  241. if (this.list.length <= 0) {
  242. this.dataShow = false;
  243. }
  244. });
  245. },
  246. onAdd() {
  247. this.$router.push({
  248. path: "/addVisit",
  249. query: {
  250. name: '新增回访记录'
  251. }
  252. });
  253. },
  254. formatter(type, val) {
  255. if (type === "year") {
  256. return `${val}年`;
  257. } else if (type === "month") {
  258. return `${val}月`;
  259. } else if (type == "day") {
  260. return `${val}日`;
  261. }
  262. return val;
  263. },
  264. },
  265. };
  266. </script>
  267. <style lang="less" scoped>
  268. @import url("../../assets/commonLess/variable.less");
  269. .visitList {
  270. min-height: 100vh;
  271. .visitTime {
  272. .van-cell__right-icon{
  273. line-height: .36rem;
  274. }
  275. }
  276. }
  277. .addClass {
  278. width: 0.2rem;
  279. height: 0.2rem;
  280. line-height: 0.2rem;
  281. position: relative;
  282. top: 0.05rem;
  283. }
  284. .cellGroup {
  285. display: flex;
  286. align-items: center;
  287. line-height: .61rem;
  288. }
  289. .sectionTitle {
  290. font-size: 0.15rem!important;
  291. color: #1a1a1a;
  292. align-items: center;
  293. line-height: .21rem;
  294. .type {
  295. color: #666;
  296. font-size: 0.14rem;
  297. }
  298. }
  299. .sectionValue {
  300. display: flex;
  301. width: 60%;
  302. flex: 1 auto;
  303. justify-content: space-between;
  304. align-items: center;
  305. height: auto !important;
  306. .time{
  307. font-size: .14rem;
  308. color: #808080;
  309. }
  310. .content {
  311. font-size: 0.16rem;
  312. color: #1a1a1a;
  313. flex: 1;
  314. text-align: center;
  315. }
  316. .van-button {
  317. font-size: 0.14rem;
  318. background-color: @mColor;
  319. border-color: @mColor;
  320. padding: 0 0.12rem;
  321. min-width: 0.88rem;
  322. height: 0.3rem;
  323. &.van-update {
  324. background-color: #fff;
  325. color: @mColor;
  326. }
  327. }
  328. }
  329. /deep/.van-cell__title {
  330. font-size: 0.14rem;
  331. color: @mFontColor;
  332. flex: 1 auto;
  333. }
  334. .btnWrap {
  335. display: flex;
  336. flex-direction: row;
  337. .cancelBtn {
  338. height: 48px;
  339. line-height: 48px;
  340. background: #eeeff3;
  341. color: @mColor;
  342. text-align: center;
  343. width: 100%;
  344. }
  345. .okBtn {
  346. width: 100%;
  347. height: 48px;
  348. line-height: 48px;
  349. background: @mColor;
  350. color: #fff;
  351. text-align: center;
  352. }
  353. }
  354. .addVisit {
  355. position: fixed;
  356. bottom: 1rem;
  357. right: 0.2rem;
  358. font-size: 30px;
  359. padding: 10px;
  360. border-radius: 50%;
  361. background: #fff;
  362. color: @mColor;
  363. box-shadow: 0 2px 12px rgba(100, 101, 102, 0.12);
  364. }
  365. .van-cell{
  366. color: #1A1A1A;
  367. line-height: .36rem!important;
  368. font-size: .16rem;
  369. }
  370. </style>