index.vue 13 KB

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