index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. <template>
  2. <div id="stationLetter">
  3. <div style="margin-bottom: 10px">
  4. <p>
  5. 共{{ total }}封,其中<span style="color: red">{{ dontRead }}</span>
  6. 个消息未读
  7. </p>
  8. <div>
  9. <el-button size="mini" type="primary" plain @click="haveRead"
  10. >标记为已读</el-button
  11. ><el-button
  12. v-if="false"
  13. size="mini"
  14. type="primary"
  15. plain
  16. @click="notHaveRead"
  17. >标记为未读</el-button
  18. ><span style="font-size: 14px; margin-left: 10px">状态:</span
  19. ><el-select
  20. size="mini"
  21. v-model="formData.receiptStatus"
  22. placeholder="请选择状态"
  23. @change="changeStatus"
  24. >
  25. <el-option
  26. v-for="item in options"
  27. :key="item.value"
  28. :label="item.label"
  29. :value="item.value"
  30. >
  31. </el-option>
  32. </el-select>
  33. </div>
  34. </div>
  35. <el-table
  36. :data="tableData"
  37. style="width: 100%"
  38. border
  39. row-key="id"
  40. ref="tableData"
  41. >
  42. <el-table-column
  43. type="selection"
  44. width="55"
  45. align="center"
  46. reserve-selection
  47. :selectable="canSelect"
  48. >
  49. </el-table-column>
  50. <template v-for="(item, index) in tableSet">
  51. <el-table-column
  52. :width="item.width"
  53. :key="index"
  54. :label="item.label"
  55. align="center"
  56. :sortable="item.prop === 'sort'"
  57. :show-overflow-tooltip="true"
  58. header-align="center"
  59. :prop="item.prop"
  60. sort-by="sort"
  61. >
  62. <template slot-scope="scope">
  63. <i
  64. v-if="item.scope === 'icon'"
  65. :style="
  66. scope.row[item.prop] === 0
  67. ? 'color:#409EFF;'
  68. : scope.row[item.prop] === 1
  69. ? 'color:#eee;'
  70. : ''
  71. "
  72. style="font-size: 18px"
  73. class="el-icon-s-comment"
  74. ></i>
  75. <span v-else-if="item.scope === 'theme'">
  76. <strong style="margin-left: 10px">{{
  77. scope.row[item.prop1]
  78. }}</strong
  79. ><span>{{ scope.row[item.prop2] }}</span>
  80. </span>
  81. <span v-else-if="item.scope === 'aTimeList'">{{
  82. $methodsTools.onlyForma(scope.row[item.prop])
  83. }}</span>
  84. <span v-else>{{ scope.row[item.prop] }}</span></template
  85. ></el-table-column
  86. ></template
  87. ><el-table-column label="操作" align="center" fixed="right" width="180px">
  88. <template slot-scope="scope">
  89. <el-button size="mini" @click="newSee(scope.row)" type="text"
  90. >立即查看</el-button
  91. ><el-button
  92. size="mini"
  93. :disabled="scope.row.receiptStatus === 1"
  94. @click="haveReadID(scope.row.id)"
  95. type="text"
  96. >标记为已读</el-button
  97. >
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <pagination
  102. :total="total"
  103. :pageSize="formData.pageSize"
  104. :currentPage="formData.pageNum"
  105. @handleSizeChange="handleSizeChange"
  106. @handleCurrentChange="handleCurrentChange"
  107. />
  108. <el-dialog
  109. :visible.sync="dialogCG"
  110. width="760px"
  111. :show-close="false"
  112. :close-on-click-modal="false"
  113. >
  114. <div slot="title" class="hearders">
  115. <div class="leftTitle">查看消息</div>
  116. <div class="rightBoxs">
  117. <img
  118. src="@/assets/images/Close@2x.png"
  119. alt=""
  120. @click="dialogCG = false"
  121. />
  122. </div>
  123. </div>
  124. <h3 style="color: #333; font-weight: bold">{{ newData.remind }}</h3>
  125. <p>{{ newData.text }}</p>
  126. <span slot="footer" class="dialog-footer">
  127. <el-button @click="dialogCG = false">关闭</el-button>
  128. <el-button
  129. v-if="false"
  130. type="primary"
  131. @click="
  132. submitChecks(
  133. newData.type === 2 || newData.type === 3
  134. ? 2
  135. : newData.type === 4
  136. ? 3
  137. : 1
  138. )
  139. "
  140. >{{
  141. newData.type === 2 || newData.type === 3
  142. ? "查看订单"
  143. : newData.type === 4
  144. ? "查看活动"
  145. : "查看学员"
  146. }}</el-button
  147. >
  148. </span>
  149. </el-dialog>
  150. </div>
  151. </template>
  152. <script>
  153. import pagination from "@/components/pagination";
  154. export default {
  155. name: "StationLetter",
  156. components: { pagination },
  157. data() {
  158. return {
  159. newData: { remind: "" }, //当前数据
  160. options: [
  161. {
  162. label: "全部",
  163. value: "",
  164. },
  165. {
  166. label: "已读",
  167. value: 1,
  168. },
  169. {
  170. label: "未读",
  171. value: 0,
  172. },
  173. ],
  174. total: 0,
  175. dontRead: 0, //未读
  176. formData: {
  177. pageSize: 10,
  178. pageNum: 1,
  179. receiptStatus: "",
  180. systemStatus: 1,
  181. },
  182. tableSet: [
  183. {
  184. label: "状态",
  185. prop: "receiptStatus",
  186. scope: "icon",
  187. width: "80px",
  188. },
  189. {
  190. label: "主题",
  191. prop1: "remind",
  192. prop2: "text",
  193. scope: "theme",
  194. },
  195. {
  196. label: "发送时间",
  197. prop: "sendTime",
  198. scope: "aTimeList",
  199. width: "220px",
  200. },
  201. ],
  202. tableData: [],
  203. loading: false,
  204. dialogCG: false,
  205. };
  206. },
  207. mounted() {
  208. this.search();
  209. if (this.$route.params.id) {
  210. this.$api.informsys_user(this.$route.params.id).then((res) => {
  211. if (res.data) {
  212. this.newSee(res.data);
  213. }
  214. });
  215. }
  216. },
  217. methods: {
  218. /**
  219. * 查看消息
  220. */
  221. newSee(data) {
  222. this.newData = JSON.parse(JSON.stringify(data));
  223. this.dialogCG = true;
  224. if (data.receiptStatus !== 1) {
  225. this.haveReadID(data.id, false);
  226. }
  227. },
  228. /**
  229. * 单个标记已读
  230. */
  231. haveReadID(id, status = true) {
  232. this.$api
  233. .editupdateReadStatusBatch({ ids: [id], receiptStatus: 1 })
  234. .then((res) => {
  235. if (status) {
  236. this.$message.success("已读成功");
  237. this.$refs.tableData.clearSelection();
  238. }
  239. this.search();
  240. });
  241. },
  242. /**
  243. * 切换消息状态
  244. */
  245. changeStatus(val) {
  246. this.formData.pageSize = 10;
  247. this.formData.pageNum = 1;
  248. this.search();
  249. },
  250. search() {
  251. this.loading = true;
  252. this.$api
  253. .inquireinformsys_userlist(this.formData)
  254. .then((res) => {
  255. this.total = res.total;
  256. this.tableData = res.rows;
  257. })
  258. .finally(() => {
  259. this.loading = false;
  260. });
  261. this.$api
  262. .inquireinformsys_userinformUnReadSum({ systemStatus: 1 })
  263. .then((res) => {
  264. this.dontRead = res.data;
  265. });
  266. },
  267. /**
  268. * 查看学员
  269. */
  270. submitChecks(int) {
  271. this.dialogCG = false;
  272. if (int === 3) {
  273. const jump = () => {
  274. //分销活动列表
  275. this.$router.push({
  276. name: "ActivityList",
  277. });
  278. };
  279. const statusPage = this.$store.state.tagsView.visitedViews.some(
  280. (item) => {
  281. return item.name == "ActivityList";
  282. }
  283. );
  284. if (statusPage) {
  285. this.$store
  286. .dispatch("tagsView/delCachedView", {
  287. name: "ActivityList",
  288. })
  289. .then((res) => {
  290. jump();
  291. });
  292. } else {
  293. jump();
  294. }
  295. }
  296. if (int === 2) {
  297. const jump = () => {
  298. //退款订单列表
  299. this.$router.push({
  300. name: "PendingRefundOrder",
  301. params: {
  302. orderSn: this.newData.orderSn,
  303. type:
  304. this.newData.type === 3
  305. ? "1,2"
  306. : this.newData.type === 2
  307. ? "0"
  308. : "",
  309. },
  310. });
  311. };
  312. const statusPage = this.$store.state.tagsView.visitedViews.some(
  313. (item) => {
  314. return item.name == "PendingRefundOrder";
  315. }
  316. );
  317. if (statusPage) {
  318. this.$store
  319. .dispatch("tagsView/delCachedView", {
  320. name: "PendingRefundOrder",
  321. })
  322. .then((res) => {
  323. jump();
  324. });
  325. } else {
  326. jump();
  327. }
  328. }
  329. if (int === 1) {
  330. const jump = () => {
  331. //学员详情
  332. this.$router.push({
  333. name: "StudentXQ",
  334. query: {
  335. id: this.newData.studentUserId,
  336. },
  337. });
  338. };
  339. const statusPage = this.$store.state.tagsView.visitedViews.some(
  340. (item) => {
  341. return item.name == "StudentXQ";
  342. }
  343. );
  344. if (statusPage) {
  345. this.$store
  346. .dispatch("tagsView/delCachedView", {
  347. name: "StudentXQ",
  348. })
  349. .then((res) => {
  350. jump();
  351. });
  352. } else {
  353. jump();
  354. }
  355. }
  356. },
  357. /**
  358. * 已读
  359. */
  360. haveRead() {
  361. const idList = this.$refs.tableData.selection.map((item) => {
  362. return item.id;
  363. });
  364. if (idList.length == 0) {
  365. this.$message.warning("请选择需要标记已读的数据");
  366. return;
  367. }
  368. this.$api
  369. .editupdateReadStatusBatch({ ids: idList, receiptStatus: 1 })
  370. .then((res) => {
  371. this.$message.success("已读成功");
  372. this.$refs.tableData.clearSelection();
  373. this.search();
  374. });
  375. console.log(idList);
  376. },
  377. notHaveRead() {
  378. const idList = this.$refs.tableData.selection.map((item) => {
  379. return item.id;
  380. });
  381. if (idList.length == 0) {
  382. this.$message.warning("请选择需要标记已读的数据");
  383. return;
  384. }
  385. this.$api
  386. .editupdateReadStatusBatch({ ids: idList, receiptStatus: 0 })
  387. .then((res) => {
  388. this.$message.success("未读成功");
  389. this.$refs.tableData.clearSelection();
  390. this.search();
  391. });
  392. console.log(idList);
  393. },
  394. handleSizeChange(v) {
  395. this.formData.pageSize = v;
  396. this.formData.pageNum = 1;
  397. this.search();
  398. },
  399. handleCurrentChange(v) {
  400. this.formData.pageNum = v;
  401. this.search();
  402. },
  403. canSelect(row, index) {
  404. if (row.receiptStatus === 0) {
  405. return true;
  406. } else {
  407. return false;
  408. }
  409. },
  410. },
  411. };
  412. </script>
  413. <style lang="less" scoped>
  414. /deep/.el-button {
  415. border-radius: 8px;
  416. }
  417. /deep/.el-dialog {
  418. border-radius: 8px;
  419. .el-dialog__header {
  420. padding: 0;
  421. .hearders {
  422. height: 40px;
  423. display: flex;
  424. align-items: center;
  425. justify-content: space-between;
  426. padding: 0px 18px 0px 20px;
  427. border-bottom: 1px solid #e2e2e2;
  428. .leftTitle {
  429. font-size: 14px;
  430. font-weight: bold;
  431. color: #2f4378;
  432. }
  433. .rightBoxs {
  434. display: flex;
  435. align-items: center;
  436. img {
  437. width: 14px;
  438. height: 14px;
  439. margin-left: 13px;
  440. cursor: pointer;
  441. }
  442. }
  443. }
  444. }
  445. .el-dialog__body {
  446. max-height: 500px;
  447. overflow: auto;
  448. }
  449. .el-dialog__footer {
  450. padding: 0;
  451. .dialog-footer {
  452. padding: 0px 40px;
  453. height: 70px;
  454. border-top: 1px solid #e2e2e2;
  455. display: flex;
  456. align-items: center;
  457. justify-content: flex-end;
  458. }
  459. }
  460. }
  461. .imgBox {
  462. width: 100%;
  463. // height: 210px;
  464. border: 1px solid #e2e2e2;
  465. border-radius: 8px;
  466. padding: 8px 8px 3px;
  467. display: flex;
  468. flex-direction: column;
  469. align-items: center;
  470. .imgLabel {
  471. flex: 1;
  472. width: 100%;
  473. border: 1px dotted #e2e2e2;
  474. color: #999;
  475. font-size: 14px;
  476. cursor: pointer;
  477. border-radius: 8px;
  478. .msPhoto {
  479. display: flex;
  480. justify-content: center;
  481. align-items: center;
  482. max-width: 100%;
  483. max-height: 270px;
  484. img {
  485. max-width: 100%;
  486. max-height: 270px;
  487. }
  488. }
  489. .imgbbx {
  490. display: flex;
  491. flex-direction: column;
  492. align-items: center;
  493. justify-content: center;
  494. width: 100%;
  495. height: 100%;
  496. i {
  497. font-weight: bold;
  498. margin: 14px 0;
  499. font-size: 24px;
  500. }
  501. }
  502. }
  503. p {
  504. margin: 5px 0px;
  505. }
  506. }
  507. </style>