index.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196
  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. this.carouselList = []
  391. // 已登录
  392. if(this.hasLogin){
  393. // 已认证用户
  394. if(this.userInfo.sysUserFlag == '1'){
  395. // 查询是否有数字货架
  396. this.getStoreShelf(flag)
  397. }else{// 游客
  398. // 获取扫描次数
  399. this.$store.dispatch("getScanNums")
  400. // 获取最大扫描次数
  401. this.getMaxQty()
  402. // 查询门店认证信息
  403. this.findLastApply()
  404. // 获取扫描记录
  405. this.getVinLog()
  406. if(this.hasShopiing){
  407. this.showShopPage(flag)
  408. }else{
  409. this.showNoShopPage()
  410. }
  411. }
  412. }else{
  413. // 未登录
  414. this.hasShopiing = true
  415. // 隐藏促销模块
  416. this.hidePromoTab()
  417. if(this.hasShopiing){
  418. this.showShopPage(flag)
  419. }else{
  420. this.showNoShopPage()
  421. }
  422. }
  423. },
  424. // 查询是否支持数字货架, flag: true 再次刷新,false 首次加载,只加载一次
  425. getStoreShelf(flag){
  426. findStoreShelf().then(res => {
  427. this.$store.state.vuex_storeShelf = res.data;
  428. // 有数字货架
  429. if(res.data){
  430. // 获取轮播数据,包括促销活动
  431. this.getCarousel()
  432. // 查询是否有商城
  433. this.getHasShopping(flag)
  434. // 只需加载一次
  435. if(flag==0){
  436. // 更新用户信息
  437. this.getCurrUserInfo()
  438. // 显示促销模块
  439. this.showPromoTab()
  440. // 保证金查询
  441. this.getShelfBWPayRecord()
  442. // 获取订单信息
  443. this.shelfGetTotalWaitQty()
  444. }
  445. // 获取价格权限配置
  446. this.getPriceCofig()
  447. }else{
  448. // 没有数字货架,隐藏促销模块
  449. this.hidePromoTab()
  450. }
  451. })
  452. },
  453. // 最新用户信息
  454. getCurrUserInfo(){
  455. getCurrUserInfo().then(res => {
  456. if(res.data){
  457. this.$store.state.vuex_userInfo.userNameCN = res.data.name;
  458. this.$store.state.vuex_userInfo.mobile = res.data.mobile;
  459. this.$store.state.vuex_userInfo.adminId = res.data.id;
  460. this.$store.state.vuex_userPhoto = res.data.photo;
  461. uni.setStorageSync('userPhoto', res.data.photo);
  462. }
  463. })
  464. },
  465. // 获取价格配置
  466. getPriceCofig(){
  467. const data = this.$store.state.vuex_storeShelf
  468. queryQplsConfig({shelfSn: data.shelfSn}).then(res => {
  469. this.$store.state.vuex_configPrice = res.data || null
  470. })
  471. },
  472. // 商城信息, flag: true 再次刷新,false 只加载一次
  473. getHasShopping(flag){
  474. getShopStatus().then(res => {
  475. this.hasShopiing = res.data && res.data.paramValue == 1
  476. // 有商城
  477. if(this.hasShopiing){
  478. this.showShopPage()
  479. }else{
  480. // 没有商城
  481. this.showNoShopPage()
  482. }
  483. // 查询红包活动
  484. this.getRedPacketRule()
  485. })
  486. },
  487. // 显示开通商城的页面
  488. showShopPage(flag){
  489. // 隐藏tab 视频,显示tab购物车
  490. if(this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1'){
  491. this.cartCount()
  492. }else{
  493. this.$store.state.vuex_cartTotal = 0
  494. this.showCatTab()
  495. }
  496. // 商品分类
  497. this.getGoodType(flag)
  498. // 获取推荐产品
  499. this.getHotProductList(flag)
  500. },
  501. // 显示未没有开通商城的界面
  502. showNoShopPage(){
  503. this.productTypeList = []
  504. this.productList = []
  505. // 隐藏tab 购物车,显示tab视频
  506. this.showVideoTab()
  507. // 滚动扫描记录
  508. this.getScrollLog()
  509. // 获取扫描记录
  510. if(this.hasLogin){
  511. this.getVinLog()
  512. }
  513. },
  514. // 购物车数量
  515. cartCount(){
  516. getCartCount({}).then(res => {
  517. if(res.status == 200){
  518. this.$store.state.vuex_cartTotal = res.data?res.data.qty:0
  519. this.showCatTab()
  520. }
  521. })
  522. },
  523. // 商品一级分类
  524. getGoodType(flag){
  525. this.productTypeList = []
  526. getShopCategory({categoryLevel: 1}).then(res => {
  527. const list = res.data || []
  528. const ret = []
  529. list.forEach(item => {
  530. ret.push({
  531. id: item.id,
  532. categorySn: item.categorySn,
  533. auth: true,
  534. ignoreAuth: false,
  535. name: item.categoryName,
  536. icon: item.iconUrl,
  537. url: '/pagesB/shopiing/shopProduct?clzId='+item.categorySn+'&clzName='+item.categoryName+"&shopCategoryCount="+item.shopCategoryCount+'&shopProductCount='+item.shopProductCount,
  538. target: 'page'
  539. })
  540. })
  541. // 转成二维数组
  542. for(let i=0;i<ret.length;i=i+8){
  543. this.productTypeList.push({
  544. id: 'swiper-item-'+i,
  545. list: ret.slice(i,(i+8)>ret.length?ret.length:(i+8))
  546. })
  547. }
  548. })
  549. },
  550. // 商品列表查询
  551. getHotProductList(flag){
  552. this.hotProductPageNo = 1
  553. // 不是show 刷新列表
  554. if(flag!=1){
  555. this.productList = []
  556. this.hotProductpageSize = 10
  557. }else{
  558. // 刷新列表
  559. let count = 0
  560. this.productList.forEach(item => {
  561. count += item.length
  562. })
  563. this.hotProductpageSize = count||10
  564. }
  565. this.getProductList(flag)
  566. },
  567. getProductList(flag){
  568. this.status = "loading"
  569. const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_storeShelf.dealerSn : ''
  570. // 获取推荐产品
  571. getShopProductList({pageNo:this.hotProductPageNo,pageSize:this.hotProductpageSize,hotFlag:1, status: 1, dealerSn: dealerSn}).then(res => {
  572. if(res.status == 200){
  573. const list = res.data ? res.data.list : []
  574. list.map(item=>{
  575. const a = item.shopPromoProduct
  576. if(a){
  577. item.promoType = a.promoType
  578. item.resultValue = a.resultValue
  579. item.conditionValue = a.conditionValue
  580. item.discountType = a.discountType
  581. item.promoProductSn = a.promoProductSn
  582. item.promoSn = a.promoSn
  583. // 特价
  584. if(item.promoType=='PROMO_PROD'){
  585. item.orginPrice = item.price
  586. // 直降
  587. if(item.discountType == 'STRAIGHT_DOWN'){
  588. item.price = item.price - item.resultValue
  589. }
  590. // 折扣
  591. if(item.discountType == 'DISCOUNT'){
  592. item.price = Number(item.price * item.resultValue).toFixed(2)
  593. }
  594. }
  595. }
  596. item.priceStr = Number(item.price).toFixed(2).toString().split('.')
  597. delete item.shopPromoProduct
  598. })
  599. if(flag!=1){
  600. this.productList.push(list)
  601. }else{
  602. // 刷新
  603. this.productList = [list]
  604. }
  605. this.status = res.data.count>=this.list.length ? "nomore" : 'loadmore'
  606. // 判断是否最后一页
  607. const maxPages = Math.ceil(res.data.count / 10)
  608. this.totalhotPage = maxPages
  609. this.status = this.hotProductPageNo >= maxPages ? "nomore" : 'loadmore'
  610. this.noDataText = this.status == 'nomore' ? '没有更多了' : '更多商品'
  611. }else{
  612. this.status = "nomore"
  613. this.noDataText = res.message || '没有更多了'
  614. }
  615. })
  616. },
  617. // 获取上方滚动扫描记录
  618. getScrollLog(){
  619. scanVinLogQueryRoll({pageNo:1,pageSize:50}).then(res => {
  620. this.list = res.data.list || []
  621. this.list.map(item => {
  622. item.placeText = item.userName + '刚刚扫描了一个VIN'
  623. })
  624. })
  625. },
  626. // 获取当前门店扫描记录
  627. getVinLog(){
  628. this.vinList = []
  629. this.status = "loading"
  630. // VISITOR:游客,EMPLOYEE:雇员
  631. getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
  632. this.vinList = res.data&&res.data.list || []
  633. this.vinList = this.vinList.filter(item => item.vinCode)
  634. this.status = 'nomore'
  635. })
  636. },
  637. // tab单击
  638. beforeSwitch(index){
  639. const row = this.$store.state.vuex_tabBarList[index] // 当前tab
  640. const isNoAuth = this.userInfo ? this.userInfo.sysUserFlag == '0' : false // 是否认证门店
  641. return clickTab(row,this.hasLogin,isNoAuth,this.vuex_vinScanNums < this.vuex_scanMaxNums)
  642. },
  643. // 去搜索产品
  644. toSearch(event){
  645. if(this.hasLogin){
  646. // 游客去认证
  647. if(this.userInfo.sysUserFlag == '0'){
  648. toAuthStore()
  649. }else{
  650. uni.navigateTo({
  651. url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
  652. })
  653. }
  654. }else{
  655. toLogin()
  656. }
  657. },
  658. // 促销活动的轮播图片
  659. getCarousel(){
  660. this.carouselList = []
  661. // 获取所有促销活动数据
  662. shopBannerList({}).then(res => {
  663. if(res.status == 200){
  664. res.data&&res.data.map(item => {
  665. item.image = item.imageUrl // 默认取第一张图片
  666. })
  667. this.carouselList = res.data
  668. }
  669. })
  670. },
  671. // 快速导航单击
  672. onNavFun(item){
  673. if(item.auth){
  674. // 非游客
  675. if(this.userInfo.sysUserFlag == '1'){
  676. // 编码取货
  677. if(item.url=='openTakeGood1'){
  678. this.openTakeGood(1)
  679. }
  680. // 扫码取货
  681. if(item.url=='openTakeGood0'){
  682. this.openTakeGood(0)
  683. }
  684. }else{
  685. // 去认证
  686. toAuthStore()
  687. }
  688. }else{
  689. toLogin()
  690. }
  691. },
  692. // 获取数据字典
  693. getListLookUp() {
  694. const _this = this;
  695. listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
  696. if (res.status == 200) {
  697. _this.$store.state.vuex_allLookUp = res.data;
  698. }
  699. });
  700. },
  701. // 或某一项字典列表,参数code
  702. getLookUpList(code, vuexKey) {
  703. getLookUpDatas({ type: code }).then(res => {
  704. if (res.status == 200) {
  705. this.$store.state[vuexKey] = res.data || [];
  706. }
  707. });
  708. },
  709. // 获取最大扫描数
  710. getMaxQty(){
  711. getScanGetMaxQty().then(res => {
  712. this.scanMaxNums = res.data || 10
  713. this.$store.state.vuex_scanMaxNums = this.scanMaxNums
  714. })
  715. },
  716. // 获取最新申请门店
  717. findLastApply(){
  718. const mobile = this.userInfo.mobile
  719. this.$store.dispatch('getSotreAuth',mobile)
  720. },
  721. // 知道审核不通过
  722. toKnow(){
  723. uni.showLoading({
  724. title: "正在提交"
  725. })
  726. xprhStoreApplyRead({sn:this.storeApply.applySn}).then(res => {
  727. if(res.status == 200){
  728. this.findLastApply()
  729. }
  730. uni.hideLoading()
  731. })
  732. },
  733. // 待取货数量合计
  734. shelfGetTotalWaitQty(){
  735. shelfGetTotalWaitQty({billState:'WAIT'}).then(res => {
  736. if(res.status == 200){
  737. this.orderTodo = res.data;
  738. }
  739. })
  740. },
  741. // 货架订单列表
  742. toOrder(){
  743. if(this.hasShelf){
  744. uni.navigateTo({
  745. url: "/pagesA/digitalShelf/orderList"
  746. })
  747. }else{
  748. uni.showToast({
  749. icon:'none',
  750. title: '门店没有关联数字货架,无法使用此功能!'
  751. })
  752. }
  753. },
  754. // 显示购物车tab
  755. showCatTab(){
  756. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
  757. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  758. if(catIndex<0 && videoIndex >= 0){
  759. // 替换视频为购物车
  760. this.$store.state.vuex_tabBarList.splice(videoIndex,1,{
  761. "pagePath": "/pages/cart/index",
  762. "iconPath": "/static/tab/tab_cart_normal.png",
  763. "selectedIconPath": "/static/tab/tab_cart_pressed.png",
  764. "text": "购物车",
  765. 'customIcon': false,
  766. 'count': this.$store.state.vuex_cartTotal,
  767. 'isDot': false
  768. })
  769. }
  770. // 购物车已存在
  771. if(catIndex>=0){
  772. this.$store.state.vuex_tabBarList[catIndex].count = this.$store.state.vuex_cartTotal
  773. }
  774. },
  775. // 显示视频tab,隐藏购物车
  776. showVideoTab(){
  777. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
  778. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  779. if(videoIndex<0 && catIndex >= 0){
  780. // 替换购物车为视频
  781. this.$store.state.vuex_tabBarList.splice(catIndex,1,{
  782. "pagePath": "/pages/videos/index",
  783. "iconPath": "/static/tab/tab_video_normal.png",
  784. "selectedIconPath": "/static/tab/tab_video_pressed.png",
  785. "text": "视频",
  786. 'customIcon': false,
  787. })
  788. }
  789. },
  790. // 显示促销模块
  791. showPromoTab(){
  792. // 添加促销模块
  793. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  794. if(promoIndex<0){
  795. this.$store.state.vuex_tabBarList.splice(1,0,{
  796. "pagePath": "/pages/promo/index",
  797. "iconPath": "/static/tab/tab_promo_normal.png",
  798. "selectedIconPath": "/static/tab/tab_promo_pressed.png",
  799. "text": "促销",
  800. 'customIcon': false,
  801. })
  802. }
  803. // 居中透出显示扫描按钮
  804. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  805. if(scanTab){
  806. scanTab.iconPath = "/static/tab/tab_scan_mid.png"
  807. scanTab.midButton = true
  808. }
  809. },
  810. // 隐藏促销模块
  811. hidePromoTab(){
  812. // 删除促销模块
  813. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  814. if(promoIndex > -1){
  815. this.$store.state.vuex_tabBarList.splice(promoIndex,1)
  816. }
  817. // 扫描按钮不局中
  818. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  819. if(scanTab){
  820. scanTab.iconPath = "/static/tab/tab_scan_normal.png"
  821. scanTab.midButton = false
  822. }
  823. },
  824. // 查询是有红包活动
  825. getRedPacketRule(){
  826. findCurrentRewardRule().then(res => {
  827. this.$store.state.vuex_rewardRule = res.data;
  828. // 商城未开通时调用
  829. if(res.data && !this.hasShopiing){
  830. this.getRedScroll()
  831. }
  832. })
  833. },
  834. // 红包奖励信息
  835. getRedScroll(){
  836. getRewardRollList({pageNo:1,pageSize:50}).then(res => {
  837. this.slist = res.data || []
  838. this.slist.map(item => {
  839. item.placeText = item.userName + '刚刚得到了'+item.totalRewardAmount+'元 红包奖励'
  840. })
  841. })
  842. },
  843. // 获取保证金金额
  844. getShelfBWPayRecord(){
  845. const data = this.$store.state.vuex_storeShelf
  846. shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
  847. console.log(res,'获取保证金金额')
  848. this.bondRecord = res.data
  849. })
  850. },
  851. // 保证金支付
  852. toPayBondAmount(){},
  853. openTakeGood(index){
  854. // 已有数字货架
  855. if(this.hasShelf){
  856. this.clickAction(index)
  857. }else{
  858. uni.showToast({
  859. icon:'none',
  860. title: '门店没有关联数字货架,无法使用此功能!'
  861. })
  862. }
  863. },
  864. // 选择取货方式
  865. clickAction(index){
  866. const shelfSn = this.hasShelf.shelfSn
  867. const _this = this
  868. // 扫描
  869. if(index == 0){
  870. uni.scanCode({
  871. success: function (ret) {
  872. const params = {
  873. codeType: ret.scanType == 'QR_CODE' ? 0 : 1
  874. }
  875. // 二维码
  876. if(ret.scanType == 'QR_CODE'){
  877. const result = ret.result.split("&")
  878. params.productSn = result[2] // 产品编码sn
  879. }else{
  880. params.qrCode = ret.result
  881. }
  882. uni.showLoading({
  883. title: "正在查询产品..."
  884. })
  885. // 确认取货
  886. getProductfindByScanCode(params).then(res => {
  887. if(res.status == 200 && res.data){
  888. if(res.data.currentInven){
  889. const billSource = ret.scanType == 'QR_CODE' ? 'qr_code': 'bar_code'
  890. const retData = Object.assign({shelfSn: shelfSn, billSource: billSource},res.data)
  891. _this.$store.state.vuex_tempData = retData
  892. uni.navigateTo({
  893. url: '/pagesA/queryByCode/confirmQh'
  894. })
  895. }else{
  896. uni.showModal({
  897. title: '提示',
  898. content: '产品库存为0,无法取货!',
  899. confirmText: '好的',
  900. showCancel: false
  901. })
  902. }
  903. }else{
  904. uni.showModal({
  905. title: '提示',
  906. content: '产品不属于此货架,请重新扫描!',
  907. confirmText: '好的',
  908. showCancel: false
  909. })
  910. }
  911. uni.hideLoading()
  912. })
  913. }
  914. });
  915. }else{
  916. // 按编码搜索
  917. uni.navigateTo({
  918. url: '/pagesA/queryByCode/queryByCode'
  919. })
  920. }
  921. },
  922. // 单击banner
  923. clickBanner(index){
  924. clickBannerList(this.imgList[index])
  925. },
  926. // 查看扫描VIN记录
  927. toAllRecord(){
  928. if(this.hasLogin){
  929. uni.navigateTo({
  930. url: "/pagesA/vinRecord/vinRecord"
  931. })
  932. }else{
  933. toLogin()
  934. }
  935. },
  936. // 查看用户信息
  937. toUser(){
  938. if(this.hasLogin){
  939. if(this.userInfo.sysUserFlag == '1'){
  940. // 用户详细信息
  941. uni.navigateTo({
  942. url: '/pages/personData/personData'
  943. })
  944. }else{
  945. // 或 门店认证
  946. toAuthStore()
  947. }
  948. }else{
  949. toLogin()
  950. }
  951. },
  952. // 选择配件
  953. toChoosePart(item){
  954. item.text = item.modelInfo
  955. uni.navigateTo({
  956. url: "/pagesA/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))+'&type=log'
  957. })
  958. },
  959. }
  960. }
  961. </script>
  962. <style lang="less">
  963. page{
  964. background-color: #ffffff;
  965. }
  966. .bg-0{
  967. position: relative;
  968. > view{
  969. z-index:1;
  970. position: relative;
  971. }
  972. &::after{
  973. /* 这个伪类的作用就是一个圆弧的背景色 */
  974. width: 130%;
  975. height: 30vh;
  976. position: absolute;
  977. /*设置水平居中*/
  978. left: -15%;
  979. /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
  980. top: 0;
  981. /*层叠顺序,最底层显示*/
  982. content: '';
  983. /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
  984. background: linear-gradient(to bottom, #86defa, #ffffff);
  985. }
  986. }
  987. .bg-1{
  988. background-image: linear-gradient(#86defa 0%,#cdeff9 20%,#ffffff 30%);
  989. }
  990. .content {
  991. margin: 0;
  992. padding: 0;
  993. display: flex;
  994. flex-direction: column;
  995. .content-body{
  996. flex-grow: 1;
  997. }
  998. .header-box{
  999. z-index: 5;
  1000. padding: 0em 1em;
  1001. background: #066cff;
  1002. .title{
  1003. padding: 0;
  1004. }
  1005. .version{
  1006. color: #FFEB3B;
  1007. font-size: 0.8em;
  1008. margin-left: 1em;
  1009. }
  1010. }
  1011. .headerFixed{
  1012. padding: 0 0.5rem;
  1013. width: 100%;
  1014. z-index: 10;
  1015. left: 0;
  1016. top:0;
  1017. position: fixed;
  1018. background: #066cff;
  1019. /deep/ .uni-searchbar{
  1020. padding: 0;
  1021. .uni-searchbar__box{
  1022. height: 30px;
  1023. }
  1024. }
  1025. }
  1026. .cbody{
  1027. flex-grow: 1;
  1028. overflow-y: auto;
  1029. overflow-x: hidden;
  1030. .notices{
  1031. padding: 0.5em 0 0;
  1032. font-size: 0.9em;
  1033. margin-top: 0.5rem;
  1034. view{
  1035. color: #ffaf46;
  1036. flex-grow: 1;
  1037. }
  1038. .text{
  1039. color: #ffffff;
  1040. margin-left: 1em;
  1041. }
  1042. }
  1043. .pa-box{
  1044. background: #fff;
  1045. border-radius: 6px;
  1046. margin: 10px 0;
  1047. padding: 10px 0;
  1048. border: 1px solid #eee;
  1049. }
  1050. .product-box{
  1051. margin: 10px 0;
  1052. }
  1053. .ptype-nav{
  1054. position: relative;
  1055. .indicator-dots{
  1056. width: 100%;
  1057. height: 3px;
  1058. display: flex;
  1059. align-items: center;
  1060. justify-content: center;
  1061. position: absolute;
  1062. left: 0;
  1063. bottom:5px;
  1064. }
  1065. .indicator-dots > view{
  1066. width: 10px;
  1067. height: 3px;
  1068. background: #e7e7e7;
  1069. display: inline-block;
  1070. }
  1071. .indicator-dots >.indicator-dots-active{
  1072. background: #00aaff;
  1073. }
  1074. }
  1075. }
  1076. .body-box{
  1077. padding: 0em 1em 0.8em;
  1078. z-index: 4;
  1079. .banner{
  1080. margin-top: 20rpx;
  1081. }
  1082. .action-button{
  1083. padding:40upx 0 0 0;
  1084. justify-content: space-between;
  1085. > view{
  1086. display: flex;
  1087. align-items: center;
  1088. color: #fff;
  1089. border-radius: 10rpx;
  1090. width: 49%;
  1091. padding: 6rpx 0;
  1092. box-shadow: 0rem 0.3rem 0.5rem #d9dada;
  1093. }
  1094. .f1{
  1095. background: #2196f3;
  1096. }
  1097. .f2{
  1098. background: #FF9800;
  1099. }
  1100. .icons{
  1101. font-size: 50rpx;
  1102. color: #fff;
  1103. width: 80rpx;
  1104. height: 80rpx;
  1105. text-align:center;
  1106. display: flex;
  1107. align-items: center;
  1108. flex-direction: column;
  1109. justify-content: center;
  1110. }
  1111. .tits{
  1112. font-size:28rpx;
  1113. }
  1114. }
  1115. }
  1116. .body-box1{
  1117. padding: 0em 10px 0.8em;
  1118. }
  1119. .bg-blue{
  1120. position: relative;
  1121. z-index: 1;
  1122. > view{
  1123. z-index: 100;
  1124. position: relative;
  1125. }
  1126. &::after{
  1127. /* 这个伪类的作用就是一个圆弧的背景色 */
  1128. width: 130%;
  1129. height: 100%;
  1130. position: absolute;
  1131. /*设置水平居中*/
  1132. left: -15%;
  1133. /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
  1134. top: -10%;
  1135. /*层叠顺序,最底层显示*/
  1136. content: '';
  1137. border-radius: 0 0 50% 50%;
  1138. /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
  1139. background: linear-gradient(to bottom, #066cff, #056bf9);
  1140. }
  1141. .userCard{
  1142. position:relative;
  1143. left:0;
  1144. bottom:-0.8rem;
  1145. padding: 0.5rem;
  1146. background: #fff;
  1147. border-radius: 0.8rem;
  1148. box-shadow: 0rem 0.3rem 0.5rem #bcdede;
  1149. .userCard-info{
  1150. flex-grow:1;
  1151. > view{
  1152. &:last-child{
  1153. margin-left: 0.5em;
  1154. line-height: 1.5em;
  1155. .user-name{
  1156. font-size: 1rem;
  1157. }
  1158. >view{
  1159. padding: 0.2em;
  1160. }
  1161. }
  1162. }
  1163. .user-info{
  1164. flex-grow:1;
  1165. }
  1166. }
  1167. .user-rz{
  1168. font-size: 0.8rem;
  1169. color:#58aff5;
  1170. }
  1171. }
  1172. }
  1173. .shopping{
  1174. padding: 0;
  1175. .notices{
  1176. padding: 0.5em 10px 0;
  1177. margin-top: 0.2rem;
  1178. .text{
  1179. color: #066cff;
  1180. }
  1181. }
  1182. }
  1183. .list-box{
  1184. padding: 0 1em;
  1185. overflow: auto;
  1186. .des{
  1187. text-align: center;
  1188. padding: 1em 0;
  1189. color: #999;
  1190. font-size: 0.8em;
  1191. }
  1192. }
  1193. }
  1194. </style>