index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <view class="content">
  3. <view class="header-box">
  4. <UniStatusBar></UniStatusBar>
  5. <view class="title flex align_center" :style="{height:(navHeight+'px')}">
  6. <u-image src="/static/logo-h.png" width="349" height='40'></u-image>
  7. </view>
  8. </view>
  9. <view class="cbody">
  10. <view class="body-box bg-blue">
  11. <!-- 滚动区域 -->
  12. <view class="scroll-list">
  13. <scrollBox v-if="list.length" :list="list"></scrollBox>
  14. </view>
  15. <!-- 保证金 -->
  16. <view class="notices flex align_center" v-if="bondRecord" @click="toPayBondAmount">
  17. <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 您有一笔保证金待支付 ¥{{bondRecord.bondAmount}}</view>
  18. <!-- <text class="text">立即支付>></text> -->
  19. </view>
  20. <!-- 待取货提醒 -->
  21. <view class="notices flex align_center" v-if="!bondRecord&&orderTodo" @click="toOrder">
  22. <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 您有待取货的货架订单哦!</view> <text class="text">立即处理>></text>
  23. </view>
  24. <!-- 门店审核不通过 -->
  25. <view class="notices flex justify_between" v-if="storeApply&&storeApply.auditStatus=='REFUSE'&&storeApply.readFlag=='0'">
  26. <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 门店认证资料审核不通过,请重新提交审核!</view> <text class="text" @click="toKnow">知道了</text>
  27. </view>
  28. <!-- 名片 -->
  29. <view class="userCard flex align_center justify_between" @click="toUser">
  30. <view class="userCard-info flex align_center justify_between">
  31. <view>
  32. <u-image shape='circle' v-if="!hasLogin" src="/static/def_personal_avatar.png" width="90" height="90"></u-image>
  33. <u-image shape='circle' v-else :src="avatarUrl||'/static/def_personal_avatar.png'" width="90" height="90"></u-image>
  34. </view>
  35. <view class="user-info">
  36. <view v-if="!hasLogin" style="font-size: 40rpx;">
  37. 请点击登录
  38. </view>
  39. <view v-else>
  40. <view class="user-name">{{userInfo.userNameCN || userInfo.mobile}}</view>
  41. <view v-if="hasLogin&&userInfo&&userInfo.sysUserFlag == '0'">
  42. <u-tag text="个人用户" mode="dark" type="warning" shape="circle" size="mini" />
  43. </view>
  44. <view v-else>{{userInfo.orgName}}</view>
  45. </view>
  46. </view>
  47. </view>
  48. <view>
  49. <text v-if="hasLogin&&userInfo&&userInfo.sysUserFlag == '0'" class="user-rz">
  50. {{storeApply&&storeApply.auditStatus=='WAIT'?'认证门店审核中':'认证成为门店'}}
  51. </text>
  52. <u-icon name="arrow-right"></u-icon>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="body-box">
  57. <!-- 扫描按钮 -->
  58. <view class="scanButton flex align_center" @click="openCamera">
  59. <u-icon name="scan" size="60"></u-icon><text class="ml10">扫描VIN</text>
  60. </view>
  61. <view class="flex align_center justify_center">
  62. <u-image src="/static/banner1.png" width="645" height="504"></u-image>
  63. </view>
  64. </view>
  65. <!-- 扫描记录 -->
  66. <view class="list-box">
  67. <!-- 扫描记录 -->
  68. <u-cell-group :border="false">
  69. <u-cell-item title="VIN查询历史" @click="toAllRecord" :title-style="{fontSize:'1em'}" value="全部">
  70. <u-icon slot="icon" size="38" color="#066cff" style="margin-right: 0.3em;" name="order"></u-icon>
  71. </u-cell-item>
  72. </u-cell-group>
  73. <u-cell-group :border="false" v-if="hasLogin">
  74. <u-cell-item v-for="item in vinList"
  75. @click="toChoosePart(item)"
  76. :key="item.id"
  77. :title="item.vinCode"
  78. :title-style="{fontSize:'1em'}"
  79. :label="userInfo&&userInfo.sysUserFlag == '0' ? '' : (item.brandName +' '+item.modelName)">
  80. <text slot="icon"></text>
  81. </u-cell-item>
  82. <view style="padding: 20upx;">
  83. <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>
  84. <u-loadmore v-if="status=='loading'" :status="status" />
  85. </view>
  86. </u-cell-group>
  87. <view class="des" v-if="vinList.length&&hasLogin">仅展示最近5条记录,点击“全部”查看更多</view>
  88. <view class="des" v-if="!hasLogin">请登录后查看历史记录</view>
  89. </view>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. import {
  95. mapState,
  96. mapMutations,
  97. } from 'vuex'
  98. import scrollBox from '@/components/scrollBox.vue'
  99. import UniStatusBar from '@/components/uni-status-bar/uni-status-bar.vue'
  100. import { shelfBondRecordWaitPayRecord, findStoreShelf, shelfGetTotalWaitQty } from '@/api/shelf.js'
  101. import { xprhStoreApplyRead } from '@/api/xprh.js'
  102. import { listLookUp, getLookUpDatas } from '@/api/data.js';
  103. import { scanVinLogQueryRoll, getScanVinLogList, getScanGetMaxQty }from '@/api/car.js'
  104. export default {
  105. components: {
  106. scrollBox,
  107. UniStatusBar
  108. },
  109. data() {
  110. return {
  111. status: 'loading',
  112. noDataText: '暂无数据',
  113. bondRecord: null, // 保证金
  114. list:[],
  115. vinList: [],
  116. orderTodo: null,
  117. avatarUrl:'',
  118. navHeight: '44',
  119. scanMaxNums: 10
  120. }
  121. },
  122. computed: {
  123. ...mapState(['hasLogin','vuex_vinScanNums']),
  124. hasShelf(){
  125. return this.$store.state.vuex_storeShelf
  126. },
  127. userInfo(){
  128. return this.$store.state.vuex_userInfo
  129. },
  130. storeApply(){
  131. return this.$store.state.vuex_storeAuthInfo || null
  132. }
  133. },
  134. onReady() {
  135. this.getScrollLog()
  136. // 获取导航栏高度
  137. const res = uni.getSystemInfoSync()
  138. const system = res.platform
  139. if (system === 'android') {
  140. this.navHeight = 48
  141. } else if (system === 'ios') {
  142. this.navHeight = 44
  143. }
  144. },
  145. onLoad() {
  146. this.orderTodo = null
  147. this.bondRecord = null
  148. this.vinList = []
  149. // 检测是否登录
  150. this.$store.dispatch('checkLogin',()=>{
  151. // 获取数据字典
  152. this.getListLookUp();
  153. // 获取支付,收款方式
  154. this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
  155. // 初始化页面
  156. this.pageInit()
  157. })
  158. // 刷新首页数据
  159. uni.$on("refashHome",()=>{
  160. this.pageInit()
  161. })
  162. },
  163. onUnload() {
  164. uni.$off('refashHome')
  165. },
  166. // 下拉刷新
  167. onPullDownRefresh(){
  168. this.pageInit()
  169. setTimeout(function () {
  170. uni.stopPullDownRefresh();
  171. }, 1000);
  172. },
  173. onShareAppMessage() {},
  174. onShow() {
  175. if(this.hasLogin){
  176. // 查询门店认证信息
  177. if(this.userInfo.sysUserFlag == '0'){
  178. this.findLastApply()
  179. }
  180. // 用户头像
  181. this.avatarUrl = this.userInfo.extInfo&&this.userInfo.extInfo.userExtInfo ? this.userInfo.extInfo.userExtInfo.headImage : ''
  182. }
  183. },
  184. methods: {
  185. pageInit(){
  186. if(this.hasLogin){
  187. // 获取扫描记录
  188. this.getVinLog()
  189. // 非游客
  190. if(this.userInfo.sysUserFlag == '1'){
  191. // 查询是否有数字货架
  192. this.getStoreShelf()
  193. }else{
  194. // 获取扫描次数
  195. this.$store.dispatch("getScanNums")
  196. // 获取最大扫描次数
  197. this.getMaxQty()
  198. // 查询门店认证信息
  199. this.findLastApply()
  200. }
  201. }else{
  202. uni.removeStorageSync('token')
  203. }
  204. },
  205. // 获取数据字典
  206. getListLookUp() {
  207. const _this = this;
  208. listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
  209. if (res.status == 200) {
  210. _this.$store.state.vuex_allLookUp = res.data;
  211. }
  212. });
  213. },
  214. // 或某一项字典列表,参数code
  215. getLookUpList(code, vuexKey) {
  216. getLookUpDatas({ type: code }).then(res => {
  217. if (res.status == 200) {
  218. this.$store.state[vuexKey] = res.data || [];
  219. }
  220. });
  221. },
  222. // 获取最大扫描数
  223. getMaxQty(){
  224. getScanGetMaxQty().then(res => {
  225. this.scanMaxNums = res.data || 10
  226. this.$store.state.vuex_scanMaxNums = this.scanMaxNums
  227. })
  228. },
  229. // 获取最新申请门店
  230. findLastApply(){
  231. const mobile = this.userInfo.mobile
  232. this.$store.dispatch('getSotreAuth',mobile)
  233. },
  234. // 知道审核不通过
  235. toKnow(){
  236. uni.showLoading({
  237. title: "正在提交"
  238. })
  239. xprhStoreApplyRead({sn:this.storeApply.applySn}).then(res => {
  240. if(res.status == 200){
  241. this.findLastApply()
  242. }
  243. uni.hideLoading()
  244. })
  245. },
  246. // 待取货数量合计
  247. shelfGetTotalWaitQty(){
  248. shelfGetTotalWaitQty({billState:'WAIT'}).then(res => {
  249. if(res.status == 200){
  250. this.orderTodo = res.data;
  251. }
  252. })
  253. },
  254. // 货架订单列表
  255. toOrder(){
  256. if(this.hasShelf){
  257. uni.navigateTo({
  258. url: "/pages/digitalShelf/orderList"
  259. })
  260. }else{
  261. uni.showToast({
  262. icon:'none',
  263. title: '门店没有关联数字货架,无法使用此功能!'
  264. })
  265. }
  266. },
  267. // 获取上方滚动扫描记录
  268. getScrollLog(){
  269. scanVinLogQueryRoll({pageNo:1,pageSize:1000}).then(res => {
  270. console.log(res)
  271. this.list = res.data.list || []
  272. })
  273. },
  274. // 获取当前门店扫描记录
  275. getVinLog(){
  276. this.vinList = []
  277. this.status = "loading"
  278. // VISITOR:游客,EMPLOYEE:雇员
  279. getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
  280. this.vinList = res.data&&res.data.list || []
  281. this.vinList = this.vinList.filter(item => item.vinCode)
  282. this.status = 'nomore'
  283. })
  284. },
  285. // 查询是否支持数字货架
  286. getStoreShelf(){
  287. findStoreShelf().then(res => {
  288. console.log(res)
  289. this.$store.state.vuex_storeShelf = res.data;
  290. if(res.data){
  291. // 保证金查询
  292. this.getShelfBWPayRecord()
  293. // 获取订单信息
  294. this.shelfGetTotalWaitQty()
  295. }
  296. })
  297. },
  298. // 获取保证金金额
  299. getShelfBWPayRecord(){
  300. const data = this.$store.state.vuex_storeShelf
  301. shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
  302. console.log(res,'获取保证金金额')
  303. this.bondRecord = res.data
  304. })
  305. },
  306. // 保证金支付
  307. toPayBondAmount(){
  308. },
  309. // 去扫描
  310. openCamera(){
  311. if(this.hasLogin){
  312. if(this.userInfo.sysUserFlag == '0'){
  313. if(this.vuex_vinScanNums < this.scanMaxNums){
  314. uni.navigateTo({
  315. url: "/pages/scan-frame/scan-frame"
  316. })
  317. }else{
  318. uni.showModal({
  319. title: '提示',
  320. content: '个人用户扫描VIN限10次/天,您的次数已用完!',
  321. confirmText: '去认证',
  322. success(res) {
  323. if(res.confirm) {
  324. uni.navigateTo({
  325. url: '/pages/storeManage/storeAuth'
  326. })
  327. }
  328. }
  329. })
  330. }
  331. }else{
  332. uni.navigateTo({
  333. url: "/pages/scan-frame/scan-frame"
  334. })
  335. }
  336. }else{
  337. uni.navigateTo({
  338. url: '/pages/login/login'
  339. })
  340. }
  341. },
  342. // 查看扫描记录
  343. toAllRecord(){
  344. uni.navigateTo({
  345. url: this.hasLogin ? "/pages/vinRecord/vinRecord" : '/pages/login/login'
  346. })
  347. },
  348. toUser(){
  349. if(this.hasLogin){
  350. // 用户详细信息 或 门店认证
  351. uni.navigateTo({
  352. url: this.userInfo.sysUserFlag == '1' ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
  353. })
  354. }else{
  355. uni.navigateTo({
  356. url: '/pages/login/login'
  357. })
  358. }
  359. },
  360. toChoosePart(item){
  361. if(this.userInfo.sysUserFlag == '0'){
  362. return
  363. }
  364. if(this.hasShelf){
  365. item.text = item.modelInfo
  366. uni.navigateTo({
  367. url: "/pages/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))
  368. })
  369. }else{
  370. uni.showToast({
  371. icon:'none',
  372. title: '门店没有关联数字货架,无法使用此功能!'
  373. })
  374. }
  375. }
  376. }
  377. }
  378. </script>
  379. <style lang="less">
  380. .content {
  381. margin: 0;
  382. padding: 0;
  383. height: 100vh;
  384. display: flex;
  385. flex-direction: column;
  386. background-image: linear-gradient(#86defa 0%,#cdeff9 25%,#ffffff 40%);
  387. .header-box{
  388. z-index: 5;
  389. padding: 0em 1em;
  390. background: #066cff;
  391. .title{
  392. padding: 0;
  393. }
  394. }
  395. .cbody{
  396. flex-grow: 1;
  397. overflow-y: auto;
  398. overflow-x: hidden;
  399. }
  400. .body-box{
  401. padding: 0em 1em 0.8em;
  402. z-index: 4;
  403. .notices{
  404. padding: 0.5em 0 0;
  405. font-size: 0.9em;
  406. margin-top: 0.5rem;
  407. view{
  408. color: #ffaf46;
  409. max-width: 80%;
  410. }
  411. .text{
  412. color: #ffffff;
  413. margin-left: 1em;
  414. }
  415. }
  416. .scanButton{
  417. margin: 0.8em 0 0.5em;
  418. padding: 0.5em;
  419. background: #066cff;
  420. color: #fff;
  421. font-size: 1.5em;
  422. border-radius: 5em;
  423. justify-content: center;
  424. &:active{
  425. opacity: 0.8;
  426. }
  427. }
  428. .ml10{
  429. margin-left: 0.4em;
  430. }
  431. }
  432. .bg-blue{
  433. position: relative;
  434. > view{
  435. z-index: 100;
  436. position: relative;
  437. }
  438. &::after{
  439. /* 这个伪类的作用就是一个圆弧的背景色 */
  440. width: 130%;
  441. height: 100%;
  442. position: absolute;
  443. /*设置水平居中*/
  444. left: -15%;
  445. /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
  446. top: -20%;
  447. /*层叠顺序,最底层显示*/
  448. content: '';
  449. border-radius: 0 0 50% 50%;
  450. /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
  451. background: linear-gradient(to bottom, #066cff, #1d77ff);
  452. }
  453. .userCard{
  454. position:relative;
  455. left:0;
  456. bottom:-1rem;
  457. padding:0.8em;
  458. background: #fff;
  459. border-radius: 0.5em;
  460. box-shadow: 0.3em 0.3em 1em #c4e5ee;
  461. .userCard-info{
  462. > view{
  463. &:last-child{
  464. margin-left: 0.5em;
  465. line-height: 1.5em;
  466. .user-name{
  467. font-size: 1rem;
  468. }
  469. >view{
  470. padding: 0.2em;
  471. }
  472. }
  473. }
  474. }
  475. .user-rz{
  476. font-size: 0.8rem;
  477. color:#58aff5;
  478. }
  479. }
  480. }
  481. .list-box{
  482. padding: 0 1em;
  483. overflow: auto;
  484. .des{
  485. text-align: center;
  486. padding: 1em 0;
  487. color: #999;
  488. font-size: 0.8em;
  489. }
  490. }
  491. }
  492. </style>