index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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. <!--最新资讯-->
  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" :closeable="true" :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. cooper_entrust: 2
  115. };
  116. },
  117. onLoad() {
  118. let user = this.getUser();
  119. this.user = user;
  120. this.getBannerList();
  121. this.getNewsList();
  122. this.getMenu();
  123. uni.$on('getMenu', res => {
  124. this.getMenu();
  125. });
  126. },
  127. onShow() {
  128. this.getOrderConfirm();
  129. this.checkFace()
  130. this.keyword = '';
  131. this.getRead();
  132. },
  133. methods: {
  134. close() {
  135. this.show = false;
  136. },
  137. checkFace() {
  138. let user = this.getUser();
  139. if ((user.userType == 1 || user.userType == 2) && user.face == 0) {
  140. this.faceRegister = true;
  141. return;
  142. }
  143. this.faceRegister=false;
  144. this.getOrderConfirm();
  145. },
  146. go(url) {
  147. uni.navigateTo({
  148. url: url
  149. });
  150. },
  151. //获取待处理的订单弹出
  152. getOrderConfirm() {
  153. let user = this.getUser();
  154. if (user.userType > 2) {
  155. return;
  156. }
  157. console.log(user)
  158. // 是否校验互助委托书【1校验 2不校验】
  159. this.http.request({
  160. url: '/sp-admin/SpCfg/cooper',
  161. method: 'POST',
  162. data: { cfgName: 'cooper_entrust_cfg' },
  163. success: res => {
  164. this.cooper_entrust = JSON.parse(res.data.data).cooper_entrust
  165. this.http.request({
  166. url: '/level-one-server/app/TbOrder/getNoConfirmOrder',
  167. data: {cooper_entrust: this.cooper_entrust},
  168. loading: 'false',
  169. success: res => {
  170. if (res.data.data) {
  171. this.order = res.data.data;
  172. this.show = true;
  173. }
  174. }
  175. });
  176. }
  177. })
  178. },
  179. confirm() {
  180. if (this.order.declareType == '1') {
  181. uni.navigateTo({
  182. url: '/pages/market/one/leader/handle?orderId=' + this.order.id
  183. });
  184. } else {
  185. uni.navigateTo({
  186. url: '/pages/market/one/leader/handleThree?orderId=' + this.order.id +
  187. '&peopleConfirmStatus=' + this.order.peopleConfirmStatus + '&cooperEntrustStatus=' +
  188. this.order.cooperEntrustStatus + '&applyConfirmStatus=' + this.order.applyConfirmStatus
  189. });
  190. }
  191. this.show = false;
  192. },
  193. getRead() {
  194. this.http.request({
  195. url: '/sp-admin/app/TbMessage/getRead',
  196. loading: 'false',
  197. success: res => {
  198. if (res.data.data.count > 0) {
  199. this.count = res.data.data.count;
  200. uni.setTabBarBadge({
  201. index: 1,
  202. text: res.data.data.count
  203. });
  204. } else {
  205. this.count = 0;
  206. }
  207. }
  208. });
  209. },
  210. getBannerList() {
  211. this.http.request({
  212. url: '/level-one-server/app/TbBanner/getList',
  213. success: res => {
  214. this.bannerList = res.data.data;
  215. }
  216. });
  217. },
  218. getMenu() {
  219. this.menuList = [];
  220. let menu = uni.getStorageSync('menu');
  221. this.http.request({
  222. url: '/sp-admin/app/AppMenu/getList',
  223. success: res => {
  224. let data = res.data.data;
  225. menu.map((item2, index1) => {
  226. data.map((item1, index) => {
  227. if (parseInt(item1.id) == parseInt(item2)) {
  228. item1.icon = this.http.ngip + item1.icon
  229. this.menuList.push(item1);
  230. }
  231. });
  232. });
  233. this.menuList.sort((a, b) => a.sort - b.sort);
  234. }
  235. });
  236. },
  237. getNewsList() {
  238. this.http.request({
  239. url: '/level-one-server/app/TbPortNews/getNewestList',
  240. data: {
  241. limit: 3
  242. },
  243. success: res => {
  244. this.newsList = res.data.data;
  245. }
  246. });
  247. },
  248. //点击轮播图
  249. click(index) {
  250. uni.navigateTo({
  251. url: '/pages/news/detail?id=8'
  252. });
  253. },
  254. message() {
  255. uni.switchTab({
  256. url: '/pages/message/message'
  257. });
  258. },
  259. search() {
  260. uni.navigateTo({
  261. url: '/pages/news/list?keyword=' + this.keyword
  262. });
  263. },
  264. navTo(url) {
  265. //收购商需要认证才给访问
  266. if (this.getUser().userType == 3 && !this.hasAuth()) {
  267. uni.navigateTo({
  268. url: '/pages/authentication/index'
  269. });
  270. return;
  271. }
  272. uni.navigateTo({
  273. url: url,
  274. fail: res => {
  275. console.log('zx:' + JSON.stringify(res));
  276. uni.showModal({
  277. content: '功能还在开发中',
  278. showCancel: false
  279. });
  280. }
  281. });
  282. },
  283. go(url) {
  284. uni.navigateTo({
  285. url: url
  286. });
  287. }
  288. },
  289. //下拉刷新
  290. onPullDownRefresh() {
  291. setTimeout(() => {
  292. uni.stopPullDownRefresh();
  293. this.getMenu();
  294. }, 1000);
  295. }
  296. };
  297. </script>
  298. <style lang="scss">
  299. page {
  300. background-color: $pg;
  301. }
  302. .top {
  303. width: 100%;
  304. position: relative;
  305. }
  306. .cmain {
  307. padding: 10px 15px 10px 15px;
  308. margin-top: -183px;
  309. position: relative;
  310. .vsearch {
  311. margin-bottom: 13px;
  312. position: relative;
  313. .vse {
  314. width: 82% !important;
  315. }
  316. .icon {
  317. position: absolute;
  318. right: 0px;
  319. top: 0px;
  320. color: white;
  321. font-size: 25px;
  322. top: 5px;
  323. }
  324. .bage {
  325. width: 8px;
  326. height: 8px;
  327. border-radius: 50%;
  328. background-color: #f44336;
  329. top: 0px;
  330. right: 0px;
  331. position: absolute;
  332. }
  333. }
  334. .uni-swiper {
  335. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  336. }
  337. .notice {
  338. margin-top: 10px;
  339. border-radius: 5px !important;
  340. overflow: hidden;
  341. }
  342. .news {
  343. margin-top: 15px;
  344. }
  345. }
  346. .reflush {
  347. width: 60rpx;
  348. height: 60rpx;
  349. float: right;
  350. position: absolute;
  351. right: 20rpx;
  352. padding: 20rpx;
  353. font-size: 24rpx;
  354. }
  355. .ppopup {
  356. padding: 50rpx 30rpx;
  357. .item {
  358. padding: 5px 0px 5px 0px;
  359. color: $font-c;
  360. .label {
  361. width: 70px;
  362. float: left;
  363. text-align: left;
  364. padding-right: 10px;
  365. font-weight: bold;
  366. }
  367. }
  368. }
  369. </style>