index.vue 30 KB

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