service.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. />
  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(cell) {
  101. const time = cell.time.replace(/[年月日]/g, '-')
  102. if (cell.shopTieredType === 7 || cell.shopTieredType === 10) {
  103. this.$api.navigateTo(
  104. '/pages/seller/notice/service/Institutional_visits?spId=' +
  105. this.userInfo.serviceProviderId +
  106. '&accDateTime=' +
  107. cell.time + '&type=' + this.params.type
  108. )
  109. } else if(cell.shopTieredType === 11) {
  110. this.$api.navigateTo('/pages/seller/club/club-remind')
  111. }else {
  112. const {data} = await this.SellerService.getFindUserId({id: cell.clubId, userType: 1})
  113. this.$api.navigateTo('/pages/seller/club/club-portrait?userId=' + data)
  114. }
  115. }
  116. },
  117. onPullDownRefresh() {
  118. this.params.pageSize = 10
  119. this.params.pageNum = 1
  120. this.getMessageList({isRefresh: true})
  121. uni.stopPullDownRefresh()
  122. },
  123. onReachBottom() {
  124. if (!this.isLastPage) {
  125. this.params.pageNum += 1
  126. this.getMessageList({isRefresh: false})
  127. }
  128. }
  129. }
  130. </script>
  131. <style scopde lang="scss">
  132. .container {
  133. box-sizing: border-box;
  134. }
  135. .info-card {
  136. margin-bottom: 24rpx;
  137. box-sizing: border-box;
  138. }
  139. page {
  140. background-color: #f7f7f7;
  141. }
  142. .container-main {
  143. width: 100%;
  144. box-sizing: border-box;
  145. padding: 24rpx 0;
  146. .empty-container-image {
  147. width: 260rpx;
  148. height: 260rpx;
  149. margin-top: -300rpx;
  150. }
  151. }
  152. .tui-swipeout-content {
  153. white-space: normal !important;
  154. }
  155. .tui-notice {
  156. margin-bottom: 24rpx;
  157. }
  158. .tui-notice-cell {
  159. width: 702rpx;
  160. height: auto;
  161. background-color: #ffffff;
  162. border-radius: 16rpx;
  163. box-sizing: border-box;
  164. padding: 24rpx;
  165. margin: 0 auto;
  166. .tui-cell-top {
  167. width: 100%;
  168. height: 105rpx;
  169. line-height: 105rpx;
  170. border-bottom: 1px solid #ccc;
  171. margin-bottom: 33rpx;
  172. .cell-title {
  173. font-size: 32rpx;
  174. color: #333333;
  175. float: left;
  176. font-weight: bold;
  177. }
  178. .cell-time {
  179. font-size: 24rpx;
  180. color: #999999;
  181. float: right;
  182. }
  183. }
  184. .tui-cell-content {
  185. width: 100%;
  186. height: auto;
  187. box-sizing: border-box;
  188. border-radius: 8rpx;
  189. line-height: 44rpx;
  190. padding: 24rpx;
  191. background-color: #f7f7f7;
  192. font-size: 28rpx;
  193. color: #333333;
  194. text-align: justify;
  195. }
  196. }
  197. .tui-custom-btn_box {
  198. width: 80px;
  199. height: 100%;
  200. padding: 0 20rpx;
  201. box-sizing: border-box;
  202. display: flex;
  203. align-items: center;
  204. justify-content: center;
  205. background-color: #f7f7f7;
  206. }
  207. .tui-custom-btn {
  208. width: 56rpx;
  209. height: 56rpx;
  210. border-radius: 50%;
  211. background-color: #f94b4b;
  212. color: #ffffff;
  213. display: flex;
  214. align-items: center;
  215. justify-content: center;
  216. flex-shrink: 0;
  217. .icon-shanchu3 {
  218. font-size: 32rpx;
  219. }
  220. }
  221. </style>