index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  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="userInfo&&userInfo.identifyType=='VISITOR'" 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.identifyType=='VISITOR'?'':'全部'">
  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.identifyType=='VISITOR' ? '' : (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. // 检测是否登录
  133. this.$store.dispatch('checkLogin',()=>{
  134. this.pageInit()
  135. })
  136. this.getScrollLog()
  137. // 获取导航栏高度
  138. const res = uni.getSystemInfoSync()
  139. const system = res.platform
  140. if (system === 'android') {
  141. this.navHeight = 48
  142. } else if (system === 'ios') {
  143. this.navHeight = 44
  144. }
  145. },
  146. onLoad() {
  147. // 获取数据字典
  148. this.getListLookUp();
  149. // 获取支付,收款方式
  150. this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
  151. // 刷新首页数据
  152. uni.$on("refashHome",()=>{
  153. this.pageInit()
  154. })
  155. },
  156. onUnload() {
  157. uni.$off('refashHome')
  158. },
  159. // 下拉刷新
  160. onPullDownRefresh(){
  161. this.pageInit()
  162. setTimeout(function () {
  163. uni.stopPullDownRefresh();
  164. }, 1000);
  165. },
  166. onShareAppMessage() {},
  167. onShow() {
  168. // 查询门店认证信息
  169. this.findLastApply()
  170. },
  171. methods: {
  172. pageInit(){
  173. if(this.hasLogin){
  174. this.avatarUrl = this.userInfo.avatarUrl
  175. // 查询是否有数字货架
  176. this.getStoreShelf()
  177. // 获取扫描记录
  178. this.getVinLog()
  179. // 获取扫描次数
  180. this.$store.dispatch("getScanNums")
  181. }else{
  182. uni.removeStorageSync('token')
  183. }
  184. },
  185. // 获取数据字典
  186. getListLookUp() {
  187. const _this = this;
  188. listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
  189. if (res.status == 200) {
  190. _this.$store.state.vuex_allLookUp = res.data;
  191. }
  192. });
  193. },
  194. // 或某一项字典列表,参数code
  195. getLookUpList(code, vuexKey) {
  196. getLookUpDatas({ type: code }).then(res => {
  197. if (res.status == 200) {
  198. this.$store.state[vuexKey] = res.data || [];
  199. }
  200. });
  201. },
  202. // 获取最新申请门店
  203. findLastApply(){
  204. // const mobile = this.userInfo.mobile
  205. this.$store.dispatch('getSotreAuth','11223564569')
  206. },
  207. // 知道审核不通过
  208. toKnow(){
  209. uni.showLoading({
  210. title: "正在提交"
  211. })
  212. xprhStoreApplyRead({sn:this.storeApply.applySn}).then(res => {
  213. if(res.status == 200){
  214. this.findLastApply()
  215. }
  216. uni.hideLoading()
  217. })
  218. },
  219. // 待取货数量合计
  220. shelfGetTotalWaitQty(){
  221. shelfGetTotalWaitQty({billState:'WAIT'}).then(res => {
  222. if(res.status == 200){
  223. this.orderTodo = res.data;
  224. }
  225. })
  226. },
  227. // 货架订单列表
  228. toOrder(){
  229. if(this.hasShelf){
  230. uni.navigateTo({
  231. url: "/pages/digitalShelf/orderList"
  232. })
  233. }else{
  234. uni.showToast({
  235. icon:'none',
  236. title: '门店没有关联数字货架,无法使用此功能!'
  237. })
  238. }
  239. },
  240. // 获取上方滚动扫描记录
  241. getScrollLog(){
  242. scanVinLogQueryRoll({pageNo:1,pageSize:1000}).then(res => {
  243. this.list = res.data.list || []
  244. })
  245. },
  246. // 获取当前门店扫描记录
  247. getVinLog(){
  248. this.vinList = []
  249. this.status = "loading"
  250. // VISITOR:游客,EMPLOYEE:雇员
  251. getScanVinLogList({pageNo:1,pageSize:5,identifyType: this.userInfo.identifyType}).then(res => {
  252. this.vinList = res.data.list || []
  253. this.vinList = this.vinList.filter(item => item.vinCode)
  254. this.status = 'nomore'
  255. })
  256. },
  257. // 查询是否支持数字货架
  258. getStoreShelf(){
  259. findStoreShelf().then(res => {
  260. console.log(res)
  261. this.$store.state.vuex_storeShelf = res.data;
  262. if(res.data){
  263. // 保证金查询
  264. this.getShelfBWPayRecord()
  265. // 获取订单信息
  266. this.shelfGetTotalWaitQty()
  267. }
  268. })
  269. },
  270. // 获取保证金金额
  271. getShelfBWPayRecord(){
  272. const data = this.$store.state.vuex_storeShelf
  273. shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
  274. console.log(res,'获取保证金金额')
  275. this.bondRecord = res.data
  276. })
  277. },
  278. // 保证金支付
  279. toPayBondAmount(){
  280. },
  281. // 去扫描
  282. openCamera(){
  283. if(this.hasLogin){
  284. if(this.userInfo.identifyType=='VISITOR'){
  285. if(this.vuex_vinScanNums < 10){
  286. uni.navigateTo({
  287. url: "/pages/scan-frame/scan-frame"
  288. })
  289. }else{
  290. uni.showModal({
  291. title: '提示',
  292. content: '个人用户扫描VIN限10次/天,您的次数已用完!',
  293. confirmText: '去认证',
  294. success(res) {
  295. if(res.confirm) {
  296. uni.navigateTo({
  297. url: '/pages/storeManage/storeAuth'
  298. })
  299. }
  300. }
  301. })
  302. }
  303. }else{
  304. uni.navigateTo({
  305. url: "/pages/scan-frame/scan-frame"
  306. })
  307. }
  308. }else{
  309. uni.navigateTo({
  310. url: '/pages/login/login'
  311. })
  312. }
  313. },
  314. // 查看扫描记录
  315. toAllRecord(){
  316. if(this.userInfo.identifyType == 'EMPLOYEE'){
  317. uni.navigateTo({
  318. url: this.hasLogin ? "/pages/vinRecord/vinRecord" : '/pages/login/login'
  319. })
  320. }
  321. },
  322. toUser(){
  323. if(this.hasLogin){
  324. // 用户详细信息 或 门店认证
  325. uni.navigateTo({
  326. url: this.userInfo.identifyType=='EMPLOYEE' ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
  327. })
  328. }else{
  329. uni.navigateTo({
  330. url: '/pages/storeManage/storeAuth'
  331. })
  332. }
  333. },
  334. toChoosePart(item){
  335. if(this.hasShelf){
  336. item.text = item.modelInfo
  337. uni.navigateTo({
  338. url: "/pages/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))
  339. })
  340. }else{
  341. uni.showToast({
  342. icon:'none',
  343. title: '门店没有关联数字货架,无法使用此功能!'
  344. })
  345. }
  346. }
  347. }
  348. }
  349. </script>
  350. <style lang="less">
  351. .content {
  352. margin: 0;
  353. padding: 0;
  354. height: 100vh;
  355. display: flex;
  356. flex-direction: column;
  357. background-image: linear-gradient(#86defa 0%,#cdeff9 25%,#ffffff 40%);
  358. .header-box{
  359. z-index: 5;
  360. padding: 0em 1em;
  361. background: #066cff;
  362. .title{
  363. padding: 0;
  364. }
  365. }
  366. .cbody{
  367. flex-grow: 1;
  368. overflow-y: auto;
  369. overflow-x: hidden;
  370. }
  371. .body-box{
  372. padding: 0em 1em 0.8em;
  373. z-index: 4;
  374. .notices{
  375. padding: 0.5em 0 0;
  376. font-size: 1em;
  377. view{
  378. color: #ffaf46;
  379. }
  380. .text{
  381. color: #ffffff;
  382. margin-left: 1em;
  383. }
  384. }
  385. .scanButton{
  386. margin: 0.8em 0 0.5em;
  387. padding: 0.5em;
  388. background: #066cff;
  389. color: #fff;
  390. font-size: 1.5em;
  391. border-radius: 5em;
  392. justify-content: center;
  393. &:active{
  394. opacity: 0.8;
  395. }
  396. }
  397. .ml10{
  398. margin-left: 0.4em;
  399. }
  400. }
  401. .bg-blue{
  402. position: relative;
  403. > view{
  404. z-index: 100;
  405. position: relative;
  406. }
  407. &::after{
  408. /* 这个伪类的作用就是一个圆弧的背景色 */
  409. width: 130%;
  410. height: 100%;
  411. position: absolute;
  412. /*设置水平居中*/
  413. left: -15%;
  414. /* 之所以left:20%,是因为width:140%,若width:160%,那么left:30%才能水平居中 */
  415. top: -20%;
  416. /*层叠顺序,最底层显示*/
  417. content: '';
  418. border-radius: 0 0 50% 50%;
  419. /*分别对应 左上 右上 右下 左下 可以修改成其它颜色*/
  420. background: linear-gradient(to bottom, #066cff, #1d77ff);
  421. }
  422. .userCard{
  423. position:relative;
  424. left:0;
  425. bottom:-1rem;
  426. padding:0.8em;
  427. background: #fff;
  428. border-radius: 0.5em;
  429. box-shadow: 0.3em 0.3em 1em #c4e5ee;
  430. .userCard-info{
  431. > view{
  432. &:last-child{
  433. margin-left: 0.5em;
  434. line-height: 1.5em;
  435. .user-name{
  436. font-size: 1rem;
  437. }
  438. >view{
  439. padding: 0.2em;
  440. }
  441. }
  442. }
  443. }
  444. .user-rz{
  445. font-size: 0.8rem;
  446. color:#58aff5;
  447. }
  448. }
  449. }
  450. .list-box{
  451. padding: 0 1em;
  452. overflow: auto;
  453. .des{
  454. text-align: center;
  455. padding: 1em 0;
  456. color: #999;
  457. font-size: 0.8em;
  458. }
  459. }
  460. }
  461. </style>