This commit is contained in:
2025-04-02 10:35:17 +08:00
commit 89db955ec1
701 changed files with 91082 additions and 0 deletions

52
http/businessHttp.js Normal file
View File

@@ -0,0 +1,52 @@
/**
* 因为两个小程序接口不一致餐饮商超商家端的接口使用该http
*/
import useStorage from '@/commons/utils/useStroage.js'
import go from '@/commons/utils/go.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 = '/ysk'
// #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('iToken'),
'Authorization': useStorage.get('iToken'),
'Content-Type': 'application/json'
},
success: res => {
if (res.data.code == 0) {
resolve(res.data)
} else {
uni.showToast({
icon: 'none',
"title": res.data.msg
})
if(res.data.code==-4){
setTimeout(()=>{
go.to('PAGES_LOGIN', {}, 'redirect')
},2000)
}
reject(res.data.msg)
}
},
fail: err => {
uni.showToast({
icon: 'none',
"title": err.errMsg
})
reject(err)
}
})
})
}