index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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' }"
  8. :animation="true" actionText="取消"></u-search>
  9. </view>
  10. <view class="icon" @click="message()">&#xe60d;</view>
  11. <view class="bage" v-if="count > 0"></view>
  12. </view>
  13. <!--轮播图-->
  14. <u-swiper circular :radius="5" :indicator="true" keyName="image" :list="bannerList" :height="110"
  15. class="uni-swiper" @click="click"></u-swiper>
  16. <!--通知公告-->
  17. <view class="notice">
  18. <u-notice-bar color="#848484" :text="noticeList" :step="true" direction="column" mode="link"
  19. bgColor="white" speed="300" url="/pages/notice/index"></u-notice-bar>
  20. </view>
  21. <!--菜单-->
  22. <view class="menu">
  23. <view class="msn" v-for="(item, index) in menuList" :key="index" @click="navTo(item.path)">
  24. <view class="out">
  25. <view class="int">
  26. <image :src="item.icon" mode="widthFix" style="width: 54px; height: 54px"></image>
  27. <view class="tit">{{ item.menuName }}</view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="clear"></view>
  32. </view>
  33. <!--最新资讯-->
  34. <view class="news">
  35. <view class="vlabel">
  36. <view class="tag"></view>
  37. <text class="title">最新资讯</text>
  38. <text class="more" @click="navTo('/pages/news/list')">
  39. <text>更多</text>
  40. <text class="icon">&#xe8f2;</text>
  41. </text>
  42. </view>
  43. <view class="list animated fadeInDown">
  44. <view class="news_item" v-for="(item, index) in newsList" :key="index"
  45. @click="go('/pages/news/detail?id=' + item.id)">
  46. <image :src="item.cover" mode="aspectFill" class="img" v-if="item.cover"></image>
  47. <image src="../../static/tp.jpg" mode="aspectFill" class="img" v-else></image>
  48. <view class="con">
  49. <view class="title ellip">{{ item.title }}</view>
  50. <view class="source omit">
  51. <text class="icon">&#xe639;</text>
  52. <text>{{ item.readCount }}</text>
  53. </view>
  54. <view class="releaseTime">{{ util.forDate(item.releaseTime,'yyyy-MM-dd HH:mm') }}</view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <u-popup :show="show" @close="close()" round="15" mode="center" :closeOnClickOverlay="false"
  61. :customStyle="{ width: '90%' }">
  62. <view class="ppopup">
  63. <u-divider text="交易订单提醒" textSize="16"></u-divider>
  64. <view class="contents">
  65. <view class="item omit">
  66. <text class="label">商品名称:</text>
  67. <text class="desc">{{ order.goodsNames }}</text>
  68. </view>
  69. <view class="item omit">
  70. <text class="label">数量:</text>
  71. <text class="desc">{{ order.totalWeight }}</text>
  72. </view>
  73. <view class="item omit">
  74. <text class="label">金额:</text>
  75. <text class="desc">¥ {{ order.totalPrice }}</text>
  76. </view>
  77. </view>
  78. <button class="btn" @click="confirm()">去处理</button>
  79. </view>
  80. </u-popup>
  81. <u-popup :show="faceRegister" @close="close()" round="15" mode="center" :closeOnClickOverlay="false"
  82. :customStyle="{ width: '90%' }">
  83. <view class="reflush" @click="checkFace">刷新</view>
  84. <view class="ppopup">
  85. <u-divider text="人脸录入" textSize="16"></u-divider>
  86. <view class="contents">
  87. <view class="item omit">
  88. <text class="label">边民信息:</text>
  89. <text class="desc">{{ user.name }}({{ user.phone }})</text>
  90. </view>
  91. <view style="text-indent: 2rem;line-height: 60rpx;">
  92. 根据相关规定,边民进行互市贸易需要确保为本人实际操作,为了确保后续交易的合规合法话,需要您先录入人脸!</view>
  93. </view>
  94. <button class="btn" @click="go('/pages/face/faceRegister')">马上录入</button>
  95. </view>
  96. </u-popup>
  97. </view>
  98. </template>
  99. <script>
  100. export default {
  101. data() {
  102. return {
  103. keyword: '',
  104. bannerList: [],
  105. newsList: [],
  106. noticeList: ['边民互市贸易APP上线了', '关于边民互市贸易开通注意事项'],
  107. roleMenu: [],
  108. menuList: [],
  109. count: 0,
  110. show: false,
  111. order: {},
  112. user: {},
  113. faceRegister: false
  114. };
  115. },
  116. onLoad() {
  117. let user = this.getUser();
  118. this.user = user;
  119. this.getBannerList();
  120. this.getNewsList();
  121. this.getMenu();
  122. uni.$on('getMenu', res => {
  123. this.getMenu();
  124. });
  125. },
  126. onShow() {
  127. this.checkFace()
  128. this.keyword = '';
  129. this.getRead();
  130. this.getOrderConfirm();
  131. },
  132. methods: {
  133. checkFace() {
  134. let user = this.getUser();
  135. console.log(user);
  136. if ((user.userType == 1 || user.userType == 2) && user.face == 0) {
  137. this.faceRegister = true;
  138. return;
  139. }
  140. this.faceRegister=false;
  141. },
  142. go(url) {
  143. uni.navigateTo({
  144. url: url
  145. });
  146. },
  147. //获取待处理的订单弹出
  148. getOrderConfirm() {
  149. let user = this.getUser();
  150. if (user.userType > 2) {
  151. return;
  152. }
  153. this.http.request({
  154. url: '/level-one-server/app/TbOrder/getNoConfirmOrder',
  155. loading: 'false',
  156. success: res => {
  157. if (res.data.data) {
  158. this.order = res.data.data;
  159. this.show = true;
  160. }
  161. }
  162. });
  163. },
  164. confirm() {
  165. if (this.order.declareType == '1') {
  166. uni.navigateTo({
  167. url: '/pages/market/one/leader/handle?orderId=' + this.order.id
  168. });
  169. } else {
  170. uni.navigateTo({
  171. url: '/pages/market/one/leader/handleThree?orderId=' + this.order.id +
  172. '&peopleConfirmStatus=' + this.order.peopleConfirmStatus + '&cooperEntrustStatus=' +
  173. this.order.cooperEntrustStatus + '&applyConfirmStatus=' + this.order.applyConfirmStatus
  174. });
  175. }
  176. this.show = false;
  177. },
  178. getRead() {
  179. this.http.request({
  180. url: '/sp-admin/app/TbMessage/getRead',
  181. loading: 'false',
  182. success: res => {
  183. if (res.data.data.count > 0) {
  184. this.count = res.data.data.count;
  185. uni.setTabBarBadge({
  186. index: 1,
  187. text: res.data.data.count
  188. });
  189. } else {
  190. this.count = 0;
  191. }
  192. }
  193. });
  194. },
  195. getBannerList() {
  196. this.http.request({
  197. url: '/level-one-server/app/TbBanner/getList',
  198. success: res => {
  199. this.bannerList = res.data.data;
  200. }
  201. });
  202. },
  203. getMenu() {
  204. this.menuList = [];
  205. let menu = uni.getStorageSync('menu');
  206. this.http.request({
  207. url: '/sp-admin/app/AppMenu/getList',
  208. success: res => {
  209. let data = res.data.data;
  210. menu.map((item2, index1) => {
  211. data.map((item1, index) => {
  212. if (parseInt(item1.id) == parseInt(item2)) {
  213. this.menuList.push(item1);
  214. }
  215. });
  216. });
  217. this.menuList.sort((a, b) => a.sort - b.sort);
  218. }
  219. });
  220. },
  221. getNewsList() {
  222. this.http.request({
  223. url: '/level-one-server/app/TbPortNews/getNewestList',
  224. data: {
  225. limit: 3
  226. },
  227. success: res => {
  228. this.newsList = res.data.data;
  229. }
  230. });
  231. },
  232. //点击轮播图
  233. click(index) {
  234. uni.navigateTo({
  235. url: '/pages/news/detail?id=8'
  236. });
  237. },
  238. message() {
  239. uni.switchTab({
  240. url: '/pages/message/message'
  241. });
  242. },
  243. search() {
  244. uni.navigateTo({
  245. url: '/pages/news/list?keyword=' + this.keyword
  246. });
  247. },
  248. navTo(url) {
  249. //收购商需要认证才给访问
  250. if (this.getUser().userType == 3 && !this.hasAuth()) {
  251. uni.navigateTo({
  252. url: '/pages/authentication/index'
  253. });
  254. return;
  255. }
  256. uni.navigateTo({
  257. url: url,
  258. fail: res => {
  259. console.log('zx:' + JSON.stringify(res));
  260. uni.showModal({
  261. content: '功能还在开发中',
  262. showCancel: false
  263. });
  264. }
  265. });
  266. },
  267. go(url) {
  268. uni.navigateTo({
  269. url: url
  270. });
  271. }
  272. },
  273. //下拉刷新
  274. onPullDownRefresh() {
  275. setTimeout(() => {
  276. uni.stopPullDownRefresh();
  277. this.getMenu();
  278. }, 1000);
  279. }
  280. };
  281. </script>
  282. <style lang="scss">
  283. page {
  284. background-color: $pg;
  285. }
  286. .top {
  287. width: 100%;
  288. position: relative;
  289. }
  290. .cmain {
  291. padding: 10px 15px 10px 15px;
  292. margin-top: -183px;
  293. position: relative;
  294. .vsearch {
  295. margin-bottom: 13px;
  296. position: relative;
  297. .vse {
  298. width: 82% !important;
  299. }
  300. .icon {
  301. position: absolute;
  302. right: 0px;
  303. top: 0px;
  304. color: white;
  305. font-size: 25px;
  306. top: 5px;
  307. }
  308. .bage {
  309. width: 8px;
  310. height: 8px;
  311. border-radius: 50%;
  312. background-color: #f44336;
  313. top: 0px;
  314. right: 0px;
  315. position: absolute;
  316. }
  317. }
  318. .uni-swiper {
  319. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  320. }
  321. .notice {
  322. margin-top: 10px;
  323. border-radius: 5px !important;
  324. overflow: hidden;
  325. }
  326. .news {
  327. margin-top: 15px;
  328. }
  329. }
  330. .reflush {
  331. width: 60rpx;
  332. height: 60rpx;
  333. float: right;
  334. position: absolute;
  335. right: 20rpx;
  336. padding: 20rpx;
  337. font-size: 24rpx;
  338. }
  339. .ppopup {
  340. .item {
  341. padding: 5px 0px 5px 0px;
  342. color: $font-c;
  343. .label {
  344. width: 70px;
  345. float: left;
  346. text-align: left;
  347. padding-right: 10px;
  348. font-weight: bold;
  349. }
  350. }
  351. }
  352. </style>