index.vue 35 KB

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