增加扫码验券接口

This commit is contained in:
YeMingfei666 2024-11-29 14:12:32 +08:00
parent fe0eafbbb3
commit 8baaf8ff94
2 changed files with 300 additions and 0 deletions

199
src/api/coup/index.js Normal file
View File

@ -0,0 +1,199 @@
// 代客下单
import request from "@/utils/request-php";
// 抖音团购核销准备
export function $douyin_fulfilmentcertificateprepare(data) {
return request({
url: 'douyin/fulfilmentcertificateprepare',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音团购核销
export function $douyin_certificateprepare(data) {
return request({
url: 'douyin/certificateprepare',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音团购核销撤销
export function $douyin_fulfilmentcertificatecancel(data) {
return request({
url: 'douyin/fulfilmentcertificatecancel',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音团购核销记录
export function $douyin_orderlist(data) {
return request({
url: 'douyin/orderlist',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音门店列表
export function $douyin_storelist(data) {
return request({
url: 'douyin/storelist',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音绑定门店
export function $douyin_bindstore(data) {
return request({
url: 'douyin/bindstore',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音订单查询
export function $douyin_orderquery(data) {
return request({
url: 'douyin/orderquery',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
//会员签入
export function $douyin_checkIn(data) {
return request({
url: 'douyin/checkIn',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
//美团
// 美团获取uisdk 绑定 链接
export function $meituan_getuisdkurl(data) {
return request({
url: 'meituan/getuisdkurl',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团获取uisdk 解绑 链接
export function $meituan_getuisdkuniurl(data) {
return request({
url: 'meituan/getuisdkuniurl',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团团购核销准备
export function $meituan_fulfilmentcertificateprepare(data) {
return request({
url: 'meituan/fulfilmentcertificateprepare',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团执行核销
export function $meituan_certificateprepare(data) {
return request({
url: 'meituan/certificateprepare',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团团购核销记录
export function $meituan_orderlist(data) {
return request({
url: 'meituan/orderlist',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团团购撤销
export function $meituan_fulfilmentcertificatecancel(data) {
return request({
url: 'meituan/fulfilmentcertificatecancel',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团查询绑定状态
export function $meituan_searchstorestatus(data) {
return request({
url: 'meituan/searchstorestatus',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 登出
export function $logout(data) {
return request({
url: 'user/logout',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}

101
src/utils/request-php.js Normal file
View File

@ -0,0 +1,101 @@
import axios from 'axios'
import router from '@/router/routers'
import { Notification } from 'element-ui'
import store from '../store'
import { getToken } from '@/utils/auth'
import Config from '@/settings'
import Cookies from 'js-cookie'
import { setToken } from '@/utils/globalCancelToken.js'
// 创建axios实例
const service = axios.create({
// baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/',
baseURL: 'https://czgdoumei.sxczgkj.com/index.php/api/', // api 的 base_url
timeout: Config.timeout // 请求超时时间
})
// request拦截器
service.interceptors.request.use(
config => {
if (getToken()) {
config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
config.headers['Content-Type'] = 'application/json'
// 添加可取消请求配置
config.cancelToken = new axios.CancelToken(c => setToken(c))
return config
},
error => {
Promise.reject(error)
}
)
// response 拦截器
service.interceptors.response.use(
response => {
return response.data
},
error => {
console.log(error);
if (axios.isCancel(error)) {
console.log('请求已取消')
Notification.error({
title: '请求已取消',
duration: 5000
})
return Promise.reject('请求已取消')
}
// 兼容blob下载出错json提示
if (error.response.data instanceof Blob && error.response.data.type.toLowerCase().indexOf('json') !== -1) {
const reader = new FileReader()
reader.readAsText(error.response.data, 'utf-8')
reader.onload = function (e) {
const errorMsg = JSON.parse(reader.result).message
Notification.error({
title: errorMsg,
duration: 5000
})
}
} else {
let code = 0
try {
code = error.response.data.status
} catch (e) {
if (error.toString().indexOf('Error: timeout') !== -1) {
Notification.error({
title: '网络请求超时',
duration: 5000
})
return Promise.reject(error)
}
}
console.log(code)
if (code) {
if (code === 401) {
store.dispatch('LogOut').then(() => {
// 用户登录界面提示
Cookies.set('point', 401)
location.reload()
})
} else if (code === 403) {
router.push({ path: '/401' })
} else {
const errorMsg = error.response.data.message
if (errorMsg !== undefined) {
Notification.error({
title: errorMsg,
duration: 5000
})
}
}
} else {
Notification.error({
title: '接口请求失败',
duration: 5000
})
}
}
return Promise.reject(error)
}
)
export default service