index.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201
  1. <template>
  2. <view class="content" :class="hasShopiing?'':'bg-1'">
  3. <view class="content-body">
  4. <!-- 头部栏 -->
  5. <view class="header-box">
  6. <UniStatusBar></UniStatusBar>
  7. <view class="title flex align_center" :style="{height:(navHeight+'px')}">
  8. <u-image src="/static/logo-h.png" width="349" height='40'></u-image>
  9. <!-- 版本提示 -->
  10. <text class="version" v-if="showVersion">体验版</text>
  11. </view>
  12. </view>
  13. <!-- 浮动头部 -->
  14. <view class="header-box headerFixed" v-if="hasShopiing&&showFixed">
  15. <UniStatusBar></UniStatusBar>
  16. <view class="title flex align_center" :style="{height:(navHeight+'px')}">
  17. <view class="search-head" @click="toSearch">
  18. <uni-search-bar readonly radius="100" bg-color="#fff" placeholder="请输入商品名称/产品编码/原厂编码" clearButton="auto" cancelButton="none"/>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="cbody" :class="hasShopiing?'bg-0':''">
  23. <view :class="hasShopiing?'shopping':'body-box bg-blue'">
  24. <!-- 滚动区域 -->
  25. <view class="scroll-list" v-if="!hasShopiing">
  26. <scrollBox v-if="list.length&&!hasRedPacket" :list="list"></scrollBox>
  27. <scrollBox v-if="slist.length&&hasRedPacket" :list="slist"></scrollBox>
  28. </view>
  29. <!-- 保证金 -->
  30. <view class="notices flex align_center" v-if="bondRecord" @click="toPayBondAmount">
  31. <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 您有一笔保证金待支付 ¥{{bondRecord.bondAmount}}</view>
  32. <!-- <text class="text">立即支付>></text> -->
  33. </view>
  34. <!-- 待取货提醒 -->
  35. <view class="notices flex align_center" v-if="!bondRecord&&orderTodo" @click="toOrder">
  36. <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 您有待取货的货架订单哦!</view> <text class="text">立即处理>></text>
  37. </view>
  38. <!-- 门店审核不通过 -->
  39. <view class="notices flex" v-if="storeApply&&storeApply.auditStatus=='REFUSE'&&storeApply.readFlag=='0'">
  40. <view class="flex justify_between align_center">
  41. <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 门店认证资料审核不通过,请重新提交审核!</view> <text class="text" @click="toKnow">知道了</text>
  42. </view>
  43. </view>
  44. <!-- 名片 -->
  45. <view class="userCard flex align_center justify_between" v-if="!hasShopiing">
  46. <view class="userCard-info flex align_center">
  47. <view>
  48. <u-image shape='circle' v-if="!hasLogin" src="/static/def_personal_avatar.png" width="90" height="90"></u-image>
  49. <u-image shape='circle' v-else :src="avatarUrl||'/static/def_personal_avatar.png'" width="90" height="90"></u-image>
  50. </view>
  51. <view class="user-info" @click="toUser">
  52. <view v-if="!hasLogin" style="font-size: 40rpx;">
  53. 请点击登录
  54. </view>
  55. <view v-else>
  56. <view class="user-name">{{userInfo.userNameCN || userInfo.mobile}}</view>
  57. <view v-if="hasLogin&&userInfo&&userInfo.sysUserFlag == '0'">
  58. <u-tag text="个人用户" mode="dark" type="warning" shape="circle" size="mini" />
  59. </view>
  60. <view v-else>{{userInfo.orgName}}</view>
  61. </view>
  62. </view>
  63. </view>
  64. <view @click="toUser">
  65. <text v-if="hasLogin&&userInfo&&userInfo.sysUserFlag == '0'" class="user-rz">
  66. {{storeApply&&storeApply.auditStatus=='WAIT'?'认证门店审核中':'认证成为门店'}}
  67. </text>
  68. <uni-icons type="arrowright" size="20" color="#999"></uni-icons>
  69. </view>
  70. </view>
  71. <!-- 搜索 -->
  72. <view class="search-head" v-if="hasShopiing" @click="toSearch">
  73. <uni-search-bar readonly radius="100" bg-color="#fff" placeholder="请输入商品名称/产品编码/原厂编码" clearButton="auto" cancelButton="none"/>
  74. </view>
  75. </view>
  76. <view :class="hasShopiing?'body-box1':'body-box'">
  77. <!-- 扫描按钮 -->
  78. <view class="action-button flex" v-if="userInfo.sysUserFlag == '1'&&!hasShopiing">
  79. <view class="f1" @click="openTakeGood(1)">
  80. <view class="icons"><u-icon name="bianmachaxun" custom-prefix="custom-icon"></u-icon></view>
  81. <view class="tits">产品编码取货</view>
  82. </view>
  83. <view class="f2" @click="openTakeGood(0)">
  84. <view class="icons"><u-icon name="saoma" custom-prefix="custom-icon"></u-icon></view>
  85. <view class="tits">二维码/条形码取货</view>
  86. </view>
  87. </view>
  88. <!-- banner -->
  89. <view class="banner">
  90. <u-swiper mode="dot" bg-color="" img-mode="widthFix" @click="clickBanner" :interval="3000" :height="hasShopiing?280:350" :list="imgList"></u-swiper>
  91. </view>
  92. <!-- 快捷导航 -->
  93. <view class="quick-nav pa-box" v-if="hasShopiing&&navList.length">
  94. <iconItemsList :list="navList" type="img" :isLogin="true" :sysUserFlag="userInfo.sysUserFlag" :iconSize="45" @callback="onNavFun"></iconItemsList>
  95. </view>
  96. <!-- 产品分类 -->
  97. <view class="ptype-nav pa-box" v-if="hasShopiing&&productTypeList.length">
  98. <swiper class="swiper" :style="{height:navHeight==44?'160px':'160px'}" @change="e=>{currentPtypeDot=e.detail.current}">
  99. <swiper-item v-for="(item, idx) in productTypeList" :index="idx" :key="item.id">
  100. <iconItemsList :isLogin="hasLogin" circle :sysUserFlag="userInfo.sysUserFlag" :list="item.list" type="img"></iconItemsList>
  101. </swiper-item>
  102. </swiper>
  103. <view class="indicator-dots" v-if="productTypeList.length>1">
  104. <view v-for="(item,idx) in productTypeList" :key="idx" :class="currentPtypeDot==idx?'indicator-dots-active':''" ></view>
  105. </view>
  106. </view>
  107. <!-- 产品列表 -->
  108. <view class="product-box" v-if="hasShopiing && totalhotPage>0">
  109. <u-divider bg-color="" half-width="0" color="#666" use-slot :fontSize="28">
  110. <image style="width: 16px;height:16px;" src="../../static/hot.png"></image>
  111. <text style="margin: 0 5px;font-weight: bold;">热门推荐</text>
  112. <image style="width: 16px;height:16px;" src="../../static/hot.png"></image>
  113. </u-divider>
  114. <view class="product-list">
  115. <!-- 产品列表 -->
  116. <productItem
  117. v-for="(item,index) in productList"
  118. :key="index"
  119. :list="item"
  120. :index="index"
  121. :itemWidth="(screenWidth-25)*0.5"
  122. :gap="5"
  123. :isLogin="hasLogin"
  124. :sysUserFlag="userInfo.sysUserFlag"
  125. ></productItem>
  126. <view style="padding: 50upx 0;">
  127. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="totalhotPage==0 && status!='loading'" mode="list"></u-empty>
  128. <u-loadmore v-else color="#999" :fontSize="24" :status="status" />
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <!-- 扫描记录 -->
  134. <view class="list-box" v-if="!hasShopiing">
  135. <!-- 扫描记录 -->
  136. <u-cell-group :border="false">
  137. <u-cell-item title="VIN查询历史" @click="toAllRecord" :title-style="{fontSize:'1em'}" value="全部">
  138. <u-icon slot="icon" size="32" color="#066cff" style="margin-right: 0.3em;" name="order"></u-icon>
  139. </u-cell-item>
  140. </u-cell-group>
  141. <u-cell-group :border="false" v-if="hasLogin">
  142. <u-cell-item v-for="item in vinList"
  143. @click="toChoosePart(item)"
  144. :key="item.id"
  145. :title="item.vinCode"
  146. :title-style="{fontSize:'1em'}"
  147. :label="userInfo&&userInfo.sysUserFlag == '0' ? item.createDate : (item.brandName +' '+item.modelName)">
  148. <text slot="icon"></text>
  149. </u-cell-item>
  150. <view style="padding: 20upx;">
  151. <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>
  152. <u-loadmore v-if="status=='loading'" :status="status" />
  153. </view>
  154. </u-cell-group>
  155. <view class="des" v-if="vinList.length&&hasLogin">仅展示最近5条记录,点击“全部”查看更多</view>
  156. <view class="des" v-if="!hasLogin">请登录后查看历史记录</view>
  157. </view>
  158. </view>
  159. </view>
  160. <!-- tab栏 -->
  161. <u-tabbar :list="vuex_tabBarList" :mid-button-size="80" :before-switch="beforeSwitch" :midButton="vuex_tabBarList.length==5"></u-tabbar>
  162. </view>
  163. </template>
  164. <script>
  165. import {
  166. mapState,
  167. mapMutations,
  168. } from 'vuex'
  169. import scrollBox from '@/components/scrollBox.vue'
  170. import UniStatusBar from '@/components/uni-status-bar/uni-status-bar.vue'
  171. import iconItemsList from '@/components/icon-items-list/icon-items-list.vue'
  172. import productItem from './productItem.vue'
  173. import { shelfBondRecordWaitPayRecord, findStoreShelf, shelfGetTotalWaitQty, getProductfindByScanCode, queryQplsConfig } from '@/api/shelf.js'
  174. import { xprhStoreApplyRead } from '@/api/xprh.js'
  175. import { findCurrentRewardRule } from '@/api/rewardRule.js'
  176. import { listLookUp, getLookUpDatas, getCurrUserInfo } from '@/api/data.js';
  177. import { scanVinLogQueryRoll, getScanVinLogList, getScanGetMaxQty }from '@/api/car.js'
  178. import { shopBannerList } from '@/api/video.js'
  179. import { getRewardRollList } from '@/api/rewardRule.js'
  180. import { getCartCount } from '@/api/cart.js'
  181. import { getShopStatus, getShopUserParam } from '@/api/bizParam.js'
  182. import { getShopCategory, getShopProductList } from '@/api/shop.js'
  183. import { openWebView, clickTab, toAuthStore, clickBannerList, toLogin } from "@/utils/index.js"
  184. export default {
  185. components: {
  186. iconItemsList, // 图标网格
  187. scrollBox, // 无缝滚动组件
  188. UniStatusBar, // 状态栏组件
  189. productItem // 产品列表
  190. },
  191. data() {
  192. const _this = this
  193. return {
  194. status: 'loading',
  195. noDataText: '暂无数据',
  196. hasShopiing: false, // 是否开通商城
  197. bondRecord: null, // 保证金
  198. list:[], // 扫描记录滚动
  199. slist:[], // 红包滚动
  200. vinList: [], // 扫描记录
  201. orderTodo: null, // 待取货的货架订单信息
  202. avatarUrl:'', // 用户图像
  203. navHeight: '44', // 头部高度
  204. scanMaxNums: 10, // 扫描VIN仅限10次
  205. carouselList: [] ,// 修理厂促销活动列表
  206. productTypeList: [], // 产品分类
  207. currentPtypeDot: 0, // 当前产品分类页
  208. screenWidth: 325, // 屏幕宽度
  209. productList:[], // 热门产品
  210. hotProductPageNo: 1 ,// 热门产品页码
  211. hotProductpageSize:10, // 热门产品每页数量
  212. totalhotPage: 0, // 热门产品总页数
  213. showFixed: false, // 是否显示浮动头部
  214. isCheckLogin:false, // 是否正在检查登录
  215. }
  216. },
  217. computed: {
  218. ...mapState(['hasLogin','vuex_vinScanNums','vuex_tabBarList']),
  219. // 显示开发版本信息
  220. showVersion () {
  221. const baseUrl = getApp().globalData.baseUrl
  222. return baseUrl.indexOf(".test.") >= 0 || baseUrl.indexOf('192.168') >=0
  223. },
  224. // 是否有数字货架
  225. hasShelf(){
  226. return this.$store.state.vuex_storeShelf
  227. },
  228. // 登录用户信息
  229. userInfo(){
  230. return this.$store.state.vuex_userInfo
  231. },
  232. // 是否有门店申请信息
  233. storeApply(){
  234. return this.$store.state.vuex_storeAuthInfo || null
  235. },
  236. // 是否有红包
  237. hasRedPacket(){
  238. const rule = this.$store.state.vuex_rewardRule
  239. return rule&&rule.ruleStatus == 'release'
  240. },
  241. // banner 图片列表
  242. imgList(){
  243. let list = [
  244. {
  245. image: '/static/banner1.jpg',
  246. activeType: ''
  247. }
  248. ]
  249. const newList = []
  250. // 红包
  251. if(this.hasRedPacket&&this.hasShelf){
  252. newList.push(
  253. {
  254. image: '/static/banner2.jpg',
  255. activeType: 'redPacket'
  256. })
  257. }
  258. return this.carouselList.length>0 ? newList.concat(this.carouselList) : list.concat(newList)
  259. },
  260. // 快捷导航
  261. navList(){
  262. const list = [
  263. {
  264. id:'n0',
  265. auth: this.hasLogin,
  266. ignoreAuth: false,
  267. icon:'/static/nav_icon1.jpg',
  268. name: '产品编码取货',
  269. color:'#056cd9',
  270. url: 'openTakeGood1',
  271. target: 'fun'
  272. },
  273. {
  274. id:'n1',
  275. auth: this.hasLogin,
  276. ignoreAuth: false,
  277. icon:'/static/nav_icon2.jpg',
  278. name: '二维/条码取货',
  279. color:'#f44336',
  280. url:'openTakeGood0',
  281. target: 'fun'
  282. },
  283. {
  284. id:'n3',
  285. auth: true,
  286. ignoreAuth: true,
  287. icon:'/static/nav_icon3.jpg',
  288. name: '视频讲解',
  289. color:'#03a9f4',
  290. url:'/pagesB/videos/index',
  291. target: 'page'
  292. },
  293. {
  294. id:'n2',
  295. auth: this.hasLogin,
  296. ignoreAuth: true,
  297. icon:'/static/nav_icon4.jpg',
  298. name: 'VIN查询历史',
  299. color:'#ff9800',
  300. url:'/pagesA/vinRecord/vinRecord',
  301. target: this.hasLogin ? 'page' : 'fun'
  302. }
  303. ]
  304. return list
  305. }
  306. },
  307. onReady() {
  308. // 获取导航栏高度
  309. const res = uni.getSystemInfoSync()
  310. this.screenWidth = res.windowWidth
  311. const system = res.platform
  312. if (system === 'android') {
  313. this.navHeight = 48
  314. } else if (system === 'ios') {
  315. this.navHeight = 44
  316. }
  317. },
  318. onLoad() {
  319. this.orderTodo = null
  320. this.bondRecord = null
  321. this.vinList = []
  322. // 视频类型
  323. this.getLookUpList('CONTENT_CATEGORY', 'vuex_videoTypeList');
  324. // 检测是否登录
  325. this.isCheckLogin = true
  326. this.$store.dispatch('checkLogin',(isLogin)=>{
  327. this.isCheckLogin = false
  328. // 获取数据字典
  329. this.getListLookUp();
  330. // 获取支付,收款方式
  331. this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
  332. // 价格类型
  333. this.getLookUpList('PRICE_SHOW_TYPE', 'vuex_priceTypeList');
  334. // 查询是否有商城
  335. this.pageInit(0)
  336. })
  337. // 刷新首页数据
  338. uni.$on("refashHome",()=>{
  339. this.pageInit(2)
  340. })
  341. // 刷新购物车
  342. uni.$on("refashCart",()=>{
  343. this.cartCount()
  344. })
  345. },
  346. // 页面卸载
  347. onUnload() {
  348. uni.$off('refashHome')
  349. uni.$off('refashProm')
  350. uni.$off('refashCart')
  351. },
  352. onHide() {
  353. // 用户头像
  354. this.avatarUrl = uni.getStorageSync('userPhoto');
  355. // 重新刷新
  356. if(!this.isCheckLogin){
  357. this.pageInit(1)
  358. }
  359. },
  360. // 下拉刷新
  361. onPullDownRefresh(){
  362. this.pageInit(2)
  363. setTimeout(function () {
  364. uni.stopPullDownRefresh();
  365. }, 1000);
  366. },
  367. onShareAppMessage() {},
  368. // 页面滚动
  369. onPageScroll(e) {
  370. this.showFixed = e.scrollTop > 120
  371. },
  372. // 滚动到底部,加载热门产品
  373. onReachBottom() {
  374. if(this.hasShopiing && this.hotProductPageNo < this.totalhotPage){
  375. this.hotProductPageNo++
  376. this.getProductList()
  377. }
  378. },
  379. methods: {
  380. // 去认证
  381. authStore(){
  382. uni.navigateTo({
  383. url: '/pages/storeManage/storeAuth'
  384. })
  385. },
  386. // 初始化页面
  387. pageInit(flag){
  388. // 已登录
  389. if(this.hasLogin){
  390. // 已认证用户
  391. if(this.userInfo.sysUserFlag == '1'){
  392. // 查询是否有数字货架
  393. this.getStoreShelf(flag)
  394. }else{// 游客
  395. this.getHasShopping()
  396. // 获取扫描次数
  397. this.$store.dispatch("getScanNums")
  398. // 获取最大扫描次数
  399. this.getMaxQty()
  400. // 查询门店认证信息
  401. this.findLastApply()
  402. // 获取扫描记录
  403. this.getVinLog()
  404. }
  405. }else{
  406. // 未登录
  407. this.getHasShopping()
  408. // 隐藏促销模块
  409. this.hidePromoTab()
  410. }
  411. },
  412. // 查询是否支持数字货架, flag: true 再次刷新,false 首次加载,只加载一次
  413. getStoreShelf(flag){
  414. findStoreShelf().then(res => {
  415. this.$store.state.vuex_storeShelf = res.data;
  416. // 有数字货架
  417. if(res.data){
  418. // 只需加载一次
  419. if(flag==0){
  420. // 更新用户信息
  421. this.getCurrUserInfo()
  422. // 保证金查询
  423. this.getShelfBWPayRecord()
  424. // 获取订单信息
  425. this.shelfGetTotalWaitQty()
  426. // 获取价格权限配置
  427. this.getPriceCofig()
  428. }
  429. }else{
  430. // 没有数字货架,隐藏促销模块
  431. this.hidePromoTab()
  432. }
  433. this.getHasShopping()
  434. })
  435. },
  436. // 最新用户信息
  437. getCurrUserInfo(){
  438. getCurrUserInfo().then(res => {
  439. if(res.data){
  440. this.$store.state.vuex_userInfo.userNameCN = res.data.name;
  441. this.$store.state.vuex_userInfo.mobile = res.data.mobile;
  442. this.$store.state.vuex_userInfo.adminId = res.data.id;
  443. this.$store.state.vuex_userPhoto = res.data.photo;
  444. uni.setStorageSync('userPhoto', res.data.photo);
  445. }
  446. })
  447. },
  448. // 获取价格配置
  449. getPriceCofig(){
  450. const data = this.$store.state.vuex_storeShelf
  451. queryQplsConfig({shelfSn: data.shelfSn}).then(res => {
  452. this.$store.state.vuex_configPrice = res.data || null
  453. })
  454. },
  455. // 商城信息, flag: true 再次刷新,false 只加载一次
  456. getHasShopping(flag){
  457. getShopStatus().then(res => {
  458. const hasShopiing = res.data && res.data.paramValue == 1
  459. // 经销商开启商城
  460. if(hasShopiing){
  461. // 判断员工是否开启商城
  462. this.getShopUserStatus(flag)
  463. }else{
  464. this.hasShopiing = false
  465. this.$store.state.vuex_hasShopiing = this.hasShopiing
  466. // 没有商城
  467. this.showNoShopPage(flag)
  468. // 查询红包活动
  469. this.getRedPacketRule()
  470. }
  471. })
  472. },
  473. // 员工用户是否开启商城
  474. getShopUserStatus(flag){
  475. const data = this.$store.state.vuex_storeShelf
  476. getShopUserParam({shelfSn: data.shelfSn}).then(res=>{
  477. const item = res.data
  478. this.hasShopiing = item && item.paramMap && item.paramMap.mall_flag && item.paramMap.mall_flag.paramValue == 1
  479. this.$store.state.vuex_hasShopiing = this.hasShopiing
  480. if(this.hasShopiing){
  481. // 判断员工是否开启商城
  482. this.showShopPage(flag)
  483. }else{
  484. this.showNoShopPage(flag)
  485. }
  486. // 查询红包活动
  487. this.getRedPacketRule()
  488. })
  489. },
  490. // 显示开通商城的页面
  491. showShopPage(flag){
  492. // 隐藏tab 视频,显示tab购物车
  493. if(this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1'){
  494. // 显示促销模块
  495. this.showPromoTab()
  496. this.cartCount()
  497. }else{
  498. this.$store.state.vuex_cartTotal = 0
  499. this.showCatTab()
  500. }
  501. // 获取轮播数据,包括促销活动
  502. this.getCarousel(1)
  503. // 商品分类
  504. this.getGoodType(flag)
  505. // 获取推荐产品
  506. this.getHotProductList(flag)
  507. },
  508. // 显示未没有开通商城的界面
  509. showNoShopPage(flag){
  510. this.productTypeList = []
  511. this.productList = []
  512. // 获取轮播数据,包括促销活动
  513. this.getCarousel(0)
  514. // 隐藏促销模块
  515. this.hidePromoTab()
  516. // 隐藏tab 购物车,显示tab视频
  517. this.showVideoTab()
  518. // 滚动扫描记录
  519. this.getScrollLog()
  520. // 获取扫描记录
  521. if(this.hasLogin){
  522. this.getVinLog()
  523. }
  524. },
  525. // 购物车数量
  526. cartCount(){
  527. getCartCount({}).then(res => {
  528. if(res.status == 200){
  529. this.$store.state.vuex_cartTotal = res.data?res.data.qty:0
  530. this.showCatTab()
  531. }
  532. })
  533. },
  534. // 商品一级分类
  535. getGoodType(flag){
  536. this.productTypeList = []
  537. getShopCategory({categoryLevel: 1}).then(res => {
  538. const list = res.data || []
  539. const ret = []
  540. list.forEach(item => {
  541. ret.push({
  542. id: item.id,
  543. categorySn: item.categorySn,
  544. auth: true,
  545. ignoreAuth: false,
  546. name: item.categoryName,
  547. icon: item.iconUrl,
  548. url: '/pagesB/shopiing/shopProduct?clzId='+item.categorySn+'&clzName='+item.categoryName+"&shopCategoryCount="+item.shopCategoryCount+'&shopProductCount='+item.shopProductCount,
  549. target: 'page'
  550. })
  551. })
  552. // 转成二维数组
  553. for(let i=0;i<ret.length;i=i+8){
  554. this.productTypeList.push({
  555. id: 'swiper-item-'+i,
  556. list: ret.slice(i,(i+8)>ret.length?ret.length:(i+8))
  557. })
  558. }
  559. })
  560. },
  561. // 商品列表查询
  562. getHotProductList(flag){
  563. console.log(flag)
  564. this.hotProductPageNo = 1
  565. // 不是show 刷新列表
  566. if(flag!=1){
  567. this.productList = []
  568. this.hotProductpageSize = 10
  569. }else{
  570. // 刷新列表
  571. let count = 0
  572. this.productList.forEach(item => {
  573. count += item.length
  574. })
  575. this.hotProductpageSize = count||10
  576. }
  577. this.getProductList(flag)
  578. },
  579. getProductList(flag){
  580. this.status = "loading"
  581. const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_storeShelf.dealerSn : ''
  582. // 获取推荐产品
  583. getShopProductList({pageNo:this.hotProductPageNo,pageSize:this.hotProductpageSize,hotFlag:1, status: 1, dealerSn: dealerSn}).then(res => {
  584. if(res.status == 200){
  585. const list = res.data ? res.data.list : []
  586. list.map(item=>{
  587. const a = item.shopPromoProduct
  588. if(a){
  589. item.promoType = a.promoType
  590. item.resultValue = a.resultValue
  591. item.conditionValue = a.conditionValue
  592. item.discountType = a.discountType
  593. item.promoProductSn = a.promoProductSn
  594. item.promoSn = a.promoSn
  595. item.orginPrice = item.price
  596. // 特价
  597. if(item.promoType=='PROMO_PROD'){
  598. item.price = item.conditionValue
  599. }
  600. }
  601. item.priceStr = Number(item.price).toFixed(2).toString().split('.')
  602. delete item.shopPromoProduct
  603. })
  604. if(flag!=1){
  605. this.productList.push(list)
  606. }else{
  607. // 刷新
  608. this.productList = [list]
  609. }
  610. this.status = res.data.count>=this.list.length ? "nomore" : 'loadmore'
  611. // 判断是否最后一页
  612. const maxPages = Math.ceil(res.data.count / 10)
  613. this.totalhotPage = maxPages
  614. this.status = this.hotProductPageNo >= maxPages ? "nomore" : 'loadmore'
  615. this.noDataText = this.status == 'nomore' ? '没有更多了' : '更多商品'
  616. }else{
  617. this.status = "nomore"
  618. this.noDataText = res.message || '没有更多了'
  619. }
  620. })
  621. },
  622. // 获取上方滚动扫描记录
  623. getScrollLog(){
  624. scanVinLogQueryRoll({pageNo:1,pageSize:50}).then(res => {
  625. this.list = res.data.list || []
  626. this.list.map(item => {
  627. item.placeText = item.userName + '刚刚扫描了一个VIN'
  628. })
  629. })
  630. },
  631. // 获取当前门店扫描记录
  632. getVinLog(){
  633. this.vinList = []
  634. this.status = "loading"
  635. // VISITOR:游客,EMPLOYEE:雇员
  636. getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
  637. this.vinList = res.data&&res.data.list || []
  638. this.vinList = this.vinList.filter(item => item.vinCode)
  639. this.status = 'nomore'
  640. })
  641. },
  642. // tab单击
  643. beforeSwitch(index){
  644. const row = this.$store.state.vuex_tabBarList[index] // 当前tab
  645. const isNoAuth = this.userInfo ? this.userInfo.sysUserFlag == '0' : false // 是否认证门店
  646. return clickTab(row,this.hasLogin,isNoAuth,this.vuex_vinScanNums < this.vuex_scanMaxNums)
  647. },
  648. // 去搜索产品
  649. toSearch(event){
  650. if(this.hasLogin){
  651. // 游客去认证
  652. if(this.userInfo.sysUserFlag == '0'){
  653. toAuthStore()
  654. }else{
  655. uni.navigateTo({
  656. url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
  657. })
  658. }
  659. }else{
  660. toLogin()
  661. }
  662. },
  663. // 轮播图片
  664. getCarousel(flag){
  665. this.carouselList = []
  666. // 获取所有促销活动数据
  667. shopBannerList({promoFlag:flag}).then(res => {
  668. if(res.status == 200){
  669. res.data&&res.data.map(item => {
  670. item.image = item.imageUrl
  671. })
  672. this.carouselList = res.data
  673. }
  674. })
  675. },
  676. // 快速导航单击
  677. onNavFun(item){
  678. if(item.auth){
  679. // 非游客
  680. if(this.userInfo.sysUserFlag == '1'){
  681. // 编码取货
  682. if(item.url=='openTakeGood1'){
  683. this.openTakeGood(1)
  684. }
  685. // 扫码取货
  686. if(item.url=='openTakeGood0'){
  687. this.openTakeGood(0)
  688. }
  689. }else{
  690. // 去认证
  691. toAuthStore()
  692. }
  693. }else{
  694. toLogin()
  695. }
  696. },
  697. // 获取数据字典
  698. getListLookUp() {
  699. const _this = this;
  700. listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
  701. if (res.status == 200) {
  702. _this.$store.state.vuex_allLookUp = res.data;
  703. }
  704. });
  705. },
  706. // 或某一项字典列表,参数code
  707. getLookUpList(code, vuexKey) {
  708. getLookUpDatas({ type: code }).then(res => {
  709. if (res.status == 200) {
  710. this.$store.state[vuexKey] = res.data || [];
  711. }
  712. });
  713. },
  714. // 获取最大扫描数
  715. getMaxQty(){
  716. getScanGetMaxQty().then(res => {
  717. this.scanMaxNums = res.data || 10
  718. this.$store.state.vuex_scanMaxNums = this.scanMaxNums
  719. })
  720. },
  721. // 获取最新申请门店
  722. findLastApply(){
  723. const mobile = this.userInfo.mobile
  724. this.$store.dispatch('getSotreAuth',mobile)
  725. },
  726. // 知道审核不通过
  727. toKnow(){
  728. uni.showLoading({
  729. title: "正在提交"
  730. })
  731. xprhStoreApplyRead({sn:this.storeApply.applySn}).then(res => {
  732. if(res.status == 200){
  733. this.findLastApply()
  734. }
  735. uni.hideLoading()
  736. })
  737. },
  738. // 待取货数量合计
  739. shelfGetTotalWaitQty(){
  740. shelfGetTotalWaitQty({billState:'WAIT'}).then(res => {
  741. if(res.status == 200){
  742. this.orderTodo = res.data;
  743. }
  744. })
  745. },
  746. // 货架订单列表
  747. toOrder(){
  748. if(this.hasShelf){
  749. uni.navigateTo({
  750. url: "/pagesA/digitalShelf/orderList"
  751. })
  752. }else{
  753. uni.showToast({
  754. icon:'none',
  755. title: '门店没有关联数字货架,无法使用此功能!'
  756. })
  757. }
  758. },
  759. // 显示购物车tab
  760. showCatTab(){
  761. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
  762. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  763. if(catIndex<0 && videoIndex >= 0){
  764. // 替换视频为购物车
  765. this.$store.state.vuex_tabBarList.splice(videoIndex,1,{
  766. "pagePath": "/pages/cart/index",
  767. "iconPath": "/static/tab/tab_cart_normal.png",
  768. "selectedIconPath": "/static/tab/tab_cart_pressed.png",
  769. "text": "购物车",
  770. 'customIcon': false,
  771. 'count': this.$store.state.vuex_cartTotal,
  772. 'isDot': false
  773. })
  774. }
  775. // 购物车已存在
  776. if(catIndex>=0){
  777. this.$store.state.vuex_tabBarList[catIndex].count = this.$store.state.vuex_cartTotal
  778. }
  779. },
  780. // 显示视频tab,隐藏购物车
  781. showVideoTab(){
  782. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
  783. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  784. if(videoIndex<0 && catIndex >= 0){
  785. // 替换购物车为视频
  786. this.$store.state.vuex_tabBarList.splice(catIndex,1,{
  787. "pagePath": "/pages/videos/index",
  788. "iconPath": "/static/tab/tab_video_normal.png",
  789. "selectedIconPath": "/static/tab/tab_video_pressed.png",
  790. "text": "视频",
  791. 'customIcon': false,
  792. })
  793. }
  794. },
  795. // 显示促销模块
  796. showPromoTab(){
  797. // 添加促销模块
  798. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  799. if(promoIndex<0){
  800. this.$store.state.vuex_tabBarList.splice(1,0,{
  801. "pagePath": "/pages/promo/index",
  802. "iconPath": "/static/tab/tab_promo_normal.png",
  803. "selectedIconPath": "/static/tab/tab_promo_pressed.png",
  804. "text": "促销",
  805. 'customIcon': false,
  806. })
  807. }
  808. // 居中透出显示扫描按钮
  809. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  810. if(scanTab){
  811. scanTab.iconPath = "/static/tab/tab_scan_mid.png"
  812. scanTab.midButton = true
  813. }
  814. },
  815. // 隐藏促销模块
  816. hidePromoTab(){
  817. // 删除促销模块
  818. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  819. if(promoIndex > -1){
  820. this.$store.state.vuex_tabBarList.splice(promoIndex,1)
  821. }
  822. // 扫描按钮不局中
  823. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  824. if(scanTab){
  825. scanTab.iconPath = "/static/tab/tab_scan_normal.png"
  826. scanTab.midButton = false
  827. }
  828. },
  829. // 查询是有红包活动
  830. getRedPacketRule(){
  831. findCurrentRewardRule().then(res => {
  832. this.$store.state.vuex_rewardRule = res.data;
  833. // 商城未开通时调用
  834. if(res.data && !this.hasShopiing){
  835. this.getRedScroll()
  836. }
  837. })
  838. },
  839. // 红包奖励信息
  840. getRedScroll(){
  841. getRewardRollList({pageNo:1,pageSize:50}).then(res => {
  842. this.slist = res.data || []
  843. this.slist.map(item => {
  844. item.placeText = item.userName + '刚刚得到了'+item.totalRewardAmount+'元 红包奖励'
  845. })
  846. })
  847. },
  848. // 获取保证金金额
  849. getShelfBWPayRecord(){
  850. const data = this.$store.state.vuex_storeShelf
  851. shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
  852. console.log(res,'获取保证金金额')
  853. this.bondRecord = res.data
  854. })
  855. },
  856. // 保证金支付
  857. toPayBondAmount(){},
  858. openTakeGood(index){
  859. // 已有数字货架
  860. if(this.hasShelf){
  861. this.clickAction(index)
  862. }else{
  863. uni.showToast({
  864. icon:'none',
  865. title: '门店没有关联数字货架,无法使用此功能!'
  866. })
  867. }
  868. },
  869. // 选择取货方式
  870. clickAction(index){
  871. const shelfSn = this.hasShelf.shelfSn
  872. const _this = this
  873. // 扫描
  874. if(index == 0){
  875. uni.scanCode({
  876. success: function (ret) {
  877. const params = {
  878. codeType: ret.scanType == 'QR_CODE' ? 0 : 1
  879. }
  880. // 二维码
  881. if(ret.scanType == 'QR_CODE'){
  882. const result = ret.result.split("&")
  883. params.productSn = result[2] // 产品编码sn
  884. }else{
  885. params.qrCode = ret.result
  886. }
  887. uni.showLoading({
  888. title: "正在查询产品..."
  889. })
  890. // 确认取货
  891. getProductfindByScanCode(params).then(res => {
  892. if(res.status == 200 && res.data){
  893. if(res.data.currentInven){
  894. const billSource = ret.scanType == 'QR_CODE' ? 'qr_code': 'bar_code'
  895. const retData = Object.assign({shelfSn: shelfSn, billSource: billSource},res.data)
  896. _this.$store.state.vuex_tempData = retData
  897. uni.navigateTo({
  898. url: '/pagesA/queryByCode/confirmQh'
  899. })
  900. }else{
  901. uni.showModal({
  902. title: '提示',
  903. content: '产品库存为0,无法取货!',
  904. confirmText: '好的',
  905. showCancel: false
  906. })
  907. }
  908. }else{
  909. uni.showModal({
  910. title: '提示',
  911. content: '产品不属于此货架,请重新扫描!',
  912. confirmText: '好的',
  913. showCancel: false
  914. })
  915. }
  916. uni.hideLoading()
  917. })
  918. }
  919. });
  920. }else{
  921. // 按编码搜索
  922. uni.navigateTo({
  923. url: '/pagesA/queryByCode/queryByCode'
  924. })
  925. }
  926. },
  927. // 单击banner
  928. clickBanner(index){
  929. clickBannerList(this.imgList[index],this.hasLogin,this.userInfo&&this.userInfo.sysUserFlag == '1')
  930. },
  931. // 查看扫描VIN记录
  932. toAllRecord(){
  933. if(this.hasLogin){
  934. uni.navigateTo({
  935. url: "/pagesA/vinRecord/vinRecord"
  936. })
  937. }else{
  938. toLogin()
  939. }
  940. },
  941. // 查看用户信息
  942. toUser(){
  943. if(this.hasLogin){
  944. if(this.userInfo.sysUserFlag == '1'){
  945. // 用户详细信息
  946. uni.navigateTo({
  947. url: '/pages/personData/personData'
  948. })
  949. }else{
  950. // 或 门店认证
  951. this.authStore()
  952. }
  953. }else{
  954. toLogin()
  955. }
  956. },
  957. // 选择配件
  958. toChoosePart(item){
  959. item.text = item.modelInfo
  960. uni.navigateTo({
  961. url: "/pagesA/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))+'&type=log'
  962. })
  963. },
  964. }
  965. }
  966. </script>
  967. <style lang="less">
  968. page{
  969. background-color: #ffffff;
  970. }
  971. .bg-0{
  972. position: relative;
  973. > view{
  974. z-index:1;
  975. position: relative;
  976. }
  977. &::after{
  978. /* 这个伪类的作用就是一个圆弧的背景色 */
  979. width: 130%;
  980. height: 30vh;
  981. position: absolute;
  982. /*设置水平居中*/
  983. left: -15%;
  984. /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
  985. top: 0;
  986. /*层叠顺序,最底层显示*/
  987. content: '';
  988. /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
  989. background: linear-gradient(to bottom, #86defa, #ffffff);
  990. }
  991. }
  992. .bg-1{
  993. background-image: linear-gradient(#86defa 0%,#cdeff9 20%,#ffffff 30%);
  994. }
  995. .content {
  996. margin: 0;
  997. padding: 0;
  998. display: flex;
  999. flex-direction: column;
  1000. .content-body{
  1001. flex-grow: 1;
  1002. }
  1003. .header-box{
  1004. z-index: 5;
  1005. padding: 0em 1em;
  1006. background: #066cff;
  1007. .title{
  1008. padding: 0;
  1009. }
  1010. .version{
  1011. color: #FFEB3B;
  1012. font-size: 0.8em;
  1013. margin-left: 1em;
  1014. }
  1015. }
  1016. .headerFixed{
  1017. padding: 0 0.5rem;
  1018. width: 100%;
  1019. z-index: 10;
  1020. left: 0;
  1021. top:0;
  1022. position: fixed;
  1023. background: #066cff;
  1024. /deep/ .uni-searchbar{
  1025. padding: 0;
  1026. .uni-searchbar__box{
  1027. height: 30px;
  1028. }
  1029. }
  1030. }
  1031. .cbody{
  1032. flex-grow: 1;
  1033. overflow-y: auto;
  1034. overflow-x: hidden;
  1035. .notices{
  1036. padding: 0.5em 0 0;
  1037. font-size: 0.9em;
  1038. margin-top: 0.5rem;
  1039. view{
  1040. color: #ffaf46;
  1041. flex-grow: 1;
  1042. }
  1043. .text{
  1044. color: #ffffff;
  1045. margin-left: 1em;
  1046. }
  1047. }
  1048. .pa-box{
  1049. background: #fff;
  1050. border-radius: 6px;
  1051. margin: 10px 0;
  1052. padding: 10px 0;
  1053. border: 1px solid #eee;
  1054. }
  1055. .product-box{
  1056. margin: 10px 0;
  1057. }
  1058. .ptype-nav{
  1059. position: relative;
  1060. .indicator-dots{
  1061. width: 100%;
  1062. height: 3px;
  1063. display: flex;
  1064. align-items: center;
  1065. justify-content: center;
  1066. position: absolute;
  1067. left: 0;
  1068. bottom:5px;
  1069. }
  1070. .indicator-dots > view{
  1071. width: 10px;
  1072. height: 3px;
  1073. background: #e7e7e7;
  1074. display: inline-block;
  1075. }
  1076. .indicator-dots >.indicator-dots-active{
  1077. background: #00aaff;
  1078. }
  1079. }
  1080. }
  1081. .body-box{
  1082. padding: 0em 1em 0.8em;
  1083. z-index: 4;
  1084. .banner{
  1085. margin-top: 20rpx;
  1086. }
  1087. .action-button{
  1088. padding:40upx 0 0 0;
  1089. justify-content: space-between;
  1090. > view{
  1091. display: flex;
  1092. align-items: center;
  1093. color: #fff;
  1094. border-radius: 10rpx;
  1095. width: 49%;
  1096. padding: 6rpx 0;
  1097. box-shadow: 0rem 0.3rem 0.5rem #d9dada;
  1098. }
  1099. .f1{
  1100. background: #2196f3;
  1101. }
  1102. .f2{
  1103. background: #FF9800;
  1104. }
  1105. .icons{
  1106. font-size: 50rpx;
  1107. color: #fff;
  1108. width: 80rpx;
  1109. height: 80rpx;
  1110. text-align:center;
  1111. display: flex;
  1112. align-items: center;
  1113. flex-direction: column;
  1114. justify-content: center;
  1115. }
  1116. .tits{
  1117. font-size:28rpx;
  1118. }
  1119. }
  1120. }
  1121. .body-box1{
  1122. padding: 0em 10px 0.8em;
  1123. }
  1124. .bg-blue{
  1125. position: relative;
  1126. z-index: 1;
  1127. > view{
  1128. z-index: 100;
  1129. position: relative;
  1130. }
  1131. &::after{
  1132. /* 这个伪类的作用就是一个圆弧的背景色 */
  1133. width: 130%;
  1134. height: 100%;
  1135. position: absolute;
  1136. /*设置水平居中*/
  1137. left: -15%;
  1138. /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
  1139. top: -10%;
  1140. /*层叠顺序,最底层显示*/
  1141. content: '';
  1142. border-radius: 0 0 50% 50%;
  1143. /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
  1144. background: linear-gradient(to bottom, #066cff, #056bf9);
  1145. }
  1146. .userCard{
  1147. position:relative;
  1148. left:0;
  1149. bottom:-0.8rem;
  1150. padding: 0.5rem;
  1151. background: #fff;
  1152. border-radius: 0.8rem;
  1153. box-shadow: 0rem 0.3rem 0.5rem #bcdede;
  1154. .userCard-info{
  1155. flex-grow:1;
  1156. > view{
  1157. &:last-child{
  1158. margin-left: 0.5em;
  1159. line-height: 1.5em;
  1160. .user-name{
  1161. font-size: 1rem;
  1162. }
  1163. >view{
  1164. padding: 0.2em;
  1165. }
  1166. }
  1167. }
  1168. .user-info{
  1169. flex-grow:1;
  1170. }
  1171. }
  1172. .user-rz{
  1173. font-size: 0.8rem;
  1174. color:#58aff5;
  1175. }
  1176. }
  1177. }
  1178. .shopping{
  1179. padding: 0;
  1180. .notices{
  1181. padding: 0.5em 10px 0;
  1182. margin-top: 0.2rem;
  1183. .text{
  1184. color: #066cff;
  1185. }
  1186. }
  1187. }
  1188. .list-box{
  1189. padding: 0 1em;
  1190. overflow: auto;
  1191. .des{
  1192. text-align: center;
  1193. padding: 1em 0;
  1194. color: #999;
  1195. font-size: 0.8em;
  1196. }
  1197. }
  1198. }
  1199. </style>