index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view class="content">
  3. <view class="header-box">
  4. <view class="status_bar"></view>
  5. <view class="title"><text>管配件,就用</text>修配一码通</view>
  6. </view>
  7. <view class="body-box">
  8. <!-- 滚动区域 -->
  9. <view class="scroll-list">
  10. <scrollBox :list="list"></scrollBox>
  11. </view>
  12. <!-- 保证金 -->
  13. <view class="notices flex align_center" v-if="bondRecord" @click="toPayBondAmount">
  14. <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 您有一笔保证金待支付 ¥{{bondRecord.bondAmount}}</view> <text>立即支付>></text>
  15. </view>
  16. <!-- 名片 -->
  17. <view class="userCard flex align_center justify_between" @click="toUser">
  18. <view class="userCard-info flex align_center justify_between">
  19. <view>
  20. <u-image v-if="!hasLogin" src="/static/def_personal_avatar.png" width="60" height="60"></u-image>
  21. <open-data v-else type="userAvatarUrl" class="user-photo"></open-data>
  22. </view>
  23. <view>
  24. <view v-if="!hasLogin" style="font-size: 40rpx;">
  25. 请点击登录/注册
  26. </view>
  27. <view v-else>
  28. <view>王杰</view>
  29. <view>宇博极速汽车维修养护中心</view>
  30. </view>
  31. </view>
  32. </view>
  33. <view>
  34. <u-icon name="arrow-right"></u-icon>
  35. </view>
  36. </view>
  37. <!-- 扫描按钮 -->
  38. <view class="scanButton flex align_center" @click="openCamera">
  39. <u-icon name="scan" size="40"></u-icon><text class="ml10">扫描VIN</text>
  40. </view>
  41. <!-- 扫描记录 -->
  42. <u-cell-group :border="false">
  43. <u-cell-item title="扫描记录" @click="toAllRecord" :title-style="{fontSize:'1.1em'}" value="查看全部">
  44. <u-icon slot="icon" size="38" color="#00aaff" style="margin-right: 0.3em;" name="order"></u-icon>
  45. </u-cell-item>
  46. </u-cell-group>
  47. </view>
  48. <!-- 扫描记录 -->
  49. <view class="list-box">
  50. <u-cell-group :border="false">
  51. <u-cell-item v-for="item in vinList" :key="item.id" :title="item.vinCode" :title-style="{fontSize:'1em'}" :value="item.brandName +' '+item.modelName">
  52. <text slot="icon"></text>
  53. </u-cell-item>
  54. <view style="padding: 20upx;">
  55. <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>
  56. <u-loadmore v-if="status=='loading'" :status="status" />
  57. </view>
  58. </u-cell-group>
  59. <view class="des" v-if="vinList.length">仅展示最近10条记录,点击“全部”查看更多</view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import {
  65. mapState,
  66. mapMutations
  67. } from 'vuex'
  68. import scrollBox from '@/components/scrollBox.vue'
  69. import { shelfBondRecordWaitPayRecord, findStoreShelf } from '@/api/shelf.js'
  70. import { listLookUp, getLookUpDatas } from '@/api/data.js';
  71. import { scanVinLogQueryRoll, getScanVinLogList }from '@/api/car.js'
  72. export default {
  73. components: {
  74. scrollBox
  75. },
  76. data() {
  77. return {
  78. status: 'loading',
  79. noDataText: '暂无数据',
  80. bondRecord: null, // 保证金
  81. list:[],
  82. vinList: []
  83. }
  84. },
  85. computed: {
  86. ...mapState(['hasLogin']),
  87. hasShelf(){
  88. return this.$store.state.vuex_storeShelf
  89. }
  90. },
  91. onLoad() {
  92. this.getStoreShelf()
  93. // 获取数据字典
  94. this.getListLookUp();
  95. // 获取支付,收款方式
  96. this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
  97. },
  98. onShow() {
  99. // 获取扫描记录
  100. this.getScrollLog()
  101. this.getVinLog()
  102. },
  103. methods: {
  104. // 获取数据字典
  105. getListLookUp() {
  106. const _this = this;
  107. listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
  108. if (res.status == 200) {
  109. _this.$store.state.vuex_allLookUp = res.data;
  110. }
  111. });
  112. },
  113. // 或某一项字典列表,参数code
  114. getLookUpList(code, vuexKey) {
  115. getLookUpDatas({ type: code }).then(res => {
  116. if (res.status == 200) {
  117. this.$store.state[vuexKey] = res.data || [];
  118. }
  119. });
  120. },
  121. getScrollLog(){
  122. scanVinLogQueryRoll({pageNo:1,pageSize:1000}).then(res => {
  123. this.list = res.data.list || []
  124. })
  125. },
  126. getVinLog(){
  127. this.status = "loading"
  128. getScanVinLogList({pageNo:1,pageSize:10}).then(res => {
  129. this.vinList = res.data.list || []
  130. this.vinList = this.vinList.filter(item => item.vinCode)
  131. this.status = 'nomore'
  132. })
  133. },
  134. // 查询是否支持数字货架
  135. getStoreShelf(){
  136. findStoreShelf().then(res => {
  137. console.log(res)
  138. this.$store.state.vuex_storeShelf = res.data;
  139. if(res.data){
  140. // 保证金查询
  141. this.getShelfBWPayRecord()
  142. }
  143. })
  144. },
  145. // 获取保证金金额
  146. getShelfBWPayRecord(){
  147. const data = this.$store.state.vuex_storeShelf
  148. shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
  149. console.log(res,'获取保证金金额')
  150. this.bondRecord = res.data
  151. })
  152. },
  153. // 保证金支付
  154. toPayBondAmount(){
  155. },
  156. // 去扫描
  157. openCamera(){
  158. uni.navigateTo({
  159. url: "/pages/scan-frame/scan-frame"
  160. })
  161. },
  162. // 查看扫描记录
  163. toAllRecord(){
  164. uni.navigateTo({
  165. url: "/pages/vinRecord/vinRecord"
  166. })
  167. },
  168. toUser(){
  169. uni.navigateTo({
  170. url: this.hasLogin ? '/pages/personData/personData' : '/pages/login/login'
  171. })
  172. }
  173. }
  174. }
  175. </script>
  176. <style lang="less">
  177. .content {
  178. margin: 0;
  179. padding: 0;
  180. height: 100vh;
  181. display: flex;
  182. flex-direction: column;
  183. background-image: linear-gradient(#86defa 0%,#cdeff9 25%,#ffffff 40%);
  184. .header-box{
  185. padding: 0.3em 1em;
  186. .status_bar {
  187. height: var(--status-bar-height);
  188. width: 100%;
  189. }
  190. .title{
  191. padding-top: 0.4em;
  192. font-size: 1.5em;
  193. color: #000;
  194. text{
  195. color: #0077fd;
  196. }
  197. }
  198. }
  199. .body-box{
  200. padding: 0.5em 1em;
  201. .notices{
  202. padding: 0.5em 0 0;
  203. view{
  204. color: #f2a557;
  205. }
  206. text{
  207. color: #0077fd;
  208. margin-left: 1em;
  209. }
  210. }
  211. .userCard{
  212. margin-top: 0.8em;
  213. padding:0.8em;
  214. background: #fff;
  215. border-radius: 1em;
  216. box-shadow: 0.2em 0.3em 0.8em #cdeff9;
  217. .userCard-info{
  218. > view{
  219. &:last-child{
  220. margin-left: 0.5em;
  221. >view{
  222. padding: 0.2em;
  223. }
  224. }
  225. }
  226. }
  227. .user-photo{
  228. display: block;
  229. width: 120rpx;
  230. height: 120rpx;
  231. border-radius: 50%;
  232. overflow: hidden;
  233. }
  234. }
  235. .scanButton{
  236. margin: 0.6em 0;
  237. padding: 0.5em;
  238. background: #1283d4;
  239. color: #fff;
  240. font-size: 1.5em;
  241. border-radius: 5em;
  242. justify-content: center;
  243. &:active{
  244. opacity: 0.8;
  245. }
  246. }
  247. .ml10{
  248. margin-left: 0.2em;
  249. }
  250. }
  251. .list-box{
  252. flex-grow: 1;
  253. padding: 0 1em;
  254. overflow: auto;
  255. .des{
  256. text-align: center;
  257. padding: 1em 0;
  258. color: #999;
  259. font-size: 0.8em;
  260. }
  261. }
  262. }
  263. </style>