index.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228
  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, queryBalancePaymentParam } 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. watch:{
  380. hasShopiing(a,b){
  381. if(a!=b&&a){
  382. // 获取抵扣支付权限
  383. this.getPayBalanceAuth()
  384. }
  385. }
  386. },
  387. methods: {
  388. // 去认证
  389. authStore(){
  390. uni.navigateTo({
  391. url: '/pages/storeManage/storeAuth'
  392. })
  393. },
  394. // 初始化页面
  395. pageInit(flag){
  396. // 已登录
  397. if(this.hasLogin){
  398. // 已认证用户
  399. if(this.userInfo.sysUserFlag == '1'){
  400. // 查询是否有数字货架
  401. this.getStoreShelf(flag)
  402. // 如果已开通商城
  403. if(this.hasShopiing){
  404. // 获取抵扣支付权限
  405. this.getPayBalanceAuth()
  406. }
  407. }else{// 游客
  408. this.getHasShopping()
  409. // 获取扫描次数
  410. this.$store.dispatch("getScanNums")
  411. // 获取最大扫描次数
  412. this.getMaxQty()
  413. // 查询门店认证信息
  414. this.findLastApply()
  415. // 获取扫描记录
  416. this.getVinLog()
  417. }
  418. }else{
  419. // 未登录
  420. this.getHasShopping()
  421. // 隐藏促销模块
  422. this.hidePromoTab()
  423. }
  424. },
  425. // 查询是否支持数字货架, flag: true 再次刷新,false 首次加载,只加载一次
  426. getStoreShelf(flag){
  427. findStoreShelf().then(res => {
  428. this.$store.state.vuex_storeShelf = res.data;
  429. // 有数字货架
  430. if(res.data){
  431. // 只需加载一次
  432. if(flag==0){
  433. // 更新用户信息
  434. this.getCurrUserInfo()
  435. // 保证金查询
  436. this.getShelfBWPayRecord()
  437. // 获取订单信息
  438. this.shelfGetTotalWaitQty()
  439. // 获取价格权限配置
  440. this.getPriceCofig()
  441. }
  442. }else{
  443. // 没有数字货架,隐藏促销模块
  444. this.hidePromoTab()
  445. }
  446. this.getHasShopping()
  447. })
  448. },
  449. // 最新用户信息
  450. getCurrUserInfo(){
  451. getCurrUserInfo().then(res => {
  452. if(res.data){
  453. this.$store.state.vuex_userInfo.userNameCN = res.data.name;
  454. this.$store.state.vuex_userInfo.mobile = res.data.mobile;
  455. this.$store.state.vuex_userInfo.adminId = res.data.id;
  456. this.$store.state.vuex_userPhoto = res.data.photo;
  457. uni.setStorageSync('userPhoto', res.data.photo);
  458. }
  459. })
  460. },
  461. // 获取价格配置
  462. getPriceCofig(){
  463. const data = this.$store.state.vuex_storeShelf
  464. queryQplsConfig({shelfSn: data.shelfSn}).then(res => {
  465. this.$store.state.vuex_configPrice = res.data || null
  466. })
  467. },
  468. // 商城信息, flag: true 再次刷新,false 只加载一次
  469. getHasShopping(flag){
  470. getShopStatus().then(res => {
  471. const hasShopiing = res.data && res.data.paramValue == 1
  472. this.$store.state.vuex_showShopAuth = hasShopiing
  473. // 经销商开启商城
  474. if(hasShopiing){
  475. // 判断员工是否开启商城
  476. this.getShopUserStatus(flag)
  477. }else{
  478. this.hasShopiing = false
  479. this.$store.state.vuex_hasShopiing = this.hasShopiing
  480. // 没有商城
  481. this.showNoShopPage(flag)
  482. // 查询红包活动
  483. this.getRedPacketRule()
  484. }
  485. })
  486. },
  487. // 员工用户是否开启商城
  488. getShopUserStatus(flag){
  489. const data = this.$store.state.vuex_storeShelf
  490. if(data){
  491. getShopUserParam({shelfSn: data.shelfSn}).then(res=>{
  492. const item = res.data
  493. this.hasShopiing = item && item.paramMap && item.paramMap.mall_flag && item.paramMap.mall_flag.paramValue == 1
  494. this.$store.state.vuex_hasShopiing = this.hasShopiing
  495. if(this.hasShopiing){
  496. // 判断员工是否开启商城
  497. this.showShopPage(flag)
  498. }else{
  499. this.showNoShopPage(flag)
  500. }
  501. // 查询红包活动
  502. this.getRedPacketRule()
  503. })
  504. }else{
  505. this.showNoShopPage(flag)
  506. // 查询红包活动
  507. this.getRedPacketRule()
  508. }
  509. },
  510. // 抵扣支付权限
  511. getPayBalanceAuth(){
  512. queryBalancePaymentParam({userId:this.userInfo&&this.userInfo.userid}).then(res => {
  513. const data = res.data[0]
  514. this.$store.state.vuex_showBalanceAuth = data && data.storeParamList&&data.storeParamList[0]&&data.storeParamList[0].paramValue == 1
  515. })
  516. },
  517. // 显示开通商城的页面
  518. showShopPage(flag){
  519. // 隐藏tab 视频,显示tab购物车
  520. if(this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1'){
  521. // 显示促销模块
  522. this.showPromoTab()
  523. this.cartCount()
  524. }else{
  525. this.$store.state.vuex_cartTotal = 0
  526. this.showCatTab()
  527. }
  528. // 获取轮播数据,包括促销活动
  529. this.getCarousel(1)
  530. // 商品分类
  531. this.getGoodType(flag)
  532. // 获取推荐产品
  533. this.getHotProductList(flag)
  534. },
  535. // 显示未没有开通商城的界面
  536. showNoShopPage(flag){
  537. this.productTypeList = []
  538. this.productList = []
  539. // 获取轮播数据,包括促销活动
  540. this.getCarousel(0)
  541. // 隐藏促销模块
  542. this.hidePromoTab()
  543. // 隐藏tab 购物车,显示tab视频
  544. this.showVideoTab()
  545. // 滚动扫描记录
  546. this.getScrollLog()
  547. // 获取扫描记录
  548. if(this.hasLogin){
  549. this.getVinLog()
  550. }
  551. },
  552. // 购物车数量
  553. cartCount(){
  554. getCartCount({}).then(res => {
  555. if(res.status == 200){
  556. this.$store.state.vuex_cartTotal = res.data?res.data.qty:0
  557. this.showCatTab()
  558. }
  559. })
  560. },
  561. // 商品一级分类
  562. getGoodType(flag){
  563. this.productTypeList = []
  564. getShopCategory({categoryLevel: 1}).then(res => {
  565. const list = res.data || []
  566. const ret = []
  567. list.forEach(item => {
  568. ret.push({
  569. id: item.id,
  570. categorySn: item.categorySn,
  571. auth: true,
  572. ignoreAuth: false,
  573. name: item.categoryName,
  574. icon: item.iconUrl,
  575. url: '/pagesB/shopiing/shopProduct?clzId='+item.categorySn+'&clzName='+item.categoryName+"&shopCategoryCount="+item.shopCategoryCount+'&shopProductCount='+item.shopProductCount,
  576. target: 'page'
  577. })
  578. })
  579. // 转成二维数组
  580. for(let i=0;i<ret.length;i=i+8){
  581. this.productTypeList.push({
  582. id: 'swiper-item-'+i,
  583. list: ret.slice(i,(i+8)>ret.length?ret.length:(i+8))
  584. })
  585. }
  586. })
  587. },
  588. // 商品列表查询
  589. getHotProductList(flag){
  590. console.log(flag)
  591. this.hotProductPageNo = 1
  592. // 不是show 刷新列表
  593. if(flag!=1){
  594. this.productList = []
  595. this.hotProductpageSize = 10
  596. }else{
  597. // 刷新列表
  598. let count = 0
  599. this.productList.forEach(item => {
  600. count += item.length
  601. })
  602. this.hotProductpageSize = count||10
  603. }
  604. this.getProductList(flag)
  605. },
  606. getProductList(flag){
  607. this.status = "loading"
  608. const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_storeShelf.dealerSn : ''
  609. // 获取推荐产品
  610. getShopProductList({pageNo:this.hotProductPageNo,pageSize:this.hotProductpageSize,hotFlag:1, status: 1, dealerSn: dealerSn}).then(res => {
  611. if(res.status == 200){
  612. const list = res.data ? res.data.list : []
  613. list.map(item=>{
  614. const a = item.shopPromoProduct
  615. if(a){
  616. item.promoType = a.promoType
  617. item.resultValue = a.resultValue
  618. item.conditionValue = a.conditionValue
  619. item.discountType = a.discountType
  620. item.promoProductSn = a.promoProductSn
  621. item.promoSn = a.promoSn
  622. item.orginPrice = item.price
  623. // 特价
  624. if(item.promoType=='PROMO_PROD'){
  625. item.price = item.conditionValue
  626. }
  627. }
  628. item.priceStr = Number(item.price).toFixed(2).toString().split('.')
  629. })
  630. if(flag!=1){
  631. this.productList.push(list)
  632. }else{
  633. // 刷新
  634. this.productList = [list]
  635. }
  636. this.status = res.data.count>=this.list.length ? "nomore" : 'loadmore'
  637. // 判断是否最后一页
  638. const maxPages = Math.ceil(res.data.count / 10)
  639. this.totalhotPage = maxPages
  640. this.status = this.hotProductPageNo >= maxPages ? "nomore" : 'loadmore'
  641. this.noDataText = this.status == 'nomore' ? '没有更多了' : '更多商品'
  642. }else{
  643. this.status = "nomore"
  644. this.noDataText = res.message || '没有更多了'
  645. }
  646. })
  647. },
  648. // 获取上方滚动扫描记录
  649. getScrollLog(){
  650. scanVinLogQueryRoll({pageNo:1,pageSize:50}).then(res => {
  651. this.list = res.data.list || []
  652. this.list.map(item => {
  653. item.placeText = item.userName + '刚刚扫描了一个VIN'
  654. })
  655. })
  656. },
  657. // 获取当前门店扫描记录
  658. getVinLog(){
  659. this.vinList = []
  660. this.status = "loading"
  661. // VISITOR:游客,EMPLOYEE:雇员
  662. getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
  663. this.vinList = res.data&&res.data.list || []
  664. this.vinList = this.vinList.filter(item => item.vinCode)
  665. this.status = 'nomore'
  666. })
  667. },
  668. // tab单击
  669. beforeSwitch(index){
  670. const row = this.$store.state.vuex_tabBarList[index] // 当前tab
  671. const isNoAuth = this.userInfo ? this.userInfo.sysUserFlag == '0' : false // 是否认证门店
  672. return clickTab(row,this.hasLogin,isNoAuth,this.vuex_vinScanNums < this.vuex_scanMaxNums)
  673. },
  674. // 去搜索产品
  675. toSearch(event){
  676. if(this.hasLogin){
  677. // 游客去认证
  678. if(this.userInfo.sysUserFlag == '0'){
  679. toAuthStore()
  680. }else{
  681. uni.navigateTo({
  682. url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
  683. })
  684. }
  685. }else{
  686. toLogin()
  687. }
  688. },
  689. // 轮播图片
  690. getCarousel(flag){
  691. this.carouselList = []
  692. // 获取所有促销活动数据
  693. shopBannerList({promoFlag:flag}).then(res => {
  694. if(res.status == 200){
  695. res.data&&res.data.map(item => {
  696. item.image = item.imageUrl
  697. })
  698. this.carouselList = res.data
  699. }
  700. })
  701. },
  702. // 快速导航单击
  703. onNavFun(item){
  704. if(item.auth){
  705. // 非游客
  706. if(this.userInfo.sysUserFlag == '1'){
  707. // 编码取货
  708. if(item.url=='openTakeGood1'){
  709. this.openTakeGood(1)
  710. }
  711. // 扫码取货
  712. if(item.url=='openTakeGood0'){
  713. this.openTakeGood(0)
  714. }
  715. }else{
  716. // 去认证
  717. toAuthStore()
  718. }
  719. }else{
  720. toLogin()
  721. }
  722. },
  723. // 获取数据字典
  724. getListLookUp() {
  725. const _this = this;
  726. listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
  727. if (res.status == 200) {
  728. _this.$store.state.vuex_allLookUp = res.data;
  729. }
  730. });
  731. },
  732. // 或某一项字典列表,参数code
  733. getLookUpList(code, vuexKey) {
  734. getLookUpDatas({ type: code }).then(res => {
  735. if (res.status == 200) {
  736. this.$store.state[vuexKey] = res.data || [];
  737. }
  738. });
  739. },
  740. // 获取最大扫描数
  741. getMaxQty(){
  742. getScanGetMaxQty().then(res => {
  743. this.scanMaxNums = res.data || 10
  744. this.$store.state.vuex_scanMaxNums = this.scanMaxNums
  745. })
  746. },
  747. // 获取最新申请门店
  748. findLastApply(){
  749. const mobile = this.userInfo.mobile
  750. this.$store.dispatch('getSotreAuth',mobile)
  751. },
  752. // 知道审核不通过
  753. toKnow(){
  754. uni.showLoading({
  755. title: "正在提交"
  756. })
  757. xprhStoreApplyRead({sn:this.storeApply.applySn}).then(res => {
  758. if(res.status == 200){
  759. this.findLastApply()
  760. }
  761. uni.hideLoading()
  762. })
  763. },
  764. // 待取货数量合计
  765. shelfGetTotalWaitQty(){
  766. shelfGetTotalWaitQty({billState:'WAIT'}).then(res => {
  767. if(res.status == 200){
  768. this.orderTodo = res.data;
  769. }
  770. })
  771. },
  772. // 货架订单列表
  773. toOrder(){
  774. if(this.hasShelf){
  775. uni.navigateTo({
  776. url: "/pagesA/digitalShelf/orderList"
  777. })
  778. }else{
  779. uni.showToast({
  780. icon:'none',
  781. title: '门店没有关联数字货架,无法使用此功能!'
  782. })
  783. }
  784. },
  785. // 显示购物车tab
  786. showCatTab(){
  787. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '我的')
  788. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  789. if(catIndex<0 && videoIndex >= 0){
  790. // 替换视频为购物车
  791. this.$store.state.vuex_tabBarList.splice(videoIndex,0,{
  792. "pagePath": "/pages/cart/index",
  793. "iconPath": "/static/tab/tab_cart_normal.png",
  794. "selectedIconPath": "/static/tab/tab_cart_pressed.png",
  795. "text": "购物车",
  796. 'customIcon': false,
  797. 'count': this.$store.state.vuex_cartTotal,
  798. 'isDot': false
  799. })
  800. }
  801. // 购物车已存在
  802. if(catIndex>=0){
  803. this.$store.state.vuex_tabBarList[catIndex].count = this.$store.state.vuex_cartTotal
  804. }
  805. },
  806. // 显示视频tab,隐藏购物车
  807. showVideoTab(){
  808. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
  809. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  810. if(videoIndex<0 && catIndex >= 0){
  811. // 替换购物车为视频
  812. // this.$store.state.vuex_tabBarList.splice(catIndex,1,{
  813. // "pagePath": "/pages/videos/index",
  814. // "iconPath": "/static/tab/tab_video_normal.png",
  815. // "selectedIconPath": "/static/tab/tab_video_pressed.png",
  816. // "text": "视频",
  817. // 'customIcon': false,
  818. // })
  819. this.$store.state.vuex_tabBarList.splice(catIndex,1)
  820. }
  821. },
  822. // 显示促销模块
  823. showPromoTab(){
  824. // 添加促销模块
  825. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  826. if(promoIndex<0){
  827. this.$store.state.vuex_tabBarList.splice(1,0,{
  828. "pagePath": "/pages/promo/index",
  829. "iconPath": "/static/tab/tab_promo_normal.png",
  830. "selectedIconPath": "/static/tab/tab_promo_pressed.png",
  831. "text": "促销",
  832. 'customIcon': false,
  833. })
  834. }
  835. // 居中透出显示扫描按钮
  836. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  837. if(scanTab){
  838. scanTab.iconPath = "/static/tab/tab_scan_mid.png"
  839. scanTab.midButton = true
  840. }
  841. },
  842. // 隐藏促销模块
  843. hidePromoTab(){
  844. // 删除促销模块
  845. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  846. if(promoIndex > -1){
  847. this.$store.state.vuex_tabBarList.splice(promoIndex,1)
  848. }
  849. // 扫描按钮不局中
  850. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  851. if(scanTab){
  852. scanTab.iconPath = "/static/tab/tab_scan_normal.png"
  853. scanTab.midButton = false
  854. }
  855. },
  856. // 查询是有红包活动
  857. getRedPacketRule(){
  858. findCurrentRewardRule().then(res => {
  859. this.$store.state.vuex_rewardRule = res.data;
  860. // 商城未开通时调用
  861. if(res.data && !this.hasShopiing){
  862. this.getRedScroll()
  863. }
  864. })
  865. },
  866. // 红包奖励信息
  867. getRedScroll(){
  868. getRewardRollList({pageNo:1,pageSize:50}).then(res => {
  869. this.slist = res.data || []
  870. this.slist.map(item => {
  871. item.placeText = item.userName + '刚刚得到了'+item.totalRewardAmount+'元 红包奖励'
  872. })
  873. })
  874. },
  875. // 获取保证金金额
  876. getShelfBWPayRecord(){
  877. const data = this.$store.state.vuex_storeShelf
  878. shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
  879. console.log(res,'获取保证金金额')
  880. this.bondRecord = res.data
  881. })
  882. },
  883. // 保证金支付
  884. toPayBondAmount(){},
  885. openTakeGood(index){
  886. // 已有数字货架
  887. if(this.hasShelf){
  888. this.clickAction(index)
  889. }else{
  890. uni.showToast({
  891. icon:'none',
  892. title: '门店没有关联数字货架,无法使用此功能!'
  893. })
  894. }
  895. },
  896. // 选择取货方式
  897. clickAction(index){
  898. const shelfSn = this.hasShelf.shelfSn
  899. const _this = this
  900. // 扫描
  901. if(index == 0){
  902. uni.scanCode({
  903. success: function (ret) {
  904. const params = {
  905. codeType: ret.scanType == 'QR_CODE' ? 0 : 1
  906. }
  907. // 二维码
  908. if(ret.scanType == 'QR_CODE'){
  909. const result = ret.result.split("&")
  910. params.productSn = result[2] // 产品编码sn
  911. }else{
  912. params.qrCode = ret.result
  913. }
  914. uni.showLoading({
  915. title: "正在查询产品..."
  916. })
  917. // 确认取货
  918. getProductfindByScanCode(params).then(res => {
  919. if(res.status == 200 && res.data){
  920. if(res.data.currentInven){
  921. const billSource = ret.scanType == 'QR_CODE' ? 'qr_code': 'bar_code'
  922. const retData = Object.assign({shelfSn: shelfSn, billSource: billSource},res.data)
  923. _this.$store.state.vuex_tempData = retData
  924. uni.navigateTo({
  925. url: '/pagesA/queryByCode/confirmQh'
  926. })
  927. }else{
  928. uni.showModal({
  929. title: '提示',
  930. content: '产品库存为0,无法取货!',
  931. confirmText: '好的',
  932. showCancel: false
  933. })
  934. }
  935. }else{
  936. uni.showModal({
  937. title: '提示',
  938. content: '产品不属于此货架,请重新扫描!',
  939. confirmText: '好的',
  940. showCancel: false
  941. })
  942. }
  943. uni.hideLoading()
  944. })
  945. }
  946. });
  947. }else{
  948. // 按编码搜索
  949. uni.navigateTo({
  950. url: '/pagesA/queryByCode/queryByCode'
  951. })
  952. }
  953. },
  954. // 单击banner
  955. clickBanner(index){
  956. clickBannerList(this.imgList[index],this.hasLogin,this.userInfo&&this.userInfo.sysUserFlag == '1')
  957. },
  958. // 查看扫描VIN记录
  959. toAllRecord(){
  960. if(this.hasLogin){
  961. uni.navigateTo({
  962. url: "/pagesA/vinRecord/vinRecord"
  963. })
  964. }else{
  965. toLogin()
  966. }
  967. },
  968. // 查看用户信息
  969. toUser(){
  970. if(this.hasLogin){
  971. if(this.userInfo.sysUserFlag == '1'){
  972. // 用户详细信息
  973. uni.navigateTo({
  974. url: '/pages/personData/personData'
  975. })
  976. }else{
  977. // 或 门店认证
  978. this.authStore()
  979. }
  980. }else{
  981. toLogin()
  982. }
  983. },
  984. // 选择配件
  985. toChoosePart(item){
  986. item.text = item.modelInfo
  987. uni.navigateTo({
  988. url: "/pagesA/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))+'&type=log'
  989. })
  990. },
  991. }
  992. }
  993. </script>
  994. <style lang="less">
  995. page{
  996. background-color: #ffffff;
  997. }
  998. .bg-0{
  999. position: relative;
  1000. > view{
  1001. z-index:1;
  1002. position: relative;
  1003. }
  1004. &::after{
  1005. /* 这个伪类的作用就是一个圆弧的背景色 */
  1006. width: 130%;
  1007. height: 30vh;
  1008. position: absolute;
  1009. /*设置水平居中*/
  1010. left: -15%;
  1011. /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
  1012. top: 0;
  1013. /*层叠顺序,最底层显示*/
  1014. content: '';
  1015. /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
  1016. background: linear-gradient(to bottom, #86defa, #ffffff);
  1017. }
  1018. }
  1019. .bg-1{
  1020. background-image: linear-gradient(#86defa 0%,#cdeff9 20%,#ffffff 30%);
  1021. }
  1022. .content {
  1023. margin: 0;
  1024. padding: 0;
  1025. display: flex;
  1026. flex-direction: column;
  1027. .content-body{
  1028. flex-grow: 1;
  1029. }
  1030. .header-box{
  1031. z-index: 5;
  1032. padding: 0em 1em;
  1033. background: #066cff;
  1034. .title{
  1035. padding: 0;
  1036. }
  1037. .version{
  1038. color: #FFEB3B;
  1039. font-size: 0.8em;
  1040. margin-left: 1em;
  1041. }
  1042. }
  1043. .headerFixed{
  1044. padding: 0 0.5rem;
  1045. width: 100%;
  1046. z-index: 10;
  1047. left: 0;
  1048. top:0;
  1049. position: fixed;
  1050. background: #066cff;
  1051. ::v-deep .uni-searchbar{
  1052. padding: 0;
  1053. .uni-searchbar__box{
  1054. height: 30px;
  1055. }
  1056. }
  1057. }
  1058. .cbody{
  1059. flex-grow: 1;
  1060. overflow-y: auto;
  1061. overflow-x: hidden;
  1062. .notices{
  1063. padding: 0.5em 0 0;
  1064. font-size: 0.9em;
  1065. margin-top: 0.5rem;
  1066. view{
  1067. color: #ffaf46;
  1068. flex-grow: 1;
  1069. }
  1070. .text{
  1071. color: #ffffff;
  1072. margin-left: 1em;
  1073. }
  1074. }
  1075. .pa-box{
  1076. background: #fff;
  1077. border-radius: 6px;
  1078. margin: 10px 0;
  1079. padding: 10px 0;
  1080. border: 1px solid #eee;
  1081. }
  1082. .product-box{
  1083. margin: 10px 0;
  1084. }
  1085. .ptype-nav{
  1086. position: relative;
  1087. .indicator-dots{
  1088. width: 100%;
  1089. height: 3px;
  1090. display: flex;
  1091. align-items: center;
  1092. justify-content: center;
  1093. position: absolute;
  1094. left: 0;
  1095. bottom:5px;
  1096. }
  1097. .indicator-dots > view{
  1098. width: 10px;
  1099. height: 3px;
  1100. background: #e7e7e7;
  1101. display: inline-block;
  1102. }
  1103. .indicator-dots >.indicator-dots-active{
  1104. background: #00aaff;
  1105. }
  1106. }
  1107. }
  1108. .body-box{
  1109. padding: 0em 1em 0.8em;
  1110. z-index: 4;
  1111. .banner{
  1112. margin-top: 20rpx;
  1113. }
  1114. .action-button{
  1115. padding:40upx 0 0 0;
  1116. justify-content: space-between;
  1117. > view{
  1118. display: flex;
  1119. align-items: center;
  1120. color: #fff;
  1121. border-radius: 10rpx;
  1122. width: 49%;
  1123. padding: 6rpx 0;
  1124. box-shadow: 0rem 0.3rem 0.5rem #d9dada;
  1125. }
  1126. .f1{
  1127. background: #2196f3;
  1128. }
  1129. .f2{
  1130. background: #FF9800;
  1131. }
  1132. .icons{
  1133. font-size: 50rpx;
  1134. color: #fff;
  1135. width: 80rpx;
  1136. height: 80rpx;
  1137. text-align:center;
  1138. display: flex;
  1139. align-items: center;
  1140. flex-direction: column;
  1141. justify-content: center;
  1142. }
  1143. .tits{
  1144. font-size:28rpx;
  1145. }
  1146. }
  1147. }
  1148. .body-box1{
  1149. padding: 0em 10px 0.8em;
  1150. }
  1151. .bg-blue{
  1152. position: relative;
  1153. z-index: 1;
  1154. > view{
  1155. z-index: 100;
  1156. position: relative;
  1157. }
  1158. &::after{
  1159. /* 这个伪类的作用就是一个圆弧的背景色 */
  1160. width: 130%;
  1161. height: 100%;
  1162. position: absolute;
  1163. /*设置水平居中*/
  1164. left: -15%;
  1165. /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
  1166. top: -10%;
  1167. /*层叠顺序,最底层显示*/
  1168. content: '';
  1169. border-radius: 0 0 50% 50%;
  1170. /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
  1171. background: linear-gradient(to bottom, #066cff, #056bf9);
  1172. }
  1173. .userCard{
  1174. position:relative;
  1175. left:0;
  1176. bottom:-0.8rem;
  1177. padding: 0.5rem;
  1178. background: #fff;
  1179. border-radius: 0.8rem;
  1180. box-shadow: 0rem 0.3rem 0.5rem #bcdede;
  1181. .userCard-info{
  1182. flex-grow:1;
  1183. > view{
  1184. &:last-child{
  1185. margin-left: 0.5em;
  1186. line-height: 1.5em;
  1187. .user-name{
  1188. font-size: 1rem;
  1189. }
  1190. >view{
  1191. padding: 0.2em;
  1192. }
  1193. }
  1194. }
  1195. .user-info{
  1196. flex-grow:1;
  1197. }
  1198. }
  1199. .user-rz{
  1200. font-size: 0.8rem;
  1201. color:#58aff5;
  1202. }
  1203. }
  1204. }
  1205. .shopping{
  1206. padding: 0;
  1207. .notices{
  1208. padding: 0.5em 10px 0;
  1209. margin-top: 0.2rem;
  1210. .text{
  1211. color: #066cff;
  1212. }
  1213. }
  1214. }
  1215. .list-box{
  1216. padding: 0 1em;
  1217. overflow: auto;
  1218. .des{
  1219. text-align: center;
  1220. padding: 1em 0;
  1221. color: #999;
  1222. font-size: 0.8em;
  1223. }
  1224. }
  1225. }
  1226. </style>