index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view>
  3. <image src="../../static/images/my.png" mode="widthFix" class="top"></image>
  4. <view class="cmain">
  5. <view class="vsearch">
  6. <view class="vse">
  7. <u-search placeholder="搜索资讯" v-model="keyword" @search="search" :actionStyle="{ color: 'white' }" :animation="true" actionText="取消"></u-search>
  8. </view>
  9. <view class="icon" @click="message()">&#xe60d;</view>
  10. <view class="bage" v-if="count > 0"></view>
  11. </view>
  12. <!--轮播图-->
  13. <u-swiper circular :radius="5" :indicator="true" keyName="image" :list="bannerList" :height="110" class="uni-swiper" @click="click"></u-swiper>
  14. <!--通知公告-->
  15. <view class="notice">
  16. <u-notice-bar color="#848484" :text="noticeList" :step="true" direction="column" mode="link" bgColor="white" speed="300" url="/pages/notice/index"></u-notice-bar>
  17. </view>
  18. <!--菜单-->
  19. <view class="menu">
  20. <view class="msn" v-for="(item, index) in menuList" :key="index" @click="navTo(item.path)">
  21. <view class="out">
  22. <view class="int">
  23. <image :src="item.icon" mode="widthFix" style="width: 54px; height: 54px"></image>
  24. <view class="tit">{{ item.menuName }}</view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="clear"></view>
  29. </view>
  30. <!--最新资讯-->
  31. <view class="news">
  32. <view class="vlabel">
  33. <view class="tag"></view>
  34. <text class="title">最新资讯</text>
  35. <text class="more" @click="navTo('/pages/news/list')">
  36. <text>更多</text>
  37. <text class="icon">&#xe8f2;</text>
  38. </text>
  39. </view>
  40. <view class="list animated fadeInDown">
  41. <view class="news_item" v-for="(item, index) in newsList" :key="index" @click="go('/pages/news/detail?id=' + item.id)">
  42. <image src="../../static/tp.jpg" mode="aspectFill" class="img"></image>
  43. <view class="con">
  44. <view class="title ellip">{{ item.title }}</view>
  45. <view class="source omit">
  46. <text class="icon">&#xe639;</text>
  47. <text>{{ item.readCount }}</text>
  48. </view>
  49. <view class="releaseTime">{{ item.releaseTime }}</view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <u-popup :show="show" @close="close()" round="15" mode="center" :closeOnClickOverlay="false" :customStyle="{ width: '90%' }">
  56. <view class="ppopup">
  57. <u-divider text="交易订单提醒" textSize="16"></u-divider>
  58. <view class="contents">
  59. <view class="item omit">
  60. <text class="label">商品名称:</text>
  61. <text class="desc">{{ order.goodsNames }}</text>
  62. </view>
  63. <view class="item omit">
  64. <text class="label">数量:</text>
  65. <text class="desc">{{ order.totalWeight }}</text>
  66. </view>
  67. <view class="item omit">
  68. <text class="label">金额:</text>
  69. <text class="desc">¥ {{ order.totalPrice }}</text>
  70. </view>
  71. </view>
  72. <button class="btn" @click="confirm()">去处理</button>
  73. </view>
  74. </u-popup>
  75. </view>
  76. </template>
  77. <script>
  78. export default {
  79. data() {
  80. return {
  81. keyword: '',
  82. bannerList: [],
  83. newsList: [],
  84. noticeList: ['边民互市贸易APP上线了', '关于边民互市贸易开通注意事项'],
  85. roleMenu: [],
  86. menuList: [],
  87. count: 0,
  88. show: false,
  89. order: {}
  90. };
  91. },
  92. onLoad() {
  93. this.getMenu();
  94. this.getBannerList();
  95. this.getNewsList();
  96. },
  97. onShow() {
  98. this.keyword = '';
  99. this.getRead();
  100. this.getOrderConfirm();
  101. },
  102. methods: {
  103. //获取待处理的订单弹出
  104. getOrderConfirm() {
  105. this.http.request({
  106. url: '/level-one-server/app/TbOrder/getNoConfirmOrder',
  107. loading: 'false',
  108. success: res => {
  109. if (res.data.data) {
  110. this.order=res.data.data;
  111. this.show = true;
  112. }
  113. }
  114. });
  115. },
  116. confirm() {
  117. uni.navigateTo({ url: '/pages/market/one/leader/handle?orderId=' + this.order.id });
  118. this.show = false;
  119. },
  120. getRead() {
  121. this.http.request({
  122. url: '/sp-admin/app/TbMessage/getRead',
  123. loading: 'false',
  124. success: res => {
  125. if (res.data.data.count > 0) {
  126. this.count = res.data.data.count;
  127. uni.setTabBarBadge({ index: 1, text: res.data.data.count });
  128. } else {
  129. this.count = 0;
  130. }
  131. }
  132. });
  133. },
  134. getBannerList() {
  135. this.http.request({
  136. url: '/level-one-server/app/TbBanner/getList',
  137. success: res => {
  138. this.bannerList = res.data.data;
  139. }
  140. });
  141. },
  142. getMenu() {
  143. this.menuList = [];
  144. let menu = uni.getStorageSync('menu');
  145. this.http.request({
  146. url: '/sp-admin/app/AppMenu/getList',
  147. success: res => {
  148. let data = res.data.data;
  149. menu.map((item2, index1) => {
  150. data.map((item1, index) => {
  151. if (parseInt(item1.id) == parseInt(item2)) {
  152. this.menuList.push(item1);
  153. }
  154. });
  155. });
  156. this.menuList.sort((a, b) => a.sort - b.sort);
  157. }
  158. });
  159. },
  160. getNewsList() {
  161. this.http.request({
  162. url: '/level-one-server/app/TbPortNews/getNewestList',
  163. data: { limit: 5 },
  164. success: res => {
  165. this.newsList = res.data.data;
  166. }
  167. });
  168. },
  169. //点击轮播图
  170. click(index) {
  171. uni.navigateTo({ url: '/pages/news/detail?id=8' });
  172. },
  173. message() {
  174. uni.switchTab({ url: '/pages/message/message' });
  175. },
  176. search() {
  177. uni.navigateTo({ url: '/pages/news/list?keyword=' + this.keyword });
  178. },
  179. navTo(url) {
  180. uni.navigateTo({
  181. url: url,
  182. fail: res => {
  183. console.log('zx:' + JSON.stringify(res));
  184. uni.showModal({ content: '功能还在开发中', showCancel: false });
  185. }
  186. });
  187. },
  188. go(url) {
  189. uni.navigateTo({ url: url });
  190. }
  191. },
  192. //下拉刷新
  193. onPullDownRefresh() {
  194. setTimeout(() => {
  195. uni.stopPullDownRefresh();
  196. this.getMenu();
  197. }, 1000);
  198. }
  199. };
  200. </script>
  201. <style lang="scss">
  202. page {
  203. background-color: $pg;
  204. }
  205. .top {
  206. width: 100%;
  207. position: relative;
  208. }
  209. .cmain {
  210. padding: 10px 15px 10px 15px;
  211. margin-top: -193px;
  212. position: relative;
  213. .vsearch {
  214. margin-bottom: 13px;
  215. position: relative;
  216. .vse {
  217. width: 82% !important;
  218. }
  219. .icon {
  220. position: absolute;
  221. right: 0px;
  222. top: 0px;
  223. color: white;
  224. font-size: 25px;
  225. top: 5px;
  226. }
  227. .bage {
  228. width: 8px;
  229. height: 8px;
  230. border-radius: 50%;
  231. background-color: #f44336;
  232. top: 0px;
  233. right: 0px;
  234. position: absolute;
  235. }
  236. }
  237. .uni-swiper {
  238. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  239. }
  240. .notice {
  241. margin-top: 10px;
  242. border-radius: 5px !important;
  243. overflow: hidden;
  244. }
  245. .news {
  246. margin-top: 15px;
  247. }
  248. }
  249. .ppopup {
  250. .item {
  251. padding: 5px 0px 5px 0px;
  252. color: $font-c;
  253. .label {
  254. width: 70px;
  255. float: left;
  256. text-align: left;
  257. padding-right: 10px;
  258. font-weight: bold;
  259. }
  260. }
  261. }
  262. </style>