2023-12-07 19:05:27 +08:00
|
|
|
|
|
|
|
import axios from "axios";
|
2023-12-08 18:51:02 +08:00
|
|
|
import { ElMessage } from 'element-plus'
|
2023-12-11 18:35:55 +08:00
|
|
|
import router from "./router";
|
|
|
|
|
|
|
|
let expire = localStorage.getItem("TRADE_USER") ? JSON.parse(localStorage.getItem("TRADE_USER")).expire : {}
|
|
|
|
|
|
|
|
|
2023-12-07 19:05:27 +08:00
|
|
|
// 创建axios 实例
|
|
|
|
const instacne = axios.create({
|
2024-06-18 19:05:36 +08:00
|
|
|
baseURL: "http://192.168.1.22:8545",
|
|
|
|
// baseURL: "https://shop.lihaink.cn/",
|
2023-12-07 19:05:27 +08:00
|
|
|
timeout: 30000,
|
|
|
|
});
|
|
|
|
|
|
|
|
// 请求拦截
|
|
|
|
instacne.interceptors.request.use(
|
|
|
|
(config) => {
|
|
|
|
// 在发送请求之前做什么
|
2023-12-11 18:35:55 +08:00
|
|
|
let timestamp = Math.floor(new Date().getTime() / 1000);
|
|
|
|
|
|
|
|
if (expire) {
|
|
|
|
|
|
|
|
if (timestamp > expire) {
|
|
|
|
ElMessage({
|
|
|
|
message: "登录过期,请重新登录",
|
|
|
|
type: 'warning',
|
|
|
|
})
|
|
|
|
|
|
|
|
localStorage.removeItem('TRADE_USER')
|
|
|
|
router.replace('/login')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-12-07 19:05:27 +08:00
|
|
|
|
|
|
|
return config;
|
|
|
|
},
|
|
|
|
(err) => {
|
|
|
|
return Promise.reject(err);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// 响应拦截
|
|
|
|
instacne.interceptors.response.use(
|
|
|
|
(res) => {
|
2023-12-08 18:51:02 +08:00
|
|
|
|
2024-06-18 19:05:36 +08:00
|
|
|
if (res.data.code != 1) {
|
2023-12-08 18:51:02 +08:00
|
|
|
ElMessage({
|
|
|
|
message: res.data.message,
|
|
|
|
type: 'warning',
|
|
|
|
})
|
|
|
|
return Promise.reject(res.data.message);
|
|
|
|
|
|
|
|
}
|
2023-12-07 19:05:27 +08:00
|
|
|
// 对响应的数据做什么
|
|
|
|
return res.data;
|
|
|
|
},
|
|
|
|
(err) => {
|
|
|
|
return Promise.reject(err);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getUserNumApi(params) {
|
2024-06-18 19:05:36 +08:00
|
|
|
return instacne.get('/statistics/user', { params })
|
2023-12-07 19:05:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function getOrderNumApi(params) {
|
|
|
|
return instacne.get('/api/dataview/order_statistics', { params })
|
|
|
|
}
|
|
|
|
export function getSalesRankApi(params) {
|
2024-06-18 19:05:36 +08:00
|
|
|
return instacne.get('/statistics/sales_ranking', { params })
|
2023-12-07 19:05:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function getTodayOrderAmountApi(params) {
|
|
|
|
return instacne.get('/api/dataview/curr_day_order_amount', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function getProductCountApi(params) {
|
2024-06-18 19:05:36 +08:00
|
|
|
return instacne.get('/statistics/product_count', { params })
|
2023-12-07 19:05:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getViewCountApi(params) {
|
2024-06-18 19:05:36 +08:00
|
|
|
return instacne.get('/statistics/index', { params })
|
2023-12-07 19:05:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getUserTradeCountApi(params) {
|
2024-06-18 19:05:36 +08:00
|
|
|
return instacne.get('/statistics/user_trade_count', { params })
|
2023-12-07 19:05:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getProductCategoryListApi(params) {
|
|
|
|
return instacne.get('/api/dataview/product_category_list', { params })
|
|
|
|
}
|
2023-12-08 00:06:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
export function getProductListApi(params) {
|
|
|
|
return instacne.get('/api/dataview/product_list', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
export function merchant_listApi(params) {
|
|
|
|
return instacne.get('/api/dataview/merchant_list', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
export function order_listApi(params) {
|
|
|
|
return instacne.get('/api/dataview/order_list', { params })
|
|
|
|
}
|
|
|
|
export function order_list_count_titleApi(params) {
|
|
|
|
return instacne.get('/api/dataview/order_list_count_title', { params })
|
|
|
|
}
|
|
|
|
export function refund_order_listApi(params) {
|
|
|
|
return instacne.get('/api/dataview/refund_order_list', { params })
|
|
|
|
}
|
|
|
|
export function take_order_listApi(params) {
|
|
|
|
return instacne.get('/api/dataview/take_order_list', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function take_order_count_titleApi(params) {
|
|
|
|
return instacne.get('/api/dataview/take_order_count_title', { params })
|
|
|
|
}
|
2023-12-07 19:05:27 +08:00
|
|
|
|
2023-12-08 18:51:02 +08:00
|
|
|
|
|
|
|
export function financial_record_titleApi(params) {
|
|
|
|
return instacne.get('/api/dataview/financial_record_title', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function financial_recordApi(params) {
|
|
|
|
return instacne.get('/api/dataview/financial_record', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
export function product_status_filterApi(params) {
|
|
|
|
return instacne.get('/api/dataview/product_status_filter', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function financial_record_detailApi(params) {
|
|
|
|
return instacne.get('/api/dataview/financial_record_detail/1', { params })
|
|
|
|
}
|
|
|
|
export function financial_record_detailApi2(params) {
|
|
|
|
return instacne.get('/api/dataview/financial_record_detail/2', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function bill_listApi(params) {
|
|
|
|
return instacne.get('/api/dataview/bill_list', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
export function withdraw_listApi(params) {
|
|
|
|
return instacne.get('/api/dataview/withdraw_list', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
export function street_currday_order_countApi(params) {
|
2024-06-18 19:05:36 +08:00
|
|
|
return instacne.get('/statistics/street_currday_order_count', { params })
|
2023-12-08 18:51:02 +08:00
|
|
|
}
|
|
|
|
export function loginApi(params) {
|
|
|
|
return instacne.post('/api/dataview/login', params)
|
|
|
|
}
|
2023-12-11 18:35:55 +08:00
|
|
|
|
|
|
|
|
|
|
|
export function storeLoginApi(params) {
|
|
|
|
return instacne.post('/api/dataview/mechant_login', params)
|
|
|
|
}
|
|
|
|
|
|
|
|
export function merchant_count_mainApi(params) {
|
|
|
|
return instacne.get('/api/dataview/merchant_count_main', { params })
|
|
|
|
}
|
|
|
|
export function order_user_num_countApi(params) {
|
2024-06-18 19:05:36 +08:00
|
|
|
return instacne.get('/statistics/order_user_num_count', { params })
|
2023-12-11 18:35:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function merchant_product_rankingApi(params) {
|
|
|
|
return instacne.get('/api/dataview/merchant_product_ranking', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function merchant_product_visitApi(params) {
|
|
|
|
return instacne.get('/api/dataview/merchant_product_visit', { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function merchant_product_cartApi(params) {
|
|
|
|
return instacne.get('/api/dataview/merchant_product_cart', { params })
|
|
|
|
}
|
2023-12-18 18:49:23 +08:00
|
|
|
|
|
|
|
export function merchantApi(params) {
|
|
|
|
return instacne.get('/api/dataview/merchant', { params })
|
|
|
|
}
|
|
|
|
|
2023-12-08 18:51:02 +08:00
|
|
|
//
|
2023-12-18 18:49:23 +08:00
|
|
|
//api/dataview/merchant?mer_id=36&areaCode=510524&streetCode=510524100
|
2023-12-08 18:51:02 +08:00
|
|
|
// }
|