index.vue 32 KB

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