This commit is contained in:
parent
a08f3fe339
commit
855f6fa070
|
@ -0,0 +1,26 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 门店列表列表
|
||||
export function apiSystemStoreLists(params: any) {
|
||||
return request.get({ url: '/system_store/systemstore/lists', params })
|
||||
}
|
||||
|
||||
// 添加门店列表
|
||||
export function apiSystemStoreAdd(params: any) {
|
||||
return request.post({ url: '/system_store/systemstore/add', params })
|
||||
}
|
||||
|
||||
// 编辑门店列表
|
||||
export function apiSystemStoreEdit(params: any) {
|
||||
return request.post({ url: '/system_store/systemstore/edit', params })
|
||||
}
|
||||
|
||||
// 删除门店列表
|
||||
export function apiSystemStoreDelete(params: any) {
|
||||
return request.post({ url: '/system_store/systemstore/delete', params })
|
||||
}
|
||||
|
||||
// 门店列表详情
|
||||
export function apiSystemStoreDetail(params: any) {
|
||||
return request.get({ url: '/system_store/systemstore/detail', params })
|
||||
}
|
|
@ -62,7 +62,7 @@
|
|||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- <edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" /> -->
|
||||
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,12 +1,25 @@
|
|||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup ref="popupRef" title="详情" :async="true" width="550px" :cancelButtonText="false"
|
||||
<popup ref="popupRef" title="详情" :async="true" width="1000px" :cancelButtonText="false"
|
||||
:confirmButtonText="false">
|
||||
<el-form ref="formRef" :model="formData" label-width="90px">
|
||||
<el-form-item label="商品名称" prop="store_name">
|
||||
<el-input v-model="formData.store_name" clearable placeholder="请输入商品名称" :readonly="true" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-descriptions class="margin-top" title="商品详情" :column="2" border>
|
||||
<el-descriptions-item label="商品名称">
|
||||
{{ formData.store_name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商品图片">
|
||||
<el-image :src="formData.image" class="w-20 h-20" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商品条码">
|
||||
{{ formData.bar_code }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商品分类">{{ formData.cate_name }}</el-descriptions-item>
|
||||
<el-descriptions-item label="商品售价">{{ formData.price }}</el-descriptions-item>
|
||||
<el-descriptions-item label="商品单位">{{ formData.unit_name }}</el-descriptions-item>
|
||||
<el-descriptions-item label="库存">{{ formData.stock }}</el-descriptions-item>
|
||||
<el-descriptions-item label="成本">{{ formData.cost }}</el-descriptions-item>
|
||||
<el-descriptions-item label="采购价">{{ formData.purchase }}</el-descriptions-item>
|
||||
<el-descriptions-item label="上浮比例">{{ formData.rose }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -24,16 +37,24 @@ defineProps({
|
|||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
|
||||
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
store_name: '',
|
||||
image: "",
|
||||
store_name: "",
|
||||
bar_code: "",
|
||||
cate_id: "",
|
||||
cate_name: "",
|
||||
price: "",
|
||||
unit: "",
|
||||
unit_name: "",
|
||||
stock: "",
|
||||
cost: "",
|
||||
purchase: "",
|
||||
rose: "0",
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="添加时间" prop="create_time" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<el-table-column label="操作" width="180" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-perms="['store_product.store_product/edit']" type="primary" link
|
||||
@click="handleEdit(row)">
|
||||
|
@ -117,7 +117,7 @@ const handleAdd = async () => {
|
|||
// 详情
|
||||
const handleDetail = async (data: any) => {
|
||||
detailsRef.value?.open();
|
||||
detailsRef.value?.setFormData();
|
||||
detailsRef.value?.setFormData(data);
|
||||
};
|
||||
|
||||
// 编辑
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</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">
|
||||
<!-- <el-button v-perms="['store_order.store_order/add']" type="primary" @click="handleAdd">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
|
@ -24,7 +24,7 @@
|
|||
<el-button v-perms="['store_order.store_order/delete']" :disabled="!selectData.length"
|
||||
@click="handleDelete(selectData)">
|
||||
删除
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
<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-item label="门店名称" prop="name">
|
||||
<el-input v-model="formData.name" clearable placeholder="请输入门店名称" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="简介" prop="introduction">
|
||||
<el-input v-model="formData.introduction" clearable placeholder="请输入简介" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码" prop="phone">
|
||||
<el-input v-model="formData.phone" clearable placeholder="请输入手机号码" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="详细地址" prop="detailed_address">
|
||||
<el-input v-model="formData.detailed_address" clearable placeholder="请输入详细地址" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="门店logo" prop="image">
|
||||
<el-input v-model="formData.image" clearable placeholder="请输入门店logo" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示" prop="is_show">
|
||||
<el-input v-model="formData.is_show" clearable placeholder="请输入是否显示" :readonly="true"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="systemStoreDETAILS">
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apiSystemStoreAdd, apiSystemStoreEdit, apiSystemStoreDetail } from '@/api/system_store'
|
||||
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: '',
|
||||
name: '',
|
||||
introduction: '',
|
||||
phone: '',
|
||||
detailed_address: '',
|
||||
image: '',
|
||||
is_show: '',
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 获取详情
|
||||
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 apiSystemStoreDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
//打开弹窗
|
||||
const open = () => {
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,151 @@
|
|||
<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="请输入门店名称" :readonly="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="简介" prop="introduction">
|
||||
<el-input v-model="formData.introduction" clearable placeholder="请输入简介" :readonly="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码" prop="phone">
|
||||
<el-input v-model="formData.phone" clearable placeholder="请输入手机号码" :readonly="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="详细地址" prop="detailed_address">
|
||||
<el-input v-model="formData.detailed_address" clearable placeholder="请输入详细地址" :readonly="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="门店logo" prop="image">
|
||||
<material-picker v-model="formData.image" :limit="1" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示" prop="is_show">
|
||||
<el-radio-group v-model="formData.is_show">
|
||||
<el-radio :label="1">显示</el-radio>
|
||||
<el-radio :label="0">隐藏</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="systemStoreEdit">
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apiSystemStoreAdd, apiSystemStoreEdit, apiSystemStoreDetail } from '@/api/system_store'
|
||||
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: '',
|
||||
introduction: '',
|
||||
phone: '',
|
||||
detailed_address: '',
|
||||
image: '',
|
||||
is_show: 1,
|
||||
})
|
||||
|
||||
|
||||
// 表单验证
|
||||
const formRules = reactive<any>({
|
||||
name: [{
|
||||
required: true,
|
||||
message: '请输入门店名称',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
phone: [{
|
||||
required: true,
|
||||
message: '请输入手机号码',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
detailed_address: [{
|
||||
required: true,
|
||||
message: '请输入详细地址',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
image: [{
|
||||
required: true,
|
||||
message: '请输入门店logo',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
latitude: [{
|
||||
required: true,
|
||||
message: '请输入纬度',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
longitude: [{
|
||||
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 apiSystemStoreDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
|
||||
// 提交按钮
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data = { ...formData, }
|
||||
mode.value == 'edit'
|
||||
? await apiSystemStoreEdit(data)
|
||||
: await apiSystemStoreAdd(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>
|
|
@ -0,0 +1,142 @@
|
|||
<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="phone">
|
||||
<el-input class="w-[280px]" v-model="queryParams.phone" 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="['system_store.system_store/add']" type="primary" @click="handleAdd">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['system_store.system_store/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="name" show-overflow-tooltip />
|
||||
<el-table-column label="手机号码" prop="phone" show-overflow-tooltip />
|
||||
<el-table-column label="详细地址" prop="detailed_address" show-overflow-tooltip />
|
||||
<el-table-column label="门店logo" prop="image" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-image :src="row.image" class="w-[50px] h-[50px]" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否显示" prop="is_show" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.is_show ? '显示' : '隐藏' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-perms="['system_store.system_store/edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['system_store.system_store/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="systemStoreLists">
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import { apiSystemStoreLists, apiSystemStoreDelete } from '@/api/system_store'
|
||||
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({
|
||||
name: '',
|
||||
phone: ''
|
||||
})
|
||||
|
||||
// 选中数据
|
||||
const selectData = ref<any[]>([])
|
||||
|
||||
// 表格选择后回调事件
|
||||
const handleSelectionChange = (val: any[]) => {
|
||||
selectData.value = val.map(({ id }) => id)
|
||||
}
|
||||
|
||||
// 获取字典数据
|
||||
const { dictData } = useDictData('')
|
||||
|
||||
// 分页相关
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
fetchFun: apiSystemStoreLists,
|
||||
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 apiSystemStoreDelete({ id })
|
||||
getLists()
|
||||
}
|
||||
|
||||
getLists()
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue