index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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 v-if="list.length" :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="notices flex align_center" v-if="!bondRecord&&orderTodo" @click="toOrder">
  18. <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 您有待取货的货架订单哦!</view> <text>立即处理>></text>
  19. </view>
  20. <!-- 名片 -->
  21. <view class="userCard flex align_center justify_between" @click="toUser">
  22. <view class="userCard-info flex align_center justify_between">
  23. <view>
  24. <u-image v-if="!hasLogin" src="/static/def_personal_avatar.png" width="60" height="60"></u-image>
  25. <open-data v-else type="userAvatarUrl" class="user-photo"></open-data>
  26. </view>
  27. <view>
  28. <view v-if="!hasLogin" style="font-size: 40rpx;">
  29. 请点击登录
  30. </view>
  31. <view v-else>
  32. <view>{{userInfo.userNameCN}}</view>
  33. <view>{{userInfo.orgName}}</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view>
  38. <u-icon name="arrow-right"></u-icon>
  39. </view>
  40. </view>
  41. <!-- 扫描按钮 -->
  42. <view class="scanButton flex align_center" @click="openCamera">
  43. <u-icon name="scan" size="40"></u-icon><text class="ml10">扫描VIN</text>
  44. </view>
  45. <!-- 扫描记录 -->
  46. <u-cell-group :border="false">
  47. <u-cell-item title="VIN查询历史" @click="toAllRecord" :title-style="{fontSize:'1.1em'}" :value="hasLogin?'查看全部':''">
  48. <u-icon slot="icon" size="38" v-if="hasLogin" color="#00aaff" style="margin-right: 0.3em;" name="order"></u-icon>
  49. </u-cell-item>
  50. </u-cell-group>
  51. </view>
  52. <!-- 扫描记录 -->
  53. <view class="list-box">
  54. <u-cell-group :border="false" v-if="hasLogin">
  55. <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">
  56. <text slot="icon"></text>
  57. </u-cell-item>
  58. <view style="padding: 20upx;">
  59. <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>
  60. <u-loadmore v-if="status=='loading'" :status="status" />
  61. </view>
  62. </u-cell-group>
  63. <view class="des" v-if="vinList.length&&hasLogin">仅展示最近10条记录,点击“全部”查看更多</view>
  64. <view class="des" v-if="!hasLogin">请登录后查看历史记录</view>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. import {
  70. mapState,
  71. mapMutations,
  72. } from 'vuex'
  73. import scrollBox from '@/components/scrollBox.vue'
  74. import { shelfBondRecordWaitPayRecord, findStoreShelf, shelfGetTotalWaitQty } from '@/api/shelf.js'
  75. import { listLookUp, getLookUpDatas } from '@/api/data.js';
  76. import { scanVinLogQueryRoll, getScanVinLogList }from '@/api/car.js'
  77. export default {
  78. components: {
  79. scrollBox
  80. },
  81. data() {
  82. return {
  83. status: 'loading',
  84. noDataText: '暂无数据',
  85. bondRecord: null, // 保证金
  86. list:[],
  87. vinList: [],
  88. orderTodo: null,
  89. }
  90. },
  91. computed: {
  92. ...mapState(['hasLogin']),
  93. hasShelf(){
  94. return this.$store.state.vuex_storeShelf
  95. },
  96. userInfo(){
  97. return this.$store.state.vuex_userInfo
  98. }
  99. },
  100. onReady() {
  101. // 检测是否登录
  102. this.$store.dispatch('checkLogin')
  103. },
  104. onLoad() {
  105. // 获取数据字典
  106. this.getListLookUp();
  107. // 获取支付,收款方式
  108. this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
  109. },
  110. onShow() {
  111. if(this.hasLogin){
  112. // 查询是否有数字货架
  113. this.getStoreShelf()
  114. // 获取扫描记录
  115. this.getVinLog()
  116. }
  117. this.getScrollLog()
  118. },
  119. methods: {
  120. // 获取数据字典
  121. getListLookUp() {
  122. const _this = this;
  123. listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
  124. if (res.status == 200) {
  125. _this.$store.state.vuex_allLookUp = res.data;
  126. }
  127. });
  128. },
  129. // 或某一项字典列表,参数code
  130. getLookUpList(code, vuexKey) {
  131. getLookUpDatas({ type: code }).then(res => {
  132. if (res.status == 200) {
  133. this.$store.state[vuexKey] = res.data || [];
  134. }
  135. });
  136. },
  137. // 待取货数量合计
  138. shelfGetTotalWaitQty(){
  139. shelfGetTotalWaitQty({billState:'WAIT'}).then(res => {
  140. if(res.status == 200){
  141. this.orderTodo = res.data
  142. }
  143. })
  144. },
  145. // 货架订单列表
  146. toOrder(){
  147. if(this.hasShelf){
  148. uni.navigateTo({
  149. url: "/pages/digitalShelf/orderList"
  150. })
  151. }else{
  152. uni.showToast({
  153. icon:'none',
  154. title: '当前门店没有数字货架!'
  155. })
  156. }
  157. },
  158. getScrollLog(){
  159. scanVinLogQueryRoll({pageNo:1,pageSize:1000}).then(res => {
  160. this.list = res.data.list || []
  161. })
  162. },
  163. getVinLog(){
  164. this.vinList = []
  165. this.status = "loading"
  166. getScanVinLogList({pageNo:1,pageSize:10}).then(res => {
  167. this.vinList = res.data.list || []
  168. this.vinList = this.vinList.filter(item => item.vinCode)
  169. this.status = 'nomore'
  170. })
  171. },
  172. // 查询是否支持数字货架
  173. getStoreShelf(){
  174. findStoreShelf().then(res => {
  175. console.log(res)
  176. this.$store.state.vuex_storeShelf = res.data;
  177. if(res.data){
  178. // 保证金查询
  179. this.getShelfBWPayRecord()
  180. // 获取订单信息
  181. this.shelfGetTotalWaitQty()
  182. }
  183. })
  184. },
  185. // 获取保证金金额
  186. getShelfBWPayRecord(){
  187. const data = this.$store.state.vuex_storeShelf
  188. shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
  189. console.log(res,'获取保证金金额')
  190. this.bondRecord = res.data
  191. })
  192. },
  193. // 保证金支付
  194. toPayBondAmount(){
  195. },
  196. // 去扫描
  197. openCamera(){
  198. uni.navigateTo({
  199. url: this.hasLogin ? "/pages/scan-frame/scan-frame" : '/pages/login/login'
  200. })
  201. },
  202. // 查看扫描记录
  203. toAllRecord(){
  204. uni.navigateTo({
  205. url: this.hasLogin ? "/pages/vinRecord/vinRecord" : '/pages/login/login'
  206. })
  207. },
  208. toUser(){
  209. uni.navigateTo({
  210. url: this.hasLogin ? '/pages/personData/personData' : '/pages/login/login'
  211. })
  212. },
  213. toChoosePart(item){
  214. if(this.hasShelf){
  215. item.text = item.modelInfo
  216. uni.navigateTo({
  217. url: "/pages/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))
  218. })
  219. }else{
  220. uni.showToast({
  221. icon:'none',
  222. title: '当前门店没有数字货架!'
  223. })
  224. }
  225. }
  226. }
  227. }
  228. </script>
  229. <style lang="less">
  230. .content {
  231. margin: 0;
  232. padding: 0;
  233. height: 100vh;
  234. display: flex;
  235. flex-direction: column;
  236. background-image: linear-gradient(#86defa 0%,#cdeff9 25%,#ffffff 40%);
  237. .header-box{
  238. padding: 0.3em 1em;
  239. .status_bar {
  240. height: var(--status-bar-height);
  241. width: 100%;
  242. }
  243. .title{
  244. padding-top: 0.4em;
  245. font-size: 1.5em;
  246. color: #000;
  247. text{
  248. color: #0077fd;
  249. }
  250. }
  251. }
  252. .body-box{
  253. padding: 0.5em 1em;
  254. .notices{
  255. padding: 0.5em 0 0;
  256. view{
  257. color: #f2a557;
  258. }
  259. text{
  260. color: #0077fd;
  261. margin-left: 1em;
  262. }
  263. }
  264. .userCard{
  265. margin-top: 0.8em;
  266. padding:0.8em;
  267. background: #fff;
  268. border-radius: 1em;
  269. box-shadow: 0.2em 0.3em 0.8em #cdeff9;
  270. .userCard-info{
  271. > view{
  272. &:last-child{
  273. margin-left: 0.5em;
  274. >view{
  275. padding: 0.2em;
  276. }
  277. }
  278. }
  279. }
  280. .user-photo{
  281. display: block;
  282. width: 120rpx;
  283. height: 120rpx;
  284. border-radius: 50%;
  285. overflow: hidden;
  286. }
  287. }
  288. .scanButton{
  289. margin: 0.6em 0;
  290. padding: 0.5em;
  291. background: #1283d4;
  292. color: #fff;
  293. font-size: 1.5em;
  294. border-radius: 5em;
  295. justify-content: center;
  296. &:active{
  297. opacity: 0.8;
  298. }
  299. }
  300. .ml10{
  301. margin-left: 0.2em;
  302. }
  303. }
  304. .list-box{
  305. flex-grow: 1;
  306. padding: 0 1em;
  307. overflow: auto;
  308. .des{
  309. text-align: center;
  310. padding: 1em 0;
  311. color: #999;
  312. font-size: 0.8em;
  313. }
  314. }
  315. }
  316. </style>