加油站付款小程序,打印小票
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

90 lines
2.7 KiB

import http from './http.js'
const config = {
//示例
// getConfig: { url: '/api/getConfig', method: 'GET', limit: 500 },
// 修改个人信息接口
infoUpdateInfo: { url: '/cheer/info/updateInfo', method: 'POST', auth: true },
// 登录接口
loginLogin: { url: '/cheer/login/login', method: 'GET' },
// 获取个人信息接口
infoGetInfo: { url: '/cheer/info/getInfo', method: 'GET', auth: true, showLoading : true },
//下单
// createOrderPay: { url: '/cheer/info/createOrderPay', method: 'GET', auth: true, limit : 2000, showLoading : true },
//获取折扣、客户电话、微信
// getConfig: { url: '/cheer/info/getConfig', method: 'GET'},
//获取充值套餐
// getRechargePage: { url: '/cheer/info/getRechargePage', method: 'GET'},
//获取加油流水订单
// getOrderWaterPage: { url: '/cheer/info/getOrderWaterPage', method: 'GET', showLoading : true },
//获取隐私政策
getPrivacyPolicy: { url: '/cheer/login/getPrivacyPolicy', method: 'GET'},
//获取用户协议
getUserAgreement: { url: '/cheer/login/getUserAgreement', method: 'GET'},
/**
* 新版本接口
*/
//根据加油站标识获取相关配置信息
twogetConfig: { url: '/cheer/two/getConfig', method: 'GET'},
//获取加油站列表信息接口
getGasStationList: { url: '/cheer/two/getGasStationList', method: 'GET'},
//根据加油站标识获取加油流水订单
twogetOrderWaterPage: { url: '/cheer/two/getOrderWaterPage', method: 'GET'},
//根据加油站标识获取加油站充值套餐信息
twogetRechargeList: { url: '/cheer/two/getRechargeList', method: 'GET'},
//获取推广二维码
getQrCode: { url: '/cheer/two/getQrCode', method: 'GET'},
//查询当前用户是否是管理员
isAdmin: { url: '/cheer/two/isAdmin', method: 'GET'},
//用户输入支付创建支付订单并且支付
twocreateOrderPay: { url: '/cheer/two/createOrderPay', method: 'POST'},
}
export function api(key, data, callback, loadingTitle) {
let req = config[key]
if (!req) {
console.error('无效key' + key);
return
}
if (typeof callback == 'string') {
loadingTitle = callback
}
if (typeof data == 'function') {
callback = data
data = {}
}
// 接口限流
if (req.limit) {
let storageKey = 'limit:' + req.url
let storage = uni.getStorageSync(storageKey)
if (storage && new Date().getTime() - parseInt(storage) < req.limit) {
return
}
uni.setStorageSync(storageKey, new Date().getTime())
}
//必须登录
if (req.auth) {
if (!uni.getStorageSync('token')) {
// uni.navigateTo({
// url: '/pages/login/mobile'
// })
console.error('需要登录')
return
}
}
http.http(req.url, data, callback, req.method,
loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
}
export default api