| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564 |
- <template>
- <view class="container">
- <view class="status_bar"></view>
- <!-- 轮播图 start -->
- <swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
- <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
- @click="bannerNavToUrl(item)">
- <image :src="item.pic" />
- </swiper-item>
- </swiper>
- <!-- 轮播图 end -->
- <!-- 认证提示 statr-->
- <view class="rznow flex" v-if="userInfo && userInfo.is_real == 0">
- <view class="rztit">
- 您尚未完成身份认证,前往认证>>
- </view>
- <view class="rzbtn" @click="navTo('/pages/shop/attestation')">
- 立即认证
- </view>
- </view>
- <!-- 认证提示 ed-->
- <!-- 功能区 start-->
- <view class="gn-wrap flex">
- <view class="gn-icon flex">
- <image src="../../static/icon/in1.png" mode="heightFix"></image>
- </view>
- <view class="gn-tit">
- <view class="">
- 租电
- </view>
- <view class="tit-jj">
- 信用免押
- </view>
- </view>
- <view class="gn-btn" @click="navTo('/pages/shop/rent',1)">
- 立即租电
- </view>
- </view>
- <view class="gn-wrap flex">
- <view class="gn-icon flex">
- <image src="../../static/icon/in2.png" mode="heightFix"></image>
- </view>
- <view class="gn-tit">
- <view class="">
- 租车
- </view>
- <view class="tit-jj">
- 信用免押
- </view>
- </view>
- <view class="gn-btn" @click="navTo('/pages/shop/accessory')">
- 立即租车
- </view>
- </view>
- <!-- 功能区 ed-->
- <!-- 附近门店 start -->
- <view class="fjmd" @click="navTo('/pages/shop/shopTab')">
- <image src="../../static/img/md.png" mode=""></image>
- </view>
- <!-- 附近门店 end -->
- <!-- 使用攻略 start -->
- <view class="sygl">
- <view class="sy-top">
- <image src="../../static/icon/gl-top.png" mode=""></image>
- <view class="top-tit">
- 使用攻略
- </view>
- </view>
- <view class="sy-content flex">
- <view class="content-item flex">
- <image src="../../static/icon/sy1.png" mode="" class="sy-icon"></image>
- <view class="">
- 注册账号
- </view>
- </view>
- <image src="../../static/icon/jt.png" mode="" class="jt"></image>
- <view class="content-item flex">
- <image src="../../static/icon/sy2.png" mode="" class="sy-icon"></image>
- <view class="">
- 实名认证
- </view>
- </view>
- <image src="../../static/icon/jt.png" mode="" class="jt"></image>
- <view class="content-item flex">
- <image src="../../static/icon/sy3.png" mode="" class="sy-icon"></image>
- <view class="">
- 租电/租车
- </view>
- </view>
- <image src="../../static/icon/jt.png" mode="" class="jt"></image>
- <view class="content-item flex">
- <image src="../../static/icon/sy4.png" mode="" class="sy-icon"></image>
- <view class="">
- 开始使用
- </view>
- </view>
- </view>
- </view>
- <!-- 使用攻略 ed-->
- </view>
- </template>
- <script>
- // #ifdef MP-WEIXIN
- import {
- openMap
- } from '@/utils/rocessor.js';
- // #endif
- import {
- saveUrl,
- interceptor
- } from '@/utils/loginUtils.js';
- import {
- loadIndexs
- } from '@/api/index.js'
- import {
- mapState,
- mapMutations
- } from "vuex"
- export default {
- data() {
- return {
- carouselList: [], //轮播图
- };
- },
- computed: {
- ...mapState('user', ['userInfo', 'hasLogin']),
- },
- // 切换或显示后变动tabbar颜色
- onHide() {
- },
- onLoad: function(option) {
- // #ifndef MP
- if (option.spread) {
- // 存储其他邀请人
- uni.setStorageSync('spread', option.spread);
- }
- // #endif
- // #ifdef MP
- if (option.scene) {
- // 存储小程序邀请人
- uni.setStorage({
- key: 'spread_code',
- data: option.scene
- });
- }
- // #endif
- // 获取定位数据
- this.getlocation();
- },
- onShow() {
- this.getIndex()
- },
- onReady() {
- },
- // #ifdef MP
- onShareAppMessage(options) {
- // 设置菜单中的转发按钮触发转发事件时的转发内容
- let pages = getCurrentPages(); //获取加载的页面
- let currentPage = pages[pages.length - 1]; //获取当前页面的对象
- let url = currentPage.route; //当前页面url
- let item = currentPage.options; //如果要获取url中所带的参数可以查看options
- let shareObj = {
- title: '租电', // 默认是小程序的名称(可以写slogan等)
- path: url, // 默认是当前页面,必须是以‘/’开头的完整路径
- imageUrl: '',
- desc: '',
- success: function(res) {
- // 转发成功之后的回调
- if (res.errMsg == 'shareAppMessage:ok') {}
- },
- fail: function() {
- // 转发失败之后的回调
- if (res.errMsg == 'shareAppMessage:fail cancel') {
- // 用户取消转发
- } else if (res.errMsg == 'shareAppMessage:fail') {
- // 转发失败,其中 detail message 为详细失败信息
- }
- }
- };
- // 判断是否可以邀请
- // if (this.userInfo.uid) {
- // shareObj.path += '&spread=' + this.userInfo.uid;
- // }
- return shareObj;
- },
- // #endif
- methods: {
- ...mapMutations('user',['setAddress']),
- getIndex() {
- loadIndexs().then(res => {
- this.carouselList = res.data.banner
- })
- },
- navTo(url, ind = 0) {
- if (ind == 1) {
- if (!this.hasLogin) {
- // 保存地址
- saveUrl();
- // 登录拦截
- interceptor();
- } else {
- if (this.userInfo.is_real == 1) {
- if(this.userInfo.payRules) {
- uni.showModal({
- title: '温馨提醒',
- content:'您已支付相同金额订单,请确认是否重新下单?',
- complete(res) {
- if(res.confirm) {
- uni.navigateTo({
- url,
- fail(e) {
- console.log(e);
- }
- });
- }
- }
- })
- }else {
- uni.navigateTo({
- url,
- fail(e) {
- console.log(e);
- }
- });
- }
-
- } else {
- uni.showModal({
- title: '提示',
- content: '您当前未进行实名认证,是否立即实名认证?',
- complete(res) {
- if (res.confirm) {
- uni.navigateTo({
- url: '/pages/shop/attestation'
- })
- }
- }
- })
- }
- }
- } else {
- if (url.indexOf('http') != -1) {
- window.location.href = url
- } else {
- uni.navigateTo({
- url,
- fail() {
- uni.switchTab({
- url
- })
- }
- })
- }
- }
- },
- // 获取经纬度
- getlocation() {
- let obj = this;
- // #ifdef H5 || APP
- uni.getLocation({
- type: 'gcj02',
- success(e) {
- obj.getlocationSetInit(e)
- },
- fail(e) {
- if(e.errCode==22){
- uni.showModal({
- title: '定位开启错误',
- content: '请查看是否已经开启定位服务',
- showCancel: false,
- });
- }
- console.log(e, 'cw');
- }
- })
- // #endif
- // #ifdef MP-WEIXIN
- openMap().then((e) => {
- console.log("授权");
- wx.getLocation({
- type: 'gcj02',
- success: (e) => {
- console.log(e);
- // 调用鉴定位置变化事件
- this.getlocationSetInit(e)
- },
- fail() {
- }
- })
- })
- // #endif
- },
- // 获取经纬度完毕后回调处理
- getlocationSetInit(data) {
- const obj = this;
- try {
- console.log(data, '位置数据');
- // 保存当前经纬度
- obj.setAddress({
- latitude: data.latitude,
- longitude: data.longitude
- })
- } catch (e) {
- console.log(e, 'cww');
- }
- },
- }
- };
- </script>
- <style lang="scss">
- page {
- background: #ffff;
- min-height: 100%;
- height: auto;
- }
- // 顶部搜索
- .top-search {
- height: 80rpx;
- padding: 0 20rpx;
- background-color: #fff;
- .top-logo {
- width: 50rpx;
- // height: 50rpx;
- margin-right: 10rpx;
- image {
- width: 48rpx;
- }
- }
- .search-box {
- justify-content: center;
- width: 698rpx;
- height: 60rpx;
- background: #EEEEEE;
- // box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
- border-radius: 30rpx;
- .search {
- width: 34rpx;
- height: 34rpx;
- }
- .search-font {
- margin-left: 14rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #CBCBCB;
- }
- }
- }
- // 顶部轮播图
- .top-swiper {
- width: 750rpx;
- height: 473rpx;
- // margin: 20rpx 0 0;
- image {
- width: 750rpx;
- height: 473rpx;
- }
- }
- .jg {
- height: 20rpx;
- background: #F8F8F8;
- }
- // 分类
- .cate-section {
- justify-content: space-around;
- background-color: #fff;
- padding: 0rpx 0 30rpx;
- .cate-item {
- flex-grow: 0;
- width: 20%;
- flex-direction: column;
- text-align: center;
- align-items: center;
- justify-content: center;
- .img-wrapper {
- width: 112rpx;
- height: 112rpx;
- border-radius: 20rpx;
- position: relative;
- image {
- width: 112rpx;
- height: 112rpx;
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- }
- }
- .item-title {
- margin-top: 15rpx;
- font-size: 26rpx;
- font-weight: 500;
- color: #666666;
- }
- }
- }
- .rznow {
- font-weight: 500;
- font-size: 26rpx;
- color: #FFFFFF;
- background-color: #78797a;
- height: 74rpx;
- padding: 0 42rpx 0 52rpx;
- .rztit {
- line-height: 74rpx;
- }
- .rzbtn {
- width: 127rpx;
- height: 47rpx;
- text-align: center;
- line-height: 47rpx;
- background: #35d9b7;
- border-radius: 24rpx;
- font-size: 22rpx;
- }
- }
- .gn-wrap {
- margin: 45rpx auto;
- width: 670rpx;
- height: 219rpx;
- background: #FFFFFF;
- box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
- border-radius: 30rpx;
- padding-right: 47rpx;
- .gn-icon {
- flex-shrink: 0;
- width: 210rpx;
- height: 100%;
- justify-content: center;
- image {
- height: 112rpx;
- }
- }
- .gn-tit {
- flex-grow: 1;
- font-weight: bold;
- color: #333333;
- font-size: 36rpx;
- flex-direction: column;
- justify-content: center;
- align-items: flex-start;
- .tit-jj {
- font-size: 25rpx;
- font-weight: 500;
- color: #666666;
- padding-top: 32rpx;
- }
- }
- .gn-btn {
- flex-shrink: 0;
- width: 127rpx;
- border: 1px solid $base-color;
- border-radius: 28rpx;
- font-size: 25rpx;
- font-weight: 500;
- color: $base-color;
- line-height: 55rpx;
- text-align: center;
- }
- }
- .fjmd {
- width: 708rpx;
- height: 233rpx;
- margin: 20rpx auto;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .sygl {
- .sy-top {
- position: relative;
- height: 100rpx;
- image {
- width: 369rpx;
- height: 8rpx;
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- margin: auto;
- }
- .top-tit {
- font-size: 32rpx;
- font-weight: bold;
- color: #4A2723;
- text-align: center;
- line-height: 100rpx;
- }
- }
- .sy-content {
- padding: 0 10rpx 65rpx;
- .content-item {
- flex-grow: 1;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- font-size: 22rpx;
- font-weight: 500;
- color: #4A2723;
- }
- .sy-icon {
- width: 90rpx;
- height: 90rpx;
- margin-bottom: 15rpx;
- }
- .jt {
- flex-shrink: 0;
- width: 14rpx;
- height: 15rpx;
- margin-top: 40rpx;
- align-self: flex-start;
- }
- }
- }
- </style>
|