index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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="item.cover" mode="aspectFill" class="img" v-if="item.cover"></image>
  43. <image src="../../static/tp.jpg" mode="aspectFill" class="img" v-else></image>
  44. <view class="con">
  45. <view class="title ellip">{{ item.title }}</view>
  46. <view class="source omit">
  47. <text class="icon">&#xe639;</text>
  48. <text>{{ item.readCount }}</text>
  49. </view>
  50. <view class="releaseTime">{{ util.forDate(item.releaseTime,'yyyy-MM-dd HH:mm') }}</view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <u-popup :show="show" @close="close()" round="15" mode="center" :closeOnClickOverlay="false" :customStyle="{ width: '90%' }">
  57. <view class="ppopup">
  58. <u-divider text="交易订单提醒" textSize="16"></u-divider>
  59. <view class="contents">
  60. <view class="item omit">
  61. <text class="label">商品名称:</text>
  62. <text class="desc">{{ order.goodsNames }}</text>
  63. </view>
  64. <view class="item omit">
  65. <text class="label">数量:</text>
  66. <text class="desc">{{ order.totalWeight }}</text>
  67. </view>
  68. <view class="item omit">
  69. <text class="label">金额:</text>
  70. <text class="desc">¥ {{ order.totalPrice }}</text>
  71. </view>
  72. </view>
  73. <button class="btn" @click="confirm()">去处理</button>
  74. </view>
  75. </u-popup>
  76. </view>
  77. </template>
  78. <script>
  79. export default {
  80. data() {
  81. return {
  82. keyword: '',
  83. bannerList: [],
  84. newsList: [],
  85. noticeList: ['边民互市贸易APP上线了', '关于边民互市贸易开通注意事项'],
  86. roleMenu: [],
  87. menuList: [],
  88. count: 0,
  89. show: false,
  90. order: {}
  91. };
  92. },
  93. onLoad() {
  94. this.getBannerList();
  95. this.getNewsList();
  96. this.getMenu();
  97. uni.$on('getMenu', res => {
  98. this.getMenu();
  99. });
  100. },
  101. onShow() {
  102. this.keyword = '';
  103. this.getRead();
  104. this.getOrderConfirm();
  105. },
  106. methods: {
  107. //获取待处理的订单弹出
  108. getOrderConfirm() {
  109. this.http.request({
  110. url: '/level-one-server/app/TbOrder/getNoConfirmOrder',
  111. loading: 'false',
  112. success: res => {
  113. if (res.data.data) {
  114. this.order = res.data.data;
  115. this.show = true;
  116. }
  117. }
  118. });
  119. },
  120. confirm() {
  121. if(this.order.declareType == '1') {
  122. uni.navigateTo({ url: '/pages/market/one/leader/handle?orderId=' + this.order.id });
  123. } else {
  124. uni.navigateTo({ url: '/pages/market/one/leader/handleThree?orderId=' + this.order.id + '&peopleConfirmStatus=' + this.order.peopleConfirmStatus + '&cooperEntrustStatus=' + this.order.cooperEntrustStatus+ '&applyConfirmStatus=' + this.order.applyConfirmStatus});
  125. }
  126. this.show = false;
  127. },
  128. getRead() {
  129. this.http.request({
  130. url: '/sp-admin/app/TbMessage/getRead',
  131. loading: 'false',
  132. success: res => {
  133. if (res.data.data.count > 0) {
  134. this.count = res.data.data.count;
  135. uni.setTabBarBadge({ index: 1, text: res.data.data.count });
  136. } else {
  137. this.count = 0;
  138. }
  139. }
  140. });
  141. },
  142. getBannerList() {
  143. this.http.request({
  144. url: '/level-one-server/app/TbBanner/getList',
  145. success: res => {
  146. this.bannerList = res.data.data;
  147. }
  148. });
  149. },
  150. getMenu() {
  151. this.menuList = [];
  152. let menu = uni.getStorageSync('menu');
  153. this.http.request({
  154. url: '/sp-admin/app/AppMenu/getList',
  155. success: res => {
  156. let data = res.data.data;
  157. menu.map((item2, index1) => {
  158. data.map((item1, index) => {
  159. if (parseInt(item1.id) == parseInt(item2)) {
  160. this.menuList.push(item1);
  161. }
  162. });
  163. });
  164. this.menuList.sort((a, b) => a.sort - b.sort);
  165. }
  166. });
  167. },
  168. getNewsList() {
  169. this.http.request({
  170. url: '/level-one-server/app/TbPortNews/getNewestList',
  171. data: { limit: 3 },
  172. success: res => {
  173. this.newsList = res.data.data;
  174. }
  175. });
  176. },
  177. //点击轮播图
  178. click(index) {
  179. uni.navigateTo({ url: '/pages/news/detail?id=8' });
  180. },
  181. message() {
  182. uni.switchTab({ url: '/pages/message/message' });
  183. },
  184. search() {
  185. uni.navigateTo({ url: '/pages/news/list?keyword=' + this.keyword });
  186. },
  187. navTo(url) {
  188. //收购商需要认证才给访问
  189. if (this.getUser().userType == 3 && !this.hasAuth()) {
  190. uni.navigateTo({ url: '/pages/authentication/index' });
  191. return;
  192. }
  193. uni.navigateTo({
  194. url: url,
  195. fail: res => {
  196. console.log('zx:' + JSON.stringify(res));
  197. uni.showModal({ content: '功能还在开发中', showCancel: false });
  198. }
  199. });
  200. },
  201. go(url) {
  202. uni.navigateTo({ url: url });
  203. }
  204. },
  205. //下拉刷新
  206. onPullDownRefresh() {
  207. setTimeout(() => {
  208. uni.stopPullDownRefresh();
  209. this.getMenu();
  210. }, 1000);
  211. }
  212. };
  213. </script>
  214. <style lang="scss">
  215. page {
  216. background-color: $pg;
  217. }
  218. .top {
  219. width: 100%;
  220. position: relative;
  221. }
  222. .cmain {
  223. padding: 10px 15px 10px 15px;
  224. margin-top: -183px;
  225. position: relative;
  226. .vsearch {
  227. margin-bottom: 13px;
  228. position: relative;
  229. .vse {
  230. width: 82% !important;
  231. }
  232. .icon {
  233. position: absolute;
  234. right: 0px;
  235. top: 0px;
  236. color: white;
  237. font-size: 25px;
  238. top: 5px;
  239. }
  240. .bage {
  241. width: 8px;
  242. height: 8px;
  243. border-radius: 50%;
  244. background-color: #f44336;
  245. top: 0px;
  246. right: 0px;
  247. position: absolute;
  248. }
  249. }
  250. .uni-swiper {
  251. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  252. }
  253. .notice {
  254. margin-top: 10px;
  255. border-radius: 5px !important;
  256. overflow: hidden;
  257. }
  258. .news {
  259. margin-top: 15px;
  260. }
  261. }
  262. .ppopup {
  263. .item {
  264. padding: 5px 0px 5px 0px;
  265. color: $font-c;
  266. .label {
  267. width: 70px;
  268. float: left;
  269. text-align: left;
  270. padding-right: 10px;
  271. font-weight: bold;
  272. }
  273. }
  274. }
  275. </style>