Commit 77961b7c by liangjianmin

feat(classify-price): 增加管控标签和优化数据展示

- 在货物明细中添加管控标签,提升信息可视化。
- 更新数据展示逻辑,使用 getValue 函数处理各项数据,确保一致性。
- 优化空数据提示,增强用户体验。
parent b1d376fe
......@@ -197,6 +197,14 @@
word-break: break-all;
}
.control-tag {
margin-right: 6rpx;
color: #f04438;
font-size: 24rpx;
line-height: 36rpx;
flex-shrink: 0;
}
.goods-grid {
display: flex;
flex-wrap: wrap;
......
......@@ -87,34 +87,35 @@
<view class="section highlight-section">
<view class="section-title">明细</view>
<view class="goods-list">
<view class="goods-card" v-for="(item, index) in goodsList" :key="item.order_goods_id || index">
<view class="goods-card" v-for="(item, index) in goodsList" :key="index">
<view class="goods-header">
<view class="goods-title-box">
<text class="goods-index">{{ index + 1 }}</text>
<text class="goods-title">{{ getGoodsTitle(item) }}</text>
<text v-if="isControlGoods(item)" class="control-tag">【管控】</text>
<text class="goods-title">{{ getValue(item.goods_type) }}</text>
</view>
<text class="link-text" @click.stop="openPriceHistory(item)">历史价格</text>
</view>
<view class="goods-grid">
<view class="goods-cell">
<text class="goods-label">品牌</text>
<text class="goods-value">{{ item.brand || '-' }}</text>
<text class="goods-value">{{ getValue(item.brand) }}</text>
</view>
<view class="goods-cell">
<text class="goods-label">品名</text>
<text class="goods-value">{{ item.goods_title || '-' }}</text>
<text class="goods-value">{{ getValue(item.goods_title) }}</text>
</view>
<view class="goods-cell">
<text class="goods-label">数量</text>
<text class="goods-value">{{ item.numbers || '-' }}</text>
<text class="goods-value">{{ getValue(item.numbers) }}</text>
</view>
<view class="goods-cell">
<text class="goods-label">金额</text>
<text class="goods-value">{{ item.total_price || '-' }}</text>
<text class="goods-value">{{ getValue(item.total_price) }}</text>
</view>
<view class="goods-cell">
<text class="goods-label">海关编码</text>
<text class="goods-value">{{ item.customs_code || '-' }}</text>
<text class="goods-value">{{ getValue(item.customs_code) }}</text>
</view>
<view class="goods-cell">
<text class="goods-label">归类状态</text>
......@@ -122,11 +123,11 @@
</view>
<view class="goods-cell">
<text class="goods-label">COO</text>
<text class="goods-value">{{ item.origin || '-' }}</text>
<text class="goods-value">{{ getValue(item.origin) }}</text>
</view>
<view class="goods-cell">
<text class="goods-label">COD</text>
<text class="goods-value">{{ item.cod || '-' }}</text>
<text class="goods-value">{{ getValue(item.cod) }}</text>
</view>
<view class="goods-cell">
<text class="goods-label">是否商检</text>
......@@ -134,22 +135,27 @@
</view>
<view class="goods-cell">
<text class="goods-label">成交单位</text>
<text class="goods-value">{{ item.measurement || '-' }}</text>
<text class="goods-value">{{ getValue(item.measurement) }}</text>
</view>
<view class="goods-cell">
<text class="goods-label">物料编码</text>
<text class="goods-value">{{ getValue(item.material_sn) }}</text>
</view>
<view class="goods-cell">
<text class="goods-label">备注</text>
<text class="goods-value">{{ getValue(item.remark) }}</text>
</view>
</view>
<view class="price-row">
<text class="goods-label">单价</text>
<text class="price-value" :style="getPriceStyle(item)">{{ item.unit_price || '-' }}</text>
<text class="price-value" :style="(item.color || item.price_color) ? 'background:' + (item.color || item.price_color) + ';color:#000000' : ''">{{ getValue(item.unit_price) }}</text>
</view>
<view class="goods-desc" v-if="item.deckeyele">
<text class="goods-label">申报要素内容</text>
<text class="desc-text">{{ item.deckeyele }}</text>
</view>
<view class="goods-desc" v-if="item.material_sn || item.remark">
<text class="desc-text">{{ getGoodsExtraText(item) }}</text>
</view>
</view>
<u-empty v-if="!goodsList.length" mode="data" text="暂无货物明细" iconSize="120" textSize="24"></u-empty>
<u-empty v-if="!hasGoodsList" mode="data" text="暂无货物明细" iconSize="120" textSize="24"></u-empty>
</view>
</view>
......@@ -157,22 +163,22 @@
<view class="section-title">附件</view>
<view class="section-body">
<view class="file-title">发票Invoice:</view>
<view class="file-list" v-if="invoiceFiles.length">
<view class="file-item" v-for="(file, index) in invoiceFiles" :key="getFileKey(file, index)" @click="openFile(file)">
<view class="file-list" v-if="hasInvoiceFiles">
<view class="file-item" v-for="(file, index) in invoiceFiles" :key="index" @click="openFile(file)">
<image v-if="isImageFile(file)" class="file-image" :src="file" mode="aspectFill"></image>
<view v-else class="pdf-file">
<text class="pdf-text">PDF</text>
</view>
</view>
</view>
<view v-else class="empty-inline">暂无发票附件</view>
<view v-if="!hasInvoiceFiles" class="empty-inline">暂无发票附件</view>
</view>
</view>
<view class="section" v-if="approveLogs.length">
<view class="section-title">审批日志</view>
<view class="timeline-wrap">
<view class="timeline-item" v-for="(log, index) in approveLogs" :key="log.approve_item_id || index">
<view class="timeline-item" v-for="(log, index) in approveLogs" :key="index">
<view class="timeline-dot"></view>
<view class="timeline-content">
<view class="log-header">
......@@ -250,7 +256,7 @@
<text class="history-td">单价</text>
<text class="history-td">币种</text>
</view>
<view class="history-tr" v-for="(item, index) in recentPriceItems" :key="getHistoryKey('recent', index)">
<view class="history-tr" v-for="(item, index) in recentPriceItems" :key="index">
<text class="history-td">{{ item.business_time_cn || '-' }}</text>
<text class="history-td">{{ item.order_sn || '-' }}</text>
<text class="history-td">{{ item.goods_type || '-' }}</text>
......@@ -274,7 +280,7 @@
<text class="history-td">单价</text>
<text class="history-td">币种</text>
</view>
<view class="history-tr" v-for="(item, index) in oldPriceItems" :key="getHistoryKey('old', index)">
<view class="history-tr" v-for="(item, index) in oldPriceItems" :key="index">
<text class="history-td">{{ item.business_time_cn || '-' }}</text>
<text class="history-td">{{ item.order_sn || '-' }}</text>
<text class="history-td">{{ item.goods_type || '-' }}</text>
......@@ -303,6 +309,8 @@
order_id: '',
bill_id: '',
detail: {},
goodsList: [],
invoiceFiles: [],
approveMeta: {},
loading: false,
showApproveModal: false,
......@@ -315,20 +323,6 @@
},
computed: {
/**
* 货物明细
* @return {Array} 货物列表
*/
goodsList() {
return this.detail.items || [];
},
/**
* 发票附件列表
* @return {Array} 附件列表
*/
invoiceFiles() {
return this.getFileList(this.detail.order_invoice_file);
},
/**
* 审批日志
* @return {Array} 审批日志列表
*/
......@@ -353,6 +347,20 @@
return status === 0 || status === 1;
},
/**
* 是否有货物明细
* @return {boolean} 是否有数据
*/
hasGoodsList() {
return this.goodsList.length > 0;
},
/**
* 是否有发票附件
* @return {boolean} 是否有附件
*/
hasInvoiceFiles() {
return this.invoiceFiles.length > 0;
},
/**
* 近三月价格列表
* @return {Array} 近三月列表
*/
......@@ -421,6 +429,8 @@
return;
}
this.detail = res.data || {};
this.goodsList = this.detail.items || [];
this.invoiceFiles = this.getFileList(this.detail.order_invoice_file);
this.setPageTitle();
if (this.detail.order_sn) {
this.getApproveMeta(this.detail.order_sn);
......@@ -592,13 +602,21 @@
this.showPriceModal = false;
},
/**
* 获取商品标题
* 获取字段显示值
* @param {number|string} value - 字段值
* @return {string|number} 显示值
*/
getValue(value) {
if (value === 0 || value === '0') return value;
return value || '-';
},
/**
* 是否管控商品
* @param {Object} item - 货物明细
* @return {string} 标题
* @return {boolean} 是否管控
*/
getGoodsTitle(item) {
var controlText = Number(item.is_control) === 1 ? '【管控】' : '';
return `${controlText}${item.goods_type || '-'}`;
isControlGoods(item) {
return Number(item.is_control) === 1;
},
/**
* 获取商品归类状态
......@@ -618,18 +636,6 @@
return Number(item.is_goods_check) === 1 ? '是' : '否';
},
/**
* 获取商品补充信息
* @param {Object} item - 货物明细
* @return {string} 补充信息
*/
getGoodsExtraText(item) {
var rows = [
item.material_sn ? `物料编码:${item.material_sn}` : '',
item.remark ? `备注:${item.remark}` : ''
];
return rows.filter(Boolean).join(' ');
},
/**
* 获取单价样式
* @param {Object} item - 货物明细
* @return {Object} 样式
......
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 sign in to comment