index.vue 33 KB

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