index.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147
  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. }
  648. }
  649. },
  650. // 显示购物车tab
  651. showCatTab(){
  652. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
  653. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  654. if(catIndex<0 && videoIndex >= 0){
  655. // 替换视频为购物车
  656. this.$store.state.vuex_tabBarList.splice(videoIndex,1,{
  657. "pagePath": "/pages/cart/index",
  658. "iconPath": "/static/tab/tab_cart_normal.png",
  659. "selectedIconPath": "/static/tab/tab_cart_pressed.png",
  660. "text": "购物车",
  661. 'customIcon': false,
  662. })
  663. }
  664. },
  665. // 显示视频tab,隐藏购物车
  666. showVideoTab(){
  667. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
  668. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  669. if(videoIndex<0 && catIndex >= 0){
  670. // 替换购物车为视频
  671. this.$store.state.vuex_tabBarList.splice(catIndex,1,{
  672. "pagePath": "/pages/videos/index",
  673. "iconPath": "/static/tab/tab_video_normal.png",
  674. "selectedIconPath": "/static/tab/tab_video_pressed.png",
  675. "text": "视频",
  676. 'customIcon': false,
  677. })
  678. }
  679. },
  680. // 查询是否支持数字货架, flag: true 再次刷新,false 首次加载,只加载一次
  681. getStoreShelf(flag){
  682. findStoreShelf().then(res => {
  683. this.$store.state.vuex_storeShelf = res.data;
  684. if(res.data){
  685. // 查询是否有商城
  686. this.getHasShopping(flag)
  687. // false 不需要每次加载
  688. if(!flag){
  689. // 更新用户信息
  690. this.getCurrUserInfo()
  691. // 显示促销模块
  692. this.showPromoTab()
  693. // 保证金查询
  694. this.getShelfBWPayRecord()
  695. // 获取订单信息
  696. this.shelfGetTotalWaitQty()
  697. }
  698. // 查询红包活动
  699. this.getRedPacketRule()
  700. // 获取价格权限配置
  701. this.getPriceCofig()
  702. // 获取轮播数据,包括促销活动
  703. this.getCarousel()
  704. }else{
  705. // 没有数字货架,隐藏促销模块
  706. this.hidePromoTab()
  707. }
  708. })
  709. },
  710. // 显示促销模块
  711. showPromoTab(){
  712. // 添加促销模块
  713. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  714. if(promoIndex<0){
  715. this.$store.state.vuex_tabBarList.splice(1,0,{
  716. "pagePath": "/pages/promo/index",
  717. "iconPath": "/static/tab/tab_promo_normal.png",
  718. "selectedIconPath": "/static/tab/tab_promo_pressed.png",
  719. "text": "促销",
  720. 'customIcon': false,
  721. })
  722. }
  723. // 居中透出显示扫描按钮
  724. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  725. if(scanTab){
  726. scanTab.iconPath = "/static/tab/tab_scan_mid.png"
  727. scanTab.midButton = true
  728. }
  729. },
  730. // 隐藏促销模块
  731. hidePromoTab(){
  732. // 删除促销模块
  733. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  734. if(promoIndex > -1){
  735. this.$store.state.vuex_tabBarList.splice(promoIndex,1)
  736. }
  737. // 扫描按钮不局中
  738. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  739. if(scanTab){
  740. scanTab.iconPath = "/static/tab/tab_scan_normal.png"
  741. scanTab.midButton = false
  742. }
  743. },
  744. // 查询是有红包活动
  745. getRedPacketRule(){
  746. findCurrentRewardRule().then(res => {
  747. this.$store.state.vuex_rewardRule = res.data;
  748. this.getRedScroll()
  749. })
  750. },
  751. // 红包奖励信息
  752. getRedScroll(){
  753. getRewardRollList({pageNo:1,pageSize:50}).then(res => {
  754. this.slist = res.data || []
  755. this.slist.map(item => {
  756. item.placeText = item.userName + '刚刚得到了'+item.totalRewardAmount+'元 红包奖励'
  757. })
  758. })
  759. },
  760. // 获取保证金金额
  761. getShelfBWPayRecord(){
  762. const data = this.$store.state.vuex_storeShelf
  763. shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
  764. console.log(res,'获取保证金金额')
  765. this.bondRecord = res.data
  766. })
  767. },
  768. // 保证金支付
  769. toPayBondAmount(){},
  770. openTakeGood(index){
  771. // 已有数字货架
  772. if(this.hasShelf){
  773. this.clickAction(index)
  774. }else{
  775. uni.showToast({
  776. icon:'none',
  777. title: '门店没有关联数字货架,无法使用此功能!'
  778. })
  779. }
  780. },
  781. // 单击banner
  782. clickBanner(index){
  783. const row = this.imgList[index]
  784. // 红包
  785. if(row.activeType == 'redPacket'){
  786. uni.navigateTo({url:"/pages/morePage/redPacket"})
  787. }
  788. // 图文
  789. if(row.contentType == 'IMAGE_CONTENT'){
  790. uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoActiveSn})
  791. }
  792. // 视频
  793. if(row.contentType == 'VIDEO'){
  794. uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoActiveSn})
  795. }
  796. // 链接
  797. if(row.contentType == 'LINK'){
  798. // 货架促销活动
  799. if(row.content.indexOf("pagesB/promoDetail") >= 0){
  800. uni.navigateTo({
  801. url: '/pagesB/promoProduct?promoActiveSn='+row.promoActiveSn+'&title='+row.title
  802. })
  803. }else{
  804. openWebView({url:row.content})
  805. }
  806. }
  807. },
  808. // 选择取货方式
  809. clickAction(index){
  810. const shelfSn = this.hasShelf.shelfSn
  811. const _this = this
  812. // 扫描
  813. if(index == 0){
  814. uni.scanCode({
  815. success: function (ret) {
  816. console.log(ret);
  817. const params = {
  818. codeType: ret.scanType == 'QR_CODE' ? 0 : 1
  819. }
  820. // 二维码
  821. if(ret.scanType == 'QR_CODE'){
  822. const result = ret.result.split("&")
  823. params.productSn = result[2] // 产品编码sn
  824. }else{
  825. params.qrCode = ret.result
  826. }
  827. uni.showLoading({
  828. title: "正在查询产品..."
  829. })
  830. // 确认取货
  831. getProductfindByScanCode(params).then(res => {
  832. if(res.status == 200 && res.data){
  833. if(res.data.currentInven){
  834. const billSource = ret.scanType == 'QR_CODE' ? 'qr_code': 'bar_code'
  835. const retData = Object.assign({shelfSn: shelfSn, billSource: billSource},res.data)
  836. _this.$store.state.vuex_tempData = retData
  837. uni.navigateTo({
  838. url: '/pagesA/queryByCode/confirmQh'
  839. })
  840. }else{
  841. uni.showModal({
  842. title: '提示',
  843. content: '产品库存为0,无法取货!',
  844. confirmText: '好的',
  845. showCancel: false
  846. })
  847. }
  848. }else{
  849. uni.showModal({
  850. title: '提示',
  851. content: '产品不属于此货架,请重新扫描!',
  852. confirmText: '好的',
  853. showCancel: false
  854. })
  855. }
  856. uni.hideLoading()
  857. })
  858. }
  859. });
  860. }else{
  861. // 按编码搜索
  862. uni.navigateTo({
  863. url: '/pagesA/queryByCode/queryByCode'
  864. })
  865. }
  866. },
  867. // 去扫VIN
  868. openCamera(){
  869. if(this.hasLogin){
  870. // 游客身份
  871. if(this.userInfo.sysUserFlag == '0'){
  872. // 最多扫10次
  873. if(this.vuex_vinScanNums < this.scanMaxNums){
  874. uni.navigateTo({
  875. url: "/pages/scan-frame/scan-frame"
  876. })
  877. }else{
  878. uni.showModal({
  879. title: '提示',
  880. content: '个人用户扫描VIN仅限10次,您的次数已用完!',
  881. confirmText: '好的',
  882. showCancel: false,
  883. success(res) {}
  884. })
  885. }
  886. }else{
  887. // 非游客,直接扫
  888. uni.navigateTo({
  889. url: "/pages/scan-frame/scan-frame"
  890. })
  891. }
  892. }else{
  893. uni.navigateTo({
  894. url: '/pages/login/login'
  895. })
  896. }
  897. },
  898. // 查看扫描VIN记录
  899. toAllRecord(){
  900. uni.navigateTo({
  901. url: this.hasLogin ? "/pagesA/vinRecord/vinRecord" : '/pages/login/login'
  902. })
  903. },
  904. // 查看用户信息
  905. toUser(){
  906. if(this.hasLogin){
  907. // 用户详细信息 或 门店认证
  908. uni.navigateTo({
  909. url: this.userInfo.sysUserFlag == '1' ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
  910. })
  911. }else{
  912. uni.navigateTo({
  913. url: '/pages/login/login'
  914. })
  915. }
  916. },
  917. // 选择配件
  918. toChoosePart(item){
  919. item.text = item.modelInfo
  920. uni.navigateTo({
  921. url: "/pagesA/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))+'&type=log'
  922. })
  923. }
  924. }
  925. }
  926. </script>
  927. <style lang="less">
  928. page{
  929. background-color: #ffffff;
  930. }
  931. .bg-0{
  932. background-image: linear-gradient(#86defa 0%,#cdeff9 25%,#ffffff 40%);
  933. }
  934. .bg-1{
  935. background-image: linear-gradient(#066cff 10%, #80b1fd 30%, #f8f8f8 50%);
  936. }
  937. .content {
  938. margin: 0;
  939. padding: 0;
  940. display: flex;
  941. flex-direction: column;
  942. .content-body{
  943. flex-grow: 1;
  944. }
  945. .header-box{
  946. z-index: 5;
  947. padding: 0em 1em;
  948. background: #066cff;
  949. .title{
  950. padding: 0;
  951. }
  952. .version{
  953. color: #FFEB3B;
  954. font-size: 0.8em;
  955. margin-left: 1em;
  956. }
  957. }
  958. .headerFixed{
  959. padding: 0 0.5rem;
  960. width: 100%;
  961. z-index: 10;
  962. left: 0;
  963. top:0;
  964. position: fixed;
  965. background: #066cff;
  966. /deep/ .uni-searchbar{
  967. padding: 0;
  968. .uni-searchbar__box{
  969. height: 30px;
  970. }
  971. }
  972. }
  973. .cbody{
  974. flex-grow: 1;
  975. overflow-y: auto;
  976. overflow-x: hidden;
  977. .notices{
  978. padding: 0.5em 0 0;
  979. font-size: 0.9em;
  980. margin-top: 0.5rem;
  981. view{
  982. color: #ffaf46;
  983. flex-grow: 1;
  984. }
  985. .text{
  986. color: #ffffff;
  987. margin-left: 1em;
  988. }
  989. }
  990. .pa-box{
  991. background: #fff;
  992. border-radius: 6px;
  993. margin: 10px 0;
  994. padding: 10px 0;
  995. box-shadow: 1px 1px 3px #eee;
  996. border: 1px solid #f8f8f8;
  997. }
  998. .product-box{
  999. margin: 10px 0;
  1000. }
  1001. .ptype-nav{
  1002. position: relative;
  1003. .indicator-dots{
  1004. width: 100%;
  1005. height: 3px;
  1006. display: flex;
  1007. align-items: center;
  1008. justify-content: center;
  1009. position: absolute;
  1010. left: 0;
  1011. bottom:5px;
  1012. }
  1013. .indicator-dots > view{
  1014. width: 10px;
  1015. height: 3px;
  1016. background: #e7e7e7;
  1017. display: inline-block;
  1018. }
  1019. .indicator-dots >.indicator-dots-active{
  1020. background: #00aaff;
  1021. }
  1022. }
  1023. }
  1024. .body-box{
  1025. padding: 0em 1em 0.8em;
  1026. z-index: 4;
  1027. .banner{
  1028. margin-top: 20rpx;
  1029. }
  1030. .action-button{
  1031. padding:40upx 0 0 0;
  1032. justify-content: space-between;
  1033. > view{
  1034. display: flex;
  1035. align-items: center;
  1036. color: #fff;
  1037. border-radius: 10rpx;
  1038. width: 49%;
  1039. padding: 6rpx 0;
  1040. box-shadow: 0rem 0.3rem 0.5rem #d9dada;
  1041. }
  1042. .f1{
  1043. background: #2196f3;
  1044. }
  1045. .f2{
  1046. background: #FF9800;
  1047. }
  1048. .icons{
  1049. font-size: 50rpx;
  1050. color: #fff;
  1051. width: 80rpx;
  1052. height: 80rpx;
  1053. text-align:center;
  1054. display: flex;
  1055. align-items: center;
  1056. flex-direction: column;
  1057. justify-content: center;
  1058. }
  1059. .tits{
  1060. font-size:28rpx;
  1061. }
  1062. }
  1063. }
  1064. .body-box1{
  1065. padding: 0em 10px 0.8em;
  1066. }
  1067. .bg-blue{
  1068. position: relative;
  1069. > view{
  1070. z-index: 100;
  1071. position: relative;
  1072. }
  1073. &::after{
  1074. /* 这个伪类的作用就是一个圆弧的背景色 */
  1075. width: 130%;
  1076. height: 100%;
  1077. position: absolute;
  1078. /*设置水平居中*/
  1079. left: -15%;
  1080. /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
  1081. top: -10%;
  1082. /*层叠顺序,最底层显示*/
  1083. content: '';
  1084. border-radius: 0 0 50% 50%;
  1085. /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
  1086. background: linear-gradient(to bottom, #066cff, #1d77ff);
  1087. }
  1088. .search-head{
  1089. }
  1090. .userCard{
  1091. position:relative;
  1092. left:0;
  1093. bottom:-0.8rem;
  1094. padding: 0.5rem;
  1095. background: #fff;
  1096. border-radius: 0.8rem;
  1097. box-shadow: 0rem 0.3rem 0.5rem #bcdede;
  1098. .userCard-info{
  1099. flex-grow:1;
  1100. > view{
  1101. &:last-child{
  1102. margin-left: 0.5em;
  1103. line-height: 1.5em;
  1104. .user-name{
  1105. font-size: 1rem;
  1106. }
  1107. >view{
  1108. padding: 0.2em;
  1109. }
  1110. }
  1111. }
  1112. .user-info{
  1113. flex-grow:1;
  1114. }
  1115. }
  1116. .user-rz{
  1117. font-size: 0.8rem;
  1118. color:#58aff5;
  1119. }
  1120. }
  1121. }
  1122. .shopping{
  1123. padding: 0;
  1124. .notices{
  1125. padding: 0.5em 10px 0
  1126. }
  1127. &::after{
  1128. top: -25px;
  1129. border-radius: 0 0 150px 150px;
  1130. }
  1131. }
  1132. .list-box{
  1133. padding: 0 1em;
  1134. overflow: auto;
  1135. .des{
  1136. text-align: center;
  1137. padding: 1em 0;
  1138. color: #999;
  1139. font-size: 0.8em;
  1140. }
  1141. }
  1142. }
  1143. </style>