index.vue 33 KB

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