| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- <template>
- <view class="page">
- <view class="page-container">
- <u-navbar class="nav-bar" title="库存管理" :autoBack="true" :placeholder="true" v-hideNav></u-navbar>
- <!-- 总资产成本区域 -->
- <view class="asset-header">
- <view class="asset-text-wrap">
- <view class="asset-title-con">
- <view class="asset-title">总资产成本(元)</view>
- <u-icon name="question-circle" size="14" color="#999999"></u-icon>
- </view>
- <text class="asset-value">{{ wareHouseCard.totalCost }}</text>
- </view>
- <u-button class="view-btn" type="text" size="mini" @click="navigateToFakeRegistration">假货登记</u-button>
- </view>
- <view class="data-cards">
- <view class="card-item">
- <text class="card-label">今日上传</text>
- <text class="card-value">{{ wareHouseCard.uploadCostToday }}</text>
- </view>
- <view class="card-item">
- <text class="card-label">今日下架</text>
- <text class="card-value green">{{ wareHouseCard.outStockToday }}</text>
- </view>
- <view class="card-item">
- <text class="card-label">商品总数</text>
- <text class="card-value">{{ wareHouseCard.totalNum }}</text>
- </view>
- </view>
- <!-- <u-upload @afterRead="uploadTestAfter" name="1" multiple :maxCount="10"></u-upload> -->
- <view class="search-wrapper">
- <u-search placeholder="搜索编号、名称、品牌..." v-model="searchString" bg-color="#f9fafb" border-radius="4rpx"
- :show-action="false" class="search-input-wrap" showAction @clear="handleSearch" @custom="handleSearch"></u-search>
- </view>
- <view class="category-tabs-wrap">
- <u-tabs :list="tabList" :is-scroll="true" active-color="#007aff" inactive-color="#666666" font-size="28rpx" keyName="dictLabel"
- border-bottom="none" @change="switchTab" class="u-tabs-custom"></u-tabs>
- </view>
- <view class="filter-bar">
- <view class="sort-btn" @click="sortPickerShow = true">
- <text class="sort-text">{{ curSortType.label }}</text>
- <u-icon name="arrow-down" size="12" color="#666666" class="sort-icon"></u-icon>
- <u-picker :show="sortPickerShow" :columns="sortColumns" keyName="label" @confirm="handleSortChange" @cancel="sortPickerShow = false"></u-picker>
- </view>
- <view class="price-layout-btn">
- <view class="price-btn" type="text" @click="priceVisibleChange">
- <u-icon :name="priceVisible ? 'eye' : 'eye-off'" size="18" color="#1890ff" class="price-icon"></u-icon>
- <text class="price-text">价格可见</text>
- </view>
- <view class="layout-btn" type="text" size="mini" @click="openSearchFilter">
- <u-icon name="grid" size="20" color="#666666"></u-icon>
- <!-- 筛选列 品牌、价格范围、位置、回收时间、回收人员、鉴定人员、商品属性 -->
- </view>
- <searchFilter ref="searchFilter" @confirm="handleSearch"></searchFilter>
- </view>
- </view>
- <scroll-view class="goods-list" scroll-y @scrolltolower="handleLoadMore" enable-back-to-top>
- <view @click="handleToDetail(goods)" class="goods-item" v-for="(goods, goodsIndex) in goodsList" :key="`goods-${goodsIndex}`">
- <view class="goods-img-container">
- <image class="goods-img" :src="goods.goodPicFileList[0] ? goods.goodPicFileList[0] : '/static/no-img.png'" mode="aspectFill" lazy-load></image>
- <!-- <image class="goods-img" src="/static/no-img.png" mode="aspectFill" lazy-load></image> -->
- <view :class="['stock-indicator', goods.downStatus == '1' ? 'up-indicator' : 'down-indicator']"></view>
- </view>
- <view class="goods-info">
- <text class="goods-brand">{{ goods.dictLabel || '' }}</text>
- <text class="goods-name">{{ goods.model || '' }}</text>
- <view class="price-group">
- <view class="price-items">
- <view class="price-item">
- <text class="price-type">成本价</text>
- <text class="price">¥{{ priceVisible ? goods.costPrice || '-' : '****' }}</text>
- </view>
- <view class="price-item">
- <text class="price-type">销售价</text>
- <text class="price sales">¥{{ priceVisible ? goods.salePrice || '-' : '****' }}</text>
- </view>
- </view>
- <view class="price-items">
- <view class="price-item">
- <text class="price-type">同行价</text>
- <text class="price">¥{{ priceVisible ? goods.peerPrice || '-' : '****' }}</text>
- </view>
- <view class="price-item">
- <text class="price-type">代理价</text>
- <text class="price">¥{{ priceVisible ? goods.agentPrice || '-' : '****' }}</text>
- </view>
- </view>
- </view>
- <!-- <view class="others">
- <view class="other-item stock" >得</view>
- <view class="other-item">得</view>
- <view class="other-item">得</view>
- </view> -->
- </view>
- <view class="more">
- <view></view>
- <!-- <u-icon name="more-dot-fill" size="16" color="#666666"></u-icon> -->
- <text class="goods-stock"
- v-if="goods.stock !== null && goods.stock !== undefined && goods.stock > 0">数量:{{ goods.stock
- }}</text>
- </view>
- </view>
- <show-emtry v-if="goodsList.length === 0"></show-emtry>
- </scroll-view>
-
- </view>
- <!-- 添加按钮 -->
- <view class="add-button" @click="handleAdd">
- <u-icon name="plus" size="36" color="#ffffff"></u-icon>
- </view>
- </view>
-
- </template>
- <script>
- import searchFilter from './components/searchFilter.vue'
- export default {
- components: {
- searchFilter,
- },
- data() {
- return {
- searchString:'',//搜索编号、名称、品牌...
- type:'',
- searchInfo:{},
- pageNum:1,
- pageSize:10,
- curSortType:{
- id:4,
- label: '按入库最新',
- },
- wareHouseCard:{
- totalCost: '-',
- uploadCostToday: '-',
- outStockToday: '-',
- totalNum: '-'
- },
- tabList: [],
- goodsList: [
- // {
- // id:'123456754',//商品库存id
- // name:'Rolex',//商品名称
- // model:'Submariner Date 126610LN',//型号
- // costPrice:'12345',//成本价格
- // salesPrice:'12345',//销售价格
- // peerPrice:'12345',//同行价格
- // agentPrice:'12345',//代理价格
- // stock:'12345',//库存数量
- // imgUrl:'https://xiaohulu-crm.oss-cn-shanghai.aliyuncs.com/crm/2026/01/06/1767677335839-1767677330379.jpg',//商品图片
- // platform:[]//同步平台,此功能暂时不做,先定义一个字段
- // }
- ],
- sortPickerShow: false,
- sortColumns: [[
- {
- label:'按最久未下载',
- id:1
- },
- {
- label:'按最近更新',
- id:2
- },
- {
- label:'按最久更新',
- id:3
- },
- {
- label:'按入库最新',
- id:4
- },
- {
- label:'按入库最久',
- id:5
- },
- {
- label:'按价格最高',
- id:6
- },
- {
- label:'按价格最低',
- id:7
- },
- ]],
- priceVisible:true,
- searchPopShow:false,
- total:0
- };
- },
- onLoad() {
- this.getTypeList();
- },
- methods: {
- getTypeList(){
- this.$getDicts("crm_form_category").then(res => {
- this.tabList = res
- this.tabList.unshift({ dictLabel: "全部", dictValue: '' })
- })
- },
- uploadTestAfter(info){
- console.log(info);
- info.file.forEach(item=>{
- uni.$u.api.uploadFile(item.url).then((res) => {
- uni.$u.toast("文件上传成功");
- }).catch(() => {
- uni.$u.toast("上传文件失败");
- })
- })
- },
- getList(){
- uni.$u.api.wareHouseList({
- pageNum: this.pageNum,
- pageSize: this.pageSize,
- },
- {
- searchString:this.searchString,
- sortType:this.curSortType.id,
- type:this.type,
- ...this.searchInfo
- }).then(res => {
- if(this.pageNum == 1){
- this.goodsList = res.rows;
- }else{
- this.goodsList = this.goodsList.concat(res.rows);
- }
- this.total = res.total;
- });
- },
- // 加载更多
- handleLoadMore() {
- console.log("加载更多");
- if(this.goodsList.length >= this.total){
- uni.$u.toast("没有更多了");
- return;
- }
- this.pageNum++;
- this.getList();
- },
- handleSearch(info){
- this.pageNum = 1;
- this.searchInfo = info;
- this.goodsList = [];
- this.getList();
- },
- switchTab(item) {
- this.type = item.dictValue;
- this.handleSearch();
- },
- handleToDetail(item) {
- uni.navigateTo({
- url: `/pages/wareHouse/components/detail?id=${item.id}`,
- });
- },
- handleAdd() {
- uni.navigateTo({
- url: `/pages/wareHouse/components/add`
- });
- },
- // 获取仓库卡片数据
- getCard() {
- uni.$u.api.getWareHouseCard({ userId: this.$store.state.user.userInfo.userId }).then(res => {
- if (res.code === 200) {
- this.wareHouseCard = res.data;
- }
- });
- },
- handleSortChange(e){
- this.curSortType = e.value[0];
- this.sortPickerShow = false;
- this.handleSearch();
- },
- priceVisibleChange(){
- this.priceVisible = !this.priceVisible;
- },
- openSearchFilter(){
- this.$refs.searchFilter.open();
- },
- navigateToFakeRegistration() {
- uni.navigateTo({
- url: '/pages/wareHouse/components/fakeRegistration',
- });
- },
- },
- onShow() {
- this.pageNum = 1;
- this.getList();
- this.getCard();
- },
- onPullDownRefresh() {
- this.pageNum = 1;
- this.getList();
- this.getCard();
- uni.stopPullDownRefresh();
- },
- };
- </script>
- <style lang="scss" scoped>
- @import "./styles/index.scss";
- </style>
|