index.vue 34 KB

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