notification.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <!--
  2. * @title 消息通知
  3. * @author Rockery(1113269755@qq.com)
  4. -->
  5. <template>
  6. <view class="notification">
  7. <view class="wrap">
  8. <view class="u-tabs-box notice-tabsswiper">
  9. <u-tabs-swiper bg-color="transparent" ref="noticeTabsSwiper" :list="tabsSwiperList" :current="current" @change="tabsSwiperChange" :is-scroll="false"></u-tabs-swiper>
  10. </view>
  11. <view class="notice-search">
  12. <u-search placeholder="请输入您关键词" v-model="noticeKeyword" bg-color="#FFFFFF" input-align="center" :show-action="false" class="notice-search-btn"></u-search>
  13. </view>
  14. <swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
  15. <swiper-item class="swiper-item">
  16. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
  17. <view class="page-box">
  18. <view class="notice-container" v-for="(consultItem, index) in dataList[0]" :key="index + 'consultitem'">
  19. <view class="title">{{consultItem.title}}</view>
  20. <view class="content">{{consultItem.content}}</view>
  21. <view class="footer">
  22. <view class="left">{{consultItem.dateTime}}</view>
  23. <view :class="consultItem.status == 0 ?'unread':'haveread'" class="right">{{consultItem.statusLabel}}</view>
  24. </view>
  25. </view>
  26. <u-loadmore :status="loadStatus[0]" bgColor="#f2f2f2"></u-loadmore>
  27. </view>
  28. </scroll-view>
  29. </swiper-item>
  30. <swiper-item class="swiper-item">
  31. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
  32. <view class="page-box">
  33. <view class="notice-container" v-for="(systemInfoItem, index) in dataList[1]" :key="index + 'systeminfo'">
  34. <view class="title">{{systemInfoItem.title}}</view>
  35. <view class="content">{{systemInfoItem.content}}</view>
  36. <view class="footer">
  37. <view class="left">{{systemInfoItem.dateTime}}</view>
  38. <view class="right">{{systemInfoItem.status}}</view>
  39. </view>
  40. </view>
  41. <u-loadmore :status="loadStatus[2]" bgColor="#f2f2f2"></u-loadmore>
  42. </view>
  43. </scroll-view>
  44. </swiper-item>
  45. </swiper>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. data() {
  52. return {
  53. noticeKeyword: '',
  54. tabsSwiperList: [
  55. {
  56. name: '问题咨询'
  57. },
  58. {
  59. name: '系统消息'
  60. }
  61. ],
  62. dataList: [
  63. [
  64. {
  65. id: 1,
  66. title: '请问针对退役军人就业有哪些什么政策',
  67. content: '退役军人就业政策,每个地方的规定不一样,但都会按照相关规定实行阳光安置,根据退役军人相关条件和考试成绩进行选择安置。',
  68. dateTime: '发布于2021.09.23 12:31',
  69. status: 1,
  70. statusLabel: '已读'
  71. },
  72. {
  73. id: 2,
  74. title: '请问针对退役军人就业有哪些什么政策',
  75. content: '退役军人就业政策,每个地方的规定不一样,但都会按照相关规定实行阳光安置,根据退役军人相关条件和考试成绩进行选择安置。',
  76. dateTime: '发布于2021.09.23 12:31',
  77. status: 0,
  78. statusLabel: '未读'
  79. }
  80. ],
  81. [
  82. {
  83. id: 1,
  84. title: '请问针对退役军人就业有哪些什么政策',
  85. content: '退役军人就业政策,每个地方的规定不一样,但都会按照相关规定实行阳光安置,根据退役军人相关条件和考试成绩进行选择安置。',
  86. dateTime: '发布于2021.09.23 12:31',
  87. status: 1,
  88. statusLabel: '已读'
  89. },
  90. {
  91. id: 2,
  92. title: '请问针对退役军人就业有哪些什么政策',
  93. content: '退役军人就业政策,每个地方的规定不一样,但都会按照相关规定实行阳光安置,根据退役军人相关条件和考试成绩进行选择安置。',
  94. dateTime: '发布于2021.09.23 12:31',
  95. status: 0,
  96. statusLabel: '未读'
  97. }
  98. ]
  99. ],
  100. current: 0,
  101. swiperCurrent: 0,
  102. dx: 0,
  103. loadStatus: ['loadmore','loadmore'],
  104. };
  105. },
  106. onLoad() {
  107. this.getDataList(0);
  108. },
  109. computed: {
  110. // 价格小数
  111. priceDecimal() {
  112. return val => {
  113. if (val !== parseInt(val)) return val.slice(-2);
  114. else return '00';
  115. };
  116. },
  117. // 价格整数
  118. priceInt() {
  119. return val => {
  120. if (val !== parseInt(val)) return val.split('.')[0];
  121. else return val;
  122. };
  123. }
  124. },
  125. methods: {
  126. reachBottom() {
  127. this.loadStatus.splice(this.current,1,"loading");
  128. setTimeout(() => {
  129. this.getDataList(this.current);
  130. }, 1200);
  131. },
  132. // 页面数据
  133. getDataList(idx) {
  134. this.loadStatus.splice(this.current,1,"nomore")
  135. },
  136. // 总价
  137. totalPrice(item) {
  138. let price = 0;
  139. item.map(val => {
  140. price += parseFloat(val.price);
  141. });
  142. return price.toFixed(2);
  143. },
  144. // 总件数
  145. totalNum(item) {
  146. let num = 0;
  147. item.map(val => {
  148. num += val.number;
  149. });
  150. return num;
  151. },
  152. // tab栏切换
  153. tabsSwiperChange(index) {
  154. this.swiperCurrent = index;
  155. this.getDataList(index);
  156. },
  157. transition({ detail: { dx } }) {
  158. this.$refs.noticeTabsSwiper.setDx(dx);
  159. },
  160. animationfinish({ detail: { current } }) {
  161. this.$refs.noticeTabsSwiper.setFinishCurrent(current);
  162. this.swiperCurrent = current;
  163. this.current = current;
  164. }
  165. }
  166. };
  167. </script>
  168. <style lang="scss" scoped>
  169. .order {
  170. width: 710rpx;
  171. background-color: #ffffff;
  172. margin: 20rpx auto;
  173. border-radius: 20rpx;
  174. box-sizing: border-box;
  175. padding: 20rpx;
  176. font-size: 28rpx;
  177. .top {
  178. display: flex;
  179. justify-content: space-between;
  180. .left {
  181. display: flex;
  182. align-items: center;
  183. .store {
  184. margin: 0 10rpx;
  185. font-size: 32rpx;
  186. font-weight: bold;
  187. }
  188. }
  189. .right {
  190. color: $u-type-warning-dark;
  191. }
  192. }
  193. .item {
  194. display: flex;
  195. margin: 20rpx 0 0;
  196. .left {
  197. margin-right: 20rpx;
  198. image {
  199. width: 200rpx;
  200. height: 200rpx;
  201. border-radius: 10rpx;
  202. }
  203. }
  204. .content {
  205. .title {
  206. font-size: 28rpx;
  207. line-height: 50rpx;
  208. }
  209. .type {
  210. margin: 10rpx 0;
  211. font-size: 24rpx;
  212. color: $u-tips-color;
  213. }
  214. .delivery-time {
  215. color: #e5d001;
  216. font-size: 24rpx;
  217. }
  218. }
  219. .right {
  220. margin-left: 10rpx;
  221. padding-top: 20rpx;
  222. text-align: right;
  223. .decimal {
  224. font-size: 24rpx;
  225. margin-top: 4rpx;
  226. }
  227. .number {
  228. color: $u-tips-color;
  229. font-size: 24rpx;
  230. }
  231. }
  232. }
  233. .total {
  234. margin-top: 20rpx;
  235. text-align: right;
  236. font-size: 24rpx;
  237. .total-price {
  238. font-size: 32rpx;
  239. }
  240. }
  241. .bottom {
  242. display: flex;
  243. margin-top: 40rpx;
  244. padding: 0 10rpx;
  245. justify-content: space-between;
  246. align-items: center;
  247. .btn {
  248. line-height: 52rpx;
  249. width: 160rpx;
  250. border-radius: 26rpx;
  251. border: 2rpx solid $u-border-color;
  252. font-size: 26rpx;
  253. text-align: center;
  254. color: $u-type-info-dark;
  255. }
  256. .evaluate {
  257. color: $u-type-warning-dark;
  258. border-color: $u-type-warning-dark;
  259. }
  260. }
  261. }
  262. .centre {
  263. text-align: center;
  264. margin: 200rpx auto;
  265. font-size: 32rpx;
  266. image {
  267. width: 164rpx;
  268. height: 164rpx;
  269. border-radius: 50%;
  270. margin-bottom: 20rpx;
  271. }
  272. .tips {
  273. font-size: 24rpx;
  274. color: #999999;
  275. margin-top: 20rpx;
  276. }
  277. .btn {
  278. margin: 80rpx auto;
  279. width: 200rpx;
  280. border-radius: 32rpx;
  281. line-height: 64rpx;
  282. color: #ffffff;
  283. font-size: 26rpx;
  284. background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%);
  285. }
  286. }
  287. </style>
  288. <style lang="scss"
  289. scoped>
  290. @import './scss/notification.scss'
  291. </style>