index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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/news/list"></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"
  27. style="max-width: 54px; max-height: 52px; object-fit: contain;"></image>
  28. <view class="tit">{{ item.menuName }}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="clear"></view>
  33. </view>
  34. <!--最新资讯-->
  35. <view class="news">
  36. <view class="vlabel">
  37. <view class="tag"></view>
  38. <text class="title">最新资讯</text>
  39. <text class="more" @click="navTo('/pages/news/list')">
  40. <text>更多</text>
  41. <text class="icon">&#xe8f2;</text>
  42. </text>
  43. </view>
  44. <view class="list animated fadeInDown">
  45. <view class="news_item" v-for="(item, index) in newsList" :key="index"
  46. @click="go('/pages/news/detail?id=' + item.id)">
  47. <image :src="item.cover" mode="aspectFill" class="img" v-if="item.cover"></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">{{item.releaseTime}}</view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <u-popup :show="show" @close="close()" round="15" mode="center" :closeable="false" :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" :closeable="false"
  82. :closeOnClickOverlay="false" :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. <u-popup :show="purchaser" round="15" mode="center" :closeable="false" :closeOnClickOverlay="false"
  98. :customStyle="{ width: '90%' }">
  99. <view class="reflush" @click="getTbPurchaserAuth()">刷新</view>
  100. <view class="ppopup">
  101. <u-divider text="提醒" textSize="16"></u-divider>
  102. <view class="contents">
  103. <view style="text-indent: 2rem;line-height: 60rpx;">
  104. 您的资料不完善或正在审核中,请前往补充或者等待管理员审核!</view>
  105. </view>
  106. <button class="btn" @click="go('/pages/authentication/index')">前往查看</button>
  107. </view>
  108. </u-popup>
  109. <u-popup :show="update.visible" round="15" mode="center" :closeable="false" :closeOnClickOverlay="false"
  110. :customStyle="{ width: '90%' }">
  111. <view class="ppopup">
  112. <u-divider text="有新版本更新!" textSize="16"></u-divider>
  113. <view class="contents">
  114. <view style="text-indent: 2rem;line-height: 60rpx;">
  115. 更新内容:{{update.content}}
  116. </view>
  117. <view style="text-indent: 2rem;line-height: 60rpx;">
  118. 当前版本号:{{update.currentVersion}}
  119. </view>
  120. <view style="text-indent: 2rem;line-height: 60rpx;">
  121. 新版本号:{{update.version}}
  122. </view>
  123. </view>
  124. <button class="btn" @click="updateApk">立即更新</button>
  125. </view>
  126. </u-popup>
  127. </view>
  128. </template>
  129. <script>
  130. export default {
  131. data() {
  132. return {
  133. keyword: '',
  134. bannerList: [],
  135. newsList: [],
  136. noticeList: [],
  137. roleMenu: [],
  138. menuList: [],
  139. count: 0,
  140. show: false,
  141. order: {},
  142. user: {},
  143. faceRegister: false,
  144. cooper_entrust: 2,
  145. purchaser: false,
  146. update: {
  147. visible: false,
  148. currentVersion: '',
  149. version: '',
  150. content: '',
  151. url: ''
  152. }
  153. };
  154. },
  155. onLoad() {
  156. uni.hideLoading()
  157. this.getBannerList();
  158. this.getNewsList();
  159. this.getMenu();
  160. uni.$on('getMenu', res => {
  161. this.getMenu();
  162. });
  163. },
  164. onShow() {
  165. this.keyword = '';
  166. let user = uni.getStorageSync('info');
  167. this.user = user;
  168. this.checkFace()
  169. this.getRead();
  170. this.getUpdateInfo();
  171. },
  172. methods: {
  173. getUpdateInfo() {
  174. let currentVersion = uni.getAppBaseInfo().appVersion;
  175. this.update.visible=false;
  176. this.http.request({
  177. url: '/sp-admin/app/updateInfo',
  178. loading: 'false',
  179. success: resp => {
  180. if(resp.data.data){
  181. let version = resp.data.data.version;
  182. this.update = {
  183. visible: currentVersion != version,
  184. currentVersion: currentVersion,
  185. content: resp.data.data.content,
  186. version: version,
  187. url: resp.data.data.url
  188. };
  189. }
  190. }
  191. })
  192. },
  193. updateApk() {
  194. plus.runtime.openURL(this.update.url)
  195. return;
  196. var dtask = plus.downloader.createDownload(
  197. this.update.url, {
  198. force: true
  199. }, (d, status) => {
  200. if (status == 200) {
  201. console.log("下载成功安装: " + d.filename);
  202. plus.runtime.install(d.filename)
  203. } else {
  204. plus.nativeUI.alert("安装失败,请稍候重试: " + status)
  205. }
  206. });
  207. dtask.start();
  208. },
  209. close() {
  210. this.show = false;
  211. },
  212. checkFace() {
  213. let user = this.user;
  214. this.faceRegister = false;
  215. if ((user.userType == 1 || user.userType == 2)) {
  216. this.http.request({
  217. url:'/sp-admin/app/AppUser/getAuth',
  218. success:resp=>{
  219. let res=resp.data.data;
  220. this.user.name=res.name;
  221. this.user.phone=res.phone;
  222. this.user.face=res.face;
  223. this.faceRegister=res.face==0;
  224. if(res.face==1){
  225. this.getOrderConfirm();
  226. }
  227. }
  228. })
  229. return;
  230. } else if (user.userType == 3) {
  231. this.getTbPurchaserAuth()
  232. }
  233. },
  234. go(url) {
  235. uni.navigateTo({
  236. url: url
  237. });
  238. },
  239. getTbPurchaserAuth() {
  240. this.purchaser = false;
  241. this.http.request({
  242. url: '/level-two-server/app/TbPurchaser/info',
  243. loading: 'false',
  244. success: res => {
  245. let resp = res.data;
  246. if (!resp.data || resp.data.judgeStatus == 2) {
  247. this.purchaser = true;
  248. return;
  249. }
  250. }
  251. })
  252. },
  253. //获取待处理的订单弹出
  254. getOrderConfirm() {
  255. let user = this.getUser();
  256. if (user.userType > 2) {
  257. return;
  258. }
  259. // 是否校验互助委托书【1校验 2不校验】
  260. this.http.request({
  261. url: '/sp-admin/SpCfg/cooper',
  262. method: 'POST',
  263. data: {
  264. cfgName: 'cooper_entrust_cfg'
  265. },
  266. success: res => {
  267. this.cooper_entrust = JSON.parse(res.data.data).cooper_entrust
  268. this.http.request({
  269. url: '/level-one-server/app/TbOrder/getNoConfirmOrder',
  270. data: {
  271. cooper_entrust: this.cooper_entrust
  272. },
  273. loading: 'false',
  274. success: res => {
  275. if (res.data.data) {
  276. this.order = res.data.data;
  277. this.show = true;
  278. }
  279. }
  280. });
  281. }
  282. })
  283. },
  284. confirm() {
  285. if (this.order.declareType == '1') {
  286. uni.navigateTo({
  287. url: '/pages/market/one/leader/handle?orderId=' + this.order.id + '&peopleConfirmStatus=' +
  288. this.order.peopleConfirmStatus + '&applyConfirmStatus=' + this.order.applyConfirmStatus
  289. });
  290. } else {
  291. uni.navigateTo({
  292. url: '/pages/market/one/leader/handleThree?orderId=' + this.order.id +
  293. '&peopleConfirmStatus=' + this.order.peopleConfirmStatus + '&cooperEntrustStatus=' +
  294. this.order.cooperEntrustStatus + '&applyConfirmStatus=' + this.order.applyConfirmStatus
  295. });
  296. }
  297. this.show = false;
  298. },
  299. getRead() {
  300. this.http.request({
  301. url: '/sp-admin/app/TbMessage/getRead',
  302. loading: 'false',
  303. success: res => {
  304. if (res.data.data.count > 0) {
  305. this.count = res.data.data.count;
  306. uni.setTabBarBadge({
  307. index: 1,
  308. text: res.data.data.count
  309. });
  310. } else {
  311. this.count = 0;
  312. }
  313. }
  314. });
  315. },
  316. getBannerList() {
  317. this.http.request({
  318. url: '/level-one-server/app/TbBanner/getList',
  319. success: res => {
  320. this.bannerList = res.data.data;
  321. }
  322. });
  323. },
  324. getMenu() {
  325. this.menuList = [];
  326. let menu = uni.getStorageSync('menu');
  327. this.http.request({
  328. url: '/sp-admin/app/AppMenu/getList',
  329. data: {
  330. pageNo: 1,
  331. pageSize: 50
  332. },
  333. success: res => {
  334. let data = res.data.data;
  335. menu.map((item2, index1) => {
  336. data.map((item1, index) => {
  337. if (parseInt(item1.id) == parseInt(item2)) {
  338. item1.icon = item1.icon
  339. this.menuList.push(item1);
  340. }
  341. });
  342. });
  343. this.menuList.sort((a, b) => a.sort - b.sort);
  344. }
  345. });
  346. },
  347. getNewsList() {
  348. this.http.request({
  349. url: '/level-one-server/app/TbPortNews/getNewestList',
  350. data: {
  351. limit: 3
  352. },
  353. success: res => {
  354. let list = res.data.data;
  355. this.newsList = res.data.data;
  356. this.noticeList = list?list.map(obj => obj.title):[];
  357. }
  358. });
  359. },
  360. //点击轮播图
  361. click(index) {
  362. let item = this.bannerList[index];
  363. let url = item.url;
  364. if (url) {
  365. // #ifdef APP-PLUS
  366. plus.runtime.openURL(url) //这里默认使用外部浏览器打开而不是内部web-view组件打开
  367. // #endif
  368. // #ifdef H5
  369. window.open(url)
  370. // #endif
  371. }
  372. },
  373. message() {
  374. uni.switchTab({
  375. url: '/pages/message/message'
  376. });
  377. },
  378. search() {
  379. uni.navigateTo({
  380. url: '/pages/news/list?keyword=' + this.keyword
  381. });
  382. },
  383. navTo(url) {
  384. //收购商需要认证才给访问
  385. if (this.getUser().userType == 3 && !this.hasAuth()) {
  386. uni.navigateTo({
  387. url: '/pages/authentication/index'
  388. });
  389. return;
  390. }
  391. console.log(url);
  392. uni.navigateTo({
  393. url: url,
  394. fail: res => {
  395. uni.showModal({
  396. content: '功能还在开发中',
  397. showCancel: false
  398. });
  399. }
  400. });
  401. },
  402. go(url) {
  403. uni.navigateTo({
  404. url: url
  405. });
  406. }
  407. },
  408. //下拉刷新
  409. onPullDownRefresh() {
  410. setTimeout(() => {
  411. uni.stopPullDownRefresh();
  412. this.getMenu();
  413. }, 1000);
  414. }
  415. };
  416. </script>
  417. <style lang="scss">
  418. page {
  419. background-color: $pg;
  420. }
  421. .top {
  422. width: 100%;
  423. position: relative;
  424. }
  425. .cmain {
  426. padding: 10px 15px 10px 15px;
  427. margin-top: -183px;
  428. position: relative;
  429. .vsearch {
  430. margin-bottom: 13px;
  431. position: relative;
  432. .vse {
  433. width: 82% !important;
  434. }
  435. .icon {
  436. position: absolute;
  437. right: 0px;
  438. top: 0px;
  439. color: white;
  440. font-size: 25px;
  441. top: 5px;
  442. }
  443. .bage {
  444. width: 8px;
  445. height: 8px;
  446. border-radius: 50%;
  447. background-color: #f44336;
  448. top: 0px;
  449. right: 0px;
  450. position: absolute;
  451. }
  452. }
  453. .uni-swiper {
  454. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  455. }
  456. .notice {
  457. margin-top: 10px;
  458. border-radius: 5px !important;
  459. overflow: hidden;
  460. }
  461. .news {
  462. margin-top: 15px;
  463. }
  464. }
  465. .reflush {
  466. width: 60rpx;
  467. height: 60rpx;
  468. float: right;
  469. position: absolute;
  470. right: 20rpx;
  471. padding: 20rpx;
  472. font-size: 24rpx;
  473. }
  474. .ppopup {
  475. padding: 50rpx 30rpx;
  476. .item {
  477. padding: 5px 0px 5px 0px;
  478. color: $font-c;
  479. .label {
  480. width: 70px;
  481. float: left;
  482. text-align: left;
  483. padding-right: 10px;
  484. font-weight: bold;
  485. }
  486. }
  487. }
  488. </style>