mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-01-22 11:08:10 +00:00
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
export function useGoods(params: any = {}) {
|
|
|
|
const baseTagStyle = (data: any) => {
|
|
let style = "";
|
|
if (data.color_json && data.color_json.text_color) {
|
|
style += `color:${ data.color_json.text_color };`;
|
|
}
|
|
if (data.color_json && data.color_json.border_color) {
|
|
style += `border-color: ${ data.color_json.border_color };`;
|
|
}
|
|
if (data.color_json && data.color_json.bg_color) {
|
|
style += `background-color: ${ data.color_json.bg_color };`;
|
|
}
|
|
return style;
|
|
}
|
|
|
|
// 价格类型
|
|
const priceType = (data: any) => {
|
|
return data.goodsSku.show_type
|
|
}
|
|
|
|
// 商品价格
|
|
const goodsPrice = (data: any) => {
|
|
let price = data.goodsSku.show_price
|
|
return parseFloat(price);
|
|
}
|
|
|
|
// 错误图片展示
|
|
const errorImgFn = (data: any, type: any) => {
|
|
data[type] = '';
|
|
}
|
|
|
|
return {
|
|
baseTagStyle: baseTagStyle,
|
|
goodsPrice: goodsPrice,
|
|
priceType: priceType,
|
|
error: errorImgFn
|
|
}
|
|
}
|