feat(custom): 新增订单统计,用户统计
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -30,5 +30,8 @@
|
||||
"files.associations": {
|
||||
"*.env.*": "dotenv",
|
||||
"*.css": "postcss"
|
||||
},
|
||||
"[nginx]": {
|
||||
"editor.defaultFormatter": "ahmadalli.vscode-nginx-conf"
|
||||
}
|
||||
}
|
||||
|
||||
67
nginx.conf
Normal file
67
nginx.conf
Normal file
@@ -0,0 +1,67 @@
|
||||
upstream backend {
|
||||
server 127.0.0.1:3000;
|
||||
server 47.106.106.179:4000 backup;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name www1.wanzhuanyongcheng.cn;
|
||||
index index.php index.html index.htm default.php default.htm default.html;
|
||||
root /www/wwwroot/www1.wanzhuanyongcheng.cn;
|
||||
|
||||
#PHP-INFO-START PHP引用配置,可以注释或修改
|
||||
include enable-php-00.conf;
|
||||
#PHP-INFO-END
|
||||
|
||||
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
|
||||
include /www/server/panel/vhost/rewrite/www1.wanzhuanyongcheng.cn.conf;
|
||||
#REWRITE-END
|
||||
|
||||
#禁止访问的文件或目录
|
||||
location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md) {
|
||||
return 404;
|
||||
}
|
||||
|
||||
#一键申请SSL证书验证目录相关设置
|
||||
location ~ \.well-known {
|
||||
allow all;
|
||||
}
|
||||
|
||||
#禁止在证书验证目录放入敏感文件
|
||||
if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
|
||||
return 403;
|
||||
}
|
||||
|
||||
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
|
||||
expires 30d;
|
||||
error_log /dev/null;
|
||||
access_log /dev/null;
|
||||
}
|
||||
|
||||
location ~ .*\.(js|css)?$ {
|
||||
expires 12h;
|
||||
error_log /dev/null;
|
||||
access_log /dev/null;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
error_page 502 = @switch_to_backup;
|
||||
}
|
||||
|
||||
location @switch_to_backup {
|
||||
proxy_pass http://47.106.106.179:4000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
# Add any necessary additional configuration for backup container
|
||||
}
|
||||
|
||||
access_log /www/wwwlogs/www1.wanzhuanyongcheng.cn.log;
|
||||
error_log /www/wwwlogs/www1.wanzhuanyongcheng.cn.error.log;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<CommonPage show-footer :title="$route.title">
|
||||
<!-- {{ model }}-->
|
||||
<!--{{ model }}-->
|
||||
<n-spin size="large" :show="isShowSpin">
|
||||
<n-form ref="formRef" label-width="100" :model="model" :rules="rules" label-placement="left">
|
||||
<n-grid :cols="2" :x-gap="24">
|
||||
|
||||
@@ -3,16 +3,26 @@
|
||||
<n-row gutter="12">
|
||||
<n-col :span="24">
|
||||
<div flex>
|
||||
<n-card w-500>
|
||||
<n-statistic label="订单流水" tabular-nums>
|
||||
<n-card w-200 rounded-5>
|
||||
<n-statistic label="交易额(元)" tabular-nums>
|
||||
<n-number-animation :from="0" :to="cardData.total" />
|
||||
</n-statistic>
|
||||
</n-card>
|
||||
<n-card ml-10 w-500>
|
||||
<n-card ml-10 w-200 rounded-5>
|
||||
<n-statistic label="订单数量" tabular-nums>
|
||||
<n-number-animation :from="0" :to="cardData.count" />
|
||||
</n-statistic>
|
||||
</n-card>
|
||||
<n-card ml-10 w-200 rounded-5>
|
||||
<n-statistic label="赠送豆子" tabular-nums>
|
||||
<n-number-animation :from="0" :to="cardData.pulse" />
|
||||
</n-statistic>
|
||||
</n-card>
|
||||
<n-card ml-10 w-200 rounded-5>
|
||||
<n-statistic label="总佣金" tabular-nums>
|
||||
<n-number-animation :from="0" :to="cardData.commission" />
|
||||
</n-statistic>
|
||||
</n-card>
|
||||
</div>
|
||||
</n-col>
|
||||
<n-col :span="24" mt-10>
|
||||
@@ -34,7 +44,7 @@
|
||||
<n-input-group>
|
||||
<n-select
|
||||
v-model:value="queryData.selectKey"
|
||||
:style="{ width: '7%' }"
|
||||
:style="{ width: '10%' }"
|
||||
:options="selectOptions"
|
||||
placeholder="请选择"
|
||||
/>
|
||||
@@ -182,6 +192,39 @@ const columns = ref([
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '赠送豆子',
|
||||
align: 'center',
|
||||
key: 'pulse_number',
|
||||
},
|
||||
{
|
||||
title: '赠送积分',
|
||||
align: 'center',
|
||||
key: 'integral',
|
||||
},
|
||||
{
|
||||
title: '推广积分',
|
||||
align: 'center',
|
||||
key: 'commission_number',
|
||||
},
|
||||
{
|
||||
title: '分佣类型',
|
||||
align: 'center',
|
||||
slot: 'commission_type',
|
||||
render: (row) => {
|
||||
switch (row.commission_type) {
|
||||
case 1:
|
||||
return h('span', '百分比')
|
||||
case 2:
|
||||
return h('span', '固定金额')
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '分佣比例',
|
||||
align: 'center',
|
||||
key: 'commission',
|
||||
},
|
||||
{
|
||||
title: '下单时间',
|
||||
align: 'center',
|
||||
@@ -208,6 +251,8 @@ const cardData = ref({
|
||||
total: 0,
|
||||
service: 0,
|
||||
count: 0,
|
||||
commission: 0,
|
||||
pulse: 0,
|
||||
})
|
||||
|
||||
const pagination = ref({
|
||||
@@ -261,6 +306,8 @@ const getList = async () => {
|
||||
cardData.value.total = res.data.number
|
||||
cardData.value.service = res.data.commission
|
||||
cardData.value.count = res.data.total
|
||||
cardData.value.commission = res.data.total_commission
|
||||
cardData.value.pulse = res.data.total_pulse
|
||||
} catch (error) {
|
||||
$message.error(error.msg)
|
||||
throw error
|
||||
|
||||
5
src/views/user/index1/api.js
Normal file
5
src/views/user/index1/api.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import { request } from '@/utils'
|
||||
|
||||
export default {
|
||||
getUser: (data) => request.post('/user', data),
|
||||
}
|
||||
264
src/views/user/index1/index.vue
Normal file
264
src/views/user/index1/index.vue
Normal file
@@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<CommonPage show-footer :title="$route.title">
|
||||
<n-row gutter="12">
|
||||
<n-col :span="24">
|
||||
<div flex>
|
||||
<n-card ml-10 w-200 rounded-5>
|
||||
<n-statistic label="总积分" tabular-nums>
|
||||
<n-number-animation :from="0" :to="cardData.integral" />
|
||||
</n-statistic>
|
||||
</n-card>
|
||||
<n-card ml-10 w-200 rounded-5>
|
||||
<n-statistic label="总豆子" tabular-nums>
|
||||
<n-number-animation :from="0" :to="cardData.pulse" />
|
||||
</n-statistic>
|
||||
</n-card>
|
||||
</div>
|
||||
</n-col>
|
||||
<n-col :span="24" mt-10>
|
||||
<div>
|
||||
<span>筛选状态:</span>
|
||||
<n-radio-group v-model:value="queryData.status">
|
||||
<n-radio-button
|
||||
v-for="song in songs"
|
||||
:key="song.value"
|
||||
:value="song.value"
|
||||
:label="song.label"
|
||||
/>
|
||||
</n-radio-group>
|
||||
</div>
|
||||
</n-col>
|
||||
<n-col :span="24">
|
||||
<div mt-10 flex items-center>
|
||||
<div w-100>关键字搜索:</div>
|
||||
<n-input-group>
|
||||
<n-select
|
||||
v-model:value="queryData.selectKey"
|
||||
:style="{ width: '10%' }"
|
||||
:options="selectOptions"
|
||||
placeholder="请选择"
|
||||
/>
|
||||
<n-input v-model:value="queryData.word" :style="{ width: '20%' }" />
|
||||
</n-input-group>
|
||||
</div>
|
||||
</n-col>
|
||||
<n-col :span="10">
|
||||
<div mt-10 flex items-center>
|
||||
<span w-100>时间筛选:</span>
|
||||
<n-date-picker
|
||||
v-model:formatted-value="queryData.time"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetimerange"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
</n-col>
|
||||
<n-col :span="24">
|
||||
<div mt-10>
|
||||
<n-button type="primary" @click="getList">搜索</n-button>
|
||||
<n-button ml-10 @click="clear">重置</n-button>
|
||||
</div>
|
||||
</n-col>
|
||||
</n-row>
|
||||
<n-data-table
|
||||
class="mt-5"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
:pagination="pagination"
|
||||
:bordered="false"
|
||||
remote
|
||||
@update:sorter="handleSorterChange"
|
||||
/>
|
||||
</CommonPage>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import api from './api'
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const cardData = ref({
|
||||
pulse: 0,
|
||||
integral: 0,
|
||||
})
|
||||
|
||||
const queryData = ref({
|
||||
status: '',
|
||||
time: null,
|
||||
selectKey: null,
|
||||
word: '',
|
||||
})
|
||||
|
||||
const songs = ref([
|
||||
{
|
||||
value: 1,
|
||||
label: '未使用',
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: '用户输',
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
label: '用户赢',
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
label: '已过期',
|
||||
},
|
||||
])
|
||||
|
||||
const selectOptions = ref([
|
||||
{
|
||||
value: 1,
|
||||
label: '用户昵称',
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '手机号',
|
||||
},
|
||||
])
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: 'ID',
|
||||
align: 'center',
|
||||
key: 'ID',
|
||||
},
|
||||
{
|
||||
title: '昵称',
|
||||
align: 'center',
|
||||
key: 'nickName',
|
||||
},
|
||||
{
|
||||
title: '头像',
|
||||
align: 'center',
|
||||
slot: 'avatarUrl',
|
||||
render(row) {
|
||||
return h('img', {
|
||||
src: row.avatarUrl,
|
||||
style: {
|
||||
width: '30px',
|
||||
height: '30px',
|
||||
borderRadius: '50%',
|
||||
},
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '电话',
|
||||
align: 'center',
|
||||
key: 'phone',
|
||||
},
|
||||
{
|
||||
title: '用户积分',
|
||||
align: 'center',
|
||||
key: 'integral',
|
||||
sorter: true,
|
||||
sortOrder: false,
|
||||
},
|
||||
{
|
||||
title: '用户豆子',
|
||||
align: 'center',
|
||||
key: 'pulse',
|
||||
sorter: true,
|
||||
sortOrder: false,
|
||||
},
|
||||
// {
|
||||
// title: '操作',
|
||||
// align: 'center',
|
||||
// slot: 'action',
|
||||
// render(row) {
|
||||
// console.log(row)
|
||||
// },
|
||||
// },
|
||||
])
|
||||
|
||||
const data = ref([])
|
||||
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
itemCount: 0,
|
||||
onChange: (page) => {
|
||||
pagination.value.page = page
|
||||
getList()
|
||||
},
|
||||
onUpdatePageSize: (pageSize) => {
|
||||
pagination.value.pageSize = pageSize
|
||||
pagination.value.page = 1
|
||||
getList()
|
||||
},
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const query_data = {
|
||||
Status: queryData.value.status || '',
|
||||
StartTime: queryData.value.time === null ? '' : queryData.value.time[0] || '',
|
||||
EndTime: queryData.value.time === null ? '' : queryData.value.time[1] || '',
|
||||
}
|
||||
switch (queryData.value.selectKey) {
|
||||
case 1:
|
||||
query_data['Name'] = queryData.value.word
|
||||
break
|
||||
case 2:
|
||||
query_data['Phone'] = queryData.value.word
|
||||
break
|
||||
}
|
||||
const res = await api.getUser({
|
||||
pageNum: pagination.value.page,
|
||||
pageSize: pagination.value.pageSize,
|
||||
...query_data,
|
||||
})
|
||||
data.value = res.data.data
|
||||
pagination.value.itemCount = res.data.total
|
||||
cardData.value.integral = res.data.total_integral
|
||||
cardData.value.pulse = res.data.total_pulse
|
||||
} catch (error) {
|
||||
$message.error(error.msg)
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
const clear = () => {
|
||||
queryData.value = {
|
||||
time: null,
|
||||
status: '',
|
||||
selectKey: null,
|
||||
word: '',
|
||||
}
|
||||
getList()
|
||||
}
|
||||
|
||||
const handleSorterChange = (sorter) => {
|
||||
if (!loading.value) {
|
||||
loading.value = true
|
||||
switch (sorter.columnKey) {
|
||||
case 'pulse':
|
||||
columns.value[5].sortOrder = !sorter ? false : sorter.order
|
||||
data.value = data.value.sort((a, b) => {
|
||||
if (sorter.order === 'descend') return b.pulse - a.pulse
|
||||
return a.pulse - b.pulse
|
||||
})
|
||||
break
|
||||
case 'integral':
|
||||
columns.value[4].sortOrder = !sorter ? false : sorter.order
|
||||
data.value = data.value.sort((a, b) => {
|
||||
if (sorter.order === 'descend') return b.integral - a.integral
|
||||
return a.integral - b.integral
|
||||
})
|
||||
break
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -12,10 +12,24 @@ export default {
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'Userlist',
|
||||
path: 'user_list',
|
||||
name: 'dhUserlist',
|
||||
path: 'dh_user_list',
|
||||
component: () => import('./index/index.vue'),
|
||||
meta: {
|
||||
requireAuth: true,
|
||||
role: ['2'],
|
||||
title: '用户列表',
|
||||
icon: 'mdi:account-multiple',
|
||||
order: 10,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'gyUserlist',
|
||||
path: 'gy_user_list',
|
||||
component: () => import('./index1/index.vue'),
|
||||
meta: {
|
||||
requireAuth: true,
|
||||
role: ['1'],
|
||||
title: '用户列表',
|
||||
icon: 'mdi:account-multiple',
|
||||
order: 10,
|
||||
|
||||
Reference in New Issue
Block a user