This commit is contained in:
weipengfei 2024-05-11 11:16:23 +08:00
commit 7ab75f7562
19 changed files with 1076 additions and 579 deletions

View File

@ -1,5 +1,5 @@
NODE_ENV = 'development'
VITE_NOW_TYPE = 'dist'
# Base API
# VITE_APP_BASE_URL='http://192.168.1.14:8546'
VITE_APP_BASE_URL='https://erp.lihaink.cn'
VITE_APP_BASE_URL='http://192.168.1.14:8546'
# VITE_APP_BASE_URL='https://erp.lihaink.cn'

View File

@ -1,3 +1,5 @@
## 注意注意!
# 需要将打包后的文件移入admin/目录下, 否则无法正常访问
# 需要将打包后的文件移入 admin/目录下, 否则无法正常访问
# 我不打包,你一个人打包

View File

@ -12,7 +12,7 @@
<!-- 自定义内容 -->
<slot>{{ content }}</slot>
<!-- 底部弹窗页脚 -->
<template #footer>
<template #footer v-if="bottomBtn">
<div class="dialog-footer">
<el-button v-if="cancelButtonText" @click="handleEvent('cancel')">
{{ cancelButtonText }}
@ -77,6 +77,10 @@ export default defineComponent({
customClass: {
type: String,
default: ''
},
bottomBtn: {
type: Boolean,
default: true
}
},
emits: ['confirm', 'cancel', 'close', 'open'],

View File

@ -0,0 +1,196 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :async="true" width="60vw" @close="handleClose" :bottom-btn="false">
<el-descriptions class="margin-top" :title="popupTitle" :column="3" border>
<el-descriptions-item label="商户头像">
<material-picker v-model="formData.mer_avatar" disabled />
</el-descriptions-item>
<el-descriptions-item label="商户名称">
{{ formData.mer_name }}
</el-descriptions-item>
<el-descriptions-item label="商户分类">
<dict-value :options="dictData.mer_category_type" :value="formData.category_id" />
</el-descriptions-item>
<el-descriptions-item label="店铺类型">
<dict-value :options="dictData.merchat_type" :value="formData.type_id" />
</el-descriptions-item>
<el-descriptions-item label="店主姓名">
<dict-value :options="dictData.service_user" :value="formData.type_id" />
</el-descriptions-item>
<el-descriptions-item label="是否支持先货后款">
<dict-value :options="dictData.show_status" :value="formData.credit_buy" />
</el-descriptions-item>
<el-descriptions-item label="结算周期(天)">
{{ formData.settle_cycle }}
</el-descriptions-item>
<el-descriptions-item label="利率">
{{ formData.interest_rate }}
</el-descriptions-item>
<el-descriptions-item label="城市">
{{ formData.city_name }}
</el-descriptions-item>
<el-descriptions-item label="区县">
{{ formData.area_name }}
</el-descriptions-item>
<el-descriptions-item label="镇街">
{{ formData.street_name }}
</el-descriptions-item>
<el-descriptions-item label="村">
{{ formData.village_name }}
</el-descriptions-item>
<el-descriptions-item label="商户地址">
{{ formData.mer_address }}
</el-descriptions-item>
<el-descriptions-item label="排序">
{{ formData.sort }}
</el-descriptions-item>
<el-descriptions-item label="商户是否禁用">
<dict-value :options="dictData.show_status" :value="formData.status" />
</el-descriptions-item>
<el-descriptions-item label="提成比例">
{{ formData.commission_rate }}
</el-descriptions-item>
<el-descriptions-item label="商户手续费单独设置">
<dict-value :options="dictData.show_status" :value="formData.commission_switch" />
</el-descriptions-item>
<el-descriptions-item label="经度">
{{ formData.long }}
</el-descriptions-item>
<el-descriptions-item label="纬度">
{{ formData.lat }}
</el-descriptions-item>
<el-descriptions-item label="店铺电话">
{{ formData.service_phone }}
</el-descriptions-item>
<el-descriptions-item label="商户余额">
{{ formData.mer_money }}
</el-descriptions-item>
<el-descriptions-item label="商户备注">
{{ formData.mark }}
</el-descriptions-item>
<el-descriptions-item label="银行卡转账信息">
{{ formData.financial_bank }}
</el-descriptions-item>
<el-descriptions-item label="微信转账信息">
{{ formData.financial_wechat }}
</el-descriptions-item>
<el-descriptions-item label="支付宝转账信息">
{{ formData.financial_alipay }}
</el-descriptions-item>
<el-descriptions-item label="默认使用类型">
<dict-value :options="dictData.financial_type" :value="formData.financial_type" />
</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({
financial_type: "",
mer_id: '',
category_id: '',
type_id: '',
mer_name: '',
service_user: "",
credit_buy: '',
settle_cycle: '',
interest_rate: '',
province_id: '510000',
city_id: '',
city_name: '',
area_id: '',
area_name: '',
street_id: '',
street_name: '',
village_id: '',
village_name: '',
mer_address: '',
mer_avatar: '',
mark: '',
sort: '',
status: '',
commission_rate: '',
commission_switch: '',
long: '',
lat: '',
service_phone: '',
mer_money: '',
financial_bank: '',
financial_wechat: '',
financial_alipay: '',
})
//
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

@ -115,12 +115,12 @@
</template>
</el-table-column>
<el-table-column label="商户名称" prop="mer_name" show-overflow-tooltip />
<el-table-column label="是否支持先货后款" prop="credit_buy">
<el-table-column label="是否支持先货后款" prop="credit_buy" width="160">
<template #default="{ row }">
<dict-value :options="dictData.show_status" :value="row.credit_buy" />
</template>
</el-table-column>
<el-table-column label="结算周期(天)" prop="settle_cycle" show-overflow-tooltip />
<el-table-column label="结算周期(天)" prop="settle_cycle" width="120" show-overflow-tooltip />
<el-table-column label="利率" prop="interest_rate" show-overflow-tooltip />
<el-table-column label="城市" prop="city_name" show-overflow-tooltip />
<el-table-column label="区县" prop="area_name" show-overflow-tooltip />
@ -132,10 +132,10 @@
<el-table-column label="提成比例" prop="commission_rate" show-overflow-tooltip />
<el-table-column label="店铺电话" prop="service_phone" show-overflow-tooltip />
<el-table-column label="商户余额" prop="mer_money" show-overflow-tooltip />
<el-table-column label="银行卡转账信息" prop="financial_bank" show-overflow-tooltip />
<el-table-column label="微信转账信息" prop="financial_wechat" show-overflow-tooltip />
<el-table-column label="支付宝转账信息" prop="financial_alipay" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<el-table-column label="银行卡转账信息" prop="financial_bank" width="140" show-overflow-tooltip />
<el-table-column label="微信转账信息" prop="financial_wechat" width="140" show-overflow-tooltip />
<el-table-column label="支付宝转账信息" prop="financial_alipay" width="160" show-overflow-tooltip />
<el-table-column label="操作" width="170" fixed="right">
<template #default="{ row }">
<el-button v-perms="['merchat.merchant/edit']" type="primary" link @click="handleEdit(row)">
编辑
@ -144,6 +144,9 @@
@click="handleDelete(row.mer_id)">
删除
</el-button>
<el-button link @click="handleDetail(row)">
详情
</el-button>
</template>
</el-table-column>
</el-table>
@ -153,20 +156,25 @@
</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="merchantLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiMerchantLists, apiMerchantDelete } from '@/api/merchant'
import { timeFormat } from '@/utils/util'
import { apiMerchantLists, apiMerchantDelete, apiMerchantDetail } from '@/api/merchant'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailPopup from './detail.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const showDetail = ref(false)
//
@ -223,6 +231,15 @@ const handleDelete = async (mer_id: number | any[]) => {
getLists()
}
//
const handleDetail = async (data) => {
// let res = await apiMerchantDetail({ mer_id })
showDetail.value = true
await nextTick()
detailRef.value?.open('edit')
detailRef.value?.setFormData(data)
}
getLists()
</script>

View File

@ -0,0 +1,186 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :async="true" width="60vw" @close="handleClose" :bottom-btn="false">
<el-descriptions class="margin-top" :title="popupTitle" :column="3" border>
<el-descriptions-item label="商户头像">
<material-picker v-model="formData.mer_avatar" disabled />
</el-descriptions-item>
<el-descriptions-item label="商户名称">
{{ formData.mer_name }}
</el-descriptions-item>
<el-descriptions-item label="商户分类">
<dict-value :options="dictData.mer_category_type" :value="formData.category_id" />
</el-descriptions-item>
<el-descriptions-item label="店铺类型">
<dict-value :options="dictData.merchat_type" :value="formData.type_id" />
</el-descriptions-item>
<el-descriptions-item label="结算周期(天)">
{{ formData.settle_cycle }}
</el-descriptions-item>
<el-descriptions-item label="利率">
{{ formData.interest_rate }}
</el-descriptions-item>
<el-descriptions-item label="标签">
{{ formData.sys_labels_text }}
</el-descriptions-item>
<el-descriptions-item label="城市">
{{ formData.city_name }}
</el-descriptions-item>
<el-descriptions-item label="区县">
{{ formData.area_name }}
</el-descriptions-item>
<el-descriptions-item label="镇街">
{{ formData.street_name }}
</el-descriptions-item>
<el-descriptions-item label="村">
{{ formData.village_name }}
</el-descriptions-item>
<el-descriptions-item label="商户地址">
{{ formData.mer_address }}
</el-descriptions-item>
<el-descriptions-item label="商户是否禁用">
<dict-value :options="dictData.show_status" :value="formData.status" />
</el-descriptions-item>
<el-descriptions-item label="提成比例">
{{ formData.commission_rate }}
</el-descriptions-item>
<el-descriptions-item label="商户手续费单独设置">
<dict-value :options="dictData.show_status" :value="formData.commission_switch" />
</el-descriptions-item>
<el-descriptions-item label="经度">
{{ formData.long }}
</el-descriptions-item>
<el-descriptions-item label="纬度">
{{ formData.lat }}
</el-descriptions-item>
<el-descriptions-item label="店铺电话">
{{ formData.service_phone }}
</el-descriptions-item>
<el-descriptions-item label="商户余额">
{{ formData.mer_money }}
</el-descriptions-item>
<el-descriptions-item label="银行卡转账信息">
{{ formData.financial_bank }}
</el-descriptions-item>
<el-descriptions-item label="微信转账信息">
{{ formData.financial_wechat }}
</el-descriptions-item>
<el-descriptions-item label="支付宝转账信息">
{{ formData.financial_alipay }}
</el-descriptions-item>
<el-descriptions-item label="默认使用类型">
<dict-value :options="dictData.financial_type" :value="formData.financial_type" />
</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: '',
category_id: '',
type_id: '',
mer_name: '',
settle_cycle: '',
interest_rate: '',
sys_labels: [],
sys_labels_text: '',
province_id: '510000',
city_id: '',
city_name: "",
area_id: '',
area_name: '',
street_id: '',
street_name: '',
village_id: '',
village_name: '',
mer_address: '',
mer_avatar: '',
mark: '',
status: '',
commission_rate: '',
commission_switch: '',
long: '',
lat: '',
service_phone: '',
mer_money: '',
financial_bank: '',
financial_wechat: '',
financial_alipay: '',
financial_type: '',
})
//
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

@ -1,177 +0,0 @@
<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="商户分类 id" prop="category_id">
<el-input v-model="formData.category_id" clearable placeholder="请输入商户分类 id" :readonly="true" />
</el-form-item>
<el-form-item label="店铺类型 id" prop="type_id">
<el-input v-model="formData.type_id" clearable placeholder="请输入店铺类型 id" :readonly="true" />
</el-form-item>
<el-form-item label="商户名称" prop="mer_name">
<el-input v-model="formData.mer_name" clearable placeholder="请输入商户名称" :readonly="true" />
</el-form-item>
<el-form-item label="结算周期,单位天" prop="settle_cycle">
<el-input v-model="formData.settle_cycle" clearable placeholder="请输入结算周期(天)" :readonly="true" />
</el-form-item>
<el-form-item label="利率" prop="interest_rate">
<el-input v-model="formData.interest_rate" clearable placeholder="请输入利率" :readonly="true" />
</el-form-item>
<el-form-item label="标签" prop="sys_labels">
<el-input v-model="formData.sys_labels" clearable placeholder="请输入标签" :readonly="true" />
</el-form-item>
<el-form-item label="城市code" prop="city_id">
<el-input v-model="formData.city_id" clearable placeholder="请输入城市code" :readonly="true" />
</el-form-item>
<el-form-item label="区县code" prop="area_id">
<el-input v-model="formData.area_id" clearable placeholder="请输入区县code" :readonly="true" />
</el-form-item>
<el-form-item label="镇街表code" prop="street_id">
<el-input v-model="formData.street_id" clearable placeholder="请输入镇街表code" :readonly="true" />
</el-form-item>
<el-form-item label="村code" prop="village_id">
<el-input v-model="formData.village_id" clearable placeholder="请输入村code" :readonly="true" />
</el-form-item>
<el-form-item label="商户地址" prop="mer_address">
<el-input v-model="formData.mer_address" clearable placeholder="请输入商户地址" :readonly="true" />
</el-form-item>
<el-form-item label="商户头像" prop="mer_avatar">
<el-input v-model="formData.mer_avatar" clearable placeholder="请输入商户头像" :readonly="true" />
</el-form-item>
<el-form-item label="商户备注" prop="mark">
<el-input v-model="formData.mark" clearable placeholder="请输入商户备注" :readonly="true" />
</el-form-item>
<el-form-item label="商户是否禁用0锁定,1正常" prop="status">
<el-radio-group v-model="formData.status" placeholder="请选择商户是否禁用" :disabled="true">
<el-radio v-for="(item, index) in dictData.show_status" :key="index" :label="parseInt(item.value)">
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="提成比例" prop="commission_rate">
<el-input v-model="formData.commission_rate" clearable placeholder="请输入提成比例" :readonly="true" />
</el-form-item>
<el-form-item label="商户手续费单独设置 0 关闭 1 开启" prop="commission_switch">
<el-radio-group v-model="formData.commission_switch" placeholder="请选择商户手续费单独设置 0 关闭 1 开启"
:disabled="true">
<el-radio v-for="(item, index) in dictData.show_status" :key="index" :label="parseInt(item.value)">
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="经度" prop="long">
<el-input v-model="formData.long" clearable placeholder="请输入经度" :readonly="true" />
</el-form-item>
<el-form-item label="纬度" prop="lat">
<el-input v-model="formData.lat" clearable placeholder="请输入纬度" :readonly="true" />
</el-form-item>
<el-form-item label="店铺电话" prop="service_phone">
<el-input v-model="formData.service_phone" clearable placeholder="请输入店铺电话" :readonly="true" />
</el-form-item>
<el-form-item label="商户余额" prop="mer_money">
<el-input v-model="formData.mer_money" clearable placeholder="请输入商户余额" :readonly="true" />
</el-form-item>
<el-form-item label="银行卡转账信息" prop="financial_bank">
<el-input v-model="formData.financial_bank" clearable placeholder="请输入银行卡转账信息" :readonly="true" />
</el-form-item>
<el-form-item label="微信转账信息" prop="financial_wechat">
<el-input v-model="formData.financial_wechat" clearable placeholder="请输入微信转账信息" :readonly="true" />
</el-form-item>
<el-form-item label="支付宝转账信息" prop="financial_alipay">
<el-input v-model="formData.financial_alipay" clearable placeholder="请输入支付宝转账信息" :readonly="true" />
</el-form-item>
<el-form-item label="默认使用类型" prop="financial_type">
<el-input v-model="formData.financial_type" clearable placeholder="请输入默认使用类型" :readonly="true" />
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="supplierDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiSupplierAdd, apiSupplierEdit, apiSupplierDetail } from '@/api/supplier'
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: '',
category_id: '',
type_id: '',
mer_name: '',
settle_cycle: '',
interest_rate: '',
sys_labels: '',
city_id: '',
area_id: '',
street_id: '',
village_id: '',
mer_address: '',
mer_avatar: '',
mark: '',
status: '',
commission_rate: '',
commission_switch: '',
long: '',
lat: '',
service_phone: '',
mer_money: '',
financial_bank: '',
financial_wechat: '',
financial_alipay: '',
financial_type: '',
})
//
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 apiSupplierDetail({
id: row.id
})
setFormData(data)
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -77,7 +77,7 @@
</template>
</el-table-column>
<el-table-column label="商户余额" prop="mer_money" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<el-table-column label="操作" width="170" fixed="right">
<template #default="{ row }">
<el-button v-perms="['supplier.supplier/edit']" type="primary" link @click="handleEdit(row)">
编辑
@ -86,6 +86,9 @@
@click="handleDelete(row.id)">
删除
</el-button>
<el-button link @click="handleDetail(row.id)">
详情
</el-button>
</template>
</el-table-column>
</el-table>
@ -95,20 +98,25 @@
</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="supplierLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiSupplierLists, apiSupplierDelete } from '@/api/supplier'
import { apiSupplierLists, apiSupplierDelete, apiSupplierDetail } from '@/api/supplier'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailPopup from './detail.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const showDetail = ref(false)
//
@ -157,6 +165,15 @@ const handleDelete = async (id: number | any[]) => {
getLists()
}
//
const handleDetail = async (id: any) => {
let res = await apiSupplierDetail({ id })
showDetail.value = true
await nextTick()
detailRef.value?.open('edit')
detailRef.value?.setFormData(res)
}
getLists()
</script>

View File

@ -0,0 +1,112 @@
<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.data }}
</el-descriptions-item>
<el-descriptions-item label="扩展信息">
{{ formData.more }}
</el-descriptions-item>
<el-descriptions-item label="图片">
<material-picker v-model="formData.pic" disabled />
</el-descriptions-item>
<el-descriptions-item label="排序">
{{ formData.sort }}
</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: '',
more: '',
pic: '',
sort: '',
})
//
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

@ -51,7 +51,7 @@
</template>
</el-table-column>
<el-table-column label="排序" prop="sort" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<el-table-column label="操作" width="170" fixed="right">
<template #default="{ row }">
<el-button v-perms="['goods.brand/edit']" type="primary" link @click="handleEdit(row)">
编辑
@ -59,6 +59,9 @@
<el-button v-perms="['goods.brand/delete']" type="danger" link @click="handleDelete(row.id)">
删除
</el-button>
<el-button v-perms="['goods.brand/delete']" link @click="handleDetail(row.id)">
详情
</el-button>
</template>
</el-table-column>
</el-table>
@ -68,20 +71,24 @@
</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="brandLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiBrandLists, apiBrandDelete } from '@/api/brand'
import { timeFormat } from '@/utils/util'
import { apiBrandLists, apiBrandDelete, apiBrandDetail } from '@/api/brand'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailPopup from './detail.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const showDetail = ref(false)
//
@ -127,6 +134,14 @@ const handleEdit = async (data: any) => {
editRef.value?.setFormData(data)
}
//
const handleDetail = async (id: any) => {
let res = await apiBrandDetail({ id })
showDetail.value = true
await nextTick()
detailRef.value?.open('edit')
detailRef.value?.setFormData(res)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')

View File

@ -0,0 +1,111 @@
<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.code }}
</el-descriptions-item>
<el-descriptions-item label="条码类型">
<dict-value :options="dictData.code_type" :value="formData.type" />
</el-descriptions-item>
<el-descriptions-item label="备注信息">
{{ formData.data }}
</el-descriptions-item>
<el-descriptions-item label="扩展信息">
{{ formData.more }}
</el-descriptions-item>
<el-descriptions-item label="排序">
{{ formData.sort }}
</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: '',
code: '',
type: '',
data: '',
more: '',
sort: '',
})
//
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

@ -1,114 +0,0 @@
<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="py">
<el-input v-model="formData.py" clearable placeholder="请输入拼音信息" :readonly="true"/>
</el-form-item>
<el-form-item label="条码内容" prop="code">
<el-input v-model="formData.code" clearable placeholder="请输入条码内容" :readonly="true"/>
</el-form-item>
<el-form-item label="条码类型" prop="type">
<el-select class="flex-1" v-model="formData.type" clearable placeholder="请选择条码类型" :disabled="true">
<el-option
v-for="(item, index) in dictData.code_type"
:key="index"
:label="item.name"
:value="parseInt(item.value)"
/>
</el-select>
</el-form-item>
<el-form-item label="备注信息" prop="data">
<el-input v-model="formData.data" clearable placeholder="请输入备注信息" :readonly="true"/>
</el-form-item>
<el-form-item label="扩展信息" prop="more">
<el-input v-model="formData.more" clearable placeholder="请输入扩展信息" :readonly="true"/>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="formData.sort" clearable placeholder="请输入排序" :readonly="true"/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="codeDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCodeAdd, apiCodeEdit, apiCodeDetail } from '@/api/code'
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: '',
py: '',
code: '',
type: '',
data: '',
more: '',
sort: '',
})
//
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 apiCodeDetail({
id: row.id
})
setFormData(data)
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -58,17 +58,17 @@
<el-table-column label="备注信息" prop="data" show-overflow-tooltip />
<el-table-column label="扩展信息" prop="more" show-overflow-tooltip />
<el-table-column label="排序" prop="sort" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<el-table-column label="操作" width="170" fixed="right">
<template #default="{ row }">
<el-button v-perms="['goods.code/edit']" type="primary" link @click="handleEdit(row)">
编辑
</el-button>
<el-button type="primary" link @click="handleDetails(row)">
详情
</el-button>
<el-button v-perms="['goods.code/delete']" type="danger" link @click="handleDelete(row.id)">
删除
</el-button>
<el-button link @click="handleDetail(row.id)">
详情
</el-button>
</template>
</el-table-column>
</el-table>
@ -78,25 +78,25 @@
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
<detail-popup v-if="detailEdit" ref="detailRef" :dict-data="dictData" @success="getLists"
@close="detailEdit = false" />
<DetailPopup v-if="showDetail" ref="detailRef" :dict-data="dictData" @success="getLists"
@close="showDetail = false" />
</div>
</template>
<script lang="ts" setup name="codeLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiCodeLists, apiCodeDelete } from '@/api/code'
import { timeFormat } from '@/utils/util'
import { apiCodeLists, apiCodeDelete, apiCodeDetail } from '@/api/code'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailPopup from './details.vue'
import DetailPopup from './detail.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = shallowRef<InstanceType<typeof DetailPopup>>()
const detailRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const detailEdit = ref(false)
const showDetail = ref(false)
//
@ -150,6 +150,16 @@ const handleDetails = async (data: any) => {
detailRef.value?.setFormData(data)
}
//
const handleDetail = async (id: any) => {
let res = await apiCodeDetail({ id })
showDetail.value = true
await nextTick()
detailRef.value?.open('edit')
detailRef.value?.setFormData(res)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')

View File

@ -0,0 +1,111 @@
<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.code }}
</el-descriptions-item>
<el-descriptions-item label="条码类型">
<dict-value :options="dictData.code_type" :value="formData.type" />
</el-descriptions-item>
<el-descriptions-item label="备注信息">
{{ formData.data }}
</el-descriptions-item>
<el-descriptions-item label="扩展信息">
{{ formData.more }}
</el-descriptions-item>
<el-descriptions-item label="排序">
{{ formData.sort }}
</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: '',
code: '',
type: '',
data: '',
more: '',
sort: '',
})
//
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,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.data }}
</el-descriptions-item>
<el-descriptions-item label="扩展信息">
{{ formData.more }}
</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: '',
more: '',
})
//
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

@ -42,7 +42,7 @@
<el-table-column label="单位编号" prop="number" show-overflow-tooltip />
<el-table-column label="备注信息" prop="data" show-overflow-tooltip />
<el-table-column label="扩展信息" prop="more" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<el-table-column label="操作" width="170" fixed="right">
<template #default="{ row }">
<el-button v-perms="['goods.unit/edit']" type="primary" link @click="handleEdit(row)">
编辑
@ -50,6 +50,9 @@
<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>
@ -59,20 +62,24 @@
</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 { apiUnitLists, apiUnitDelete } from '@/api/unit'
import { timeFormat } from '@/utils/util'
import { apiUnitLists, apiUnitDelete, apiUnitDetail } from '@/api/unit'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailPopup from './detail.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const showDetail = ref(false)
//
@ -116,6 +123,15 @@ const handleEdit = async (data: any) => {
editRef.value?.setFormData(data)
}
//
const handleDetail = async (id: any) => {
let res = await apiUnitDetail({ id })
showDetail.value = true
await nextTick()
detailRef.value?.open('edit')
detailRef.value?.setFormData(res)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')

View File

@ -0,0 +1,140 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :async="true" width="60vw" @close="handleClose" :bottom-btn="false">
<el-descriptions class="margin-top" :title="popupTitle" :column="3" border>
<el-descriptions-item label="所属商户">
<material-picker v-model="formData.merchant" disabled />
</el-descriptions-item>
<el-descriptions-item label="客户">
{{ formData.user_name }}
</el-descriptions-item>
<el-descriptions-item label="单据时间">
{{ formData.create_time }}
</el-descriptions-item>
<el-descriptions-item label="单据编号">
{{ formData.number }}
</el-descriptions-item>
<el-descriptions-item label="单据金额">
{{ formData.total }}
</el-descriptions-item>
<el-descriptions-item label="抵扣金额">
{{ formData.deduction_price }}
</el-descriptions-item>
<el-descriptions-item label="实际金额">
{{ formData.actual }}
</el-descriptions-item>
<el-descriptions-item label="实收金额">
{{ formData.money }}
</el-descriptions-item>
<el-descriptions-item label="支付方式">
<dict-value :options="dictData.pay_type" :value="formData.pay_type" />
</el-descriptions-item>
<el-descriptions-item label="审核状态">
<dict-value :options="dictData.auditing_type" :value="formData.type" />
</el-descriptions-item>
<el-descriptions-item label="审核人">
{{ formData.auditinguser_name }}
</el-descriptions-item>
<el-descriptions-item label="审核时间">
{{ formData.auditingtime }}
</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: '',
merchant: '',
user_name: "",
create_time: "",
store_id: '',
customer: '',
time: '',
number: '',
total: '',
deduction_price: '',
actual: '',
money: '',
pay_type: '',
data: '',
type: '',
auditinguser: '',
auditinguser_name: "",
auditingtime: '',
more: '',
})
//
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

@ -1,251 +0,0 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="60vw" @confirm="handleSubmit" @close="handleClose">
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules" disabled>
<el-row>
<el-col :span="8">
<el-form-item label="所属商户" prop="merchant">
<el-input v-model="formData.merchant" clearable placeholder="请输入所属商户" :readonly="false" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="归属门店" prop="store_id">
<el-input v-model="formData.store_id" clearable placeholder="请输入归属门店" :readonly="false" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="客户ID" prop="customer">
<el-input v-model="formData.customer" clearable placeholder="请输入客户ID" :readonly="false" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单据时间" prop="time">
<!-- <el-input v-model="formData.time" clearable placeholder="请输入单据时间" :readonly="false" /> -->
<el-date-picker :readonly="false" class="flex-1 !flex" v-model="formData.time" clearable
type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="选择单据时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单据编号" prop="number">
<el-input v-model="formData.number" clearable placeholder="请输入单据编号" :readonly="false" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单据金额" prop="total">
<el-input v-model="formData.total" type="number" clearable placeholder="请输入单据金额"
:readonly="false" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="抵扣金额" prop="deduction_price">
<el-input v-model="formData.deduction_price" clearable placeholder="请输入抵扣金额"
:readonly="false" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实际金额" prop="actual">
<el-input v-model="formData.actual" type="number" clearable placeholder="请输入实际金额"
:readonly="false" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实收金额" prop="money">
<el-input v-model="formData.money" type="number" clearable placeholder="请输入实收金额"
:readonly="false" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="支付方式 " prop="pay_type">
<el-select class="flex-1" v-model="formData.pay_type" clearable placeholder="请选择支付方式"
:disabled="false">
<el-option v-for="(item, index) in dictData.pay_type" :key="index" :label="item.name"
:value="parseInt(item.value)" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注信息" prop="data">
<el-input v-model="formData.data" clearable placeholder="请输入备注信息" type="textarea"
:readonly="false" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="审核状态" prop="type">
<el-radio-group v-model="formData.type" placeholder="请选择审核状态" :disabled="false">
<el-radio v-for="(item, index) in dictData.auditing_type" :key="index"
:label="parseInt(item.value)">
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="审核人" prop="auditinguser">
<el-input v-model="formData.auditinguser" clearable placeholder="请输入审核人" :readonly="false" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="审核时间" prop="auditingtime">
<el-date-picker :readonly="false" class="flex-1 !flex" v-model="formData.auditingtime" clearable
type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="选择审核时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="扩展信息" prop="more">
<el-input v-model="formData.more" clearable placeholder="请输入扩展信息" type="textarea"
:readonly="false" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="cashierclassEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCashierclassAdd, apiCashierclassEdit, apiCashierclassDetail } from '@/api/cashierclass'
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: '',
merchant: '',
store_id: '',
customer: '',
time: '',
number: '',
total: '',
deduction_price: '',
actual: '',
money: '',
pay_type: '',
data: '',
type: '',
auditinguser: '',
auditingtime: '',
more: '',
})
//
const formRules = reactive<any>({
merchant: [{
required: true,
message: '请输入所属商户',
trigger: ['blur']
}],
customer: [{
required: true,
message: '请输入客户ID',
trigger: ['blur']
}],
time: [{
required: true,
message: '请输入单据时间',
trigger: ['blur']
}],
number: [{
required: true,
message: '请输入单据编号',
trigger: ['blur']
}],
total: [{
required: true,
message: '请输入单据金额',
trigger: ['blur']
}],
actual: [{
required: true,
message: '请输入实际金额',
trigger: ['blur']
}],
money: [{
required: true,
message: '请输入实收金额',
trigger: ['blur']
}],
pay_type: [{
required: true,
message: '请选择支付方式 0余额 1微信 2小程序 3 h5 4支付宝 5 支付宝扫码 6 微信扫码 8先货后款 10对公转账',
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]
}
}
//@ts-ignore
formData.auditingtime = timeFormat(formData.auditingtime, 'yyyy-mm-dd hh:MM:ss')
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiCashierclassDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiCashierclassEdit(data)
: await apiCashierclassAdd(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

@ -94,8 +94,7 @@
@click="handleDelete(row.id)">
删除
</el-button> -->
<el-button v-perms="['retail.cashierclass/edit']" type="primary" link
@click="handleDetail(row)">
<el-button link @click="handleDetail(row)">
详情
</el-button>
</template>
@ -107,7 +106,7 @@
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
<detail-popup v-if="showDetail" ref="detailRef" :dict-data="dictData" @success="getLists"
<DetailPopup v-if="showDetail" ref="detailRef" :dict-data="dictData" @success="getLists"
@close="showDetail = false" />
</div>
</template>
@ -119,7 +118,7 @@ import { apiCashierclassLists, apiCashierclassDelete, apiCashierclassAuditing }
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailPopup from './details.vue'
import DetailPopup from './detail.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = shallowRef<InstanceType<typeof EditPopup>>()
@ -173,7 +172,7 @@ const handleEdit = async (data: any) => {
}
//
const handleDetail = async (data: any) => {
const handleDetail = async (data) => {
showDetail.value = true
await nextTick()
detailRef.value?.open('edit')