Commit 9e672258 authored by June_Q's avatar June_Q

feat:溯源新增批次以及检测报告

parent 734a8506
......@@ -191,7 +191,7 @@ export function changeOrderAddr(params) {
*/
export function safeOrigin(og_id) {
return request({
url: 'zsxcx/getWarehouseGoodsMsgZS.htm',
url: 'zsxcx/getWarehouseGoodsMsgN.htm',
method: 'post',
data: {
og_id
......
......@@ -3,7 +3,7 @@
<view class="order-info">
<slot name="total"></slot>
<scroll-view scroll-x class="w-100 text-right" style="white-space: nowrap;">
<view class="btn ml-2 cancle" v-if="showLogistics && item.deliverycount" @click.stop="handleLogistics">查看物流</view>
<view class="btn ml-2 cancle" v-if="showLogistics && item.deliverycount && !['1', '6'].includes(item.order_status)" @click.stop="handleLogistics">查看物流</view>
<template v-if="!['2', '5'].includes(item.order_status)">
<!-- 先款后货 -->
......
<template>
<view class="box mb-2">
<view class="h_title text-center">
{{name}}资质证书
<template v-if="showInfo">
<view class="mb-2">
<view class="descColor mb-2">批次号</view>
<view>{{batchsn}}</view>
</view>
<view class="mb-2">
<view class="descColor mb-2">生产日期</view>
<view>{{date}}</view>
</view>
<view class="mb-2">
<view class="descColor mb-2">保质期</view>
<view>{{safedate}}</view>
</view>
<view class="mb-2">
<view class="descColor mb-2">{{name}}单位名称</view>
<view>{{originName}}</view>
</view>
<view class="mb-2">
<view class="descColor mb-2">{{name}}统一社会信用代码</view>
<view>{{originCode}}</view>
</view>
</template>
<view class="h_title text-center" v-if="title">
{{title}}
</view>
<view class="swiper-wrap" v-if="list.length > 0">
<swiper
......@@ -36,14 +58,14 @@
><text class="iconfont icon-xiangyou1" :class="{preCancle: img_current === list_len}"></text></view>
</template>
</view>
<view class="w-100 flex j-between a-center mb-2" v-if="originName">
<!-- <view class="w-100 flex j-between a-center mb-2" v-if="originName">
<view class="descColor">{{name}}单位</view>
<view>{{originName}}</view>
</view>
<view class="w-100 flex j-between a-center" v-if="originCode">
<view class="descColor">{{name}}统一社会信用代码</view>
<view>{{originCode}}</view>
</view>
</view> -->
</view>
</template>
......@@ -72,10 +94,30 @@
<script>
export default {
props: {
batchsn: {
type: String,
default: '--'
},
safedate: {
type: String,
default: '--'
},
date: {
type: String,
default: '--'
},
showInfo: {
type: Boolean,
default: false
},
name: {
type: String,
default: ''
},
title: {
type: String,
default: ''
},
originName: {
type: String,
default: ''
......@@ -132,37 +174,36 @@
<style lang="scss" scoped>
.box {
@include borderBox(40rpx, 30rpx);
@include borderBox(20rpx, 30rpx);
background-color: #fff;
.h_title {
position: relative;
width: 256rpx;
margin: 0 auto 30rpx;
margin: 0 auto 20rpx;
font-size: 28rpx;
font-weight: bold;
color: #FF661A;
&::before {
position: absolute;
left: -95rpx;
top: 50%;
transform: translateY(-50%);
display: inline-block;
content: '';
width: 100rpx;
height: 2rpx;
background-color: #FF661A;
}
&::after {
position: absolute;
right: -95rpx;
top: 50%;
transform: translateY(-50%);
display: inline-block;
content: '';
width: 100rpx;
height: 2rpx;
background-color: #FF661A;
}
// &::before {
// position: absolute;
// left: -95rpx;
// top: 50%;
// transform: translateY(-50%);
// display: inline-block;
// content: '';
// width: 100rpx;
// height: 2rpx;
// background-color: #FF661A;
// }
// &::after {
// position: absolute;
// right: -95rpx;
// top: 50%;
// transform: translateY(-50%);
// display: inline-block;
// content: '';
// width: 100rpx;
// height: 2rpx;
// background-color: #FF661A;
// }
}
.swiper-wrap {
position: relative;
......
<template>
<view class="wraper">
<image class="cover" v-if="detail.base_data.goods_img" :src="baseUrl + '/' + detail.base_data.goods_img" mode="aspectFit"></image>
<image class="cover" v-if="detail.goodsInfo.goods_img" :src="baseUrl + '/' + detail.goodsInfo.goods_img" mode="aspectFit"></image>
<view class="title">{{detail.base_data.goods_name}}</view>
<view class="title">{{detail.goodsInfo.goods_name}}</view>
<view class="information font-28 mb-2">
<view class="w-100 flex j-between a-center mb-3">
<view class="descColor">商品规格</view>
<view>{{detail.base_data.goods_attr}}</view>
<view>{{detail.goodsInfo.goods_attr}}</view>
</view>
<view class="w-100 flex j-between a-center mb-3">
<view class="descColor">产品产地</view>
<view>{{detail.base_data.production_place}}</view>
</view>
<view class="w-100 flex j-between a-center mb-3">
<view class="descColor">商品条码</view>
<view>{{detail.base_data.bar_code}}</view>
</view>
<view class="w-100 flex j-between a-center mb-3">
<view class="descColor">生产日期</view>
<view>{{detail.base_data.production_data}}</view>
<view>{{detail.goodsInfo.production_place || '--'}}</view>
</view>
<view class="w-100 flex j-between a-center">
<view class="descColor">保质期</view>
<view>{{detail.base_data.shelf_life}}</view>
<view class="descColor">商品条码</view>
<view>{{detail.goodsInfo.bar_code || '--'}}</view>
</view>
</view>
<view class="w-100 text-center hd py-2">
<view class="hd_title">商品批次</view>
</view>
<!-- 当批次大于1时显示,并且在批次数量小于或等于5时flex-, else scroll-x -->
<template v-if="detail.list.length > 1">
<template v-if="detail.list.length <= 5">
<view
class="tab-wrap text-center flex j-center a-center w-100 font-28"
@click="handleTab"
>
<view
class="tab-item flex-1"
v-for="(p, pidx) in detail.list"
:key="pidx"
:data-curidx="pidx"
:class="{'tab_active': cur_index === pidx}"
>批次{{pidx+1}}</view>
</view>
</template>
<template v-else>
<scroll-view
class="tab-wrap flex j-start w-100 font-28"
scroll-x
@click="handleTab"
>
<view
class="tab-item flex-1 px-2"
v-for="(p, pidx) in detail.list"
:key="pidx"
:data-curidx="pidx"
:class="{'tab_active': cur_index === pidx}"
>批次{{pidx+1}}</view>
</scroll-view>
</template>
</template>
<!-- 字段都是不一样的 -->
<preview-zz
v-if="detail.dynamic_data.sup_zhizhao && detail.dynamic_data.sup_zhizhao.length > 0"
v-if="detail.list[cur_index].dynamic_data.sup_zhizhao && detail.list[cur_index].dynamic_data.sup_zhizhao.length"
name="供货商"
:originName="detail.dynamic_data.sup_name"
:originCode="detail.dynamic_data.sup_unit_credit_code"
:list="detail.sup_imgs"
title="供货商资质证书"
showInfo
:batchsn="detail.list[cur_index].batch_sn"
:safedate="detail.list[cur_index].shelf_life"
:date="detail.list[cur_index].production_data"
:originName="detail.list[cur_index].dynamic_data.sup_name"
:originCode="detail.list[cur_index].dynamic_data.sup_unit_credit_code"
:list="detail.list[cur_index].sup_imgs"
/>
<preview-zz
v-if="detail.dynamic_data.jxs_zhizhao && detail.dynamic_data.jxs_zhizhao.length > 0"
v-if="detail.list[cur_index].dynamic_data.jxs_zhizhao && detail.list[cur_index].dynamic_data.jxs_zhizhao.length"
name="经销商"
:originName="detail.dynamic_data.jxs_name"
:originCode="detail.dynamic_data.jxs_unit_credit_code"
:list="detail.jxs_imgs"
title="经销商资质证书"
showInfo
:batchsn="detail.list[cur_index].batch_sn"
:safedate="detail.list[cur_index].shelf_life"
:date="detail.list[cur_index].production_data"
:originName="detail.list[cur_index].dynamic_data.jxs_name"
:originCode="detail.list[cur_index].dynamic_data.jxs_unit_credit_code"
:list="detail.list[cur_index].jxs_imgs"
/>
<preview-zz
title="商品检测报告"
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"
/>
</view>
</template>
......@@ -52,6 +98,7 @@
export default {
data() {
return {
cur_index: 0,
detail: {}
}
},
......@@ -71,13 +118,32 @@
safeOrigin(this.og_id)
.then(({status, data}) => {
if(status) {
data.base_data.production_data = data.base_data.production_data ? dayjs(data.base_data.production_data * 1000).format('YYYY-MM-DD') : '--'
// 【营业执照,许可证,其他资质]
data.sup_imgs = [...data.dynamic_data.sup_zhizhao, ...data.dynamic_data.sup_food_production_license, ...data.dynamic_data.sup_other_qualifications]
data.jxs_imgs = [...data.dynamic_data.jxs_zhizhao, ...data.dynamic_data.jxs_food_production_license, ...data.dynamic_data.jxs_other_qualifications]
this.detail = data
// data.base_data.production_data = data.base_data.production_data ? dayjs(data.base_data.production_data * 1000).format('YYYY-MM-DD') : '--'
// // 【营业执照,许可证,其他资质]
// data.sup_imgs = [...data.dynamic_data.sup_zhizhao, ...data.dynamic_data.sup_food_production_license, ...data.dynamic_data.sup_other_qualifications]
// data.jxs_imgs = [...data.dynamic_data.jxs_zhizhao, ...data.dynamic_data.jxs_food_production_license, ...data.dynamic_data.jxs_other_qualifications]
data.finList.forEach(i => {
i.sup_imgs = [...i.dynamic_data.sup_zhizhao, ...i.dynamic_data.sup_food_production_license, ...i.dynamic_data.sup_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.report_imgs = [i.dynamic_data.goods_report_file_url]
})
this.detail = {
goodsInfo: {
...data.publicData
},
list: [...data.finList]
}
}
})
},
handleTab(e) {
const { curidx } = e.target.dataset;
console.log(curidx)
if(curidx === this.cur_index) return
this.cur_index = curidx
}
}
}
......@@ -96,6 +162,81 @@
background-color: #fff;
margin-bottom: 20rpx;
}
.hd {
background-color: #fff;
.hd_title {
position: relative;
width: 256rpx;
margin: 0 auto;
font-size: 28rpx;
font-weight: bold;
color: #FF661A;
&::before {
position: absolute;
left: -48rpx;
top: 50%;
transform: translateY(-50%);
display: inline-block;
content: '';
width: 100rpx;
height: 2rpx;
background-color: #FF661A;
}
&::after {
position: absolute;
right: -48rpx;
top: 50%;
transform: translateY(-50%);
display: inline-block;
content: '';
width: 100rpx;
height: 2rpx;
background-color: #FF661A;
}
}
}
.tab-wrap {
position: relative;
height: 88rpx;
white-space: nowrap;
border-bottom: 2rpx solid $line;
&::after {
display: inline-block;
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 2rpx;
background-color: $line;
z-index: -1;
}
.tab-item {
position: relative;
display: inline-block;
height: 88rpx;
line-height: 88rpx;
}
.tab_active {
color: $primary;
font-weight: bold;
z-index: 5;
&::after {
display: inline-block;
content: '';
position: absolute;
bottom: 1rpx;
left: 50%;
transform: translateX(-50%);
width: 80%;
height: 2rpx;
background-color: $primary;
z-index: 5;
}
}
}
.information {
width: 100%;
@include borderBox(40rpx, 30rpx);
......
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