123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- <template>
- <view class="content">
- <view class="header-box">
- <view class="status_bar"></view>
- <view class="title"><text>管配件,就用</text>修配一码通</view>
- </view>
- <view class="body-box">
- <!-- 滚动区域 -->
- <view class="scroll-list">
- <scrollBox v-if="list.length" :list="list"></scrollBox>
- </view>
- <!-- 保证金 -->
- <view class="notices flex align_center" v-if="bondRecord" @click="toPayBondAmount">
- <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 您有一笔保证金待支付 ¥{{bondRecord.bondAmount}}</view> <text>立即支付>></text>
- </view>
- <!-- 待取货提醒 -->
- <view class="notices flex align_center" v-if="!bondRecord&&orderTodo" @click="toOrder">
- <view><u-icon name="volume" color="#f2a557" :size="28" :margin-right='15'></u-icon> 您有待取货的货架订单哦!</view> <text>立即处理>></text>
- </view>
- <!-- 名片 -->
- <view class="userCard flex align_center justify_between" @click="toUser">
- <view class="userCard-info flex align_center justify_between">
- <view>
- <u-image v-if="!hasLogin" src="/static/def_personal_avatar.png" width="60" height="60"></u-image>
- <open-data v-else type="userAvatarUrl" class="user-photo"></open-data>
- </view>
- <view>
- <view v-if="!hasLogin" style="font-size: 40rpx;">
- 请点击登录
- </view>
- <view v-else>
- <view>{{userInfo.userNameCN}}</view>
- <view>{{userInfo.orgName}}</view>
- </view>
- </view>
- </view>
- <view>
- <u-icon name="arrow-right"></u-icon>
- </view>
- </view>
- <!-- 扫描按钮 -->
- <view class="scanButton flex align_center" @click="openCamera">
- <u-icon name="scan" size="40"></u-icon><text class="ml10">扫描VIN</text>
- </view>
- <!-- 扫描记录 -->
- <u-cell-group :border="false">
- <u-cell-item title="VIN查询历史" @click="toAllRecord" :title-style="{fontSize:'1.1em'}" :value="hasLogin?'查看全部':''">
- <u-icon slot="icon" size="38" v-if="hasLogin" color="#00aaff" style="margin-right: 0.3em;" name="order"></u-icon>
- </u-cell-item>
- </u-cell-group>
- </view>
- <!-- 扫描记录 -->
- <view class="list-box">
- <u-cell-group :border="false" v-if="hasLogin">
- <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">
- <text slot="icon"></text>
- </u-cell-item>
- <view style="padding: 20upx;">
- <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>
- <u-loadmore v-if="status=='loading'" :status="status" />
- </view>
- </u-cell-group>
- <view class="des" v-if="vinList.length&&hasLogin">仅展示最近10条记录,点击“全部”查看更多</view>
- <view class="des" v-if="!hasLogin">请登录后查看历史记录</view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations,
- } from 'vuex'
- import scrollBox from '@/components/scrollBox.vue'
- import { shelfBondRecordWaitPayRecord, findStoreShelf, shelfGetTotalWaitQty } from '@/api/shelf.js'
- import { listLookUp, getLookUpDatas } from '@/api/data.js';
- import { scanVinLogQueryRoll, getScanVinLogList }from '@/api/car.js'
- export default {
- components: {
- scrollBox
- },
- data() {
- return {
- status: 'loading',
- noDataText: '暂无数据',
- bondRecord: null, // 保证金
- list:[],
- vinList: [],
- orderTodo: null,
- }
- },
- computed: {
- ...mapState(['hasLogin']),
- hasShelf(){
- return this.$store.state.vuex_storeShelf
- },
- userInfo(){
- return this.$store.state.vuex_userInfo
- }
- },
- onReady() {
- // 检测是否登录
- this.$store.dispatch('checkLogin',()=>{
- this.pageInit()
- })
- },
- onLoad() {
- // 获取数据字典
- this.getListLookUp();
- // 获取支付,收款方式
- this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
- // 刷新首页数据
- uni.$on("refashHome",()=>{
- this.pageInit()
- })
- },
- onUnload() {
- uni.$off('refashHome')
- },
- // 下拉刷新
- onPullDownRefresh(){
- this.pageInit()
- setTimeout(function () {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- methods: {
- pageInit(){
- if(this.hasLogin){
- // 查询是否有数字货架
- this.getStoreShelf()
- // 获取扫描记录
- this.getVinLog()
- }
- this.getScrollLog()
- },
- // 获取数据字典
- getListLookUp() {
- const _this = this;
- listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
- if (res.status == 200) {
- _this.$store.state.vuex_allLookUp = res.data;
- }
- });
- },
- // 或某一项字典列表,参数code
- getLookUpList(code, vuexKey) {
- getLookUpDatas({ type: code }).then(res => {
- if (res.status == 200) {
- this.$store.state[vuexKey] = res.data || [];
- }
- });
- },
- // 待取货数量合计
- shelfGetTotalWaitQty(){
- shelfGetTotalWaitQty({billState:'WAIT'}).then(res => {
- if(res.status == 200){
- this.orderTodo = res.data
- }
- })
- },
- // 货架订单列表
- toOrder(){
- if(this.hasShelf){
- uni.navigateTo({
- url: "/pages/digitalShelf/orderList"
- })
- }else{
- uni.showToast({
- icon:'none',
- title: '当前门店没有数字货架!'
- })
- }
- },
- getScrollLog(){
- scanVinLogQueryRoll({pageNo:1,pageSize:1000}).then(res => {
- this.list = res.data.list || []
- })
- },
- getVinLog(){
- this.vinList = []
- this.status = "loading"
- getScanVinLogList({pageNo:1,pageSize:10}).then(res => {
- this.vinList = res.data.list || []
- this.vinList = this.vinList.filter(item => item.vinCode)
- this.status = 'nomore'
- })
- },
- // 查询是否支持数字货架
- getStoreShelf(){
- findStoreShelf().then(res => {
- console.log(res)
- this.$store.state.vuex_storeShelf = res.data;
- if(res.data){
- // 保证金查询
- this.getShelfBWPayRecord()
- // 获取订单信息
- this.shelfGetTotalWaitQty()
- }
- })
- },
- // 获取保证金金额
- getShelfBWPayRecord(){
- const data = this.$store.state.vuex_storeShelf
- shelfBondRecordWaitPayRecord({shelfSn: data.shelfSn, storeSn: data.storeSn}).then(res => {
- console.log(res,'获取保证金金额')
- this.bondRecord = res.data
- })
- },
- // 保证金支付
- toPayBondAmount(){
-
- },
- // 去扫描
- openCamera(){
- uni.navigateTo({
- url: this.hasLogin ? "/pages/scan-frame/scan-frame" : '/pages/login/login'
- })
- },
- // 查看扫描记录
- toAllRecord(){
- uni.navigateTo({
- url: this.hasLogin ? "/pages/vinRecord/vinRecord" : '/pages/login/login'
- })
- },
- toUser(){
- uni.navigateTo({
- url: this.hasLogin ? '/pages/personData/personData' : '/pages/login/login'
- })
- },
- toChoosePart(item){
- if(this.hasShelf){
- item.text = item.modelInfo
- uni.navigateTo({
- url: "/pages/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))
- })
- }else{
- uni.showToast({
- icon:'none',
- title: '当前门店没有数字货架!'
- })
- }
- }
- }
- }
- </script>
- <style lang="less">
- .content {
- margin: 0;
- padding: 0;
- height: 100vh;
- display: flex;
- flex-direction: column;
- background-image: linear-gradient(#86defa 0%,#cdeff9 25%,#ffffff 40%);
- .header-box{
- padding: 0.3em 1em;
- .status_bar {
- height: var(--status-bar-height);
- width: 100%;
- }
- .title{
- padding-top: 0.4em;
- font-size: 1.5em;
- color: #000;
- text{
- color: #0077fd;
- }
- }
- }
- .body-box{
- padding: 0.5em 1em;
- .notices{
- padding: 0.5em 0 0;
- view{
- color: #f2a557;
- }
- text{
- color: #0077fd;
- margin-left: 1em;
- }
- }
- .userCard{
- margin-top: 0.8em;
- padding:0.8em;
- background: #fff;
- border-radius: 1em;
- box-shadow: 0.2em 0.3em 0.8em #cdeff9;
- .userCard-info{
- > view{
- &:last-child{
- margin-left: 0.5em;
- >view{
- padding: 0.2em;
- }
- }
- }
- }
- .user-photo{
- display: block;
- width: 120rpx;
- height: 120rpx;
- border-radius: 50%;
- overflow: hidden;
- }
- }
- .scanButton{
- margin: 0.6em 0;
- padding: 0.5em;
- background: #1283d4;
- color: #fff;
- font-size: 1.5em;
- border-radius: 5em;
- justify-content: center;
- &:active{
- opacity: 0.8;
- }
- }
- .ml10{
- margin-left: 0.2em;
- }
- }
- .list-box{
- flex-grow: 1;
- padding: 0 1em;
- overflow: auto;
- .des{
- text-align: center;
- padding: 1em 0;
- color: #999;
- font-size: 0.8em;
- }
- }
- }
- </style>
|