index.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114
  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" :iconSize="45" @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-25)*0.5"
  107. :gap="5"
  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" :mid-button-size="80" :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:'#056cd9',
  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:'#ffaa7f',
  248. url:'openTakeGood1',
  249. target: 'fun'
  250. },
  251. {
  252. id:'n3',
  253. auth: this.hasLogin,
  254. icon:'shipin1',
  255. name: '视频教程',
  256. color:'#55aaff',
  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:'#abc4ff',
  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 == '购物车'){
  350. uni.navigateTo({
  351. url:'/pagesB/cart/index',
  352. target: 'page'
  353. })
  354. }
  355. if(row.text == '扫描VIN'){
  356. this.openCamera()
  357. }else{
  358. return true
  359. }
  360. },
  361. // 去搜索产品
  362. toSearch(event){
  363. uni.navigateTo({
  364. url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
  365. })
  366. },
  367. // 获取产品列表
  368. getProductList(){
  369. const cacheList = this.$store.state.vuex_cartList.find(k => k.sn == '693459699332595712')
  370. this.productList = cacheList ? JSON.parse(JSON.stringify(cacheList.list)) : []
  371. },
  372. // 初始化页面
  373. pageInit(flag){
  374. this.carouselList = []
  375. if(this.hasLogin){
  376. // 非游客
  377. if(this.userInfo.sysUserFlag == '1'){
  378. // 查询是否有商城
  379. this.getHasShopping(flag)
  380. }else{
  381. // 游客
  382. // 获取扫描次数
  383. this.$store.dispatch("getScanNums")
  384. // 获取最大扫描次数
  385. this.getMaxQty()
  386. // 查询门店认证信息
  387. this.findLastApply()
  388. // 获取扫描记录
  389. this.getVinLog()
  390. }
  391. }else{
  392. uni.removeStorageSync('token')
  393. }
  394. },
  395. // 轮播图片
  396. getCarousel(){
  397. this.carouselList = []
  398. // 获取所有促销活动数据
  399. promoTerminalList({}).then(res => {
  400. if(res.status == 200){
  401. res.data&&res.data.map(item => {
  402. item.image = item.imageSet&&item.imageSet[0] // 默认取第一张图片
  403. })
  404. // 过滤掉产品促销活动
  405. // this.carouselList = res.data.filter(item => item.content.indexOf("pages/promo/index") < 0)
  406. // 所有数据
  407. this.carouselList = res.data
  408. }
  409. })
  410. },
  411. // 快速导航单击
  412. onNavFun(item){
  413. // 编码取货
  414. if(item.url=='openTakeGood1'){
  415. this.openTakeGood(1)
  416. }
  417. // 扫码取货
  418. if(item.url=='openTakeGood0'){
  419. this.openTakeGood(0)
  420. }
  421. // 产品分类跳转
  422. if(item.url=='ptypeNav'){
  423. uni.navigateTo({
  424. url:'/pagesB/shopiing/searchProduct?clzId='+item.sn+'&clzName='+item.name
  425. })
  426. }
  427. },
  428. // 获取数据字典
  429. getListLookUp() {
  430. const _this = this;
  431. listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
  432. if (res.status == 200) {
  433. _this.$store.state.vuex_allLookUp = res.data;
  434. }
  435. });
  436. },
  437. // 或某一项字典列表,参数code
  438. getLookUpList(code, vuexKey) {
  439. getLookUpDatas({ type: code }).then(res => {
  440. if (res.status == 200) {
  441. this.$store.state[vuexKey] = res.data || [];
  442. }
  443. });
  444. },
  445. // 获取价格配置
  446. getPriceCofig(){
  447. const data = this.$store.state.vuex_storeShelf
  448. queryQplsConfig({shelfSn: data.shelfSn}).then(res => {
  449. this.$store.state.vuex_configPrice = res.data || null
  450. })
  451. },
  452. // 最新用户信息
  453. getCurrUserInfo(){
  454. getCurrUserInfo().then(res => {
  455. if(res.data){
  456. this.$store.state.vuex_userInfo.userNameCN = res.data.name;
  457. this.$store.state.vuex_userInfo.mobile = res.data.mobile;
  458. this.$store.state.vuex_userInfo.adminId = res.data.id;
  459. this.$store.state.vuex_userPhoto = res.data.photo;
  460. uni.setStorageSync('userPhoto', res.data.photo);
  461. }
  462. })
  463. },
  464. // 获取最大扫描数
  465. getMaxQty(){
  466. getScanGetMaxQty().then(res => {
  467. this.scanMaxNums = res.data || 10
  468. this.$store.state.vuex_scanMaxNums = this.scanMaxNums
  469. })
  470. },
  471. // 获取最新申请门店
  472. findLastApply(){
  473. const mobile = this.userInfo.mobile
  474. this.$store.dispatch('getSotreAuth',mobile)
  475. },
  476. // 知道审核不通过
  477. toKnow(){
  478. uni.showLoading({
  479. title: "正在提交"
  480. })
  481. xprhStoreApplyRead({sn:this.storeApply.applySn}).then(res => {
  482. if(res.status == 200){
  483. this.findLastApply()
  484. }
  485. uni.hideLoading()
  486. })
  487. },
  488. // 待取货数量合计
  489. shelfGetTotalWaitQty(){
  490. shelfGetTotalWaitQty({billState:'WAIT'}).then(res => {
  491. if(res.status == 200){
  492. this.orderTodo = res.data;
  493. }
  494. })
  495. },
  496. // 货架订单列表
  497. toOrder(){
  498. if(this.hasShelf){
  499. uni.navigateTo({
  500. url: "/pagesA/digitalShelf/orderList"
  501. })
  502. }else{
  503. uni.showToast({
  504. icon:'none',
  505. title: '门店没有关联数字货架,无法使用此功能!'
  506. })
  507. }
  508. },
  509. // 获取上方滚动扫描记录
  510. getScrollLog(){
  511. scanVinLogQueryRoll({pageNo:1,pageSize:50}).then(res => {
  512. this.list = res.data.list || []
  513. this.list.map(item => {
  514. item.placeText = item.userName + '刚刚扫描了一个VIN'
  515. })
  516. })
  517. },
  518. // 获取当前门店扫描记录
  519. getVinLog(){
  520. this.vinList = []
  521. this.status = "loading"
  522. // VISITOR:游客,EMPLOYEE:雇员
  523. getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
  524. this.vinList = res.data&&res.data.list || []
  525. this.vinList = this.vinList.filter(item => item.vinCode)
  526. this.status = 'nomore'
  527. })
  528. },
  529. // 商城信息, flag: true 再次刷新,false 首次加载
  530. getHasShopping(flag){
  531. if(!flag){
  532. setTimeout(()=>{
  533. this.hasShopiing = true
  534. // 有商城
  535. if(this.hasShopiing){
  536. // 隐藏tab 视频,显示购物车tab
  537. this.showCatTab()
  538. // 商品分类
  539. const list = [
  540. {
  541. id:'0',
  542. sn:'0',
  543. name:'轮胎',
  544. icon:'/static/temp/t1.jpeg',
  545. url: 'ptypeNav',
  546. target: 'fun'
  547. },
  548. {
  549. id:'1',
  550. sn:'1',
  551. name:'滤清器',
  552. icon:'/static/temp/t2.jpeg',
  553. url: 'ptypeNav',
  554. target: 'fun'
  555. },
  556. {
  557. id:'2',
  558. sn:'3',
  559. name:'刹车片',
  560. icon:'/static/temp/t4.jpg',
  561. url: 'ptypeNav',
  562. target: 'fun'
  563. },{
  564. id:'4',
  565. sn:'4',
  566. name:'油品',
  567. icon:'/static/temp/t5.png',
  568. url: 'ptypeNav',
  569. target: 'fun'
  570. },{
  571. id:'5',
  572. sn:'5',
  573. name:'雨刮',
  574. icon:'/static/temp/t11.jpg',
  575. url: 'ptypeNav',
  576. target: 'fun'
  577. },{
  578. id:'6',
  579. sn:'6',
  580. name:'火花塞',
  581. icon:'/static/temp/t6.jpeg',
  582. url: 'ptypeNav',
  583. target: 'fun'
  584. },{
  585. id:'7',
  586. sn:'7',
  587. name:'电火线圈',
  588. icon:'/static/temp/t7.jpg',
  589. url: 'ptypeNav',
  590. target: 'fun'
  591. },{
  592. id:'8',
  593. sn:'8',
  594. name:'照明系列',
  595. icon:'/static/temp/t9.jpg',
  596. url: 'ptypeNav',
  597. target: 'fun'
  598. },{
  599. id:'9',
  600. sn:'9',
  601. name:'空气滤',
  602. icon:'/static/temp/t10.jpg',
  603. url: 'ptypeNav',
  604. target: 'fun'
  605. },{
  606. id:'10',
  607. sn:'10',
  608. name:'机油率',
  609. icon:'/static/temp/t3.jpg',
  610. url: 'ptypeNav',
  611. target: 'fun'
  612. },{
  613. id:'11',
  614. sn:'11',
  615. name:'电瓶电池',
  616. icon:'/static/temp/t8.jpg',
  617. url: 'ptypeNav',
  618. target: 'fun'
  619. },{
  620. id:'12',
  621. sn:'12',
  622. name:'洗美养护',
  623. icon:'/static/temp/t12.jpg',
  624. url: 'ptypeNav',
  625. target: 'fun'
  626. }
  627. ]
  628. // 转成二维数组
  629. for(let i=0;i<list.length;i=i+8){
  630. this.productTypeList.push({
  631. id: 'swiper-item-'+i,
  632. list: list.slice(i,(i+8)>list.length?list.length:(i+8))
  633. })
  634. }
  635. }else{ // 没有商城
  636. // 滚动扫描记录
  637. this.getScrollLog()
  638. // 获取扫描记录
  639. this.getVinLog()
  640. }
  641. // 查询是否有数字货架
  642. this.getStoreShelf(flag)
  643. },150)
  644. }else{
  645. if(!this.hasShopiing){
  646. // 滚动扫描记录
  647. this.getScrollLog()
  648. // 获取扫描记录
  649. this.getVinLog()
  650. }
  651. // 查询是否有数字货架
  652. this.getStoreShelf(flag)
  653. }
  654. },
  655. // 显示购物车tab
  656. showCatTab(){
  657. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
  658. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  659. if(catIndex<0 && videoIndex >= 0){
  660. // 替换视频为购物车
  661. this.$store.state.vuex_tabBarList.splice(videoIndex,1,{
  662. "pagePath": "/pages/cart/index",
  663. "iconPath": "/static/tab/tab_cart_normal.png",
  664. "selectedIconPath": "/static/tab/tab_cart_pressed.png",
  665. "text": "购物车",
  666. 'customIcon': false,
  667. })
  668. }
  669. },
  670. // 查询是否支持数字货架, flag: true 再次刷新,false 首次加载
  671. getStoreShelf(flag){
  672. findStoreShelf().then(res => {
  673. this.$store.state.vuex_storeShelf = res.data;
  674. if(res.data){
  675. if(!flag){
  676. // 更新用户信息
  677. this.getCurrUserInfo()
  678. // 显示促销模块
  679. this.showPromoTab()
  680. }
  681. // 获取价格权限配置
  682. this.getPriceCofig()
  683. // 保证金查询
  684. this.getShelfBWPayRecord()
  685. // 获取订单信息
  686. this.shelfGetTotalWaitQty()
  687. // 获取轮播数据,包括促销活动
  688. this.getCarousel()
  689. }else{
  690. // 没有数字货架,隐藏促销模块
  691. this.hidePromoTab()
  692. }
  693. })
  694. },
  695. // 显示促销模块
  696. showPromoTab(){
  697. // 添加促销模块
  698. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  699. if(promoIndex<0){
  700. this.$store.state.vuex_tabBarList.splice(1,0,{
  701. "pagePath": "/pages/promo/index",
  702. "iconPath": "/static/tab/tab_promo_normal.png",
  703. "selectedIconPath": "/static/tab/tab_promo_pressed.png",
  704. "text": "促销",
  705. 'customIcon': false,
  706. })
  707. }
  708. // 居中透出显示扫描按钮
  709. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  710. if(scanTab){
  711. scanTab.iconPath = "/static/tab/tab_scan_mid.png"
  712. scanTab.midButton = true
  713. }
  714. },
  715. // 隐藏促销模块
  716. hidePromoTab(){
  717. // 删除促销模块
  718. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  719. if(promoIndex > -1){
  720. this.$store.state.vuex_tabBarList.splice(promoIndex,1)
  721. }
  722. // 扫描按钮不局中
  723. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  724. if(scanTab){
  725. scanTab.iconPath = "/static/tab/tab_scan_normal.png"
  726. scanTab.midButton = false
  727. }
  728. },
  729. // 查询是有红包活动
  730. getRedPacketRule(){
  731. findCurrentRewardRule().then(res => {
  732. this.$store.state.vuex_rewardRule = res.data;
  733. this.getRedScroll()
  734. })
  735. },
  736. // 红包奖励信息
  737. getRedScroll(){
  738. getRewardRollList({pageNo:1,pageSize:50}).then(res => {
  739. this.slist = res.data || []
  740. this.slist.map(item => {
  741. item.placeText = item.userName + '刚刚得到了'+item.totalRewardAmount+'元 红包奖励'
  742. })
  743. })
  744. },
  745. // 获取保证金金额
  746. getShelfBWPayRecord(){
  747. const data = this.$store.state.vuex_storeShelf
  748. shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
  749. console.log(res,'获取保证金金额')
  750. this.bondRecord = res.data
  751. })
  752. },
  753. // 保证金支付
  754. toPayBondAmount(){},
  755. openTakeGood(index){
  756. // 已有数字货架
  757. if(this.hasShelf){
  758. this.clickAction(index)
  759. }else{
  760. uni.showToast({
  761. icon:'none',
  762. title: '门店没有关联数字货架,无法使用此功能!'
  763. })
  764. }
  765. },
  766. // 单击banner
  767. clickBanner(index){
  768. const row = this.imgList[index]
  769. // 红包
  770. if(row.activeType == 'redPacket'){
  771. uni.navigateTo({url:"/pages/morePage/redPacket"})
  772. }
  773. // 图文
  774. if(row.contentType == 'IMAGE_CONTENT'){
  775. uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoActiveSn})
  776. }
  777. // 视频
  778. if(row.contentType == 'VIDEO'){
  779. uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoActiveSn})
  780. }
  781. // 链接
  782. if(row.contentType == 'LINK'){
  783. // 货架促销活动
  784. if(row.content.indexOf("pagesB/promoDetail") >= 0){
  785. uni.navigateTo({
  786. url: '/pagesB/promoProduct?promoActiveSn='+row.promoActiveSn+'&title='+row.title
  787. })
  788. }else{
  789. openWebView({url:row.content})
  790. }
  791. }
  792. },
  793. // 选择取货方式
  794. clickAction(index){
  795. const shelfSn = this.hasShelf.shelfSn
  796. const _this = this
  797. // 扫描
  798. if(index == 0){
  799. uni.scanCode({
  800. success: function (ret) {
  801. console.log(ret);
  802. const params = {
  803. codeType: ret.scanType == 'QR_CODE' ? 0 : 1
  804. }
  805. // 二维码
  806. if(ret.scanType == 'QR_CODE'){
  807. const result = ret.result.split("&")
  808. params.productSn = result[2] // 产品编码sn
  809. }else{
  810. params.qrCode = ret.result
  811. }
  812. uni.showLoading({
  813. title: "正在查询产品..."
  814. })
  815. // 确认取货
  816. getProductfindByScanCode(params).then(res => {
  817. if(res.status == 200 && res.data){
  818. if(res.data.currentInven){
  819. const billSource = ret.scanType == 'QR_CODE' ? 'qr_code': 'bar_code'
  820. const retData = Object.assign({shelfSn: shelfSn, billSource: billSource},res.data)
  821. _this.$store.state.vuex_tempData = retData
  822. uni.navigateTo({
  823. url: '/pagesA/queryByCode/confirmQh'
  824. })
  825. }else{
  826. uni.showModal({
  827. title: '提示',
  828. content: '产品库存为0,无法取货!',
  829. confirmText: '好的',
  830. showCancel: false
  831. })
  832. }
  833. }else{
  834. uni.showModal({
  835. title: '提示',
  836. content: '产品不属于此货架,请重新扫描!',
  837. confirmText: '好的',
  838. showCancel: false
  839. })
  840. }
  841. uni.hideLoading()
  842. })
  843. }
  844. });
  845. }else{
  846. // 按编码搜索
  847. uni.navigateTo({
  848. url: '/pagesA/queryByCode/queryByCode'
  849. })
  850. }
  851. },
  852. // 去扫VIN
  853. openCamera(){
  854. if(this.hasLogin){
  855. // 游客身份
  856. if(this.userInfo.sysUserFlag == '0'){
  857. // 最多扫10次
  858. if(this.vuex_vinScanNums < this.scanMaxNums){
  859. uni.navigateTo({
  860. url: "/pages/scan-frame/scan-frame"
  861. })
  862. }else{
  863. uni.showModal({
  864. title: '提示',
  865. content: '个人用户扫描VIN仅限10次,您的次数已用完!',
  866. confirmText: '好的',
  867. showCancel: false,
  868. success(res) {}
  869. })
  870. }
  871. }else{
  872. // 非游客,直接扫
  873. uni.navigateTo({
  874. url: "/pages/scan-frame/scan-frame"
  875. })
  876. }
  877. }else{
  878. uni.navigateTo({
  879. url: '/pages/login/login'
  880. })
  881. }
  882. },
  883. // 查看扫描VIN记录
  884. toAllRecord(){
  885. uni.navigateTo({
  886. url: this.hasLogin ? "/pagesA/vinRecord/vinRecord" : '/pages/login/login'
  887. })
  888. },
  889. // 查看用户信息
  890. toUser(){
  891. if(this.hasLogin){
  892. // 用户详细信息 或 门店认证
  893. uni.navigateTo({
  894. url: this.userInfo.sysUserFlag == '1' ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
  895. })
  896. }else{
  897. uni.navigateTo({
  898. url: '/pages/login/login'
  899. })
  900. }
  901. },
  902. // 选择配件
  903. toChoosePart(item){
  904. item.text = item.modelInfo
  905. uni.navigateTo({
  906. url: "/pagesA/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))+'&type=log'
  907. })
  908. }
  909. }
  910. }
  911. </script>
  912. <style lang="less">
  913. page{
  914. background-color: #ffffff;
  915. }
  916. .bg-0{
  917. background-image: linear-gradient(#86defa 0%,#cdeff9 25%,#ffffff 40%);
  918. }
  919. .bg-1{
  920. background-image: linear-gradient(#066cff 10%, #80b1fd 30%, #f8f8f8 50%);
  921. }
  922. .content {
  923. margin: 0;
  924. padding: 0;
  925. height: 100vh;
  926. display: flex;
  927. flex-direction: column;
  928. .header-box{
  929. z-index: 5;
  930. padding: 0em 1em;
  931. background: #066cff;
  932. .title{
  933. padding: 0;
  934. }
  935. .version{
  936. color: #FFEB3B;
  937. font-size: 0.8em;
  938. margin-left: 1em;
  939. }
  940. }
  941. .cbody{
  942. flex-grow: 1;
  943. overflow-y: auto;
  944. overflow-x: hidden;
  945. .notices{
  946. padding: 0.5em 0 0;
  947. font-size: 0.9em;
  948. margin-top: 0.5rem;
  949. view{
  950. color: #ffaf46;
  951. flex-grow: 1;
  952. }
  953. .text{
  954. color: #ffffff;
  955. margin-left: 1em;
  956. }
  957. }
  958. .pa-box{
  959. background: #fff;
  960. border-radius: 6px;
  961. margin: 10px 0;
  962. }
  963. .product-box{
  964. margin: 10px 0;
  965. }
  966. .ptype-nav{
  967. padding: 10px 0;
  968. position: relative;
  969. .indicator-dots{
  970. width: 100%;
  971. height: 3px;
  972. display: flex;
  973. align-items: center;
  974. justify-content: center;
  975. position: absolute;
  976. left: 0;
  977. bottom:5px;
  978. }
  979. .indicator-dots > view{
  980. width: 10px;
  981. height: 3px;
  982. background: #e7e7e7;
  983. display: inline-block;
  984. }
  985. .indicator-dots >.indicator-dots-active{
  986. background: #00aaff;
  987. }
  988. }
  989. }
  990. .body-box{
  991. padding: 0em 1em 0.8em;
  992. z-index: 4;
  993. .banner{
  994. margin-top: 20rpx;
  995. }
  996. .action-button{
  997. padding:40upx 0 0 0;
  998. justify-content: space-between;
  999. > view{
  1000. display: flex;
  1001. align-items: center;
  1002. color: #fff;
  1003. border-radius: 10rpx;
  1004. width: 49%;
  1005. padding: 6rpx 0;
  1006. box-shadow: 0rem 0.3rem 0.5rem #d9dada;
  1007. }
  1008. .f1{
  1009. background: #2196f3;
  1010. }
  1011. .f2{
  1012. background: #FF9800;
  1013. }
  1014. .icons{
  1015. font-size: 50rpx;
  1016. color: #fff;
  1017. width: 80rpx;
  1018. height: 80rpx;
  1019. text-align:center;
  1020. display: flex;
  1021. align-items: center;
  1022. flex-direction: column;
  1023. justify-content: center;
  1024. }
  1025. .tits{
  1026. font-size:28rpx;
  1027. }
  1028. }
  1029. }
  1030. .body-box1{
  1031. padding: 0em 10px 0.8em;
  1032. }
  1033. .bg-blue{
  1034. position: relative;
  1035. > view{
  1036. z-index: 100;
  1037. position: relative;
  1038. }
  1039. &::after{
  1040. /* 这个伪类的作用就是一个圆弧的背景色 */
  1041. width: 130%;
  1042. height: 100%;
  1043. position: absolute;
  1044. /*设置水平居中*/
  1045. left: -15%;
  1046. /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
  1047. top: -10%;
  1048. /*层叠顺序,最底层显示*/
  1049. content: '';
  1050. border-radius: 0 0 50% 50%;
  1051. /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
  1052. background: linear-gradient(to bottom, #066cff, #1d77ff);
  1053. }
  1054. .search-head{
  1055. }
  1056. .userCard{
  1057. position:relative;
  1058. left:0;
  1059. bottom:-0.8rem;
  1060. padding: 0.5rem;
  1061. background: #fff;
  1062. border-radius: 0.8rem;
  1063. box-shadow: 0rem 0.3rem 0.5rem #bcdede;
  1064. .userCard-info{
  1065. flex-grow:1;
  1066. > view{
  1067. &:last-child{
  1068. margin-left: 0.5em;
  1069. line-height: 1.5em;
  1070. .user-name{
  1071. font-size: 1rem;
  1072. }
  1073. >view{
  1074. padding: 0.2em;
  1075. }
  1076. }
  1077. }
  1078. .user-info{
  1079. flex-grow:1;
  1080. }
  1081. }
  1082. .user-rz{
  1083. font-size: 0.8rem;
  1084. color:#58aff5;
  1085. }
  1086. }
  1087. }
  1088. .shopping{
  1089. padding: 0;
  1090. .notices{
  1091. padding: 0.5em 10px 0
  1092. }
  1093. &::after{
  1094. top: -25px;
  1095. border-radius: 0 0 150px 150px;
  1096. }
  1097. }
  1098. .list-box{
  1099. padding: 0 1em;
  1100. overflow: auto;
  1101. .des{
  1102. text-align: center;
  1103. padding: 1em 0;
  1104. color: #999;
  1105. font-size: 0.8em;
  1106. }
  1107. }
  1108. }
  1109. </style>