| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <template>
- <!-- 批次明细 -->
- <view class="main-wrap" :class="{ info: isInfo }">
- <uni-search-bar class="uni-search-bar" @confirm="search" v-model="searchForm.batchNum" @input="search" cancelButton="none" placeholder="批次号"></uni-search-bar>
- <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="lower">
- <view class="order-list">
- <view class="item" v-for="(item, index) in listData" :key="index">
- <view class="title">
- <view class="s1">批次号 {{ item.batchNum }}</view>
- <view class="s2" v-if="baseInfo.assetType == 3" @click="_getAnalysisCertificate(item)">质检单</view>
- </view>
- <view class="main">
- <view class="row">
- <view class="row-item">
- <text class="t1">库存数量</text>
- <text class="t2">{{ item.realInventoryNum }}</text>
- </view>
- <view class="row-item">
- <text class="t1">计量单位</text>
- <text class="t2">{{ item.unit }}</text>
- </view>
- </view>
- <view class="row">
- <view class="row-item">
- <text class="t1">包装数量</text>
- <text class="t2">{{ item.measurementUnit }}</text>
- </view>
- <view class="row-item">
- <text class="t1">包装单位</text>
- <text class="t2">{{ item.minPackUnit }}</text>
- </view>
- </view>
- <view class="row">
- <view class="row-item">
- <text class="t1">首次入库时间</text>
- <text class="t2">{{ item.firstTime }}</text>
- </view>
- </view>
- <view class="row">
- <view class="row-item">
- <text class="t1">最近出库时间</text>
- <text class="t2">{{ item.lastTime }}</text>
- </view>
- </view>
- <!-- <view class="row">
- <view class="row-item">
- <text class="t1">质检单</text>
- <text
- class="t2 text-success"
- @click="_getAnalysisCertificate(item)"
- >查看</text
- >
- </view>
- </view> -->
- <!-- <view class="ckmx" @click="goDetails(item)"> 查看明细 </view> -->
- </view>
- </view>
- </view>
- <u-loadmore :status="status" style="margin: 20rpx 0" />
- </scroll-view>
- <uni-popup ref="popup" type="center">
- <img class="popImg" :src="apiUrl + itemUrl" alt="" @click="clickImg()" />
- </uni-popup>
- </view>
- </template>
- <script>
- import { post, get } from '@/utils/api.js'
- let [page, size, isEnd] = [1, 10, true]
- export default {
- props: ['batchNum', 'inventoryCode', 'isInfo', 'dimension', 'baseInfo'],
- data() {
- return {
- listData: [],
- searchForm: {
- batchNum: '',
- isZero: ''
- },
- itemUrl: '',
- status: 'loading',
- searchValue: '',
- dictObj: {
- bizScene: {
- 1: '生产入库',
- 2: '采购入库',
- 3: '赠送入库',
- 4: '借用入库',
- 5: '退还入库',
- 6: '其他入库'
- }
- },
- certificate: '',
- certificateVisible: false
- }
- },
- created() {
- this.getData()
- },
- methods: {
- // 查看图片
- clickImg() {
- wx.previewImage({
- urls: [this.apiUrl + this.itemUrl], //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
- current: this.itemUrl, // 当前显示图片的http链接,默认是第一个
- success: function (res) {},
- fail: function (res) {},
- complete: function (res) {}
- })
- },
- // 触底
- lower() {
- console.log('触底')
- if (isEnd) {
- return
- }
- this.getMoreLists()
- },
- getData() {
- let par = {
- batchNum: this.searchForm.batchNum,
- bizStatus: 1,
- inventoryCode: this.inventoryCode,
- isZero: this.searchForm.isZero,
- dimension: +this.dimension
- }
- if (this.searchValue !== '') {
- par.key = this.searchValue
- }
- // post(this.apiUrl + `/InventoryBook/select/getDetail?size=${size}&page=${page}`, par).then(res => {
- // if (res.success) {
- // this.listData = [...this.listData, ...res.data.records]
- // let pages = res.data.pages
- // if (page < pages) {
- // isEnd = false
- // } else {
- // isEnd = true
- // this.status = 'nomore'
- // }
- // }
- // })
- },
- //质检单 资产类型、资产编码以及批次号获取质检单
- async _getAnalysisCertificate(row) {
- if (row.certificate) {
- this.certificate = row.certificate
- this.$refs.popup.open()
- return
- }
- // const res = await get(
- // this.apiUrl + `/InventoryBook/select/getAnalysisCertificate`, {
- // code: this.baseInfo.assetType,
- // inventoryCode: this.inventoryCode,
- // batchNum: row.batchNum
- // }
- // )
- // if (res?.success) {
- // if (res.data?.length) {
- // this.itemUrl = res.data[0].accessUrl
- // this.clickImg()
- // // this.itemUrl = res.data[0].accessUrl
- // // this.$refs.popup.open()
- // } else {
- // uni.showToast({
- // title: '未上传质检单!',
- // icon: 'none'
- // })
- // }
- // }
- },
- getMoreLists() {
- page++
- this.getData()
- },
- search() {
- this.page = 1
- this.listData = []
- this.status = 'loading'
- this.getData()
- },
- goDetails(item) {
- console.log(item)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .popImg {
- width: 400rpx;
- height: 400rpx;
- }
- .main-wrap {
- height: calc(100% - 170rpx);
- &.info {
- height: calc(100% - 236rpx);
- }
- }
- .scroll-Y {
- height: calc(100vh - 112rpx);
- //height: 100%;
- background-color: #fafafa;
- }
- .order-list {
- .item {
- background-color: #fff;
- margin-bottom: 30rpx;
- margin-bottom: 30rpx;
- .title {
- display: flex;
- padding: 20rpx;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1px solid #dedede;
- .s1 {
- color: #333333;
- font-size: 28rpx;
- font-weight: bold;
- }
- .s2 {
- font-size: 28rpx;
- font-weight: bold;
- color: #70b603;
- }
- }
- .main {
- padding: 0 30rpx;
- .row {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 20rpx 0;
- border-bottom: 1px dashed #dedede;
- .row-item {
- .t1 {
- font-weight: bold;
- font-size: 28rpx;
- color: #333333;
- margin-right: 20rpx;
- }
- .t2 {
- font-size: 28rpx;
- color: #333333;
- }
- }
- }
- .ckmx {
- color: #70b603;
- font-size: 28rpx;
- font-weight: bold;
- padding: 20rpx;
- display: flex;
- justify-content: flex-end;
- }
- }
- }
- }
- </style>
|