service.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. }
  55. },
  56. watch: {
  57. 'params.type': {
  58. handler(val) {
  59. this.getMessageList({ isRefresh: true })
  60. }
  61. }
  62. },
  63. mounted() {
  64. this.getMessageList({ isRefresh: false })
  65. },
  66. methods: {
  67. // 请求信息列表
  68. async getMessageList(options) {
  69. this.userInfo = uni.getStorageSync('userInfo')
  70. this.params.commonId = this.userInfo.serviceProviderId
  71. const { data } = await this.SellerService.getSellerNotice(this.params)
  72. if (options.isRefresh) {
  73. this.messageList = data.list
  74. }
  75. else {
  76. this.messageList = [...this.messageList, ...data.list]
  77. }
  78. this.isLastPage = data.isLastPage
  79. },
  80. // 删除
  81. deleteBtn(id, index) {
  82. // 删除通知消息
  83. this.UserService.authDeleteMessage({ id: id })
  84. .then(response => {
  85. uni.vibrateShort({
  86. success: () => {
  87. this.params.pageSize = this.params.pageNum * this.params.pageSize
  88. this.params.pageNum = 1
  89. this.getMessageList({isRefresh: true})
  90. }
  91. })
  92. })
  93. .catch(error => {
  94. console.log('error=>', error.msg)
  95. })
  96. },
  97. // 详情
  98. async trampInfo($event) {
  99. const time = $event.time.replace(/[年月日]/g, '-')
  100. if ($event.shopTieredType === 7 && $event.shopTieredType === 10) {
  101. this.$api.navigateTo(
  102. '/pages/seller/notice/service/Institutional_visits?spId=' +
  103. this.userInfo.serviceProviderId +
  104. '&accDateTime=' +
  105. $event.time + '&type=' + this.params.type
  106. )
  107. } else {
  108. const {data} = await this.SellerService.getFindUserId({id: $event.clubId, userType: 1})
  109. this.$api.navigateTo('/pages/seller/club/club-portrait?userId=' + data)
  110. }
  111. }
  112. },
  113. onPullDownRefresh() {
  114. this.params.pageSize = 10
  115. this.params.pageNum = 1
  116. this.getMessageList({isRefresh: true})
  117. uni.stopPullDownRefresh()
  118. },
  119. onReachBottom() {
  120. if (!this.isLastPage) {
  121. this.params.pageNum += 1
  122. this.getMessageList({isRefresh: false})
  123. }
  124. }
  125. }
  126. </script>
  127. <style scopde lang="scss">
  128. .container {
  129. box-sizing: border-box;
  130. }
  131. .info-card {
  132. margin-bottom: 24rpx;
  133. box-sizing: border-box;
  134. }
  135. page {
  136. background-color: #f7f7f7;
  137. }
  138. .container-main {
  139. width: 100%;
  140. box-sizing: border-box;
  141. padding: 24rpx 0;
  142. .empty-container-image {
  143. width: 260rpx;
  144. height: 260rpx;
  145. margin-top: -300rpx;
  146. }
  147. }
  148. .tui-swipeout-content {
  149. white-space: normal !important;
  150. }
  151. .tui-notice {
  152. margin-bottom: 24rpx;
  153. }
  154. .tui-notice-cell {
  155. width: 702rpx;
  156. height: auto;
  157. background-color: #ffffff;
  158. border-radius: 16rpx;
  159. box-sizing: border-box;
  160. padding: 24rpx;
  161. margin: 0 auto;
  162. .tui-cell-top {
  163. width: 100%;
  164. height: 105rpx;
  165. line-height: 105rpx;
  166. border-bottom: 1px solid #ccc;
  167. margin-bottom: 33rpx;
  168. .cell-title {
  169. font-size: 32rpx;
  170. color: #333333;
  171. float: left;
  172. font-weight: bold;
  173. }
  174. .cell-time {
  175. font-size: 24rpx;
  176. color: #999999;
  177. float: right;
  178. }
  179. }
  180. .tui-cell-content {
  181. width: 100%;
  182. height: auto;
  183. box-sizing: border-box;
  184. border-radius: 8rpx;
  185. line-height: 44rpx;
  186. padding: 24rpx;
  187. background-color: #f7f7f7;
  188. font-size: 28rpx;
  189. color: #333333;
  190. text-align: justify;
  191. }
  192. }
  193. .tui-custom-btn_box {
  194. width: 80px;
  195. height: 100%;
  196. padding: 0 20rpx;
  197. box-sizing: border-box;
  198. display: flex;
  199. align-items: center;
  200. justify-content: center;
  201. background-color: #f7f7f7;
  202. }
  203. .tui-custom-btn {
  204. width: 56rpx;
  205. height: 56rpx;
  206. border-radius: 50%;
  207. background-color: #f94b4b;
  208. color: #ffffff;
  209. display: flex;
  210. align-items: center;
  211. justify-content: center;
  212. flex-shrink: 0;
  213. .icon-shanchu3 {
  214. font-size: 32rpx;
  215. }
  216. }
  217. </style>