This commit is contained in:
weipengfei 2024-05-31 16:59:14 +08:00
parent c4079cd7a1
commit afa3ba8feb
18 changed files with 1455 additions and 7 deletions

26
src/api/store_order.ts Normal file
View File

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 订单表列表
export function apiStoreOrderLists(params: any) {
return request.get({ url: '/store_order/storeorder/lists', params })
}
// 添加订单表
export function apiStoreOrderAdd(params: any) {
return request.post({ url: '/store_order/storeorder/add', params })
}
// 编辑订单表
export function apiStoreOrderEdit(params: any) {
return request.post({ url: '/store_order/storeorder/edit', params })
}
// 删除订单表
export function apiStoreOrderDelete(params: any) {
return request.post({ url: '/store_order/storeorder/delete', params })
}
// 订单表详情
export function apiStoreOrderDetail(params: any) {
return request.get({ url: '/store_order/storeorder/detail', params })
}

View File

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 计量单位列表
export function apiStoreProductUnitLists(params: any) {
return request.get({ url: '/store_product_unit/storeproductunit/lists', params })
}
// 添加计量单位
export function apiStoreProductUnitAdd(params: any) {
return request.post({ url: '/store_product_unit/storeproductunit/add', params })
}
// 编辑计量单位
export function apiStoreProductUnitEdit(params: any) {
return request.post({ url: '/store_product_unit/storeproductunit/edit', params })
}
// 删除计量单位
export function apiStoreProductUnitDelete(params: any) {
return request.post({ url: '/store_product_unit/storeproductunit/delete', params })
}
// 计量单位详情
export function apiStoreProductUnitDetail(params: any) {
return request.get({ url: '/store_product_unit/storeproductunit/detail', params })
}

View File

@ -20,3 +20,29 @@ export function getUserInfo() {
export function setUserInfo(params: any) { export function setUserInfo(params: any) {
return request.post({ url: '/auth/admin/editSelf', params }) return request.post({ url: '/auth/admin/editSelf', params })
} }
// 用户表列表
export function apiUserLists(params: any) {
return request.get({ url: '/user/user/lists', params })
}
// 添加用户表
export function apiUserAdd(params: any) {
return request.post({ url: '/user/user/add', params })
}
// 编辑用户表
export function apiUserEdit(params: any) {
return request.post({ url: '/user/user/edit', params })
}
// 删除用户表
export function apiUserDelete(params: any) {
return request.post({ url: '/user/user/delete', params })
}
// 用户表详情
export function apiUserDetail(params: any) {
return request.get({ url: '/user/user/detail', params })
}

26
src/api/user_bill.ts Normal file
View File

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 用户账单表列表
export function apiUserBillLists(params: any) {
return request.get({ url: '/user_bill/userbill/lists', params })
}
// 添加用户账单表
export function apiUserBillAdd(params: any) {
return request.post({ url: '/user_bill/userbill/add', params })
}
// 编辑用户账单表
export function apiUserBillEdit(params: any) {
return request.post({ url: '/user_bill/userbill/edit', params })
}
// 删除用户账单表
export function apiUserBillDelete(params: any) {
return request.post({ url: '/user_bill/userbill/delete', params })
}
// 用户账单表详情
export function apiUserBillDetail(params: any) {
return request.get({ url: '/user_bill/userbill/detail', params })
}

View File

@ -19,7 +19,7 @@ export class Feedback {
} }
// 错误消息 // 错误消息
msgError(msg: string) { msgError(msg: string) {
ElMessage.error(msg) if(msg!=='Network Error') ElMessage.error(msg)
} }
// 成功消息 // 成功消息
msgSuccess(msg: string) { msgSuccess(msg: string) {

View File

@ -0,0 +1,81 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
title="详情"
:async="true"
width="550px"
:cancelButtonText="false"
:confirmButtonText="false"
>
<el-form ref="formRef" :model="formData" label-width="90px">
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="userBillDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiUserBillAdd, apiUserBillEdit, apiUserBillDetail } from '@/api/user_bill'
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 formData = reactive({
id: '',
})
//
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 apiUserBillDetail({
id: row.id
})
setFormData(data)
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,103 @@
<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="90px" :rules="formRules">
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="userBillEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiUserBillAdd, apiUserBillEdit, apiUserBillDetail } from '@/api/user_bill'
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: '',
})
//
const formRules = reactive<any>({
})
//
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 apiUserBillDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiUserBillEdit(data)
: await apiUserBillAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,136 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form
class="mb-[-16px]"
:model="queryParams"
inline
>
<el-form-item label="用户uid" prop="uid">
<el-input class="w-[280px]" v-model="queryParams.uid" clearable placeholder="请输入用户uid" />
</el-form-item>
<el-form-item label="明细类型" prop="type">
<el-input class="w-[280px]" v-model="queryParams.type" clearable placeholder="请输入明细类型" />
</el-form-item>
<el-form-item label="创建时间" prop="create_time">
<el-input class="w-[280px]" v-model="queryParams.create_time" clearable placeholder="请输入创建时间" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['user_bill.user_bill/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button
v-perms="['user_bill.user_bill/delete']"
:disabled="!selectData.length"
@click="handleDelete(selectData)"
>
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="明细类型" prop="type" show-overflow-tooltip />
<el-table-column label="明细数字" prop="number" show-overflow-tooltip />
<el-table-column label="备注" prop="mark" show-overflow-tooltip />
<el-table-column label="创建时间" prop="create_time" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['user_bill.user_bill/edit']"
type="primary"
link
@click="handleEdit(row)"
>
编辑
</el-button>
<el-button
v-perms="['user_bill.user_bill/delete']"
type="danger"
link
@click="handleDelete(row.id)"
>
删除
</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" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="userBillLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiUserBillLists, apiUserBillDelete } from '@/api/user_bill'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
uid: '',
type: '',
create_time: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiUserBillLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiUserBillDelete({ id })
getLists()
}
getLists()
</script>

View File

@ -34,9 +34,11 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="商品名称" prop="store_name" show-overflow-tooltip /> <el-table-column label="商品名称" prop="store_name" show-overflow-tooltip />
<el-table-column label="分类id" prop="cate_id" show-overflow-tooltip /> <el-table-column label="分类" prop="cate_name" show-overflow-tooltip />
<el-table-column label="商品价格" prop="price" show-overflow-tooltip /> <el-table-column label="商品价格" prop="price" show-overflow-tooltip />
<el-table-column label="单位名" prop="unit_name" show-overflow-tooltip /> <el-table-column label="单位名" prop="unit_name" show-overflow-tooltip />
<el-table-column label="成本价" prop="cost" show-overflow-tooltip />
<el-table-column label="采购价" prop="purchase" show-overflow-tooltip />
<el-table-column label="销量" prop="sales" show-overflow-tooltip /> <el-table-column label="销量" prop="sales" show-overflow-tooltip />
<el-table-column label="库存" prop="stock" show-overflow-tooltip /> <el-table-column label="库存" prop="stock" show-overflow-tooltip />
<el-table-column label="状态" prop="is_show" show-overflow-tooltip> <el-table-column label="状态" prop="is_show" show-overflow-tooltip>
@ -44,11 +46,7 @@
{{ row.is_show ? "上架" : "未上架" }} {{ row.is_show ? "上架" : "未上架" }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="是否新品" prop="is_new" show-overflow-tooltip /> <el-table-column label="添加时间" prop="create_time" show-overflow-tooltip />
<el-table-column label="添加时间" prop="add_time" show-overflow-tooltip />
<el-table-column label="是否包邮" prop="is_postage" show-overflow-tooltip />
<el-table-column label="是否删除" prop="is_del" show-overflow-tooltip />
<el-table-column label="成本价" prop="cost" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right"> <el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button v-perms="['store_product.store_product/edit']" type="primary" link <el-button v-perms="['store_product.store_product/edit']" type="primary" link

View File

@ -0,0 +1,103 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :async="true" width="550px" @close="handleClose" :bottom-btn="false">
<el-descriptions class="margin-top" :title="popupTitle" :column="1" border>
<el-descriptions-item label="单位名称">
{{ formData.name }}
</el-descriptions-item>
<el-descriptions-item label="单位编号">
{{ formData.number }}
</el-descriptions-item>
<el-descriptions-item label="是否散装">
{{ formData.is_bulk ? '是' : '否' }}
</el-descriptions-item>
<el-descriptions-item label="备注信息">
{{ formData.data }}
</el-descriptions-item>
</el-descriptions>
</popup>
</div>
</template>
<script lang="ts" setup name="brandEdit">
import Popup from '@/components/popup/index.vue'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
//
const popupTitle = computed(() => {
return '单位详情'
})
//
const formData = reactive({
id: '',
name: '',
py: '',
number: '',
data: '',
is_bulk: '',
})
//
const formRules = reactive<any>({
name: [{
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 handleSubmit = async () => {
// await formRef.value?.validate()
// const data = { ...formData, }
// mode.value == 'edit'
// ? await apiBrandEdit(data)
// : await apiBrandAdd(data)
// popupRef.value?.close()
// emit('success')
// }
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
})
</script>

View File

@ -0,0 +1,121 @@
<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="90px" :rules="formRules">
<el-form-item label="单位名称" prop="name">
<el-input v-model="formData.name" clearable placeholder="请输入单位名称" />
</el-form-item>
<!-- <el-form-item label="拼音信息" prop="py">
<el-input v-model="formData.py" clearable placeholder="请输入拼音信息" />
</el-form-item> -->
<el-form-item label="单位编号" prop="number">
<el-input v-model="formData.number" clearable placeholder="请输入单位编号" />
</el-form-item>
<el-form-item label="是否散装" prop="is_bulk">
<el-radio-group v-model="formData.is_bulk">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注信息" prop="data">
<el-input v-model="formData.data" type="textarea" clearable placeholder="请输入备注信息" />
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="unitEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiStoreProductUnitAdd, apiStoreProductUnitEdit, apiStoreProductUnitDetail } from '@/api/store_product_unit'
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: '',
name: '',
py: '',
number: '',
data: '',
is_bulk: 0,
})
//
const formRules = reactive<any>({
name: [{
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 apiStoreProductUnitDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiStoreProductUnitEdit(data)
: await apiStoreProductUnitAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,152 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="单位名称" prop="name">
<el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入单位名称" />
</el-form-item>
<!-- <el-form-item label="拼音信息" prop="py">
<el-input class="w-[280px]" v-model="queryParams.py" clearable placeholder="请输入拼音信息" />
</el-form-item> -->
<el-form-item label="单位编号" prop="number">
<el-input class="w-[280px]" v-model="queryParams.number" clearable placeholder="请输入单位编号" />
</el-form-item>
<!-- <el-form-item label="备注信息" prop="data">
<el-input class="w-[280px]" v-model="queryParams.data" clearable placeholder="请输入备注信息" />
</el-form-item>
<el-form-item label="扩展信息" prop="more">
<el-input class="w-[280px]" v-model="queryParams.more" clearable placeholder="请输入扩展信息" />
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['goods.unit/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button v-perms="['goods.unit/delete']" :disabled="!selectData.length" @click="handleDelete(selectData)">
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="ID" prop="id" width="55" />
<el-table-column label="单位名称" prop="name" show-overflow-tooltip />
<!-- <el-table-column label="拼音信息" prop="py" show-overflow-tooltip /> -->
<el-table-column label="单位编号" prop="number" show-overflow-tooltip />
<el-table-column label="是否散装" prop="is_bulk" show-overflow-tooltip>
<template #default="{ row }">
{{ row.is_bulk ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column label="备注信息" prop="data" show-overflow-tooltip />
<el-table-column label="操作" width="170" fixed="right">
<template #default="{ row }">
<el-button v-perms="['goods.unit/edit']" type="primary" link @click="handleEdit(row)">
编辑
</el-button>
<el-button v-perms="['goods.unit/delete']" type="danger" link @click="handleDelete(row.id)">
删除
</el-button>
<el-button v-perms="['goods.unit/edit']" link @click="handleDetail(row.id)">
详情
</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" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
<DetailPopup v-if="showDetail" ref="detailRef" :dict-data="dictData" @success="getLists"
@close="showDetail = false" />
</div>
</template>
<script lang="ts" setup name="unitLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiStoreProductUnitLists, apiStoreProductUnitDelete, apiStoreProductUnitDetail } from '@/api/store_product_unit'
import feedback from '@/utils/feedback'
import DetailPopup from './detail.vue'
import EditPopup from "./edit.vue";
const editRef = ref(null)
const detailRef = ref(null)
//
const showEdit = ref(false)
const showDetail = ref(false)
//
const queryParams = reactive({
name: '',
py: '',
number: '',
data: '',
more: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiStoreProductUnitLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
console.log(editRef.value)
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleDetail = async (id: any) => {
let res = await apiStoreProductUnitDetail({ id })
showDetail.value = true
await nextTick()
detailRef.value?.open('edit')
detailRef.value?.setFormData(res)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiStoreProductUnitDelete({ id })
getLists()
}
getLists()
</script>

View File

@ -0,0 +1,81 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
title="详情"
:async="true"
width="550px"
:cancelButtonText="false"
:confirmButtonText="false"
>
<el-form ref="formRef" :model="formData" label-width="90px">
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="storeOrderDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiStoreOrderAdd, apiStoreOrderEdit, apiStoreOrderDetail } from '@/api/store_order'
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 formData = reactive({
id: '',
})
//
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 apiStoreOrderDetail({
id: row.id
})
setFormData(data)
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,103 @@
<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="90px" :rules="formRules">
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="storeOrderEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiStoreOrderAdd, apiStoreOrderEdit, apiStoreOrderDetail } from '@/api/store_order'
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: '',
})
//
const formRules = reactive<any>({
})
//
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 apiStoreOrderDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiStoreOrderEdit(data)
: await apiStoreOrderAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,124 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="订单号" prop="order_id">
<el-input class="w-[280px]" v-model="queryParams.order_id" clearable placeholder="请输入订单号" />
</el-form-item>
<el-form-item label="支付方式" prop="pay_type">
<el-input class="w-[280px]" v-model="queryParams.pay_type" clearable placeholder="请输入支付方式" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['store_order.store_order/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button v-perms="['store_order.store_order/delete']" :disabled="!selectData.length"
@click="handleDelete(selectData)">
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="订单ID" prop="id" show-overflow-tooltip />
<el-table-column label="订单号" prop="order_id" show-overflow-tooltip />
<el-table-column label="实际支付金额" prop="pay_price" show-overflow-tooltip />
<el-table-column label="支付时间" prop="pay_time" show-overflow-tooltip />
<el-table-column label="支付方式" prop="pay_type" show-overflow-tooltip />
<el-table-column label="订单状态" prop="status"
show-overflow-tooltip>
<template #default="{ row }">
<!-- -1 : 申请退款 -2 : 退货成功 0待发货1待收货2已收货3待评价-1已退款 -->
<dict-value :options="dictData.order_status" :values="row.status"></dict-value>
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button v-perms="['store_order.store_order/edit']" type="primary" link
@click="handleEdit(row)">
编辑
</el-button>
<el-button v-perms="['store_order.store_order/delete']" type="danger" link
@click="handleDelete(row.id)">
删除
</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" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="storeOrderLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiStoreOrderLists, apiStoreOrderDelete } from '@/api/store_order'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
order_id: '',
pay_type: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiStoreOrderLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiStoreOrderDelete({ id })
getLists()
}
getLists()
</script>

View File

@ -0,0 +1,81 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
title="详情"
:async="true"
width="550px"
:cancelButtonText="false"
:confirmButtonText="false"
>
<el-form ref="formRef" :model="formData" label-width="90px">
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="userDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiUserAdd, apiUserEdit, apiUserDetail } from '@/api/user'
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 formData = reactive({
id: '',
})
//
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 apiUserDetail({
id: row.id
})
setFormData(data)
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

103
src/views/user/edit.vue Normal file
View File

@ -0,0 +1,103 @@
<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="90px" :rules="formRules">
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="userEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiUserAdd, apiUserEdit, apiUserDetail } from '@/api/user'
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: '',
})
//
const formRules = reactive<any>({
})
//
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 apiUserDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiUserEdit(data)
: await apiUserAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

158
src/views/user/index.vue Normal file
View File

@ -0,0 +1,158 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form
class="mb-[-16px]"
:model="queryParams"
inline
>
<el-form-item label="用户昵称" prop="nickname">
<el-input class="w-[280px]" v-model="queryParams.nickname" clearable placeholder="请输入用户昵称" />
</el-form-item>
<el-form-item label="用户账号" prop="account">
<el-input class="w-[280px]" v-model="queryParams.account" clearable placeholder="请输入用户账号" />
</el-form-item>
<el-form-item label="用户电话" prop="mobile">
<el-input class="w-[280px]" v-model="queryParams.mobile" clearable placeholder="请输入用户电话" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['user.user/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button
v-perms="['user.user/delete']"
:disabled="!selectData.length"
@click="handleDelete(selectData)"
>
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="主键" prop="id" show-overflow-tooltip />
<el-table-column label="头像" prop="avatar" show-overflow-tooltip >
<template #default="{ row }">
<el-image :src="row.avatar" class="w-[40px] h-[40px] rounded-full" />
</template>
</el-table-column>
<el-table-column label="真实姓名" prop="real_name" show-overflow-tooltip />
<el-table-column label="用户昵称" prop="nickname" show-overflow-tooltip />
<el-table-column label="用户账号" prop="account" show-overflow-tooltip />
<!-- <el-table-column label="用户密码" prop="password" show-overflow-tooltip /> -->
<el-table-column label="用户电话" prop="mobile" show-overflow-tooltip />
<el-table-column label="用户性别" prop="sex">
<template #default="{ row }">
<dict-value :options="dictData.sex" :value="row.sex" />
</template>
</el-table-column>
<el-table-column label="注册渠道" prop="channel" show-overflow-tooltip />
<el-table-column label="是否禁用" prop="is_disable">
<template #default="{ row }">
<dict-value :options="dictData.system_disable" :value="row.is_disable" />
</template>
</el-table-column>
<el-table-column label="最后登录IP" prop="login_ip" show-overflow-tooltip />
<el-table-column label="最后登录时间" prop="login_time" show-overflow-tooltip />
<el-table-column label="用户余额" prop="user_money" show-overflow-tooltip />
<el-table-column label="累计充值" prop="total_recharge_amount" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['user.user/edit']"
type="primary"
link
@click="handleEdit(row)"
>
编辑
</el-button>
<el-button
v-perms="['user.user/delete']"
type="danger"
link
@click="handleDelete(row.id)"
>
删除
</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" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="userLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiUserLists, apiUserDelete } from '@/api/user'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
nickname: '',
account: '',
mobile: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('sex,system_disable')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiUserLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiUserDelete({ id })
getLists()
}
getLists()
</script>