index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view class="page">
  3. <view class="page-container">
  4. <u-navbar class="nav-bar" title="库存管理" :autoBack="true" :placeholder="true" v-hideNav></u-navbar>
  5. <!-- 总资产成本区域 -->
  6. <view class="asset-header">
  7. <view class="asset-text-wrap">
  8. <view class="asset-title-con">
  9. <view class="asset-title">总资产成本(元)</view>
  10. <u-icon name="question-circle" size="14" color="#999999"></u-icon>
  11. </view>
  12. <text class="asset-value">{{ wareHouseCard.totalCost }}</text>
  13. </view>
  14. <u-button class="view-btn" type="text" size="mini">查看财务报表</u-button>
  15. </view>
  16. <view class="data-cards">
  17. <view class="card-item">
  18. <text class="card-label">今日上传</text>
  19. <text class="card-value">{{ wareHouseCard.uploadCostToday }}</text>
  20. </view>
  21. <view class="card-item">
  22. <text class="card-label">今日下架</text>
  23. <text class="card-value green">{{ wareHouseCard.outStockToday }}</text>
  24. </view>
  25. <view class="card-item">
  26. <text class="card-label">商品总数</text>
  27. <text class="card-value">{{ wareHouseCard.totalNum }}</text>
  28. </view>
  29. </view>
  30. <view class="search-wrapper">
  31. <u-search placeholder="搜索编号、名称、品牌..." v-model="searchString" bg-color="#f9fafb" border-radius="4rpx"
  32. :show-action="false" class="search-input-wrap" showAction @clear="handleSearch" @custom="handleSearch"></u-search>
  33. </view>
  34. <view class="category-tabs-wrap">
  35. <u-tabs :list="tabList" :is-scroll="true" active-color="#007aff" inactive-color="#666666" font-size="28rpx"
  36. border-bottom="none" @change="switchTab" class="u-tabs-custom"></u-tabs>
  37. </view>
  38. <view class="filter-bar">
  39. <view class="sort-btn" @click="sortPickerShow = true">
  40. <text class="sort-text">{{ curSortType.label }}</text>
  41. <u-icon name="arrow-down" size="12" color="#666666" class="sort-icon"></u-icon>
  42. <u-picker :show="sortPickerShow" :columns="sortColumns" keyName="label" @confirm="handleSortChange" @cancel="sortPickerShow = false"></u-picker>
  43. </view>
  44. <view class="price-layout-btn">
  45. <view class="price-btn" type="text" @click="priceVisibleChange">
  46. <u-icon :name="priceVisible ? 'eye' : 'eye-off'" size="18" color="#1890ff" class="price-icon"></u-icon>
  47. <text class="price-text">价格可见</text>
  48. </view>
  49. <view class="layout-btn" type="text" size="mini" @click="openSearchFilter">
  50. <u-icon name="grid" size="20" color="#666666"></u-icon>
  51. <!-- 筛选列 品牌、价格范围、位置、回收时间、回收人员、鉴定人员、商品属性 -->
  52. </view>
  53. <searchFilter ref="searchFilter" @confirm="handleSearch"></searchFilter>
  54. </view>
  55. </view>
  56. <scroll-view class="goods-list" scroll-y @scrolltolower="handleLoadMore" enable-back-to-top>
  57. <view @click="handleToDetail(goods)" class="goods-item" v-for="(goods, goodsIndex) in goodsList" :key="`goods-${goodsIndex}`">
  58. <view class="goods-img-container">
  59. <image class="goods-img" :src="goods.imgUrl" mode="aspectFill" lazy-load></image>
  60. <view class="stock-indicator"
  61. v-if="goods.stock > 0"></view>
  62. </view>
  63. <view class="goods-info">
  64. <text class="goods-brand">{{ goods.name || '' }}</text>
  65. <text class="goods-name">{{ goods.model || '' }}</text>
  66. <view class="price-group">
  67. <view class="price-items">
  68. <view class="price-item">
  69. <text class="price-type">成本价</text>
  70. <text class="price">¥{{ priceVisible ? goods.costPrice : '****' }}</text>
  71. </view>
  72. <view class="price-item">
  73. <text class="price-type">销售价</text>
  74. <text class="price sales">¥{{ priceVisible ? goods.salesPrice : '****' }}</text>
  75. </view>
  76. </view>
  77. <view class="price-items">
  78. <view class="price-item">
  79. <text class="price-type">同行价</text>
  80. <text class="price">¥{{ priceVisible ? goods.peerPrice : '****' }}</text>
  81. </view>
  82. <view class="price-item">
  83. <text class="price-type">代理价</text>
  84. <text class="price">¥{{ priceVisible ? goods.agentPrice : '****' }}</text>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="others">
  89. <view class="other-item stock" >得</view>
  90. <view class="other-item">得</view>
  91. <view class="other-item">得</view>
  92. </view>
  93. </view>
  94. <view class="more">
  95. <view></view>
  96. <!-- <u-icon name="more-dot-fill" size="16" color="#666666"></u-icon> -->
  97. <text class="goods-stock"
  98. v-if="goods.stock !== null && goods.stock !== undefined && goods.stock > 0">数量:{{ goods.stock
  99. }}</text>
  100. </view>
  101. </view>
  102. <show-emtry v-if="goodsList.length === 0"></show-emtry>
  103. </scroll-view>
  104. </view>
  105. <!-- 添加按钮 -->
  106. <view class="add-button" @click="handleAdd">
  107. <u-icon name="plus" size="36" color="#ffffff"></u-icon>
  108. </view>
  109. </view>
  110. </template>
  111. <script>
  112. import searchFilter from './components/searchFilter.vue'
  113. export default {
  114. components: {
  115. searchFilter,
  116. },
  117. data() {
  118. return {
  119. searchString:'',//搜索编号、名称、品牌...
  120. searchInfo:{},
  121. pageNum:1,
  122. pageSize:10,
  123. curSortType:{
  124. id:4,
  125. label: '按入库最新',
  126. },
  127. wareHouseCard:{
  128. totalCost: '-',
  129. uploadCostToday: '-',
  130. outStockToday: '-',
  131. totalNum: '-'
  132. },
  133. tabList: [
  134. { name: "全部", id: 1 },
  135. { name: "腕表", id: 2 },
  136. { name: "箱包", id: 3 },
  137. { name: "珠宝", id: 4 },
  138. { name: "鞋靴", id: 5 },
  139. { name: "配饰", id: 6 },
  140. { name: "服饰", id: 7 },
  141. { name: "其它", id: 8 }
  142. ],
  143. goodsList: [
  144. // {
  145. // id:'123456754',//商品库存id
  146. // name:'Rolex',//商品名称
  147. // model:'Submariner Date 126610LN',//型号
  148. // costPrice:'12345',//成本价格
  149. // salesPrice:'12345',//销售价格
  150. // peerPrice:'12345',//同行价格
  151. // agentPrice:'12345',//代理价格
  152. // stock:'12345',//库存数量
  153. // imgUrl:'https://xiaohulu-crm.oss-cn-shanghai.aliyuncs.com/crm/2026/01/06/1767677335839-1767677330379.jpg',//商品图片
  154. // platform:[]//同步平台,此功能暂时不做,先定义一个字段
  155. // }
  156. ],
  157. sortPickerShow: false,
  158. sortColumns: [[
  159. {
  160. label:'按最久未下载',
  161. id:1
  162. },
  163. {
  164. label:'按最近更新',
  165. id:2
  166. },
  167. {
  168. label:'按最久更新',
  169. id:3
  170. },
  171. {
  172. label:'按入库最新',
  173. id:4
  174. },
  175. {
  176. label:'按入库最久',
  177. id:5
  178. },
  179. {
  180. label:'按价格最高',
  181. id:6
  182. },
  183. {
  184. label:'按价格最低',
  185. id:7
  186. },
  187. ]],
  188. priceVisible:true,
  189. searchPopShow:false,
  190. total:0
  191. };
  192. },
  193. methods: {
  194. getList(){
  195. uni.$u.api.wareHouseList({
  196. pageNum: this.pageNum,
  197. pageSize: this.pageSize,
  198. },
  199. {
  200. searchString:this.searchString,
  201. sortType:this.curSortType.id,
  202. ...this.searchInfo,
  203. }).then(res => {
  204. if(this.pageNum == 1){
  205. this.goodsList = res.rows;
  206. }else{
  207. this.goodsList = this.goodsList.concat(res.rows);
  208. }
  209. this.total = res.total;
  210. });
  211. },
  212. // 加载更多
  213. handleLoadMore() {
  214. console.log("加载更多");
  215. if(this.goodsList.length >= this.total){
  216. uni.$u.toast("没有更多了");
  217. return;
  218. }
  219. this.pageNum++;
  220. this.getList();
  221. },
  222. handleSearch(info){
  223. this.pageNum = 1;
  224. this.searchInfo = info;
  225. this.goodsList = [];
  226. this.getList();
  227. },
  228. switchTab(item) {
  229. this.searchInfo.category = item.id;
  230. this.handleSearch();
  231. },
  232. handleToDetail(item) {
  233. uni.navigateTo({
  234. url: `/pages/wareHouse/components/detail?id=${item.id}`,
  235. });
  236. },
  237. handleAdd() {
  238. console.log("点击添加按钮");
  239. uni.navigateTo({
  240. url: `/pages/wareHouse/components/add`
  241. });
  242. },
  243. // 获取仓库卡片数据
  244. getCard() {
  245. uni.$u.api.getWareHouseCard({ userId: this.$store.state.user.userInfo.userId }).then(res => {
  246. if (res.code === 200) {
  247. this.wareHouseCard = res.data;
  248. }
  249. });
  250. },
  251. handleSortChange(e){
  252. this.curSortType = e.value[0];
  253. this.sortPickerShow = false;
  254. this.handleSearch();
  255. },
  256. priceVisibleChange(){
  257. this.priceVisible = !this.priceVisible;
  258. },
  259. openSearchFilter(){
  260. this.$refs.searchFilter.open();
  261. },
  262. },
  263. mounted() {
  264. this.getCard();
  265. this.getList();
  266. }
  267. };
  268. </script>
  269. <style lang="scss" scoped>
  270. @import "./styles/index.scss";
  271. </style>