Commit 0e6b9197 authored by 何毅恒's avatar 何毅恒

溯源需求

parent a2a76c59
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
>批次{{pidx+1}}</view> >批次{{pidx+1}}</view>
</scroll-view> </scroll-view>
</template> </template>
</template> </template>
<!-- 字段都是不一样的 --> <!-- 字段都是不一样的 -->
...@@ -88,7 +89,16 @@ ...@@ -88,7 +89,16 @@
v-if="detail.list[cur_index].dynamic_data.goods_report_file_url && detail.list[cur_index].dynamic_data.goods_report_file_url !== '无'" v-if="detail.list[cur_index].dynamic_data.goods_report_file_url && detail.list[cur_index].dynamic_data.goods_report_file_url !== '无'"
:list="detail.list[cur_index].report_imgs" :list="detail.list[cur_index].report_imgs"
/> />
<!-- 溯源 -->
<view class="traceability" v-if="detail.list[cur_index].dynamic_data.material_log.length>0">
<view class="traceability_title">产品加工信息</view>
<view class="traceability_box" v-for="(item,index) in detail.list[cur_index].dynamic_data.material_log" :key="index">
<view class="traceability_time">{{ timestampToTime(item.operator_time) }}</view>
<view class="traceability_msg">{{ item.msg }}</view>
</view>
</view> </view>
</view>>
</template> </template>
<script> <script>
...@@ -128,6 +138,7 @@ ...@@ -128,6 +138,7 @@
i.jxs_imgs = [...i.dynamic_data.jxs_zhizhao, ...i.dynamic_data.jxs_food_production_license, ...i.dynamic_data.jxs_other_qualifications] i.jxs_imgs = [...i.dynamic_data.jxs_zhizhao, ...i.dynamic_data.jxs_food_production_license, ...i.dynamic_data.jxs_other_qualifications]
i.production_data = i.production_data ? dayjs(i.production_data * 1000).format('YYYY-MM-DD') : '--' i.production_data = i.production_data ? dayjs(i.production_data * 1000).format('YYYY-MM-DD') : '--'
i.report_imgs = [i.dynamic_data.goods_report_file_url] i.report_imgs = [i.dynamic_data.goods_report_file_url]
i.material_log = [i.dynamic_data.material_log]
}) })
this.detail = { this.detail = {
goodsInfo: { goodsInfo: {
...@@ -135,8 +146,10 @@ ...@@ -135,8 +146,10 @@
}, },
list: [...data.finList] list: [...data.finList]
} }
console.log(this.detail);
} }
}) })
}, },
handleTab(e) { handleTab(e) {
...@@ -144,7 +157,17 @@ ...@@ -144,7 +157,17 @@
console.log(curidx) console.log(curidx)
if(curidx === this.cur_index) return if(curidx === this.cur_index) return
this.cur_index = curidx this.cur_index = curidx
} },
timestampToTime(timestamp) {
let date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
let Y = date.getFullYear() + '-';
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
return Y + M + D + h + m + s;
},
} }
} }
</script> </script>
...@@ -242,4 +265,26 @@ ...@@ -242,4 +265,26 @@
@include borderBox(40rpx, 30rpx); @include borderBox(40rpx, 30rpx);
background-color: #fff; background-color: #fff;
} }
.traceability{
background-color: #fff;
padding:20rpx 30rpx;
.traceability_title{
margin-bottom: 20rpx;
font-size:28rpx;
}
.traceability_box{
display: flex;
align-items: center;
margin-bottom: 20rpx;
.traceability_time{
margin-right: 50rpx;
color:#7F7F7F;
}
.traceability_msg{
color:#7F7F7F;
}
}
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment