index.vue 10.0 KB

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