index.vue 33 KB

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