This commit is contained in:
weipengfei 2024-05-10 17:42:39 +08:00
commit 47249a333f
14 changed files with 599 additions and 136 deletions

View File

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

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

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 仓库信息表列表
export function apigetProvinceLists() {
return request.get({ url: '/geo/province' })
}
// 仓库信息表列表
export function apicityLists(params: any) {
return request.get({ url: '/geo/city', params })
}
// 仓库信息表列表
export function apiAreaLists(params: any) {
return request.get({ url: '/geo/area', params })
}
// 仓库信息表列表
export function apiStreetLists(params: any) {
return request.get({ url: '/geo/street', params })
}
// 仓库信息表列表
export function apiVillageLists(params: any) {
return request.get({ url: '/geo/village', params })
}

View File

@ -23,4 +23,9 @@ export function apiCashierclassDelete(params: any) {
// 零售单详情 // 零售单详情
export function apiCashierclassDetail(params: any) { export function apiCashierclassDetail(params: any) {
return request.get({ url: '/retail/cashierclass/detail', params }) return request.get({ url: '/retail/cashierclass/detail', params })
}
// 零售单详情
export function apiCashierclassAuditing(params: any) {
return request.post({ url: '/retail/cashierclass/auditing', params })
} }

View File

@ -0,0 +1,39 @@
interface Iconfig {
/** 请求列表的接口*/
fetchFn: Function;
/**用户可搜索的内容select为下拉列表,select为数组时为自定义option,w为string时表示获取字典里的值 */
serchList: Array<{
label: String;
value: String;
select?: Array<{ name: string; value: string | Number }> | String;
}>;
/**需要的字典数据隔开的string */
dictData?: String;
/**table配置 */
tableList: Array<Object>;
}
import { apiGoodsLabelLists } from '@/api/goods_label'
export const goods_label: Iconfig = {
fetchFn: apiGoodsLabelLists,
serchList: [
// {
// label: "项目名称",
// value: "project_name",
// },
// {
// label: "项目编号",
// value: "project_code",
// },
],
tableList: [
{ id: "ID" },
{ name: "标签名" },
],
};

View File

@ -0,0 +1,117 @@
<template>
<div>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item :label="item.label" v-for="(item, index) in config.serchList" :key="index">
<el-select v-model="queryParams[item.value]" v-if="item.select" :disabled="isDisabled(item.value)">
<el-option :label="i.name" :value="i.value" v-for="i in item.select"
v-if="Array.isArray(item.select)"></el-option>
<el-option v-for="(i, index) in dictData[item.select]" :key="index" :label="i.name"
:value="parseInt(i.value)" v-else />
</el-select>
<el-input class="w-[280px]" v-model="queryParams[item.value]" clearable
:placeholder="`请输入${item.label}`" v-else />
</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>
<div class="mt-4">
<el-table :data="pager.lists" @cell-click="handleCurrentChange" row-key="id"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" v-if="multipleChoice" />
<el-table-column :label="item[(Object.keys(item))[0]]" show-overflow-tooltip
v-for="item in config.tableList ">
<template #default="{ row }">
{{ (Object.keys(item))[0].includes('.') ?
row[(Object.keys(item))[0].split(".")[0]][(Object.keys(item))[0].split(".")[1]] :
row[(Object.keys(item))[0]] }}
</template>
</el-table-column>
</el-table>
</div>
<div class="flex justify-end mt-4">
<pagination v-model="pager" @change="getLists" />
</div>
<div class="flex justify-end mt-4" v-if="multipleChoice">
<el-button type="primary" @click="confirm">确定</el-button>
</div>
</el-card>
</div>
</template>
<script lang="ts" setup>
import { usePaging } from "@/hooks/usePaging"
import { defineEmits } from "vue"
import { useDictData } from '@/hooks/useDictOptions'
const props = defineProps({
config: {
type: Object,
required: true
},
query: Object,
multipleChoice: Boolean
})
/**根据传入的config生成queryParmas */
const getParmasFn = () => {
const arr = props.config.serchList.map((item: any) => (item.value))
const result = arr.reduce((acc: any, curr: any) => {
acc[curr] = '';
return acc;
}, {});
const mergedObj = Object.assign({}, result, props.query);
return mergedObj
}
/**判断是否需要disabled的搜索框*/
const isDisabled = (key: String) => {
if (!props.query) return
return Object.keys(props.query).includes(key)
}
//
const queryParams = reactive({
...getParmasFn()
});
const { dictData } = useDictData(props.config.dictData)
//
const emits = defineEmits(["customEvent"]);
//
const handleCurrentChange = (value: any) => {
if (props.multipleChoice) return
emits("customEvent", value);
};
//
const multipleSelection = ref([])
const handleSelectionChange = (val: any) => {
multipleSelection.value = val
}
const confirm = () => {
emits("customEvent", multipleSelection.value);
}
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: props.config.fetchFn,
params: queryParams,
});
getLists();
</script>

View File

@ -29,6 +29,14 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="店主姓名" prop="service_user">
<el-input v-model="formData.service_user" clearable placeholder="请输入店主姓名" />
</el-form-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="是否支持先货后款" prop="credit_buy"> <el-form-item label="是否支持先货后款" prop="credit_buy">
@ -42,7 +50,7 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="结算周期(天)" prop="settle_cycle"> <el-form-item label="结算周期(天)" prop="settle_cycle">
<el-input v-model="formData.settle_cycle" clearable placeholder="请输入结算周期,单位天" /> <el-input v-model="formData.settle_cycle" clearable placeholder="请输入结算周期" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -50,7 +58,10 @@
<el-input v-model="formData.interest_rate" clearable placeholder="请输入利率" /> <el-input v-model="formData.interest_rate" clearable placeholder="请输入利率" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<!-- <el-col :span="8">
<el-form-item label="城市" prop="city_id"> <el-form-item label="城市" prop="city_id">
<el-input v-model="formData.city_id" clearable placeholder="请输入城市" /> <el-input v-model="formData.city_id" clearable placeholder="请输入城市" />
</el-form-item> </el-form-item>
@ -69,6 +80,41 @@
<el-form-item label="村" prop="village_id"> <el-form-item label="村" prop="village_id">
<el-input v-model="formData.village_id" clearable placeholder="请输入村" /> <el-input v-model="formData.village_id" clearable placeholder="请输入村" />
</el-form-item> </el-form-item>
</el-col> -->
<el-col :span="8">
<el-form-item label="城市" prop="city_id">
<el-select class="flex-1" v-model="formData.city_id" clearable placeholder="请选择城市"
@change="getAreaList(formData.city_id)">
<el-option v-for="(item, index) in address.cityList" :key="index" :label="item.city_name"
:value="parseInt(item.city_code)" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="区县" prop="area_id">
<el-select class="flex-1" v-model="formData.area_id" clearable placeholder="请选择城市"
@change="getTownList(formData.area_id)">
<el-option v-for="(item, index) in address.areaList" :key="index" :label="item.area_name"
:value="parseInt(item.area_code)" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="镇街" prop="street_id">
<el-select class="flex-1" v-model="formData.street_id" clearable placeholder="请选择城市"
@change="getVilllageList(formData.street_id)">
<el-option v-for="(item, index) in address.townList" :key="index" :label="item.street_name"
:value="parseInt(item.street_code)" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="村" prop="village_id">
<el-select class="flex-1" v-model="formData.village_id" clearable placeholder="请选择城市">
<el-option v-for="(item, index) in address.villlageList" :key="index"
:label="item.village_name" :value="(item.village_code)" />
</el-select>
</el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="商户地址" prop="mer_address"> <el-form-item label="商户地址" prop="mer_address">
@ -76,11 +122,11 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="8"> <el-col :span="8">
<el-form-item label="" prop="sort"> <el-form-item label="排序" prop="sort">
<el-input v-model="formData.sort" clearable placeholder="请输入" /> <el-input v-model="formData.sort" clearable placeholder="请输入" />
</el-form-item> </el-form-item>
</el-col> --> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="商户是否禁用" prop="status"> <el-form-item label="商户是否禁用" prop="status">
<el-radio-group v-model="formData.status" placeholder="请选择商户是否禁用"> <el-radio-group v-model="formData.status" placeholder="请选择商户是否禁用">
@ -146,6 +192,14 @@
<el-input v-model="formData.financial_alipay" clearable placeholder="请输入支付宝转账信息" /> <el-input v-model="formData.financial_alipay" clearable placeholder="请输入支付宝转账信息" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="默认使用类型" prop="financial_type">
<el-select class="flex-1" v-model="formData.financial_type" clearable placeholder="请选择默认使用类型">
<el-option v-for="(item, index) in dictData.financial_type" :key="index" :label="item.name"
:value="parseInt(item.value)" />
</el-select>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
</popup> </popup>
@ -156,7 +210,8 @@
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue' import Popup from '@/components/popup/index.vue'
import { apiMerchantAdd, apiMerchantEdit, apiMerchantDetail } from '@/api/merchant' import { apiMerchantAdd, apiMerchantEdit, apiMerchantDetail } from '@/api/merchant'
import { timeFormat } from '@/utils/util' import { apicityLists, apiAreaLists, apiStreetLists, apiVillageLists } from "@/api/address"
import type { PropType } from 'vue' import type { PropType } from 'vue'
defineProps({ defineProps({
dictData: { dictData: {
@ -177,13 +232,16 @@ const popupTitle = computed(() => {
// //
const formData = reactive({ const formData = reactive({
financial_type: "",
mer_id: '', mer_id: '',
category_id: '', category_id: '',
type_id: '', type_id: '',
mer_name: '', mer_name: '',
service_user: "",
credit_buy: '', credit_buy: '',
settle_cycle: '', settle_cycle: '',
interest_rate: '', interest_rate: '',
province_id: '510000',
city_id: '', city_id: '',
area_id: '', area_id: '',
street_id: '', street_id: '',
@ -273,7 +331,9 @@ const setFormData = async (data: Record<any, any>) => {
formData[key] = data[key] formData[key] = data[key]
} }
} }
await getAreaList(formData.city_id, true)
await getTownList(formData.area_id, true)
getVilllageList(formData.street_id)
} }
@ -308,6 +368,54 @@ const handleClose = () => {
} }
//
const address = reactive({
cityList: [],
areaList: [],
townList: [],
villlageList: []
})
const getCityList = async (province_code: number | String, isAsync: Boolean) => {
let res = await apicityLists({ province_code })
address.cityList = res
if (isAsync) {
return Promise.resolve({
msg: '获取成功'
});
}
}
const getAreaList = async (city_code: number | String, isAsync: Boolean) => {
let res = await apiAreaLists({ city_code })
address.areaList = res
if (isAsync) {
return Promise.resolve({
msg: '获取成功'
});
}
}
const getTownList = async (area_code: number | String, isAsync: Boolean) => {
let res = await apiStreetLists({ area_code })
address.townList = res
if (isAsync) {
return Promise.resolve({
msg: '获取成功'
});
}
}
const getVilllageList = async (street_code: number | String) => {
let res = await apiVillageLists({ street_code })
address.villlageList = res
}
//
getCityList(510000, false)
defineExpose({ defineExpose({
open, open,

View File

@ -125,10 +125,10 @@
</el-table-column> </el-table-column>
<el-table-column label="结算周期(天)" prop="settle_cycle" show-overflow-tooltip /> <el-table-column label="结算周期(天)" prop="settle_cycle" show-overflow-tooltip />
<el-table-column label="利率" prop="interest_rate" show-overflow-tooltip /> <el-table-column label="利率" prop="interest_rate" show-overflow-tooltip />
<el-table-column label="城市" prop="city_id" show-overflow-tooltip /> <el-table-column label="城市" prop="city_name" show-overflow-tooltip />
<el-table-column label="区县" prop="area_id" show-overflow-tooltip /> <el-table-column label="区县" prop="area_name" show-overflow-tooltip />
<el-table-column label="镇街表" prop="street_id" show-overflow-tooltip /> <el-table-column label="镇街表" prop="street_name" show-overflow-tooltip />
<el-table-column label="村主键" prop="village_id" show-overflow-tooltip /> <el-table-column label="村" prop="village_name" show-overflow-tooltip />
<el-table-column label="商户地址" prop="mer_address" show-overflow-tooltip /> <el-table-column label="商户地址" prop="mer_address" show-overflow-tooltip />
<el-table-column label="商户头像" prop="mer_avatar" show-overflow-tooltip /> <el-table-column label="商户头像" prop="mer_avatar" show-overflow-tooltip />
<el-table-column label="商户备注" prop="mark" show-overflow-tooltip /> <el-table-column label="商户备注" prop="mark" show-overflow-tooltip />
@ -196,7 +196,7 @@ const handleSelectionChange = (val: any[]) => {
} }
// //
const { dictData } = useDictData('mer_category_type,merchat_type,show_status,off_status') const { dictData } = useDictData('mer_category_type,merchat_type,show_status,off_status,financial_type')
// //
const { pager, getLists, resetParams, resetPage } = usePaging({ const { pager, getLists, resetParams, resetPage } = usePaging({

View File

@ -43,27 +43,43 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="标签" prop="sys_labels"> <el-form-item label="标签" prop="sys_labels">
<el-input v-model="formData.sys_labels" clearable placeholder="请输入标签" :readonly="false" /> <el-input v-model="formData.sys_labels_text" readonly @click="showDialog = true" clearable
placeholder="请输入标签" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="城市" prop="city_id"> <el-form-item label="城市" prop="city_id">
<el-input v-model="formData.city_id" clearable placeholder="请输入城市" :readonly="false" /> <el-select class="flex-1" v-model="formData.city_id" clearable placeholder="请选择城市"
@change="getAreaList(formData.city_id)">
<el-option v-for="(item, index) in address.cityList" :key="index" :label="item.city_name"
:value="parseInt(item.city_code)" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="区县" prop="area_id"> <el-form-item label="区县" prop="area_id">
<el-input v-model="formData.area_id" clearable placeholder="请输入区县" :readonly="false" /> <el-select class="flex-1" v-model="formData.area_id" clearable placeholder="请选择城市"
@change="getTownList(formData.area_id)">
<el-option v-for="(item, index) in address.areaList" :key="index" :label="item.area_name"
:value="parseInt(item.area_code)" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="镇街" prop="street_id"> <el-form-item label="镇街" prop="street_id">
<el-input v-model="formData.street_id" clearable placeholder="请输入镇街表" :readonly="false" /> <el-select class="flex-1" v-model="formData.street_id" clearable placeholder="请选择城市"
@change="getVilllageList(formData.street_id)">
<el-option v-for="(item, index) in address.townList" :key="index" :label="item.street_name"
:value="parseInt(item.street_code)" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="村" prop="village_id"> <el-form-item label="村" prop="village_id">
<el-input v-model="formData.village_id" clearable placeholder="请输入村" :readonly="false" /> <el-select class="flex-1" v-model="formData.village_id" clearable placeholder="请选择城市">
<el-option v-for="(item, index) in address.villlageList" :key="index"
:label="item.village_name" :value="(item.village_code)" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -146,12 +162,18 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="默认使用类型" prop="financial_type"> <el-form-item label="默认使用类型" prop="financial_type">
<el-input v-model="formData.financial_type" clearable placeholder="请输入默认使用类型" <el-select class="flex-1" v-model="formData.financial_type" clearable placeholder="请选择默认使用类型">
:readonly="false" /> <el-option v-for="(item, index) in dictData.financial_type" :key="index" :label="item.name"
:value="parseInt(item.value)" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-dialog v-model="showDialog" title="选择标签" width="70%">
<dialogTable multipleChoice :config="goods_label" @customEvent="customEvent">
</dialogTable>
</el-dialog>
</popup> </popup>
</div> </div>
</template> </template>
@ -160,6 +182,11 @@
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue' import Popup from '@/components/popup/index.vue'
import { apiSupplierAdd, apiSupplierEdit, apiSupplierDetail } from '@/api/supplier' import { apiSupplierAdd, apiSupplierEdit, apiSupplierDetail } from '@/api/supplier'
import { apicityLists, apiAreaLists, apiStreetLists, apiVillageLists } from "@/api/address"
import { goods_label } from "@/components/dialogTable/dialogTableConfig"
import type { PropType } from 'vue' import type { PropType } from 'vue'
defineProps({ defineProps({
dictData: { dictData: {
@ -171,7 +198,7 @@ const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>() const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>() const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add') const mode = ref('add')
const showDialog = ref(false)
// //
const popupTitle = computed(() => { const popupTitle = computed(() => {
@ -186,7 +213,9 @@ const formData = reactive({
mer_name: '', mer_name: '',
settle_cycle: '', settle_cycle: '',
interest_rate: '', interest_rate: '',
sys_labels: '', sys_labels: [],
sys_labels_text: '',
province_id: '510000',
city_id: '', city_id: '',
area_id: '', area_id: '',
street_id: '', street_id: '',
@ -207,6 +236,18 @@ const formData = reactive({
financial_type: '', financial_type: '',
}) })
const customEvent = (e) => {
formData.sys_labels = []
let text = []
e.forEach(item => {
formData.sys_labels.push(item.id)
text.push(item.name)
});
formData.sys_labels_text = text.join(',')
formData.sys_labels = formData.sys_labels.join(',')
showDialog.value = false
}
// //
const formRules = reactive<any>({ const formRules = reactive<any>({
@ -266,7 +307,9 @@ const setFormData = async (data: Record<any, any>) => {
formData[key] = data[key] formData[key] = data[key]
} }
} }
await getAreaList(formData.city_id, true)
await getTownList(formData.area_id, true)
getVilllageList(formData.street_id)
} }
@ -299,7 +342,7 @@ const open = (type = 'add') => {
const handleClose = () => { const handleClose = () => {
emit('close') emit('close')
} }
// 510000
// //
@ -310,6 +353,45 @@ const address = reactive({
villlageList: [] villlageList: []
}) })
const getCityList = async (province_code: number | String, isAsync: Boolean) => {
let res = await apicityLists({ province_code })
address.cityList = res
if (isAsync) {
return Promise.resolve({
msg: '获取成功'
});
}
}
const getAreaList = async (city_code: number | String, isAsync: Boolean) => {
let res = await apiAreaLists({ city_code })
address.areaList = res
if (isAsync) {
return Promise.resolve({
msg: '获取成功'
});
}
}
const getTownList = async (area_code: number | String, isAsync: Boolean) => {
let res = await apiStreetLists({ area_code })
address.townList = res
if (isAsync) {
return Promise.resolve({
msg: '获取成功'
});
}
}
const getVilllageList = async (street_code: number | String) => {
let res = await apiVillageLists({ street_code })
address.villlageList = res
}
//
getCityList(510000, false)
defineExpose({ defineExpose({

View File

@ -62,7 +62,7 @@
<el-table-column label="商户名称" prop="mer_name" show-overflow-tooltip /> <el-table-column label="商户名称" prop="mer_name" show-overflow-tooltip />
<el-table-column label="结算周期(天)" prop="settle_cycle" show-overflow-tooltip /> <el-table-column label="结算周期(天)" prop="settle_cycle" show-overflow-tooltip />
<el-table-column label="利率" prop="interest_rate" show-overflow-tooltip /> <el-table-column label="利率" prop="interest_rate" show-overflow-tooltip />
<el-table-column label="标签" prop="sys_labels" show-overflow-tooltip /> <el-table-column label="标签" prop="sys_labels_text" show-overflow-tooltip />
<el-table-column label="商户地址" prop="mer_address" show-overflow-tooltip /> <el-table-column label="商户地址" prop="mer_address" show-overflow-tooltip />
<el-table-column label="商户是否禁用" prop="status"> <el-table-column label="商户是否禁用" prop="status">
<template #default="{ row }"> <template #default="{ row }">
@ -127,7 +127,7 @@ const handleSelectionChange = (val: any[]) => {
} }
// //
const { dictData } = useDictData('show_status,mer_category_type,merchat_type') const { dictData } = useDictData('show_status,mer_category_type,merchat_type,financial_type')
// //
const { pager, getLists, resetParams, resetPage } = usePaging({ const { pager, getLists, resetParams, resetPage } = usePaging({

View File

@ -1,11 +1,7 @@
<template> <template>
<div> <div>
<el-card class="!border-none mb-4" shadow="never"> <el-card class="!border-none mb-4" shadow="never">
<el-form <el-form class="mb-[-16px]" :model="queryParams" inline>
class="mb-[-16px]"
:model="queryParams"
inline
>
<el-form-item label="" prop="name"> <el-form-item label="" prop="name">
<el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入" /> <el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入" />
</el-form-item> </el-form-item>
@ -22,11 +18,8 @@
</template> </template>
新增 新增
</el-button> </el-button>
<el-button <el-button v-perms="['goods.goods_label/delete']" :disabled="!selectData.length"
v-perms="['goods.goods_label/delete']" @click="handleDelete(selectData)">
:disabled="!selectData.length"
@click="handleDelete(selectData)"
>
删除 删除
</el-button> </el-button>
<div class="mt-4"> <div class="mt-4">
@ -36,20 +29,11 @@
<el-table-column label="标签名" prop="name" show-overflow-tooltip /> <el-table-column label="标签名" prop="name" 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 <el-button v-perms="['goods.goods_label/edit']" type="primary" link @click="handleEdit(row)">
v-perms="['goods.goods_label/edit']"
type="primary"
link
@click="handleEdit(row)"
>
编辑 编辑
</el-button> </el-button>
<el-button <el-button v-perms="['goods.goods_label/delete']" type="danger" link
v-perms="['goods.goods_label/delete']" @click="handleDelete(row.id)">
type="danger"
link
@click="handleDelete(row.id)"
>
删除 删除
</el-button> </el-button>
</template> </template>

View File

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

View File

@ -130,7 +130,7 @@ const mode = ref('add')
// //
const popupTitle = computed(() => { const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑零售单' : '新增零售单' return '零售单详情'
}) })
// //

View File

@ -20,7 +20,7 @@
<el-form-item label="制单人" prop="user"> <el-form-item label="制单人" prop="user">
<el-input class="w-[280px]" v-model="queryParams.user" clearable placeholder="请输入制单人" /> <el-input class="w-[280px]" v-model="queryParams.user" clearable placeholder="请输入制单人" />
</el-form-item> </el-form-item>
<el-form-item label="支付方式" prop="pay_type" tips=" 0余额 1微信 2小程序 3 h5 4支付宝 5 支付宝扫码 6 微信扫码 8先货后款 10对公转账"> <el-form-item label="支付方式" prop="pay_type">
<el-select class="w-[280px]" v-model="queryParams.pay_type" clearable placeholder="请选择支付方式"> <el-select class="w-[280px]" v-model="queryParams.pay_type" clearable placeholder="请选择支付方式">
<el-option label="全部" value=""></el-option> <el-option label="全部" value=""></el-option>
<el-option v-for="(item, index) in dictData.pay_type" :key="index" :label="item.name" <el-option v-for="(item, index) in dictData.pay_type" :key="index" :label="item.name"
@ -44,7 +44,7 @@
</el-form> </el-form>
</el-card> </el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never"> <el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['retail.cashierclass/add']" type="primary" @click="handleAdd"> <!-- <el-button v-perms="['retail.cashierclass/add']" type="primary" @click="handleAdd">
<template #icon> <template #icon>
<icon name="el-icon-Plus" /> <icon name="el-icon-Plus" />
</template> </template>
@ -53,21 +53,21 @@
<el-button v-perms="['retail.cashierclass/delete']" :disabled="!selectData.length" <el-button v-perms="['retail.cashierclass/delete']" :disabled="!selectData.length"
@click="handleDelete(selectData)"> @click="handleDelete(selectData)">
删除 删除
</el-button> </el-button> -->
<div class="mt-4"> <div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange"> <el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="ID" prop="id" /> <el-table-column label="ID" prop="id" />
<el-table-column label="所属商户" prop="merchant" show-overflow-tooltip /> <el-table-column label="所属商户" prop="merchant_name" show-overflow-tooltip />
<el-table-column label="归属门店" prop="store_id" show-overflow-tooltip /> <!-- <el-table-column label="归属门店" prop="store_id" show-overflow-tooltip /> -->
<el-table-column label="客户ID" prop="customer" show-overflow-tooltip /> <el-table-column label="客户" prop="user_name" show-overflow-tooltip />
<el-table-column label="单据时间" prop="time" show-overflow-tooltip /> <el-table-column label="单据时间" prop="create_time" show-overflow-tooltip />
<el-table-column label="单据编号" prop="number" show-overflow-tooltip /> <el-table-column label="单据编号" prop="number" show-overflow-tooltip />
<el-table-column label="单据金额" prop="total" show-overflow-tooltip /> <el-table-column label="单据金额" prop="total" show-overflow-tooltip />
<el-table-column label="抵扣金额" prop="deduction_price" show-overflow-tooltip /> <el-table-column label="抵扣金额" prop="deduction_price" show-overflow-tooltip />
<el-table-column label="实际金额" prop="actual" show-overflow-tooltip /> <el-table-column label="实际金额" prop="actual" show-overflow-tooltip />
<el-table-column label="实收金额" prop="money" show-overflow-tooltip /> <el-table-column label="实收金额" prop="money" show-overflow-tooltip />
<el-table-column label="制单人" prop="user" show-overflow-tooltip /> <!-- <el-table-column label="制单人" prop="user" show-overflow-tooltip /> -->
<el-table-column label="支付方式" prop="pay_type"> <el-table-column label="支付方式" prop="pay_type">
<template #default="{ row }"> <template #default="{ row }">
<dict-value :options="dictData.pay_type" :value="row.pay_type" /> <dict-value :options="dictData.pay_type" :value="row.pay_type" />
@ -78,21 +78,22 @@
<dict-value :options="dictData.auditing_type" :value="row.type" /> <dict-value :options="dictData.auditing_type" :value="row.type" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="审核人" prop="auditinguser" show-overflow-tooltip /> <el-table-column label="审核人" prop="auditinguser_name" show-overflow-tooltip />
<el-table-column label="审核时间" prop="auditingtime"> <el-table-column label="审核时间" prop="auditingtime" width="200">
<template #default="{ row }"> <template #default="{ row }">
<span>{{ row.auditingtime ? timeFormat(row.auditingtime, 'yyyy-mm-dd hh:MM:ss') : '' }}</span> <span>{{ row.auditingtime ? timeFormat(row.auditingtime, 'yyyy-mm-dd hh:MM:ss') : '' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="170" fixed="right"> <el-table-column label="操作" width="170" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button v-perms="['retail.cashierclass/edit']" type="primary" link @click="handleEdit(row)"> <el-button v-if="row.type == 0" v-perms="['retail.cashierclass/edit']" type="primary" link
编辑 @click="handleEdit(row)">
审核
</el-button> </el-button>
<el-button v-perms="['retail.cashierclass/delete']" type="danger" link <!-- <el-button v-perms="['retail.cashierclass/delete']" type="danger" link
@click="handleDelete(row.id)"> @click="handleDelete(row.id)">
删除 删除
</el-button> </el-button> -->
<el-button v-perms="['retail.cashierclass/edit']" type="primary" link <el-button v-perms="['retail.cashierclass/edit']" type="primary" link
@click="handleDetail(row)"> @click="handleDetail(row)">
详情 详情
@ -114,7 +115,7 @@
<script lang="ts" setup name="cashierclassLists"> <script lang="ts" setup name="cashierclassLists">
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions' import { useDictData } from '@/hooks/useDictOptions'
import { apiCashierclassLists, apiCashierclassDelete } from '@/api/cashierclass' import { apiCashierclassLists, apiCashierclassDelete, apiCashierclassAuditing } from '@/api/cashierclass'
import { timeFormat } from '@/utils/util' import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
import EditPopup from './edit.vue' import EditPopup from './edit.vue'
@ -166,10 +167,9 @@ const handleAdd = async () => {
// //
const handleEdit = async (data: any) => { const handleEdit = async (data: any) => {
showEdit.value = true await apiCashierclassAuditing({ id: data.id })
await nextTick() getLists()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
} }
// //

View File

@ -1,11 +1,7 @@
<template> <template>
<div> <div>
<el-card class="!border-none mb-4" shadow="never"> <el-card class="!border-none mb-4" shadow="never">
<el-form <el-form class="mb-[-16px]" :model="queryParams" inline>
class="mb-[-16px]"
:model="queryParams"
inline
>
<el-form-item label="所属ID" prop="pid"> <el-form-item label="所属ID" prop="pid">
<el-input class="w-[280px]" v-model="queryParams.pid" clearable placeholder="请输入所属ID" /> <el-input class="w-[280px]" v-model="queryParams.pid" clearable placeholder="请输入所属ID" />
</el-form-item> </el-form-item>
@ -47,16 +43,16 @@
<el-table-column label="ID" prop="id" show-overflow-tooltip /> <el-table-column label="ID" prop="id" show-overflow-tooltip />
<el-table-column label="所属ID" prop="pid" show-overflow-tooltip /> <el-table-column label="所属ID" prop="pid" show-overflow-tooltip />
<el-table-column label="仓储" prop="room" show-overflow-tooltip /> <el-table-column label="仓储" prop="room" show-overflow-tooltip />
<el-table-column label="商品" prop="goods" show-overflow-tooltip /> <el-table-column label="商品" prop="goods_name" show-overflow-tooltip />
<el-table-column label="仓库" prop="warehouse" show-overflow-tooltip /> <el-table-column label="仓库" prop="warehouse" show-overflow-tooltip />
<el-table-column label="串号" prop="serial" show-overflow-tooltip /> <el-table-column label="串号" prop="cashier_number" show-overflow-tooltip />
<el-table-column label="数量" prop="nums" show-overflow-tooltip /> <el-table-column label="数量" prop="nums" 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="discount" show-overflow-tooltip /> <el-table-column label="折扣" prop="discount" show-overflow-tooltip />
<el-table-column label="总价" prop="total" show-overflow-tooltip /> <el-table-column label="总价" prop="total" show-overflow-tooltip />
<el-table-column label="备注" prop="data" 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="扩展信息" prop="more" show-overflow-tooltip />
<el-table-column label="排序" prop="sort" 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="120" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button <el-button