1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114 |
- <template>
- <view>
- <view class="content" :class="hasShopiing?'bg-1':'bg-0'">
- <!-- 头部栏 -->
- <view class="header-box">
- <UniStatusBar></UniStatusBar>
- <view class="title flex align_center" :style="{height:(navHeight+'px')}">
- <u-image src="/static/logo-h.png" width="349" height='40'></u-image>
- <!-- 版本提示 -->
- <text class="version" v-if="showVersion">体验版</text>
- </view>
- </view>
- <view class="cbody">
- <view :class="hasShopiing?'shopping bg-blue':'body-box bg-blue'">
- <!-- 滚动区域 -->
- <view class="scroll-list" v-if="!hasShopiing">
- <scrollBox v-if="list.length&&!hasRedPacket" :list="list"></scrollBox>
- <scrollBox v-if="slist.length&&hasRedPacket" :list="slist"></scrollBox>
- </view>
- <!-- 保证金 -->
- <view class="notices flex align_center" v-if="bondRecord" @click="toPayBondAmount">
- <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 您有一笔保证金待支付 ¥{{bondRecord.bondAmount}}</view>
- <!-- <text class="text">立即支付>></text> -->
- </view>
- <!-- 待取货提醒 -->
- <view class="notices flex align_center" v-if="!bondRecord&&orderTodo" @click="toOrder">
- <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 您有待取货的货架订单哦!</view> <text class="text">立即处理>></text>
- </view>
- <!-- 门店审核不通过 -->
- <view class="notices flex justify_between" v-if="storeApply&&storeApply.auditStatus=='REFUSE'&&storeApply.readFlag=='0'">
- <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 门店认证资料审核不通过,请重新提交审核!</view> <text class="text" @click="toKnow">知道了</text>
- </view>
- <!-- 名片 -->
- <view class="userCard flex align_center justify_between" v-if="!hasShopiing">
- <view class="userCard-info flex align_center">
- <view>
- <u-image shape='circle' v-if="!hasLogin" src="/static/def_personal_avatar.png" width="90" height="90"></u-image>
- <u-image shape='circle' v-else :src="avatarUrl||'/static/def_personal_avatar.png'" width="90" height="90"></u-image>
- </view>
- <view class="user-info" @click="toUser">
- <view v-if="!hasLogin" style="font-size: 40rpx;">
- 请点击登录
- </view>
- <view v-else>
- <view class="user-name">{{userInfo.userNameCN || userInfo.mobile}}</view>
- <view v-if="hasLogin&&userInfo&&userInfo.sysUserFlag == '0'">
- <u-tag text="个人用户" mode="dark" type="warning" shape="circle" size="mini" />
- </view>
- <view v-else>{{userInfo.orgName}}</view>
- </view>
- </view>
- </view>
- <view @click="toUser">
- <text v-if="hasLogin&&userInfo&&userInfo.sysUserFlag == '0'" class="user-rz">
- {{storeApply&&storeApply.auditStatus=='WAIT'?'认证门店审核中':'认证成为门店'}}
- </text>
- <u-icon name="arrow-right"></u-icon>
- </view>
- </view>
- <!-- 搜索 -->
- <view class="search-head" v-if="hasShopiing">
- <uni-search-bar radius="100" placeholder="请输入商品名称/产品编码/原厂编码" clearButton="auto" cancelButton="none" @confirm="toSearch"/>
- </view>
- </view>
- <view :class="hasShopiing?'body-box1':'body-box'">
- <!-- 扫描按钮 -->
- <view class="action-button flex" v-if="userInfo.sysUserFlag == '1'&&!hasShopiing">
- <view class="f1" @click="openTakeGood(1)">
- <view class="icons"><u-icon name="bianmachaxun" custom-prefix="custom-icon"></u-icon></view>
- <view class="tits">产品编码取货</view>
- </view>
- <view class="f2" @click="openTakeGood(0)">
- <view class="icons"><u-icon name="saoma" custom-prefix="custom-icon"></u-icon></view>
- <view class="tits">二维码/条形码取货</view>
- </view>
- </view>
- <!-- banner -->
- <view class="banner">
- <u-swiper mode="dot" bg-color="" img-mode="widthFix" @click="clickBanner" :interval="3000" :height="hasShopiing?280:374" :list="imgList"></u-swiper>
- </view>
- <!-- 快捷导航 -->
- <view class="quick-nav pa-box" v-if="hasShopiing&&navList.length">
- <iconItemsList :list="navList" :iconSize="45" @callback="onNavFun"></iconItemsList>
- </view>
- <!-- 产品分类 -->
- <view class="ptype-nav pa-box" v-if="hasShopiing">
- <swiper class="swiper" @change="e=>{currentPtypeDot=e.detail.current}">
- <swiper-item v-for="(item, idx) in productTypeList" :index="idx" :key="item.id">
- <iconItemsList :list="item.list" type="img" @callback="onNavFun"></iconItemsList>
- </swiper-item>
- </swiper>
- <view class="indicator-dots">
- <view v-for="(item,idx) in productTypeList" :key="idx" :class="currentPtypeDot==idx?'indicator-dots-active':''" ></view>
- </view>
- </view>
- <!-- 产品列表 -->
- <view class="product-box" v-if="hasShopiing">
- <u-divider bg-color="">热门推荐</u-divider>
- <view class="product-list">
- <!-- 产品列表 -->
- <productItem
- v-for="(item,index) in productList"
- :key="index"
- :list="item"
- :index="index"
- :itemWidth="(screenWidth-25)*0.5"
- :gap="5"
- ></productItem>
- </view>
- </view>
- </view>
- <!-- 扫描记录 -->
- <view class="list-box" v-if="!hasShopiing">
- <!-- 扫描记录 -->
- <u-cell-group :border="false">
- <u-cell-item title="VIN查询历史" @click="toAllRecord" :title-style="{fontSize:'1em'}" value="全部">
- <u-icon slot="icon" size="38" color="#066cff" style="margin-right: 0.3em;" name="order"></u-icon>
- </u-cell-item>
- </u-cell-group>
- <u-cell-group :border="false" v-if="hasLogin">
- <u-cell-item v-for="item in vinList"
- @click="toChoosePart(item)"
- :key="item.id"
- :title="item.vinCode"
- :title-style="{fontSize:'1em'}"
- :label="userInfo&&userInfo.sysUserFlag == '0' ? item.createDate : (item.brandName +' '+item.modelName)">
- <text slot="icon"></text>
- </u-cell-item>
- <view style="padding: 20upx;">
- <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="vinList.length==0 && status!='loading'" mode="list"></u-empty>
- <u-loadmore v-if="status=='loading'" :status="status" />
- </view>
- </u-cell-group>
- <view class="des" v-if="vinList.length&&hasLogin">仅展示最近5条记录,点击“全部”查看更多</view>
- <view class="des" v-if="!hasLogin">请登录后查看历史记录</view>
- </view>
- </view>
- </view>
- <!-- tab栏 -->
- <u-tabbar :list="vuex_tabBarList" :mid-button-size="80" :before-switch="beforeSwitch" :midButton="vuex_tabBarList.length==5"></u-tabbar>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations,
- } from 'vuex'
- import scrollBox from '@/components/scrollBox.vue'
- import UniStatusBar from '@/components/uni-status-bar/uni-status-bar.vue'
- import iconItemsList from '@/components/icon-items-list/icon-items-list.vue'
- import productItem from './productItem.vue'
- import { shelfBondRecordWaitPayRecord, findStoreShelf, shelfGetTotalWaitQty, getProductfindByScanCode, queryQplsConfig } from '@/api/shelf.js'
- import { xprhStoreApplyRead } from '@/api/xprh.js'
- import { findCurrentRewardRule } from '@/api/rewardRule.js'
- import { listLookUp, getLookUpDatas, getCurrUserInfo } from '@/api/data.js';
- import { scanVinLogQueryRoll, getScanVinLogList, getScanGetMaxQty }from '@/api/car.js'
- import { promoTerminalList } from '@/api/video.js'
- import { getRewardRollList } from '@/api/rewardRule.js'
- import { openWebView } from "@/utils/index.js"
- export default {
- components: {
- iconItemsList, // 图标网格
- scrollBox, // 无缝滚动组件
- UniStatusBar, // 状态栏组件
- productItem // 产品列表
- },
- data() {
- const _this = this
- return {
- status: 'loading',
- noDataText: '暂无数据',
- hasShopiing: false, // 是否开通商城
- bondRecord: null, // 保证金
- list:[], // 扫描记录滚动
- slist:[], // 红包滚动
- vinList: [], // 扫描记录
- orderTodo: null, // 待取货的货架订单信息
- avatarUrl:'', // 用户图像
- navHeight: '44', // 头部高度
- scanMaxNums: 10, // 扫描VIN仅限10次
- carouselList: [] ,// 修理厂促销活动列表
- productTypeList: [], // 产品分类
- currentPtypeDot: 0,
- screenWidth: 325,
- productList:[]
- }
- },
- computed: {
- ...mapState(['hasLogin','vuex_vinScanNums','vuex_tabBarList']),
- // 显示开发版本信息
- showVersion () {
- const baseUrl = getApp().globalData.baseUrl
- return baseUrl.indexOf(".test.") >= 0
- },
- // 是否有数字货架
- hasShelf(){
- return this.$store.state.vuex_storeShelf
- },
- // 登录用户信息
- userInfo(){
- return this.$store.state.vuex_userInfo
- },
- // 是否有门店申请信息
- storeApply(){
- return this.$store.state.vuex_storeAuthInfo || null
- },
- // 是否有红包
- hasRedPacket(){
- const rule = this.$store.state.vuex_rewardRule
- return rule&&rule.ruleStatus == 'release'
- },
- // banner 图片列表
- imgList(){
- let list = [
- {
- image: this.hasShopiing ? '/static/banner1.jpg':'/static/banner1.png',
- activeType: ''
- }
- ]
- // 红包
- if(this.hasRedPacket&&this.hasShelf){
- list.push(
- {
- image: this.hasShopiing ? '/static/banner2.jpg':'/static/banner2.png',
- activeType: 'redPacket'
- })
- }
- return list.concat(this.carouselList)
- },
- // 快捷导航
- navList(){
- const list = [
- {
- id:'n0',
- auth: this.hasLogin&&this.userInfo.sysUserFlag == '1',
- icon:'bianmachaxun',
- name: '产品编码取货',
- color:'#056cd9',
- url: 'openTakeGood0',
- target: 'fun'
- },
- {
- id:'n1',
- auth: this.hasLogin&&this.userInfo.sysUserFlag == '1',
- icon:'saoma',
- name: '二维/条码取货',
- color:'#ffaa7f',
- url:'openTakeGood1',
- target: 'fun'
- },
- {
- id:'n3',
- auth: this.hasLogin,
- icon:'shipin1',
- name: '视频教程',
- color:'#55aaff',
- url:'/pagesB/videos/index',
- target: 'page'
- },
- {
- id:'n2',
- auth: this.hasLogin,
- icon:'chaxunjilu',
- name: 'VIN查询历史',
- color:'#abc4ff',
- url:'/pagesA/vinRecord/vinRecord',
- target: 'page'
- }
- ]
- return list.filter(item=> item.auth)
- }
- },
- onReady() {
- // 获取导航栏高度
- const res = uni.getSystemInfoSync()
- this.screenWidth = res.windowWidth
- const system = res.platform
- if (system === 'android') {
- this.navHeight = 48
- } else if (system === 'ios') {
- this.navHeight = 44
- }
- },
- onLoad() {
- this.orderTodo = null
- this.bondRecord = null
- this.vinList = []
- // 推荐产品列表
- this.getProductList()
- // 视频类型
- this.getLookUpList('CONTENT_CATEGORY', 'vuex_videoTypeList');
- // 检测是否登录
- this.$store.dispatch('checkLogin',()=>{
- // 获取数据字典
- this.getListLookUp();
- // 获取支付,收款方式
- this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
- // 价格类型
- this.getLookUpList('PRICE_SHOW_TYPE', 'vuex_priceTypeList');
- // 初始化页面
- this.pageInit(false)
- })
- // 刷新首页数据
- uni.$on("refashHome",()=>{
- this.pageInit(true)
- })
- },
- // 页面卸载
- onUnload() {
- uni.$off('refashHome')
- uni.$off('refashProm')
- },
- // 下拉刷新
- onPullDownRefresh(){
- this.pageInit(true)
- setTimeout(function () {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- onShareAppMessage() {},
- onShow() {
- // 用户头像
- this.avatarUrl = uni.getStorageSync('userPhoto');
- if(this.hasLogin){
- // 查询门店认证信息
- if(this.userInfo.sysUserFlag == '0'){
- this.findLastApply()
- }
- if(this.userInfo.sysUserFlag == '1'){
- // 查询红包活动
- this.getRedPacketRule()
- }
- // 重新刷新
- this.pageInit(true)
- }else{
- // 隐藏促销模块
- this.hidePromoTab()
- // 滚动扫描记录
- this.getScrollLog()
- }
- },
- methods: {
- // 扫描vin
- beforeSwitch(index){
- const row = this.$store.state.vuex_tabBarList[index]
- if(row.text == '促销'){
- uni.$emit('refashProm')
- }
- if(row.text == '购物车'){
- uni.navigateTo({
- url:'/pagesB/cart/index',
- target: 'page'
- })
- }
- if(row.text == '扫描VIN'){
- this.openCamera()
- }else{
- return true
- }
- },
- // 去搜索产品
- toSearch(event){
- uni.navigateTo({
- url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
- })
- },
- // 获取产品列表
- getProductList(){
- const cacheList = this.$store.state.vuex_cartList.find(k => k.sn == '693459699332595712')
- this.productList = cacheList ? JSON.parse(JSON.stringify(cacheList.list)) : []
- },
- // 初始化页面
- pageInit(flag){
- this.carouselList = []
- if(this.hasLogin){
- // 非游客
- if(this.userInfo.sysUserFlag == '1'){
- // 查询是否有商城
- this.getHasShopping(flag)
- }else{
- // 游客
- // 获取扫描次数
- this.$store.dispatch("getScanNums")
- // 获取最大扫描次数
- this.getMaxQty()
- // 查询门店认证信息
- this.findLastApply()
- // 获取扫描记录
- this.getVinLog()
- }
-
- }else{
- uni.removeStorageSync('token')
- }
- },
- // 轮播图片
- getCarousel(){
- this.carouselList = []
- // 获取所有促销活动数据
- promoTerminalList({}).then(res => {
- if(res.status == 200){
- res.data&&res.data.map(item => {
- item.image = item.imageSet&&item.imageSet[0] // 默认取第一张图片
- })
- // 过滤掉产品促销活动
- // this.carouselList = res.data.filter(item => item.content.indexOf("pages/promo/index") < 0)
- // 所有数据
- this.carouselList = res.data
- }
- })
- },
- // 快速导航单击
- onNavFun(item){
- // 编码取货
- if(item.url=='openTakeGood1'){
- this.openTakeGood(1)
- }
- // 扫码取货
- if(item.url=='openTakeGood0'){
- this.openTakeGood(0)
- }
- // 产品分类跳转
- if(item.url=='ptypeNav'){
- uni.navigateTo({
- url:'/pagesB/shopiing/searchProduct?clzId='+item.sn+'&clzName='+item.name
- })
- }
- },
- // 获取数据字典
- getListLookUp() {
- const _this = this;
- listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
- if (res.status == 200) {
- _this.$store.state.vuex_allLookUp = res.data;
- }
- });
- },
- // 或某一项字典列表,参数code
- getLookUpList(code, vuexKey) {
- getLookUpDatas({ type: code }).then(res => {
- if (res.status == 200) {
- this.$store.state[vuexKey] = res.data || [];
- }
- });
- },
- // 获取价格配置
- getPriceCofig(){
- const data = this.$store.state.vuex_storeShelf
- queryQplsConfig({shelfSn: data.shelfSn}).then(res => {
- this.$store.state.vuex_configPrice = res.data || null
- })
- },
- // 最新用户信息
- getCurrUserInfo(){
- getCurrUserInfo().then(res => {
- if(res.data){
- this.$store.state.vuex_userInfo.userNameCN = res.data.name;
- this.$store.state.vuex_userInfo.mobile = res.data.mobile;
- this.$store.state.vuex_userInfo.adminId = res.data.id;
- this.$store.state.vuex_userPhoto = res.data.photo;
- uni.setStorageSync('userPhoto', res.data.photo);
- }
- })
- },
- // 获取最大扫描数
- getMaxQty(){
- getScanGetMaxQty().then(res => {
- this.scanMaxNums = res.data || 10
- this.$store.state.vuex_scanMaxNums = this.scanMaxNums
- })
- },
- // 获取最新申请门店
- findLastApply(){
- const mobile = this.userInfo.mobile
- this.$store.dispatch('getSotreAuth',mobile)
- },
- // 知道审核不通过
- toKnow(){
- uni.showLoading({
- title: "正在提交"
- })
- xprhStoreApplyRead({sn:this.storeApply.applySn}).then(res => {
- if(res.status == 200){
- this.findLastApply()
- }
- uni.hideLoading()
- })
- },
- // 待取货数量合计
- shelfGetTotalWaitQty(){
- shelfGetTotalWaitQty({billState:'WAIT'}).then(res => {
- if(res.status == 200){
- this.orderTodo = res.data;
- }
- })
- },
- // 货架订单列表
- toOrder(){
- if(this.hasShelf){
- uni.navigateTo({
- url: "/pagesA/digitalShelf/orderList"
- })
- }else{
- uni.showToast({
- icon:'none',
- title: '门店没有关联数字货架,无法使用此功能!'
- })
- }
- },
- // 获取上方滚动扫描记录
- getScrollLog(){
- scanVinLogQueryRoll({pageNo:1,pageSize:50}).then(res => {
- this.list = res.data.list || []
- this.list.map(item => {
- item.placeText = item.userName + '刚刚扫描了一个VIN'
- })
- })
- },
- // 获取当前门店扫描记录
- getVinLog(){
- this.vinList = []
- this.status = "loading"
- // VISITOR:游客,EMPLOYEE:雇员
- getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
- this.vinList = res.data&&res.data.list || []
- this.vinList = this.vinList.filter(item => item.vinCode)
- this.status = 'nomore'
- })
- },
- // 商城信息, flag: true 再次刷新,false 首次加载
- getHasShopping(flag){
- if(!flag){
- setTimeout(()=>{
- this.hasShopiing = true
- // 有商城
- if(this.hasShopiing){
- // 隐藏tab 视频,显示购物车tab
- this.showCatTab()
- // 商品分类
- const list = [
- {
- id:'0',
- sn:'0',
- name:'轮胎',
- icon:'/static/temp/t1.jpeg',
- url: 'ptypeNav',
- target: 'fun'
- },
- {
- id:'1',
- sn:'1',
- name:'滤清器',
- icon:'/static/temp/t2.jpeg',
- url: 'ptypeNav',
- target: 'fun'
- },
- {
- id:'2',
- sn:'3',
- name:'刹车片',
- icon:'/static/temp/t4.jpg',
- url: 'ptypeNav',
- target: 'fun'
- },{
- id:'4',
- sn:'4',
- name:'油品',
- icon:'/static/temp/t5.png',
- url: 'ptypeNav',
- target: 'fun'
- },{
- id:'5',
- sn:'5',
- name:'雨刮',
- icon:'/static/temp/t11.jpg',
- url: 'ptypeNav',
- target: 'fun'
- },{
- id:'6',
- sn:'6',
- name:'火花塞',
- icon:'/static/temp/t6.jpeg',
- url: 'ptypeNav',
- target: 'fun'
- },{
- id:'7',
- sn:'7',
- name:'电火线圈',
- icon:'/static/temp/t7.jpg',
- url: 'ptypeNav',
- target: 'fun'
- },{
- id:'8',
- sn:'8',
- name:'照明系列',
- icon:'/static/temp/t9.jpg',
- url: 'ptypeNav',
- target: 'fun'
- },{
- id:'9',
- sn:'9',
- name:'空气滤',
- icon:'/static/temp/t10.jpg',
- url: 'ptypeNav',
- target: 'fun'
- },{
- id:'10',
- sn:'10',
- name:'机油率',
- icon:'/static/temp/t3.jpg',
- url: 'ptypeNav',
- target: 'fun'
- },{
- id:'11',
- sn:'11',
- name:'电瓶电池',
- icon:'/static/temp/t8.jpg',
- url: 'ptypeNav',
- target: 'fun'
- },{
- id:'12',
- sn:'12',
- name:'洗美养护',
- icon:'/static/temp/t12.jpg',
- url: 'ptypeNav',
- target: 'fun'
- }
- ]
- // 转成二维数组
- for(let i=0;i<list.length;i=i+8){
- this.productTypeList.push({
- id: 'swiper-item-'+i,
- list: list.slice(i,(i+8)>list.length?list.length:(i+8))
- })
- }
- }else{ // 没有商城
- // 滚动扫描记录
- this.getScrollLog()
- // 获取扫描记录
- this.getVinLog()
- }
- // 查询是否有数字货架
- this.getStoreShelf(flag)
- },150)
- }else{
- if(!this.hasShopiing){
- // 滚动扫描记录
- this.getScrollLog()
- // 获取扫描记录
- this.getVinLog()
- }
- // 查询是否有数字货架
- this.getStoreShelf(flag)
- }
- },
- // 显示购物车tab
- showCatTab(){
- const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
- const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
- if(catIndex<0 && videoIndex >= 0){
- // 替换视频为购物车
- this.$store.state.vuex_tabBarList.splice(videoIndex,1,{
- "pagePath": "/pages/cart/index",
- "iconPath": "/static/tab/tab_cart_normal.png",
- "selectedIconPath": "/static/tab/tab_cart_pressed.png",
- "text": "购物车",
- 'customIcon': false,
- })
- }
- },
- // 查询是否支持数字货架, flag: true 再次刷新,false 首次加载
- getStoreShelf(flag){
- findStoreShelf().then(res => {
- this.$store.state.vuex_storeShelf = res.data;
- if(res.data){
- if(!flag){
- // 更新用户信息
- this.getCurrUserInfo()
- // 显示促销模块
- this.showPromoTab()
- }
-
- // 获取价格权限配置
- this.getPriceCofig()
- // 保证金查询
- this.getShelfBWPayRecord()
- // 获取订单信息
- this.shelfGetTotalWaitQty()
- // 获取轮播数据,包括促销活动
- this.getCarousel()
- }else{
- // 没有数字货架,隐藏促销模块
- this.hidePromoTab()
- }
- })
- },
- // 显示促销模块
- showPromoTab(){
- // 添加促销模块
- const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
- if(promoIndex<0){
- this.$store.state.vuex_tabBarList.splice(1,0,{
- "pagePath": "/pages/promo/index",
- "iconPath": "/static/tab/tab_promo_normal.png",
- "selectedIconPath": "/static/tab/tab_promo_pressed.png",
- "text": "促销",
- 'customIcon': false,
- })
- }
- // 居中透出显示扫描按钮
- const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
- if(scanTab){
- scanTab.iconPath = "/static/tab/tab_scan_mid.png"
- scanTab.midButton = true
- }
- },
- // 隐藏促销模块
- hidePromoTab(){
- // 删除促销模块
- const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
- if(promoIndex > -1){
- this.$store.state.vuex_tabBarList.splice(promoIndex,1)
- }
- // 扫描按钮不局中
- const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
- if(scanTab){
- scanTab.iconPath = "/static/tab/tab_scan_normal.png"
- scanTab.midButton = false
- }
- },
- // 查询是有红包活动
- getRedPacketRule(){
- findCurrentRewardRule().then(res => {
- this.$store.state.vuex_rewardRule = res.data;
- this.getRedScroll()
- })
- },
- // 红包奖励信息
- getRedScroll(){
- getRewardRollList({pageNo:1,pageSize:50}).then(res => {
- this.slist = res.data || []
- this.slist.map(item => {
- item.placeText = item.userName + '刚刚得到了'+item.totalRewardAmount+'元 红包奖励'
- })
- })
- },
- // 获取保证金金额
- getShelfBWPayRecord(){
- const data = this.$store.state.vuex_storeShelf
- shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
- console.log(res,'获取保证金金额')
- this.bondRecord = res.data
- })
- },
- // 保证金支付
- toPayBondAmount(){},
- openTakeGood(index){
- // 已有数字货架
- if(this.hasShelf){
- this.clickAction(index)
- }else{
- uni.showToast({
- icon:'none',
- title: '门店没有关联数字货架,无法使用此功能!'
- })
- }
- },
- // 单击banner
- clickBanner(index){
- const row = this.imgList[index]
- // 红包
- if(row.activeType == 'redPacket'){
- uni.navigateTo({url:"/pages/morePage/redPacket"})
- }
- // 图文
- if(row.contentType == 'IMAGE_CONTENT'){
- uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoActiveSn})
- }
- // 视频
- if(row.contentType == 'VIDEO'){
- uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoActiveSn})
- }
- // 链接
- if(row.contentType == 'LINK'){
- // 货架促销活动
- if(row.content.indexOf("pagesB/promoDetail") >= 0){
- uni.navigateTo({
- url: '/pagesB/promoProduct?promoActiveSn='+row.promoActiveSn+'&title='+row.title
- })
- }else{
- openWebView({url:row.content})
- }
- }
- },
- // 选择取货方式
- clickAction(index){
- const shelfSn = this.hasShelf.shelfSn
- const _this = this
- // 扫描
- if(index == 0){
- uni.scanCode({
- success: function (ret) {
- console.log(ret);
- const params = {
- codeType: ret.scanType == 'QR_CODE' ? 0 : 1
- }
- // 二维码
- if(ret.scanType == 'QR_CODE'){
- const result = ret.result.split("&")
- params.productSn = result[2] // 产品编码sn
- }else{
- params.qrCode = ret.result
- }
- uni.showLoading({
- title: "正在查询产品..."
- })
- // 确认取货
- getProductfindByScanCode(params).then(res => {
- if(res.status == 200 && res.data){
- if(res.data.currentInven){
- const billSource = ret.scanType == 'QR_CODE' ? 'qr_code': 'bar_code'
- const retData = Object.assign({shelfSn: shelfSn, billSource: billSource},res.data)
- _this.$store.state.vuex_tempData = retData
- uni.navigateTo({
- url: '/pagesA/queryByCode/confirmQh'
- })
- }else{
- uni.showModal({
- title: '提示',
- content: '产品库存为0,无法取货!',
- confirmText: '好的',
- showCancel: false
- })
- }
- }else{
- uni.showModal({
- title: '提示',
- content: '产品不属于此货架,请重新扫描!',
- confirmText: '好的',
- showCancel: false
- })
- }
- uni.hideLoading()
- })
- }
- });
- }else{
- // 按编码搜索
- uni.navigateTo({
- url: '/pagesA/queryByCode/queryByCode'
- })
- }
- },
- // 去扫VIN
- openCamera(){
- if(this.hasLogin){
- // 游客身份
- if(this.userInfo.sysUserFlag == '0'){
- // 最多扫10次
- if(this.vuex_vinScanNums < this.scanMaxNums){
- uni.navigateTo({
- url: "/pages/scan-frame/scan-frame"
- })
- }else{
- uni.showModal({
- title: '提示',
- content: '个人用户扫描VIN仅限10次,您的次数已用完!',
- confirmText: '好的',
- showCancel: false,
- success(res) {}
- })
- }
- }else{
- // 非游客,直接扫
- uni.navigateTo({
- url: "/pages/scan-frame/scan-frame"
- })
- }
- }else{
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- },
- // 查看扫描VIN记录
- toAllRecord(){
- uni.navigateTo({
- url: this.hasLogin ? "/pagesA/vinRecord/vinRecord" : '/pages/login/login'
- })
- },
- // 查看用户信息
- toUser(){
- if(this.hasLogin){
- // 用户详细信息 或 门店认证
- uni.navigateTo({
- url: this.userInfo.sysUserFlag == '1' ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
- })
- }else{
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- },
- // 选择配件
- toChoosePart(item){
- item.text = item.modelInfo
- uni.navigateTo({
- url: "/pagesA/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))+'&type=log'
- })
- }
- }
- }
- </script>
- <style lang="less">
- page{
- background-color: #ffffff;
- }
- .bg-0{
- background-image: linear-gradient(#86defa 0%,#cdeff9 25%,#ffffff 40%);
- }
- .bg-1{
- background-image: linear-gradient(#066cff 10%, #80b1fd 30%, #f8f8f8 50%);
- }
- .content {
- margin: 0;
- padding: 0;
- height: 100vh;
- display: flex;
- flex-direction: column;
- .header-box{
- z-index: 5;
- padding: 0em 1em;
- background: #066cff;
- .title{
- padding: 0;
- }
- .version{
- color: #FFEB3B;
- font-size: 0.8em;
- margin-left: 1em;
- }
- }
- .cbody{
- flex-grow: 1;
- overflow-y: auto;
- overflow-x: hidden;
- .notices{
- padding: 0.5em 0 0;
- font-size: 0.9em;
- margin-top: 0.5rem;
- view{
- color: #ffaf46;
- flex-grow: 1;
- }
- .text{
- color: #ffffff;
- margin-left: 1em;
- }
- }
- .pa-box{
- background: #fff;
- border-radius: 6px;
- margin: 10px 0;
- }
- .product-box{
- margin: 10px 0;
- }
- .ptype-nav{
- padding: 10px 0;
- position: relative;
- .indicator-dots{
- width: 100%;
- height: 3px;
- display: flex;
- align-items: center;
- justify-content: center;
- position: absolute;
- left: 0;
- bottom:5px;
- }
- .indicator-dots > view{
- width: 10px;
- height: 3px;
- background: #e7e7e7;
- display: inline-block;
- }
- .indicator-dots >.indicator-dots-active{
- background: #00aaff;
- }
- }
- }
- .body-box{
- padding: 0em 1em 0.8em;
- z-index: 4;
- .banner{
- margin-top: 20rpx;
- }
- .action-button{
- padding:40upx 0 0 0;
- justify-content: space-between;
- > view{
- display: flex;
- align-items: center;
- color: #fff;
- border-radius: 10rpx;
- width: 49%;
- padding: 6rpx 0;
- box-shadow: 0rem 0.3rem 0.5rem #d9dada;
- }
- .f1{
- background: #2196f3;
- }
- .f2{
- background: #FF9800;
- }
- .icons{
- font-size: 50rpx;
- color: #fff;
- width: 80rpx;
- height: 80rpx;
- text-align:center;
- display: flex;
- align-items: center;
- flex-direction: column;
- justify-content: center;
- }
- .tits{
- font-size:28rpx;
- }
- }
- }
- .body-box1{
- padding: 0em 10px 0.8em;
- }
- .bg-blue{
- position: relative;
- > view{
- z-index: 100;
- position: relative;
- }
- &::after{
- /* 这个伪类的作用就是一个圆弧的背景色 */
- width: 130%;
- height: 100%;
- position: absolute;
- /*设置水平居中*/
- left: -15%;
- /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
- top: -10%;
- /*层叠顺序,最底层显示*/
- content: '';
- border-radius: 0 0 50% 50%;
- /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
- background: linear-gradient(to bottom, #066cff, #1d77ff);
- }
- .search-head{
-
- }
- .userCard{
- position:relative;
- left:0;
- bottom:-0.8rem;
- padding: 0.5rem;
- background: #fff;
- border-radius: 0.8rem;
- box-shadow: 0rem 0.3rem 0.5rem #bcdede;
- .userCard-info{
- flex-grow:1;
- > view{
- &:last-child{
- margin-left: 0.5em;
- line-height: 1.5em;
- .user-name{
- font-size: 1rem;
- }
- >view{
- padding: 0.2em;
- }
- }
- }
- .user-info{
- flex-grow:1;
- }
- }
- .user-rz{
- font-size: 0.8rem;
- color:#58aff5;
- }
- }
- }
- .shopping{
- padding: 0;
- .notices{
- padding: 0.5em 10px 0
- }
- &::after{
- top: -25px;
- border-radius: 0 0 150px 150px;
- }
- }
- .list-box{
- padding: 0 1em;
- overflow: auto;
- .des{
- text-align: center;
- padding: 1em 0;
- color: #999;
- font-size: 0.8em;
- }
- }
- }
- </style>
|