details.vue 5.2 KB

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