service.vue 5.9 KB

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