123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <template>
- <view class="st-detailList-wrap">
- <view class="panel-box">
- <view class="type-box">
- <u-subsection @change="sectionChange" mode="subsection" height="60" :list="list" :current="curNow" :active-color="$config('primaryColor')"></u-subsection>
- </view>
- <view class="st-detailList-info">
- <view class="st-detailList-tit">
- <view class="u-line" :style="{backgroundColor: $config('primaryColor')}"></view>{{stockInfo&&stockInfo.productName ? stockInfo.productName : '--'}}
- </view>
- <view class="st-detailList-info-con flex align_center">
- <view class="pimgs">
- <u-image :src="stockInfo&&stockInfo.product&&stockInfo&&stockInfo.product.productMsg?stockInfo&&stockInfo.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
- </view>
- <view class="flex_1">
- <view>产品编码:{{stockInfo&&stockInfo.productCode ? stockInfo.productCode : '--'}}</view>
- <view class="padding_3">原厂编码:{{stockInfo&&stockInfo.productOrigCode ? stockInfo.productOrigCode : '--'}}</view>
- <view class="flex align_center justify_between">
- <view class="font_13">
- 可用数量:
- <u-count-to :end-val="stockInfo&&stockInfo.currentStockQty ? stockInfo&&stockInfo.currentStockQty : 0" separator="," font-size="26"></u-count-to>个
- </view>
- <view class="font_13">
- 库存成本:
- ¥<u-count-to :end-val="stockInfo&&stockInfo.currentStockCost ? stockInfo&&stockInfo.currentStockCost : 0" separator="," font-size="26" :decimals="2"></u-count-to>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 查询结果 -->
- <scroll-view class="st-detailList-con" scroll-y @scrolltolower="onreachBottom">
- <view class="st-detailList-main">
- <!-- 库存详情 -->
- <view v-if="curNow==0" class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
- <view class="flex align_center justify_between margin-b20">
- <view :style="{color: $config('infoColor')}">{{item.putTime || '--'}}</view>
- <u-tag :text="item.putBizTypeDictValue" :border-color="$config('primaryColor')" shape="circle" size="mini" />
- </view>
- <view class="flex align_center justify_between">
- <view v-if="item.warehouseName || item.warehouseLocationName">{{item.warehouseName}} > {{item.warehouseLocationName}}</view>
- <view v-else>--</view>
- <view>¥{{item.putCost}} * {{item.currentQty}}{{item.productUnit}}</view>
- </view>
- </view>
- <!-- 出入库明细 -->
- <view v-if="curNow==1" class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
- <view class="flex align_center justify_between margin-b20">
- <view :style="{color: $config('infoColor')}">{{item.auditTime || '--'}}</view>
- <u-tag :text="item.bizTypeDictValue" :border-color="$config('primaryColor')" shape="circle" size="mini" />
- </view>
- <view class="flex align_center justify_between">
- <view>{{item.unitName || '--'}}</view>
- <view :style="{color: item.flowType=='PUT' ? 'green':'red'}"><text v-if="item.qty!=0">{{ item.flowType=='PUT' ? '+':'-' }}</text>{{ item.qty }}{{item.productUnit}}</view>
- </view>
- </view>
- <view v-if="listData && listData.length == 0">
- <u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- import { stockDetailList, stockFlowList } from '@/api/stock'
- export default{
- data(){
- return {
- list: [
- { name: '库存详情' },
- { name: '出入库明细' }
- ],
- totalData: null,
- totalNum: 0,
- listData: [],
- pageNo: 1,
- pageSize: 10,
- stockInfo: null,
- noDataText: '暂无数据',
- curNow: 0,
- theme: ''
- }
- },
- onLoad(option) {
- this.theme = getApp().globalData.theme
- this.stockInfo = option.data ? JSON.parse(option.data) : null
- this.getList()
- },
- methods: {
- // 列表
- getList(pageNo){
- const _this = this
- if (pageNo) {
- this.pageNo = pageNo
- }
- let url = stockDetailList
- if(this.curNow == 0){ // 库存详情
- url = stockDetailList
- }else if(this.curNow == 1){ // 出入库明细
- url = stockFlowList
- }
- url({ pageNo: this.pageNo, pageSize: this.pageSize }).then(res => {
- if (res.status == 200) {
- if(this.pageNo>1){
- this.listData = this.listData.concat(res.data.list || [])
- }else{
- this.listData = res.data.list || []
- }
- this.totalNum = res.data.count || 0
- } else {
- this.listData = []
- this.totalNum = 0
- this.noDataText = res.message
- }
- })
- },
- // scroll-view到底部加载更多
- onreachBottom() {
- if(this.listData.length < this.totalNum){
- this.pageNo += 1
- this.getList()
- }
- },
- // 详情
- getDetail(data){
- if(this.curNow == 0){ // 库存详情
- uni.navigateTo({ url: "/pages/stock/stockDetail?productData="+JSON.stringify(this.stockInfo)+"&data="+JSON.stringify(data) })
- }else if(this.curNow == 1){ // 出入库明细
- uni.navigateTo({ url: "/pages/stock/warehouseDetail?productData="+JSON.stringify(this.stockInfo)+"&data="+JSON.stringify(data) })
- }
- },
- sectionChange(index) {
- this.curNow = index
- this.getList(1)
- }
- }
- }
- </script>
- <style lang="scss">
- .st-detailList-wrap{
- width: 100%;
- height: 100vh;
- .panel-box {
- background-color: #ffffff;
- box-shadow: 3upx 2upx 6upx #eee;
- margin-bottom: 20upx;
- .type-box{
- margin: 0 auto 20upx;
- width: 65%;
- }
- .st-detailList-info{
- background: #ffffff;
- padding: 20upx;
- margin-bottom: 25upx;
- border-radius: 25upx;
- box-shadow: 1px 1px 3px #EEEEEE;
- .st-detailList-tit{
- padding-bottom: 20upx;
- border-bottom: 1px solid #e4e7ed;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- .u-line{
- display: inline-block;
- width: 6upx;
- height: 40upx;
- background-color: red;
- vertical-align: bottom;
- margin: 0 20upx 0 10upx;
- }
- }
- .st-detailList-info-con{
- padding: 20upx 20upx 6upx;
- font-size: 26upx;
- .pimgs{
- margin-right: 16upx;
- }
- .font_13{
- font-size: 26upx;
- }
- .padding_3{
- padding: 6upx 0;
- }
- }
- }
- }
- .st-detailList-con{
- height: calc(100vh - 356upx);
- .st-detailList-main{
- .st-detailList-main-item{
- background-color: #fff;
- margin: 0 20upx 10upx;
- border-radius: 25upx;
- box-shadow: 1px 1px 3px #EEEEEE;
- padding: 20upx 20upx;
- .margin-b20{
- margin-bottom: 20upx;
- }
- }
- }
-
- }
- }
- </style>
|