更新工作台页面,优化交易数据展示,修复核销订单金额等数据展示错误,并调整相关API接口路径

This commit is contained in:
zmj 2024-06-13 17:31:45 +08:00
parent 69da1cb54f
commit 8f9d0decf5
5 changed files with 15 additions and 429 deletions

View File

@ -1,31 +0,0 @@
<template>
<!-- <el-table :data="props.lists"> -->
<el-table :data="[{}]">
<el-table-column :label="item.label" :prop="item.prop" show-overflow-tooltip v-for="item in column" />
</el-table>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</template>
<script lang="ts" setup name="manageProjectLists">
import { ref, reactive, defineProps } from "vue"
import { usePaging } from '@/hooks/usePaging'
let props = defineProps({
fetchApi: {
type: Function
},
column: {
type: Array,
}
})
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: props.fetchApi,
})
// getLists()
</script>

View File

@ -1,71 +0,0 @@
<template>
<popup ref="popupRef" title="店员详情" :async="true" width="50vw" @close="close" :show-footer="false">
<div class="flex">
<el-avatar shape="circle" :size="70"
src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" />
<el-row class="w-[100%] ml-4">
<el-col :span="24">你干嘛</el-col>
<el-col :span="7">收银订单200.00</el-col>
<el-col :span="7">核销订单200.00</el-col>
<el-col :span="7">配送订单200.00</el-col>
</el-row>
</div>
<el-tabs tab-position="left" style="height: 200px" class="demo-tabs mt-8">
<el-tab-pane label="收银订单">
<myTable :column="datas.moneyLists"></myTable>
</el-tab-pane>
<el-tab-pane label="配送订单">
<myTable :column="datas.moneyLists"></myTable>
</el-tab-pane>
<el-tab-pane label="核销订单">
<myTable :column="datas.moneyLists"></myTable>
</el-tab-pane>
</el-tabs>
</popup>
</template>
<script setup>
import { ref, reactive } from 'vue'
import myTable from './components/myTable.vue';
const popupRef = ref(null)
const emit = defineEmits(['close'])
const open = () => {
popupRef.value?.open()
}
const close = () => {
emit('close')
}
const datas = reactive({
moneyLists: [
{ label: '订单id', prop: 'orderid' },
{ label: '收货人', prop: 'orderid' },
{ label: '商品数量', prop: 'orderid' },
{ label: '商品总价', prop: 'orderid' },
{ label: '实付金额', prop: 'orderid' },
{ label: '交易完成时间', prop: 'orderid' },
],
sendLists: [
{ label: '订单id', prop: 'orderid' },
{ label: '收货人', prop: 'orderid' },
{ label: '商品数量', prop: 'orderid' },
{ label: '商品总价', prop: 'orderid' },
{ label: '实付金额', prop: 'orderid' },
{ label: '交易完成时间', prop: 'orderid' },
],
})
defineExpose({
open,
})
</script>

View File

@ -1,166 +0,0 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit"
@close="handleClose">
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
<el-form-item label="店员名称" prop="title">
<el-input v-model="formData.title" clearable placeholder="请输入店员名称" />
</el-form-item>
<el-form-item label="头像" prop="title">
<el-input v-model="formData.title" clearable placeholder="请输入店员名称" />
</el-form-item>
<el-form-item label="店员账号" prop="title">
<el-input v-model="formData.title" clearable placeholder="请输入店员账号" />
</el-form-item>
<el-form-item label="店员密码" prop="title">
<el-input v-model="formData.title" clearable placeholder="请输入店员账号" type="password" />
</el-form-item>
<el-form-item label="确认密码" prop="title">
<el-input v-model="formData.title" clearable placeholder="请确认账号密码" />
</el-form-item>
<el-form-item label="手机号码" prop="title">
<el-input v-model="formData.title" clearable placeholder="请输入手机号码" />
</el-form-item>
<el-form-item label="店员身份" prop="title">
<el-input v-model="formData.title" clearable placeholder="请输入手机号码" />
</el-form-item>
<el-form-item label="状态" prop="title">
<el-input v-model="formData.title" clearable placeholder="请输入手机号码" />
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="oaPlanEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
// import { apiOaPlanAdd, apiOaPlanEdit, apiOaPlanDetail } from '@/api/oa_plan'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑日程安排' : '新增日程安排'
})
//
const formData = reactive({
id: '',
title: '',
type: '',
start_time: '',
end_time: '',
remind_type: '',
remark: '',
})
const chekcDate = (rule: any, value: any, callback: any) => {
if (new Date(formData.end_time) < new Date(formData.start_time)) {
callback(new Error('结束时间不能早于开始时间'))
} else {
callback()
}
}
//
const formRules = reactive<any>({
title: [{
required: true,
message: '请输入工作安排主题',
trigger: ['blur']
}],
type: [{
required: true,
message: '请输入日程优先级',
trigger: ['blur']
}],
start_time: [{
required: true,
message: '请输入开始时间',
trigger: ['blur']
}],
end_time: [{
required: true,
message: '请输入结束时间',
trigger: ['blur']
},
{
validator: chekcDate,
trigger: ['blur']
}],
remind_type: [{
required: true,
message: '请输入提醒类型',
trigger: ['blur']
}],
remind_time: [{
required: true,
message: '请输入提醒时间',
trigger: ['blur']
}]
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiOaPlanDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
// mode.value == 'edit'
// ? await apiOaPlanEdit(data)
// : await apiOaPlanAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add', start_time = '') => {
mode.value = type
formData.start_time = start_time
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -1,151 +0,0 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" label-width="80px">
<el-row>
<el-col :span="6">
<el-form-item label="商品状态">
<el-select class="flex-1" v-model="queryParams.status" clearable placeholder="请选择商品状态">
<el-option label="销售中" :value="0" />
<el-option label="仓库中" :value="0" />
<el-option label="已售罄" :value="0" />
<el-option label="库存预警" :value="0" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="商品搜索" prop="nature">
<el-input v-model="queryParams.status" clearable placeholder="请输入商品名称" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['dept.dept/add']" type="primary" @click="handleAdd()">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column label="id" prop="progress" show-overflow-tooltip />
<el-table-column label="头像" prop="build_area_text" show-overflow-tooltip>
<template #default="{ row }">
<!-- <el-image style="width: 50px; height: 50px" :src="url" /> -->
</template>
</el-table-column>
<el-table-column label="昵称" prop="project_level_text" show-overflow-tooltip />
<el-table-column label="店员身份" prop="project_level_text" show-overflow-tooltip />
<el-table-column label="手机号" prop="total_investment" show-overflow-tooltip />
<el-table-column label="状态" prop="engineering_status_text" show-overflow-tooltip>
<template #default="{ row }">
<el-switch v-model="row.status" :active-value="1" :inactive-value="0"
@change="changeStatus(row)"></el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="170" fixed="right">
<template #default="{ row }">
<el-button type="primary" link @click="handleEdit(row)">
编辑
</el-button>
<el-button type="primary" link @click="handleDetail(row)">
详情
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
<DetailPopup v-if="showDetail" ref="detailRef" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="manageProjectLists">
import { ref, reactive } from "vue"
import { usePaging } from '@/hooks/usePaging'
import { apiGoodsListLists, apiStatus, apiGoodsTypeLists } from '@/api/goodsList'
import EditPopup from './edit.vue'
import DetailPopup from './detail.vue'
const detailRef = ref(null)
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const showDetail = ref(false)
//
const queryParams = reactive({
status: ""
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
// &
const changeStatus = (data: any) => {
apiStatus({
// id: data.id,
// account: data.account,
// name: data.name,
// role_id: data.role_id,
// disable: data.disable,
// org_id: data.org_id,
// dept_id: data.dept_id,
// job_id: data.job_id,
// multipoint_login: data.multipoint_login
}).finally(() => {
getLists()
})
}
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiGoodsListLists,
params: queryParams
})
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
const handleDetail = () => {
showDetail.value = true
nextTick(() => {
detailRef.value?.open()
})
}
getLists()
</script>

View File

@ -2,7 +2,7 @@
<el-card :key="date"> <el-card :key="date">
<template #header>今日</template> <template #header>今日</template>
<el-row> <el-row>
<el-col :span="6" class="flex" v-for="(item, index) in statisticLists" :key="index"> <el-col :span="5" class="flex" v-for="(item, index) in statisticLists" :key="index">
<img class="w-[50px] h-[50px] mr-2" :src="item.src" /> <img class="w-[50px] h-[50px] mr-2" :src="item.src" />
<div> <div>
<el-statistic :title="item.title" :value="item.value()" /> <el-statistic :title="item.title" :value="item.value()" />
@ -14,7 +14,7 @@
<el-card :key="date"> <el-card :key="date">
<template #header>累计</template> <template #header>累计</template>
<el-row> <el-row>
<el-col :span="6" class='flex' v-for="(item, index) in statisticLists" :key="index"> <el-col :span="5" class='flex' v-for="(item, index) in statisticLists" :key="index">
<img class="w-[50px] h-[50px] mr-2" :src="item.src" /> <img class="w-[50px] h-[50px] mr-2" :src="item.src" />
<div> <div>
<el-statistic :title="item.title" :value="item.value()" /> <el-statistic :title="item.title" :value="item.value()" />
@ -33,18 +33,11 @@
</template> </template>
<script lang="ts" setup name="manageProjectLists"> <script lang="ts" setup name="manageProjectLists">
import { ref, reactive } from "vue" import { ref, reactive, onMounted } from "vue"
// import { apiTradStatisApi } from '@/api/statistics' // import { apiTradStatisApi } from '@/api/statistics'
import vCharts from 'vue-echarts' import vCharts from 'vue-echarts'
const date = ref([]) const date = ref([])
const queryParams = reactive({
start_time: "",
end_time: "",
})
const formData = ref({ const formData = ref({
order_amount: 0, order_amount: 0,
@ -77,6 +70,13 @@ const statisticLists = reactive([
return String(formData.value.income_amount) return String(formData.value.income_amount)
} }
}, },
{
src: 'https://ceshi-engineering.lihaink.cn/uploads/files/20240604/20240604171701594ff8897.png',
title: "现金收银金额",
value: () => {
return String(formData.value.income_amount)
}
},
{ {
src: 'https://ceshi-engineering.lihaink.cn/uploads/files/20240604/202406041717018a22e1161.png', src: 'https://ceshi-engineering.lihaink.cn/uploads/files/20240604/202406041717018a22e1161.png',
title: "保证金", title: "保证金",
@ -130,6 +130,11 @@ const visitorOption = reactive({
const getData = async () => { const getData = async () => {
// let res = await apiTradStatisApi(queryParams) // let res = await apiTradStatisApi(queryParams)
// formData.value = res // formData.value = res
// visitorOption.xAxis.data = res.statistics.range // visitorOption.xAxis.data = res.statistics.range