index.vue 13 KB

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