index.vue 31 KB

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