index.vue 9.6 KB

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