index.vue 33 KB

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