gxd-vue-library
Version:
依赖与element Ui插件库,聚福宝福利PC端插件库
259 lines (231 loc) • 23.5 kB
JavaScript
'use strict';
//const data = {"total_size":2230,"next_page_token":"2","list":[{"product_id":60009027,"product_type":"good","product_type_name":"实物商品","supplier_id":500003,"supplier_name":"其他--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":17,"brand_name":"品牌123","product_name":"香水(其他-供货商)","thumb":"\/uploads\/20230607\/67b44feb845fb2dadb6a0a47aafc0cc9.jpg","specs":{"purchase_price":2500,"market_price":4500,"dist_price":2575,"sale_price":2875,"jfb_price":4500,"min_sale_price":0,"jfb_discount_ratio":5556,"market_discount_ratio":5556,"sale_discount_ratio":8696,"min_sale_discount_ratio":0},"stocks":{"on_num":20,"total_num":20},"sku_count":0,"audit_time":1686130737,"real_sale_num":0,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60009026,"product_type":"good","product_type_name":"实物商品","supplier_id":500003,"supplier_name":"其他--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":17,"brand_name":"品牌123","product_name":"口红(其他-供货商)","thumb":"\/uploads\/20230607\/34c9cb6e798b43bddefca15d47fbad2c.png","specs":{"purchase_price":1500,"market_price":2500,"dist_price":1545,"sale_price":1845,"jfb_price":2500,"min_sale_price":0,"jfb_discount_ratio":6000,"market_discount_ratio":6000,"sale_discount_ratio":8131,"min_sale_discount_ratio":0},"stocks":{"on_num":20,"total_num":20},"sku_count":0,"audit_time":1686130740,"real_sale_num":0,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60009025,"product_type":"good","product_type_name":"实物商品","supplier_id":500006,"supplier_name":"礼包--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":14,"brand_name":"测试1111","product_name":"西柚柠檬果茶","thumb":"\/uploads\/20230607\/aae580f0b714b231671f4259d091662a.png","specs":{"purchase_price":3500,"market_price":6300,"dist_price":3605,"sale_price":3905,"jfb_price":6300,"min_sale_price":0,"jfb_discount_ratio":5556,"market_discount_ratio":5556,"sale_discount_ratio":8963,"min_sale_discount_ratio":0},"stocks":{"on_num":50,"total_num":50},"sku_count":0,"audit_time":1686129772,"real_sale_num":0,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60009024,"product_type":"good","product_type_name":"实物商品","supplier_id":500006,"supplier_name":"礼包--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":15,"brand_name":"测试·123","product_name":"柠檬","thumb":"\/uploads\/20230607\/b2e5ea6b4ee92ade7807fa29fab2063c.png","specs":{"purchase_price":2500,"market_price":5500,"dist_price":2575,"sale_price":2875,"jfb_price":5500,"min_sale_price":0,"jfb_discount_ratio":4546,"market_discount_ratio":4546,"sale_discount_ratio":8696,"min_sale_discount_ratio":0},"stocks":{"on_num":48,"total_num":50},"sku_count":0,"audit_time":1686129776,"real_sale_num":2,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60009023,"product_type":"good","product_type_name":"实物商品","supplier_id":500006,"supplier_name":"礼包--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":15,"brand_name":"测试·123","product_name":"百香果","thumb":"\/uploads\/20230607\/6cb520c38e5aba2c1883f388e8e48ddb.png","specs":{"purchase_price":1500,"market_price":3500,"dist_price":1545,"sale_price":1845,"jfb_price":3500,"min_sale_price":0,"jfb_discount_ratio":4286,"market_discount_ratio":4286,"sale_discount_ratio":8131,"min_sale_discount_ratio":0},"stocks":{"on_num":48,"total_num":50},"sku_count":0,"audit_time":1686129779,"real_sale_num":2,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60009022,"product_type":"good","product_type_name":"实物商品","supplier_id":500003,"supplier_name":"其他--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":15,"brand_name":"测试·123","product_name":"桃子","thumb":"\/uploads\/20230607\/641c2473197c9092753446654ec95453.png","specs":{"purchase_price":3000,"market_price":6000,"dist_price":3090,"sale_price":3390,"jfb_price":6000,"min_sale_price":0,"jfb_discount_ratio":5000,"market_discount_ratio":5000,"sale_discount_ratio":8850,"min_sale_discount_ratio":0},"stocks":{"on_num":2,"total_num":2},"sku_count":0,"audit_time":1686103463,"real_sale_num":0,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60009021,"product_type":"good","product_type_name":"实物商品","supplier_id":500006,"supplier_name":"礼包--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":14,"brand_name":"测试1111","product_name":"咖啡","thumb":"\/uploads\/20230607\/b9ef7080c2c9ceb07ebb7816eded042f.png","specs":{"purchase_price":3500,"market_price":6200,"dist_price":3605,"sale_price":3905,"jfb_price":6200,"min_sale_price":0,"jfb_discount_ratio":5646,"market_discount_ratio":5646,"sale_discount_ratio":8963,"min_sale_discount_ratio":0},"stocks":{"on_num":100,"total_num":100},"sku_count":0,"audit_time":1686103004,"real_sale_num":0,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60009014,"product_type":"good","product_type_name":"实物商品","supplier_id":61553,"supplier_name":"聚福宝第三方","category_id":100020,"category_full_name":"实物产品","brand_id":2,"brand_name":"味多美","product_name":"消毒液(a加盟商)","thumb":"\/uploads\/20230606\/97e532adc5a2da24fc2d92079e0c8607.png","specs":{"purchase_price":0,"market_price":6500,"dist_price":2575,"sale_price":2653,"jfb_price":6500,"min_sale_price":0,"jfb_discount_ratio":3962,"market_discount_ratio":3962,"sale_discount_ratio":9706,"min_sale_discount_ratio":0},"stocks":{"on_num":97,"total_num":100},"sku_count":0,"audit_time":1686036530,"real_sale_num":3,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60009011,"product_type":"good","product_type_name":"实物商品","supplier_id":61553,"supplier_name":"聚福宝第三方","category_id":100020,"category_full_name":"实物产品","brand_id":2,"brand_name":"味多美","product_name":"花露水(a加盟商)","thumb":"\/uploads\/20230606\/51b2d486f2fb65dd09fc31e14a555c3d.png","specs":{"purchase_price":0,"market_price":5500,"dist_price":2575,"sale_price":2653,"jfb_price":5500,"min_sale_price":0,"jfb_discount_ratio":4682,"market_discount_ratio":4682,"sale_discount_ratio":9706,"min_sale_discount_ratio":0},"stocks":{"on_num":99,"total_num":100},"sku_count":0,"audit_time":1686036535,"real_sale_num":1,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60009002,"product_type":"good","product_type_name":"实物商品","supplier_id":500006,"supplier_name":"礼包--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":2,"brand_name":"味多美","product_name":"百事可乐(161)","thumb":"\/uploads\/20230606\/7ccfb3aa7edc824b3318eee72645a676.png","specs":{"purchase_price":3000,"market_price":8000,"dist_price":3090,"sale_price":3390,"jfb_price":8000,"min_sale_price":0,"jfb_discount_ratio":3750,"market_discount_ratio":3750,"sale_discount_ratio":8850,"min_sale_discount_ratio":0},"stocks":{"on_num":92,"total_num":100},"sku_count":0,"audit_time":1686023611,"real_sale_num":8,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60009001,"product_type":"good","product_type_name":"实物商品","supplier_id":500006,"supplier_name":"礼包--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":2,"brand_name":"味多美","product_name":"可口可乐(161)","thumb":"\/uploads\/20230606\/df9ca6daac464b2bbdee1fe9aedaf13b.png","specs":{"purchase_price":2200,"market_price":5500,"dist_price":2266,"sale_price":2566,"jfb_price":5500,"min_sale_price":0,"jfb_discount_ratio":4000,"market_discount_ratio":4000,"sale_discount_ratio":8574,"min_sale_discount_ratio":0},"stocks":{"on_num":92,"total_num":100},"sku_count":0,"audit_time":1686023615,"real_sale_num":8,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60008997,"product_type":"good","product_type_name":"实物商品","supplier_id":91001,"supplier_name":"蛋糕叔叔","category_id":9,"category_full_name":"百货","brand_id":20564,"brand_name":"星期六","product_name":"众望小麻花312g*2袋","thumb":"https:\/\/img.dangaoss.com\/public\/p\/28\/15\/1285543_l.jpg","specs":{"purchase_price":2431,"market_price":3000,"dist_price":2431,"sale_price":2731,"jfb_price":2760,"min_sale_price":0,"jfb_discount_ratio":8808,"market_discount_ratio":8104,"sale_discount_ratio":8902,"min_sale_discount_ratio":0},"stocks":{"on_num":0,"total_num":0},"sku_count":0,"audit_time":1686022096,"real_sale_num":0,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60008996,"product_type":"good","product_type_name":"实物商品","supplier_id":91001,"supplier_name":"蛋糕叔叔","category_id":9,"category_full_name":"百货","brand_id":20564,"brand_name":"星期六","product_name":"Mixx豆乳味芝士味夹心饼干230g*2袋","thumb":"https:\/\/img.dangaoss.com\/public\/p\/18\/5\/1285533_l.jpg","specs":{"purchase_price":2431,"market_price":3000,"dist_price":2431,"sale_price":2731,"jfb_price":2760,"min_sale_price":0,"jfb_discount_ratio":8808,"market_discount_ratio":8104,"sale_discount_ratio":8902,"min_sale_discount_ratio":0},"stocks":{"on_num":0,"total_num":0},"sku_count":0,"audit_time":1686022093,"real_sale_num":0,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60008995,"product_type":"good","product_type_name":"实物商品","supplier_id":500006,"supplier_name":"礼包--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":2,"brand_name":"味多美","product_name":"酸梅汤","thumb":"\/uploads\/20230606\/6fb556fb389e09b4408cd6d8c2303aaa.png","specs":{"purchase_price":3500,"market_price":4500,"dist_price":3605,"sale_price":3905,"jfb_price":4500,"min_sale_price":0,"jfb_discount_ratio":7778,"market_discount_ratio":7778,"sale_discount_ratio":8963,"min_sale_discount_ratio":0},"stocks":{"on_num":97,"total_num":100},"sku_count":0,"audit_time":1686020941,"real_sale_num":3,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60008994,"product_type":"good","product_type_name":"实物商品","supplier_id":500006,"supplier_name":"礼包--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":14,"brand_name":"测试1111","product_name":"葡萄","thumb":"\/uploads\/20230606\/1e409ebbf87310405f95ba09085cc942.png","specs":{"purchase_price":1500,"market_price":2500,"dist_price":1545,"sale_price":1845,"jfb_price":2500,"min_sale_price":0,"jfb_discount_ratio":6000,"market_discount_ratio":6000,"sale_discount_ratio":8131,"min_sale_discount_ratio":0},"stocks":{"on_num":97,"total_num":100},"sku_count":0,"audit_time":1686020945,"real_sale_num":3,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60008993,"product_type":"good","product_type_name":"实物商品","supplier_id":500006,"supplier_name":"礼包--供应商","category_id":100020,"category_full_name":"实物产品","brand_id":14,"brand_name":"测试1111","product_name":"芒果(161)","thumb":"\/uploads\/20230606\/a81232de9697cfbbf028914441dda5e1.png","specs":{"purchase_price":1000,"market_price":2000,"dist_price":1030,"sale_price":1330,"jfb_price":2000,"min_sale_price":0,"jfb_discount_ratio":5000,"market_discount_ratio":5000,"sale_discount_ratio":7519,"min_sale_discount_ratio":0},"stocks":{"on_num":98,"total_num":100},"sku_count":0,"audit_time":1686020999,"real_sale_num":2,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60008992,"product_type":"good","product_type_name":"实物商品","supplier_id":91001,"supplier_name":"蛋糕叔叔","category_id":9,"category_full_name":"百货","brand_id":20564,"brand_name":"星期六","product_name":"波路梦 猫舌卷曲奇蛋卷 2盒组合装","thumb":"https:\/\/img.dangaoss.com\/public\/p\/54\/33\/1330812_l.jpg","specs":{"purchase_price":1575,"market_price":2000,"dist_price":1575,"sale_price":1875,"jfb_price":1760,"min_sale_price":0,"jfb_discount_ratio":8949,"market_discount_ratio":7875,"sale_discount_ratio":8400,"min_sale_discount_ratio":0},"stocks":{"on_num":0,"total_num":0},"sku_count":0,"audit_time":1686022143,"real_sale_num":0,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60008991,"product_type":"good","product_type_name":"实物商品","supplier_id":91001,"supplier_name":"蛋糕叔叔","category_id":9,"category_full_name":"百货","brand_id":20564,"brand_name":"星期六","product_name":"波路梦 软香饼 2袋组合装","thumb":"https:\/\/img.dangaoss.com\/public\/p\/66\/8\/1330824_l.jpg","specs":{"purchase_price":1704,"market_price":2000,"dist_price":1704,"sale_price":2004,"jfb_price":1960,"min_sale_price":0,"jfb_discount_ratio":8694,"market_discount_ratio":8520,"sale_discount_ratio":8503,"min_sale_discount_ratio":0},"stocks":{"on_num":0,"total_num":0},"sku_count":0,"audit_time":1686022143,"real_sale_num":0,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60008990,"product_type":"good","product_type_name":"实物商品","supplier_id":91001,"supplier_name":"蛋糕叔叔","category_id":9,"category_full_name":"百货","brand_id":20564,"brand_name":"星期六","product_name":"波路梦 物语缤纷装 3袋组合装","thumb":"https:\/\/img.dangaoss.com\/public\/p\/83\/25\/1330841_l.jpg","specs":{"purchase_price":2120,"market_price":2600,"dist_price":2120,"sale_price":2420,"jfb_price":2360,"min_sale_price":0,"jfb_discount_ratio":8984,"market_discount_ratio":8154,"sale_discount_ratio":8761,"min_sale_discount_ratio":0},"stocks":{"on_num":0,"total_num":0},"sku_count":0,"audit_time":1686022143,"real_sale_num":0,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]},{"product_id":60008989,"product_type":"good","product_type_name":"实物商品","supplier_id":91001,"supplier_name":"蛋糕叔叔","category_id":9,"category_full_name":"百货","brand_id":20564,"brand_name":"星期六","product_name":"Aji 岩烧圈蛋糕 焦糖味 2盒装","thumb":"https:\/\/img.dangaoss.com\/public\/p\/15\/32\/1331070_l.jpg","specs":{"purchase_price":2120,"market_price":2600,"dist_price":2120,"sale_price":2420,"jfb_price":2360,"min_sale_price":0,"jfb_discount_ratio":8984,"market_discount_ratio":8154,"sale_discount_ratio":8761,"min_sale_discount_ratio":0},"stocks":{"on_num":0,"total_num":0},"sku_count":0,"audit_time":1686022124,"real_sale_num":0,"supplier_is_deleted":false,"supplier_is_offed_product":false,"site_product_status":"Y","can_cancel_modifyprice":false,"site_is_top":"N","market_tags":[]}],"request_id":"66b4326ef17ca548"};
/**
* @description 获取随机字符串
* @param len {number}
* @returns {string}
*/
const randomChar = (len)=>{
function random (min, max){
let Range = max - min;
let Rand = Math.random();
return (min + Math.round(Rand * Range));
}
let arrString = 'qwertyuiopasdfghjklzxcvbnm123456789QWERTYUIOPASDFGHJKLZXCVBNM'.split('');
let str = '';
for (let i = 0; i < len; i++) {
let index = random(0, arrString.length - 1);
str += arrString[index];
}
return str;
};
const checkType = (obj)=>{
let toString = Object.prototype.toString;
let map = {
'[object Boolean]': 'boolean',
'[object Number]': 'number',
'[object String]': 'string',
'[object Function]': 'function',
'[object Array]': 'array',
'[object Undefined]': 'undefined',
'[object Null]': 'null',
};
return map[toString.call(obj)];
}
const uniMap = {
price: '元',
ratio: '%',
num: '件'
};
const configMap = {
purchase_price: '货源进货价',
dist_price: '平台进货价',
market_price: '市场价',
market_discount_ratio: '市场价抵扣比例',
sale_price: '售价',
sale_discount_ratio: '售价抵扣比例',
jfb_price: '建议零售价',
jfb_discount_ratio: '建议零售价抵扣比例',
min_sale_price: '最低售价',
min_sale_discount_ratio: '最低售价抵扣比例',
product_num: "数量",
num: "数量",
"sale_price&sale_discount_ratio": '售价',
"market_price&market_discount_ratio": '市场价',
"jfb_price&jfb_discount_ratio": '建议零售价',
"min_sale_price&min_sale_discount_ratio": '最低售价',
};
const systemTpl = {
tpl_order: ['purchase_price', 'product_num'],
tpl_select: [
"purchase_price",
"dist_price",
"market_price&market_discount_ratio",
"jfb_price&jfb_discount_ratio",
"min_sale_price&min_sale_discount_ratio"
],
tpl_product_admin: [
"purchase_price",
"dist_price",
"market_price&market_discount_ratio",
"jfb_price&jfb_discount_ratio",
"sale_price&sale_discount_ratio",
"min_sale_price&min_sale_discount_ratio"
],
tpl_price: [
"purchase_price",
"dist_price",
"sale_price",
"market_price",
"jfb_price"
],
tpl_empty: []
};
const tpl = {
label: "",
type: "priceGroup",
prop: '',
align: "left",
minWidth: 250,
labelWidth: 120,
message: {}
};
const headerSystemSlot = {
"sale_price&sale_discount_ratio": '平台进货价 / 市场价',
"market_price&market_discount_ratio": '市场价抵扣比例 =货源进货价 / 市场价',
"jfb_price&jfb_discount_ratio": '建议零售价抵扣比例 = 货源进货价 / 建议售价',
"min_sale_price&min_sale_discount_ratio": '平台进货价 / 建议售价',
};
class Price {
configMap;
systemTpl;
unitMap;
constructor(tpl, label, width = 250, field = null, customConfigMap = {}, unit={}){
this.customConfigMap = this.deep(customConfigMap);
this.customTpl = Object.keys(customConfigMap).map(item=>{
return item;
});
this.configMap = Object.assign({}, this.deep(configMap), customConfigMap);
this.unitMap = Object.assign({}, this.deep(uniMap), unit);
this.systemTpl = this.deep(systemTpl);
this.width = width;
this.field = field;
this.fields = ['root'];
this.label = label;
this.tpl = tpl;
if(typeof field !== 'string' || field === '') {
if(checkType(field) === 'array') {
this.fields = field.concat(this.fields)
}
this.field = `fd-${randomChar(10)}`;
}
}
deep(obj){
return JSON.parse(JSON.stringify(obj))
}
isEmpty(data){
return JSON.stringify(data) === '{}';
}
getItem(item){
let keys = Object.keys(this.getMessage());
let noItemData = {};
let data = {};
keys.map(key=>{
noItemData[key] = true;
});
let len = this.fields.length;
for(let i = 0 ; i < len; i++) {
let temp = item[this.fields[i]];
if(this.fields[i] === 'root') temp = this.deep(item);
if(temp){
keys.map(key=>{
//带&的键值处理
if(key.indexOf('&') !== -1) {
let ks = key.split('&');
if(data[key] && data[key][ks[0]] !== undefined && data[key][ks[1]] !== undefined) {
delete noItemData[key];
}
else{
if (data[key] === undefined) data[key] = {};
if (temp[ks[0]] !== undefined) data[key][ks[0]] = temp[ks[0]];
if (temp[ks[1]] !== undefined) data[key][ks[1]] = temp[ks[1]];
if(data[key][ks[0]] !== undefined && data[key][ks[1]] !== undefined) {
delete noItemData[key];
}
}
}
//普通键值处理
else {
if (temp[key] !== undefined && data[key] === undefined) {
data[key] = temp[key];
delete noItemData[key];
}
}
});
if(this.isEmpty(noItemData)) break;
}
}
Object.keys(noItemData).map(key=>{
data[key] = -999
});
return data;
}
transformData(list=[]){
return list.map(item=>{
item[this.field] = this.getItem(item);
return item;
});
}
getField(){
return this.field
}
getMessage(){
if(!this.tpl || !this.systemTpl[this.tpl]) throw new Error(this.tpl);
let tpl = this.systemTpl[this.tpl];
if(this.tpl ==='tpl_empty') {
tpl = this.customTpl;
if(tpl.length === 0) throw new Error('用户自定义模版不能为空');
}
let temp = {};
tpl.map(item=>{
let type = 'ratio';
let unit = this.unitMap['ratio'];
if (/^.+(_price)$/.test(item)){
type = 'price';
unit = this.unitMap['price']
}
else{
if (/^.+(_price&).+$/.test(item)) {
type = 'priceAndRatio';
unit = [this.unitMap['price'], this.unitMap['ratio']]
}
}
if(item.indexOf('num') !== -1){
type = 'unit';
unit = this.unitMap['num']
}
temp[item] = [this.configMap[item], type, unit];
});
return temp;
}
getHeader(labelWidth=120, align = 'left', headerSlot = []){
let temp = this.deep(tpl);
temp['label'] = this.label;
temp['prop'] = this.field;
temp['width'] = this.width;
temp['align'] = align;
temp['labelWidth'] = labelWidth;
temp['message'] = this.getMessage();
let systemSlot = [];
// Object.keys(temp['message']).map(key=>{
// if(key.indexOf('&') !== -1 && headerSystemSlot[key]) systemSlot.push(headerSystemSlot[key])
// });
temp['headerSlot'] = systemSlot.concat(headerSlot || []) ;
return temp
}
}
//const price = new Price('tpl_product_admin', '平台进货价格&数量', 200, ['specs','stocks'], {purchase_price: '平台进货单价', total_num: '总数' },{price: '¥',num: '条'});
//console.log(price.getHeader());
//console.log(price.getField());
//price.transformData(data.list);
export default Price;