123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391 |
- <template>
- <view class="modal-box">
- <view class="header_box">
- <view class="headerName u-flex">
- <text></text>
- <view class="shelfName u-line-1">{{shelfName}}</view>
- </view>
- <view class="searchBox">
- <view class="searchBox_l">
- <u-search
- placeholder="请输入产品编码/产品名称"
- @change="getSearchCon"
- @search="getSearchCon"
- @custom="getSearchCon"
- @clear="clearSearch"
- v-model="keyword"
- bg-color="#fff"
- :action-style="searchStyle"
- ></u-search>
- </view>
- <view class="searchBox_r" @click="sortShow = true">
- <text>排序</text>
- <u-icon color="#666666" name="paixu" custom-prefix="iscm-icon"></u-icon>
- </view>
- </view>
- </view>
- <view style="height:112rpx;vertical-align: top;"></view>
- <view v-if="list.length > 0">
- <view class="listBox" v-for="(item, i) in list" :key="i">
- <view class="listBox_l"><image :src="item.images ? item.images : `../../static/${theme}/def_img@2x.png`" width="100%" height="100%"></image></view>
- <view class="listBox_r">
- <view class="type">{{ item.productCode }}</view>
- <view class="tit">{{ item.productName }}i</view>
- <view class="bot u-flex u-row-between">
- <view>
- 适配有货
- <text>{{ item.inStockCount || 0 }}</text>
- 次
- </view>
- <view>
- 适配无货
- <text>{{ item.notStockCount || 0 }}</text>
- 次
- </view>
- </view>
- </view>
- </view>
- <view style="padding: 20rpx 0;"><u-loadmore :status="status" /></view>
- </view>
- <view v-else class="emptyStyle"><u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" text="暂无匹配产品" mode="list"></u-empty></view>
-
- <u-popup v-model="sortShow" mode="right" width="60%">
- <view class="sortPopup">
- <view class="sortList" v-for="(item, i) in sortList" :key="i" :class="isSortFlag == i ? 'sortChecked' : ''" @click="chooseSort(i)">{{ item.name }}</view>
- <view class="butBox u-flex">
-
-
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import { reportPage } from '@/api/vinLog';
- export default {
- data() {
- return {
- searchStyle: {
- border: '1rpx solid #189Dff',
- marginRight: '10rpx',
- borderRadius: '26rpx',
- color: '#189Dff',
- fontSize: '26rpx',
- padding: '4rpx 10rpx'
- },
- sortShow: false,
- keyword: '',
- sortList: [
- {
- id: 1,
- name: '最近一次VIN扫描时间降序'
- },
- {
- id: 2,
- name: '适配有货降序'
- },
- {
- id: 3,
- name: '适配无货降序'
- }
- ],
- isSortFlag: 0,
- list: [],
- shelfSn: '',
- shelfName: '',
- pageNo: 1,
- pageSize: 10,
- noDataText: '暂无数据',
- status: 'loading',
- totalNum: 0,
- total: 0,
- theme:'',
- customBtnStyle: {
- borderColor: this.$config('primaryColor'),
- backgroundColor: this.$config('primaryColor'),
- color: '#fff'
- },
- };
- },
- onLoad(options) {
- this.theme = getApp({ allowDefault: true }).globalData.theme;
- this.shelfSn = options.shelfSn;
- this.shelfName = options.shelfName;
- let ajaxData = {
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- shelfSn: this.shelfSn
- };
- this.loadData(ajaxData);
- },
- onBackPress(e) {
- if (this.sortShow) {
- this.sortShow = false;
- this.isSortFlag = 0;
- return true;
- }
- },
- methods: {
-
- loadData(params) {
- const _this = this;
- _this.status = 'loading';
- reportPage(params).then(res => {
- if (res.status == 200) {
- if (this.pageNo > 1) {
- this.list = this.list.concat(res.data.list || []);
- } else {
- this.list = res.data.list || [];
- }
- this.totalNum = res.data.count || 0;
- } else {
- this.list = [];
- this.totalNum = 0;
- this.noDataText = res.message;
- }
- this.status = 'loadmore';
- });
- },
- chooseSort(i) {
- this.isSortFlag = i;
- this.handelSort();
- },
- reset() {
- this.isSortFlag = 0;
- this.pageNo = 1;
- let ajaxData = {
- pageNo: 1,
- pageSize: this.pageSize,
- shelfSn: this.shelfSn
- };
- this.loadData(ajaxData);
- },
-
- getSearchCon() {
- this.pageNo = 1;
- var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
- var ajaxData = null;
- if (reg.test(this.keyword)) {
-
- ajaxData = {
- pageNo: 1,
- pageSize: this.pageSize,
- shelfSn: this.shelfSn,
- productName: this.keyword.trim()
- };
- } else {
- ajaxData = {
- pageNo: 1,
- pageSize: this.pageSize,
- shelfSn: this.shelfSn,
- productCode: this.keyword.trim()
- };
- }
- if (this.isSortFlag == 0) {
- ajaxData.orderBy = 'xvfp.scan_vin_date desc,xp.code asc';
- } else if (this.isSortFlag == 1) {
- ajaxData.orderBy = 'xvfp.in_stock_count desc,xp.code asc';
- } else {
- ajaxData.orderBy = 'xvfp.not_stock_count desc,xp.code asc';
- }
- this.loadData(ajaxData);
- },
-
- clearSearch() {
- this.keyword = '';
- this.reset();
-
- },
- handelSort() {
- this.pageNo = 1;
- var ajaxData = {
- shelfSn: this.shelfSn,
- pageNo: 1,
- pageSize: this.pageSize
- };
- if (this.keyword) {
- var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
- if (reg.test(this.keyword)) {
- ajaxData.productName=this.keyword.trim();
- }else{
- ajaxData.productCode=this.keyword.trim();
- }
- }
- if (this.isSortFlag == 0) {
- ajaxData.orderBy = 'xvfp.scan_vin_date desc,xp.code asc';
- } else if (this.isSortFlag == 1) {
- ajaxData.orderBy = 'xvfp.in_stock_count desc,xp.code asc';
- } else {
- ajaxData.orderBy = 'xvfp.not_stock_count desc,xp.code asc';
- }
- this.sortShow = false;
- this.loadData(ajaxData);
- }
- },
-
- onReachBottom() {
- if (this.list.length < this.totalNum) {
- this.pageNo += 1;
- var ajaxData = {
- shelfSn: this.shelfSn,
- pageNo: this.pageNo,
- pageSize: this.pageSize
- };
- if (this.keyword) {
- var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
- if (reg.test(this.keyword)) {
- ajaxData.productName=this.keyword.trim();
- }else{
- ajaxData.productCode=this.keyword.trim();
- }
- }
- if (this.isSortFlag == 0) {
- ajaxData.orderBy = 'xvfp.scan_vin_date desc,xp.code asc';
- } else if (this.isSortFlag == 1) {
- ajaxData.orderBy = 'xvfp.in_stock_count desc,xp.code asc';
- } else {
- ajaxData.orderBy = 'xvfp.not_stock_count desc,xp.code asc';
- }
- this.loadData(ajaxData);
- } else {
- this.status = 'nomore';
- }
- }
- };
- </script>
- <style lang="less" scoped>
- .modal-box {
- background: #ffffff;
- padding: 20rpx;
- width: 100%;
- .header_box{
- width: 100%;
- padding: 0 20rpx 20rpx;
- position: fixed;
- top:0;
- left:0;
- z-index: 999;
- background-color: #fff;
- .headerName{
- padding-bottom: 15rpx;
- color: #222;
- font-size: 30rpx;
- text{
- display: block;
- height: 30rpx;
- width: 6rpx;
- background: #0485F6;
- margin-right: 10rpx;
- border-radius: 10rpx;
- }
- .shelfName{
- font-weight: bold;
- width: calc(100% - 16rpx);
- }
- }
- .searchBox {
- width: 100%;
- display: flex;
- align-items: center;
- .searchBox_l {
- width: 80%;
- border: 1rpx solid #e0e0e0;
- border-radius: 36rpx;
- box-sizing: border-box;
- }
- .searchBox_r {
- width: 19%;
- color: #666666;
- text-align: right;
- text {
- margin-right: 10rpx;
- }
- }
- }
- }
- .listBox {
- width: 100%;
- display: flex;
- padding: 30rpx 0;
- border-bottom: 1rpx solid #e0e0e0;
- .listBox_l {
- width: 150rpx;
- height: 150rpx;
- overflow: hidden;
- border-radius: 20rpx;
- margin-right: 20rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .listBox_r {
- width: calc(100% - 170rpx);
- .type {
- color: #222;
- font-size: 32rpx;
- }
- .tit {
- margin: 10rpx 0;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- }
- .bot {
- width: 100%;
- view {
- &:first-child {
- color: #999;
- text {
- color: green;
- margin: 0 10rpx;
- }
- }
- &:last-child {
- color: #999;
- text {
- color: red;
- margin: 0 10rpx;
- }
- }
- }
- }
- }
- }
- // 弹窗样式
- .sortPopup {
- padding: 30rpx 20rpx;
- box-sizing: border-box;
- .sortList {
- width: 100%;
- height: 70rpx;
- text-align: center;
- line-height: 70rpx;
- border-radius: 60rpx;
- color: #333;
- margin-bottom: 30rpx;
- font-size: 26rpx;
- border: 1rpx solid #e0e0e0;
- }
- .butBox {
- margin-top: 100rpx;
- }
- .sortChecked {
- background-color: rgb(0, 122, 255);
- color: #ffffff;
- }
- }
- .emptyStyle {
- margin-top: 280rpx;
- }
- .u-size-medium {
- padding: 0 60rpx !important;
- }
- }
- </style>
|