index.vue 34 KB

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