details.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="page-container">
  3. <!-- 自定义导航栏 -->
  4. <u-navbar :title="initParams.categoryName || '消息通知'" bgColor="#fff" :autoBack="true" :placeholder="true">
  5. </u-navbar>
  6. <view class="main-box">
  7. <!-- 列表 -->
  8. <view class="msg-list-card">
  9. <ListScrollView ref="listScroll" :api="api" :init="initParams" :pageSize="20">
  10. <template v-slot:list="{ data }">
  11. <view class="msg-item" v-for="(item, i) in data" :key="i" @click="onDetail(item)">
  12. <view class="msg-header-row">
  13. <view class="title-with-dot">
  14. <text class="msg-title">{{ item.titleName }}</text>
  15. <view v-if="item.status === '0'" class="msg-dot"></view>
  16. </view>
  17. </view>
  18. <view class="msg-divider"></view>
  19. <view class="msg-desc">{{ item.content }}</view>
  20. <view class="msg-time">{{ item.createTimeDisplay }}</view>
  21. </view>
  22. </template>
  23. </ListScrollView>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import ListScrollView from '@/components/list-scroll-view/index.vue';
  30. import throttleUtil from '@/utils/public.js';
  31. import { USER_INFO } from "@/common/util/constants"
  32. import { updateMsgTabBadge } from '@/common/util/msgBadge.js';
  33. export default {
  34. components: {
  35. ListScrollView
  36. },
  37. data() {
  38. return {
  39. api: {
  40. url: '/localUserNotice/localUserNotice/getPageListNew',
  41. method: 'POST',
  42. },
  43. initParams: {
  44. userType: 1,
  45. category: null
  46. },
  47. indexOption: null,
  48. merchantId: null
  49. };
  50. },
  51. onLoad(options) {
  52. // 接收参数
  53. if (options) {
  54. this.initParams.category = options.category
  55. }
  56. this.initData()
  57. },
  58. methods: {
  59. async initData() {
  60. this.merchantId = uni.getStorageSync(USER_INFO).merchantId;
  61. let res = await this.$http.get("/merchant/localMerchantInfo/queryAppInfoById?id=" + this.merchantId)
  62. if (res.data.success) {
  63. this.indexOption = res.data.result
  64. }
  65. },
  66. // 点击消息详情
  67. onDetail: throttleUtil.throttles(async function (item) {
  68. if (item.status === '0') {
  69. this.$http.post("/localUserNotice/localUserNotice/edit", {
  70. id: item.id,
  71. status: '1'
  72. }).then(res => {
  73. item.status = '1';
  74. updateMsgTabBadge();
  75. })
  76. }
  77. this.navigateToDetail(item);
  78. }, 500),
  79. // 跳转详情页面
  80. navigateToDetail(item) {
  81. const queryString = encodeURIComponent(JSON.stringify(this.indexOption))
  82. let routeMap = {
  83. // 消息类
  84. 'S1': `/pages/login/settled?params=${queryString}`, //店铺信息审核结果
  85. 'S2': `/pages/store/brandMessage?params=${queryString}`, //品牌信息审核结果
  86. 'S3': `/pages/store/advertising?params=${queryString}`, //广告素材审核结果
  87. 'S4': `/pages/store/headPhoto?params=${queryString}`, //商户照片审核结果
  88. 'S5': '/pages/store/businessQua?params=${queryString}', //经营资质审核结果
  89. 'S6': '/pages/product/index?type=0', // 商品审核结果通过
  90. 'S7': '/pages/product/index?type=3', // 商品审核结果不通过
  91. 'S8': '/pages/store/settings', //店铺设置页面
  92. 'O1': ``, //核销成功 不跳转
  93. 'O4': `/pages/groupMeal/goods/list`, //拼团成功
  94. };
  95. if (item.type === 'O2' || item.type === 'O3') {
  96. const isService = item.isService == 1;
  97. const url = isService
  98. ? `/pages/order/serviceOrder/orderDetail?taskId=${item.businessId}&checkType=${item.checkType}&rightsId=''`
  99. : `/pages/order/record?orderId=${item.businessId}`;
  100. uni.navigateTo({ url });
  101. return;
  102. }
  103. if (item.type === 'O5') {
  104. const app = getApp();
  105. app.globalData.currentIndex = 1
  106. app.globalData.tabIndex = 1
  107. uni.switchTab({
  108. url: `/pages/order/index`//待接单提醒
  109. })
  110. }
  111. if (routeMap[item.type]) {
  112. uni.navigateTo({
  113. url: routeMap[item.type]
  114. });
  115. }
  116. },
  117. }
  118. };
  119. </script>
  120. <style lang="scss" scoped>
  121. .page-container {
  122. height: 100vh;
  123. display: flex;
  124. flex-direction: column;
  125. background: #f8f8fa;
  126. .main-box {
  127. flex: 1;
  128. margin: 30rpx;
  129. border-radius: 16rpx;
  130. overflow: hidden;
  131. display: flex;
  132. flex-direction: column;
  133. }
  134. }
  135. .msg-list-card {
  136. flex: 1;
  137. overflow: hidden;
  138. background-color: #f8f8fa;
  139. .msg-item {
  140. background: #ffffff;
  141. border-radius: 17rpx;
  142. padding: 20rpx;
  143. margin-bottom: 25rpx;
  144. .msg-header-row {
  145. margin-bottom: 16rpx;
  146. .title-with-dot {
  147. display: flex;
  148. align-items: center;
  149. .msg-title {
  150. font-size: 28rpx;
  151. font-weight: 500;
  152. color: #333;
  153. }
  154. .msg-dot {
  155. width: 13rpx;
  156. height: 13rpx;
  157. background: #ff004e;
  158. border-radius: 50%;
  159. margin-left: 10rpx;
  160. }
  161. }
  162. }
  163. .msg-divider {
  164. width: 100%;
  165. height: 1rpx;
  166. background: #eeeeee;
  167. margin-bottom: 16rpx;
  168. }
  169. .msg-desc {
  170. font-size: 24rpx;
  171. color: #666;
  172. line-height: 1.5;
  173. margin-bottom: 12rpx;
  174. }
  175. .msg-time {
  176. font-size: 24rpx;
  177. color: #666;
  178. }
  179. }
  180. }
  181. </style>