index.vue 11 KB

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