| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210 |
- import Vue from 'vue'
- import __config from 'config/env';
- import util from 'utils/util';
- import { validatenull } from './validate';
- const request = (url, method, data, showLoading) => {
- let _url = url;
- //#ifndef H5
- _url = __config.basePath + url
- //#endif
- _url = __config.basePath + url
- let tokenName = uni.getStorageSync(__config.tokenNameKey)
- let tokenValue = uni.getStorageSync(__config.tokenValueKey)
- let shopId = uni.getStorageSync(__config.shopIdSessionKey)
- let switchToken = uni.getStorageSync(__config.switchTokenKey)
- let headerTokenObj = {}
- if (tokenName && tokenValue) {
- headerTokenObj[tokenName ? tokenName : 'rs-auth-token'] = tokenValue ? tokenValue : ''
- }
-
- // 拼接 header 所有参数
- let headerOptions = Object.assign({
- 'tenant-id': __config.tenantId, //租户ID
- //#ifdef H5
- // 'app-id': getApp().globalData.appId ? getApp().globalData.appId : '', //微信h5有appId
- // 'switch-token' : getApp().globalData.isEnableSwitchToken ? switchToken : '', //临时用户身份凭证
- // 'client-type': validatenull(shopId) ? 'OM-HALL' : 'OM-SHOP', //点餐机类型 大厅的/门店内
- // 'device-id': "1f82c7ab30405ebf", //点餐机-唯一设备编号
- "client-type": "OM-SHOP",
- "device-id": "8F5735D3BABEAACD01D72E71D16EB4D2",
- "switch-token": "",
- "shop-id": "1625722888362496001"
- //#endif
- //#ifdef MP-WEIXIN
- 'client-type': 'MA', //客户端类型小程序
- 'app-id': uni.getAccountInfoSync().miniProgram.appId, //小程序appId
- 'shop-id': "1658295766983700481", //店铺ID
- //#endif
- //#ifdef APP-PLUS
- /* 点餐机模式 */
- 'client-type': validatenull(shopId) ? 'OM-HALL' : 'OM-SHOP', //点餐机类型 大厅的/门店内
- 'device-id': getApp().globalData.deviceId, //点餐机-唯一设备编号
- 'switch-token' : getApp().globalData.isEnableSwitchToken ? switchToken : '', //临时用户身份凭证
- 'shop-id': shopId, //店铺ID
- //#endif
- }, headerTokenObj)
- //#ifdef APP-PLUS
- //console.log('\n APP模式 => API 请求 Header参数: \n' + JSON.stringify(headerOptions, null, '\t'))
- //#endif
-
- //#ifdef MP-WEIXIN
- console.log('WX小程序模式 => API 请求 Header参数: \n' + JSON.stringify(headerOptions, null, '\t'))
- //#endif
- return new Promise((resolve, reject) => {
- if (showLoading) {
- uni.showLoading({
- title: '加载中···'
- });
- }
- // console.log(getApp().globalData.isEnableSwitchToken,"isEnableSwitchToken")
- // console.log(switchToken, "switchToken")
- uni.request({
- url: _url,
- method: method,
- data: data,
- withCredentials: true,
- header: headerOptions,
- success(res) {
- if (res.statusCode == 200) {
- if (res.data.code != 200) {
- if (res.data.code == 60001 || res.data.code == 406) {
- if (!getApp().globalData.logining) {
- getApp().globalData.logining = true //防止同时多个接口触发登录
- if (util.isMiniPg() || (getApp().globalData.appId && util
- .isWeiXinBrowser())) {
- //小程序或公众号H5,删除wx_token_name|wx_token_value重新登录
- uni.removeStorageSync(__config.tokenNameKey);
- uni.removeStorageSync(__config.tokenValueKey);
- getApp().doLogin().then(res => {
- var pages = getCurrentPages(); // 获取页面栈
- var currPage = pages[pages.length - 1]; // 当前页面
- currPage.onLoad(currPage.options)
- currPage.onShow()
- });
- } else {
- util.backLoginPage()
- }
- setTimeout(function() {
- getApp().globalData.logining = false;
- }, 2000);
- }
- reject("session过期重新登录");
- } else if (res.data.code == 60003) {
- if (!getApp().globalData.logining2) {
- getApp().globalData.logining2 = true //防止同时多个接口触发登录
- util.backLoginPage()
- setTimeout(function() {
- getApp().globalData.logining2 = false;
- }, 2000);
- }
- reject("请先登录系统");
- } else {
- let code = ["80050"]
- for (var i = 0; i < code.length; i++) {
- if(code[i] = res.data.code){
- reject(res.data)
- }else{
- uni.showModal({
- title: '提示',
- content: res.data.msg + '',
- success() {},
- complete() {
-
- }
- });
- }
- }
-
- // reject(res.data.msg);
- }
- }
- resolve(res.data);
- } else if (res.statusCode == 404) {
- uni.showModal({
- title: '提示',
- content: '网络异常,请检查您所处的网络环境是否正常。',
- success(res) {}
- });
- reject();
- } else if (res.statusCode == 502) {
- console.log(502)
- uni.showModal({
- title: '提示',
- content: '服务器维护中,请稍后再来',
- success(res) {}
- });
- reject();
- } else if (res.statusCode == 503) {
- console.log(503)
- uni.showModal({
- title: '提示',
- content: '503错误,服务未启动',
- success(res) {}
- });
- reject();
- } else {
- console.error(`API请求=>接口地址: ${_url} \n错误信息: ${res.data.msg}`);
- // uni.showModal({
- // title: '提示',
- // content: '错误:' + res.data.msg,
- // success(res) {}
- // });
- reject();
- }
- },
- fail(error) {
- console.error(`[fail].API请求=>接口地址: ${_url} \n错误信息: ${JSON.stringify(error, null, '\t')}`);
- uni.showModal({
- title: '网络异常,请检查您所处的网络环境是否正常。',
- success(res) {}
- });
- reject(error);
- },
- complete(res) {
- uni.hideLoading();
- }
- });
- });
- };
- // 登录成功后需要进行的统一操作
- const loginSuccess = (request) => {
- return new Promise((resolve, reject) => {
- request.then((res) => {
- if (res && res.data.id) { // 登录成功
- console.log("************登录成功************");
- let userInfo = res.data;
- uni.setStorageSync('third_session', userInfo.thirdSession);
- uni.setStorageSync('user_info', userInfo);
- getApp().userOnlineHeartbeat()
- }
- resolve(res)
- }).catch((err) => {
- reject(err)
- })
- })
- }
- // 退出登录后需要进行的统一操作
- const logoutSuccess = (request) => {
- return new Promise((resolve, reject) => {
- request.then((res) => {
- //退出登录成功
- console.log("************退出登录成功************");
- getApp().userOnlineHeartbeat(true)
- resolve(res)
- }).catch((err) => {
- reject(err)
- })
- })
- }
- module.exports = {
- request,
- doGet: function(url, params, isShowLoading = true) {
- return request(url, 'get', params, isShowLoading);
- },
- doPost: function(url, params, isShowLoading = true) {
- return request(url, 'post', params, isShowLoading);
- },
- doPut: function(url, params, isShowLoading = true) {
- return request(url, 'put', params, isShowLoading);
- },
- doDelete: function(url, params, isShowLoading = true) {
- return request(url, 'delete', params, isShowLoading);
- },
-
- deviceReport: (data) => {
- // 点餐机设备信息上报
- return new Promise((resolve, reject) => {
- request('/mallapi/deviceReport/add', 'post', data, false).then(res => {
- resolve(res)
- }).catch(error => {
- reject(error)
- })
- })
- },
-
- userInfoGet: () => {
- //查询点餐平台用户信息
- //小程序获取当前登录用户信息
- return new Promise((resolve, reject) => {
- request('/openapi/ma/common/getCurrentUser', 'get', null, false).then(res => {
- /**
- * 缓存用户信息
- */
- let wxMemberInfo = util.parseUser(res.data)
- uni.setStorageSync(__config.loginWxUserInfoKey, wxMemberInfo)
- res.data = wxMemberInfo
- resolve(res)
- }).catch(error => {
- console.error('小程序获取当前登录用户信息出错: ' + error)
- reject(error)
- })
- })
- },
- getCurrentUserSync: (data) => {
- //小程序获取当前登录用户信息
- return new Promise((resolve, reject) => {
- request('/openapi/ma/common/getCurrentUser', 'get', data, false).then(res => {
- /**
- * 缓存用户信息
- */
- let wxMemberInfo = util.parseUser(res.data)
- uni.setStorageSync(__config.loginWxUserInfoKey, wxMemberInfo)
- res.data = wxMemberInfo
- resolve(res)
- }).catch(error => {
- console.error('小程序获取当前登录用户信息出错: ' + error)
- reject(error)
- })
- })
- },
- /* 小程序文件上传方法 */
- uploadFile: (params, filePath) => {
- uni.showLoading({
- title: '文件上传中...'
- });
- let tokenName = uni.getStorageSync(__config.tokenNameKey)
- let tokenValue = uni.getStorageSync(__config.tokenValueKey)
- let headerTokenObj = {}
- if (tokenName && tokenValue) {
- headerTokenObj[tokenName ? tokenName : 'rs-auth-token'] = tokenValue ? tokenValue : ''
- }
- headerTokenObj = Object.assign({
- "Content-Type": "multipart/form-data"
- }, headerTokenObj)
- if (!params) {
- params = {
- dir: '/uploads/',
- }
- }
- //小程序上传文件
- return new Promise((resolve, reject) => {
- uni.uploadFile({
- url: __config.basePath + '/openapi/storage/upload?dir=' + params.dir,
- filePath: filePath,
- name: 'file',
- header: headerTokenObj,
- //formData: params,
- success: (res) => {
- resolve(JSON.parse(res.data))
- },
- fail: (err) => {
- reject(err)
- },
- complete(res) {
- uni.hideLoading();
- }
- })
- })
- },
- getSingleConfig: key => {
- //根据配置Key获取单个配置值(返回单个值)
- return request('/openapi/common/getSingleConfig/' + key, 'get', null, false);
- },
-
- getMultipleConfig: keys => {
- //根据配置Keys获取多个配置值(返回对象)
- return request('/openapi/common/getMultipleConfig/' + keys, 'get', null, false);
- },
-
- getMultipleConfigByMasterKey: masterKey => {
- //根据配置主表Key获取多个配置值(返回对象)
- return request('/openapi/common/getMultipleConfig/masterKey/' + masterKey, 'get', null, false);
- },
-
-
- getGroupDataList: groupKey => {
- //根据组Key获取数据集合(不分页)
- return request('/openapi/common/getGroupDataList/' + groupKey, 'get', null, false);
- },
-
- getGroupDataPageList: groupKey => {
- //根据组Key获取数据集合(不分页)
- return request('/openapi/common/getGroupDataPageList/' + groupKey, 'get', null, false);
- },
- getDictByKey: data => {
- //获取字典信息(根据字典编码)
- return request('/openapi/common/getDictByKey/' + data, 'get', null, false);
- },
- getConfigByKey: data => {
- //获取字典信息(根据字典编码)
- return request('/openapi/common/getConfigByKey/' + data, 'get', null, false);
- },
-
- getAssetsByKey: data => {
- //获取资产信息(根据资产编码)
- return request('/openapi/assets/info/' + data, 'get', null, false);
- },
-
- getAssetsJsonByKey: (key) => {
- //获取当前项目配置信息
- return new Promise((resolve, reject) => {
- request('/openapi/assets/info/' + key, 'get', null, false).then(res => {
- try {
- if(res.data.length > 0){
- resolve(JSON.parse(res.data[0].itemValue))
- }else{
- resolve(undefined)
- }
- } catch (err) {
- console.error(err)
- resolve(undefined)
- }
- }).catch(error => {
- console.error('小程序获取静态资源配置信息出错: ' + error)
- resolve(undefined)
- })
- })
- },
- unifiedOrder: data => {
- //聚合支付下单接口
- /* {
- "orderId":"1519237400780607571",
- "payType":"PAY_TYPE_WX_MA"
- }*/
- return request('/openapi/payment/unifiedOrder', 'post', data, null, true);
- },
- loginWxMa: data => {
- //如果有分享人则带上分享人的user_code
- data = util.dataAddSharerUserCode(data)
- //微信小程序登录接口
- // return request('/mallapi/wxuser/loginma', 'post', data, false);
- return loginSuccess(request('/mallapi/wxuser/loginma', 'post', data, false));
- },
- loginWxMp: data => {
- //如果有分享人则带上分享人的user_code
- data = util.dataAddSharerUserCode(data)
- //微信公众号登录接口
- return loginSuccess(request('/mallapi/wxuser/loginmp', 'post', data, false));
- },
- loginByPhoneMa: data => {
- //如果有分享人则带上分享人的user_code
- data = util.dataAddSharerUserCode(data)
- //点餐平台通过小程序授权手机号一键登录点餐平台
- return loginSuccess(request('/mallapi/userinfo/ma/phone/login', 'post', data, true));
- },
- loginByPhone: data => {
- //如果有分享人则带上分享人的user_code
- data = util.dataAddSharerUserCode(data)
- //点餐平台手机验证码登录点餐平台
- return loginSuccess(request('/mallapi/userinfo/phone/login', 'post', data, true));
- },
- login: data => {
- //如果有分享人则带上分享人的user_code
- data = util.dataAddSharerUserCode(data)
- //点餐平台账号登录
- return loginSuccess(request('/mallapi/userinfo/login', 'post', data, true));
- },
- logout: data => {
- //点餐平台退出登录
- return logoutSuccess(request('/mallapi/userinfo/logout', 'post', data, true));
- },
- getPhoneCode: data => {
- //获取手机验证码
- return request('/mallapi/phone/code', 'get', data, true);
- },
- register: data => {
- //如果有分享人则带上分享人的user_code
- data = util.dataAddSharerUserCode(data)
- //账号注册
- return request('/mallapi/userinfo/register', 'post', data, true);
- },
- updateUserPhone: data => {
- //修改点餐平台用户手机号
- return request('/mallapi/userinfo/phone', 'post', data, true);
- },
- getJsSdkConfig: data => {
- //获取jssdk config参数
- return request('/mallapi/wxjssdk/config', 'post', data, false);
- },
- themeMobileGet: () => {
- //获取点餐平台主题装修配置
- return new Promise((resolve, reject) => {
- resolve({})
- });
- },
- shopInfoPage: data => {
- //店铺列表
- return request('/mallapi/shopinfo/page', 'get', data, false);
- },
- shopInfoPageWithSpu: data => {
- //店铺列表带菜品
- return request('/mallapi/shopinfo/pagewithspu', 'get', data, false);
- },
- shopInfoGet: id => {
- //店铺查询
- return request('/mallapi/shopinfo/' + id, 'get', null, false);
- },
- userInfoUpdateByMa: data => {
- //通过微信小程序更新用户信息
- return request('/mallapi/userinfo/ma', 'put', data, true);
- },
- userInfoUpdateByMp: data => {
- //通过微信公众号网页授权更新用户信息
- return request('/mallapi/userinfo/mp', 'put', data, true);
- },
- goodsCategoryTree: data => {
- //点餐平台菜品分类tree查询
- return request('/mallapi/goodscategory/tree', 'get', data, false);
- },
- goodsCategoryShopTree: data => {
- //店铺菜品分类tree查询
- return request('/mallapi/goodscategoryshop/tree', 'get', data, true);
- },
- goodsPage: data => {
- //菜品列表
- return request('/mallapi/goodsspu/page', 'get', data, false);
- },
- goodsGet: id => {
- //菜品查询
- return request('/mallapi/goodsspu/' + id, 'get', null, false);
- },
- goodsSpecGet: data => {
- //菜品规格查询
- return request('/mallapi/goodsspuspec/tree', 'get', data, true);
- },
- shoppingCartPage: data => {
- //购物车列表
- return request('/mallapi/shoppingcart/page', 'get', data, false);
- },
- shoppingCartEmpty: data => {
- //清空购物车列表
- return request('/mallapi/shoppingcart', 'delete', data, false);
- },
- shoppingCartAdd: data => {
- //购物车新增
- return request('/mallapi/shoppingcart', 'post', data, true);
- },
- shoppingCartUpdate: data => {
- //购物车修改
- return request('/mallapi/shoppingcart', 'put', data, true);
- },
- shoppingCartDel: data => {
- //购物车删除
- return request('/mallapi/shoppingcart/del', 'post', data, false);
- },
- shoppingCartCount: data => {
- //购物车数量
- return request('/mallapi/shoppingcart/count', 'get', data, false);
- },
- orderSub: data => {
- //订单提交
- return request('/mallapi/orderinfo', 'post', data, true);
- },
- rechargeable: data => {
- //订单提交
- return request('/mallapi/rechargeable/rechargeable', 'post', data, true);
- },
- orderPriceSub: data => {
- //订单提交(新版 2023-08-22)
- return request('/mallapi/orderinfo/orderPriceSub', 'post', data, true);
- },
- moneyOrder: data => {
- //订单提交(新版充值 2023-08-22)
- return request('/mallapi/orderinfo/moneyOrder', 'post', data, true);
- },
- getSpuPriceOne: data => {
- //订单菜品单独计算优惠信息
- return request('/mallapi/orderCountPrice/computeOne', 'post', data, true);
- },
- getSpuPriceTwo: data => {
- //订单菜品单独计算优惠信息
- return request('/mallapi/orderCountPrice/computeTwo', 'post', data, true);
- },
- getSpuPriceGoodsCoupon: data => {
- //订单菜品单独计算商品兑换券
- return request('/mallapi/orderCountPrice/computeGoodsCoupon', 'post', data, true);
- },
- getZeroMoneyInfo: () => {
- // 查询用户的钱包余额(主表非明细)
- return request('/mallapi/zeroMoney/getZeroMoneyInfo', 'get',null, true);
- },
- openWallet: () => {
- // 当用户没有钱包的时候新创建钱包
- return request('/mallapi/zeroMoney/openWallet', 'get',null, true);
- },
- getZeroMoneyDetailRec: data => {
- // 获取当前用户的钱包的消费记录(充值)
- return request('/mallapi/zeroMoney/getZeroMoneyDetailRec', 'get',data, false);
- },
- getZeroMoneyDetailReturn: data => {
- // 获取当前用户的钱包的消费记录(退款)
- return request('/mallapi/zeroMoney/getZeroMoneyDetailReturn', 'get',data, false);
- },
- getZeroMoneyDetailPay: data => {
- // 获取当前用户的钱包的消费记录(消费)
- return request('/mallapi/zeroMoney/getZeroMoneyDetailPay', 'get',data, false);
- },
- queryMicroOrder: data => {
- //付款码支付查询订单交易状态
- return request('/mallapi/orderinfo/queryMicroOrder/' + data.orderId, 'post', data , false);
- },
- getIndexStatus: tenantId => {
- //判断租户是否要显示首页(堂食还是外卖页)
- return request('/mallapi/orderinfo/getIndexStatus/' + tenantId, 'get', null , false);
- },
- getSendFloor: tenantId => {
- //获取餐厅配送楼层信息
- return request('/mallapi/orderinfo/getSendFloor/' + tenantId, 'get', null , false);
- },
- getRoomNo: tenantId => {
- //获取餐厅是显示楼层信息还是房间号信息
- return request('/mallapi/orderinfo/getRoomNo/' + tenantId, 'get', null , false);
- },
- orderPage: data => {
- //订单列表
- return request('/mallapi/orderinfo/page', 'get', data, false);
- },
- orderGet: id => {
- //订单详情查询
- return request('/mallapi/orderinfo/' + id, 'get', null, false);
- },
- orderAgain: data => {
- //再来一单
- return request('/mallapi/orderinfo/anotherOrder', 'get', data, false);
- },
- orderCancel: id => {
- //订单确认取消
- return request('/mallapi/orderinfo/cancel/' + id, 'put', null, true);
- },
- orderReceive: id => {
- //订单确认收货
- return request('/mallapi/orderinfo/receive/' + id, 'put', null, true);
- },
- orderDel: id => {
- //订单删除
- return request('/mallapi/orderinfo/' + id, 'delete', null, false);
- },
- orderCountAll: data => {
- //订单计数
- return request('/mallapi/orderinfo/countAll', 'get', data, false);
- },
- orderLogisticsGet: logisticsId => {
- //订单物流查询
- return request('/mallapi/orderinfo/orderlogistics/' + logisticsId, 'get', null, false);
- },
- unifiedOrder: data => {
- //下单接口
- return request('/mallapi/orderinfo/unifiedOrder', 'post', data, true);
- },
- userAddressPage: data => {
- //用户收货地址列表
- return request('/mallapi/useraddress/page', 'get', data, false);
- },
- userAddressSave: data => {
- //用户收货地址新增
- return request('/mallapi/useraddress', 'post', data, true);
- },
- userAddressDel: id => {
- //用户收货地址删除
- return request('/mallapi/useraddress/' + id, 'delete', null, false);
- },
- userCollectAdd: data => {
- //用户收藏新增
- return request('/mallapi/usercollect', 'post', data, true);
- },
- userCollectDel: id => {
- //用户收藏删除
- return request('/mallapi/usercollect/' + id, 'delete', null, false);
- },
- userCollectPage: data => {
- //用户收藏列表
- return request('/mallapi/usercollect/page', 'get', data, false);
- },
- userFootprintPage: data => {
- //用户足迹列表
- return request('/mallapi/userfootprint/page', 'get', data, false);
- },
- goodsAppraisesAdd: data => {
- //菜品评价新增
- return request('/mallapi/goodsappraises', 'post', data, true);
- },
- goodsAppraisesPage: data => {
- //菜品评价列表
- return request('/mallapi/goodsappraises/page', 'get', data, false);
- },
- qrCodeUnlimited: data => {
- //获取小程序二维码
- return request('/mallapi/wxqrcode/unlimited', 'post', data, true);
- },
- orderItemGet: id => {
- //查询订单详情
- return request('/mallapi/orderitem/' + id, 'get', null, false);
- },
- orderRefundsSave: data => {
- //发起退款
- return request('/mallapi/orderrefunds', 'post', data, true);
- },
- updateTableUserId: data => {
- //修改前台下单数据进行修改 暂未结账的
- return request('/mallapi/table/updateUserId', 'post', data, true);
- },
-
- userInfoUpdate: (data) => {
- //修改点餐平台用户
- return request('/mallapi/userinfo', 'put', data, true);
- },
- pointsRecordPage: data => {
- //查询积分记录
- return request('/mallapi/pointsrecord/page', 'get', data, false);
- },
- pointsConfigGet: () => {
- //查询积分配置
- return request('/mallapi/pointsconfig', 'get', null, false);
- },
- couponUserSave: data => {
- //电子券用户领取
- return request('/mallapi/couponuser', 'post', data, true);
- },
- couponUserInfo: data => {
- //优惠卷详情
- return request('/mallapi/couponuser/' + data.id, 'get', false);
- },
- /************晚餐带桌号下单API开始*************/
- tableNumber: data => {
- //查询可用桌号
- return request('/mallapi/table/getTable', 'get', data, false);
- },
- addGoodsTable: data => {
- //将数据添加到临时表中
- return request('/mallapi/table/addGoods', 'post', data, true);
- },
- getShoppingGoods: data => {
- //将数据添加到临时表中,获取数据
- return request('/mallapi/table/getShoppingGoods', 'get', data, false);
- },
-
- printInfo: data => {
- //将数据添加到临时表中
- return request('/mallapi/table/printInfo', 'post', data, true);
- },
- updateData: data => {
- //将数据添加到临时表中
- return request('/mallapi/table/updateData', 'post', data, true);
- },
- deleteTableData: data => {
- //将数据添加到临时表中
- return request('/mallapi/table/deleteTableData', 'delete', data, true);
- },
- // clearTable: id => {
- // //将数据添加到临时表中
- // return request('/mallapi/table/clearTable', 'delete', id, true);
- // },
- /************晚餐带桌号结束*************/
- addCouponAndSendToUser: data => {
- //根据优惠券规则ID生成商品券并分给当前用户
- return request('/mallapi/coupon/addCouponAndSendToUser', 'get' , data , false);
- },
- // 获取预约配送订单
- getSubscribeOrder: data=>{
- return request('/mallapi/orderinfo/getSubscribeOrder', 'get', data, false);
- },
- postSendSuccessInfo: data=>{
- return request('/mallapi/verifyOrder/sendSuccess', 'post', data, false);
- },
- getBookingDate: data => {
- //获取预约可选时间
- return request('/mallapi/orderinfo/getBookingDate', 'get', data, false);
- },
- getSaleTime: ()=>{
- //获取餐厅菜品销售使劲
- return request('/mallapi/orderinfo/getSaleTimeType', 'get', null, false);
- },
- getSendTime: data=>{
- //获取可配送时间
- return request('/mallapi/orderinfo/getSendTime', 'get', data, false);
- },
- getOrderTime: data=>{
- //获取可预约时间
- return request('/mallapi/orderinfo/getOrderTime', 'get', data, false);
- },
- getSubscribeOrderCouponAmount: data => {
- //获取预约订单优惠规则及金额
- return request('/mallapi/settlementCoupon/getSubscribeOrderCouponAmount', 'post', data, false);
- },
- couponUserPage: (data,pageParam) => {
- pageParam = pageParam||{}
- //电子券用户列表
- return request(`/mallapi/couponuser/page?pageNum=${pageParam.pageNum}&pageSize=${pageParam.pageSize}`, 'post', data, true);
- },
-
- goodCouponPage: (data,pageParam) => {
- pageParam = pageParam||{}
- //商品券用户列表
- return request(`/mallapi/couponuser/goodCouponPage?pageNum=${pageParam.pageNum}&pageSize=${pageParam.pageSize}`, 'post', data, true);
- },
- getCouponPageIndex: (data,pageParam) => {
- pageParam = pageParam||{}
- //商品券用户列表
- return request(`/mallapi/couponuser/getCouponPageIndex?pageNum=${pageParam.pageNum}&pageSize=${pageParam.pageSize}`, 'post', data, true);
- },
-
- receiveGoodCoupon: data => {
- //用户扫码绑定优惠券
- return request('/mallapi/couponuser/receiveGoodCoupon', 'get', data, false);
- },
-
- couponInfoPage: data => {
- //电子券列表
- return request('/mallapi/couponinfo/page', 'get', data, false);
- },
- bargainInfoPage: data => {
- //砍价列表
- return request('/mallapi/bargaininfo/page', 'get', data, false);
- },
- bargainInfoGet: data => {
- //砍价详情
- return request('/mallapi/bargaininfo', 'get', data, true);
- },
- bargainUserSave: data => {
- //发起砍价
- return request('/mallapi/bargainuser', 'post', data, true);
- },
- bargainCutPage: data => {
- //帮砍记录
- return request('/mallapi/bargaincut/page', 'get', data, true);
- },
- bargainUserGet: id => {
- //砍价记录详情
- return request('/mallapi/bargainuser/' + id, 'get', null, false);
- },
- bargainUserPage: data => {
- //砍价记录列表
- return request('/mallapi/bargainuser/page', 'get', data, true);
- },
- bargainCutSave: data => {
- //砍一刀
- return request('/mallapi/bargaincut', 'post', data, true);
- },
- listEnsureBySpuId: data => {
- //通过spuID,查询菜品保障
- return request('/mallapi/ensuregoods/listEnsureBySpuId', 'get', data, true);
- },
- grouponInfoPage: data => {
- //拼团列表
- return request('/mallapi/grouponinfo/page', 'get', data, false);
- },
- grouponInfoGet: id => {
- //拼团详情
- return request('/mallapi/grouponinfo/' + id, 'get', null, true);
- },
- grouponUserPageGrouponing: data => {
- //拼团中分页列表
- return request('/mallapi/grouponuser/page/grouponing', 'get', data, true);
- },
- grouponUserPage: data => {
- //拼团记录列表
- return request('/mallapi/grouponuser/page', 'get', data, true);
- },
- grouponUserGet: id => {
- //拼团记录详情
- return request('/mallapi/grouponuser/' + id, 'get', null, false);
- },
-
- seckillhallList: date => {
- //秒杀会场时间列表
- return request('/mallapi/seckillhall/list?hallDate=' + date, 'get', null, false);
- },
- seckillinfoPage: data => {
- //秒杀列表
- return request('/mallapi/seckillinfo/page', 'get', data, false);
- },
- seckillInfoGet: (seckillHallInfoId) => {
- //秒杀详情
- return request('/mallapi/seckillinfo/' + seckillHallInfoId, 'get', null, true);
- },
- wxTemplateMsgList: data => {
- //订阅消息列表
- return request('/mallapi/wxtemplatemsg/list', 'post', data, false);
- },
- liveRoomInfoList: data => {
- //获取直播房间列表
- return request('/mallapi/wxmalive/roominfo/list', 'get', data, true);
- },
- customerServiceList: shopId => {
- //客服列表
- return request('/mallapi/customerservice/list/' + shopId, 'get', null, false);
- },
- pagedevise: pageType => {
- //首页组件配置
- return new Promise((resolve, reject) => {
- resolve({code: 200, data: {}})
- });
- },
- pagedeviseShop: shopId => {
- // 店铺组件配置
- return request('/mallapi/pagedevise?pageType=2&shopId=' + shopId, 'get', null, false);
- },
- getJiguangConfig: data => {
- //获取极光参数
- return request('/mallapi/jiguang/config', 'get', data, false);
- },
- getJiguangMessages: data => {
- //获取极光消息
- return request('/mallapi/jiguang/messages?userName=' + data.userName + '&beginTime=' + data.beginTime +
- '&endTime=' + data.endTime, 'get', null, false);
- },
- articlePage: data => {
- //文章列表
- return request('/mallapi/articleinfo/page', 'get', data, false);
- },
- articleGet: id => {
- //文章详情
- return request('/mallapi/articleinfo/' + id, 'get', null, false);
- },
- articleCategoryPage: data => {
- //文章分类列表
- return request('/mallapi/articlecategory/page', 'get', data, false);
- },
- userSign: data => {
- //积分签到
- return request('/mallapi/signrecord/user', 'post', data, false);
- },
- getSignRecord: data => {
- //签到记录查询
- return request('/mallapi/signrecord/user', 'get', data, false);
- },
- signConfigPage: data => {
- //获取签到积分记录
- return request('/mallapi/signconfig/page', 'get', data, false);
- },
- distributionConfig: () => {
- //分销设置查询
- return request('/mallapi/distributionconfig', 'get');
- },
- distributionuser: () => {
- //分销员查询
- return request('/mallapi/distributionuser', 'get');
- },
- distributionuserPage: (data) => {
- //分销员查询
- return request('/mallapi/distributionuser/page', 'get', data);
- },
- distributionorderPage: data => {
- //分销订单分页
- return request('/mallapi/distributionorder/page', 'get', data);
- },
- distributionorderFrozenAmount: data => {
- //获取当前分销员的冻结金额
- return request('/mallapi/distributionorder/frozenAmount', 'get', data);
- },
- distributionPromotionPage: data => {
- //分销 推广人统计
- return request('/mallapi/userinfo/page', 'get', data);
- },
- userwithdrawRecordSave: data => {
- //分销 申请提现
- return request('/mallapi/userwithdrawrecord', 'post', data, true);
- },
- userwithdrawRecordUpdate: data => {
- //分销 提现申请修改
- return request('/mallapi/userwithdrawrecord', 'put', data, true);
- },
- userwithdrawRecordPage: data => {
- //分销 提现记录
- return request('/mallapi/userwithdrawrecord/page', 'get', data);
- },
- userwithdrawRecord: id => {
- //分销 提现记录详情
- return request('/mallapi/userwithdrawrecord/' + id, 'get', null);
- },
- userRecord: () => {
- //分销 用户消费总额记录
- return request('/mallapi/userrecord', 'get', null);
- },
- wxAppConfig: id => {
- //获取wx一件授权的component_appid
- return request('/mallapi/wxapp/' + id, 'get', null);
- },
- userAppraisesPage: data => {
- //我的评价
- return request('/mallapi/goodsappraises/page/user', 'get', data);
- },
- goodsSpuListByIds: data => {
- //根据id集合菜品查询
- if (data && data.length > 0) {
- return request('/mallapi/goodsspu/listbyids', 'post', data, false);
- } else {
- return new Promise((resolve, reject) => {
- resolve({
- data: []
- })
- })
- }
- },
- userOnlineHeartbeat: data => {
- // 接收点餐平台用户心跳
- return request('/mallapi/useronline/heartbeat', 'get', data);
- },
- orderingMachineActivityList: data => {
- //点餐机活动列表
- return request('/mallapi/activity/orderingMachineActivityList', 'get', data);
- },
-
- appActivityList: data => {
- //小程序活动列表
- return request('/mallapi/activity/appActivityList', 'get', data, true);
- },
-
- goodscategoryshop: data => {
- // 分页查询店铺分类列表
- return request('/mallapi/goodscategoryshop/page', 'get', data, true);
- },
-
- goodscategory: data => {
- // 分页查询菜品分类列表
- return request('/mallapi/goodscategory/page', 'get', data);
- },
- goodscategorytoshop: data => {
- // 分页查询菜品分类列表
- return request('/mallapi/goodscategory/pageOne', 'get', data);
- },
-
- shopinfo: data => {
- // 分页查询店铺列表
- return request('/mallapi/shopinfo/page', 'get', data);
- },
-
- goodsspu: data => {
- // 分页查询菜品列表
- return request('/mallapi/goodsspu/page', 'post', data, true);
- },
-
- getGoodsSpu: data => {
- // 根据菜品ID查询此菜品的SKU
- return request('/mallapi/goodsspu/' + data.spuId, 'get', null);
- },
-
- goodsspuspec: data => {
- // 根据菜品ID查询此菜品的SKU
- return request('/mallapi/goodsspuspec/tree' + data.spuId, 'get', null);
- },
-
- goodCouponSpecTree: data => {
- //获取菜品规格(商品礼券结算用)
- return request('/mallapi/goodsspuspec/goodCouponSpecTree' ,'get', data, false);
- },
-
- invoiceHeaderPage: data => {
- // 发票抬头分页查询
- return request('/mallapi/invoiceHeader/page', 'get', data,true);
- },
-
- invoiceHeaderSave: data => {
- // 发票抬头新增
- return request('/mallapi/invoiceHeader/save', 'post', data,true);
- },
-
- invoiceHeaderDetail: data => {
- // 发票抬头详情
- return request('/mallapi/invoiceHeader/selectDetails/' + data.id, 'get',true );
- },
-
- invoiceHeaderUpdate: data => {
- // 发票抬头修改
- return request('/mallapi/invoiceHeader/update', 'post', data,true);
- },
-
- invoiceHeaderDelete: data => {
- // 发票抬头删除
- return request('/mallapi/invoiceHeader/delete/' + data.id, 'delete',true );
- },
-
-
- couldInvoicedOrder: data => {
- // 当前用户未可开票的订单
- return request('/mallapi/invoiceHistory/couldInvoicedOrder', 'get', data,true);
- },
-
- getInvoiceHeader: data => {
- // 申请开票时的发票抬头列表,默认选中第一个
- return request('/mallapi/invoiceHistory/getInvoiceHeader', 'get',true)
- },
-
- apply: data => {
- // 确认申请开票
- return request('/mallapi/invoiceHistory/apply', 'post', data,true)
- },
-
- selectDetails: data => {
- // 开票记录详情
- return request('/mallapi/invoiceHistory/selectDetails/' + data.id, 'get',true);
- },
-
- selectList: data => {
- // 分页查询开票记录
- return request('/mallapi/invoiceHistory/invoiceHistoryPage', 'get' , data,true);
- },
-
- takeAwayMachineTemplate: orderId => {
- // 获取点餐机支付成功打印模板数据
- return request('/mallapi/orderinfo/takeAwayMachineStr/' + orderId, 'get' , null, false);
- },
-
- takeAwayMachineTemplates: orderId => {
- // 获取点餐机支付失败打印模板数据
- return request('/mallapi/orderinfo/takeAwayMachineStrError/' + orderId, 'get' , null, false);
- },
-
-
- getSwitchToken: data =>{
- // 获取点餐机临时token
- return request('/openapi/ma/common/getSwitchToken', 'get' , data);
- },
-
- setSwitchToken: data =>{
- // 存储点餐机临时token
- return request('/openapi/ma/common/setSwitchToken', 'get' , data);
- },
-
- getCouponList: data =>{
- // 获取用户优惠券列表(订单结算页用)
- return request('/mallapi/settlementCoupon/getCouponList', 'get' , data);
- },
- getCouponListReceprion: data=>{
- // 获取用户优惠券列表(桌号下单使用,仅前台用户查询)
- return request('/mallapi/settlementCoupon/getCouponListReceprion', 'get' , data);
- },
- companyList: data => {
- // 公司列表
- return request('/mallapi/userInfo/companyList', 'post', data)
- },
-
- updateUserInfo: data => {
- // 修改个人信息
- return request('/mallapi/userInfo/updateUserInfo', 'post', data)
- },
- getSentAddress: data => {
- //获取当前小程序登录的用户的最近一单有效的楼层信息
- return request('/mallapi/orderinfo/getSentAddress', 'get', data , false);
- },
- verifyGoodCoupon: data =>{
- // 验证商品券是否可用
- return request('/mallapi/coupon/verifyGoodCoupon', 'get' , data);
- },
- verifyGoodCouponShopGroup: data =>{
- // 验证商品券属于哪个店铺组
- return request('/mallapi/coupon/verifyGoodCouponShopGroup', 'get' , data);
- },
- fullGoodCoupon: data =>{
- // 验证商品券是否可用
- return request('/mallapi/coupon/fullGoodCoupon', 'get' , data);
- },
- newFullGoodCoupon: data =>{
- // 验证商品券是否可用(2023-05-08新版)
- return request('/mallapi/coupon/newFullGoodCoupon', 'get' , data);
- },
- getCouponSpuList: data =>{
- // 根据商品ID集合查询商品列表(返回购物车接口格式的数据)
- return request('/mallapi/coupon/getCouponSpuList', 'get' , data);
- },
-
- getMallOpenTime: data =>{
- // 获取当前时间、餐厅营业时间
- return request('/mallapi/sysMallSettingConfig/getMallOpenTime', 'get' , data);
- },
-
-
- getHalfPriceSpuIdList: data =>{
- // 第二份半价
- return request('/mallapi/settlementCoupon/getHalfPriceSpuIdList', 'post' , data, true);
- },
-
- originRefundOrderItem: data =>{
- // 获取已经退款的子单ID集合
- return request('/mallapi/orderinfo/originRefundOrderItem', 'get' , data, true);
- },
-
- refundOrderInfo: data =>{
- // 获取退款详情
- return request('/mallapi/orderinfo/refundOrderInfo', 'get' , data, true);
- },
- getGoodsSpuMenuData: () =>{
- // 获取菜品荤菜还有素菜
- return request('/mallapi/goodsspumenu/getGoodsspumenu', 'get' , null, true);
- },
- cancelRefundApply: data =>{
- // 撤销退款申请
- return request('/mallapi/orderinfo/cancelRefundApply', 'get' , data, true);
- },
-
- sendNotice: data =>{
- // 发送帮助
- return request('/mallapi/help/sendNotice', 'get' , data, true);
- },
-
- getByOrderNo: data =>{
- // 获取订单详情(根据订单编号)
- return request('/mallapi/orderinfo/getByOrderNo', 'get' , data, true);
- },
-
- publishReceptionPrint: data =>{
- // 执行前台打印机打印
- return request('/mallapi/orderinfo/publishReceptionPrint', 'get' , data, true);
- },
-
- getMaTemplateIdList: data => {
- // 获取微信小程序模板消息接口
- return request('/mallapi/sysMallSettingConfig/getMaTemplateIdList', 'get', data, false);
- },
- getCompanyInfo: data => {
- // 查询微信授权手机号是否在企业管理员名单中
- return request('/openapi/ma/common/getCompanyInfo', 'get', data, false);
- },
- getWorkingMealInfo: data => {
- // 查询中午订餐记录
- return request('/mallapi/company/getWorkingMealInfo', 'get', data, false);
- },
-
- getGoodSendRecordInfo: data => {
- // 古野查询订餐记录(代金券)
- return request('/mallapi/company/getGoodSendRecordInfo', 'get', data, false);
- },
- getGoodInfo: data => {
- // 查询该小程序绑定得手机号绑定得公司绑定得优惠券
- return request('/mallapi/company/getGoodInfo', 'get', data, false);
- },
- saveWorkingMealInfo: data => {
- //
- return request('/mallapi/company/save', 'post', data, false);
- },
- saveSendInfo: data => {
- //
- return request('/mallapi/company/saveSendInfo', 'post', data, false);
- },
- getOtherData: data => {
- // 查询剩余金额
- return request('/mallapi/company/getOtherData', 'get', data, false);
- },
- getUrlQRCode:() => {
- return request('/mallapi/company/generate', 'get');
- },
- getRecordsInfo: data => {
- return request('/mallapi/company/getRecordsInfo', 'get', data, false);
- },
- //退款申请
- applySupportRefund: data => {
- return request('/mallapi/orderinfo/applyRefund', 'post', data, false);
- }
- };
|