feat: 增加数据统计,销量统计,桌台统计
This commit is contained in:
@@ -1,13 +1,7 @@
|
|||||||
// 代客下单
|
// 代客下单
|
||||||
import request from "@/utils/request-php";
|
import request from "@/utils/request-php";
|
||||||
import { getToken } from "@/utils/auth";
|
import { getDouyinToken, getToken } from "@/utils/auth";
|
||||||
import { useUserStore } from "@/store";
|
|
||||||
|
|
||||||
const userStore = useUserStore();
|
|
||||||
|
|
||||||
function getLoginName() {
|
|
||||||
return userStore.userInfo.phone;
|
|
||||||
}
|
|
||||||
// 抖音团购核销准备
|
// 抖音团购核销准备
|
||||||
export function $douyin_fulfilmentcertificateprepare(data) {
|
export function $douyin_fulfilmentcertificateprepare(data) {
|
||||||
return request({
|
return request({
|
||||||
@@ -90,7 +84,7 @@ export function $douyin_checkIn(data) {
|
|||||||
data: {
|
data: {
|
||||||
clientType: "ADMIN",
|
clientType: "ADMIN",
|
||||||
token: getToken(),
|
token: getToken(),
|
||||||
loginName: getLoginName(),
|
loginName: localStorage.getItem("userInfo").phone,
|
||||||
...data,
|
...data,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
41
src/api/order/data-summary.ts
Normal file
41
src/api/order/data-summary.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
import { Order_BaseUrl } from "@/api/config";
|
||||||
|
const baseURL = Order_BaseUrl + "/admin/data/summary";
|
||||||
|
// 数据统计
|
||||||
|
const Api = {
|
||||||
|
// 营业板块-上半部分
|
||||||
|
trade(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/trade`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 商品销售 右下
|
||||||
|
productSaleDate(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/productSaleDate`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 销售趋势柱状图 左下
|
||||||
|
dateAmount(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/dateAmount`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 支付占比饼图 左下
|
||||||
|
datePayType(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/datePayType`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Api;
|
||||||
|
|
||||||
33
src/api/order/sale-summary.ts
Normal file
33
src/api/order/sale-summary.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
import { Order_BaseUrl } from "@/api/config";
|
||||||
|
const baseURL = Order_BaseUrl + "/admin/sale/summary";
|
||||||
|
// 销量统计
|
||||||
|
const Api = {
|
||||||
|
// 统计
|
||||||
|
count(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/count`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 分页
|
||||||
|
page(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/page`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 导出
|
||||||
|
export(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/export`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Api;
|
||||||
|
|
||||||
25
src/api/order/table-summary.ts
Normal file
25
src/api/order/table-summary.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
import { Order_BaseUrl } from "@/api/config";
|
||||||
|
const baseURL = Order_BaseUrl + "/admin/table/summary";
|
||||||
|
// 台桌统计
|
||||||
|
const Api = {
|
||||||
|
// 统计
|
||||||
|
list(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/list`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 导出
|
||||||
|
export(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/export`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Api;
|
||||||
|
|
||||||
@@ -384,6 +384,16 @@ export const constantRoutes: RouteRecordRaw[] = [
|
|||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "invite",
|
||||||
|
component: () => import("@/views/application/marketing/invite.vue"),
|
||||||
|
name: "invite",
|
||||||
|
meta: {
|
||||||
|
title: "邀请裂变",
|
||||||
|
affix: false,
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "points",
|
path: "points",
|
||||||
component: () => import("@/views/application/marketing/points/index.vue"),
|
component: () => import("@/views/application/marketing/points/index.vue"),
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ export const useUserStore = defineStore("user", () => {
|
|||||||
const isShopAdmin = useStorage("isShopAdmin", false) // 0商户 1员工
|
const isShopAdmin = useStorage("isShopAdmin", false) // 0商户 1员工
|
||||||
const userInfo = useStorage<UserInfo>("userInfo", {} as UserInfo);
|
const userInfo = useStorage<UserInfo>("userInfo", {} as UserInfo);
|
||||||
const promissionList = useStorage<string[]>("promissionList", [] as string[]);
|
const promissionList = useStorage<string[]>("promissionList", [] as string[]);
|
||||||
|
//美团抖音核销店铺信息
|
||||||
|
const meituan_douyin_info = useStorage<any>("meituan_douyin_info", {});
|
||||||
|
|
||||||
|
|
||||||
localStorage.setItem("shopId", "" + userInfo.value.shopId);
|
localStorage.setItem("shopId", "" + userInfo.value.shopId);
|
||||||
if (userInfo.value.shopId) {
|
if (userInfo.value.shopId) {
|
||||||
@@ -28,11 +31,12 @@ export const useUserStore = defineStore("user", () => {
|
|||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
AuthAPI.login(loginRequest)
|
AuthAPI.login(loginRequest)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
|
||||||
isShopAdmin.value = data.loginType == 0 ? true : false;
|
isShopAdmin.value = data.loginType == 0 ? true : false;
|
||||||
Object.assign(userInfo.value, { ...data.shopInfo, shopId: data.shopInfo.id });
|
Object.assign(userInfo.value, { ...data.shopInfo, shopId: data.shopInfo.id });
|
||||||
promissionList.value = data.promissionList;
|
promissionList.value = data.promissionList;
|
||||||
const token = data.tokenInfo.tokenValue;
|
const token = data.tokenInfo.tokenValue;
|
||||||
setToken(token); // Bearer eyJhbGciOiJIUzI1NiJ9.xxx.xxx
|
setToken(token);
|
||||||
setRefreshToken(token);
|
setRefreshToken(token);
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
@@ -119,6 +123,7 @@ export const useUserStore = defineStore("user", () => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
isShopAdmin,
|
isShopAdmin,
|
||||||
|
meituan_douyin_info,
|
||||||
userInfo,
|
userInfo,
|
||||||
promissionList,
|
promissionList,
|
||||||
getUserInfo,
|
getUserInfo,
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
// 访问 token 缓存的 key
|
// 访问 token 缓存的 key
|
||||||
const ACCESS_TOKEN_KEY = "access_token";
|
const ACCESS_TOKEN_KEY = "access_token";
|
||||||
|
// 访问 抖音token 缓存的 key
|
||||||
|
const DOUYIN_ACCESS_TOKEN_KEY = "douyin_access_token";
|
||||||
// 刷新 token 缓存的 key
|
// 刷新 token 缓存的 key
|
||||||
const REFRESH_TOKEN_KEY = "refresh_token";
|
const REFRESH_TOKEN_KEY = "refresh_token";
|
||||||
|
|
||||||
|
//抖音 token
|
||||||
|
function getDouyinToken() {
|
||||||
|
return localStorage.getItem(DOUYIN_ACCESS_TOKEN_KEY) || "";
|
||||||
|
}
|
||||||
|
function setDouyinToken(token: string) {
|
||||||
|
return localStorage.setItem(DOUYIN_ACCESS_TOKEN_KEY, token);
|
||||||
|
}
|
||||||
function getToken(): string {
|
function getToken(): string {
|
||||||
return localStorage.getItem(ACCESS_TOKEN_KEY) || "";
|
return localStorage.getItem(ACCESS_TOKEN_KEY) || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function setToken(token: string) {
|
function setToken(token: string) {
|
||||||
localStorage.setItem(ACCESS_TOKEN_KEY, token);
|
localStorage.setItem(ACCESS_TOKEN_KEY, token);
|
||||||
}
|
}
|
||||||
@@ -24,4 +34,4 @@ function clearToken() {
|
|||||||
localStorage.removeItem(REFRESH_TOKEN_KEY);
|
localStorage.removeItem(REFRESH_TOKEN_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { getToken, setToken, clearToken, getRefreshToken, setRefreshToken };
|
export { getToken, setToken, clearToken, getRefreshToken, setRefreshToken, getDouyinToken, setDouyinToken };
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import { getToken } from "@/utils/auth";
|
import { getDouyinToken, getToken } from "@/utils/auth";
|
||||||
|
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
@@ -12,7 +12,7 @@ const service = axios.create({
|
|||||||
service.interceptors.request.use(
|
service.interceptors.request.use(
|
||||||
(config) => {
|
(config) => {
|
||||||
if (getToken()) {
|
if (getToken()) {
|
||||||
config.headers["bausertoken"] = getToken();
|
config.headers["bausertoken"] = getDouyinToken();
|
||||||
}
|
}
|
||||||
config.headers["Content-Type"] = "application/json";
|
config.headers["Content-Type"] = "application/json";
|
||||||
// 添加可取消请求配置
|
// 添加可取消请求配置
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const to = (item) => {
|
|||||||
const list = ref([
|
const list = ref([
|
||||||
{ name: "优惠券", icon: card, path: "coupon" },
|
{ name: "优惠券", icon: card, path: "coupon" },
|
||||||
{ name: "霸王餐", icon: charge, path: "bwc" },
|
{ name: "霸王餐", icon: charge, path: "bwc" },
|
||||||
{ name: "邀请裂变", icon: invite, path: "" },
|
{ name: "邀请裂变", icon: invite, path: "invite" },
|
||||||
{ name: "积分锁客", icon: score, path: "points" },
|
{ name: "积分锁客", icon: score, path: "points" },
|
||||||
]);
|
]);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
3
src/views/application/marketing/invite.vue
Normal file
3
src/views/application/marketing/invite.vue
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
<div>邀请</div>
|
||||||
|
</template>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,449 @@
|
|||||||
<template>
|
<template>
|
||||||
<div></div>
|
<div class="app-container">
|
||||||
</template>
|
<!-- <el-tabs v-model="orderType" @tab-click="getTableData">
|
||||||
|
<el-tab-pane label="收款" name="1"></el-tab-pane>
|
||||||
|
<el-tab-pane label="销量" name="2"></el-tab-pane>
|
||||||
|
</el-tabs> -->
|
||||||
|
<div class="head-container">
|
||||||
|
<el-form :model="query" inline label-position="left">
|
||||||
|
<template v-if="orderType == 2">
|
||||||
|
<el-form-item>
|
||||||
|
<el-input placeholder="商品名称" v-model="query.proName" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-select v-model="query.cateId" placeholder="商品分类" style="width: 140px">
|
||||||
|
<el-option
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
v-for="item in categorys"
|
||||||
|
:key="item.id"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio-group v-model="timeValue" @change="timeChange">
|
||||||
|
<el-radio-button label="">全部</el-radio-button>
|
||||||
|
<el-radio-button label="0">今天</el-radio-button>
|
||||||
|
<el-radio-button label="-1">昨天</el-radio-button>
|
||||||
|
<el-radio-button label="-7">最近7天</el-radio-button>
|
||||||
|
<el-radio-button label="-30">最近30天</el-radio-button>
|
||||||
|
<el-radio-button label="week">本周</el-radio-button>
|
||||||
|
<el-radio-button label="month">本月</el-radio-button>
|
||||||
|
<el-radio-button label="custom">自定义</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
<el-date-picker
|
||||||
|
v-model="query.createdAt"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
v-if="timeValue == 'custom'"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||||
|
<el-button @click="resetHandle">重置</el-button>
|
||||||
|
<el-button icon="el-icon-download" v-loading="downloadLoading" @click="downloadHandle">
|
||||||
|
<span v-if="!downloadLoading">导出Excel</span>
|
||||||
|
<span v-else>下载中...</span>
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<div class="head-container">
|
||||||
|
<div class="collect_wrap">
|
||||||
|
<div class="item" v-for="item in payCountList" :key="item.id">
|
||||||
|
<div class="icon_wrap" style="--bg-color: #c978ee">
|
||||||
|
<i class="icon" :class="item.icon"></i>
|
||||||
|
</div>
|
||||||
|
<div class="info">
|
||||||
|
<div class="m">
|
||||||
|
<template v-if="item.isAmount == 1">¥</template>
|
||||||
|
{{ item.payAmount }}
|
||||||
|
</div>
|
||||||
|
<div class="t">{{ item.payType }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="head-container">
|
||||||
|
<el-table :data="tableData.data" v-loading="tableData.loading" v-if="orderType == 1">
|
||||||
|
<el-table-column label="日期" prop="tradeDay"></el-table-column>
|
||||||
|
<el-table-column label="营业额" prop="total">
|
||||||
|
<template v-slot="scope">¥{{ scope.row.total }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="销售额" prop="total">
|
||||||
|
<template v-slot="scope">
|
||||||
|
¥{{ scope.row.total | totalfilter(scope.row.refund) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="微信小程序支付" prop="wxLite">
|
||||||
|
<template v-slot="scope">¥{{ scope.row.wxLite }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="扫码支付金额" prop="scanCode">
|
||||||
|
<template v-slot="scope">¥{{ scope.row.scanCode }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="现金支付金额" prop="cash">
|
||||||
|
<template v-slot="scope">¥{{ scope.row.cash }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="会员充值" prop="cash">
|
||||||
|
<template v-slot="scope">¥{{ scope.row.recharge }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="会员支付" prop="cash">
|
||||||
|
<template v-slot="scope">¥{{ scope.row.deposit }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<!-- <el-table-column label="充值金额" prop="cash">
|
||||||
|
<template v-slot="scope">
|
||||||
|
¥{{ scope.row.recharge }}
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
<el-table-column label="退款金额" prop="cash">
|
||||||
|
<template v-slot="scope">¥{{ scope.row.refund }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-table :data="tableData.data" v-loading="tableData.loading" v-if="orderType == 2">
|
||||||
|
<!-- <el-table-column label="商品分类" prop="cateName"></el-table-column>
|
||||||
|
<el-table-column label="商品描述" prop="productSkuName"></el-table-column>
|
||||||
|
<el-table-column label="单价" prop="price"></el-table-column> -->
|
||||||
|
<el-table-column label="商品名称" prop="name"></el-table-column>
|
||||||
|
<el-table-column label="销量" prop="salesNum"></el-table-column>
|
||||||
|
<el-table-column label="销售金额" prop="salesAmount">
|
||||||
|
<template v-slot="scope">¥{{ scope.row.salesAmount }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="退单量" prop="refNum"></el-table-column>
|
||||||
|
<el-table-column label="退款金额" prop="refAmount">
|
||||||
|
<template v-slot="scope">¥{{ scope.row.refAmount }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div class="head-container">
|
||||||
|
<el-pagination
|
||||||
|
:total="tableData.total"
|
||||||
|
:current-page="tableData.page + 1"
|
||||||
|
:page-size="tableData.size"
|
||||||
|
@current-change="paginationChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
></el-pagination>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import saleSummaryApi from "@/api/order/sale-summary";
|
||||||
|
import categoryApi from "@/api/product/productclassification";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { downloadFile } from "@/utils/index";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
timeValue: "",
|
||||||
|
resetQuery: null,
|
||||||
|
orderType: "2",
|
||||||
|
categorys: [],
|
||||||
|
query: {
|
||||||
|
createdAt: [],
|
||||||
|
proName: "",
|
||||||
|
cateId: "",
|
||||||
|
},
|
||||||
|
tableData: {
|
||||||
|
data: [],
|
||||||
|
page: 0,
|
||||||
|
size: 10,
|
||||||
|
loading: false,
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
downloadLoading: false,
|
||||||
|
payCountList: "",
|
||||||
|
payCountTotal: 0,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
timeFilter(time) {
|
||||||
|
return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
},
|
||||||
|
totalfilter(item, d) {
|
||||||
|
let num = item + d;
|
||||||
|
return num.toFixed(2);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.resetQuery = { ...this.query };
|
||||||
|
this.getTableData();
|
||||||
|
this.getCategory();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 获取商品分类
|
||||||
|
async getCategory() {
|
||||||
|
try {
|
||||||
|
const res = await categoryApi.getList({
|
||||||
|
page: 0,
|
||||||
|
size: 200,
|
||||||
|
orderBy: "name asc",
|
||||||
|
});
|
||||||
|
this.categorys = res;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取订单汇总
|
||||||
|
async daycount() {
|
||||||
|
try {
|
||||||
|
const res = await saleSummaryApi.count({
|
||||||
|
startTime: this.query.createdAt[0],
|
||||||
|
endTime: this.query.createdAt[1],
|
||||||
|
cateId: this.query.cateId,
|
||||||
|
proName: this.query.proName,
|
||||||
|
|
||||||
|
type: this.orderType,
|
||||||
|
});
|
||||||
|
this.payCountList = res;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 导出Excel
|
||||||
|
async downloadHandle() {
|
||||||
|
try {
|
||||||
|
this.downloadLoading = true;
|
||||||
|
const file = await daydownload({
|
||||||
|
type: this.orderType,
|
||||||
|
startTime: this.query.createdAt[0],
|
||||||
|
endTime: this.query.createdAt[1],
|
||||||
|
cateId: this.query.cateId,
|
||||||
|
proName: this.query.proName,
|
||||||
|
});
|
||||||
|
downloadFile(file, "数据", "xlsx");
|
||||||
|
this.downloadLoading = false;
|
||||||
|
} catch (error) {
|
||||||
|
this.downloadLoading = false;
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 重置查询
|
||||||
|
resetHandle() {
|
||||||
|
this.timeValue = "";
|
||||||
|
this.query = { ...this.resetQuery };
|
||||||
|
this.page = 0;
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
|
// 分页大小改变
|
||||||
|
sizeChange(e) {
|
||||||
|
this.tableData.size = e;
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
|
// 分页回调
|
||||||
|
paginationChange(e) {
|
||||||
|
this.tableData.page = e - 1;
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
|
async getTableData() {
|
||||||
|
this.tableData.loading = true;
|
||||||
|
try {
|
||||||
|
this.daycount();
|
||||||
|
const res = await saleSummaryApi.page({
|
||||||
|
page: this.tableData.page,
|
||||||
|
size: this.tableData.size,
|
||||||
|
type: this.orderType,
|
||||||
|
startTime: this.query.createdAt[0],
|
||||||
|
endTime: this.query.createdAt[1],
|
||||||
|
proName: this.query.proName,
|
||||||
|
cateId: this.query.cateId,
|
||||||
|
});
|
||||||
|
this.tableData.loading = false;
|
||||||
|
this.tableData.data = res.records;
|
||||||
|
this.tableData.total = res.totalRow;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 切换时间
|
||||||
|
timeChange(e) {
|
||||||
|
const format = ["YYYY-MM-DD 00:00:00", "YYYY-MM-DD 23:59:59"];
|
||||||
|
switch (e) {
|
||||||
|
case "":
|
||||||
|
// 全部
|
||||||
|
this.query.createdAt = [];
|
||||||
|
break;
|
||||||
|
case "0":
|
||||||
|
// 今天
|
||||||
|
this.query.createdAt = [dayjs().format(format[0]), dayjs().format(format[1])];
|
||||||
|
break;
|
||||||
|
case "-1":
|
||||||
|
// 昨天
|
||||||
|
this.query.createdAt = [
|
||||||
|
dayjs().add(-1, "d").format(format[0]),
|
||||||
|
dayjs().add(-1, "d").format(format[1]),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "-7":
|
||||||
|
// 最近7天
|
||||||
|
this.query.createdAt = [
|
||||||
|
dayjs().add(-7, "d").format(format[0]),
|
||||||
|
dayjs().format(format[1]),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "-30":
|
||||||
|
// 最近7天
|
||||||
|
this.query.createdAt = [
|
||||||
|
dayjs().add(-30, "d").format(format[0]),
|
||||||
|
dayjs().format(format[1]),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "week":
|
||||||
|
// 本周
|
||||||
|
this.query.createdAt = [
|
||||||
|
dayjs().startOf("week").format(format[0]),
|
||||||
|
dayjs().endOf("week").format(format[1]),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "month":
|
||||||
|
// 本周
|
||||||
|
this.query.createdAt = [
|
||||||
|
dayjs().startOf("month").format(format[0]),
|
||||||
|
dayjs().endOf("month").format(format[1]),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "custom":
|
||||||
|
// 自定义
|
||||||
|
this.query.createdAt = [];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.collect_wrap {
|
||||||
|
display: flex;
|
||||||
|
gap: 14px;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.item:nth-child(1) {
|
||||||
|
background-image: url(../../assets/images/home/data_forms4.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item:nth-child(2) {
|
||||||
|
background-image: url(../../assets/images/home/data_forms3.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item:nth-child(3) {
|
||||||
|
background-image: url(../../assets/images/home/data_forms2.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item:nth-child(4) {
|
||||||
|
background-image: url(../../assets/images/home/data_forms1.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
background-size: 100% 100%;
|
||||||
|
width: 255px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
.icon_wrap {
|
||||||
|
$size: 34px;
|
||||||
|
$border: 6px;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: var(--bg-color);
|
||||||
|
border-radius: 50%;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
width: $size + $border;
|
||||||
|
height: $size + $border;
|
||||||
|
border-radius: 50%;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
background-color: var(--bg-color);
|
||||||
|
opacity: 0.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 10px;
|
||||||
|
|
||||||
|
.m {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.t {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #999;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.refund {
|
||||||
|
color: #ff9731;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table_order_info {
|
||||||
|
.order_no {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type {
|
||||||
|
color: #e6a23c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods_info {
|
||||||
|
.row {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 10px;
|
||||||
|
|
||||||
|
.sku {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,3 +1,371 @@
|
|||||||
<template>
|
<template>
|
||||||
<div></div>
|
<div class="app-container">
|
||||||
</template>
|
<!-- <el-tabs v-model="orderType" @tab-click="getTableData">
|
||||||
|
<el-tab-pane label="收款" name="1"></el-tab-pane>
|
||||||
|
<el-tab-pane label="销量" name="2"></el-tab-pane>
|
||||||
|
</el-tabs> -->
|
||||||
|
<div class="head-container">
|
||||||
|
<el-form :model="query" inline label-position="left">
|
||||||
|
<el-radio-group v-model="timeValue" @change="timeChange">
|
||||||
|
<el-radio-button label="">全部</el-radio-button>
|
||||||
|
<el-radio-button label="0">今天</el-radio-button>
|
||||||
|
<el-radio-button label="-1">昨天</el-radio-button>
|
||||||
|
<el-radio-button label="-7">最近7天</el-radio-button>
|
||||||
|
<el-radio-button label="-30">最近30天</el-radio-button>
|
||||||
|
<el-radio-button label="week">本周</el-radio-button>
|
||||||
|
<el-radio-button label="month">本月</el-radio-button>
|
||||||
|
<el-radio-button label="custom">自定义</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
<el-date-picker
|
||||||
|
v-model="query.createdAt"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
></el-date-picker>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||||
|
<el-button @click="resetHandle">重置</el-button>
|
||||||
|
<el-button icon="el-icon-download" v-loading="downloadLoading" @click="downloadHandle">
|
||||||
|
<span v-if="!downloadLoading">导出Excel</span>
|
||||||
|
<span v-else>下载中...</span>
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="head-container">
|
||||||
|
<div class="collect_wrap">
|
||||||
|
<div class="item" v-for="item in payCountList" :key="item.id">
|
||||||
|
<div class="icon_wrap" style="--bg-color:#C978EE">
|
||||||
|
<i class="icon" :class="item.icon"></i>
|
||||||
|
</div>
|
||||||
|
<div class="info">
|
||||||
|
<div class="m">
|
||||||
|
<template v-if="item.isAmount == 1">¥</template>
|
||||||
|
{{ item.payAmount }}
|
||||||
|
</div>
|
||||||
|
<div class="t">{{ item.payType }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
<div class="head-container">
|
||||||
|
<el-table :data="tableData.data" v-loading="tableData.loading" v-if="orderType == 1">
|
||||||
|
<el-table-column type="index" width="50"></el-table-column>
|
||||||
|
<!-- <el-table-column label="序号" prop="id"></el-table-column> -->
|
||||||
|
<!-- <el-table-column label="区域id" prop="areaId"></el-table-column> -->
|
||||||
|
<el-table-column label="区域名称" prop="areaName"></el-table-column>
|
||||||
|
<!-- <el-table-column label="门店id" prop="shopId"></el-table-column> -->
|
||||||
|
<!-- <el-table-column label="台桌Id" prop="tableId"></el-table-column> -->
|
||||||
|
<el-table-column label="台桌号" prop="tableName"></el-table-column>
|
||||||
|
<el-table-column label="订单数量" prop="orderCount">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<div class="cursor-pointer" @click="toTableOrderList(scope.row)">
|
||||||
|
{{ scope.row.orderCount }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="订单金额" prop="orderAmount"></el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- <el-table :data="tableData.data" v-loading="tableData.loading" v-if="orderType == 2">
|
||||||
|
<el-table-column label="商品名称" prop="productName"></el-table-column>
|
||||||
|
<el-table-column label="商品分类" prop="cateName"></el-table-column>
|
||||||
|
<el-table-column label="商品描述" prop="productSkuName"></el-table-column>
|
||||||
|
<el-table-column label="销量" prop="salesNum"></el-table-column>
|
||||||
|
<el-table-column label="退单量" prop="refNum"></el-table-column>
|
||||||
|
<el-table-column label="销售金额" prop="salesAmount">
|
||||||
|
<template v-slot="scope">
|
||||||
|
¥{{ scope.row.salesAmount }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="退款金额" prop="refAmount">
|
||||||
|
<template v-slot="scope">
|
||||||
|
¥{{ scope.row.refAmount }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table> -->
|
||||||
|
</div>
|
||||||
|
<!-- <div class="head-container">
|
||||||
|
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||||
|
@current-change="paginationChange" @size-change="sizeChange"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import tableSummaryApi from "@/api/order/table-summary";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { downloadFile } from "@/utils/index";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
timeValue: "",
|
||||||
|
resetQuery: null,
|
||||||
|
orderType: "1",
|
||||||
|
categorys: [],
|
||||||
|
query: {
|
||||||
|
createdAt: [],
|
||||||
|
proName: "",
|
||||||
|
cateId: "",
|
||||||
|
},
|
||||||
|
tableData: {
|
||||||
|
data: [],
|
||||||
|
page: 0,
|
||||||
|
size: 10,
|
||||||
|
loading: false,
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
downloadLoading: false,
|
||||||
|
payCountList: "",
|
||||||
|
payCountTotal: 0,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
timeFilter(time) {
|
||||||
|
return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.resetQuery = { ...this.query };
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
//携带table id跳转到订单列表页面
|
||||||
|
toTableOrderList(data) {
|
||||||
|
// console.log(data)
|
||||||
|
this.$router.push({
|
||||||
|
path: "/order_manage/order_list",
|
||||||
|
query: {
|
||||||
|
tableName: data.tableName,
|
||||||
|
timeValue: this.timeValue,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 导出Excel
|
||||||
|
async downloadHandle() {
|
||||||
|
try {
|
||||||
|
this.downloadLoading = true;
|
||||||
|
const file = await tableSummaryApi.export({
|
||||||
|
startTime: this.query.createdAt[0],
|
||||||
|
endTime: this.query.createdAt[1],
|
||||||
|
});
|
||||||
|
downloadFile(file, "数据", "xlsx");
|
||||||
|
this.downloadLoading = false;
|
||||||
|
} catch (error) {
|
||||||
|
this.downloadLoading = false;
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 重置查询
|
||||||
|
resetHandle() {
|
||||||
|
this.timeValue = "";
|
||||||
|
this.query = { ...this.resetQuery };
|
||||||
|
this.page = 0;
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
|
// 分页大小改变
|
||||||
|
sizeChange(e) {
|
||||||
|
this.tableData.size = e;
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
|
// 分页回调
|
||||||
|
paginationChange(e) {
|
||||||
|
this.tableData.page = e - 1;
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
|
async getTableData() {
|
||||||
|
this.tableData.loading = true;
|
||||||
|
try {
|
||||||
|
const res = await tableSummaryApi.list({
|
||||||
|
page: this.tableData.page + 1,
|
||||||
|
size: this.tableData.size,
|
||||||
|
startTime: this.query.createdAt[0],
|
||||||
|
endTime: this.query.createdAt[1],
|
||||||
|
});
|
||||||
|
this.tableData.loading = false;
|
||||||
|
this.tableData.data = res;
|
||||||
|
this.tableData.total = res.length;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 切换时间
|
||||||
|
timeChange(e) {
|
||||||
|
const format = ["YYYY-MM-DD 00:00:00", "YYYY-MM-DD 23:59:59"];
|
||||||
|
switch (e) {
|
||||||
|
case "":
|
||||||
|
// 全部
|
||||||
|
this.query.createdAt = [];
|
||||||
|
break;
|
||||||
|
case "0":
|
||||||
|
// 今天
|
||||||
|
this.query.createdAt = [dayjs().format(format[0]), dayjs().format(format[1])];
|
||||||
|
break;
|
||||||
|
case "-1":
|
||||||
|
// 昨天
|
||||||
|
this.query.createdAt = [
|
||||||
|
dayjs().add(-1, "d").format(format[0]),
|
||||||
|
dayjs().add(-1, "d").format(format[1]),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "-7":
|
||||||
|
// 最近7天
|
||||||
|
this.query.createdAt = [
|
||||||
|
dayjs().add(-7, "d").format(format[0]),
|
||||||
|
dayjs().format(format[1]),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "-30":
|
||||||
|
// 最近7天
|
||||||
|
this.query.createdAt = [
|
||||||
|
dayjs().add(-30, "d").format(format[0]),
|
||||||
|
dayjs().format(format[1]),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "week":
|
||||||
|
// 本周
|
||||||
|
this.query.createdAt = [
|
||||||
|
dayjs().startOf("week").format(format[0]),
|
||||||
|
dayjs().endOf("week").format(format[1]),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "month":
|
||||||
|
// 本周
|
||||||
|
this.query.createdAt = [
|
||||||
|
dayjs().startOf("month").format(format[0]),
|
||||||
|
dayjs().endOf("month").format(format[1]),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "custom":
|
||||||
|
// 自定义
|
||||||
|
this.query.createdAt = [];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.cursor-pointer {
|
||||||
|
cursor: pointer;
|
||||||
|
color: #1890ff;
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cursor-pointer:hover {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collect_wrap {
|
||||||
|
display: flex;
|
||||||
|
gap: 14px;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
.icon_wrap {
|
||||||
|
$size: 34px;
|
||||||
|
$border: 6px;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: var(--bg-color);
|
||||||
|
border-radius: 50%;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
width: $size + $border;
|
||||||
|
height: $size + $border;
|
||||||
|
border-radius: 50%;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
background-color: var(--bg-color);
|
||||||
|
opacity: 0.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 10px;
|
||||||
|
|
||||||
|
.m {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.t {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #999;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.refund {
|
||||||
|
color: #ff9731;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table_order_info {
|
||||||
|
.order_no {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type {
|
||||||
|
color: #e6a23c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods_info {
|
||||||
|
.row {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 10px;
|
||||||
|
|
||||||
|
.sku {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -67,8 +67,8 @@
|
|||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="queryForm.paidAt"
|
v-model="queryForm.paidAt"
|
||||||
type="date"
|
type="date"
|
||||||
format="yyyy-MM-dd"
|
format="YYYY-MM-DD"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="YYYY-MM-DD"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
style="width: 220px"
|
style="width: 220px"
|
||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
|
|||||||
@@ -79,12 +79,13 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { encrypt } from "@/utils/rsaEncrypt";
|
import { encrypt } from "@/utils/rsaEncrypt";
|
||||||
import $API_login from "@/api/account/login";
|
import $API_login from "@/api/account/login";
|
||||||
import { $douyin_checkIn } from "@/api/coup/index";
|
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import Background from "@/assets/images/background_img.jpg";
|
import Background from "@/assets/images/background_img.jpg";
|
||||||
import { useUserStore } from "@/store";
|
import { useUserStore } from "@/store";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
import { $douyin_checkIn } from "@/api/coup/index";
|
||||||
|
import { getToken, getDouyinToken, setDouyinToken } from "@/utils/auth";
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
@@ -191,10 +192,21 @@ function handleLogin() {
|
|||||||
userStore
|
userStore
|
||||||
.login(user)
|
.login(user)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
|
const token = getToken();
|
||||||
|
console.log("token", token);
|
||||||
|
$douyin_checkIn({
|
||||||
|
loginName: userStore.userInfo.phone,
|
||||||
|
token,
|
||||||
|
}).then((checkInfo) => {
|
||||||
|
console.log("checkInfo", checkInfo.userInfo);
|
||||||
|
userStore.meituan_douyin_info = checkInfo.userInfo;
|
||||||
|
setDouyinToken(checkInfo.userInfo.token);
|
||||||
|
});
|
||||||
await userStore.getUserInfo();
|
await userStore.getUserInfo();
|
||||||
await $douyin_checkIn();
|
|
||||||
const { path, queryParams } = parseRedirect();
|
const { path, queryParams } = parseRedirect();
|
||||||
router.push({ path: path, query: queryParams });
|
console.log(path, queryParams);
|
||||||
|
router.replace({ path: path, query: queryParams });
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
|
|||||||
@@ -29,7 +29,12 @@
|
|||||||
{{ returnOptionsLabel(scope.prop, scope.row[scope.prop]) }}
|
{{ returnOptionsLabel(scope.prop, scope.row[scope.prop]) }}
|
||||||
</template>
|
</template>
|
||||||
<template #switch="scope">
|
<template #switch="scope">
|
||||||
<el-switch v-model="scope.row[scope.prop]" disabled></el-switch>
|
<el-switch
|
||||||
|
v-model="scope.row[scope.prop]"
|
||||||
|
disabled
|
||||||
|
:inactive-value="0"
|
||||||
|
:active-value="1"
|
||||||
|
></el-switch>
|
||||||
</template>
|
</template>
|
||||||
<template #mobile="scope">
|
<template #mobile="scope">
|
||||||
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
||||||
|
|||||||
@@ -39,6 +39,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { useUserStore } from "@/store/modules/user";
|
||||||
|
import { getDouyinToken, setDouyinToken } from "@/utils/auth";
|
||||||
|
|
||||||
|
const user = useUserStore();
|
||||||
import * as $Api from "@/api/coup/index.js";
|
import * as $Api from "@/api/coup/index.js";
|
||||||
import orderApi from "@/api/order/order";
|
import orderApi from "@/api/order/order";
|
||||||
import bindShop from "./douyin-quan-bind-shop.vue";
|
import bindShop from "./douyin-quan-bind-shop.vue";
|
||||||
@@ -181,10 +185,14 @@ export default {
|
|||||||
},
|
},
|
||||||
open(data) {
|
open(data) {
|
||||||
this.show = true;
|
this.show = true;
|
||||||
$Api.$douyin_checkIn().then((res) => {
|
$Api
|
||||||
console.log(res);
|
.$douyin_checkIn({
|
||||||
localStorage.setItem("bausertoken", res.userInfo.token);
|
loginName: user.userInfo.phone,
|
||||||
});
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
setDouyinToken(res.userInfo.token);
|
||||||
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$refs.refInputCode.focus();
|
this.$refs.refInputCode.focus();
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|||||||
Reference in New Issue
Block a user