index.vue 33 KB

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