update
This commit is contained in:
@@ -17,37 +17,64 @@ function getUseType() {
|
||||
const type = uni.getStorageSync("useType")
|
||||
return type ? type : useType
|
||||
}
|
||||
// import {
|
||||
// webscoketUtill
|
||||
// } from '../websock.js'
|
||||
// let wxObj = null
|
||||
// wx初始化购物车
|
||||
// export function getWXCart(params) {
|
||||
// let wxUrl = 'ws://192.168.1.31:2348/?' + objectToString(params)
|
||||
// wxObj = new webscoketUtill(wxUrl,3000,9,(e)=>{
|
||||
// console.log('收到消息');
|
||||
// console.log(e);
|
||||
// })
|
||||
// return uni.getStorageSync('wxList')
|
||||
// }
|
||||
// 新增\删除\修改到购物车
|
||||
// export function addWXCart(params) {
|
||||
// wxObj.ws.send(params)
|
||||
// }
|
||||
|
||||
|
||||
function objectToString(obj) {
|
||||
let result = '';
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
result += `${key}=${obj[key]}&`;
|
||||
}
|
||||
}
|
||||
// 去掉最后一个多余的 &
|
||||
return result.slice(0, -1);
|
||||
}
|
||||
/**
|
||||
* 获取当前台桌订单信息
|
||||
* @returns
|
||||
*/
|
||||
export function getCart(params) {
|
||||
return request({
|
||||
url: `/api/place/cart`,
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...params
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/cart`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 已上架商品列表
|
||||
* @returns
|
||||
*/
|
||||
export function getGoodsLists(params,showLoading=true) {
|
||||
return request({
|
||||
url: `/api/place/activate`,
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...params
|
||||
},
|
||||
showLoading
|
||||
});
|
||||
export function getGoodsLists(params, showLoading = true) {
|
||||
return request({
|
||||
url: `/product/admin/product/list`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...params
|
||||
},
|
||||
showLoading
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,15 +82,15 @@ export function getGoodsLists(params,showLoading=true) {
|
||||
* @returns
|
||||
*/
|
||||
export function addCart(data) {
|
||||
return request({
|
||||
url: `/api/place/addCart`,
|
||||
method: "post",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/addCart`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,15 +98,15 @@ export function addCart(data) {
|
||||
* @returns
|
||||
*/
|
||||
export function $clearCart(data) {
|
||||
return request({
|
||||
url: `/api/place/clearCart`,
|
||||
method: "delete",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/clearCart`,
|
||||
method: "delete",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,87 +114,87 @@ export function $clearCart(data) {
|
||||
* @returns
|
||||
*/
|
||||
export function $removeCart(data) {
|
||||
return request({
|
||||
url: `/api/place/removeCart`,
|
||||
method: "delete",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/removeCart`,
|
||||
method: "delete",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 更新规格
|
||||
* @returns
|
||||
*/
|
||||
export function $updateCart(data) {
|
||||
return request({
|
||||
url: `/api/place/updateCart`,
|
||||
method: "put",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/updateCart`,
|
||||
method: "put",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 批量打包
|
||||
* @returns
|
||||
*/
|
||||
export function $allPack(data) {
|
||||
return request({
|
||||
url: `/api/place/pack`,
|
||||
method: "put",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/pack`,
|
||||
method: "put",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 获取取餐号
|
||||
* @returns
|
||||
*/
|
||||
export function $getMasterId(data) {
|
||||
return request({
|
||||
url: `/api/place/masterId`,
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/masterId`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 支付方式获取
|
||||
* @returns
|
||||
*/
|
||||
export function $getPayType(data) {
|
||||
return request({
|
||||
url: `/api/place/payType`,
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/account/admin/payType`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 创建订单
|
||||
* @returns
|
||||
*/
|
||||
export function $createOrder(data) {
|
||||
return request({
|
||||
url: `/api/place/order`,
|
||||
method: "post",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/order`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -176,15 +203,15 @@ export function $createOrder(data) {
|
||||
* @returns
|
||||
*/
|
||||
export function $cacheOrder(data) {
|
||||
return request({
|
||||
url: `/api/place/pending`,
|
||||
method: "post",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/pending`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,201 +219,201 @@ export function $cacheOrder(data) {
|
||||
* @returns
|
||||
*/
|
||||
export function $getCacheOrder(data) {
|
||||
return request({
|
||||
url: `/api/place/pending/cart`,
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/pending/cart`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 会员点单/取消会员点单
|
||||
export function $setUser(data) {
|
||||
return request({
|
||||
url: `/api/place/updateVip`,
|
||||
method: "put",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/updateVip`,
|
||||
method: "put",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
// 删除订单
|
||||
export function $delOrder(data) {
|
||||
return request({
|
||||
url: `/api/place/order`,
|
||||
method: "delete",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/place/order`,
|
||||
method: "delete",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
// 支付订单
|
||||
export function $payOrder(data) {
|
||||
return request({
|
||||
url: '/api/place/pay',
|
||||
method: "put",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/place/pay',
|
||||
method: "put",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
//退单
|
||||
|
||||
export function $returnCart(data) {
|
||||
return request({
|
||||
url: '/api/place/returnCart',
|
||||
method: "put",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/place/returnCart',
|
||||
method: "put",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
// 选择台桌
|
||||
export function $choseTable(data) {
|
||||
return request({
|
||||
url: '/api/place/choseTable',
|
||||
method: "put",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/place/choseTable',
|
||||
method: "put",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
// 用餐人数
|
||||
|
||||
export function $choseCount(data) {
|
||||
return request({
|
||||
url: '/api/place/choseCount',
|
||||
method: "put",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/place/choseCount',
|
||||
method: "put",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
useType: getUseType(),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 批量生成台桌
|
||||
export function $fastCreateTable(data) {
|
||||
return request({
|
||||
url: '/api/tbShopTable/generate',
|
||||
method: "post",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/tbShopTable/generate',
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//打印当前台桌订单
|
||||
export function $printOrder(data) {
|
||||
return request({
|
||||
url: '/api/place/printOrder',
|
||||
method: "post",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/place/printOrder',
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
//打印当前台桌菜品
|
||||
|
||||
export function $printDishes(data) {
|
||||
return request({
|
||||
url: '/api/place/printDishes',
|
||||
method: "post",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/place/printDishes',
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 就餐模式切换
|
||||
export function $changeUseType(data) {
|
||||
return request({
|
||||
url: '/api/place/choseModel',
|
||||
method: "put",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/place/choseModel',
|
||||
method: "put",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 退款
|
||||
export function $returnOrder(data) {
|
||||
return request({
|
||||
url: '/api/place/returnOrder',
|
||||
method: "post",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/place/returnOrder',
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取订单可用优惠券
|
||||
export function $activateByOrderId(data) {
|
||||
return request({
|
||||
url: '/api/tbShopCoupon/activateByOrderId',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/tbShopCoupon/activateByOrderId',
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//会员积分列表
|
||||
export function $returnMemberPointsList(data) {
|
||||
return request({
|
||||
url: '/api/points/member-points/page',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/points/member-points/page',
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 会员积分账户信息
|
||||
export function $returnMemberPoints(memberId) {
|
||||
return request({
|
||||
url: '/api/points/member-points/'+memberId,
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/points/member-points/' + memberId,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
//002-获取订单可用积分及抵扣金额(支付页面使用)
|
||||
export function $calcUsablePoints(data) {
|
||||
return request({
|
||||
url: '/api/points/member-points/calc-usable-points',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/points/member-points/calc-usable-points',
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
// 003-根据积分计算可抵扣金额
|
||||
export function $calcDeDuctionPoints(data) {
|
||||
return request({
|
||||
url: '/api/points/member-points/calc-deduction-amount',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: '/api/points/member-points/calc-deduction-amount',
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -33,13 +33,13 @@ export function tbPrintMachineGet(params) {
|
||||
}
|
||||
|
||||
// 打印机部分
|
||||
export function tbShopCategoryget(params) {
|
||||
return request({
|
||||
url: '/api/tbShopCategory',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// export function tbShopCategoryget(params) {
|
||||
// return request({
|
||||
// url: '/api/tbShopCategory',
|
||||
// method: 'get',
|
||||
// params
|
||||
// })
|
||||
// }
|
||||
// 修改打印机状态
|
||||
export function shopConfigprinter(data) {
|
||||
return request({
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import http from './http.js'
|
||||
import $API from '@/http/classApi.js'
|
||||
import appConfig from '@/config/appConfig.js'
|
||||
const request = http.request
|
||||
import {
|
||||
Base64
|
||||
} from 'js-base64'
|
||||
@@ -16,9 +17,47 @@ function objectToUrlParams(obj) {
|
||||
}
|
||||
return params.join('&');
|
||||
}
|
||||
|
||||
export function getHistoryOrder(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `/order/admin/order/historyOrder`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 清空某一次历史订单
|
||||
* @returns
|
||||
*/
|
||||
export function rmPlaceOrder(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `/${urlType}/admin/order/rmPlaceOrder`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/* 商品列表 */
|
||||
export function $tbProduct(data) {
|
||||
return http.req('/api/tbProduct', {...data,shopId:uni.getStorageSync('shopId')}, 'GET')
|
||||
export function $tbProduct(params) {
|
||||
return request({
|
||||
url: `/product/admin/product/list`,
|
||||
method: "get",
|
||||
params: {
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
// 商品详情
|
||||
export function adminProduct(params) {
|
||||
return request({
|
||||
url: `/product/admin/product/`+params,
|
||||
method: "get",
|
||||
params: {}
|
||||
});
|
||||
}
|
||||
|
||||
/* 添加商品 */
|
||||
@@ -56,7 +95,11 @@ export function $goodsIsHot(data) {
|
||||
* 商品分类列表
|
||||
*/
|
||||
export function $tbShopCategory(data) {
|
||||
return http.req('/api/tbShopCategory', {...data,shopId:uni.getStorageSync('shopId')}, 'GET')
|
||||
return request({
|
||||
url: `/product/admin/prod/category/list`,
|
||||
method: "get",
|
||||
params:data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 商品分类
|
||||
|
||||
@@ -15,28 +15,40 @@ import {
|
||||
} from '@/commons/utils/encryptUtil.js'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { reject } from 'lodash';
|
||||
import {
|
||||
reject
|
||||
} from 'lodash';
|
||||
// 测试服
|
||||
let baseUrl = 'https://admintestpapi.sxczgkj.cn'
|
||||
|
||||
// let baseUrl = 'http://192.168.1.31'
|
||||
// let baseUrl = 'https://admintestpapi.sxczgkj.cn'
|
||||
// const proxyApiwws = 'ws://192.168.1.31:2348' // 调试地址
|
||||
//预发布
|
||||
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||
|
||||
//正式
|
||||
// let baseUrl = 'https://cashieradmin.sxczgkj.cn'
|
||||
// let baseUrl = 'https://cashier.sxczgkj.com'
|
||||
|
||||
// 本地测
|
||||
let baseUrl = "http://192.168.1.31"
|
||||
// #ifdef H5
|
||||
baseUrl = '/ysk'
|
||||
// #endif
|
||||
|
||||
// 王伟本地测
|
||||
// let baseUrl = '/ww'
|
||||
// let baseUrl = 'http://192.168.1.15:8000'
|
||||
// 巩
|
||||
// let baseUrl = 'http://192.168.1.9:8000'
|
||||
// 巩
|
||||
// let baseUrl = 'http://192.168.1.9:8000'
|
||||
// 多少 ms 以内, 不提示loading
|
||||
const loadingShowTime = 200
|
||||
|
||||
|
||||
function getHeader(){
|
||||
const headerObject={}
|
||||
headerObject["Authorization"] = storageManage.token()
|
||||
function getHeader() {
|
||||
const headerObject = {}
|
||||
headerObject["token"] = uni.getStorageSync('tokenInfo').tokenValue
|
||||
headerObject["shopId"] = uni.getStorageSync("shopId"),
|
||||
// shopId:shopInfo.value.id
|
||||
headerObject["Content-Type"] = 'application/json;charset=UTF-8'
|
||||
headerObject["platformType"] ="PAD"
|
||||
return headerObject
|
||||
}
|
||||
|
||||
@@ -85,37 +97,20 @@ function commonsProcess(showLoading, httpReqCallback) {
|
||||
return Promise.reject(bodyData) // 跳转到catch函数
|
||||
}
|
||||
if (statusCode == 401) {
|
||||
// storageManage.token(null, true)
|
||||
// 提示信息
|
||||
|
||||
isShowErrorToast = true
|
||||
// infoBox.showErrorToast('请登录').then(() => {
|
||||
// go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH)
|
||||
// })
|
||||
|
||||
return Promise.reject(bodyData) // 跳转到catch函数
|
||||
}
|
||||
// http响应码不正确
|
||||
if (statusCode != 200 && statusCode != 204 && statusCode != 201) {
|
||||
isShowErrorToast = true
|
||||
data.message=data.message=='Bad credentials'?'用户名或密码错误':data.message
|
||||
data.message = data.message == 'Bad credentials' ? '用户名或密码错误' : data.message
|
||||
infoBox.showToast(data.message || '服务器异常')
|
||||
return Promise.reject(bodyData) // 跳转到catch函数
|
||||
}
|
||||
|
||||
// // 业务响应异常
|
||||
// if (bodyData.hasOwnProperty('code') && bodyData.code != 200) {
|
||||
// isShowErrorToast = true
|
||||
// infoBox.showToast(bodyData.msg)
|
||||
// if (bodyData.code == 5005) { // 密码已过期, 直接跳转到更改密码页面
|
||||
// uni.reLaunch({
|
||||
// url: '/pageUser/setting/updatePwd'
|
||||
// })
|
||||
// }
|
||||
// // if(bodyData.code == 500){ // 密码已过期, 直接跳转到更改密码页面
|
||||
// // uni.redirectTo({url: '/pages/login/index'})
|
||||
// // }
|
||||
// return bodyData
|
||||
// // return Promise.reject(bodyData)
|
||||
// }
|
||||
|
||||
|
||||
// 加密数据
|
||||
if (!bodyData.data && bodyData.encryptData) {
|
||||
@@ -130,26 +125,20 @@ function commonsProcess(showLoading, httpReqCallback) {
|
||||
return Promise.resolve(bodyData)
|
||||
|
||||
}).catch(res => {
|
||||
if(res.status==401){
|
||||
if (res.status == 401) {
|
||||
storageManage.token(null, true)
|
||||
infoBox.showErrorToast(res.message||'请登录').then(() => {
|
||||
uni.redirectTo({url: '/pages/login/index'})
|
||||
infoBox.showErrorToast(res.message || '请登录').then(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/index'
|
||||
})
|
||||
reject()
|
||||
})
|
||||
}
|
||||
// if(res.status==400){
|
||||
// storageManage.token(null, true)
|
||||
// infoBox.showErrorToast('').then(() => {
|
||||
// go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH)
|
||||
// })
|
||||
// }
|
||||
if(res.status==500){
|
||||
infoBox.showErrorToast(res.message||'服务器异常').then(() => {
|
||||
})
|
||||
|
||||
if (res.status == 500) {
|
||||
infoBox.showErrorToast(res.message || '服务器异常').then(() => {})
|
||||
}
|
||||
// if(res&&res.msg){
|
||||
// infoBox.showErrorToast(res.msg)
|
||||
// }
|
||||
|
||||
reqFinishFunc(); // 请求完毕的动作
|
||||
|
||||
// 如果没有提示错误, 那么此处提示 异常。
|
||||
@@ -168,7 +157,6 @@ function commonsProcess(showLoading, httpReqCallback) {
|
||||
|
||||
// 默认 显示loading(控制 xxs 内 不提示loading )
|
||||
function req(uri, data, method = "GET", showLoading = true, extParams = {}) {
|
||||
// headerObject[appConfig.tokenKey] = storageManage.token()
|
||||
return commonsProcess(showLoading, () => {
|
||||
return uni.request(
|
||||
Object.assign({
|
||||
@@ -193,14 +181,15 @@ function request(args) {
|
||||
extParams = {}
|
||||
} = args
|
||||
let headerObject = {}
|
||||
// headerObject[appConfig.tokenKey] = storageManage.token()
|
||||
return commonsProcess(showLoading, () => {
|
||||
// console.log('baseUrl+');
|
||||
// console.log(baseUrl + url);
|
||||
return uni.request(
|
||||
Object.assign({
|
||||
url: baseUrl + url,
|
||||
data: params||data,
|
||||
data: params || data,
|
||||
method: method,
|
||||
header: getHeader()
|
||||
header: getHeader()
|
||||
}, extParams)
|
||||
)
|
||||
})
|
||||
@@ -212,7 +201,6 @@ function request(args) {
|
||||
function upload(uri, data, file, showLoading = true, extParams = {}) {
|
||||
// 放置token
|
||||
let headerObject = {}
|
||||
// headerObject[appConfig.tokenKey] = storageManage.token()
|
||||
|
||||
return commonsProcess(showLoading, () => {
|
||||
return uni.uploadFile(
|
||||
@@ -220,14 +208,14 @@ function upload(uri, data, file, showLoading = true, extParams = {}) {
|
||||
url: baseUrl + uri,
|
||||
formData: data,
|
||||
name: "file",
|
||||
filePath: file.path||file.url,
|
||||
header: getHeader()
|
||||
filePath: file.path || file.url,
|
||||
header: getHeader()
|
||||
}, extParams)
|
||||
).then((httpData) => {
|
||||
// uni.upload 返回bodyData 的是 string类型。 需要解析。
|
||||
httpData.data = JSON.parse(httpData.data)
|
||||
return Promise.resolve(httpData)
|
||||
}).catch(err=>{
|
||||
}).catch(err => {
|
||||
uni.hideLoading()
|
||||
infoBox.showErrorToast(`上传失败`)
|
||||
})
|
||||
|
||||
@@ -3,7 +3,7 @@ const request=http.request
|
||||
|
||||
export function login(data) {
|
||||
return request({
|
||||
url: "/auth/login",
|
||||
url: "/account/admin/auth/login",
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
@@ -18,7 +18,7 @@ export function getInfo() {
|
||||
|
||||
export function getCodeImg(header) {
|
||||
return request({
|
||||
url: "/auth/code",
|
||||
url: "/account/admin/auth/captcha",
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ const request = http.request
|
||||
*/
|
||||
export function tbOrderInfoData(data) {
|
||||
return request({
|
||||
url: "/api/tbOrderInfo/date",
|
||||
method: "post",
|
||||
url: "/order/admin/order",
|
||||
method: "get",
|
||||
data: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...data
|
||||
@@ -33,7 +33,15 @@ export function tbOrderInfoDownload(data) {
|
||||
responseType: "blob"
|
||||
});
|
||||
}
|
||||
|
||||
export function createOrder(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `/${urlType}/admin/order/createOrder`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 通过Id查询订单
|
||||
* @param {*} id
|
||||
|
||||
@@ -13,15 +13,28 @@ export function $layout(params) {
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 清空历史订单
|
||||
* @returns
|
||||
*/
|
||||
export function cancelOrder(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `/${urlType}/admin/order/cancelOrder`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Pad点餐列表
|
||||
export function $layoutpage(params) {
|
||||
return request({
|
||||
url: '/api/pad/productCategory/page',
|
||||
url: '/account/admin/padProd',
|
||||
method: "get",
|
||||
params:{
|
||||
userId: uni.getStorageSync("shopUserId"),
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
// userId: uni.getStorageSync("shopUserId"),
|
||||
// shopId: uni.getStorageSync("shopId"),
|
||||
...params
|
||||
}
|
||||
});
|
||||
@@ -30,11 +43,11 @@ export function $layoutpage(params) {
|
||||
|
||||
export function $productCategory(id) {
|
||||
return request({
|
||||
url: '/api/pad/productCategory/'+id,
|
||||
url: '/account/admin/padProd/detail?id='+id,
|
||||
method: "get",
|
||||
params:{
|
||||
userId: uni.getStorageSync("shopUserId"),
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
// userId: uni.getStorageSync("shopUserId"),
|
||||
// shopId: uni.getStorageSync("shopId"),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import http from './http.js'
|
||||
import http from '@/http/http.js'
|
||||
const request=http.request
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ const request=http.request
|
||||
*/
|
||||
export function getShopList(params) {
|
||||
return request({
|
||||
url: `/api/tbShopInfo`,
|
||||
url: `/account/admin/shopUser`,
|
||||
method: 'get',
|
||||
params: {
|
||||
|
||||
@@ -20,15 +20,15 @@ export function getShopList(params) {
|
||||
* 获取店铺数据
|
||||
* @returns
|
||||
*/
|
||||
export function getShopInfo(params) {
|
||||
return request({
|
||||
url: `/api/tbShopInfo/${params}`,
|
||||
method: 'get',
|
||||
params: {
|
||||
// export function getShopInfo(params) {
|
||||
// return request({
|
||||
// url: `/account/admin/shopUser/detail/${params}`,
|
||||
// method: 'get',
|
||||
// params: {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
/**
|
||||
* 更改店铺信息
|
||||
@@ -189,13 +189,13 @@ export function tbShopCurrencyGet(params) {
|
||||
* 商品分类列表
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopCategoryGet(params) {
|
||||
return request({
|
||||
url: `/api/tbShopCategory`,
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
// export function categorylist(params) {
|
||||
// return request({
|
||||
// url: `/admin/prod/category/list`,
|
||||
// method: "get",
|
||||
// params
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* 新增、编辑分类/新增、编辑子分类
|
||||
|
||||
@@ -9,9 +9,9 @@ import {
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
|
||||
/* 台桌区域 */
|
||||
export const $tableArea = new $API('/api/tbShopArea', http.req)
|
||||
export const $tableArea = new $API('/account/admin/shopArea', http.req)
|
||||
/* 台桌 */
|
||||
export const $table = new $API('/api/tbShopTable', http.req)
|
||||
export const $table = new $API('/account/admin/shopTable', http.req)
|
||||
/* 绑定 */
|
||||
// export const $bind=new $API('/api/tbShopTable/bind',http.req)
|
||||
export function $bind(data) {
|
||||
@@ -27,7 +27,7 @@ export function $bind(data) {
|
||||
//获取台桌详情状态
|
||||
export function $returnTableDetail(data) {
|
||||
return request({
|
||||
url: '/api/tbShopTable/state',
|
||||
url: '/account/admin/shopTable/detail',
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
|
||||
@@ -7,7 +7,7 @@ const request=http.request
|
||||
export function tbShopInfo(shopId) {
|
||||
const _shopId=uni.getStorageSync('shopId')
|
||||
return request({
|
||||
url: `/api/tbShopInfo/${shopId||_shopId}`,
|
||||
url: `/account/admin/shopUser/detail?id=${shopId||_shopId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -22,4 +22,21 @@ export function tbShopInfoPut(data) {
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取店铺商品信息
|
||||
export function getShopInfo(data) {
|
||||
return request({
|
||||
url: `/account/admin/shopInfo/detail`,
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 获取布局
|
||||
export function getLayout(data) {
|
||||
return request({
|
||||
url: `/account/admin/padProd/layout`,
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user