index.vue 33 KB

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