index.vue 35 KB

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