index.vue 34 KB

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