index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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="max-width: 54px; max-height: 52px; object-fit: contain;"></image>
  27. <view class="tit">{{ item.menuName }}</view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="clear"></view>
  32. </view>
  33. <view class="menu">
  34. <!--边民菜单与组长菜单-->
  35. <view class="menu" v-if="user.userType == 1 || user.userType == 2">
  36. <view class="msn" @click="go('/pages/market/one/leader/order')">
  37. <view class="out">
  38. <view class="int">
  39. <view class="icon ioc" style="background-color: #f0dcfc; color: #b064d8">&#xe628;</view>
  40. <view class="tit">一级订单</view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="msn" @click="go('/pages/market/two/leader/order')">
  45. <view class="out">
  46. <view class="int">
  47. <view class="icon ioc" style="background-color: #f0dcfc; color: #b064d8">&#xe628;</view>
  48. <view class="tit">二级订单</view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!--收购商-->
  54. <view class="menu" v-if="user.userType == 3">
  55. <view class="msn" @click="go('/pages/market/two/purchaser/order/cart')">
  56. <view class="out">
  57. <view class="int">
  58. <view class="icon ioc" style="background-color: #fff6e0; color: #f1ba41">&#xe604;</view>
  59. <view class="tit">购物车</view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="msn" @click="go('/pages/market/two/purchaser/address/list')">
  64. <view class="out">
  65. <view class="int">
  66. <view class="icon ioc" style="background-color: #fff6e0; color: #f1ba41">&#xe623;</view>
  67. <view class="tit">地址管理</view>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="msn" @click="go('/pages/market/two/purchaser/order/list')">
  72. <view class="out">
  73. <view class="int">
  74. <view class="icon ioc" style="background-color: #f0dcfc; color: #b064d8">&#xe628;</view>
  75. <view class="tit">我的订单</view>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="msn" @click="go('/pages/authentication/purchaser/info')">
  80. <view class="out">
  81. <view class="int">
  82. <view class="icon ioc" style="background-color: #e0ffff; color: #00bfff">&#xe660;</view>
  83. <view class="tit">我的认证</view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <!--合作社-->
  89. <view class="menu" v-if="user.userType == 6">
  90. <view class="msn" @click="go('/pages/market/one/cooperative/order')">
  91. <view class="out">
  92. <view class="int">
  93. <view class="icon ioc" style="background-color: #e1f6e9; color: #47cf74">&#xe634;</view>
  94. <view class="tit">结算单</view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. <!--最新资讯-->
  101. <view class="news">
  102. <view class="vlabel">
  103. <view class="tag"></view>
  104. <text class="title">最新资讯</text>
  105. <text class="more" @click="navTo('/pages/news/list')">
  106. <text>更多</text>
  107. <text class="icon">&#xe8f2;</text>
  108. </text>
  109. </view>
  110. <view class="list animated fadeInDown">
  111. <view class="news_item" v-for="(item, index) in newsList" :key="index"
  112. @click="go('/pages/news/detail?id=' + item.id)">
  113. <image :src="item.cover" mode="aspectFill" class="img" v-if="item.cover"></image>
  114. <image src="../../static/tp.jpg" mode="aspectFill" class="img" v-else></image>
  115. <view class="con">
  116. <view class="title ellip">{{ item.title }}</view>
  117. <view class="source omit">
  118. <text class="icon">&#xe639;</text>
  119. <text>{{ item.readCount }}</text>
  120. </view>
  121. <view class="releaseTime">{{ util.forDate(item.releaseTime,'yyyy-MM-dd HH:mm') }}</view>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. <u-popup :show="show" @close="close()" round="15" mode="center" :closeable="true" :closeOnClickOverlay="false"
  128. :customStyle="{ width: '90%' }">
  129. <view class="ppopup">
  130. <u-divider text="交易订单提醒" textSize="16"></u-divider>
  131. <view class="contents">
  132. <view class="item omit">
  133. <text class="label">商品名称:</text>
  134. <text class="desc">{{ order.goodsNames }}</text>
  135. </view>
  136. <view class="item omit">
  137. <text class="label">数量:</text>
  138. <text class="desc">{{ order.totalWeight }}</text>
  139. </view>
  140. <view class="item omit">
  141. <text class="label">金额:</text>
  142. <text class="desc">¥ {{ order.totalPrice }}</text>
  143. </view>
  144. </view>
  145. <button class="btn" @click="confirm()">去处理</button>
  146. </view>
  147. </u-popup>
  148. <u-popup :show="faceRegister" @close="close()" round="15" mode="center" :closeOnClickOverlay="false"
  149. :customStyle="{ width: '90%' }">
  150. <view class="reflush" @click="checkFace">刷新</view>
  151. <view class="ppopup">
  152. <u-divider text="人脸录入" textSize="16"></u-divider>
  153. <view class="contents">
  154. <view class="item omit">
  155. <text class="label">边民信息:</text>
  156. <text class="desc">{{ user.name }}({{ user.phone }})</text>
  157. </view>
  158. <view style="text-indent: 2rem;line-height: 60rpx;">
  159. 根据相关规定,边民进行互市贸易需要确保为本人实际操作,为了确保后续交易的合规合法话,需要您先录入人脸!</view>
  160. </view>
  161. <button class="btn" @click="go('/pages/face/faceRegister')">马上录入</button>
  162. </view>
  163. </u-popup>
  164. </view>
  165. </template>
  166. <script>
  167. export default {
  168. data() {
  169. return {
  170. keyword: '',
  171. bannerList: [],
  172. newsList: [],
  173. noticeList: ['天保物流APP上线了', '关于天保物流边民互市贸易开通注意事项'],
  174. roleMenu: [],
  175. menuList: [],
  176. count: 0,
  177. show: false,
  178. order: {},
  179. user: {},
  180. faceRegister: false,
  181. cooper_entrust: 2
  182. };
  183. },
  184. onLoad() {
  185. let user = this.getUser();
  186. this.user = user;
  187. this.getBannerList();
  188. this.getNewsList();
  189. this.getMenu();
  190. uni.$on('getMenu', res => {
  191. this.getMenu();
  192. });
  193. },
  194. onShow() {
  195. this.getOrderConfirm();
  196. this.checkFace()
  197. this.keyword = '';
  198. this.getRead();
  199. },
  200. methods: {
  201. close() {
  202. this.show = false;
  203. },
  204. checkFace() {
  205. let user = this.getUser();
  206. if ((user.userType == 1 || user.userType == 2) && user.face == 0) {
  207. this.faceRegister = true;
  208. return;
  209. }
  210. this.faceRegister=false;
  211. this.getOrderConfirm();
  212. },
  213. go(url) {
  214. uni.navigateTo({
  215. url: url
  216. });
  217. },
  218. //获取待处理的订单弹出
  219. getOrderConfirm() {
  220. let user = this.getUser();
  221. if (user.userType > 2) {
  222. return;
  223. }
  224. console.log(user)
  225. // 是否校验互助委托书【1校验 2不校验】
  226. this.http.request({
  227. url: '/sp-admin/SpCfg/cooper',
  228. method: 'POST',
  229. data: { cfgName: 'cooper_entrust_cfg' },
  230. success: res => {
  231. this.cooper_entrust = JSON.parse(res.data.data).cooper_entrust
  232. this.http.request({
  233. url: '/level-one-server/app/TbOrder/getNoConfirmOrder',
  234. data: {cooper_entrust: this.cooper_entrust},
  235. loading: 'false',
  236. success: res => {
  237. if (res.data.data) {
  238. this.order = res.data.data;
  239. this.show = true;
  240. }
  241. }
  242. });
  243. }
  244. })
  245. },
  246. confirm() {
  247. if (this.order.declareType == '1') {
  248. uni.navigateTo({
  249. url: '/pages/market/one/leader/handle?orderId=' + this.order.id
  250. });
  251. } else {
  252. uni.navigateTo({
  253. url: '/pages/market/one/leader/handleThree?orderId=' + this.order.id +
  254. '&peopleConfirmStatus=' + this.order.peopleConfirmStatus + '&cooperEntrustStatus=' +
  255. this.order.cooperEntrustStatus + '&applyConfirmStatus=' + this.order.applyConfirmStatus
  256. });
  257. }
  258. this.show = false;
  259. },
  260. getRead() {
  261. this.http.request({
  262. url: '/sp-admin/app/TbMessage/getRead',
  263. loading: 'false',
  264. success: res => {
  265. if (res.data.data.count > 0) {
  266. this.count = res.data.data.count;
  267. uni.setTabBarBadge({
  268. index: 1,
  269. text: res.data.data.count
  270. });
  271. } else {
  272. this.count = 0;
  273. }
  274. }
  275. });
  276. },
  277. getBannerList() {
  278. this.http.request({
  279. url: '/level-one-server/app/TbBanner/getList',
  280. success: res => {
  281. this.bannerList = res.data.data;
  282. }
  283. });
  284. },
  285. getMenu() {
  286. this.menuList = [];
  287. let menu = uni.getStorageSync('menu');
  288. this.http.request({
  289. url: '/sp-admin/app/AppMenu/getList',
  290. success: res => {
  291. let data = res.data.data;
  292. menu.map((item2, index1) => {
  293. data.map((item1, index) => {
  294. if (parseInt(item1.id) == parseInt(item2)) {
  295. item1.icon = this.http.ngip + item1.icon
  296. this.menuList.push(item1);
  297. }
  298. });
  299. });
  300. this.menuList.sort((a, b) => a.sort - b.sort);
  301. }
  302. });
  303. },
  304. getNewsList() {
  305. this.http.request({
  306. url: '/level-one-server/app/TbPortNews/getNewestList',
  307. data: {
  308. limit: 3
  309. },
  310. success: res => {
  311. this.newsList = res.data.data;
  312. }
  313. });
  314. },
  315. //点击轮播图
  316. click(index) {
  317. uni.navigateTo({
  318. url: '/pages/news/detail?id=8'
  319. });
  320. },
  321. message() {
  322. uni.switchTab({
  323. url: '/pages/message/message'
  324. });
  325. },
  326. search() {
  327. uni.navigateTo({
  328. url: '/pages/news/list?keyword=' + this.keyword
  329. });
  330. },
  331. navTo(url) {
  332. //收购商需要认证才给访问
  333. if (this.getUser().userType == 3 && !this.hasAuth()) {
  334. uni.navigateTo({
  335. url: '/pages/authentication/index'
  336. });
  337. return;
  338. }
  339. uni.navigateTo({
  340. url: url,
  341. fail: res => {
  342. console.log('zx:' + JSON.stringify(res));
  343. uni.showModal({
  344. content: '功能还在开发中',
  345. showCancel: false
  346. });
  347. }
  348. });
  349. },
  350. go(url) {
  351. uni.navigateTo({
  352. url: url
  353. });
  354. }
  355. },
  356. //下拉刷新
  357. onPullDownRefresh() {
  358. setTimeout(() => {
  359. uni.stopPullDownRefresh();
  360. this.getMenu();
  361. }, 1000);
  362. }
  363. };
  364. </script>
  365. <style lang="scss">
  366. page {
  367. background-color: $pg;
  368. }
  369. .top {
  370. width: 100%;
  371. position: relative;
  372. }
  373. .cmain {
  374. padding: 10px 15px 10px 15px;
  375. margin-top: -183px;
  376. position: relative;
  377. .vsearch {
  378. margin-bottom: 13px;
  379. position: relative;
  380. .vse {
  381. width: 82% !important;
  382. }
  383. .icon {
  384. position: absolute;
  385. right: 0px;
  386. top: 0px;
  387. color: white;
  388. font-size: 25px;
  389. top: 5px;
  390. }
  391. .bage {
  392. width: 8px;
  393. height: 8px;
  394. border-radius: 50%;
  395. background-color: #f44336;
  396. top: 0px;
  397. right: 0px;
  398. position: absolute;
  399. }
  400. }
  401. .uni-swiper {
  402. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  403. }
  404. .notice {
  405. margin-top: 10px;
  406. border-radius: 5px !important;
  407. overflow: hidden;
  408. }
  409. .news {
  410. margin-top: 15px;
  411. }
  412. }
  413. .reflush {
  414. width: 60rpx;
  415. height: 60rpx;
  416. float: right;
  417. position: absolute;
  418. right: 20rpx;
  419. padding: 20rpx;
  420. font-size: 24rpx;
  421. }
  422. .ppopup {
  423. padding: 50rpx 30rpx;
  424. .item {
  425. padding: 5px 0px 5px 0px;
  426. color: $font-c;
  427. .label {
  428. width: 70px;
  429. float: left;
  430. text-align: left;
  431. padding-right: 10px;
  432. font-weight: bold;
  433. }
  434. }
  435. }
  436. </style>