123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819 |
- <template>
- <view>
- <!-- <u-notice-bar :autoplay="autoplay" :playState="playState" :speed="speed" :mode="mode" @click="click"
- :show="show" :type="type" :list="list" :moreIcon="moreIcon" :volumeIcon="volumeIcon" :duration="duration"
- bgColor="" padding="8rpx 24rpx" :isCircular="isCircular"
- style="position: absolute;top: 12%;z-index: 9;width: 100%;"></u-notice-bar> -->
- <!-- 状态栏 -->
- <view class="status" :style="{position:headerPosition,backgroundColor:bgColor}"></view>
- <!-- 漂浮头部 -->
- <view class="header dis a-c j-s" :style="{position:headerPosition,backgroundColor:bgColor}">
- <view class="city dis a-c ">
- <text>{{city}}</text>
- <view class="icon iconfont icon-sanjiao_fill-"></view>
- </view>
- <view class="input dis a-c">
- <view class="icon iconfont icon-saoyisao" @tap="scan"></view>
- <input disabled placeholder="车险" @tap="toSearch()" />
- </view>
- <view class="menu">
- <image mode="aspectFill" :src="avatar"
- @click='isShow?navigate({url:"/pages/realname/realname"}," ",true):""'></image>
- </view>
- </view>
- <!-- 公共组件-每个页面必须引入 -->
- <public-module></public-module>
- <!-- 占位 -->
- <view class="place" :style="{backgroundColor:'#fff'}"></view>
- <!-- 实名认证提示 -->
- <view class="" @click='navigate({url:"/pages/realname/realname"},"navigateTo",true)' v-show="isShow">
- <u-notice-bar :list="list" type="error" padding="8rpx 24rpx"></u-notice-bar>
- </view>
- <!-- 轮播图 -->
- <swiper-image :resdata="swiperList" @changeEvent="swiperChange"></swiper-image>
- <!-- <view class="" @click="arr">
- 321321
- </view> -->
- <!-- 分类轮播 -->
- <index-nav :resdata="categoryList" :row="2"></index-nav>
- <!-- 推荐商品 -->
- <view class="pick" :style="{'background':'#fff'}">
- <view class="box">
- <view class="title">
- <view class="big">推荐商品</view>
- <view class="small">好货推荐 低价精选</view>
- </view>
- <view class="product-list">
- <view v-for="product in pickList" :key="product.goods_id" @tap="toPick(product)">
- <image mode="widthFix" :src="product.img"></image>
- <view class="price">{{product.price}}起</view>
- <view class="slogan">{{product.slogan}}</view>
- </view>
- </view>
- </view>
- </view>
- <!-- 广告横幅 -->
- <view class="banner">
- <image mode="widthFix" src="/static/image/index/ad-img/ad.jpg"></image>
- </view>
- <!-- 商品列表 -->
- <view class="goods-list">
- <view class="title">— 猜你喜欢 —</view>
- <view class="product-list">
- <view class="product" v-for="product in productList" :key="product.goods_id" @tap="toGoods(product)">
- <image mode="widthFix" :src="product.img"></image>
- <view class="name">{{product.name}}</view>
- <view class="info">
- <view class="price">¥{{product.price}} 起</view>
- <view class="slogan">{{product.slogan}}</view>
- </view>
- </view>
- </view>
- <view class="loading-text">{{loadingText}}</view>
- </view>
- </view>
- </template>
- <script>
- import swiperImage from "@/components/modules/index/swiper-image.vue"
- import indexNav from "@/components/modules/index/index-nav.vue"
- import bankBin from "@/common/bankcardinfo.js"
- import store from '@/store';
- import {
- pathToBase64,
- base64ToPath
- } from '@/common/image-tools-base64.js';
- import {
- mapState
- } from "vuex"
- export default {
- components: {
- swiperImage,
- indexNav,
- },
- data() {
- return {
- city: "",
- avatar: "",
- xuelishow: false,
- border: false,
- form: {
- name: "", //姓名
- identity: "", //身份证号
- birthday: "", //出生日期
- addressnow: "", //居住地址
- education: "", //学历
- bankname: "", //开户行
- accountno: "", //银行卡号
- },
- labelPosition: 'left',
- errorType: ['message'],
- rules: {
- name: [{
- required: true,
- message: '请输入姓名',
- trigger: 'blur',
- }, ]
- },
- contentSlot: true,
- showTitle: false,
- asyncClose: false,
- isShow: false,
- autoplay: true,
- type: 'warning',
- list: ['欢迎登录晋掌柜,请点击此处文字进行实名验证,方可使用所有功能。'],
- mode: 'horizontal',
- playState: 'play',
- speed: 160,
- duration: 1000,
- moreIcon: true,
- volumeIcon: true,
- isCircular: true,
- current: 0,
- banben: {},
- bgColor: "#4B75EB",
- //轮播
- swiperList: [],
- //分类
- categoryList: [{
- cat_id: 0,
- img: '/static/image/index/category-img/0.png',
- title: '车险',
- src: '/pages/carInsure2/entry'
- },
- {
- cat_id: 1,
- img: '/static/image/index/category-img/1.png',
- title: '车损测算',
- // src: '/pages/carInsure2/entry'
- },
- {
- cat_id: 2,
- img: '/static/image/index/category-img/2.png',
- title: '道路救援',
- src: '/pages/roadRescue/index'
- },
- {
- cat_id: 3,
- img: '/static/image/index/category-img/3.png',
- title: '司法鉴定',
- src: ''
- },
- {
- cat_id: 4,
- img: '/static/image/index/category-img/4.png',
- title: '掌柜商城',
- src: ''
- },
- {
- cat_id: 5,
- img: '/static/image/index/category-img/5.png',
- title: '洗车',
- src: ''
- },
- {
- cat_id: 6,
- img: '/static/image/index/category-img/6.png',
- title: '审车',
- src: ''
- },
- {
- cat_id: 7,
- img: '/static/image/index/category-img/7.png',
- title: '代驾',
- src: ''
- },
- {
- cat_id: 8,
- img: '/static/image/index/category-img/8.png',
- title: '车检代办',
- src: '/pages/caragent/index'
- },
- {
- cat_id: 9,
- img: '/static/image/index/category-img/9.png',
- title: '一键挪车',
- src: '/pages/ticket/ticket'
- }
- ],
- //推荐商品 3个
- pickList: [{
- goods_id: 0,
- img: '/static/image/index/pick-img/p1.jpg',
- price: '¥5.85',
- slogan: '限时抢购'
- },
- {
- goods_id: 1,
- img: '/static/image/index/pick-img/p2.jpg',
- price: '¥270',
- slogan: '精选商品'
- },
- {
- goods_id: 2,
- img: '/static/image/index/pick-img/p3.jpg',
- price: '¥281',
- slogan: '今日疯抢'
- }
- ],
- //猜你喜欢列表
- productList: [{
- goods_id: 0,
- img: '/static/image/index/img/p1.jpg',
- name: '平安个人意外伤害险',
- price: '25.8',
- slogan: '1235人购买'
- },
- {
- goods_id: 1,
- img: '/static/image/index/img/p2.jpg',
- name: '一年期意外险',
- price: '1.2',
- slogan: '1235人购买'
- },
- {
- goods_id: 2,
- img: '/static/image/index/img/p3.jpg',
- name: '平安行·国内自助游保险',
- price: '88',
- slogan: '1235人购买'
- },
- {
- goods_id: 3,
- img: '/static/image/index/img/p4.jpg',
- name: '企业团体综合意外险',
- price: '1.9',
- slogan: '1235人购买'
- },
- {
- goods_id: 4,
- img: '/static/image/index/img/p5.jpg',
- name: '平安行·境内自驾旅游保险',
- price: '442',
- slogan: '1235人购买'
- },
- {
- goods_id: 5,
- img: '/static/image/index/img/p6.jpg',
- name: '平安行·境内节假日旅游保险',
- price: '257',
- slogan: '1235人购买'
- },
- {
- goods_id: 6,
- img: '/static/image/index/img/p7.jpg',
- name: '平安行·境内高原旅游保险',
- price: '0.2',
- slogan: '1235人购买'
- },
- {
- goods_id: 7,
- img: '/static/image/index/img/p8.jpg',
- name: '儿童综合医疗保险',
- price: '1400',
- slogan: '1235人购买'
- },
- {
- goods_id: 8,
- img: '/static/image/index/img/p9.jpg',
- name: '女性关爱保险',
- price: '70',
- slogan: '1235人付款'
- },
- {
- goods_id: 9,
- img: '/static/image/index/img/p10.jpg',
- name: '全球交通意外保险',
- price: '74.5',
- slogan: '1235人购买'
- }
- ],
- headerPosition: "fixed",
- loadingText: "正在加载...",
- getApplicationStatus: "",
- };
- },
- computed: {
- ...mapState(['userInfo'])
- },
- onPageScroll(e) {
- //兼容iOS端下拉时顶部漂移
- if (e.scrollTop >= 0) {
- this.headerPosition = "fixed";
- } else {
- this.headerPosition = "absolute";
- }
- },
- onShow() {
- if (this.userInfo.sysUser.headSculpture) {
- this.avatar = this.$base.baseUrl + this.userInfo.sysUser.headSculpture;
- } else {
- this.avatar = "/static/image/my/avatar1.png"
- }
- const arr = uni.getStorageSync('historyInfo');
- if (arr) {
- uni.removeStorageSync('historyInfo');
- }
- },
- async onLoad() {
- // uni.startPullDownRefresh();
- this.isShow = this.userInfo.sysUser.status == '2' ? true : false
- let res = await this.$http.get('/apps/getApplicationStatus?jobNumber=' + this.userInfo.sysUser.id);
- if (res.code == 200) {
- if (res.data == '0') {
- this.getApplicationStatus = res.data;
- }
- } else {
- }
- let banner = await this.$http.get('/apps/getCarousel');
- this.swiperList = banner.data;
- this.bgColor = this.swiperList[0].color;
- // #ifdef APP-PLUS
- // this.getCurrentLocation();
- // #endif
- },
- async onPullDownRefresh() {
- let userInfoRes = await this.$http.get('/user/loginUser')
- // let userInfoRes = await this.$http.get('/esmUserInternal/findById?id=' + this.userInfo.sysUser.id, {}, {});
- uni.stopPullDownRefresh();
- store.commit('setUserModules', {
- title: 'userInfo',
- data: {
- sysUser: {
- ...userInfoRes.data
- }
- }
- })
- if (userInfoRes.data.status == 2) {
- this.isShow = true;
- } else {
- this.isShow = false;
- }
- },
- //上拉加载,需要自己在page.json文件中配置"onReachBottomDistance"
- onReachBottom() {
- uni.showLoading({
- mask: true,
- title: "Loading..."
- })
- let len = this.productList.length;
- if (len >= 40) {
- uni.hideLoading()
- this.loadingText = "到底了";
- return false;
- }
- let end_goods_id = this.productList[len - 1].goods_id;
- for (let i = 1; i <= 10; i++) {
- let goods_id = end_goods_id + i;
- let goods_name = this.productList[i - 1].name;
- let goods_price = this.productList[i - 1].price;
- let p = {
- goods_id: goods_id,
- img: '/static/image/index/img/p' + (goods_id % 10 == 0 ? 10 : goods_id % 10) + '.jpg',
- name: goods_name,
- price: goods_price,
- slogan: '1235人购买'
- };
- this.productList.push(p);
- }
- setTimeout(() => {
- uni.hideLoading()
- }, 1000)
- },
- // async onShow() {
- // if (this.userInfo.sysUser.status == '2') {
- // this.show = true;
- // } else {
- // this.show = false;
- // }
- // },
- methods: {
- getCurrentLocation() {
- //获取当前的地理位置
- let vthis = this;
- uni.getLocation({
- type: 'gcj02',
- geocode: true,
- success: function(res) {
- vthis.city = res.address.city;
- // let address = res.address.province + res.address.city + res.address.district + res
- // .address.street + res.address.poiName;
- },
- fail: function(err) {
- console.log(err);
- }
- });
- },
- citySelection() {
- uni.navigateTo({
- url: '/pages/index/cityIndex'
- })
- },
- arr() {
- uni.navigateTo({
- url: '/pages/ad/ad?userId=' + this.userInfo.sysUser.id,
- })
- },
- nameClick() {
- this.navigate({
- url: "/pages/realname/realname"
- }, "navigateTo", true)
- },
- async chooseImage() {
- var _this = this;
- uni.chooseImage({
- count: 1,
- sizeType: "compressed",
- success(res) {
- pathToBase64(res.tempFilePaths[0])
- .then(async base64 => {
- var paramImg = {
- "image": base64, //图片base64
- "imgType": "1" //1身份证 2行驶证
- }
- let res2 = await _this.$http.post('/api/huanong/imgAI', paramImg);
- var data = res2.data.customerInfo;
- data.identifyValidDate = data.identifyValidDate.substr(0, 4) + '-' +
- data.identifyValidDate.substr(4, 2) + "-" + data.identifyValidDate
- .substr(6, 2)
- _this.form.name = data.name;
- _this.form.identifyNumber = data.identifyNumber;
- _this.form.identifyValidDate = data.identifyValidDate;
- })
- }
- });
- },
- // 验证银行卡
- async validateBankCard() {
- var that = this;
- that.bankname = "";
- await bankBin.getBankBin(this.form.name4)
- .then((data) => {
- that.form.name5 = data.bankName;
- return true;
- })
- .catch((err) => {
- return uni.showToast({
- title: err.split(":")[1],
- icon: "none"
- });
- })
- },
- //点击通知
- async click(index) {
- let res1 = await this.$http.get('/apps/getApplicationStatus?jobNumber=' + this.userInfo.sysUser.id);
- if (res1.code == 200) {
- this.getApplicationStatus = res1.data;
- if (this.getApplicationStatus == '0') {
- uni.showToast({
- icon: "none",
- title: '实名认证等待审核中',
- duration: 1500
- })
- } else if (this.getApplicationStatus == '3') {
- uni.showToast({
- icon: "none",
- title: '实名认证不通过,请修改后提交',
- duration: 1500
- })
- setTimeout(() => {
- uni.navigateTo({
- url: '/pages/user/certification'
- })
- }, 1000)
- }
- } else if (res1.code != '200') {
- setTimeout(() => {
- uni.navigateTo({
- url: '/pages/user/infoInput'
- })
- }, 1000)
- }
- if (res1.code == 200) {
- this.getApplicationStatus = res1.data;
- }
- },
- // 改变头部颜色
- swiperChange(event) {
- this.bgColor = this.swiperList[event.detail.current].color;
- },
- //扫一扫
- scan() {
- uni.scanCode({
- success: async (res) => {
- let uuid = this.getParameterByName("uuid", res.result)
- let resCode = await this.$http.get('/scanQrCode?uuid=' + uuid);
- }
- });
- },
- //搜索跳转
- toSearch() {
- // uni.showToast({title: "建议跳转到新页面做搜索功能"});
- },
- //推荐商品跳转
- toPick(e) {
- // uni.showToast({title: '推荐商品'+e.goods_id});
- },
- //商品跳转
- toGoods(e) {
- // uni.showToast({title: '商品'+e.goods_id});
- },
- getParameterByName(name, url) {
- if (!url) url = window.location.href;
- name = name.replace(/[\[\]]/g, '\\$&');
- var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
- results = regex.exec(url);
- if (!results) return null;
- if (!results[2]) return '';
- return decodeURIComponent(results[2].replace(/\+/g, ' '));
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .status {
- width: 100%;
- height: 0;
- /* #ifdef APP-PLUS */
- height: var(--status-bar-height);
- /* #endif */
- position: fixed;
- top: 0;
- z-index: 999;
- }
- .header {
- width: 100%;
- height: 100upx;
- display: flex;
- position: fixed;
- top: 0;
- /* #ifdef APP-PLUS */
- top: var(--status-bar-height);
- /* #endif */
- z-index: 996;
- padding: 0 10px;
- }
- .header .city {
- color: #fff;
- font-size: 15px;
- .icon {
- font-size: 10px;
- margin-left: 5px;
- }
- }
- .header .input {
- width: 70%;
- background-color: #fff;
- border-radius: 30px;
- height: 30px;
- padding: 10px;
- box-sizing: border-box;
- }
- .header .input input {
- // width: calc(100% - 150px);
- // height: 60upx;
- // background-color: #ffffff;
- // border-radius: 60upx;
- // padding-left: 60upx;
- // font-size: 30upx;
- }
- .header .input .icon {
- color: #a18090;
- font-size: 18px;
- margin-right: 10px;
- }
- .header .menu {
- background-color: #FFFFFF;
- border-radius: 50%;
- box-sizing: border-box;
- width: 30px;
- height: 30px;
- padding: 3px;
- box-sizing: border-box;
- }
- .header .menu image {
- width: 100%;
- height: 100%;
- border-radius: 50%;
- }
- /* 占位 */
- .place {
- /* #ifdef APP-PLUS */
- margin-top: var(--status-bar-height);
- /* #endif */
- height: 100upx;
- }
- .pick {
- padding: 0 2.5vw 2.5vw 2.5vw;
- }
- .pick .box {
- width: 100%;
- border-radius: 20upx;
- background-color: #ffffff;
- }
- .pick .box .title {
- display: flex;
- justify-content: flex-start;
- align-items: flex-end;
- height: 60upx;
- border-bottom: solid 1upx #eee;
- padding-bottom: 10upx;
- }
- .pick .box .title .big {
- font-size: 34upx;
- padding-left: 20upx;
- color: #46434f;
- }
- .pick .box .title .small {
- font-size: 24upx;
- padding-left: 20upx;
- color: #827f8b;
- }
- .pick .box .product-list {
- padding-top: 15upx;
- box-sizing: border-box;
- overflow: hidden;
- }
- .pick .box .product-list>view {
- background-color: #f8f8f8;
- display: inline-block;
- width: calc(50% - 10upx);
- position: relative;
- box-sizing: border-box;
- margin: 5upx;
- float: left;
- }
- .pick .box .product-list>view:nth-child(1) {
- height: 390upx;
- }
- .pick .box .product-list>view:nth-child(2),
- .pick .box .product-list>view:nth-child(3) {
- height: 190upx;
- }
- .pick .box .product-list>view:nth-child(1) .price {
- color: #e65339;
- font-size: 26upx;
- position: absolute;
- bottom: 6upx;
- left: 8upx;
- }
- .pick .box .product-list>view:nth-child(1) .slogan {
- color: #807c87;
- font-size: 26upx;
- position: absolute;
- bottom: 6upx;
- right: 15upx;
- }
- .pick .box .product-list>view:nth-child(1) image {
- width: 100%;
- height: 350upx !important;
- padding: 15upx;
- box-sizing: border-box;
- margin-bottom: 40upx;
- }
- .pick .box .product-list>view:nth-child(2),
- .pick .box .product-list>view:nth-child(3) {
- padding: 10upx;
- box-sizing: border-box;
- }
- .pick .box .product-list>view:nth-child(2) image,
- .pick .box .product-list>view:nth-child(3) image {
- width: calc(50% - 5upx);
- height: 170upx !important;
- }
- .pick .box .product-list>view:nth-child(2) .price,
- .pick .box .product-list>view:nth-child(3) .price {
- position: absolute;
- top: 25%;
- left: 55%;
- color: #e65339;
- font-size: 30upx;
- }
- .pick .box .product-list>view:nth-child(2) .slogan,
- .pick .box .product-list>view:nth-child(3) .slogan {
- position: absolute;
- top: 60%;
- left: 55%;
- color: #807c87;
- font-size: 26upx;
- }
- .banner image {
- width: 100%;
- }
- .goods-list {
- background-color: #f4f4f4;
- }
- .goods-list .title {
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 60upx;
- color: #979797;
- font-size: 24upx;
- }
- .goods-list .loading-text {
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 60upx;
- color: #979797;
- font-size: 24upx;
- }
- .goods-list .product-list {
- padding: 0 2.5% 2.5vw 2.5%;
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- }
- .goods-list .product-list .product {
- width: 48.75%;
- border-radius: 20upx;
- background-color: #fff;
- margin: 0 0 15upx 0;
- }
- .goods-list .product-list .product image {
- width: 100%;
- border-radius: 20upx 20upx 0 0;
- }
- .goods-list .product-list .product .name {
- width: 92%;
- padding: 10upx 4%;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
- text-align: justify;
- overflow: hidden;
- font-size: 30upx;
- }
- .goods-list .product-list .product .info {
- display: flex;
- justify-content: space-between;
- align-items: flex-end;
- width: 92%;
- padding: 10upx 4% 10upx 4%;
- }
- .goods-list .product-list .product .info .price {
- color: #e65339;
- font-size: 30upx;
- font-weight: 600;
- }
- .goods-list .product-list .product .info .slogan {
- color: #807c87;
- font-size: 24upx;
- }
- </style>
|