index.vue 35 KB

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