index.vue 11 KB

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