小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

173 lines
4.8 KiB

<template>
<view class="v-pages">
<!-- 页面 筛选 -->
<view class="v-pages-filter">
<!-- 页面 搜索 -->
<view class="v-pages-search">
<uni-search-bar @confirm="search" v-model="queryParams.processingName" @cancel="cancel" @clear="clear"
placeholder="请输入溯源产品名称" cancelButton="always"></uni-search-bar>
</view>
</view>
<!-- 页面 列表 -->
<z-paging ref="paging" v-model="listData" :pagingStyle="padingStyle" @query="getListData">
<view class="v-pages-list v-container m-t-regular">
<view class="v-pages-list-item" v-for="(item,index) in listData" :key="item.id">
<!-- 页面 卡片 -->
<view class="v-card">
<!-- 卡片 内容 -->
<view class="v-card-content">
<!-- 卡片 上部 -->
<view class="v-card-top row">
<!-- 卡片 信息 -->
<view class="v-card-info col">
<view class="v-card-title row">
<text class="name col">{{ item.processingName }}</text>
</view>
<view class="v-card-state m-t-mini">
<text class="state secondary" v-if="item.speciesName">{{ item.speciesName }}
</text>
<dict-tag class="state primary" type="source_type" :value="item.sourceType" />
</view>
<view class="v-card-code">
<text class="iconfont icon-code m-r-small"></text>
{{ item.traceabilityCode }}
</view>
</view>
</view>
<!-- 卡片 下部 -->
<view class="v-card-bot">
<view class="v-card-small-item" @click="openPopup(index)">
<view class="v-card-small-box row v-page-form small">
<view class="v-form-item col">
<uni-icons type="calendar" size="14"></uni-icons>
<text
class="content m-r-small">{{ getData(item.damagedList[0].createTime) }}
</text>
报损
</view>
<view class="record">
<text class="btn">报损记录</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</z-paging>
<!-- 记录 弹框 -->
<uni-popup ref="popup">
<view class="popup-content v-container">
<view class="close" @click="closePopup">
<uni-icons type="close" size="30"></uni-icons>
</view>
<view class="m-t-extra m-b-extra">
<view class="v-popup-title">
<text>{{ RecordName }}</text>
报损记录
</view>
<view class="popup-content-list">
<view class="v-card-small-item" v-for="(item,index) in RecordData" :key="index">
<view>
<uni-icons type="calendar" class="text-primary m-r-small" size="14"></uni-icons>
<text class="content">{{ getData(item.createTime) }}</text>
</view>
<view class="v-card-small-box v-page-form small row m-t-small">
<view class="v-form-item col-12">
<text class="label">报损类型</text>
<dict-tag class="state primary" type="loss_type" :value="String(item.lossType)" />
</view>
<view class="v-form-item col-12">
<text class="label">报损数量</text>
<text class="content">{{ item.productLoss }}公斤</text>
</view>
<view class="v-form-item col-24 m-t-mini">
<text class="label">报损原因</text>
<text class="content">{{ formatData(item.lossReason) }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import * as ProductApi from "@/api/traceability/loss"
import mix from '@/utils/mix.js'
import DictTag from "@/components/DictTag/index"
export default {
components: {
DictTag
},
data() {
return {
padingStyle: {
top: '150rpx'
},
queryParams: {
processingName: null,
},
listData: [],
RecordName: null,
RecordData: [],
}
},
mixins: [mix],
methods: {
// 获取产品数据
async getListData(pageNo, pageSize) {
try {
const queryParams = {
pageNo: pageNo,
pageSize: pageSize,
processingName: this.queryParams.processingName,
}
const res = await ProductApi.getLossPage(queryParams)
this.$refs.paging.complete(res.data.list)
} catch {
this.$refs.paging.complete(false);
}
},
// 打开 弹窗
openPopup(index) {
this.RecordName = this.listData[index].processingName
this.RecordData = this.listData[index].damagedList
this.$refs.popup.open()
},
// 关闭 弹窗
closePopup() {
this.$refs.popup.close()
},
//确定搜索
search(res) {
this.$refs.paging.reload()
},
//清除搜索
clear(res) {
this.queryParams.processingName = null;
this.$refs.paging.reload()
},
//取消搜索
cancel(res) {
this.queryParams.processingName = null;
this.$refs.paging.reload()
},
}
}
</script>
<style>
</style>