/** * 有关 访问服务器的uri */ var $http = function () { this.ajaxLock = false; // this.ip = "http://192.168.43.144/api"; // this.ip = "http://192.168.242.24:9002"; //this.ip = "http://b2bcnapi.sailuntire.com/api"; this.ip = "http://b2bcnapi.sailuntire.com/api/test"; /****** 用户相关 ******/ // 选择图片生成地址 this.getUrlByFileUrl = "/web/file/upload"; // 根据省获取经销商 this.getUpuserByProvideUrl = "/web/bizLogin/testPostApi"; // 注册用户 this.regizeUrl = "/web/bizLogin/registRetailer"; // 登录用户 this.loginUrl = "/web/bizLogin/login"; // 根据loginid获取用户信息 // this.getUserInfoUrl = "/base/retailer/loginToInfo"; /******* 订单相关 ********/ // 查看剩余库存 this.getStockUrl_old = "/jinyu/bizAgentStock/page"; this.getStockUrl = "/base/material/pageMaterialStock"; // 添加商品到购物车 this.addCarUrl = "/jinyu/bizCart/save"; // 获取购物车列表 this.shopCarListUrl = "/jinyu/bizCart/list"; // 获取商品详情 this.getInfoUrl = "/base/material/info"; // 下单传 {"retailerId":"212","amounr":100,"bizCartDtoList":[{"id":121...},{"id":12..}] 这里把购物车的列表给我} this.downOrderUrl = "/base/bizOrder/save"; // 删除购物车 --删除一个 this.deleteCar = "/jinyu/bizCart/deleteOne"; // 删除购物车记录 -- 珊瑚多个 this.deleteCars = "/jinyu/bizCart/delete"; // 获取订单列表 this.getOrderListUrl = "/base/bizOrder/page"; // 获取订单详情 this.getOrderInfo = "/base/bizOrder/info"; // ---------- 525 --------- // 获取库存详情 this.getKucunInfoUrl = "/jinyu/bizRetailerStock/page"; // 获取商品类别 this.getStoreTypeUrl = "/jinyu/bizGoodsType/list"; // 添加商品类别 this.addStoreTypeUrl = "/jinyu/bizGoodsType/save"; // 添加商品 this.addStoreUrl = "/jinyu/bizGoods/saveGoods"; // 查看自己的供应商 this.getSupplierUrl = "/jinyu/bizSupplier/list"; // 根据条形码查询商品 this.getStoreByScanUrl = "/jinyu/bizGoods/selectBySerialNumber"; // 添加供应商 this.addSupplierUrl = "/jinyu/bizSupplier/save"; // 进货 this.buyStoreUrl = "/jinyu/bizBills/save"; // 单据 this.buyListUrl = "/jinyu/bizBills/page"; // 商品详情 this.getStoreInfoUrl = "/jinyu/bizGoods/info"; // 选择品牌 this.chooseBrandUrl = "/base/brand/list"; // 根据扫出来的码获取商品信息(进销存) -- 需要后面拼接 this.jinstoreByScanUrl = "/base/material/infoByKey"; // 获取门店经销商列表 this.getSupplierListUrl = "/base/retailerAgent/list"; // 经销商查询自己库存 // this.checkStoreUrl = "/jinyu/bizAgentStock/page"; this.checkStoreUrl_old = "/jinyu/bizAgentStock/page"; this.checkStoreUrl = "/jinyu/bizAgentStock/pageOwn"; // 扫码商品 0705 this.addStoreByScanUrl = "/jinyu/bizGoods/selectBySerialNumberAndRetailerId"; // 入库扫码 this.addOrgoScanUrl = '/jinyu/bizGoods/selectInBySerialNumberAndRetailerId'; // 出库扫码 this.outScanUrl = '/jinyu/bizGoods/selectOutBySerialNumberAndRetailerId'; /********* 0706 ***********/ // 收取短信验证码 this.getPhoneCode = '/web/bizLogin/sendCode'; // 获取客户信息 this.customListUrl = '/web/bizCustomRetailer/page'; // 获取门店详情 this.getMDInfo = "/base/retailer/retailerInfo"; // 获取所有的轮胎服务类目 this.getServices = "/base/service/list"; // 添加服务 this.addServices = "/jinyu/bizRetailerService/save"; // 根据品牌统计库存 this.getStockByPP = "/jinyu/bizRetailerStock/selectStockByBrand"; // 获取积分 this.getJFStore = "/jinyu/bizMall/page"; // 获取新闻条 this.getNews = "/jinyu/bizArticle/page"; // 根据品牌获取上级代理商 this.getUpByBrand = "/jinyu/bizAgentBrand/listByAgentIds"; // 根据品牌和省市获取上级代理商 this.getUpByBrandAndArea = "/jinyu/bizAgentBrand/listByBrandIds"; // 获取门店积分列表 this.getJFlistUrl = "/jinyu/bizRetailerIntegral/page"; // 兑换商品 this.exchangeUrl = "/jinyu/bizMallOrder/save"; // 查看兑换记录 this.exchangeListUrl = "/jinyu/bizMallOrder/page"; // 检查版本 this.getVersionUrl = "/web/biz/getAppVersion"; // 活动banner this.getBannerUrl = "/biz/bizBanner/list"; // 获取参加活动的商品 this.getStoreBannerUrl = "/biz/bizActivity/activityInfo"; // 根据条形码获取商品 this.getStoreByScan = "/web/biz/bizGoods/Scancoderemotecall"; // 获取经销商对应物料列表 this.getStoreListU = "/web/biz/bizCoupon/select"; // 添加商品至购物车 this.addStoreToCarU = "/web/biz/bizCart/save"; // 获取购物车列表 this.getCarListU = "/web/biz/bizCart/selectCart"; //线上订货修改购物车数量 this.updateCarNum = "/web/biz/bizCart/update" // 从购物车下单 this.downOrderU = "/web/base/bizOrder/save"; // 扫码确定 this.scanDoneU = "/web/biz/bizGoods/Scancode"; //签约级别 this.signLv = "/web/bizLogin/enum"; // 门店立即抢购 this.rushToBuyU = "/web/base/bizOrder/directSave"; // 门店查询订单 this.getOrderListU = "/web/base/bizOrder/selectStore"; // 门店获取订单详情 this.getOrderInfoU = "/web/biz/bizOrderInfo/selectOrderInfo"; // 获取门店参保列表接口 this.getInsuranceU = "/web/sailun/insurance/getInsuranceList"; // 获取门店详情 this.getAgentInfoU = "/web/biz/bizAudit/store"; // 扫码入库 this.sacaCodeIn = "/web/biz/bizGoods/ScanCodeIn"; // 获取轮胎理赔详情 this.getLipeiList = "/web/sailun/insurance/getInsuranceList"; // 通过胎号获取理赔单详情 this.getLipeiInfoU = "/web/sailun/insurance/getTireClaimInfo"; // 理赔图片的上传 this.uploadLipeU = "/web/sailun/insurance/tireImageUpload"; // 提交轮胎保理赔记录 this.sumbiltLipeiU = "/web/sailun/insurance/submitTireClaim"; // 获取入库记录 this.getIntoListU = "/web/sailun/insurance/getStoreClaimList"; // 获取出入库记录 this.getinOrOutU = "/web/biz/bizGoods/Incomingandoutgoingrecordsquery"; // 获取赔付记录 this.peifuListU = "/web/sailun/insurance/getStoreClaimList"; // 扫码出库 this.outStoreU = "/web/biz/bizGoods/ScanCodeOut"; // 获取签约等级 this.getSignLvU = "/web/bizLogin/enum"; // 门店查询经销商库存 this.getStockListU = "/web/biz/bizAudit/QueryStoreAgentStock"; // 删除购物车记录 this.delCarMataxU = "/web/biz/bizCart/deleteOne"; // 获取理赔单详情 this.getTlementInfoU = "/web/sailun/insurance/getTireInfo"; // 生成核销code this.getHxCodeU = "/web/biz/bizCoupon/save"; // 获取门店门店核销码列表 this.getHxListU = "/web/biz/bizCoupon/selectCoupon"; // 获取物料筛选条件 this.getWuliaoAntionU = "/web/biz/bizCoupon/condition"; //请求文章 根据id this.getOneDetails = "/web/biz/bizArticle/getOneDetails"; //厂家宣传 // this.getArticle="/web/biz/bizArticle/list" // 获取地址管理 // this.getAddress="/sys/bizReceiptAddress/paget" // 获取地址列表 this.getAddressListU = "/web/sys/bizReceiptAddress/page"; // 门店新增收货地址 this.addAddressU = "/web/sys/bizReceiptAddress/save"; // 查看门店自己的优惠券 // this.searchKuCunU = "/web/sys/bizStoreRegistrationSpree/page"; /// 查看门店自己的库存 this.searchKuCunU = "/web/biz/bizGoods/storeSelectStock"; // 门店查询返利明细 this.lookUserTotalU = "/web/biz/bizStoreReward/page"; // 获取优惠券 this.getCouponListU = "/web/sys/bizStoreRegistrationSpree/page"; // 查询门店进货分析 this.getStoreIntoListU = "/web/base/bizOrder/caculateStore"; // 检查版本 this.checkVersionU = "/web/biz/getAppVersion?type=1"; // ios检查版本 this.ioscheckVersionU = "/web/biz/getAppVersion?type=3"; // 上传门店车辆图片接口 this.uploadCarPhotoU = "/web/sailun/insurance/carPictureUpload"; //我的供应商 this.getSupplier = "/web/biz/bizStoreAgent/mySuppliers"; //获取跑马灯list this.getMessageList = "/web/mobile/sysMessage/getMessageList"; //获取新版本 this.getNewVersionU = "/web/file/getShopApk"; //上传门店行驶证照片 this.uploadUserCarU = "/web/sailun/insurance/carPictureUpload"; //离线缓存工单 this.saveJxItemU = "/event/queryEventLX/"; //轮播图 this.getbannerLists = "/web/biz/bizStoreBrand/selectStoreBrandBanner"; //获取商品分类 this.getTypes = "/web/biz/bizGoodsType/selectProductCategory"; // 获取商品 this.getshopLists = "/web/biz/bizGoodsType/selectCategoryItem"; //加入购物车 this.addShopCart = "/web/sailun/bizIntegralCart/save"; //查看购物车 this.getShopCart = "/web/sailun/bizIntegralCart/page"; //修改购物车数量 this.fixCartNum = "/web/sailun/bizIntegralCart/update"; //删除购物车 this.delCart = "/web/sailun/bizIntegralCart/deletes"; //下单 this.addOrder = "/web/biz/bizShopIntegralOrder/save"; //查看兑换记录 this.getOrderannal = "/web/biz/bizIntegralOrderItem/page"; //积分商场详情 this.getProductImage = "/web//sailun/bizProductImage/storeProductItem"; //收货地址查询 this.getReceiptAddress = "/web/sys/bizReceiptAddress/list"; // 立即下单 this.immediatelyOrder = "/web/biz/bizShopIntegralOrder/immediatelyOrder"; //查找更换收后地址 this.updateAddress = "/web/sys/bizReceiptAddress/update"; //删除收货地址 this.addressDel="/web/sys/bizReceiptAddress/delete"; //根据商品名搜索积分商品 this.searchShop="/web/biz/bizCart/appSelectProduct"; //查找订单 this.searchOrder="/web/biz/bizIntegralOrderItem/selectIntegralOrderProduct" //消息列表 this.getMsg="/web/sailun/bizMessageForUser/getMessageCategory"; //消息详情 this.getMsgdetails="/web/sailun/bizMessageForUser/list"; //消息已阅 this.updateMessage="/web/sailun/bizMessageForUser/updateMessage"; //修改签约地址 this.updatesign="/web/biz/bizStoreUpdateMessage/save"; //查看签约地址 this.getsignAddress="/web/biz/bizStoreUpdateMessage/list"; //查看核销详情页 this.hexiaoInfo="/web/biz/bizCoupon/list"; //季度任务数据 this.selectQuarter="/web/biz/bizScanRecord/selectQuarter"; //提交用户信息 this.MobileMessage="/web/biz/bizMobileMessage/save"; //修改签约 this.SignlvUpdate="/web/biz/bizStoreUpdateSignlv/save"; //查看签约 this.SignlvList="/web/biz/bizStoreUpdateSignlv/list"; /**********************************车主下单功能***********************************/ //根据门店id获取所有门店微信订单信息 this.getAllUndealCarOrder="/web/sailun/wxCarorderHead/caroder/getAllUndealCarOrderByStoreId"; this.getOrderInfo = "/web/sailun/wxCarorderHead/carorder/getOrderInfoById"; this.getStoreToMaktxInfoByBSP = "/web/biz/bizGoods/getStoreToMaktxInfoByBSP"; this.updateStoreToMaktxInfoByBSP = "/web/biz/bizGoods/updateStoreToMaktxInfoByBSP"; this.changeWxCarOrderStatus = "/web/sailun/wxCarorderHead/carorder/changeWxCarOrderStatus"; /**********************************对账功能***********************************/ this.getConfirmMonth = "/web/biz/bizMonthDetail/getConfirmMonth";//获取已确认的月份 this.getMonthDetail = "/web/biz/bizMonthDetail/getMonthDetail";//获取月结明细 this.confirmMonthDetail = "/web/biz/bizMonthDetail/confirmMonthDetail";//确认月结明细 this.getRegistTime = "/web/biz/bizMonthDetail/getRegistTime";//获取门店注册时间 //通过图片获取信息 this.licenseDiscern="/web/bizLogin/licenseDiscern"; //运营执行信息是否有效 this.verifyBusiness="/web/bizLogin/verifyBusiness"; //上传运营图片 this.storeUpdatalicense="/web/biz/bizStoreBasicInfo/storeUpdateLicense" //解冻 this.storeUnfreezeProposer="/web/biz/bizAgentFunction/storeUnfreezeProposer" // 获取修改提示 this.getStoreSignMessage= "/web/biz/getStoreSignMessage" //获取优惠券 this.storeCouponMessage="/web/biz/bizGoods/storeCouponMessage" //获取优惠券余数 this.residueCoupon="/web/biz/bizGoods/residueCoupon" } $http.prototype.$postFile = function (url, data, callback) { var urlT = this.ip + eval('this.' + url); api.ajax({ url: urlT, method: 'post', data: { values: data }, headers: { "Content-type": "multipart/form-data" }, }, function (ret, err) { api.hideProgress(); api.refreshHeaderLoadDone(); if (ret) { callback(ret); } else { api.toast({ msg: '当前网络不稳定,请稍后再试' }); } }); } // api的ajax $http.prototype.$post = function (url, data, callback, other) { var content = "", urlT = "", _this = this; if (data.url == "json") { delete data.url; // 确认contenttype选项 content = "application/json;charset=UTF-8"; } else if (data.url == "file") { data = [{}, { file: data[1].file }] 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({ }); if (this.ajax == true) { return; } this.ajax = true; api.ajax({ url: urlT, method: 'post', data: datas, headers: { "Content-type": content, }, }, function (ret, err) { _this.ajax = false; api.hideProgress(); api.refreshHeaderLoadDone(); if (ret) { callback(ret); } else { api.toast({ msg: '当前网络不稳定,请稍后再试' }); } }); } //特殊post api $http.prototype.$postuser = function (url, data, callback, other) { var content = "", urlT = "", _this = this; if (data.url == "json") { delete data.url; // 确认contenttype选项 content = "application/json;charset=UTF-8"; } else if (data.url == "file") { data = [{}, { file: data[1].file }] 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({ }); if (this.ajax == true) { return; } this.ajax = true; api.ajax({ url: urlT, method: 'post', data: datas, headers: { "Content-type": content, }, }, function (ret, err) { _this.ajax = false; api.hideProgress(); api.refreshHeaderLoadDone(); if (ret) { callback(ret); } else { api.toast({ msg: '当前网络不稳定,请稍后再试' }); } }); } // 单独的get请求 $http.prototype.$getadd = function (url, data, callback, other) { var _this = this; api.showProgress({ }); this.ajax = true; api.ajax({ url: this.ip + eval('this.' + url) + data, method: 'get', data: { values: { } }, headers: { "Content-type": "application/json;charset=UTF-8" }, }, function (ret, err) { _this.ajax = false; api.hideProgress(); api.refreshHeaderLoadDone(); if (ret) { callback(ret); } else { api.toast({ msg: '当前网络不稳定,请稍后再试' }); } }); } // get获取 $http.prototype.$get = function (url, data, callback, other) { var content = "", urlT = "", _this = this; 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({ }); if (this.ajax == true) { return; } this.ajax = true; api.ajax({ url: urlT, method: 'get', data: { values: { } }, headers: { "Content-type": "application/json;charset=UTF-8" }, }, function (ret, err) { _this.ajax = false; api.hideProgress(); api.refreshHeaderLoadDone(); if (ret) { callback(ret); } else { api.toast({ msg: '当前网络不稳定,请稍后再试' }); } }); } // 在链接后面拼接参数 $http.prototype.$getOption = function (url, other, callback) { var _this = this; api.showProgress({ }); if (typeof other != 'undefined' && other != "" && other != 'undefined') { urlT = this.ip + eval('this.' + url) + '?' + other; } else { urlT = this.ip + eval('this.' + url); } api.ajax({ url: urlT, method: 'get', data: { values: { } }, headers: { "Content-type": "application/json;charset=UTF-8" }, }, function (ret, err) { _this.ajax = false; api.hideProgress(); api.refreshHeaderLoadDone(); if (ret) { callback(ret); } else { api.toast({ msg: '当前网络不稳定,请稍后再试' }); } }); } // 单独的有文件名字的上传文件 $http.prototype.uploadfile = function (url, data, callback) { var _this = this; var urlT = this.ip + eval('this.' + url); var formdata = new FormData(); formdata.append('file', data.file); formdata.append('type', data.type); api.showProgress({ }); $.ajax({ url: urlT, type: "POST", data: formdata, processData: false, // 告诉jQuery不要去处理发送的数据 contentType: false, // 告诉jQuery不要去设置Content-Type请求头 success: function (ret, status, xhr) { api.hideProgress(); if (ret.code == 0 || ret.code == '0') { callback(ret); } } }); } // 对数据进行处理,第一个为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)); }