index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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.getBannerList();
  94. this.getNewsList();
  95. this.getMenu();
  96. uni.$on('getMenu', res => {
  97. this.getMenu();
  98. });
  99. },
  100. onShow() {
  101. this.keyword = '';
  102. this.getRead();
  103. this.getOrderConfirm();
  104. },
  105. methods: {
  106. //获取待处理的订单弹出
  107. getOrderConfirm() {
  108. this.http.request({
  109. url: '/level-one-server/app/TbOrder/getNoConfirmOrder',
  110. loading: 'false',
  111. success: res => {
  112. if (res.data.data) {
  113. this.order = res.data.data;
  114. this.show = true;
  115. }
  116. }
  117. });
  118. },
  119. confirm() {
  120. uni.navigateTo({ url: '/pages/market/one/leader/handle?orderId=' + this.order.id });
  121. this.show = false;
  122. },
  123. getRead() {
  124. this.http.request({
  125. url: '/sp-admin/app/TbMessage/getRead',
  126. loading: 'false',
  127. success: res => {
  128. if (res.data.data.count > 0) {
  129. this.count = res.data.data.count;
  130. uni.setTabBarBadge({ index: 1, text: res.data.data.count });
  131. } else {
  132. this.count = 0;
  133. }
  134. }
  135. });
  136. },
  137. getBannerList() {
  138. this.http.request({
  139. url: '/level-one-server/app/TbBanner/getList',
  140. success: res => {
  141. this.bannerList = res.data.data;
  142. }
  143. });
  144. },
  145. getMenu() {
  146. this.menuList = [];
  147. let menu = uni.getStorageSync('menu');
  148. this.http.request({
  149. url: '/sp-admin/app/AppMenu/getList',
  150. success: res => {
  151. let data = res.data.data;
  152. menu.map((item2, index1) => {
  153. data.map((item1, index) => {
  154. if (parseInt(item1.id) == parseInt(item2)) {
  155. this.menuList.push(item1);
  156. }
  157. });
  158. });
  159. this.menuList.sort((a, b) => a.sort - b.sort);
  160. }
  161. });
  162. },
  163. getNewsList() {
  164. this.http.request({
  165. url: '/level-one-server/app/TbPortNews/getNewestList',
  166. data: { limit: 5 },
  167. success: res => {
  168. this.newsList = res.data.data;
  169. }
  170. });
  171. },
  172. //点击轮播图
  173. click(index) {
  174. uni.navigateTo({ url: '/pages/news/detail?id=8' });
  175. },
  176. message() {
  177. uni.switchTab({ url: '/pages/message/message' });
  178. },
  179. search() {
  180. uni.navigateTo({ url: '/pages/news/list?keyword=' + this.keyword });
  181. },
  182. navTo(url) {
  183. //收购商需要认证才给访问
  184. if (this.getUser().userType == 3 && !this.hasAuth()) {
  185. uni.navigateTo({ url: '/pages/authentication/index' });
  186. return;
  187. }
  188. uni.navigateTo({
  189. url: url,
  190. fail: res => {
  191. console.log('zx:' + JSON.stringify(res));
  192. uni.showModal({ content: '功能还在开发中', showCancel: false });
  193. }
  194. });
  195. },
  196. go(url) {
  197. uni.navigateTo({ url: url });
  198. }
  199. },
  200. //下拉刷新
  201. onPullDownRefresh() {
  202. setTimeout(() => {
  203. uni.stopPullDownRefresh();
  204. this.getMenu();
  205. }, 1000);
  206. }
  207. };
  208. </script>
  209. <style lang="scss">
  210. page {
  211. background-color: $pg;
  212. }
  213. .top {
  214. width: 100%;
  215. position: relative;
  216. }
  217. .cmain {
  218. padding: 10px 15px 10px 15px;
  219. margin-top: -183px;
  220. position: relative;
  221. .vsearch {
  222. margin-bottom: 13px;
  223. position: relative;
  224. .vse {
  225. width: 82% !important;
  226. }
  227. .icon {
  228. position: absolute;
  229. right: 0px;
  230. top: 0px;
  231. color: white;
  232. font-size: 25px;
  233. top: 5px;
  234. }
  235. .bage {
  236. width: 8px;
  237. height: 8px;
  238. border-radius: 50%;
  239. background-color: #f44336;
  240. top: 0px;
  241. right: 0px;
  242. position: absolute;
  243. }
  244. }
  245. .uni-swiper {
  246. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  247. }
  248. .notice {
  249. margin-top: 10px;
  250. border-radius: 5px !important;
  251. overflow: hidden;
  252. }
  253. .news {
  254. margin-top: 15px;
  255. }
  256. }
  257. .ppopup {
  258. .item {
  259. padding: 5px 0px 5px 0px;
  260. color: $font-c;
  261. .label {
  262. width: 70px;
  263. float: left;
  264. text-align: left;
  265. padding-right: 10px;
  266. font-weight: bold;
  267. }
  268. }
  269. }
  270. </style>