|
@@ -7,37 +7,41 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
return Product.instance;
|
|
|
}
|
|
|
Product.instance = this;
|
|
|
- this.storagePrefix = 'product_';
|
|
|
- this.products = [];
|
|
|
- this.productDic = {}; //商品对象
|
|
|
+ this.storagePrefix = 'product_';//存储前缀
|
|
|
+ this.products = []; //产品
|
|
|
+ this.productDic = {}; //商品对象
|
|
|
this.extraProductDic = {}; //商品对象
|
|
|
this.productGroup = { //商品分组
|
|
|
- 1: [], //洗澡
|
|
|
- 2: [], //剪毛
|
|
|
- 3: [], //美容
|
|
|
- 4: [], //洁牙
|
|
|
- 5: [], //SPA
|
|
|
- 6: [], //训犬
|
|
|
- 7: [], //断尾
|
|
|
- 8: [] //碳酸浴
|
|
|
+ 1: [], //洗澡-钟点工
|
|
|
+ 2: [], //剪毛-除螨杀菌
|
|
|
+ 3: [], //美容-深度清洁
|
|
|
+ 4: [], //洁牙-住家保姆
|
|
|
+ 5: [], //SPA-日常清洁
|
|
|
+ 6: [], //训犬-育儿嫂
|
|
|
+ 7: [], //断尾-月子套餐
|
|
|
+ 8: [], //碳酸浴-金牌月嫂
|
|
|
+ 9: [] //驱虫-催乳服务
|
|
|
};
|
|
|
this.extraProductGroup = { //商品分组
|
|
|
- 1: [], //洗澡
|
|
|
- 2: [], //剪毛
|
|
|
- 3: [], //美容
|
|
|
- 4: [], //洁牙
|
|
|
- 5: [], //SPA
|
|
|
- 6: [], //训犬
|
|
|
- 7: [], //断尾
|
|
|
- 8: [] //碳酸浴
|
|
|
+ 1: [], //洗澡-钟点工
|
|
|
+ 2: [], //剪毛-除螨杀菌
|
|
|
+ 3: [], //美容-深度清洁
|
|
|
+ 4: [], //洁牙-住家保姆
|
|
|
+ 5: [], //SPA-日常清洁
|
|
|
+ 6: [], //训犬-育儿嫂
|
|
|
+ 7: [], //断尾-月子套餐
|
|
|
+ 8: [], //碳酸浴-金牌月嫂
|
|
|
+ 9: [] //驱虫-催乳服务
|
|
|
};
|
|
|
this.precedence = 40; // 加急
|
|
|
- this.extraService = [];
|
|
|
- this.offDay = [];
|
|
|
+ this.extraService = [];//额外的服务
|
|
|
+ this.offDay = [];//休息日
|
|
|
};
|
|
|
|
|
|
Product.prototype = new base();
|
|
|
|
|
|
+
|
|
|
+ //获得第一批
|
|
|
Product.prototype.getGroupStep = function (type) {
|
|
|
var steps = [];
|
|
|
|
|
@@ -104,11 +108,12 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
return steps;
|
|
|
};
|
|
|
|
|
|
+ //描述
|
|
|
Product.prototype.getGroupDesc = function (type) {
|
|
|
var descs = [];
|
|
|
var notes = [];
|
|
|
switch(type){
|
|
|
- case 1: // 洗澡
|
|
|
+ case 1: // 洗澡-钟点工
|
|
|
descs = [
|
|
|
'1.疫苗未完成或完成一周内的幼犬猫不提供服务;',
|
|
|
'2.怀孕、哺乳期间的犬猫不提供服务;',
|
|
@@ -124,7 +129,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
'预约时间仅供参考,具体上门时间请以壹管家客服安排为准。'
|
|
|
];
|
|
|
break;
|
|
|
- case 2: // 剃光
|
|
|
+ case 2: // 剃光-除螨杀菌
|
|
|
descs = [
|
|
|
'1.疫苗未完成或完成一周内的幼犬不提供服务;',
|
|
|
'2.怀孕、哺乳期间的母犬不提供服务;',
|
|
@@ -140,7 +145,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
'预约时间仅供参考,具体上门时间请以壹管家客服安排为准。'
|
|
|
]
|
|
|
break;
|
|
|
- case 3: // 美容
|
|
|
+ case 3: // 美容-深度清洁
|
|
|
descs = [
|
|
|
'1.疫苗未完成或完成一周内的幼犬猫不提供服务;',
|
|
|
'2.怀孕、哺乳期间的犬猫不提供服务;',
|
|
@@ -156,7 +161,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
'预约时间仅供参考,具体上门时间请以壹管家客服安排为准。'
|
|
|
];
|
|
|
break;
|
|
|
- case 4: // 洁牙
|
|
|
+ case 4: // 洁牙-住家保姆
|
|
|
descs = [
|
|
|
'1.疫苗未完成或完成一周内的幼犬不提供服务;',
|
|
|
'2.怀孕、哺乳期间的母犬不提供服务;',
|
|
@@ -173,7 +178,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
'预约时间仅供参考,具体上门时间请以壹管家客服安排为准。'
|
|
|
];
|
|
|
break;
|
|
|
- case 5: // SPA
|
|
|
+ case 5: // SPA-日常清洁
|
|
|
descs = [
|
|
|
'1.疫苗未完成或完成一周内的幼犬不提供服务;',
|
|
|
'2.怀孕、哺乳期间的母犬不提供服务;',
|
|
@@ -190,7 +195,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
'预约时间仅供参考,具体上门时间请以壹管家客服安排为准。'
|
|
|
];
|
|
|
break;
|
|
|
- case 6: // 训犬
|
|
|
+ case 6: // 训犬-育儿嫂
|
|
|
descs = [
|
|
|
'1.需提前一周预约;',
|
|
|
'2.上门训犬的时间:两个小时左右;',
|
|
@@ -204,7 +209,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
'预约时间仅供参考,具体上门时间请以壹管家客服安排为准。'
|
|
|
];
|
|
|
break;
|
|
|
- case 7: // 断尾
|
|
|
+ case 7: // 断尾-月子套餐
|
|
|
descs = [
|
|
|
'1.本服务只限出生后3-7天的幼犬;',
|
|
|
'2.服务前,主人须签订《断尾告知书》,告知服务人员需要留几节尾骨,方可进行下一步断尾服务;'
|
|
@@ -217,7 +222,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
'请提前三天预约,预约时间仅供参考,具体上门时间请以壹管家客服安排为准。'
|
|
|
];
|
|
|
break;
|
|
|
- case 8: // 碳酸浴
|
|
|
+ case 8: // 碳酸浴-金牌月嫂
|
|
|
descs = [
|
|
|
'1.疫苗未完成或完成一周内的幼犬不提供服务;',
|
|
|
'2.怀孕、哺乳期间的母犬不提供服务;',
|
|
@@ -233,7 +238,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
'请提前1天预约,预约时间仅供参考,具体上门时间请以壹管家客服安排为准。'
|
|
|
];
|
|
|
break;
|
|
|
- case 11: // 驱虫
|
|
|
+ case 11: // 驱虫-催乳服务
|
|
|
descs = [
|
|
|
'1.疫苗未完成或完成一周内的幼犬猫不提供服务;',
|
|
|
'2.怀孕、哺乳期间的犬猫不提供服务;',
|
|
@@ -294,50 +299,51 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
};
|
|
|
};
|
|
|
|
|
|
+ //获得商品照片组
|
|
|
Product.prototype.getGroupPics = function (type) {
|
|
|
var imglists = [];
|
|
|
switch(type){
|
|
|
- case 1:
|
|
|
+ case 1:// 洗澡-钟点工
|
|
|
imglists = [
|
|
|
'20151030-1-1.jpg'
|
|
|
];
|
|
|
break;
|
|
|
- case 2:
|
|
|
+ case 2: // 剃光-除螨杀菌
|
|
|
imglists = [
|
|
|
'20151030-2-1.jpg'
|
|
|
];
|
|
|
break;
|
|
|
- case 3:
|
|
|
+ case 3:// 美容-深度清洁
|
|
|
imglists = [
|
|
|
'20151030-3-1.jpg'
|
|
|
];
|
|
|
break;
|
|
|
- case 4:
|
|
|
+ case 4:// 洁牙-住家保姆
|
|
|
imglists = [
|
|
|
'20151030-4-1.jpg'
|
|
|
];
|
|
|
break;
|
|
|
- case 5:
|
|
|
+ case 5:// SPA-日常清洁
|
|
|
imglists = [
|
|
|
'20151202-5-1.jpg'
|
|
|
];
|
|
|
break;
|
|
|
- case 6:
|
|
|
+ case 6:// 训犬-育儿嫂
|
|
|
imglists = [
|
|
|
'20151224-6-1.jpg'
|
|
|
];
|
|
|
break;
|
|
|
- case 7:
|
|
|
+ case 7:// 断尾-月子套餐
|
|
|
imglists = [
|
|
|
'20160106-7-1.jpg'
|
|
|
];
|
|
|
break;
|
|
|
- case 8:
|
|
|
+ case 8:// 碳酸浴-金牌月嫂
|
|
|
imglists = [
|
|
|
'20160111-8-1.jpg'
|
|
|
];
|
|
|
break;
|
|
|
- case 11:
|
|
|
+ case 11:// 驱虫-催乳服务
|
|
|
imglists = [
|
|
|
'20151030-6-1.jpg'
|
|
|
];
|
|
@@ -360,42 +366,43 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //得到商品名称组
|
|
|
Product.prototype.getGroupName = function (type) {
|
|
|
var name = '';
|
|
|
|
|
|
switch(type){
|
|
|
case 1:
|
|
|
- name = '宠物洗澡';
|
|
|
+ name = '宠物洗澡';/*宠物洗澡*/
|
|
|
break;
|
|
|
case 2:
|
|
|
- name = '宠物剃光';
|
|
|
+ name = '宠物剃光';/*宠物剃光*/
|
|
|
break;
|
|
|
case 3:
|
|
|
- name = '宠物美容';
|
|
|
+ name = '宠物美容';/*宠物美容*/
|
|
|
break;
|
|
|
case 4:
|
|
|
- name = '宠物洁牙';
|
|
|
+ name = '宠物洁牙';/*宠物洁牙*/
|
|
|
break;
|
|
|
case 5:
|
|
|
- name = '宠物SPA';
|
|
|
+ name = '宠物SPA';/*宠物SPA*/
|
|
|
break;
|
|
|
case 6:
|
|
|
- name = '宠物训犬';
|
|
|
+ name = '宠物训犬';/*宠物训犬*/
|
|
|
break;
|
|
|
case 7:
|
|
|
- name = '宠物断尾';
|
|
|
+ name = '宠物断尾';/*宠物断尾*/
|
|
|
break;
|
|
|
case 8:
|
|
|
- name = '碳酸浴';
|
|
|
+ name = '碳酸浴';/*碳酸浴*/
|
|
|
break;
|
|
|
case 11:
|
|
|
- name = '宠物驱虫';
|
|
|
+ name = '宠物驱虫';/*宠物驱虫*/
|
|
|
break;
|
|
|
case 12:
|
|
|
- name = '宠物药浴';
|
|
|
+ name = '宠物药浴';/*宠物药浴*/
|
|
|
break;
|
|
|
case 13:
|
|
|
- name = '一次性局部染色';
|
|
|
+ name = '一次性局部染色';/*一次性局部染色*/
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
@@ -404,45 +411,46 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
return name;
|
|
|
};
|
|
|
|
|
|
+ //获得详细的组名
|
|
|
Product.prototype.getGroupFullName = function (type) {
|
|
|
var name = '';
|
|
|
|
|
|
switch(type){
|
|
|
case 1:
|
|
|
- name = '宠物洗澡';
|
|
|
+ name = '宠物洗澡';/*宠物洗澡*/
|
|
|
break;
|
|
|
case 2:
|
|
|
- name = '宠物剃光';
|
|
|
+ name = '宠物剃光';/*宠物剃光*/
|
|
|
break;
|
|
|
case 3:
|
|
|
- name = '宠物美容(含洗澡)';
|
|
|
+ name = '宠物美容(含洗澡)';/*宠物美容(含洗澡)*/
|
|
|
break;
|
|
|
case 4:
|
|
|
- name = '宠物洁牙';
|
|
|
+ name = '宠物洁牙';/*宠物洁牙*/
|
|
|
break;
|
|
|
case 5:
|
|
|
- name = 'SPA';
|
|
|
+ name = 'SPA';/*SPA*/
|
|
|
break;
|
|
|
case 6:
|
|
|
- name = '训犬';
|
|
|
+ name = '训犬';/*训犬*/
|
|
|
break;
|
|
|
case 7:
|
|
|
- name = '断尾';
|
|
|
+ name = '断尾';/*断尾*/
|
|
|
break;
|
|
|
case 8:
|
|
|
- name = '碳酸浴';
|
|
|
+ name = '碳酸浴';/*碳酸浴*/
|
|
|
break;
|
|
|
case 9:
|
|
|
- name = '助产';
|
|
|
+ name = '助产';/*助产*/
|
|
|
break;
|
|
|
case 11:
|
|
|
- name = '宠物驱虫';
|
|
|
+ name = '宠物驱虫';/*宠物驱虫*/
|
|
|
break;
|
|
|
case 12:
|
|
|
- name = '宠物药浴';
|
|
|
+ name = '宠物药浴';/*宠物药浴*/
|
|
|
break;
|
|
|
case 13:
|
|
|
- name = '宠物染色';
|
|
|
+ name = '宠物染色';/**/
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -450,6 +458,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
return name;
|
|
|
};
|
|
|
|
|
|
+ //获得产品称号
|
|
|
Product.prototype.getProductTitle = function (type) {
|
|
|
var title = {
|
|
|
name: '',
|
|
@@ -510,6 +519,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
return title;
|
|
|
}
|
|
|
|
|
|
+ //获得微信分享
|
|
|
Product.prototype.getWXShare = function (type) {
|
|
|
var title = {
|
|
|
name: '',
|
|
@@ -570,16 +580,17 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
return title;
|
|
|
}
|
|
|
|
|
|
+ //获得产品列表
|
|
|
Product.prototype.getProductList = function (type, petID) {
|
|
|
var productList = [];
|
|
|
- if (this.productGroup.hasOwnProperty(type)) {
|
|
|
- var petList = this.productGroup[type];
|
|
|
- for (var i in petList) {
|
|
|
- var petInfo = petList[i];
|
|
|
- if (!petID || petInfo.id == petID) {
|
|
|
+ if (this.productGroup.hasOwnProperty(type)) {//自己的属性
|
|
|
+ var petList = this.productGroup[type];//产品组
|
|
|
+ for (var i in petList) {//宠物列表
|
|
|
+ var petInfo = petList[i];//宠物信息
|
|
|
+ if (!petID || petInfo.id == petID) {//宠物ID
|
|
|
for (var j in petInfo.products) {
|
|
|
if ($.inArray(petInfo.products[j], productList) == -1) {
|
|
|
- productList.push(petInfo.products[j]);
|
|
|
+ productList.push(petInfo.products[j]);//产品列表
|
|
|
}
|
|
|
}
|
|
|
if (petID) {
|
|
@@ -591,28 +602,31 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
return productList;
|
|
|
};
|
|
|
|
|
|
+ //适合服务的宠物
|
|
|
+ //petMaxWeight-最大宠物质量以及最小宠物数量
|
|
|
Product.prototype.isSuitablePet = function (type, petName, petMaxWeight, petMinWeight) {
|
|
|
- var suitablePet = {};
|
|
|
+ var suitablePet = {};//合适的宠物
|
|
|
var productGroupTmp = this.productGroup[type];
|
|
|
- for(var i in productGroupTmp) {
|
|
|
- var productGroupTmpList = productGroupTmp[i];
|
|
|
+ for(var i in productGroupTmp) {//产品模块组
|
|
|
+ var productGroupTmpList = productGroupTmp[i];//产品模块列表组
|
|
|
if (productGroupTmpList.pet_types[0]['name'] == petName && productGroupTmpList.min_weight == petMinWeight && productGroupTmpList.max_weight == petMaxWeight) {
|
|
|
suitablePet = {
|
|
|
- petPrice: productGroupTmpList.price,
|
|
|
- productID: productGroupTmpList.id
|
|
|
+ petPrice: productGroupTmpList.price,//价格
|
|
|
+ productID: productGroupTmpList.id//产品ID
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
- return suitablePet;
|
|
|
+ return suitablePet;//合适的宠物
|
|
|
}
|
|
|
|
|
|
+ //宠物名字
|
|
|
Product.prototype.getPetName = function (type, petID) {
|
|
|
var petName = '';
|
|
|
- if (this.productGroup.hasOwnProperty(type)) {
|
|
|
+ if (this.productGroup.hasOwnProperty(type)) {//产品组自己的属性为 TYEP
|
|
|
var petList = this.productGroup[type];
|
|
|
- for (var i in petList) {
|
|
|
+ for (var i in petList) {//宠物列表
|
|
|
var petInfo = petList[i];
|
|
|
- if (petInfo.id == petID) {
|
|
|
+ if (petInfo.id == petID) {//判断ID一致赋予宠物名字
|
|
|
petName = petInfo['name'];
|
|
|
break;
|
|
|
}
|
|
@@ -621,8 +635,9 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
return petName;
|
|
|
};
|
|
|
|
|
|
+ //得到宠物的重量
|
|
|
Product.prototype.getPetWeight = function (productID) {
|
|
|
- var productInfo = this.productDic[productID];
|
|
|
+ var productInfo = this.productDic[productID];//产品信息
|
|
|
if (!productInfo) {
|
|
|
return '';
|
|
|
} else {
|
|
@@ -631,66 +646,72 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
};
|
|
|
|
|
|
Product.prototype.getProductPrice = function (productID) {
|
|
|
- var productInfo = this.productDic[productID];
|
|
|
+ var productInfo = this.productDic[productID];//产品中心
|
|
|
if (!productInfo) {
|
|
|
return '';
|
|
|
} else {
|
|
|
- return productInfo.price + '元';
|
|
|
+ return productInfo.price + '元';//产品价格
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ //获得宠物服务类型
|
|
|
+ //productType-产品类型
|
|
|
Product.prototype.getPetServiceType = function (productType, productID) {
|
|
|
var petServiceType = '';
|
|
|
- this.productGroup[productType].forEach(function(e) {
|
|
|
- if (e.id == productID) {
|
|
|
+ this.productGroup[productType].forEach(function(e) {//遍历函数
|
|
|
+ if (e.id == productID) {//id一致则将服务类型赋值给petServiceType
|
|
|
petServiceType = e.service_type
|
|
|
}
|
|
|
});
|
|
|
return petServiceType;
|
|
|
};
|
|
|
|
|
|
+ //获得额外的服务类型
|
|
|
+ //checkedName - 检查名称
|
|
|
Product.prototype.getExtraServiceList = function (type, petName, checkedName) {
|
|
|
var extraServiceTmp = [];
|
|
|
- var extraServiceList = this.extraProductGroup[type];
|
|
|
+ var extraServiceList = this.extraProductGroup[type];//额外额产品组
|
|
|
for(var i in extraServiceList) {
|
|
|
- if (extraServiceList[i].pet_types[0].name == petName) {
|
|
|
+ if (extraServiceList[i].pet_types[0].name == petName) {//pet_types 宠物类型
|
|
|
var seleted = false;
|
|
|
- if (extraServiceList[i].name == checkedName) {
|
|
|
+ if (extraServiceList[i].name == checkedName) {//如果额外的服务类型与检查的一致
|
|
|
seleted = true;
|
|
|
}
|
|
|
+ //额外的服务参数
|
|
|
var extraServiceParam = {
|
|
|
- name: extraServiceList[i].name,
|
|
|
- price: extraServiceList[i].price,
|
|
|
- id: extraServiceList[i].id,
|
|
|
- serviceType: extraServiceList[i].service_type,
|
|
|
- seleted: seleted
|
|
|
+ name: extraServiceList[i].name,//名字
|
|
|
+ price: extraServiceList[i].price,//价格
|
|
|
+ id: extraServiceList[i].id,//ID
|
|
|
+ serviceType: extraServiceList[i].service_type,//服务类型
|
|
|
+ seleted: seleted//选择
|
|
|
}
|
|
|
- extraServiceTmp.push(extraServiceParam);
|
|
|
+ extraServiceTmp.push(extraServiceParam);//额外的服务数组
|
|
|
};
|
|
|
}
|
|
|
return extraServiceTmp
|
|
|
}
|
|
|
|
|
|
+ //获取列表
|
|
|
Product.prototype.getList = function (type, callback) {
|
|
|
var that = this;
|
|
|
- api.getProductList({
|
|
|
+ api.getProductList({//获得产品列表
|
|
|
type: type
|
|
|
}, function (res) {
|
|
|
if (res.success) {
|
|
|
- that.products = res.data.products;
|
|
|
- that.productList = {};
|
|
|
- that.productGroup[type] = [];
|
|
|
+ that.products = res.data.products;//产品
|
|
|
+ that.productList = {};//产品列表
|
|
|
+ that.productGroup[type] = [];//产品组
|
|
|
|
|
|
- var petDic = {};
|
|
|
- var productDatas = res['data']['products'];
|
|
|
- var extraroducts = res['data']['extra_products'];
|
|
|
+ var petDic = {};//宠物DIC
|
|
|
+ var productDatas = res['data']['products'];//产品数据
|
|
|
+ var extraroducts = res['data']['extra_products'];//额外的服务
|
|
|
that.extraService = extraroducts;
|
|
|
|
|
|
for (var i = 0, len = productDatas.length; i < len; i++) {
|
|
|
- var eachProduct = productDatas[i];
|
|
|
- var petIDs = [];
|
|
|
+ var eachProduct = productDatas[i];//每个产品
|
|
|
+ var petIDs = [];//宠物ID
|
|
|
for (var j = 0, len1 = eachProduct['pet_types'].length; j < len1; j++) {
|
|
|
- var eachPet = eachProduct['pet_types'][j];
|
|
|
+ var eachPet = eachProduct['pet_types'][j];//遍历
|
|
|
petIDs.push(eachPet.id);
|
|
|
if (!petDic[eachPet.id]) {
|
|
|
petDic[eachPet.id] = {
|
|
@@ -702,7 +723,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
petDic[eachPet.id]['products'].push(eachProduct.id);
|
|
|
}
|
|
|
}
|
|
|
- that.productDic[eachProduct.id] = {
|
|
|
+ that.productDic[eachProduct.id] = {//每个产品的ID
|
|
|
petIDs: petIDs,
|
|
|
maxWeight: eachProduct.max_weight,
|
|
|
minWeight: eachProduct.min_weight,
|
|
@@ -722,6 +743,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ //列出所有的产品
|
|
|
Product.prototype.getListAll = function (userID, callback) {
|
|
|
var that = this;
|
|
|
api.getProductList({
|
|
@@ -758,20 +780,20 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
products: [eachProduct.id]
|
|
|
};
|
|
|
} else {
|
|
|
- petDic[eachPet.id]['products'].push(eachProduct.id);
|
|
|
+ petDic[eachPet.id]['products'].push(eachProduct.id);//给每个宠物ID下的产品中添加产品ID
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- that.productDic[eachProduct.id] = {
|
|
|
- petIDs: petIDs,
|
|
|
- maxWeight: eachProduct.max_weight,
|
|
|
- minWeight: eachProduct.min_weight,
|
|
|
+ that.productDic[eachProduct.id] = {//产品中心
|
|
|
+ petIDs: petIDs,//宠物ID
|
|
|
+ maxWeight: eachProduct.max_weight,//产品最大
|
|
|
+ minWeight: eachProduct.min_weight,//产品最小
|
|
|
// price: parseFloat(eachProduct.price).toFixed(2)
|
|
|
- price: parseFloat(eachProduct.price)
|
|
|
+ price: parseFloat(eachProduct.price)//解析产品价格
|
|
|
// 价格不要加小数点后两位
|
|
|
};
|
|
|
}
|
|
|
-
|
|
|
+ //额外的产品
|
|
|
for (var i = 0, len = extraroducts.length; i < len; i++) {
|
|
|
var eachProduct = extraroducts[i];
|
|
|
var petIDs = [];
|
|
@@ -814,7 +836,7 @@ define(['base', '$', 'api'], function (base, $, api) {
|
|
|
// 某个主服务里面 是否有某个附加服务
|
|
|
var suitableService = this.productGroup;
|
|
|
var suitableServiceTmp = this.extraProductGroup;
|
|
|
- for(var i in suitableService) {
|
|
|
+ for(var i in suitableService) {//合适的服务
|
|
|
suitableService[i][0]['suitable'] = false;
|
|
|
for(var j in suitableServiceTmp[i]) {
|
|
|
if (suitableServiceTmp[i][j].name == name) {
|