123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- <template>
- <view class="moreShelfPart flex flex_column">
- <view class="moreShelfPart-search">
- <u-search
- placeholder="请输入货架名称搜索"
- v-model="queryParam.shelfName"
- :show-action="isGobleSearch"
- @input="change"
- @focus="isGobleSearch=true"
- @blur="isGobleSearch=false"
- @custom="search"
- @search="search"
- @clear="clearSearch"
- :action-style="{'color': '#fff', 'font-size': '24upx', 'background-color': '#57a3f3', 'border-radius': '6upx', 'padding': '12upx 0'}">
- </u-search>
- </view>
- <view class="flex align_center justify_between" style="padding: 10rpx 20rpx;">
- <view class="flex align_center" @click="sortList('productCategory',0)">
- <text>待补货产品款数</text>
- <view class="flex flex_column" style="margin-left: 5rpx;" >
- <u-icon name="arrow-up-fill" size="10" :color="sortVal0=='ASC'?'#666':'#ccc'"></u-icon>
- <u-icon name="arrow-down-fill" size="10" :color="sortVal0=='DESC'?'#666':'#ccc'"></u-icon>
- </view>
- </view>
- <view class="flex align_center" @click="sortList('productQty',1)">
- <text>待补货产品数量</text>
- <view class="flex flex_column" style="margin-left: 5rpx;">
- <u-icon name="arrow-up-fill" size="10" :color="sortVal1=='ASC'?'#666':'#ccc'"></u-icon>
- <u-icon name="arrow-down-fill" size="10" :color="sortVal1=='DESC'?'#666':'#ccc'"></u-icon>
- </view>
- </view>
- <view class="flex align_center" @click="sortList('lastDate',2)">
- <text>最后一次补货时间</text>
- <view class="flex flex_column" style="margin-left: 5rpx;">
- <u-icon name="arrow-up-fill" size="10" :color="sortVal2=='ASC'?'#666':'#ccc'"></u-icon>
- <u-icon name="arrow-down-fill" size="10" :color="sortVal2=='DESC'?'#666':'#ccc'"></u-icon>
- </view>
- </view>
- </view>
- <view class="moreShelfPart-body">
- <scroll-view
- class="nav-right"
- scroll-y
- @scrolltolower="onreachBottom">
- <view class="nav-right-item" v-for="(item, index) in shelfList" :key="item.id" @click="viewDetail(item)">
- <view class="item-info">
- <view class="item-name">
- <text>{{item.shelfName}}</text>
- <text style="color: #ff5500;" v-if="item.state!='ENABLE'">(状态为"已暂停")</text>
- </view>
- <view class="item-detail">
- <view>
- 待补货产品款数:
- <text class="item-detail-text">{{item.productCategory}}</text>
- </view>
- <view>
- 待补货产品数量:
- <text class="item-detail-text">{{item.productQty}}</text>
- </view>
- </view>
- <view class="item-detail">
- <view>
- 最后一次补货时间:
- <text class="item-detail-text">{{item.lastDate||'--'}}</text>
- </view>
- </view>
- </view>
- <view class="arrow">
- <u-icon name="arrow-right" color="#969da3" size="28"></u-icon>
- </view>
- </view>
- <view v-if="shelfList&&shelfList.length==0">
- <u-empty v-if="status!='loading'" :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="180" :text="noDataText" mode="list" :margin-top="200"></u-empty>
- </view>
- <view style="padding: 20upx;" v-else>
- <u-loadmore :status="status" />
- </view>
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- import { queryListForReplenish } from '@/api/shelf'
- export default {
- data() {
- return {
- isGobleSearch: false,
- shelfList: [],
- pageNo:1,
- pageSize: 15,
- total: 0, // 列表总数
- noDataText: '暂无货架',
- status: 'loading',
- tempData: null,
- allList: [],
- sortVal0:'',
- sortVal1:'',
- sortVal2:'',
- queryParam: {
- shelfName: ''
- }
- }
- },
- onReady() {
- uni.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: this.$config('primaryColor')
- })
- },
- onShow() {
- this.search()
- },
- methods: {
- clearSearch(){
- this.queryParam.shelfName = ''
- this.search()
- },
- change(v){
- if(v==''){
- this.clearSearch()
- }
- },
- // 排序
- sortList(key,index){
- // 重置其它排序字段为空
- for(let i=0;i<3;i++){
- if(i!=index){
- this['sortVal'+i] = ''
- }
- }
- const val = this['sortVal'+index]
- if(val==''){
- this['sortVal'+index] = 'ASC'
- }
- if(val=='ASC'){
- this['sortVal'+index] = 'DESC'
- }
- if(val=='DESC'){
- this['sortVal'+index] = ''
- }
-
- this.queryParam.queryWord = key
- this.queryParam.orderBy = this['sortVal'+index]
- this.search()
- },
- search(){
- this.pageNo = 1
- this.shelfList = []
- this.getShelfList()
- },
- // 获取数字货架列表
- getShelfList(){
- const _this = this
- _this.status = 'loading'
- queryListForReplenish(this.queryParam).then(res => {
- uni.hideLoading()
- if(res.status == 200){
- let list = res.data
- if (list && list.length){
- // 分页 拼接数据
- _this.shelfList = res.data.slice(0,this.pageSize)
- _this.total = res.data.length
- if (_this.shelfList.length == res.data.length) {
- _this.status = 'nomore'
- } else {
- _this.status = 'loadmore'
- }
- } else {
- _this.shelfList = list || []
- _this.total = 0
- _this.status = 'nomore'
- _this.noDataText = '没有查询到相关货架'
- }
- _this.allList = res.data
- }else{
- _this.status = 'loadmore'
- _this.shelfList = []
- _this.allList = []
- _this.total = 0
- _this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
- }
- })
- },
- // 加载更多
- onreachBottom () {
- if(this.shelfList.length < this.total ){
- if(this.isGobleSearch&&this.queryParam.shelfName==''){
- return
- }
- this.pageNo++
- this.status = 'loading'
- const s = (this.pageNo-1)*this.pageSize
- const e = s + this.pageSize
- this.shelfList = this.shelfList.concat(this.allList.slice(s,e))
- }else{
- this.status = "nomore"
- }
- },
- viewDetail (row) {
- if (row.productCategory&&row.productQty) {
- this.tempData = row
- this.tempData.chooseKey = []
- this.$store.state.vuex_tempData = null
- uni.navigateTo({
- url: "/pages/soldOut/chooseProduct?data="+encodeURIComponent(JSON.stringify(this.tempData))
- })
- } else {
- this.toashMsg('此货架没有待补货产品')
- }
- },
- }
- }
- </script>
- <style lang="less">
- .moreShelfPart{
- width: 100%;
- height: 100vh;
- background-color: #f8f8f8;
- .moreShelfPart-search{
- padding: 20rpx;
- background-color: #fff;
- }
- .moreShelfPart-body{
- flex-grow: 1;
- }
- .nav-right{
- padding: 0 30upx;
- height: calc(100vh - 160rpx);
- box-sizing: border-box;
-
- .nav-right-item{
- padding:20upx;
- border: 2rpx solid #f5f5f5;
- border-radius: 15upx;
- margin-bottom: 20upx;
- box-shadow: 3rpx 3rpx 8rpx #eee;
- background-color: #fff;
- display: flex;
- align-items: center;
- &:active{
- background: #f8f8f8;
- }
- .arrow{
- text-align: right;
- padding-left: 20rpx;
- }
- .item-info{
- flex:1;
- .item-name{
- font-size: 30upx;
- display: flex;
- align-items: center;
- }
- .item-detail{
- margin-top: 10rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: #666;
- font-size: 26upx;
- .item-detail-text{
- font-size: 26upx;
- }
- }
- }
- }
- }
- }
- </style>
|