123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- <template>
- <view class="container">
- <u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
- :placeholder="true" title="商品建模"></u-navbar>
- <view class="content">
- <view class="search">
- <u-search animation placeholder="商品搜索" :clearabled="false" v-model="keyword" :showAction="false"
- @search="search"></u-search>
- <view class="scan-icon" @click="scan">
- <u-icon name="scan" size="22" color="#909399"></u-icon>
- </view>
- </view>
- <view class="tab-list">
- <u-tabs :list="tabList" :scrollable="false" :current="pos" @click="tabClick" lineColor="#2C6FF3">
- </u-tabs>
- </view>
- <view class="list">
- <u-list @scrolltolower="scrolltolower" :height="fullHeight" v-if="commList.length>0">
- <u-list-item class="list-item" v-for="(item, index) in commList" :key="item.id"
- @click.native="goDetail(item)">
- <view class="comm-item">
- <view class="image">
- <u--image width="130rpx" height="130rpx" :src="item.cover" mode="widthFix"
- :lazy-load="true"></u--image>
- </view>
- <view class="item-content">
- <view>
- {{item.goodsName}}
- </view>
- <view>
- {{item.brandName}}
- </view>
- <view>
- {{item.createTime}}
- </view>
- <view class="failedMsg" v-if="item.status==-1">
- 驳回原因:{{item.failedMsg}}
- </view>
- </view>
- <view class="tag">
- <u-tag text="已通过" plain size="mini" type="success" v-if="item.status==1"></u-tag>
- <u-tag text="已驳回" plain size="mini" type="error" v-if="item.status==-1"></u-tag>
- <u-tag text="审核中" plain size="mini" type="warning" v-if="item.status==0"></u-tag>
- </view>
- </view>
- </u-list-item>
- <u-loadmore :status="status" v-if="commList.length>=1" />
- </u-list>
- <view class="empty" v-else>
- <u-empty></u-empty>
- </view>
- </view>
- </view>
- <view class="btn safe-bottom">
- <xbutton size="large" @click="$tab.navigateTo('/pages/commodity/addCom')">新品建模</xbutton>
- </view>
- </view>
- </template>
- <script>
- import {
- goodsPage
- } from "@/api/commodity/goodsMode.js"
- export default {
- data() {
- return {
- keyword: '',
- tabList: [{
- name: '已通过',
- id: 1
- },
- {
- name: '审核中',
- id: 0
- },
- {
- name: '已驳回',
- id: -1
- }
- ],
- page: 1,
- size: 10,
- keywords: '',
- pos: 1,
- current: 0,
- status: 'loadmore',
- commList: [],
- fullHeight: 0
- }
- },
- onLoad() {
- let _this = this;
- const query = uni.createSelectorQuery().in(this);
- query.select(".list").boundingClientRect((data) => {
- uni.getSystemInfo({
- success(res) {
- _this.fullHeight = res.windowHeight-218 + 'px';
- },
- });
- }).exec();
- this.getList()
- },
- methods: {
- tabClick(e) {
- console.log(e)
- this.pos = e.index;
- this.current = e.id;
- this.reset();
- this.getList();
- },
- reset() {
- this.status == 'loadmore'
- this.page = 1;
- this.size = 10;
- this.commList = [];
- },
- getList() {
- goodsPage({
- page: {
- current: this.page,
- size: this.size
- },
- keywords: this.keyword,
- status: this.current
- }).then(res => {
- let data = res.data.records;
- if (data.length < 10) {
- this.status = "nomore"
- } else {
- this.status = "loadmore"
- }
- this.commList = this.commList.concat(data)
- })
- },
- scrolltolower() {
- if (this.status == 'nomore') return
- this.page++
- this.getList()
- },
- search(val) {
- this.reset()
- this.getList()
- },
- scan() {
- uni.scanCode({
- success: function(res) {
- console.log('条码类型:' + res.scanType);
- console.log('条码内容:' + res.result);
- }
- });
- },
- // 详情
- goDetail(e) {
- this.$tab.navigateTo('/pages/commodity/addCom?id=' + e.id)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- height: 100% !important;
- }
- .container {
- height: 100% !important;
- .content {
- // padding-bottom: 88rpx;
- .search {
- padding: 24rpx 24rpx;
- background-color: #fff;
- position: relative;
- .scan-icon {
- position: absolute;
- right: 36rpx;
- top: 50%;
- transform: translateY(-50%);
- z-index: 2;
- }
- }
- .tab-list {
- width: 100%;
- padding: 0 24rpx;
- background-color: #fff;
- margin-bottosearchm: 12rpx;
- }
- .empty {
- margin: 40% auto 0;
- }
- .list {
- width: 100%;
- padding: 0 24rpx;
- margin-top: 16rpx;
- .comm-item {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- background-color: #fff;
- margin-bottom: 12rpx;
- border-radius: 12rpx;
- box-sizing: border-box;
- padding: 12rpx;
- position: relative;
- .image {
- width: 130rpx;
- height: 130rpx;
- }
- .item-content {
- padding-left: 24rpx;
- color: #999;
- >view:nth-child(1) {
- font-size: 28rpx;
- font-weight: bold;
- color: #333;
- }
- >view:nth-child(2) {
- font-size: 24rpx;
- padding: 12rpx 0;
- }
- >view:nth-child(3) {
- font-size: 24rpx;
- }
-
- .failedMsg{
- color: red;
- font-size: 24rpx;
- line-height: 30rpx;
- margin-top: 10rpx;
- }
- }
- .tag {
- position: absolute;
- right: 12rpx;
- top: 12rpx;
- }
- }
- }
- }
- .btn {
- width: 100%;
- position: fixed;
- left: 0;
- bottom: 24rpx;
- padding: 0 24rpx;
- }
- }
- </style>
|