123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125 |
- <template>
- <view>
- <view class="content" :class="hasShopiing?'bg-0':'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>
- <uni-icons type="arrowright" size="20" color="#999"></uni-icons>
- </view>
- </view>
- <!-- 搜索 -->
- <view class="search-head" v-if="hasShopiing" @click="toSearch">
- <uni-search-bar readonly radius="100" placeholder="请输入商品名称/产品编码/原厂编码" clearButton="auto" cancelButton="none"/>
- </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="32" 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 { getShopStatus } from '@/api/cart.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:'#97d695',
- 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'
- })
- },
- // 商品分类
- getGoodType(){
- 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))
- })
- }
- },
- // 商城信息, flag: true 再次刷新,false 首次加载
- getHasShopping(flag){
- if(!flag){
- uni.showLoading({
- title: '加载中'
- })
- getShopStatus().then(res => {
- this.hasShopiing = res.data && res.data.paramValue == 1
- // 有商城
- if(this.hasShopiing){
- // 隐藏tab 视频,显示购物车tab
- this.showCatTab()
- // 商品分类
- this.getGoodType()
- }else{
- // 没有商城
- // 滚动扫描记录
- this.getScrollLog()
- // 获取扫描记录
- this.getVinLog()
- }
- // 查询是否有数字货架
- this.getStoreShelf(flag)
- uni.hideLoading()
- })
- }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.getShelfBWPayRecord()
- // 获取订单信息
- this.shelfGetTotalWaitQty()
- }
-
- // 获取价格权限配置
- this.getPriceCofig()
- // 获取轮播数据,包括促销活动
- 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;
- box-shadow: 1px 1px 3px #eee;
- }
- .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>
|