This commit is contained in:
2024-09-10 10:49:08 +08:00
parent b5fd06b800
commit dd4f5938da
6391 changed files with 722800 additions and 0 deletions

46
http/businessHttp.js Normal file
View File

@@ -0,0 +1,46 @@
/**
* 因为两个小程序接口不一致餐饮商超商家端的接口使用该http
*/
import useStorage from '@/commons/utils/useStroage.js'
// const baseURL = 'http://192.168.2.128:9000/cashierService'
// const baseURL = 'http://192.168.2.41:9888/cashierService'
let baseURL = 'https://wxcashiertest.sxczgkj.cn/cashierService'
// #ifdef H5
baseURL = '/shopApi'
// #endif
// const baseURL = 'https://cashier.sxczgkj.cn/cashierService'
export default function(api = '', data = {}, method = 'GET') {
return new Promise((resolve, reject) => {
uni.request({
url: `${baseURL}${api}`,
method: method,
data: data,
header: {
'environment': 'wx',
'type': 'ios',
'version': '1.0.0',
'token': useStorage.get('token'),
'Content-Type': 'application/json'
},
success: res => {
if (res.data.code == 0) {
resolve(res.data)
} else {
uni.showToast({
icon: 'none',
"title": res.data.msg
})
reject(res.data.msg)
}
},
fail: err => {
uni.showToast({
icon: 'none',
"title": err.errMsg
})
reject(err)
}
})
})
}