/** * 有关 访问服务器的uri */ var $http = function() { // this.ip = "http://192.168.242.26:9002"; //this.ip = "http://b2bcnapi.sailuntire.com/api/test/web"; //this.ip = "http://b2bcnapi.sailuntire.com/api/web"; //this.ip = "http://192.168.237.6/api/web"; this.ip = "http://b2bcnapi.sailuntire.com/allstell/test/app";//测试 // this.ip = "http://b2bcnapi.sailuntire.com/allstell/app";//正式 /****** 用户相关 ******/ // 根据省获取经销商 this.getUpuserByProvideUrl = "/base/agent/listByArea"; // 注册用户 this.regizeUrl = "/bizLogin/registRetailer"; // 登录用户 this.loginUrl = "/biz/bizAgentLogin/login"; // 收取短信验证码---新增 this.getPhoneCode = '/web/bizLogin/sendCode'; // 根据loginid获取用户信息 // this.getUserInfoUrl = "/base/retailer/loginToInfo"; /******* 订单相关 ********/ // 查看剩余库存 this.getStockUrl_old = "/bizAgentStock/page"; this.getStockUrl = "/base/material/pageMaterialStock"; // 添加商品到购物车 this.addCarUrl = "/bizCart/save"; // 获取购物车列表 this.shopCarListUrl = "/bizCart/list"; // 获取商品详情 this.getInfoUrl = "/base/material/info"; // 下单传 {"retailerId":"212","amounr":100,"bizCartDtoList":[{"id":121...},{"id":12..}] 这里把购物车的列表给我} this.downOrderUrl = "/base/bizOrder/save"; // 删除购物车 --删除一个 this.deleteCar = "/bizCart/deleteOne"; // 删除购物车记录 -- 珊瑚多个 this.deleteCars = "/bizCart/delete"; // 获取订单列表 this.getOrderListUrl = "/base/bizOrder/page"; // 获取门店订单 this.getStoreOrderListUrl = "/base/bizOrder/selectStore"; // 获取订单详情 this.getOrderInfo = "/base/bizOrder/info"; // ---------- 525 --------- // 获取库存详情 this.getKucunInfoUrl = "/bizRetailerStock/page"; // 获取商品类别 this.getStoreTypeUrl = "/bizGoodsType/list"; // 添加商品类别 this.addStoreTypeUrl = "/bizGoodsType/save"; // 添加商品 this.addStoreUrl = "/bizGoods/saveGoods"; // 查看自己的供应商 this.getSupplierUrl = "/bizSupplier/list"; // 根据条形码查询商品 this.getStoreByScanUrl = "/bizGoods/selectBySerialNumber"; // 添加供应商 this.addSupplierUrl = "/bizSupplier/save"; // 进货 this.buyStoreUrl = "/bizBills/save"; // 单据 this.buyListUrl = "/bizBills/page"; // 商品详情 this.getStoreInfoUrl = "/bizGoods/info"; // 获取经销商详情 this.getUserInfoUrl = "/base/agent/infoByCode"; //查询经销商库存的查询条件列表 this.getStoreAgentCondition = "/app/appAgent/getStoreAgentCondition"; // 经销商查询自己库存 this.checkStoreUrl = "/app/appAgent/getAgentStock"; // 经销商查询b2b订单 this.b2bOrderList = "/biz/bizOrderTracking/orderCheckHead"; this.b2bOrderInfo = "biz/bizOrderTracking/orderCheckDetail"; this.b2bOrderTrans = ""; this.checkOrderUrl = "/base/bizOrder/page"; // 接单退单 this.orderReviceUrl = "/base/bizOrder/update"; // 传agentId 经销商的库存根据品牌分 this.getStockByBrand = "/bizAgentStock/selectGroupBrand"; // 经销商下的门店 this.getRetailerUrl = "/store/storeAgentBrandLv/getStoresByAgentId"; this.getRetailerUrl_old = "/base/retailerAgent/page"; //搜索门店 this.getRetailerSearch="/biz/bizStoreBasicInfo/selectSearch" // 审核门店 this.checkRetailerUrl = "/biz/bizAudit/update"; // 消息列表 this.getNewsList = "/bizSms/page"; // 获取经销商签约品牌 this.getBrandUrl = "/bizAgentBrand/list"; // 获取经销商下的物流信息 this.getWuLiuUrl = "/base/agent/selectPageCar"; // 获取经销商断下物流的车辆信息 this.getCarInfoUrl = "/base/agent/carNowPosition"; // 修改经销商下的库存 this.upDateStockUrl = "/bizAgentStock/update"; // 检查版本 this.getVersionUrl = "/biz/getAppVersion"; // 获取经销商下门店订单 this.getAgentList = "/base/bizOrder/selectStore"; // 审核门店订单 this.handerOrderUrl = "/base/bizOrder/updateTake"; // 经销商查询工厂库存 this.checkFactoryStoreUrl = "/biz/bizAgentLogin/showMateriafPRC"; // 获取经销商信息 this.getMeberInfoU = "/app/appAgent/getClientBasicMsg"; // 门店注册审核通过 this.passSignForBatch = "/store/storeAgentBrandLv/passSignForBatch"; // 门店注册审核拒绝 this.refuseSignForBatch = "/store/storeAgentBrandLv/refuseSignForBatch"; // 获取订单详情 this.getAgentOrderInfoU = "/biz/bizOrderInfo/selectOrderInfo"; // 获取门店详情 this.getAgentInfoU = "/store/storeAgentBrandLv/getStoreInfoAndBrandSignInfo"; // 删除门店签约品牌 this.deleteSignInfo = "/store/storeAgentBrandLv/deleteSignInfo"; // 查看订单详情 this.getOrderInfoU = "/biz/bizOrderInfo/selectOrderInfo"; // 审核门店核销码 this.checkConponU = "/myapp/agentCheckCoupon"; // 查看门店核销码列表 this.getCheckListU = "/myapp/agentSelectCoupon"; // 查询门店进货分析列表 this.getIntoStoreU = "/biz/bizGoods/agentSelectStoreRecord" // 获取门店进货分析列表 this.getInfoStoreU_jiage = "/app/appAgent/agentSelectStoreRecord"; // 查看门店返利明细 this.getBackMoneyListU = "/biz/bizStoreReward/page"; // 查询b2b订单详情 this.getB2bOrderInfoU = "/biz/bizOrderTracking/orderCheckDetail"; // 获取文章 根据ID this.getOneDetails="/homepage/getArticleOne"; // 检查版本更新 this.checkVersionU = "/baseReq/agentVersion" this.getIntoStoreU = "/biz/bizGoods/agentSelectStoreRecord"; //获取跑马灯list this.getMessageList="/homepage/noticeList"; //轮播图 this.getAgentBanner="/homepage/getBanners"; //核销查询 this.selectCouponLike="/biz/bizCoupon/selectCouponLike"; } // api的ajax $http.prototype.$post = function(url, data, callback, other) { var content = "", urlT = ""; if (data.url == "json") { delete data.url; // 确认contenttype选项 content = "application/json;charset=UTF-8"; } else { content = "application/x-www-form-urlencoded" } var datas = this.serize(data); if ( typeof other != 'undefined' && other != "" && other != 'undefined') { urlT = this.ip + eval('this.' + url) + '/' + other; } else { urlT = this.ip + eval('this.' + url); } api.showProgress({ }); // console.log(urlT) // console.log(JSON.stringify(datas)) api.ajax({ url : urlT, method : 'post', data : datas, headers : { "Content-type" : content }, }, function(ret, err) { // console.log(JSON.stringify(ret)) api.hideProgress(); api.refreshHeaderLoadDone(); if (ret) { callback(ret); } else { api.toast({ msg: '当前网络不稳定,请稍后再试' }); } }); } // get方法 $http.prototype.$get = function(url, data, callback, other) { var urlT = other == 'formdata' ? (this.ip + eval('this.' + url)) : (this.ip + eval('this.' + url) + '?' + data); api.showProgress({ }); api.ajax({ url : urlT, method : 'get', data : {}, headers : { "Content-type" : "application/json;charset=UTF-8" }, }, function(ret, err) { api.hideProgress(); api.refreshHeaderLoadDone(); if (ret) { callback(ret); } else { api.toast({ msg: '当前网络不稳定,请稍后再试' }); } }); } // 对数据进行处理,第一个为values,第二个为file body $http.prototype.serize = function(data) { var serizeData; if ( data instanceof Array) { if (data.length > 1) { serizeData = { values : data[0] } } else { serizeData = { values : data[0], files : data[1] } } } else { if (data.type == 'body') { delete data.type; if (data.yy == 'keng') { delete data.yy serizeData = { body : data.id } } else { serizeData = { body : data } } } else { serizeData = { values : data } } } return serizeData; } function alertJson(str) { alert(JSON.stringify(str)); }