| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- <template>
- <div class="storage">
- <div class="com-mobile-header mobile-center-header">
- <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
- <p>产品入库</p>
- <p class="en-name"><img :src="`/images/mobile/center/${user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}</p>
- </div>
- <div class="mobile-fix-content mobile-centerfix-content" id="mobile-storage-center">
- <div>
- <div class="storage-record">
- <div class="search-content clearfix">
- <div class="search">
- <input type="text" v-model="filterParams.keyword" :placeholder="switchType ==='OUTBOUND' ? (handleItem === 0 ? '出库单号/买家名称':'订单号/买家名称') : (handleItem === 0 ? '入库单号/卖家名称':'发货单/卖家名称')" class="staff-search" @keyup.13="filterRecord">
- <span @click="filterRecord"><i class="iconfont icon-sousuo"></i></span>
- </div>
- </div>
- <div class="tab-content">
- <span :class="{'active': handleItem === 0}" @click="setHandleItem(0)">{{switchType === 'INBOUND' ? '查看入库记录' : '查看出库记录'}}</span>
- <span :class="{'active': handleItem === 2}" @click="setHandleItem(2)">{{switchType === 'INBOUND' ? '采购入库' : '销售出库'}}</span>
- <span :class="{'active': handleItem === 1}" @click="setHandleItem(1)">{{switchType === 'INBOUND' ? '其它入库' : '其它出库'}}</span>
- </div>
- <div class="filters-wrap" v-show="handleItem !== 1">
- <base-filter
- v-for="filterOption in filterOptions"
- :key="filterOption.selectOption"
- :selectItems="filterOption.selectItems"
- :defaultVal="filterOption.defaultVal"
- :selectOption="filterOption.selectOption"
- @selectAction="onSelectAction"
- @valueAction="onValueAction"
- :title="filterOption.title">
- </base-filter>
- </div>
- <div class="list-content">
- <storage-list :listData="storageList" :switchType="switchType" :handleItem="handleItem" v-if="handleItem !== 1"></storage-list>
- <other-storage :switchType="switchType" v-else></other-storage>
- </div>
- <empty-status v-if="isEmpty && handleItem !== 1" :type="'collect'" :showLink="true" :text="'抱歉,没有相关信息'"></empty-status>
- <pull-up :fixId="'mobile-storage-center'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
- </div>
- </div>
- </div>
- <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
- </div>
- </template>
- <script>
- import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
- import { ModalWrapper, BaseFilter } from '~components/mobile/base'
- import { StorageList, OtherStorage } from '~components/mobile/center/outOfStorage'
- export default {
- middleware: 'authenticated',
- layout: 'mobile',
- fetch({store}) {
- return Promise.all([
- store.dispatch('loadCurrencyData')
- ])
- },
- data () {
- return {
- remindText: '',
- timeoutCount: 0,
- switchType: 'INBOUND',
- handleItem: 0,
- filterOptions: [
- {
- title: '交易时间',
- selectOption: 'date',
- selectItems: [{
- key: '30天',
- val: 1
- }, {
- key: '90天',
- val: 2
- }, {
- key: '180天',
- val: 3
- }, {
- key: '自定义',
- val: 4
- }],
- defaultVal: 1
- }
- ],
- page: 1,
- isChange: false,
- storageList: [],
- filterParams:{
- count: 10
- },
- filter:{
- count: 10,
- sorting: {"createtime":"DESC"},
- status: '502-406'
- }
- }
- },
- components: {
- RemindBox,
- PullUp,
- EmptyStatus,
- BaseFilter,
- StorageList,
- OtherStorage
- },
- created () {
- this.switchType = this.$route.query.type ? this.$route.query.type : 'INBOUND'
- this.handleItem = this.$route.query.handleItem ? Number(this.$route.query.handleItem) : 0
- this.reloadList()
- },
- watch: {
- 'storageData': {
- handler: function (val) {
- if (val && val.content) {
- if(this.isChange){
- this.storageList = []
- this.isChange = false
- }
- this.storageList = [...this.storageList, ...val.content]
- }
- }
- }
- },
- computed: {
- storageData () {
- return this.allStorageData.data
- },
- allStorageData () {
- return this.$store.state.product.storage.list
- },
- fetching () {
- return this.allStorageData.fetching
- },
- allPage () {
- return this.storageData.totalPages
- },
- isEmpty () {
- return this.storageList.length === 0
- }
- },
- methods: {
- onRemind: function (str) {
- this.remindText = str
- this.timeoutCount++
- },
- onPullUpAction () {
- this.page++
- this.filterParams.page = this.page
- this.filter.page = this.page
- this.reloadList()
- },
- setHandleItem (type) {
- if(type !== this.handleItem) {
- this.handleItem = type
- if(type !== 1) {
- this.filterParams.page = 1
- this.filter.page = 1
- this.page = 1
- this.isChange = true
- this.reloadList()
- }
- }
- },
- setSelect (type, val, isReload) {
- if (type === 'date') {
- if (val) {
- this.filterParams.fromDate = val.fromDate
- this.filter.startMils = val.fromDate
- this.filterParams.toDate = val.toDate
- this.filter.endMils = val.toDate
- } else {
- this.filterParams.fromDate = null
- this.filter.startMils = null
- this.filterParams.toDate = null
- this.filter.endMils = null
- }
- } else {
- this.filterParams[type] = val
- this.filter[type] = val
- }
- isReload && this.filterRecord()
- },
- initFilterParams () {
- this.filterParams = {
- keyword: '',
- fromDate: '',
- toDate: '',
- type: ''
- },
- this.filter = {
- keyword: '',
- startMils: '',
- endMils: ''
- }
- },
- onSelectAction (selectObj) {
- this.setSelect(selectObj.key, selectObj.value, true)
- },
- onValueAction (selectObj) {
- this.setSelect(selectObj.key, selectObj.value, false)
- },
- filterRecord () {
- this.filterParams.page = 1
- this.filter.page = 1
- this.isChange = true
- this.reloadList()
- },
- reloadList () {
- this.filterParams.type = this.switchType
- if(this.handleItem === 0) {
- this.$store.dispatch('product/getLoadStorageData', this.filterParams)
- } else if(this.handleItem === 2) {
- if(this.switchType === 'INBOUND') {
- this.filterParams.type = null
- this.$store.dispatch('product/getLoadEnterpriseData', this.filterParams)
- } else {
- this.$store.dispatch('product/getLoadPurchaseData', this.filter)
- }
- }
- }
- }
- }
- </script>
- <style lang="scss">
- $base-color: #3f84f6;
- #mobile-storage-center {
- padding-bottom: .5rem;
- margin: 0 auto;
- .storage-record {
- .search-content {
- padding: .20rem 0;
- text-align: center;
- input {
- margin: 0;
- width: 7.1rem;
- border: 1px solid $base-color;
- }
- }
- .tab-content{
- margin: 0 auto .13rem;
- width: 7.1rem;
- overflow: hidden;
- text-align: center;
- span{
- float: left;
- display: inline-block;
- width: 2.36rem;
- height: .62rem;
- line-height: .62rem;
- text-align: center;
- color: #999999;
- font-size: .26rem;
- background-color: #ffffff;
- border: solid 1px #d7d7d7;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- &.active{
- background-color: #3f84f6;
- border: none;
- color: #fff;
- }
- &:first-child{
- border-top-left-radius: .05rem;
- border-bottom-left-radius: .05rem;
- }
- &:nth-child(2){
- border-left: none;
- border-right: none;
- }
- &:last-child{
- border-top-right-radius: .05rem;
- border-bottom-right-radius: .05rem;
- }
- }
- }
- .filters-wrap{
- background: #fff;
- margin: 0 auto .13rem;
- width: 7.1rem;
- overflow: hidden;
- padding: .1rem;
- }
- .list-content{
- margin: 0 auto;
- padding: 0 .20rem;
- margin-bottom:1.2rem;
- }
- }
- }
- </style>
|