123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517 |
- <template>
- <view>
- <image src="../../static/images/my.png" mode="widthFix" class="top"></image>
- <view class="cmain">
- <view class="vsearch">
- <view class="vse">
- <u-search placeholder="搜索资讯" v-model="keyword" @search="search" :actionStyle="{ color: 'white' }"
- :animation="true" actionText="取消"></u-search>
- </view>
- <view class="icon" @click="message()"></view>
- <view class="bage" v-if="count > 0"></view>
- </view>
- <!--轮播图-->
- <u-swiper circular :radius="5" :indicator="true" keyName="image" :list="bannerList" :height="110"
- class="uni-swiper" @click="click"></u-swiper>
- <!--通知公告-->
- <view class="notice">
- <u-notice-bar color="#848484" :text="noticeList" :step="true" direction="column" mode="link"
- bgColor="white" speed="300" url="/pages/news/list"></u-notice-bar>
- </view>
- <!--菜单-->
- <view class="menu">
- <view class="msn" v-for="(item, index) in menuList" :key="index" @click="navTo(item.path)">
- <view class="out">
- <view class="int">
- <image :src="item.icon" mode="widthFix"
- style="max-width: 54px; max-height: 52px; object-fit: contain;"></image>
- <view class="tit">{{ item.menuName }}</view>
- </view>
- </view>
- </view>
- <view class="clear"></view>
- </view>
- <!--最新资讯-->
- <view class="news">
- <view class="vlabel">
- <view class="tag"></view>
- <text class="title">最新资讯</text>
- <text class="more" @click="navTo('/pages/news/list')">
- <text>更多</text>
- <text class="icon"></text>
- </text>
- </view>
- <view class="list animated fadeInDown">
- <view class="news_item" v-for="(item, index) in newsList" :key="index"
- @click="go('/pages/news/detail?id=' + item.id)">
- <image :src="item.cover" mode="aspectFill" class="img" v-if="item.cover"></image>
- <view class="con">
- <view class="title ellip">{{ item.title }}</view>
- <view class="source omit">
- <text class="icon"></text>
- <text>{{ item.readCount }}</text>
- </view>
- <view class="releaseTime">{{item.releaseTime}}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <u-popup :show="show" @close="close()" round="15" mode="center" :closeable="false" :closeOnClickOverlay="false"
- :customStyle="{ width: '90%' }">
- <view class="ppopup">
- <u-divider text="交易订单提醒" textSize="16"></u-divider>
- <view class="contents">
- <view class="item omit">
- <text class="label">商品名称:</text>
- <text class="desc">{{ order.goodsNames }}</text>
- </view>
- <view class="item omit">
- <text class="label">数量:</text>
- <text class="desc">{{ order.totalWeight }}</text>
- </view>
- <view class="item omit">
- <text class="label">金额:</text>
- <text class="desc">¥ {{ order.totalPrice }}</text>
- </view>
- </view>
- <button class="btn" @click="confirm()">去处理</button>
- </view>
- </u-popup>
- <u-popup :show="faceRegister" @close="close()" round="15" mode="center" :closeable="false"
- :closeOnClickOverlay="false" :customStyle="{ width: '90%' }">
- <view class="reflush" @click="checkFace">刷新</view>
- <view class="ppopup">
- <u-divider text="人脸录入" textSize="16"></u-divider>
- <view class="contents">
- <view class="item omit">
- <text class="label">边民信息:</text>
- <text class="desc">{{ user.name }}({{ user.phone }})</text>
- </view>
- <view style="text-indent: 2rem;line-height: 60rpx;">
- 根据相关规定,边民进行互市贸易需要确保为本人实际操作,为了确保后续交易的合规合法化,需要您先录入人脸!</view>
- </view>
- <button class="btn" @click="go('/pages/face/faceRegister')">马上录入</button>
- </view>
- </u-popup>
- <u-popup :show="purchaser" round="15" mode="center" :closeable="false" :closeOnClickOverlay="false"
- :customStyle="{ width: '90%' }">
- <view class="reflush" @click="getTbPurchaserAuth()">刷新</view>
- <view class="ppopup">
- <u-divider text="提醒" textSize="16"></u-divider>
- <view class="contents">
- <view style="text-indent: 2rem;line-height: 60rpx;">
- 您的资料不完善或正在审核中,请前往补充或者等待管理员审核!</view>
- </view>
- <button class="btn" @click="go('/pages/authentication/index')">前往查看</button>
- </view>
- </u-popup>
- <u-popup :show="update.visible" round="15" mode="center" :closeable="false" :closeOnClickOverlay="false"
- :customStyle="{ width: '90%' }">
- <view class="ppopup">
- <u-divider text="有新版本更新!" textSize="16"></u-divider>
- <view class="contents">
- <view style="text-indent: 2rem;line-height: 60rpx;">
- 更新内容:{{update.content}}
- </view>
- <view style="text-indent: 2rem;line-height: 60rpx;">
- 当前版本号:{{update.currentVersion}}
- </view>
- <view style="text-indent: 2rem;line-height: 60rpx;">
- 新版本号:{{update.version}}
- </view>
- </view>
- <button class="btn" @click="updateApk">立即更新</button>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- keyword: '',
- bannerList: [],
- newsList: [],
- noticeList: [],
- roleMenu: [],
- menuList: [],
- count: 0,
- show: false,
- order: {},
- user: {},
- faceRegister: false,
- cooper_entrust: 2,
- purchaser: false,
- update: {
- visible: false,
- currentVersion: '',
- version: '',
- content: '',
- url: ''
- }
- };
- },
- onLoad() {
- uni.hideLoading()
- uni.$on('getMenu', res => {
- this.getMenu();
- });
- },
- onShow() {
- this.keyword = '';
- let user = uni.getStorageSync('info');
- this.user = user;
- this.checkFace()
- this.getRead();
- this.getUpdateInfo();
- this.getBannerList();
- this.getNewsList();
- this.getMenu();
- },
- methods: {
- getUpdateInfo() {
- let currentVersion = uni.getAppBaseInfo().appVersion;
- this.update.visible=false;
- this.http.request({
- url: '/sp-admin/app/updateInfo',
- loading: 'false',
- success: resp => {
- if(resp.data.data){
- let version = resp.data.data.version;
- this.update = {
- visible: currentVersion != version,
- currentVersion: currentVersion,
- content: resp.data.data.content,
- version: version,
- url: resp.data.data.url
- };
- }
- }
- })
- },
- updateApk() {
- plus.runtime.openURL(this.update.url)
- return;
- var dtask = plus.downloader.createDownload(
- this.update.url, {
- force: true
- }, (d, status) => {
- if (status == 200) {
- console.log("下载成功安装: " + d.filename);
- plus.runtime.install(d.filename)
- } else {
- plus.nativeUI.alert("安装失败,请稍候重试: " + status)
- }
- });
- dtask.start();
- },
- close() {
- this.show = false;
- },
- checkFace() {
- let user = this.user;
- this.faceRegister = false;
- if ((user.userType == 1 || user.userType == 2)) {
- this.http.request({
- url:'/sp-admin/app/AppUser/getAuth',
- success:resp=>{
- let res=resp.data.data;
- this.user.name=res.name;
- this.user.phone=res.phone;
- this.user.face=res.face;
- this.faceRegister=res.face==0;
- if(res.face==1){
- this.getOrderConfirm();
- }
- }
- })
- return;
- } else if (user.userType == 3) {
- this.getTbPurchaserAuth()
- }
- },
- go(url) {
- uni.navigateTo({
- url: url
- });
- },
- getTbPurchaserAuth() {
- this.purchaser = false;
- this.http.request({
- url: '/level-two-server/app/TbPurchaser/info',
- loading: 'false',
- success: res => {
- let resp = res.data;
- if (!resp.data || resp.data.judgeStatus == 2) {
- this.purchaser = true;
- return;
- }
- }
- })
- },
- //获取待处理的订单弹出
- getOrderConfirm() {
- let user = this.getUser();
- if (user.userType > 2) {
- return;
- }
- // 是否校验互助委托书【1校验 2不校验】
- this.http.request({
- url: '/sp-admin/SpCfg/cooper',
- method: 'POST',
- data: {
- cfgName: 'cooper_entrust_cfg'
- },
- success: res => {
- this.cooper_entrust = JSON.parse(res.data.data).cooper_entrust
- this.http.request({
- url: '/level-one-server/app/TbOrder/getNoConfirmOrder',
- data: {
- cooper_entrust: this.cooper_entrust
- },
- loading: 'false',
- success: res => {
- if (res.data.data) {
- this.order = res.data.data;
- this.show = true;
- }
- }
- });
- }
- })
- },
- confirm() {
- if (this.order.declareType == '1') {
- uni.navigateTo({
- url: '/pages/market/one/leader/handle?orderId=' + this.order.id + '&peopleConfirmStatus=' +
- this.order.peopleConfirmStatus + '&applyConfirmStatus=' + this.order.applyConfirmStatus
- });
- } else {
- uni.navigateTo({
- url: '/pages/market/one/leader/handleThree?orderId=' + this.order.id +
- '&peopleConfirmStatus=' + this.order.peopleConfirmStatus + '&cooperEntrustStatus=' +
- this.order.cooperEntrustStatus + '&applyConfirmStatus=' + this.order.applyConfirmStatus
- });
- }
- this.show = false;
- },
- getRead() {
- this.http.request({
- url: '/sp-admin/app/TbMessage/getRead',
- loading: 'false',
- success: res => {
- if (res.data.data.count > 0) {
- this.count = res.data.data.count;
- uni.setTabBarBadge({
- index: 1,
- text: res.data.data.count
- });
- } else {
- this.count = 0;
- }
- }
- });
- },
- getBannerList() {
- this.http.request({
- url: '/level-one-server/app/TbBanner/getList',
- success: res => {
- this.bannerList = res.data.data;
- }
- });
- },
- getMenu() {
- this.menuList = [];
- let menu = uni.getStorageSync('menu');
- this.http.request({
- url: '/sp-admin/app/AppMenu/getList',
- data: {
- pageNo: 1,
- pageSize: 50
- },
- success: res => {
- let data = res.data.data;
- menu.map((item2, index1) => {
- data.map((item1, index) => {
- if (parseInt(item1.id) == parseInt(item2)) {
- item1.icon = item1.icon
- this.menuList.push(item1);
- }
- });
- });
- this.menuList.sort((a, b) => a.sort - b.sort);
- }
- });
- },
- getNewsList() {
- this.http.request({
- url: '/level-one-server/app/TbPortNews/getNewestList',
- data: {
- limit: 3
- },
- success: res => {
- let list = res.data.data;
- this.newsList = res.data.data;
- this.noticeList = list?list.map(obj => obj.title):[];
- }
- });
- },
- getUserWallet() {
- if(this.user.userType===1){
- this.http.request({
- url: '/level-one-server/app/TbPeople/getById',
- data: { id: this.user.fkId },
- success: res => {
- this.user.wallet = res.data.data.wallet;
- uni.setStorageSync('info', this.user);
- }
- });
- }
- },
- //点击轮播图
- click(index) {
- let item = this.bannerList[index];
- let url = item.url;
- if (url) {
- // #ifdef APP-PLUS
- plus.runtime.openURL(url) //这里默认使用外部浏览器打开而不是内部web-view组件打开
- // #endif
- // #ifdef H5
- window.open(url)
- // #endif
- }
- },
- message() {
- uni.switchTab({
- url: '/pages/message/message'
- });
- },
- search() {
- uni.navigateTo({
- url: '/pages/news/list?keyword=' + this.keyword
- });
- },
- navTo(url) {
- //收购商需要认证才给访问
- if (this.getUser().userType == 3 && !this.hasAuth()) {
- uni.navigateTo({
- url: '/pages/authentication/index'
- });
- return;
- }
- uni.navigateTo({
- url: url,
- fail: res => {
- uni.showModal({
- content: '功能还在开发中',
- showCancel: false
- });
- }
- });
- },
- go(url) {
- uni.navigateTo({
- url: url
- });
- }
- },
- //下拉刷新
- onPullDownRefresh() {
- setTimeout(() => {
- uni.stopPullDownRefresh();
- this.getMenu();
- }, 1000);
- }
- };
- </script>
- <style lang="scss">
- page {
- background-color: $pg;
- }
- .top {
- width: 100%;
- position: relative;
- }
- .cmain {
- padding: 10px 15px 10px 15px;
- margin-top: -183px;
- position: relative;
- .vsearch {
- margin-bottom: 13px;
- position: relative;
- .vse {
- width: 82% !important;
- }
- .icon {
- position: absolute;
- right: 0px;
- top: 0px;
- color: white;
- font-size: 25px;
- top: 5px;
- }
- .bage {
- width: 8px;
- height: 8px;
- border-radius: 50%;
- background-color: #f44336;
- top: 0px;
- right: 0px;
- position: absolute;
- }
- }
- .uni-swiper {
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
- }
- .notice {
- margin-top: 10px;
- border-radius: 5px !important;
- overflow: hidden;
- }
- .news {
- margin-top: 15px;
- }
- }
- .reflush {
- width: 60rpx;
- height: 60rpx;
- float: right;
- position: absolute;
- right: 20rpx;
- padding: 20rpx;
- font-size: 24rpx;
- }
- .ppopup {
- padding: 50rpx 30rpx;
- .item {
- padding: 5px 0px 5px 0px;
- color: $font-c;
- .label {
- width: 70px;
- float: left;
- text-align: left;
- padding-right: 10px;
- font-weight: bold;
- }
- }
- }
- </style>
|