index.vue 35 KB

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