index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. <template>
  2. <div>
  3. <!-- <div class="right-menu-item hover-effect" @click="handleDrawer">
  4. <i class="el-icon-message-solid" style="font-size: 24px; line-height: 50px" />
  5. <el-badge v-if='allUnreadNum > 0' class="mark" :value="allUnreadNum" />
  6. </div> -->
  7. <el-dropdown v-if="QRcodeList.length" class="user-container yidong">
  8. <div class="user right-menu-item hover-effect">
  9. <span>移动端</span>
  10. </div>
  11. <el-dropdown-menu slot="dropdown" class="user-dropdown">
  12. <el-dropdown-item v-for="(item, index) in QRcodeList" :key="index">
  13. <div class="QRcode">
  14. <el-image class="QRcode-img" :src="item.codeUrl" :preview-src-list="[item.codeUrl]" fit="fill"></el-image>
  15. <div>
  16. <div>{{ item.name }}</div>
  17. <div class="liveTitle">{{ item.saleName }}</div>
  18. <div>
  19. <el-image v-if="item.iosIcon" class="shouji-icon" :src="item.iosIcon" fit="fill"></el-image>
  20. <el-image v-if="item.androidIcon" class="shouji-icon" :src="item.androidIcon" fit="fill"></el-image>
  21. </div>
  22. </div>
  23. </div>
  24. </el-dropdown-item>
  25. </el-dropdown-menu>
  26. </el-dropdown>
  27. <el-drawer size="450px" :with-header="false" :show-close="false" :visible.sync="drawer" direction="rtl"
  28. :modal="false">
  29. <div class="drawer">
  30. <div :offset="0" class="drawer_left">
  31. <div class="drawer_top">
  32. <div class="flex center">
  33. <div class="radio">
  34. 状态筛选标签
  35. </div>
  36. <div class="icon_close">
  37. <i class="el-icon-close" @click="guanbi" />
  38. </div>
  39. </div>
  40. <div>
  41. <el-button :type="pam.read_flag == '' ? 'primary' : null" size="mini" @click="hadleRead(0)">全部</el-button>
  42. <el-button :type="pam.read_flag == 'NO' ? 'primary' : null" size="mini" @click="hadleRead(1)">未读</el-button>
  43. <el-badge :value="allUnreadNum" class="item" />
  44. <el-button :type="pam.read_flag == 'YES' ? 'primary' : null" size="mini"
  45. @click="hadleRead(2)">已读</el-button>
  46. </div>
  47. <el-tabs v-model="pam.type" @tab-click="handleClick">
  48. <el-tab-pane label="通知" name="N"></el-tab-pane>
  49. <el-tab-pane label="活动" name="A"></el-tab-pane>
  50. <el-tab-pane label="公告" name="B"></el-tab-pane>
  51. </el-tabs>
  52. </div>
  53. <div v-loading="loading" class="notice" style="position: relative;">
  54. <div style="position: absolute;top: 0;bottom: 0;left: 0;right: 0;">
  55. <v-scroll-view :x="false" :y="true" slidingBgClassName="slidingBgClassName3"
  56. slidingBlockClassName="slidingBlockClassName3">
  57. <div style="box-sizing: border-box;padding: 10px;">
  58. <div v-if="dataList.length" class="item-data" v-for="(item, index) in dataList" :key="index"
  59. @click="opendomview(item)">
  60. <div class="item-tag">{{ ["活动", "公告", "通知"][["A", "B", "N"].indexOf(item.type)] }}</div>
  61. <div class="item-centor">
  62. <div class="item-centor">{{ item.content }}</div>
  63. <div class="item-time">{{ item.issueTime }}</div>
  64. </div>
  65. </div>
  66. <el-empty v-if="!dataList.length" description="暂无数据"></el-empty>
  67. </div>
  68. </v-scroll-view>
  69. </div>
  70. </div>
  71. <el-pagination layout="total, prev, pager, next" :total="total" small :page-size="pam.pageSize"
  72. :current-page="pam.pageNum" @current-change="currentChange" />
  73. </div>
  74. </div>
  75. </el-drawer>
  76. <el-drawer :title="showRow.title" :visible.sync="dialogVisible" direction="rtl" :before-close="dialogVisibleGuanbi"
  77. size="450px" :modal="false">
  78. <el-card class="box-card">
  79. <div v-html="showRow.content"></div>
  80. </el-card>
  81. </el-drawer>
  82. </div>
  83. </template>
  84. <script>
  85. import { mapMutations, mapActions, mapGetters } from 'vuex'
  86. import vScrollView from 'v-scroll-view'
  87. // import { notifyMyList, notifyMyRead } from '@/api/notificationCenter/eventAnnouncement'
  88. import { EventBus } from '@/utils/eventBus'
  89. import { commonCompanywechatGet } from "@/api/common";
  90. export default {
  91. components: { vScrollView },
  92. data() {
  93. return {
  94. drawer: false,
  95. dataList: [],
  96. loading: false,
  97. total: 0,
  98. pam: {
  99. type: "N",
  100. read_flag: "",
  101. pageNum: 1,
  102. pageSize: 20,
  103. },
  104. dialogVisible: false,
  105. showRow: {},
  106. QRcodeList: []
  107. }
  108. },
  109. computed: {
  110. ...mapGetters(['allUnreadNum']),
  111. // 用户信息
  112. userInfo() {
  113. return JSON.parse(localStorage.getItem('greemall_user'))
  114. },
  115. },
  116. mounted() {
  117. EventBus.$on('opendomview', this.opendomview)
  118. EventBus.$on('handleDrawerabcde', this.handleDrawer)
  119. var this_ = this
  120. if (this.timeId) {
  121. clearTimeout(this.timeId)
  122. }
  123. (function dingshiqingqiu() {
  124. this_.updateUnreadNotice()
  125. this_.timeId = setTimeout(dingshiqingqiu, 2000);
  126. })()
  127. commonCompanywechatGet({ id: this.userInfo.companyWechatId }).then(res => {
  128. console.log(res)
  129. this.QRcodeList = []
  130. if (res?.data?.qrcode1) {
  131. this.QRcodeList.push({
  132. codeUrl: res.data.qrcode1,
  133. name: "小程序",
  134. saleName: "",
  135. iosIcon: "https://zf-mall.oss-cn-shenzhen.aliyuncs.com/2024-03/17115930219681afd35b0-8c93-400a-94f8-e49277c88616.png",
  136. androidIcon: "https://zf-mall.oss-cn-shenzhen.aliyuncs.com/2024-03/1711593045466d069e7f6-5c77-40a0-a7b3-6e2b3a6ce0eb.png"
  137. })
  138. }
  139. if (res?.data?.qrcode2) {
  140. this.QRcodeList.push({
  141. codeUrl: res.data.qrcode2,
  142. name: "公众号",
  143. saleName: "",
  144. iosIcon: "https://zf-mall.oss-cn-shenzhen.aliyuncs.com/2024-03/17115930219681afd35b0-8c93-400a-94f8-e49277c88616.png",
  145. androidIcon: "https://zf-mall.oss-cn-shenzhen.aliyuncs.com/2024-03/1711593045466d069e7f6-5c77-40a0-a7b3-6e2b3a6ce0eb.png"
  146. })
  147. }
  148. if (res?.data?.payQrcode) {
  149. this.QRcodeList.push({
  150. codeUrl: res.data.payQrcode,
  151. name: "收款码",
  152. saleName: "",
  153. iosIcon: "https://zf-mall.oss-cn-shenzhen.aliyuncs.com/2024-03/17115930219681afd35b0-8c93-400a-94f8-e49277c88616.png",
  154. androidIcon: "https://zf-mall.oss-cn-shenzhen.aliyuncs.com/2024-03/1711593045466d069e7f6-5c77-40a0-a7b3-6e2b3a6ce0eb.png"
  155. })
  156. }
  157. })
  158. },
  159. beforeDestroy() {
  160. if (this.timeId) {
  161. clearTimeout(this.timeId)
  162. }
  163. },
  164. watch: {
  165. pam: {
  166. handler(newVal, oldVal) {
  167. this.getMessageList()
  168. },
  169. deep: true
  170. }
  171. },
  172. methods: {
  173. ...mapMutations({
  174. SET_SHOW: 'app/SET_SHOW'
  175. }),
  176. ...mapActions({
  177. updateUnreadNotice: 'app/getUnreadNum'
  178. }),
  179. handleClick(val) {
  180. console.log(val)
  181. },
  182. opendomview(row) {
  183. this.showRow = row
  184. this.dialogVisible = true
  185. // notifyMyRead({
  186. // id:row.id
  187. // }).then(res=>{
  188. // this.updateUnreadNotice()
  189. // if(this.drawer){
  190. // this.getMessageList()
  191. // }
  192. // })
  193. },
  194. dialogVisibleGuanbi() {
  195. this.showRow = {}
  196. this.dialogVisible = false
  197. },
  198. // 数据处理
  199. getMessageList() {
  200. // notifyMyList({
  201. // "pageNum": this.pam.pageNum,
  202. // "pageSize": this.pam.pageSize,
  203. // "params": (()=>{
  204. // var arr = []
  205. // if(this.pam.read_flag){
  206. // arr.push({ "param": "a.read_flag", "compare": "=", "value": this.pam.read_flag })
  207. // }
  208. // if(this.pam.type){
  209. // arr.push({ "param": "a.type", "compare": "=", "value": this.pam.type })
  210. // }
  211. // return arr
  212. // })(),
  213. // "moduleId": "486084326453317-teshu"
  214. // }).then(res => {
  215. // this.dataList = res.data.records
  216. // this.total = res.data.total
  217. // })
  218. },
  219. currentChange(v) {
  220. this.pam.pageNum = v
  221. },
  222. // 打开消息弹窗
  223. handleDrawer() {
  224. this.drawer = true
  225. this.getMessageList()
  226. },
  227. guanbi() {
  228. this.drawer = false
  229. this.pam = {
  230. read_flag: "",
  231. pageNum: 1,
  232. pageSize: 20,
  233. }
  234. },
  235. // 状态筛选标签
  236. hadleRead(index) {
  237. this.dataList = []
  238. this.pam.read_flag = ["", "NO", "YES"][index]
  239. this.pam.pageNum = 1
  240. this.getMessageList()
  241. },
  242. }
  243. }
  244. </script>
  245. <style lang="scss" scoped>
  246. @import '~@/styles/variables.scss';
  247. .item {
  248. margin-left: -10px;
  249. margin-top: -10px;
  250. }
  251. .notice_tip {
  252. font-size: 16px;
  253. }
  254. ::v-deep .slidingBgClassName {
  255. background: rgba(0, 0, 0, 0.0075) !important;
  256. }
  257. ::v-deep .slidingBlockClassName {
  258. background: rgba(0, 0, 0, 0.0125) !important;
  259. }
  260. ::v-deep .el-drawer .el-drawer__body {
  261. overflow: hidden !important;
  262. }
  263. .navbar {
  264. width: 100%;
  265. height: 50px;
  266. overflow: hidden;
  267. background: #{$navbarBg};
  268. box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  269. display: flex;
  270. flex-direction: row;
  271. align-items: center;
  272. .hamburger-container {
  273. line-height: 46px;
  274. height: 100%;
  275. color: #{$navbarText};
  276. cursor: pointer;
  277. transition: background 0.3s;
  278. -webkit-tap-highlight-color: transparent;
  279. border-right: 1px solid #eaeaea;
  280. &:hover {
  281. background: rgba(0, 0, 0, 0.025);
  282. }
  283. }
  284. ul {
  285. list-style: none;
  286. padding: 0;
  287. line-height: 20px;
  288. li {
  289. overflow: hidden;
  290. white-space: nowrap;
  291. text-overflow: ellipsis;
  292. }
  293. }
  294. .right-menu {
  295. height: 100%;
  296. line-height: 50px;
  297. &>div {
  298. float: left;
  299. }
  300. &:focus {
  301. outline: none;
  302. }
  303. .user-container {
  304. height: 50px;
  305. .user {
  306. i {
  307. font-size: 18px;
  308. margin-right: 5px;
  309. }
  310. span {
  311. font-size: 16px;
  312. }
  313. }
  314. }
  315. .right-menu-item {
  316. display: inline-block;
  317. padding: 0 15px;
  318. height: 100%;
  319. font-size: 18px;
  320. color: #{$navbarText};
  321. vertical-align: text-bottom;
  322. border-left: 1px solid #eaeaea;
  323. &.hover-effect {
  324. cursor: pointer;
  325. transition: background 0.3s;
  326. &:hover {
  327. background: rgba(0, 0, 0, 0.025);
  328. }
  329. }
  330. .notice-icon {
  331. padding-top: 0;
  332. padding-bottom: 0;
  333. }
  334. .right-menu-item {
  335. .notice-icon>i {
  336. font-size: 18px;
  337. }
  338. sup {
  339. top: 12px;
  340. right: 25px;
  341. }
  342. }
  343. }
  344. }
  345. .flex {
  346. display: flex;
  347. justify-content: space-between;
  348. }
  349. .dot_title {
  350. height: 40px;
  351. }
  352. .dot::before {
  353. content: '';
  354. display: inline-block;
  355. margin-right: 10px;
  356. padding: 5px;
  357. border-radius: 25px;
  358. background-color: #f00;
  359. }
  360. .tip {
  361. width: 37px;
  362. height: 20px;
  363. border-radius: 2px;
  364. background-color: rgba(255, 0, 0, 1);
  365. color: rgba(255, 255, 255, 1);
  366. font-size: 14px;
  367. text-align: center;
  368. }
  369. .drawer_top {
  370. margin: 0 20px;
  371. }
  372. .center {
  373. align-items: center;
  374. }
  375. .notice {
  376. box-sizing: content-box;
  377. margin: 0 10px 10px 10px;
  378. background-color: rgba(255, 255, 255, 1);
  379. height: calc(100% - 205px);
  380. box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4);
  381. overflow-x: hidden;
  382. &_item {
  383. width: calc(450px - 80px);
  384. margin: 20px;
  385. border-bottom: 1px solid #ebeef5;
  386. }
  387. }
  388. .icon {
  389. &_bell {
  390. text-align: right;
  391. cursor: pointer;
  392. }
  393. &_close {
  394. font-size: 25px;
  395. cursor: pointer;
  396. }
  397. }
  398. .drawer {
  399. height: 100%;
  400. display: flex;
  401. font-size: 14px;
  402. &_left {
  403. width: 450px;
  404. display: inline-block;
  405. }
  406. &_right {
  407. width: 450px;
  408. margin: 0 20px;
  409. display: inline-block;
  410. .radio {
  411. display: flex;
  412. justify-content: center;
  413. }
  414. &_content {
  415. height: 855px;
  416. padding: 0 2px;
  417. overflow-y: auto;
  418. &_item {
  419. display: flex;
  420. align-items: center;
  421. margin: 20px 0;
  422. padding: 0 10px;
  423. height: 84px;
  424. font-size: 14px;
  425. border-radius: 5px;
  426. background-color: rgba(255, 255, 255, 1);
  427. box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4);
  428. &_text {
  429. display: flex;
  430. flex-direction: column;
  431. justify-content: space-around;
  432. flex: 1 1;
  433. height: 84px;
  434. padding-left: 20px;
  435. line-height: 20px;
  436. }
  437. }
  438. }
  439. }
  440. }
  441. }
  442. ::v-deep .slidingBgClassName3 {
  443. background: rgba(0, 0, 0, 0.01) !important;
  444. }
  445. ::v-deep .slidingBlockClassName3 {
  446. background: rgba(0, 0, 0, 0.03) !important;
  447. }
  448. .item-data {
  449. width: 100%;
  450. height: 50px;
  451. display: flex;
  452. align-items: center;
  453. cursor: pointer;
  454. .item-tag {
  455. height: auto;
  456. box-sizing: border-box;
  457. padding: 6px;
  458. background: #e8fffb;
  459. color: #44D4D0;
  460. margin-right: 6px;
  461. line-height: normal;
  462. }
  463. .item-centor {
  464. line-height: normal;
  465. flex: 1;
  466. overflow: hidden;
  467. text-overflow: ellipsis;
  468. white-space: nowrap;
  469. font-size: 16px;
  470. flex-wrap: 500;
  471. .item-time {
  472. font-size: 12px;
  473. color: #aaa;
  474. margin-top: 5px;
  475. text-indent: .8em;
  476. }
  477. }
  478. &:hover {
  479. background: #e8fffb;
  480. }
  481. }
  482. ul {
  483. list-style: none;
  484. padding: 0;
  485. line-height: 20px;
  486. li {
  487. overflow: hidden;
  488. white-space: nowrap;
  489. text-overflow: ellipsis;
  490. }
  491. }
  492. .right-menu {
  493. height: 100%;
  494. line-height: 50px;
  495. &>div {
  496. float: left;
  497. }
  498. &:focus {
  499. outline: none;
  500. }
  501. .user-container {
  502. height: 50px;
  503. .user {
  504. i {
  505. font-size: 18px;
  506. margin-right: 5px;
  507. }
  508. span {
  509. font-size: 16px;
  510. }
  511. }
  512. }
  513. .right-menu-item {
  514. display: inline-block;
  515. padding: 0 15px;
  516. height: 100%;
  517. font-size: 18px;
  518. color: #{$navbarText};
  519. vertical-align: text-bottom;
  520. border-left: 1px solid #eaeaea;
  521. &.hover-effect {
  522. cursor: pointer;
  523. transition: background 0.3s;
  524. &:hover {
  525. background: rgba(0, 0, 0, 0.025);
  526. }
  527. }
  528. .notice-icon {
  529. padding-top: 0;
  530. padding-bottom: 0;
  531. }
  532. .right-menu-item {
  533. .notice-icon>i {
  534. font-size: 18px;
  535. }
  536. sup {
  537. top: 12px;
  538. right: 25px;
  539. }
  540. }
  541. }
  542. }
  543. .flex {
  544. display: flex;
  545. justify-content: space-between;
  546. }
  547. .dot_title {
  548. height: 40px;
  549. }
  550. .dot::before {
  551. content: '';
  552. display: inline-block;
  553. margin-right: 10px;
  554. padding: 5px;
  555. border-radius: 25px;
  556. background-color: #f00;
  557. }
  558. .tip {
  559. width: 37px;
  560. height: 20px;
  561. border-radius: 2px;
  562. background-color: rgba(255, 0, 0, 1);
  563. color: rgba(255, 255, 255, 1);
  564. font-size: 14px;
  565. text-align: center;
  566. }
  567. .drawer_top {
  568. margin: 0 20px;
  569. }
  570. .center {
  571. align-items: center;
  572. }
  573. .notice {
  574. box-sizing: content-box;
  575. margin: 0 20px;
  576. margin-top: 20px;
  577. background-color: rgba(255, 255, 255, 1);
  578. height: 690px;
  579. box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4);
  580. overflow-x: hidden;
  581. &_item {
  582. width: calc(450px - 80px);
  583. margin: 20px;
  584. border-bottom: 1px solid #ebeef5;
  585. }
  586. }
  587. .icon {
  588. &_bell {
  589. text-align: right;
  590. cursor: pointer;
  591. }
  592. &_close {
  593. font-size: 25px;
  594. cursor: pointer;
  595. }
  596. }
  597. .drawer {
  598. height: 100%;
  599. display: flex;
  600. font-size: 14px;
  601. &_left {
  602. width: 450px;
  603. display: inline-block;
  604. }
  605. &_right {
  606. width: 450px;
  607. margin: 0 20px;
  608. display: inline-block;
  609. .radio {
  610. display: flex;
  611. justify-content: center;
  612. }
  613. &_content {
  614. height: 855px;
  615. padding: 0 2px;
  616. overflow-y: auto;
  617. &_item {
  618. display: flex;
  619. align-items: center;
  620. margin: 20px 0;
  621. padding: 0 10px;
  622. height: 84px;
  623. font-size: 14px;
  624. border-radius: 5px;
  625. background-color: rgba(255, 255, 255, 1);
  626. box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4);
  627. &_text {
  628. display: flex;
  629. flex-direction: column;
  630. justify-content: space-around;
  631. flex: 1 1;
  632. height: 84px;
  633. padding-left: 20px;
  634. line-height: 20px;
  635. }
  636. }
  637. }
  638. }
  639. }
  640. .download {
  641. width: 595px;
  642. max-height: 327px;
  643. background-color: rgba(255, 255, 255, 1);
  644. .clear {
  645. cursor: pointer;
  646. }
  647. &_title {
  648. display: flex;
  649. justify-content: space-between;
  650. padding: 5px 15px;
  651. div:last-child {
  652. display: flex;
  653. justify-content: flex-end;
  654. flex: 0 350px;
  655. div {
  656. flex: 1;
  657. font-size: 14px;
  658. }
  659. div:last-child {
  660. flex: 1;
  661. text-align: right;
  662. }
  663. }
  664. }
  665. &_item {
  666. max-height: 280px;
  667. margin: 15px;
  668. overflow-y: auto;
  669. &_content {
  670. display: flex;
  671. justify-content: space-between;
  672. margin: 10px 0;
  673. padding-bottom: 5px;
  674. font-size: 14px;
  675. border-bottom: 1px solid rgba(204, 204, 204, 0.38);
  676. div:last-child {
  677. display: flex;
  678. justify-content: flex-end;
  679. flex: 0 350px;
  680. div {
  681. flex: 1;
  682. }
  683. div:last-child {
  684. flex: 1;
  685. text-align: right;
  686. }
  687. }
  688. }
  689. }
  690. }
  691. .el-dropdown-menu {
  692. padding: 0 !important;
  693. margin: 0 !important;
  694. z-index: 9999 !important;
  695. }
  696. ::v-deep .el-dropdown-menu__item.is-disabled {
  697. color: #000;
  698. padding: 20px;
  699. border-bottom: 1px solid #EBEEF5;
  700. }
  701. .yidong {
  702. ::v-deep .el-dropdown-menu__item {
  703. padding: 0;
  704. }
  705. }
  706. ::v-deep ul>li:last-child {
  707. border-bottom: none !important;
  708. }
  709. .QRcode {
  710. display: flex;
  711. flex-direction: row;
  712. align-items: center;
  713. margin-bottom: 20px;
  714. }
  715. .QRcode-img {
  716. width: 120px;
  717. height: 120px;
  718. margin-right: 5px;
  719. border: 1px solid #EBEEF5;
  720. }
  721. .shouji-icon {
  722. width: 40px;
  723. height: 40px;
  724. margin-right: 10px;
  725. }
  726. .liveTitle {
  727. color: #f00;
  728. }
  729. </style>