service.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="service">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. ></tui-skeleton>
  10. <view class="container">
  11. <tab-list v-model="params.type" />
  12. <view v-for="(cell, index) in messageList" class="info-card" :key="index">
  13. <view class="tui-notice clearfix">
  14. <tui-swipe-action :operateWidth="80" :backgroundColor="'#F7F7F7'">
  15. <template v-slot:content>
  16. <notice-cell :cellType="1" :cell="cell" @trampInfo="trampInfo"></notice-cell>
  17. </template>
  18. <template v-slot:button>
  19. <view class="tui-custom-btn_box">
  20. <view class="tui-custom-btn" @click.stop="deleteBtn(cell.id, index)">
  21. <text class="iconfont icon-shanchu3"></text>
  22. </view>
  23. </view>
  24. </template>
  25. </tui-swipe-action>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import { mapState, mapMutations } from 'vuex'
  33. import tabList from '../components/notice-server-tab.vue'
  34. import noticeCell from '../components/notice-cell.vue'
  35. export default {
  36. components: {
  37. noticeCell,
  38. tabList
  39. },
  40. data() {
  41. return {
  42. skeletonShow: false, // 刷新
  43. params: {
  44. messageType: 3,
  45. pageNum: 1,
  46. pageSize: 10,
  47. source: 2,
  48. commonId: '',
  49. type: ''
  50. },
  51. messageList: [], // 信息列表
  52. userInfo: {},
  53. isLastPage: false, // 是否是最后一页
  54. showDataBase: false
  55. }
  56. },
  57. watch: {
  58. 'params.type': {
  59. handler(val) {
  60. this.messageList = []
  61. this.getMessageList({ isRefresh: true })
  62. }
  63. }
  64. },
  65. mounted() {
  66. this.getMessageList({ isRefresh: false })
  67. },
  68. methods: {
  69. // 请求信息列表
  70. async getMessageList(options) {
  71. this.userInfo = uni.getStorageSync('userInfo')
  72. this.params.commonId = this.userInfo.serviceProviderId
  73. const { data } = await this.SellerService.getSellerNotice(this.params)
  74. if (options.isRefresh) {
  75. this.messageList = data.list
  76. }
  77. else {
  78. this.messageList = [...this.messageList, ...data.list]
  79. }
  80. this.isLastPage = data.isLastPage
  81. },
  82. // 删除
  83. deleteBtn(id, index) {
  84. // 删除通知消息
  85. this.UserService.authDeleteMessage({ id: id })
  86. .then(response => {
  87. uni.vibrateShort({
  88. success: () => {
  89. this.params.pageSize = this.params.pageNum * this.params.pageSize
  90. this.params.pageNum = 1
  91. this.getMessageList({isRefresh: true})
  92. }
  93. })
  94. })
  95. .catch(error => {
  96. console.log('error=>', error.msg)
  97. })
  98. },
  99. // 详情
  100. async trampInfo($event) {
  101. const time = $event.time.replace(/[年月日]/g, '-')
  102. if ($event.shopTieredType === 7 || $event.shopTieredType === 10) {
  103. this.$api.navigateTo(
  104. '/pages/seller/notice/service/Institutional_visits?spId=' +
  105. this.userInfo.serviceProviderId +
  106. '&accDateTime=' +
  107. $event.time + '&type=' + this.params.type
  108. )
  109. } else {
  110. const {data} = await this.SellerService.getFindUserId({id: $event.clubId, userType: 1})
  111. this.$api.navigateTo('/pages/seller/club/club-portrait?userId=' + data)
  112. }
  113. }
  114. },
  115. onPullDownRefresh() {
  116. this.params.pageSize = 10
  117. this.params.pageNum = 1
  118. this.getMessageList({isRefresh: true})
  119. uni.stopPullDownRefresh()
  120. },
  121. onReachBottom() {
  122. if (!this.isLastPage) {
  123. this.params.pageNum += 1
  124. this.getMessageList({isRefresh: false})
  125. }
  126. }
  127. }
  128. </script>
  129. <style scopde lang="scss">
  130. .container {
  131. box-sizing: border-box;
  132. }
  133. .info-card {
  134. margin-bottom: 24rpx;
  135. box-sizing: border-box;
  136. }
  137. page {
  138. background-color: #f7f7f7;
  139. }
  140. .container-main {
  141. width: 100%;
  142. box-sizing: border-box;
  143. padding: 24rpx 0;
  144. .empty-container-image {
  145. width: 260rpx;
  146. height: 260rpx;
  147. margin-top: -300rpx;
  148. }
  149. }
  150. .tui-swipeout-content {
  151. white-space: normal !important;
  152. }
  153. .tui-notice {
  154. margin-bottom: 24rpx;
  155. }
  156. .tui-notice-cell {
  157. width: 702rpx;
  158. height: auto;
  159. background-color: #ffffff;
  160. border-radius: 16rpx;
  161. box-sizing: border-box;
  162. padding: 24rpx;
  163. margin: 0 auto;
  164. .tui-cell-top {
  165. width: 100%;
  166. height: 105rpx;
  167. line-height: 105rpx;
  168. border-bottom: 1px solid #ccc;
  169. margin-bottom: 33rpx;
  170. .cell-title {
  171. font-size: 32rpx;
  172. color: #333333;
  173. float: left;
  174. font-weight: bold;
  175. }
  176. .cell-time {
  177. font-size: 24rpx;
  178. color: #999999;
  179. float: right;
  180. }
  181. }
  182. .tui-cell-content {
  183. width: 100%;
  184. height: auto;
  185. box-sizing: border-box;
  186. border-radius: 8rpx;
  187. line-height: 44rpx;
  188. padding: 24rpx;
  189. background-color: #f7f7f7;
  190. font-size: 28rpx;
  191. color: #333333;
  192. text-align: justify;
  193. }
  194. }
  195. .tui-custom-btn_box {
  196. width: 80px;
  197. height: 100%;
  198. padding: 0 20rpx;
  199. box-sizing: border-box;
  200. display: flex;
  201. align-items: center;
  202. justify-content: center;
  203. background-color: #f7f7f7;
  204. }
  205. .tui-custom-btn {
  206. width: 56rpx;
  207. height: 56rpx;
  208. border-radius: 50%;
  209. background-color: #f94b4b;
  210. color: #ffffff;
  211. display: flex;
  212. align-items: center;
  213. justify-content: center;
  214. flex-shrink: 0;
  215. .icon-shanchu3 {
  216. font-size: 32rpx;
  217. }
  218. }
  219. </style>