index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  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. uni.$on('getMenu', res => {
  158. this.getMenu();
  159. });
  160. },
  161. onShow() {
  162. this.keyword = '';
  163. let user = uni.getStorageSync('info');
  164. this.user = user;
  165. this.checkFace()
  166. this.getRead();
  167. this.getUpdateInfo();
  168. this.getBannerList();
  169. this.getNewsList();
  170. this.getMenu();
  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. this.http.request({
  230. url: '/level-one-server/app/TbPeople/getById',
  231. data: {
  232. id: this.user.fkId
  233. },
  234. success: res => {
  235. this.user.wallet = res.data.data.wallet;
  236. uni.setStorageSync('info', this.user);
  237. }
  238. });
  239. return;
  240. } else if (user.userType == 3) {
  241. this.getTbPurchaserAuth()
  242. }
  243. },
  244. go(url) {
  245. uni.navigateTo({
  246. url: url
  247. });
  248. },
  249. getTbPurchaserAuth() {
  250. this.purchaser = false;
  251. this.http.request({
  252. url: '/level-two-server/app/TbPurchaser/info',
  253. loading: 'false',
  254. success: res => {
  255. let resp = res.data;
  256. if (!resp.data || resp.data.judgeStatus == 2) {
  257. this.purchaser = true;
  258. return;
  259. }
  260. }
  261. })
  262. },
  263. //获取待处理的订单弹出
  264. getOrderConfirm() {
  265. let user = this.getUser();
  266. if (user.userType > 2) {
  267. return;
  268. }
  269. // 是否校验互助委托书【1校验 2不校验】
  270. this.http.request({
  271. url: '/sp-admin/SpCfg/cooper',
  272. method: 'POST',
  273. data: {
  274. cfgName: 'cooper_entrust_cfg'
  275. },
  276. success: res => {
  277. this.cooper_entrust = JSON.parse(res.data.data).cooper_entrust
  278. this.http.request({
  279. url: '/level-one-server/app/TbOrder/getNoConfirmOrder',
  280. data: {
  281. cooper_entrust: this.cooper_entrust
  282. },
  283. loading: 'false',
  284. success: res => {
  285. if (res.data.data) {
  286. this.order = res.data.data;
  287. this.show = true;
  288. }
  289. }
  290. });
  291. }
  292. })
  293. },
  294. confirm() {
  295. if (this.order.declareType == '1') {
  296. uni.navigateTo({
  297. url: '/pages/market/one/leader/handle?orderId=' + this.order.id + '&peopleConfirmStatus=' +
  298. this.order.peopleConfirmStatus + '&applyConfirmStatus=' + this.order.applyConfirmStatus
  299. });
  300. } else {
  301. uni.navigateTo({
  302. url: '/pages/market/one/leader/handleThree?orderId=' + this.order.id +
  303. '&peopleConfirmStatus=' + this.order.peopleConfirmStatus + '&cooperEntrustStatus=' +
  304. this.order.cooperEntrustStatus + '&applyConfirmStatus=' + this.order.applyConfirmStatus
  305. });
  306. }
  307. this.show = false;
  308. },
  309. getRead() {
  310. this.http.request({
  311. url: '/sp-admin/app/TbMessage/getRead',
  312. loading: 'false',
  313. success: res => {
  314. if (res.data.data.count > 0) {
  315. this.count = res.data.data.count;
  316. uni.setTabBarBadge({
  317. index: 1,
  318. text: res.data.data.count
  319. });
  320. } else {
  321. this.count = 0;
  322. }
  323. }
  324. });
  325. },
  326. getBannerList() {
  327. this.http.request({
  328. url: '/level-one-server/app/TbBanner/getList',
  329. success: res => {
  330. this.bannerList = res.data.data;
  331. }
  332. });
  333. },
  334. getMenu() {
  335. this.menuList = [];
  336. let menu = uni.getStorageSync('menu');
  337. this.http.request({
  338. url: '/sp-admin/app/AppMenu/getList',
  339. data: {
  340. pageNo: 1,
  341. pageSize: 50
  342. },
  343. success: res => {
  344. let data = res.data.data;
  345. menu.map((item2, index1) => {
  346. data.map((item1, index) => {
  347. if (parseInt(item1.id) == parseInt(item2)) {
  348. item1.icon = item1.icon
  349. this.menuList.push(item1);
  350. }
  351. });
  352. });
  353. this.menuList.sort((a, b) => a.sort - b.sort);
  354. }
  355. });
  356. },
  357. getNewsList() {
  358. this.http.request({
  359. url: '/level-one-server/app/TbPortNews/getNewestList',
  360. data: {
  361. limit: 3
  362. },
  363. success: res => {
  364. let list = res.data.data;
  365. this.newsList = res.data.data;
  366. this.noticeList = list?list.map(obj => obj.title):[];
  367. }
  368. });
  369. },
  370. getUserWallet() {
  371. if(this.user.userType===1){
  372. this.http.request({
  373. url: '/level-one-server/app/TbPeople/getById',
  374. data: { id: this.user.fkId },
  375. success: res => {
  376. this.user.wallet = res.data.data.wallet;
  377. uni.setStorageSync('info', this.user);
  378. }
  379. });
  380. }
  381. },
  382. //点击轮播图
  383. click(index) {
  384. let item = this.bannerList[index];
  385. let url = item.url;
  386. if (url) {
  387. // #ifdef APP-PLUS
  388. plus.runtime.openURL(url) //这里默认使用外部浏览器打开而不是内部web-view组件打开
  389. // #endif
  390. // #ifdef H5
  391. window.open(url)
  392. // #endif
  393. }
  394. },
  395. message() {
  396. uni.switchTab({
  397. url: '/pages/message/message'
  398. });
  399. },
  400. search() {
  401. uni.navigateTo({
  402. url: '/pages/news/list?keyword=' + this.keyword
  403. });
  404. },
  405. navTo(url) {
  406. //收购商需要认证才给访问
  407. if (this.getUser().userType == 3 && !this.hasAuth()) {
  408. uni.navigateTo({
  409. url: '/pages/authentication/index'
  410. });
  411. return;
  412. }
  413. uni.navigateTo({
  414. url: url,
  415. fail: res => {
  416. uni.showModal({
  417. content: '功能还在开发中',
  418. showCancel: false
  419. });
  420. }
  421. });
  422. },
  423. go(url) {
  424. uni.navigateTo({
  425. url: url
  426. });
  427. }
  428. },
  429. //下拉刷新
  430. onPullDownRefresh() {
  431. setTimeout(() => {
  432. uni.stopPullDownRefresh();
  433. this.getMenu();
  434. }, 1000);
  435. }
  436. };
  437. </script>
  438. <style lang="scss">
  439. page {
  440. background-color: $pg;
  441. }
  442. .top {
  443. width: 100%;
  444. position: relative;
  445. }
  446. .cmain {
  447. padding: 10px 15px 10px 15px;
  448. margin-top: -183px;
  449. position: relative;
  450. .vsearch {
  451. margin-bottom: 13px;
  452. position: relative;
  453. .vse {
  454. width: 82% !important;
  455. }
  456. .icon {
  457. position: absolute;
  458. right: 0px;
  459. top: 0px;
  460. color: white;
  461. font-size: 25px;
  462. top: 5px;
  463. }
  464. .bage {
  465. width: 8px;
  466. height: 8px;
  467. border-radius: 50%;
  468. background-color: #f44336;
  469. top: 0px;
  470. right: 0px;
  471. position: absolute;
  472. }
  473. }
  474. .uni-swiper {
  475. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  476. }
  477. .notice {
  478. margin-top: 10px;
  479. border-radius: 5px !important;
  480. overflow: hidden;
  481. }
  482. .news {
  483. margin-top: 15px;
  484. }
  485. }
  486. .reflush {
  487. width: 60rpx;
  488. height: 60rpx;
  489. float: right;
  490. position: absolute;
  491. right: 20rpx;
  492. padding: 20rpx;
  493. font-size: 24rpx;
  494. }
  495. .ppopup {
  496. padding: 50rpx 30rpx;
  497. .item {
  498. padding: 5px 0px 5px 0px;
  499. color: $font-c;
  500. .label {
  501. width: 70px;
  502. float: left;
  503. text-align: left;
  504. padding-right: 10px;
  505. font-weight: bold;
  506. }
  507. }
  508. }
  509. </style>