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. 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. isCheckLogin:false, // 是否正在检查登录
  206. }
  207. },
  208. computed: {
  209. ...mapState(['hasLogin','vuex_vinScanNums','vuex_tabBarList']),
  210. // 显示开发版本信息
  211. showVersion () {
  212. const baseUrl = getApp().globalData.baseUrl
  213. return baseUrl.indexOf(".test.") >= 0 || baseUrl.indexOf('192.168') >=0
  214. },
  215. // 是否有数字货架
  216. hasShelf(){
  217. return this.$store.state.vuex_storeShelf
  218. },
  219. // 登录用户信息
  220. userInfo(){
  221. return this.$store.state.vuex_userInfo
  222. },
  223. // 是否有门店申请信息
  224. storeApply(){
  225. return this.$store.state.vuex_storeAuthInfo || null
  226. },
  227. // 是否有红包
  228. hasRedPacket(){
  229. const rule = this.$store.state.vuex_rewardRule
  230. return rule&&rule.ruleStatus == 'release'
  231. },
  232. // banner 图片列表
  233. imgList(){
  234. let list = [
  235. {
  236. image: '/static/banner1.jpg',
  237. activeType: ''
  238. }
  239. ]
  240. // 红包
  241. if(this.hasRedPacket&&this.hasShelf){
  242. list.push(
  243. {
  244. image: '/static/banner2.jpg',
  245. activeType: 'redPacket'
  246. })
  247. }
  248. return list.concat(this.carouselList)
  249. },
  250. // 快捷导航
  251. navList(){
  252. const list = [
  253. {
  254. id:'n0',
  255. auth: this.hasLogin,
  256. icon:'bianmachaxun',
  257. name: '产品编码取货',
  258. color:'#056cd9',
  259. url: 'openTakeGood1',
  260. target: 'fun'
  261. },
  262. {
  263. id:'n1',
  264. auth: this.hasLogin,
  265. icon:'saoma',
  266. name: '二维/条码取货',
  267. color:'#ffaa7f',
  268. url:'openTakeGood0',
  269. target: 'fun'
  270. },
  271. {
  272. id:'n3',
  273. auth: true,
  274. icon:'shipin1',
  275. name: '视频教程',
  276. color:'#55aaff',
  277. url:'/pagesB/videos/index',
  278. target: 'page'
  279. },
  280. {
  281. id:'n2',
  282. auth: this.hasLogin,
  283. icon:'chaxunjilu',
  284. name: 'VIN查询历史',
  285. color:'#97d695',
  286. url:'/pagesA/vinRecord/vinRecord',
  287. target: this.hasLogin ? 'page' : 'fun'
  288. }
  289. ]
  290. return list
  291. }
  292. },
  293. onReady() {
  294. // 获取导航栏高度
  295. const res = uni.getSystemInfoSync()
  296. this.screenWidth = res.windowWidth
  297. const system = res.platform
  298. if (system === 'android') {
  299. this.navHeight = 48
  300. } else if (system === 'ios') {
  301. this.navHeight = 44
  302. }
  303. },
  304. onLoad() {
  305. this.orderTodo = null
  306. this.bondRecord = null
  307. this.vinList = []
  308. // 视频类型
  309. this.getLookUpList('CONTENT_CATEGORY', 'vuex_videoTypeList');
  310. // 检测是否登录
  311. this.isCheckLogin = true
  312. this.$store.dispatch('checkLogin',(isLogin)=>{
  313. this.isCheckLogin = false
  314. // 获取数据字典
  315. this.getListLookUp();
  316. // 获取支付,收款方式
  317. this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
  318. // 价格类型
  319. this.getLookUpList('PRICE_SHOW_TYPE', 'vuex_priceTypeList');
  320. // 初始化页面
  321. this.pageInit(false)
  322. })
  323. // 刷新首页数据
  324. uni.$on("refashHome",()=>{
  325. this.pageInit(true)
  326. })
  327. },
  328. // 页面卸载
  329. onUnload() {
  330. uni.$off('refashHome')
  331. uni.$off('refashProm')
  332. },
  333. onShow() {
  334. // 用户头像
  335. this.avatarUrl = uni.getStorageSync('userPhoto');
  336. // 重新刷新
  337. if(!this.isCheckLogin){
  338. this.pageInit(true)
  339. }
  340. },
  341. // 下拉刷新
  342. onPullDownRefresh(){
  343. this.pageInit(true)
  344. setTimeout(function () {
  345. uni.stopPullDownRefresh();
  346. }, 1000);
  347. },
  348. onShareAppMessage() {},
  349. // 页面滚动
  350. onPageScroll(e) {
  351. this.showFixed = e.scrollTop > 120
  352. },
  353. // 滚动到底部,加载热门产品
  354. onReachBottom() {
  355. if(this.hasShopiing && this.hotProductPageNo < this.totalhotPage){
  356. this.hotProductPageNo++
  357. this.getProductList()
  358. }
  359. },
  360. methods: {
  361. // 去登陆
  362. toLogin(){
  363. uni.navigateTo({
  364. url: '/pages/login/login'
  365. })
  366. },
  367. // 去认证
  368. toAuthStore(){
  369. uni.navigateTo({
  370. url: '/pages/storeManage/storeAuth'
  371. })
  372. },
  373. // 初始化页面
  374. pageInit(flag){
  375. this.carouselList = []
  376. // 已登录
  377. if(this.hasLogin){
  378. // 已认证用户
  379. if(this.userInfo.sysUserFlag == '1'){
  380. // 查询是否有数字货架
  381. this.getStoreShelf(flag)
  382. }else{// 游客
  383. // 获取扫描次数
  384. this.$store.dispatch("getScanNums")
  385. // 获取最大扫描次数
  386. this.getMaxQty()
  387. // 查询门店认证信息
  388. this.findLastApply()
  389. // 获取扫描记录
  390. this.getVinLog()
  391. // 商品分类
  392. this.getGoodType()
  393. // 获取推荐产品
  394. this.getHotProductList()
  395. }
  396. }else{
  397. // 未登录
  398. this.hasShopiing = true
  399. // 隐藏促销模块
  400. this.hidePromoTab()
  401. if(!flag){
  402. // 商品分类
  403. this.getGoodType()
  404. }
  405. // 获取推荐产品
  406. this.getHotProductList()
  407. }
  408. },
  409. // 查询是否支持数字货架, flag: true 再次刷新,false 首次加载,只加载一次
  410. getStoreShelf(flag){
  411. findStoreShelf().then(res => {
  412. this.$store.state.vuex_storeShelf = res.data;
  413. // 有数字货架
  414. if(res.data){
  415. // 获取轮播数据,包括促销活动
  416. this.getCarousel()
  417. // 查询是否有商城
  418. this.getHasShopping(flag)
  419. // 只需加载一次
  420. if(!flag){
  421. // 更新用户信息
  422. this.getCurrUserInfo()
  423. // 显示促销模块
  424. this.showPromoTab()
  425. // 保证金查询
  426. this.getShelfBWPayRecord()
  427. // 获取订单信息
  428. this.shelfGetTotalWaitQty()
  429. }
  430. // 获取价格权限配置
  431. this.getPriceCofig()
  432. }else{
  433. // 没有数字货架,隐藏促销模块
  434. this.hidePromoTab()
  435. }
  436. })
  437. },
  438. // 最新用户信息
  439. getCurrUserInfo(){
  440. getCurrUserInfo().then(res => {
  441. if(res.data){
  442. this.$store.state.vuex_userInfo.userNameCN = res.data.name;
  443. this.$store.state.vuex_userInfo.mobile = res.data.mobile;
  444. this.$store.state.vuex_userInfo.adminId = res.data.id;
  445. this.$store.state.vuex_userPhoto = res.data.photo;
  446. uni.setStorageSync('userPhoto', res.data.photo);
  447. }
  448. })
  449. },
  450. // 获取价格配置
  451. getPriceCofig(){
  452. const data = this.$store.state.vuex_storeShelf
  453. queryQplsConfig({shelfSn: data.shelfSn}).then(res => {
  454. this.$store.state.vuex_configPrice = res.data || null
  455. })
  456. },
  457. // 商城信息, flag: true 再次刷新,false 只加载一次
  458. getHasShopping(flag){
  459. getShopStatus().then(res => {
  460. this.hasShopiing = res.data && res.data.paramValue == 1
  461. // 有商城
  462. if(this.hasShopiing){
  463. if(!flag){
  464. // 隐藏tab 视频,显示tab购物车
  465. this.showCatTab()
  466. // 商品分类
  467. this.getGoodType()
  468. }
  469. // 获取推荐产品
  470. this.getHotProductList()
  471. }else{
  472. // 没有商城
  473. // 隐藏tab 购物车,显示tab视频
  474. this.showVideoTab()
  475. // 滚动扫描记录
  476. this.getScrollLog()
  477. // 获取扫描记录
  478. this.getVinLog()
  479. }
  480. // 查询红包活动
  481. this.getRedPacketRule()
  482. })
  483. },
  484. // 商品一级分类
  485. getGoodType(){
  486. this.productTypeList = []
  487. getShopCategory({categoryLevel: 1, status: 1}).then(res => {
  488. const list = res.data || []
  489. const ret = []
  490. list.forEach(item => {
  491. ret.push({
  492. id: item.id,
  493. categorySn: item.categorySn,
  494. auth: true,
  495. name: item.categoryName,
  496. icon: item.iconUrl,
  497. url: '/pagesB/shopiing/searchProduct?clzId='+item.categorySn+'&clzName='+item.categoryName,
  498. target: 'page'
  499. })
  500. })
  501. // 转成二维数组
  502. for(let i=0;i<ret.length;i=i+8){
  503. this.productTypeList.push({
  504. id: 'swiper-item-'+i,
  505. list: ret.slice(i,(i+8)>ret.length?ret.length:(i+8))
  506. })
  507. }
  508. })
  509. },
  510. // 商品列表查询
  511. getHotProductList(){
  512. this.productList = []
  513. this.hotProductPageNo = 1
  514. this.getProductList()
  515. },
  516. getProductList(){
  517. this.status = "loading"
  518. const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_storeShelf.dealerSn : ''
  519. // 获取推荐产品
  520. getShopProductList({pageNo:this.hotProductPageNo,pageSize:10,hotFlag:1, status: 1, dealerSn: dealerSn}).then(res => {
  521. if(res.status == 200){
  522. const list = res.data ? res.data.list : []
  523. this.productList.push(list)
  524. this.status = res.data.count>=this.list.length ? "nomore" : 'loadmore'
  525. // 判断是否最后一页
  526. const maxPages = Math.ceil(res.data.count / 10)
  527. this.totalhotPage = maxPages
  528. this.status = this.hotProductPageNo >= maxPages ? "nomore" : 'loadmore'
  529. this.noDataText = this.status == 'nomore' ? '没有更多了' : '更多商品'
  530. }else{
  531. this.status = "nomore"
  532. this.noDataText = res.message || '没有更多了'
  533. }
  534. })
  535. },
  536. // 获取上方滚动扫描记录
  537. getScrollLog(){
  538. scanVinLogQueryRoll({pageNo:1,pageSize:50}).then(res => {
  539. this.list = res.data.list || []
  540. this.list.map(item => {
  541. item.placeText = item.userName + '刚刚扫描了一个VIN'
  542. })
  543. })
  544. },
  545. // 获取当前门店扫描记录
  546. getVinLog(){
  547. this.vinList = []
  548. this.status = "loading"
  549. // VISITOR:游客,EMPLOYEE:雇员
  550. getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
  551. this.vinList = res.data&&res.data.list || []
  552. this.vinList = this.vinList.filter(item => item.vinCode)
  553. this.status = 'nomore'
  554. })
  555. },
  556. // 扫描vin
  557. beforeSwitch(index){
  558. const row = this.$store.state.vuex_tabBarList[index]
  559. if(row.text == '促销'){
  560. uni.$emit('refashProm')
  561. }
  562. if(row.text == '购物车'){
  563. if(!this.hasLogin){
  564. this.toLogin()
  565. return true
  566. }
  567. // 游客去认证
  568. if(this.userInfo.sysUserFlag == '0'){
  569. this.toAuthStore()
  570. return true
  571. }
  572. // 打开购物车页面
  573. uni.navigateTo({
  574. url:'/pagesB/cart/index',
  575. target: 'page'
  576. })
  577. }
  578. // 打开vin扫码页面
  579. if(row.text == '扫描VIN'){
  580. this.openCamera()
  581. }else{
  582. return true
  583. }
  584. },
  585. // 去扫VIN
  586. openCamera(){
  587. if(this.hasLogin){
  588. // 游客身份
  589. if(this.userInfo.sysUserFlag == '0'){
  590. // 最多扫10次
  591. if(this.vuex_vinScanNums < this.scanMaxNums){
  592. uni.navigateTo({
  593. url: "/pages/scan-frame/scan-frame"
  594. })
  595. }else{
  596. uni.showModal({
  597. title: '提示',
  598. content: '个人用户扫描VIN仅限10次,您的次数已用完!',
  599. confirmText: '好的',
  600. showCancel: false,
  601. success(res) {}
  602. })
  603. }
  604. }else{
  605. // 非游客,直接扫
  606. uni.navigateTo({
  607. url: "/pages/scan-frame/scan-frame"
  608. })
  609. }
  610. }else{
  611. this.toLogin()
  612. }
  613. },
  614. // 去搜索产品
  615. toSearch(event){
  616. uni.navigateTo({
  617. url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
  618. })
  619. },
  620. // 促销活动的轮播图片
  621. getCarousel(){
  622. this.carouselList = []
  623. // 获取所有促销活动数据
  624. promoTerminalList({}).then(res => {
  625. if(res.status == 200){
  626. res.data&&res.data.map(item => {
  627. item.image = item.imageSet&&item.imageSet[0] // 默认取第一张图片
  628. })
  629. this.carouselList = res.data
  630. }
  631. })
  632. },
  633. // 快速导航单击
  634. onNavFun(item){
  635. if(item.auth){
  636. // 非游客
  637. if(this.userInfo.sysUserFlag == '1'){
  638. // 编码取货
  639. if(item.url=='openTakeGood1'){
  640. this.openTakeGood(1)
  641. }
  642. // 扫码取货
  643. if(item.url=='openTakeGood0'){
  644. this.openTakeGood(0)
  645. }
  646. }else{
  647. // 去认证
  648. this.toAuthStore()
  649. }
  650. }else{
  651. this.toLogin()
  652. }
  653. },
  654. // 获取数据字典
  655. getListLookUp() {
  656. const _this = this;
  657. listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
  658. if (res.status == 200) {
  659. _this.$store.state.vuex_allLookUp = res.data;
  660. }
  661. });
  662. },
  663. // 或某一项字典列表,参数code
  664. getLookUpList(code, vuexKey) {
  665. getLookUpDatas({ type: code }).then(res => {
  666. if (res.status == 200) {
  667. this.$store.state[vuexKey] = res.data || [];
  668. }
  669. });
  670. },
  671. // 获取最大扫描数
  672. getMaxQty(){
  673. getScanGetMaxQty().then(res => {
  674. this.scanMaxNums = res.data || 10
  675. this.$store.state.vuex_scanMaxNums = this.scanMaxNums
  676. })
  677. },
  678. // 获取最新申请门店
  679. findLastApply(){
  680. const mobile = this.userInfo.mobile
  681. this.$store.dispatch('getSotreAuth',mobile)
  682. },
  683. // 知道审核不通过
  684. toKnow(){
  685. uni.showLoading({
  686. title: "正在提交"
  687. })
  688. xprhStoreApplyRead({sn:this.storeApply.applySn}).then(res => {
  689. if(res.status == 200){
  690. this.findLastApply()
  691. }
  692. uni.hideLoading()
  693. })
  694. },
  695. // 待取货数量合计
  696. shelfGetTotalWaitQty(){
  697. shelfGetTotalWaitQty({billState:'WAIT'}).then(res => {
  698. if(res.status == 200){
  699. this.orderTodo = res.data;
  700. }
  701. })
  702. },
  703. // 货架订单列表
  704. toOrder(){
  705. if(this.hasShelf){
  706. uni.navigateTo({
  707. url: "/pagesA/digitalShelf/orderList"
  708. })
  709. }else{
  710. uni.showToast({
  711. icon:'none',
  712. title: '门店没有关联数字货架,无法使用此功能!'
  713. })
  714. }
  715. },
  716. // 显示购物车tab
  717. showCatTab(){
  718. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
  719. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  720. if(catIndex<0 && videoIndex >= 0){
  721. // 替换视频为购物车
  722. this.$store.state.vuex_tabBarList.splice(videoIndex,1,{
  723. "pagePath": "/pages/cart/index",
  724. "iconPath": "/static/tab/tab_cart_normal.png",
  725. "selectedIconPath": "/static/tab/tab_cart_pressed.png",
  726. "text": "购物车",
  727. 'customIcon': false,
  728. })
  729. }
  730. },
  731. // 显示视频tab,隐藏购物车
  732. showVideoTab(){
  733. const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
  734. const catIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '购物车')
  735. if(videoIndex<0 && catIndex >= 0){
  736. // 替换购物车为视频
  737. this.$store.state.vuex_tabBarList.splice(catIndex,1,{
  738. "pagePath": "/pages/videos/index",
  739. "iconPath": "/static/tab/tab_video_normal.png",
  740. "selectedIconPath": "/static/tab/tab_video_pressed.png",
  741. "text": "视频",
  742. 'customIcon': false,
  743. })
  744. }
  745. },
  746. // 显示促销模块
  747. showPromoTab(){
  748. // 添加促销模块
  749. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  750. if(promoIndex<0){
  751. this.$store.state.vuex_tabBarList.splice(1,0,{
  752. "pagePath": "/pages/promo/index",
  753. "iconPath": "/static/tab/tab_promo_normal.png",
  754. "selectedIconPath": "/static/tab/tab_promo_pressed.png",
  755. "text": "促销",
  756. 'customIcon': false,
  757. })
  758. }
  759. // 居中透出显示扫描按钮
  760. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  761. if(scanTab){
  762. scanTab.iconPath = "/static/tab/tab_scan_mid.png"
  763. scanTab.midButton = true
  764. }
  765. },
  766. // 隐藏促销模块
  767. hidePromoTab(){
  768. // 删除促销模块
  769. const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
  770. if(promoIndex > -1){
  771. this.$store.state.vuex_tabBarList.splice(promoIndex,1)
  772. }
  773. // 扫描按钮不局中
  774. const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
  775. if(scanTab){
  776. scanTab.iconPath = "/static/tab/tab_scan_normal.png"
  777. scanTab.midButton = false
  778. }
  779. },
  780. // 查询是有红包活动
  781. getRedPacketRule(){
  782. findCurrentRewardRule().then(res => {
  783. this.$store.state.vuex_rewardRule = res.data;
  784. // 商城未开通时调用
  785. if(res.data && !this.hasShopiing){
  786. this.getRedScroll()
  787. }
  788. })
  789. },
  790. // 红包奖励信息
  791. getRedScroll(){
  792. getRewardRollList({pageNo:1,pageSize:50}).then(res => {
  793. this.slist = res.data || []
  794. this.slist.map(item => {
  795. item.placeText = item.userName + '刚刚得到了'+item.totalRewardAmount+'元 红包奖励'
  796. })
  797. })
  798. },
  799. // 获取保证金金额
  800. getShelfBWPayRecord(){
  801. const data = this.$store.state.vuex_storeShelf
  802. shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
  803. console.log(res,'获取保证金金额')
  804. this.bondRecord = res.data
  805. })
  806. },
  807. // 保证金支付
  808. toPayBondAmount(){},
  809. openTakeGood(index){
  810. // 已有数字货架
  811. if(this.hasShelf){
  812. this.clickAction(index)
  813. }else{
  814. uni.showToast({
  815. icon:'none',
  816. title: '门店没有关联数字货架,无法使用此功能!'
  817. })
  818. }
  819. },
  820. // 选择取货方式
  821. clickAction(index){
  822. const shelfSn = this.hasShelf.shelfSn
  823. const _this = this
  824. // 扫描
  825. if(index == 0){
  826. uni.scanCode({
  827. success: function (ret) {
  828. const params = {
  829. codeType: ret.scanType == 'QR_CODE' ? 0 : 1
  830. }
  831. // 二维码
  832. if(ret.scanType == 'QR_CODE'){
  833. const result = ret.result.split("&")
  834. params.productSn = result[2] // 产品编码sn
  835. }else{
  836. params.qrCode = ret.result
  837. }
  838. uni.showLoading({
  839. title: "正在查询产品..."
  840. })
  841. // 确认取货
  842. getProductfindByScanCode(params).then(res => {
  843. if(res.status == 200 && res.data){
  844. if(res.data.currentInven){
  845. const billSource = ret.scanType == 'QR_CODE' ? 'qr_code': 'bar_code'
  846. const retData = Object.assign({shelfSn: shelfSn, billSource: billSource},res.data)
  847. _this.$store.state.vuex_tempData = retData
  848. uni.navigateTo({
  849. url: '/pagesA/queryByCode/confirmQh'
  850. })
  851. }else{
  852. uni.showModal({
  853. title: '提示',
  854. content: '产品库存为0,无法取货!',
  855. confirmText: '好的',
  856. showCancel: false
  857. })
  858. }
  859. }else{
  860. uni.showModal({
  861. title: '提示',
  862. content: '产品不属于此货架,请重新扫描!',
  863. confirmText: '好的',
  864. showCancel: false
  865. })
  866. }
  867. uni.hideLoading()
  868. })
  869. }
  870. });
  871. }else{
  872. // 按编码搜索
  873. uni.navigateTo({
  874. url: '/pagesA/queryByCode/queryByCode'
  875. })
  876. }
  877. },
  878. // 单击banner
  879. clickBanner(index){
  880. const row = this.imgList[index]
  881. // 红包
  882. if(row.activeType == 'redPacket'){
  883. uni.navigateTo({url:"/pages/morePage/redPacket"})
  884. }
  885. // 图文
  886. if(row.contentType == 'IMAGE_CONTENT'){
  887. uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoActiveSn})
  888. }
  889. // 视频
  890. if(row.contentType == 'VIDEO'){
  891. uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoActiveSn})
  892. }
  893. // 链接
  894. if(row.contentType == 'LINK'){
  895. // 货架促销活动
  896. if(row.content.indexOf("pagesB/promoDetail") >= 0){
  897. uni.navigateTo({
  898. url: '/pagesB/promoProduct?promoActiveSn='+row.promoActiveSn+'&title='+row.title
  899. })
  900. }else{
  901. // 外网页面
  902. openWebView({url:row.content})
  903. }
  904. }
  905. },
  906. // 查看扫描VIN记录
  907. toAllRecord(){
  908. if(this.hasLogin){
  909. uni.navigateTo({
  910. url: "/pagesA/vinRecord/vinRecord"
  911. })
  912. }else{
  913. this.toLogin()
  914. }
  915. },
  916. // 查看用户信息
  917. toUser(){
  918. if(this.hasLogin){
  919. if(this.userInfo.sysUserFlag == '1'){
  920. // 用户详细信息
  921. uni.navigateTo({
  922. url: '/pages/personData/personData'
  923. })
  924. }else{
  925. // 或 门店认证
  926. this.toAuthStore()
  927. }
  928. }else{
  929. this.toLogin()
  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>