index.vue 35 KB

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