UNPKG

fd-gulp-convert-encoding

Version:

convert file to assigned charset

63 lines (51 loc) 1.54 kB
define('detail.modules.logisticsInfo.FreightCost',['jQuery', 'Class','detail.core.Event'], function ($, Class,Event) { return Class({ init: function(config) { this.config = config; this.callback = null; this.bindEvent(); }, bindEvent:function(){ var self = this; Event.on("freightCalculation",function(data){ self.handleFreightCost(data); }); }, handleParam:function(data){ var config = this.config,param; data && $.extend(config, data); param = { countryCode:config.countryCode||1001, provinceCode:config.provinceCode, cityCode:config.cityCode, amount : config.beginAmount, weight : (config.unitWeight * config.beginAmount * 10000).toFixed(4) /10000, price : (config.refPrice * config.beginAmount*100).toFixed(2) / 100, templateId : config.freightTemplateId, memberId : config.memberId, volume : 0, // 体积目前没有 offerId : config.offerId }; return param; }, handleFreightCost:function(data){ var self = this, url = this.config.url, param = this.handleParam(data); $.ajax(url,{ dataType:'jsonp', data:param, success:function(o){ o.data && o.data.costs && Event.trigger('freightCostRender',o.data.costs); } }); }, setCallback:function(fn){ this.callback = fn; }, sendEvent: function(data){ Event.trigger("freightCalculation",data); } }); })