| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188 |
- 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 deviceId = uni.getStorageSync(__config.deviceIdSessionKey)
- if(!deviceId){
- deviceId = getApp().globalData.deviceId
- }
- 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": "0369E2FE48919344005E364491A7D614",
- "switch-token": "",
- "shop-id": "1631454886708219906",
- //#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': deviceId, //点餐机-唯一设备编号
- 'switch-token' : getApp().globalData.isEnableSwitchToken ? switchToken : '', //临时用户身份凭证
- 'shop-id': shopId, //店铺ID
- //#endif
- }, headerTokenObj)
- //#ifdef APP-PLUS
- console.log('\n APP模式 ===============>>>>>>>>>>>>>>>>>>>> \nAPI 请求 Header参数: \n' + JSON.stringify(headerOptions, null, '\t') + '\nAPI 请求URL: ' + _url + '\nAPI 请求Request参数: ' + JSON.stringify(data, null, '\t') + '\n')
- //#endif
- //#ifdef H5
- console.log('\n H5模拟APP模式 ===============>>>>>>>>>>>>>>>>>>>> \nAPI 请求 Header参数: \n' + JSON.stringify(headerOptions, null, '\t') + '\nAPI 请求URL: ' + _url + '\nAPI 请求Request参数: ' + JSON.stringify(data, null, '\t') + '\n')
- //#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: '加载中···'
- // });
- // uni.hideLoading();
- }
- // 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: '提示',
- content: '接口请求出错:' + error.errMsg,
- 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({})
- });
- },
- getShopNameArr: () => {
- //店铺列表
- return request('/mallapi/shopinfo/getShopNameArr', 'get', null, false);
- },
- 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);
- },
- getSpuPriceGoodsCoupon: data => {
- //订单菜品单独计算商品兑换券
- return request('/mallapi/orderCountPrice/computeGoodsCoupon', 'post', 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);
- },
- shoppingToOrder: data => {
- //购物车数量
- return request('/mallapi/shoppingcart/toOrder', 'post', data, false);
- },
- orderSub: data => {
- //订单提交
- return request('/mallapi/orderinfo', 'post', data, true);
- },
- 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);
- },
- getSpuPriceTwo: data => {
- //订单菜品单独计算优惠信息
- return request('/mallapi/orderCountPrice/computeTwo', 'post', data, true);
- },
- orderPriceSub: data => {
- //订单提交(新版 2023-08-22)
- return request('/mallapi/orderinfo/orderPriceSub', '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);
- },
- 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);
- },
- addCouponAndSendToUser: data => {
- //根据优惠券规则ID生成商品券并分给当前用户
- return request('/mallapi/coupon/addCouponAndSendToUser', 'get' , 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);
- },
- 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);
- },
- 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);
- },
- companyList: data => {
- // 公司列表
- return request('/mallapi/userInfo/companyList', 'post', data)
- },
- updateUserInfo: data => {
- // 修改个人信息
- return request('/mallapi/userInfo/updateUserInfo', 'post', data)
- },
- verifyGoodCoupon: data =>{
- // 验证商品券是否可用
- return request('/mallapi/coupon/verifyGoodCoupon', '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);
- },
- 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);
- },
- machineAddUpdate: data => {
- // 点餐机新增或更新店铺数据
- return request('/mallapi/deviceReport/addUpdate', 'post', data, false);
- },
- IPAD_fetchShopCateogry: data => {
- // 获取店铺下分类tree
- return request('/magic-api/openapi/ipad/shop/category/tree', 'get', data, false);
- },
- IPAD_getShoppingCart: data => {
- // 获取购物车-预览报表接口
- return request('/magic-api/openapi/ipad/cart/preview/statistics', 'get', data, false);
- },
- IPAD_getTableInfoStatus: (tableId) => {
- // 获取餐桌状态
- return request(`/magic-api/openapi/ipad/floor/table/status?tableId=${tableId}`, 'get', {}, false)
- },
- IPAD_updateShopTablePeople: (data) => {
- // 修改就餐人数
- return request(`/mallapi/ipad/updateDiningPeople`, 'post', data, false)
- },
- PHONE_getFloorList : (data) => {
- // 获取楼层列表
- return request(`/magic-api/openapi/phone/floor/list`, 'get', data, false)
- },
- PHONE_getFloorTableList : (data) => {
- // 获取楼层对应的餐桌列表
- return request(`/magic-api/openapi/phone/floor/tableList`, 'get', data, false)
- },
- PHONE_updateDiningPeople : (data) => {
- // 根据桌号修改就餐人数、入店时间
- return request(`/mallapi/phone/updateDiningPeople`, 'post', data, false)
- },
- PHONE_getTableStatus : (tableId) => {
- // 获取餐桌当前状态
- return request(`/magic-api/openapi/phone/floor/table/tableStatusPhone?tableId=${tableId}`, 'get', {}, false)
- },
- PHONE_fetchShopCategory: data => {
- // 获取店铺下分类tree
- return request('/magic-api/openapi/phone/shop/category/treePhone', 'get', data, false);
- },
- };
|