index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  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. <uni-icons type="arrowright" size="20" color="#999"></uni-icons>
  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="32" 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. uni.showLoading({
  633. title: '加载中'
  634. })
  635. getShopStatus().then(res => {
  636. this.hasShopiing = res.data && res.data.paramValue == 1
  637. // 有商城
  638. if(this.hasShopiing){
  639. // 隐藏tab 视频,显示购物车tab
  640. this.showCatTab()
  641. // 商品分类
  642. this.getGoodType()
  643. }else{
  644. // 没有商城
  645. // 滚动扫描记录
  646. this.getScrollLog()
  647. // 获取扫描记录
  648. this.getVinLog()
  649. }
  650. // 查询是否有数字货架
  651. this.getStoreShelf(flag)
  652. uni.hideLoading()
  653. })
  654. }else{
  655. if(!this.hasShopiing){
  656. // 滚动扫描记录
  657. this.getScrollLog()
  658. // 获取扫描记录
  659. this.getVinLog()
  660. }
  661. // 查询是否有数字货架
  662. this.getStoreShelf(flag)
  663. }
  664. },
  665. // 显示购物车tab
  666. showCatTab(){
  667. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
  668. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  669. if(catIndex<0 && videoIndex >= 0){
  670. // 替换视频为购物车
  671. this.$store.state.vuex_tabBarList.splice(videoIndex,1,{
  672. "pagePath": "/pages/cart/index",
  673. "iconPath": "/static/tab/tab_cart_normal.png",
  674. "selectedIconPath": "/static/tab/tab_cart_pressed.png",
  675. "text": "购物车",
  676. 'customIcon': false,
  677. })
  678. }
  679. },
  680. // 查询是否支持数字货架, flag: true 再次刷新,false 首次加载
  681. getStoreShelf(flag){
  682. findStoreShelf().then(res => {
  683. this.$store.state.vuex_storeShelf = res.data;
  684. if(res.data){
  685. if(!flag){
  686. // 更新用户信息
  687. this.getCurrUserInfo()
  688. // 显示促销模块
  689. this.showPromoTab()
  690. // 保证金查询
  691. this.getShelfBWPayRecord()
  692. // 获取订单信息
  693. this.shelfGetTotalWaitQty()
  694. }
  695. // 获取价格权限配置
  696. this.getPriceCofig()
  697. // 获取轮播数据,包括促销活动
  698. this.getCarousel()
  699. }else{
  700. // 没有数字货架,隐藏促销模块
  701. this.hidePromoTab()
  702. }
  703. })
  704. },
  705. // 显示促销模块
  706. showPromoTab(){
  707. // 添加促销模块
  708. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  709. if(promoIndex<0){
  710. this.$store.state.vuex_tabBarList.splice(1,0,{
  711. "pagePath": "/pages/promo/index",
  712. "iconPath": "/static/tab/tab_promo_normal.png",
  713. "selectedIconPath": "/static/tab/tab_promo_pressed.png",
  714. "text": "促销",
  715. 'customIcon': false,
  716. })
  717. }
  718. // 居中透出显示扫描按钮
  719. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  720. if(scanTab){
  721. scanTab.iconPath = "/static/tab/tab_scan_mid.png"
  722. scanTab.midButton = true
  723. }
  724. },
  725. // 隐藏促销模块
  726. hidePromoTab(){
  727. // 删除促销模块
  728. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  729. if(promoIndex > -1){
  730. this.$store.state.vuex_tabBarList.splice(promoIndex,1)
  731. }
  732. // 扫描按钮不局中
  733. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  734. if(scanTab){
  735. scanTab.iconPath = "/static/tab/tab_scan_normal.png"
  736. scanTab.midButton = false
  737. }
  738. },
  739. // 查询是有红包活动
  740. getRedPacketRule(){
  741. findCurrentRewardRule().then(res => {
  742. this.$store.state.vuex_rewardRule = res.data;
  743. this.getRedScroll()
  744. })
  745. },
  746. // 红包奖励信息
  747. getRedScroll(){
  748. getRewardRollList({pageNo:1,pageSize:50}).then(res => {
  749. this.slist = res.data || []
  750. this.slist.map(item => {
  751. item.placeText = item.userName + '刚刚得到了'+item.totalRewardAmount+'元 红包奖励'
  752. })
  753. })
  754. },
  755. // 获取保证金金额
  756. getShelfBWPayRecord(){
  757. const data = this.$store.state.vuex_storeShelf
  758. shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
  759. console.log(res,'获取保证金金额')
  760. this.bondRecord = res.data
  761. })
  762. },
  763. // 保证金支付
  764. toPayBondAmount(){},
  765. openTakeGood(index){
  766. // 已有数字货架
  767. if(this.hasShelf){
  768. this.clickAction(index)
  769. }else{
  770. uni.showToast({
  771. icon:'none',
  772. title: '门店没有关联数字货架,无法使用此功能!'
  773. })
  774. }
  775. },
  776. // 单击banner
  777. clickBanner(index){
  778. const row = this.imgList[index]
  779. // 红包
  780. if(row.activeType == 'redPacket'){
  781. uni.navigateTo({url:"/pages/morePage/redPacket"})
  782. }
  783. // 图文
  784. if(row.contentType == 'IMAGE_CONTENT'){
  785. uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoActiveSn})
  786. }
  787. // 视频
  788. if(row.contentType == 'VIDEO'){
  789. uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoActiveSn})
  790. }
  791. // 链接
  792. if(row.contentType == 'LINK'){
  793. // 货架促销活动
  794. if(row.content.indexOf("pagesB/promoDetail") >= 0){
  795. uni.navigateTo({
  796. url: '/pagesB/promoProduct?promoActiveSn='+row.promoActiveSn+'&title='+row.title
  797. })
  798. }else{
  799. openWebView({url:row.content})
  800. }
  801. }
  802. },
  803. // 选择取货方式
  804. clickAction(index){
  805. const shelfSn = this.hasShelf.shelfSn
  806. const _this = this
  807. // 扫描
  808. if(index == 0){
  809. uni.scanCode({
  810. success: function (ret) {
  811. console.log(ret);
  812. const params = {
  813. codeType: ret.scanType == 'QR_CODE' ? 0 : 1
  814. }
  815. // 二维码
  816. if(ret.scanType == 'QR_CODE'){
  817. const result = ret.result.split("&")
  818. params.productSn = result[2] // 产品编码sn
  819. }else{
  820. params.qrCode = ret.result
  821. }
  822. uni.showLoading({
  823. title: "正在查询产品..."
  824. })
  825. // 确认取货
  826. getProductfindByScanCode(params).then(res => {
  827. if(res.status == 200 && res.data){
  828. if(res.data.currentInven){
  829. const billSource = ret.scanType == 'QR_CODE' ? 'qr_code': 'bar_code'
  830. const retData = Object.assign({shelfSn: shelfSn, billSource: billSource},res.data)
  831. _this.$store.state.vuex_tempData = retData
  832. uni.navigateTo({
  833. url: '/pagesA/queryByCode/confirmQh'
  834. })
  835. }else{
  836. uni.showModal({
  837. title: '提示',
  838. content: '产品库存为0,无法取货!',
  839. confirmText: '好的',
  840. showCancel: false
  841. })
  842. }
  843. }else{
  844. uni.showModal({
  845. title: '提示',
  846. content: '产品不属于此货架,请重新扫描!',
  847. confirmText: '好的',
  848. showCancel: false
  849. })
  850. }
  851. uni.hideLoading()
  852. })
  853. }
  854. });
  855. }else{
  856. // 按编码搜索
  857. uni.navigateTo({
  858. url: '/pagesA/queryByCode/queryByCode'
  859. })
  860. }
  861. },
  862. // 去扫VIN
  863. openCamera(){
  864. if(this.hasLogin){
  865. // 游客身份
  866. if(this.userInfo.sysUserFlag == '0'){
  867. // 最多扫10次
  868. if(this.vuex_vinScanNums < this.scanMaxNums){
  869. uni.navigateTo({
  870. url: "/pages/scan-frame/scan-frame"
  871. })
  872. }else{
  873. uni.showModal({
  874. title: '提示',
  875. content: '个人用户扫描VIN仅限10次,您的次数已用完!',
  876. confirmText: '好的',
  877. showCancel: false,
  878. success(res) {}
  879. })
  880. }
  881. }else{
  882. // 非游客,直接扫
  883. uni.navigateTo({
  884. url: "/pages/scan-frame/scan-frame"
  885. })
  886. }
  887. }else{
  888. uni.navigateTo({
  889. url: '/pages/login/login'
  890. })
  891. }
  892. },
  893. // 查看扫描VIN记录
  894. toAllRecord(){
  895. uni.navigateTo({
  896. url: this.hasLogin ? "/pagesA/vinRecord/vinRecord" : '/pages/login/login'
  897. })
  898. },
  899. // 查看用户信息
  900. toUser(){
  901. if(this.hasLogin){
  902. // 用户详细信息 或 门店认证
  903. uni.navigateTo({
  904. url: this.userInfo.sysUserFlag == '1' ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
  905. })
  906. }else{
  907. uni.navigateTo({
  908. url: '/pages/login/login'
  909. })
  910. }
  911. },
  912. // 选择配件
  913. toChoosePart(item){
  914. item.text = item.modelInfo
  915. uni.navigateTo({
  916. url: "/pagesA/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))+'&type=log'
  917. })
  918. }
  919. }
  920. }
  921. </script>
  922. <style lang="less">
  923. page{
  924. background-color: #ffffff;
  925. }
  926. .bg-0{
  927. background-image: linear-gradient(#86defa 0%,#cdeff9 25%,#ffffff 40%);
  928. }
  929. .bg-1{
  930. background-image: linear-gradient(#066cff 10%, #80b1fd 30%, #f8f8f8 50%);
  931. }
  932. .content {
  933. margin: 0;
  934. padding: 0;
  935. height: 100vh;
  936. display: flex;
  937. flex-direction: column;
  938. .header-box{
  939. z-index: 5;
  940. padding: 0em 1em;
  941. background: #066cff;
  942. .title{
  943. padding: 0;
  944. }
  945. .version{
  946. color: #FFEB3B;
  947. font-size: 0.8em;
  948. margin-left: 1em;
  949. }
  950. }
  951. .cbody{
  952. flex-grow: 1;
  953. overflow-y: auto;
  954. overflow-x: hidden;
  955. .notices{
  956. padding: 0.5em 0 0;
  957. font-size: 0.9em;
  958. margin-top: 0.5rem;
  959. view{
  960. color: #ffaf46;
  961. flex-grow: 1;
  962. }
  963. .text{
  964. color: #ffffff;
  965. margin-left: 1em;
  966. }
  967. }
  968. .pa-box{
  969. background: #fff;
  970. border-radius: 6px;
  971. margin: 10px 0;
  972. box-shadow: 1px 1px 3px #eee;
  973. }
  974. .product-box{
  975. margin: 10px 0;
  976. }
  977. .ptype-nav{
  978. padding: 10px 0;
  979. position: relative;
  980. .indicator-dots{
  981. width: 100%;
  982. height: 3px;
  983. display: flex;
  984. align-items: center;
  985. justify-content: center;
  986. position: absolute;
  987. left: 0;
  988. bottom:5px;
  989. }
  990. .indicator-dots > view{
  991. width: 10px;
  992. height: 3px;
  993. background: #e7e7e7;
  994. display: inline-block;
  995. }
  996. .indicator-dots >.indicator-dots-active{
  997. background: #00aaff;
  998. }
  999. }
  1000. }
  1001. .body-box{
  1002. padding: 0em 1em 0.8em;
  1003. z-index: 4;
  1004. .banner{
  1005. margin-top: 20rpx;
  1006. }
  1007. .action-button{
  1008. padding:40upx 0 0 0;
  1009. justify-content: space-between;
  1010. > view{
  1011. display: flex;
  1012. align-items: center;
  1013. color: #fff;
  1014. border-radius: 10rpx;
  1015. width: 49%;
  1016. padding: 6rpx 0;
  1017. box-shadow: 0rem 0.3rem 0.5rem #d9dada;
  1018. }
  1019. .f1{
  1020. background: #2196f3;
  1021. }
  1022. .f2{
  1023. background: #FF9800;
  1024. }
  1025. .icons{
  1026. font-size: 50rpx;
  1027. color: #fff;
  1028. width: 80rpx;
  1029. height: 80rpx;
  1030. text-align:center;
  1031. display: flex;
  1032. align-items: center;
  1033. flex-direction: column;
  1034. justify-content: center;
  1035. }
  1036. .tits{
  1037. font-size:28rpx;
  1038. }
  1039. }
  1040. }
  1041. .body-box1{
  1042. padding: 0em 10px 0.8em;
  1043. }
  1044. .bg-blue{
  1045. position: relative;
  1046. > view{
  1047. z-index: 100;
  1048. position: relative;
  1049. }
  1050. &::after{
  1051. /* 这个伪类的作用就是一个圆弧的背景色 */
  1052. width: 130%;
  1053. height: 100%;
  1054. position: absolute;
  1055. /*设置水平居中*/
  1056. left: -15%;
  1057. /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
  1058. top: -10%;
  1059. /*层叠顺序,最底层显示*/
  1060. content: '';
  1061. border-radius: 0 0 50% 50%;
  1062. /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
  1063. background: linear-gradient(to bottom, #066cff, #1d77ff);
  1064. }
  1065. .search-head{
  1066. }
  1067. .userCard{
  1068. position:relative;
  1069. left:0;
  1070. bottom:-0.8rem;
  1071. padding: 0.5rem;
  1072. background: #fff;
  1073. border-radius: 0.8rem;
  1074. box-shadow: 0rem 0.3rem 0.5rem #bcdede;
  1075. .userCard-info{
  1076. flex-grow:1;
  1077. > view{
  1078. &:last-child{
  1079. margin-left: 0.5em;
  1080. line-height: 1.5em;
  1081. .user-name{
  1082. font-size: 1rem;
  1083. }
  1084. >view{
  1085. padding: 0.2em;
  1086. }
  1087. }
  1088. }
  1089. .user-info{
  1090. flex-grow:1;
  1091. }
  1092. }
  1093. .user-rz{
  1094. font-size: 0.8rem;
  1095. color:#58aff5;
  1096. }
  1097. }
  1098. }
  1099. .shopping{
  1100. padding: 0;
  1101. .notices{
  1102. padding: 0.5em 10px 0
  1103. }
  1104. &::after{
  1105. top: -25px;
  1106. border-radius: 0 0 150px 150px;
  1107. }
  1108. }
  1109. .list-box{
  1110. padding: 0 1em;
  1111. overflow: auto;
  1112. .des{
  1113. text-align: center;
  1114. padding: 1em 0;
  1115. color: #999;
  1116. font-size: 0.8em;
  1117. }
  1118. }
  1119. }
  1120. </style>