- ¥{{ record.price }}
- 市场价:{{
- record.salePrice ? `¥${record.salePrice}` : '-'
- }}¥{{ record.price
+ }} ~ ¥{{ record.priceMax }}
会员价:{{
- record.dealerPrice ? `¥${record.dealerPrice}` : '-'
- }}市场价:¥{{ record.salePrice
+ }} ~ ¥{{ record.salePriceMax }}-
+ 会员价:¥{{ record.dealerPrice
+ }} ~ ¥{{ record.dealerPriceMax }}-
@@ -389,6 +409,17 @@
});
};
+ /* 价格区间文本:多规格且区间不相等时显示 ¥min ~ ¥max,否则显示单值 */
+ const fmtPrice = (min?: string | number, max?: string | number) => {
+ if (min == null || min === '') {
+ return max != null && max !== '' ? `¥${max}` : '';
+ }
+ const base = `¥${min}`;
+ return max != null && max !== '' && `${max}` !== `${min}`
+ ? `${base} ~ ¥${max}`
+ : base;
+ };
+
/* 导出商品列表 */
const handleExport = async () => {
if (loading.value) {
@@ -424,9 +455,9 @@
array.push([
`${goods.goodsId || ''}`,
`${goods.name || ''}`,
- `¥${goods.price || 0}`,
- `${goods.salePrice ? `¥${goods.salePrice}` : ''}`,
- `${goods.dealerPrice ? `¥${goods.dealerPrice}` : ''}`,
+ fmtPrice(goods.price, goods.priceMax),
+ fmtPrice(goods.salePrice, goods.salePriceMax),
+ fmtPrice(goods.dealerPrice, goods.dealerPriceMax),
`${goods.sales || 0}`,
`${goods.stock || 0}`,
statusMap[goods.status || 0] || '',