Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjf committed 2025-06-18 12:21:43 +08:00
commit 8161325be4
9 files changed
+209 -188

No files matched your search

+4 -4
View File
@@ -8,19 +8,19 @@ VITE_OPEN = true
ENV = 'development' ENV = 'development'
# ADMIN 服务地址 # ADMIN 服务地址
VITE_ADMIN_PROXY_PATH = http://123.157.250.162:8089/api/ # 测试线上 # VITE_ADMIN_PROXY_PATH = http://123.157.250.162:8089/api/ # 测试线上
# VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 测试线上-过期 # VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 测试线上-过期
# VITE_ADMIN_PROXY_PATH = http://pjcloud.center.takin.cc/ # VITE_ADMIN_PROXY_PATH = http://pjcloud.center.takin.cc/
# VITE_ADMIN_PROXY_PATH = http://localhost:9999/ # VITE_ADMIN_PROXY_PATH = http://localhost:9999/
# VITE_ADMIN_PROXY_PATH = http://192.168.101.139:9999/ # 邓-本地 VITE_ADMIN_PROXY_PATH = http://192.168.101.139:9999/ # 邓-本地
# VITE_ADMIN_PROXY_PATH = http://59.202.170.152:81/api # 正式环境线上 # VITE_ADMIN_PROXY_PATH = http://59.202.170.152:81/api # 正式环境线上
# 图片访问基础地址 # 图片访问基础地址
VITE_IMAGE_BASE_PATH = http://123.157.250.162:8089/api/ # 测试线上 # VITE_IMAGE_BASE_PATH = http://123.157.250.162:8089/api/ # 测试线上
# VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api/ # 测试线上-过期 # VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api/ # 测试线上-过期
# VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc # VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc
# VITE_IMAGE_BASE_PATH = http://localhost:9999 # VITE_IMAGE_BASE_PATH = http://localhost:9999
# VITE_IMAGE_BASE_PATH = http://192.168.101.139:9999 # 邓-本地 VITE_IMAGE_BASE_PATH = http://192.168.101.139:9999 # 邓-本地
# VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api/ # 正式环境线上 # VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api/ # 正式环境线上
# 代码生成服务地址 # 代码生成服务地址
+20 -9
View File
@@ -1,12 +1,7 @@
<template> <template>
<el-select <el-select style="width: 100%" v-model="state.selectId" :placeholder="props.placeholder" clearable
style="width: 100%" @visible-change="(e: boolean) => e && getDictOptions()">
v-model="state.selectId" <el-option v-for="v in filterDictList" :key="v.code" :label="v.label" :value="v.value" />
:placeholder="props.placeholder"
clearable
@visible-change="(e: boolean) => e && getDictOptions()"
>
<el-option v-for="v in state.dictList" :key="v.code" :label="v.label" :value="v.value" />
</el-select> </el-select>
</template> </template>
@@ -20,6 +15,7 @@ const selectId = defineModel()
export type Props = { export type Props = {
dictCode: string dictCode: string
placeholder?: string placeholder?: string
hideIds?: string | Array<string>
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
placeholder: "请选择", placeholder: "请选择",
@@ -40,6 +36,21 @@ watch(
{ immediate: true }, { immediate: true },
) )
const filterDictList = computed(() => {
const hideKeys = props.hideIds
// 排序
const list = state.dictList?.sort((pren: any, next: any) => {
return pren.sortOrder - next.sortOrder
})
if (!hideKeys) return list
if (typeof hideKeys == "string") {
return list.filter((p: any) => p.value != hideKeys)
}
if (Array.isArray(hideKeys)) {
return list.filter((p: any) => !hideKeys.includes(p.value))
}
})
async function getDictOptions() { async function getDictOptions() {
if (!props.dictCode) return [] if (!props.dictCode) return []
const dicts = dict().getDict(props.dictCode) const dicts = dict().getDict(props.dictCode)
@@ -60,7 +71,7 @@ async function getDictOptions() {
</script> </script>
<style scoped> <style scoped>
.el-tag + .el-tag { .el-tag+.el-tag {
margin-left: 10px; margin-left: 10px;
} }
</style> </style>
+18
View File
@@ -48,6 +48,22 @@
displayPrice(row.walletReducePrice) }}</div> displayPrice(row.walletReducePrice) }}</div>
</template> </template>
</el-table-column> </el-table-column>
<!-- start 批量退换食堂 start -->
<el-table-column prop="walletReturnCanteenCount" label="批量退还各自食堂次数" align="center"
min-width="170">
<template #default="{ row }">
<div :class="{ 'color-success': row.walletReturnCanteenCount != 0 }">{{
row.walletReturnCanteenCount }}次</div>
</template>
</el-table-column>
<el-table-column prop="walletReturnCanteenPrice" label="批量退还各自食堂金额" align="center"
min-width="170">
<template #default="{ row }">
<div :class="{ 'color-success': row.walletReturnCanteenPrice != 0 }">{{
displayPrice(row.walletReturnCanteenPrice) }}</div>
</template>
</el-table-column>
<!-- end 批量退换食堂 end -->
<el-table-column prop="walletReduceCount" label="批量扣减次数" align="center" min-width="110"> <el-table-column prop="walletReduceCount" label="批量扣减次数" align="center" min-width="110">
<template #default="{ row }"> <template #default="{ row }">
<div :class="{ 'color-success': row.walletReduceCount != 0 }">{{ row.walletReduceCount <div :class="{ 'color-success': row.walletReduceCount != 0 }">{{ row.walletReduceCount
@@ -171,6 +187,8 @@ const getSummaries = (param: any) => {
"walletOnceReduceCount", "walletOnceReduceCount",
"orderProfitPrice", "orderProfitPrice",
"orderProfitCont", "orderProfitCont",
"walletReturnCanteenCount",
"walletReturnCanteenPrice"
] ]
const totalRow = Array.from({ length: columns.length }) const totalRow = Array.from({ length: columns.length })
columns.forEach((i: any, index: number) => { columns.forEach((i: any, index: number) => {
@@ -10,6 +10,7 @@
border border
show-overflow show-overflow
max-height="380" max-height="380"
:edit-rules="validRules"
:column-config="{ resizable: true }" :column-config="{ resizable: true }"
:row-config="{ isHover: true }" :row-config="{ isHover: true }"
:resizable-config="{ dragMode: 'fixed' }" :resizable-config="{ dragMode: 'fixed' }"
@@ -47,9 +48,6 @@
<template #edit="{ row }"> <template #edit="{ row }">
<el-input v-model.trim="row.barCode" /> <el-input v-model.trim="row.barCode" />
</template> </template>
<!-- <template #default="{ row }">
{{ computedSmErpUnitEntityList?.find((item) => item.id == row.unitId)?.barCode }}
</template> -->
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
</div> </div>
@@ -90,10 +88,10 @@ const props = withDefaults(
const editableTableRef = ref() const editableTableRef = ref()
// const validRules = { const validRules = {
// unit: [{ required: true, message: "包装单位不能为空", trigger: "blur" }], // unit: [{ required: true, message: "包装单位不能为空", trigger: "blur" }],
// barCode: [{ required: true, message: "条码不能为空", trigger: "blur" }], // barCode: [{ required: true, message: "条码不能为空", trigger: "blur" }],
// } }
// 底部表格行新增 // 底部表格行新增
const pushEvent = () => { const pushEvent = () => {
@@ -32,13 +32,13 @@
<el-col :span="12" class="mb20"> <el-col :span="12" class="mb20">
<el-form-item label="商品性质" prop="productNature"> <el-form-item label="商品性质" prop="productNature">
<el-select v-model="form.productNature" placeholder="请选择商品性质"> <el-select v-model="form.productNature" placeholder="请选择商品性质">
<el-option :value="item.value" :label="item.label" v-for="(item, index) in supermarket_nature" :key="index"></el-option> <el-option :value="item.value" :label="item.label" v-for="(item, index) in supermarket_nature" :key="index" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24" class="mb20"> <el-col :span="24" class="mb20">
<el-form-item label="商品封面图" prop="picUrl"> <el-form-item label="商品封面图" prop="picUrl">
<upload-img v-model:imageUrl="form.picUrl"></upload-img> <upload-img v-model:imageUrl="form.picUrl" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24" class="mb20"> <el-col :span="24" class="mb20">
@@ -54,7 +54,7 @@
<el-input v-model.trim="row.spec" /> <el-input v-model.trim="row.spec" />
</template> </template>
</vxe-column> </vxe-column>
<vxe-column field="unit" title="单位" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }"> <vxe-column field="unit" title="单位名称" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
<template #edit="{ row }"> <template #edit="{ row }">
<el-input v-model.trim="row.unit" /> <el-input v-model.trim="row.unit" />
</template> </template>
@@ -118,7 +118,7 @@ export interface rowVU {
packageNum: number packageNum: number
purchasePrice: number purchasePrice: number
retailPrice: number retailPrice: number
promotionPrice: number | null promotionPrice: number
costPrice: number costPrice: number
isNew?: boolean isNew?: boolean
isBase?: boolean | null isBase?: boolean | null
@@ -133,11 +133,11 @@ const packageUnitList = defineModel<rowVU[]>("modelValue", {
barCode: "", barCode: "",
spec: "", spec: "",
unit: "", unit: "",
status: "", status: "0",
packageNum: 1, packageNum: 1,
purchasePrice: 0, purchasePrice: 0,
retailPrice: 0.01, retailPrice: 0.01,
promotionPrice: null, promotionPrice: 0,
costPrice: 0, costPrice: 0,
}, },
], ],
@@ -166,11 +166,11 @@ const pushEvent = (row?: rowVU | undefined) => {
barCode: "", barCode: "",
spec: "", spec: "",
unit: "", unit: "",
status: "", status: "0",
packageNum: 1, packageNum: 1,
purchasePrice: 0, purchasePrice: 0,
retailPrice: 0.01, retailPrice: 0.01,
promotionPrice: null, promotionPrice: 0,
costPrice: 0, costPrice: 0,
isNew: true, isNew: true,
} }
@@ -197,7 +197,7 @@ const removeSelectRowEvent = () => {
} }
// 获取单选的行 // 获取单选的行
const getRadioEvent = () => { const getRadioRow = () => {
const $table = editableTableRef.value const $table = editableTableRef.value
if ($table) { if ($table) {
const currRadioRow = $table.getRadioRecord() const currRadioRow = $table.getRadioRecord()
@@ -231,7 +231,7 @@ const editableTableValidate = async () => {
defineExpose({ defineExpose({
editableTableValidate, editableTableValidate,
getRadioEvent, getRadioRow,
setRadioRow, setRadioRow,
pushEvent, pushEvent,
}) })
@@ -1,34 +1,31 @@
<template> <template>
<el-dialog width="80%" :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable> <el-dialog width="80%" :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="150px" v-loading="loading"> <el-form ref="formRef" :model="form" :rules="dataRules" label-width="150px" v-loading="loading">
<el-tabs class="el-tabs" v-model="tabPaneActiveName" @tab-change="handleTabChange" type="border-card"> <el-tabs class="el-tabs" v-model="tabPaneActiveName" @tab-change="handleTabChange" type="border-card">
<el-tab-pane class="el-tab-pane" label="基础信息" name="基础信息" :disabled="true"> <el-tab-pane class="el-tab-pane" label="基础信息" name="基础信息">
<base-info v-model="form" /> <base-info v-model="form" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="el-tab-pane" label="包装单位" name="包装单位" :disabled="true"> <el-tab-pane class="el-tab-pane" label="包装单位" name="包装单位">
<package-unit ref="packageUnitRef" v-model="form.smErpUnitEntityList" /> <package-unit ref="packageUnitRef" v-model="form.smErpUnitEntityList" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="el-tab-pane" label="库存" name="库存" :disabled="true"> <el-tab-pane class="el-tab-pane" label="库存" name="库存">
<product-inventory <product-inventory
v-model:stock="form.stock" v-model:stock="form.stock"
v-model:inventoryUpperLimit="form.inventoryUpperLimit" v-model:inventoryUpperLimit="form.inventoryUpperLimit"
v-model:inventoryLowerLimit="form.inventoryLowerLimit" v-model:inventoryLowerLimit="form.inventoryLowerLimit"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="el-tab-pane" label="辅助条码" name="辅助条码" :disabled="true"> <el-tab-pane class="el-tab-pane" label="辅助条码" name="辅助条码">
<auxiliary-code :smErpUnitEntityList="form.smErpUnitEntityList" v-model="form.smErpAuxiliaryCodeEntityList" /> <auxiliary-code :smErpUnitEntityList="form.smErpUnitEntityList" v-model="form.smErpAuxiliaryCodeEntityList" />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-form> </el-form>
<template #footer> <template #footer>
<!-- <el-button @click="visible = false">取消</el-button> -->
<el-button v-if="currentTabPaneIndex != 0" type="primary" @click="currentTabPaneIndex--" :disabled="loading">上一步</el-button> <el-button v-if="currentTabPaneIndex != 0" type="primary" @click="currentTabPaneIndex--" :disabled="loading">上一步</el-button>
<el-button v-if="currentTabPaneIndex == 0" type="primary" @click="addPackageUnitNextStep">下一步</el-button> <el-button v-if="currentTabPaneIndex != tabPaneEnum.length - 1" type="primary" @click="nextStep">下一步</el-button>
<el-button v-if="currentTabPaneIndex == 1 || currentTabPaneIndex == 2" type="primary" @click="currentTabPaneIndex++"> <el-button v-if="currentTabPaneIndex == tabPaneEnum.length - 1" type="primary" @click="onSubmit" :loading="loading">提 交</el-button>
下一步 <el-button @click="visible = false">取消</el-button>
</el-button>
<el-button v-if="currentTabPaneIndex == 3" type="primary" @click="onSubmit" :loading="loading">提 交</el-button>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
@@ -46,7 +43,7 @@ import { nanoid } from "nanoid"
const emit = defineEmits(["refresh"]) const emit = defineEmits(["refresh"])
const dataFormRef = ref() const formRef = ref()
const packageUnitRef = ref() const packageUnitRef = ref()
const visible = ref(false) const visible = ref(false)
const loading = ref(false) const loading = ref(false)
@@ -87,8 +84,8 @@ const form = reactive<any>({
costPrice: 0, costPrice: 0,
}) })
// 表单金额转为单位分 // 基本信息的金额转为单位分
const formatedMoney = computed(() => { const formatedBaseFormMoney = computed(() => {
return { return {
grossMargin: storePrice(form.grossMargin), grossMargin: storePrice(form.grossMargin),
purchasePrice: storePrice(form.purchasePrice), purchasePrice: storePrice(form.purchasePrice),
@@ -176,51 +173,63 @@ const getsupermarketSpuData = async (id: string) => {
// 重置表单数据 // 重置表单数据
const resetForm = () => { const resetForm = () => {
dataFormRef.value?.resetFields() formRef.value?.resetFields()
form.smErpUnitEntityList = [] form.smErpUnitEntityList = []
form.smErpAuxiliaryCodeEntityList = [] form.smErpAuxiliaryCodeEntityList = []
} }
// 第一步的下一步 // tab栏切换
const addPackageUnitNextStep = () => { const handleTabChange = (name: TabPaneName) => {
currentTabPaneIndex.value++ currentTabPaneIndex.value = tabPaneEnum.findIndex((item) => item === name)
if (form.id) return if (form.id) return
setDefaultPackageUnit()
const row = {
id: nanoid(5),
barCode: form.barCode,
spec: form.spec,
unit: form.unit,
status: form.unitStatus,
packageNum: form.packageNum,
purchasePrice: form.purchasePrice,
retailPrice: form.retailPrice,
promotionPrice: form.promotionPrice,
costPrice: form.costPrice,
isNew: true,
flag: "addPackageUnitNextStep",
}
const isFlagRowExist = form.smErpUnitEntityList.some((item: rowVU) => item.flag === "addPackageUnitNextStep")
if (isFlagRowExist) return
packageUnitRef.value.pushEvent(row)
packageUnitRef.value.setRadioRow(0) // 设置基础包装单位的单选行
} }
// tab栏切换 // 下一步
const handleTabChange = (name: TabPaneName) => (currentTabPaneIndex.value = tabPaneEnum.findIndex((item) => item === name)) const nextStep = () => {
currentTabPaneIndex.value++
if (form.id) return
setDefaultPackageUnit()
}
// 计算包装单位列表 // 默认设置一行基础包装单位
const usePackageUnitList = () => { const setDefaultPackageUnit = () => {
const curRadioRowUnit = packageUnitRef.value.getRadioEvent() if (currentTabPaneIndex.value == 1) {
const isFlagRowExist = form.smErpUnitEntityList.some((item: rowVU) => item.flag === "defaultAddedPackageUnit")
if (isFlagRowExist) return
const row = {
id: nanoid(5),
barCode: form.barCode,
spec: form.spec,
unit: form.unit,
status: form.unitStatus,
packageNum: form.packageNum,
purchasePrice: form.purchasePrice,
retailPrice: form.retailPrice,
promotionPrice: form.promotionPrice,
costPrice: form.costPrice,
isNew: true,
flag: "defaultAddedPackageUnit",
}
packageUnitRef.value.pushEvent(row)
packageUnitRef.value.setRadioRow(0) // 自动设置基础包装单位的radio单选行
}
}
// 整理包装单位列表
const settlePackageUnitList = () => {
const curRadioRowUnit = packageUnitRef.value.getRadioRow()
const smErpUnitEntityList = JSON.parse(JSON.stringify(form.smErpUnitEntityList)) const smErpUnitEntityList = JSON.parse(JSON.stringify(form.smErpUnitEntityList))
return smErpUnitEntityList.map((item: rowVU) => { return smErpUnitEntityList.map((item: rowVU) => {
// 设置基础包装单位标识(isBase)
if (item.id === curRadioRowUnit.id) { if (item.id === curRadioRowUnit.id) {
item.isBase = true item.isBase = true
} else { } else {
item.isBase = false item.isBase = false
} }
// 转换金额单位
item.costPrice = storePrice(item.costPrice) item.costPrice = storePrice(item.costPrice)
item.promotionPrice = item.promotionPrice ? storePrice(item.promotionPrice) : null item.promotionPrice = storePrice(item.promotionPrice)
item.purchasePrice = storePrice(item.purchasePrice) item.purchasePrice = storePrice(item.purchasePrice)
item.retailPrice = storePrice(item.retailPrice) item.retailPrice = storePrice(item.retailPrice)
if (item.isNew) { if (item.isNew) {
@@ -231,14 +240,13 @@ const usePackageUnitList = () => {
}) })
} }
// 计算辅助条码列表 // 整理辅助条码列表
const useAuxiliaryCode = () => { const settleAuxiliaryCode = () => {
const smErpAuxiliaryCodeEntityList = [...form.smErpAuxiliaryCodeEntityList] const smErpAuxiliaryCodeEntityList = [...form.smErpAuxiliaryCodeEntityList]
return smErpAuxiliaryCodeEntityList return smErpAuxiliaryCodeEntityList
.filter((item: rowVC) => item.unitId) .filter((item: rowVC) => item.unitId)
.map((item: rowVC) => { .map((item: rowVC) => {
const curPackageUnitItem = form.smErpUnitEntityList.find((unitItem: any) => unitItem.id == item.unitId) const curPackageUnitItem = form.smErpUnitEntityList.find((unitItem: any) => unitItem.id == item.unitId)
console.log(form.smErpUnitEntityList)
if (item.isNew) { if (item.isNew) {
item.id = "" item.id = ""
@@ -251,26 +259,25 @@ const useAuxiliaryCode = () => {
// 提交 // 提交
const onSubmit = async () => { const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => {}) const valid = await formRef.value.validate().catch(() => {})
if (!valid) return useMessage().warning("基础信息和库存必填项未填写完整") if (!valid) return useMessage().warning("基础信息或库存必填项未填写完整")
if (!form.smErpUnitEntityList || form.smErpUnitEntityList.length <= 0) return useMessage().warning("请添加包装单位") if (!form.smErpUnitEntityList || form.smErpUnitEntityList.length <= 0) return useMessage().warning("请添加包装单位")
if (!(await packageUnitRef.value.editableTableValidate())) return useMessage().warning("包装单位必填项未填写完整") if (!(await packageUnitRef.value.editableTableValidate())) return useMessage().warning("包装单位必填项未填写完整")
if (!packageUnitRef.value.getRadioEvent()) return useMessage().warning("请选择基础包装单位") if (!packageUnitRef.value.getRadioRow()) return useMessage().warning("请选择基础包装单位")
// if (!form.stock || !form.inventoryUpperLimit || !form.inventoryLowerLimit) return useMessage().warning("库存必填项未填写完整")
// if (!form.smErpAuxiliaryCodeEntityList || form.smErpAuxiliaryCodeEntityList.length <= 0) return useMessage().warning("请添加辅助条码") // if (!form.smErpAuxiliaryCodeEntityList || form.smErpAuxiliaryCodeEntityList.length <= 0) return useMessage().warning("请添加辅助条码")
// if (!(await auxiliaryCodeRef.value.editableTableValidate())) return useMessage().warning("辅助条码必填项未填写完整") // if (!(await auxiliaryCodeRef.value.editableTableValidate())) return useMessage().warning("辅助条码必填项未填写完整")
console.log(form.smErpUnitEntityList) console.log("未整理-包装单位", form.smErpUnitEntityList)
console.log("未整理-辅助条码", form.smErpAuxiliaryCodeEntityList)
const smErpAuxiliaryCodeEntityList = useAuxiliaryCode() const smErpAuxiliaryCodeEntityList = settleAuxiliaryCode()
const smErpUnitEntityList = usePackageUnitList() const smErpUnitEntityList = settlePackageUnitList()
try { try {
loading.value = true loading.value = true
const _pa = { const _pa = {
...form, ...form,
...formatedMoney.value, ...formatedBaseFormMoney.value,
grossMargin: storePrice(form.grossMargin),
smErpAuxiliaryCodeEntityList, smErpAuxiliaryCodeEntityList,
smErpUnitEntityList, smErpUnitEntityList,
} }
+43 -10
View File
@@ -1,16 +1,19 @@
<template> <template>
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" width="30%" :close-on-click-modal="false" draggable> <el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" width="30%" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading"> <el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px"
v-loading="loading">
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="24" class="mb20"> <el-col :span="24" class="mb20">
<el-form-item label="充值时间" prop="importTime"> <el-form-item label="充值时间" prop="importTime">
<el-date-picker v-model="form.importTime" type="month" value-format="YYYY-MM-DD" placeholder="请选择充值时间" /> <el-date-picker v-model="form.importTime" type="month" value-format="YYYY-MM-DD"
placeholder="请选择充值时间" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24" class="mb20"> <el-col :span="24" class="mb20">
<el-form-item label="充值类型" prop="bizType"> <el-form-item label="充值类型" prop="bizType">
<dict-select v-model="form.bizType" dict-code="wallet_biz_recharge" placeholder="请选择饭卡类型" /> <dict-select v-model="form.bizType" dict-code="wallet_biz_recharge"
:hide-ids="[roleCodes.includes('RETURN_CANTEEN') ? '' : '3']" placeholder="请选择饭卡类型" />
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -18,14 +21,26 @@
<el-form-item label="钱包" prop="walletTypeId"> <el-form-item label="钱包" prop="walletTypeId">
<!-- <select-wallet-type v-model="form.walletTypeId" placeholder="请选择钱包" :disabled="false" /> --> <!-- <select-wallet-type v-model="form.walletTypeId" placeholder="请选择钱包" :disabled="false" /> -->
<el-select v-model="form.walletTypeId" :disabled="walletTypeIdDisabled"> <el-select v-model="form.walletTypeId" :disabled="walletTypeIdDisabled">
<el-option v-for="item in walletTypeOptions" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in walletTypeOptions" :key="item.id" :label="item.name"
:value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-if="roleCodes.includes('RETURN_CANTEEN') && form.bizType == 3" :span="24" class="mb20">
<el-form-item label="授权" prop="isAuthorization">
<el-radio-group v-model="form.isAuthorization">
<el-radio v-for="v in yes_no_type" :key="v.value" :label="v.value" border>
{{ v.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24" class="mb20"> <el-col :span="24" class="mb20">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" type="textarea" :autosize="{ minRows: 6 }" /> <el-input v-model="form.remark" placeholder="请输入备注" type="textarea"
:autosize="{ minRows: 6 }" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -40,11 +55,16 @@
</template> </template>
<script setup lang="ts" name="WalletRechargeApplyDialog"> <script setup lang="ts" name="WalletRechargeApplyDialog">
import { useDict } from "/@/hooks/dict"
import { useMessage } from "/@/hooks/message" import { useMessage } from "/@/hooks/message"
import { getObj, addObj, putObj } from "/@/api/wallet/wallet-recharge-apply" import { getObj, addObj, putObj } from "/@/api/wallet/wallet-recharge-apply"
const emit = defineEmits(["refresh"]) const emit = defineEmits(["refresh"])
import { getWalletTypeSimple } from "/@/api/wallet/wallet-type" import { getWalletTypeSimple } from "/@/api/wallet/wallet-type"
import { useUserInfo } from "/@/stores/userInfo" import { useUserInfo } from "/@/stores/userInfo"
import { formatDate } from "/@/utils/formatTime"
// 定义查询字典
const { yes_no_type } = useDict("yes_no_type")
const { const {
userInfos: { roleCodes }, userInfos: { roleCodes },
@@ -56,15 +76,17 @@ const loading = ref(false)
// 定义字典 // 定义字典
// 提交表单数据 // 提交表单数据
const form = reactive({ const defaultForm = {
id: "", id: "",
userId: "", userId: "",
bizType: "", bizType: "",
walletTypeId: "", walletTypeId: "",
deptId: "", deptId: "",
importTime: "", importTime: formatDate(new Date(), "YYYY-mm"),
remark: "", remark: "",
}) isAuthorization: "1",
}
const form = reactive<any>({ ...defaultForm })
const walletTypeOptions = ref() const walletTypeOptions = ref()
const walletTypeIdDisabled = ref(true) const walletTypeIdDisabled = ref(true)
watch( watch(
@@ -93,6 +115,7 @@ const dataRules = ref({
importTime: [{ required: true, message: "导入时间(手动选择)不能为空", trigger: "change" }], importTime: [{ required: true, message: "导入时间(手动选择)不能为空", trigger: "change" }],
bizType: [{ required: true, message: "请选择充值类型", trigger: "change" }], bizType: [{ required: true, message: "请选择充值类型", trigger: "change" }],
walletTypeId: [{ required: true, message: "请选择钱包类型", trigger: "change" }], walletTypeId: [{ required: true, message: "请选择钱包类型", trigger: "change" }],
isAuthorization: [{ required: true, message: "请选择是否授权", trigger: "change" }],
}) })
// 打开弹窗 // 打开弹窗
@@ -118,9 +141,12 @@ const openDialog = async (id: string) => {
// 提交 // 提交
const onSubmit = async () => { const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => {}) const valid = await dataFormRef.value.validate().catch(() => { })
if (!valid) return false if (!valid) return false
if (form.bizType == 3 && form.isAuthorization != 1) {
useMessage().error("请同意授权协议")
return
}
try { try {
loading.value = true loading.value = true
form.id ? await putObj(form) : await addObj(form) form.id ? await putObj(form) : await addObj(form)
@@ -142,8 +168,15 @@ const getwalletRechargeApplyData = async (id: string) => {
const res = await getObj(id) const res = await getObj(id)
if (res.code == 0) { if (res.code == 0) {
Object.assign(form, res.data) Object.assign(form, res.data)
if (!form.importTime) {
form.importTime = formatDate(new Date(), "YYYY-mm-dd")
}
if (!form.isAuthorization) {
form.isAuthorization = "1"
}
} }
} catch (err: any) { } catch (err: any) {
console.error(err);
} finally { } finally {
loading.value = false loading.value = false
} }
@@ -1,7 +1,8 @@
<template> <template>
<div class="layout-padding"> <div class="layout-padding">
<div class="layout-padding-auto layout-padding-view"> <div class="layout-padding-auto layout-padding-view">
<el-form v-show="showSearch" ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList"> <el-form v-show="showSearch" ref="queryRef" :inline="true" :model="state.queryForm"
@keyup.enter="getDataList">
<el-row> <el-row>
<el-form-item style="width: 300px" label="用户" prop="userIds"> <el-form-item style="width: 300px" label="用户" prop="userIds">
<select-user v-model="state.queryForm.userIds" placeholder="用户" /> <select-user v-model="state.queryForm.userIds" placeholder="用户" />
@@ -10,34 +11,32 @@
<select-wallet-type v-model="state.queryForm.walletTypeId" placeholder="饭卡类型" clearable /> <select-wallet-type v-model="state.queryForm.walletTypeId" placeholder="饭卡类型" clearable />
</el-form-item> </el-form-item>
<el-form-item style="width: 200px" label="充值类型" prop="bizType"> <el-form-item style="width: 200px" label="充值类型" prop="bizType">
<dict-select v-model="state.queryForm.bizType" dict-code="wallet_biz_recharge" placeholder="充值类型" /> <dict-select v-model="state.queryForm.bizType" dict-code="wallet_biz_recharge"
placeholder="充值类型" />
</el-form-item> </el-form-item>
<el-form-item style="width: 450px" label="创建时间" prop="createTimeList"> <el-form-item style="width: 450px" label="创建时间" prop="createTimeList">
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" /> <el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" />
</el-form-item> </el-form-item>
<el-form-item style="width: 450px" label="审核时间" prop="processTimeList"> <el-form-item style="width: 450px" label="审核时间" prop="processTimeList">
<el-date-picker v-model="state.queryForm.processTimeList" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" /> <el-date-picker v-model="state.queryForm.processTimeList" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button> <el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn")
}}</el-button>
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button> <el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
</el-form-item> </el-form-item>
</el-row> </el-row>
</el-form> </el-form>
<el-row> <el-row>
<div class="mb8" style="width: 100%"> <div class="mb8" style="width: 100%">
<el-button icon="folder-add" type="primary" class="ml10" @click="uploadExcelRef.show()" v-auth="'wallet_walletRechargeApply_add'"> <el-button icon="folder-add" type="primary" class="ml10" @click="uploadExcelRef.show()"
v-auth="'wallet_walletRechargeApply_add'">
导 入 导 入
</el-button> </el-button>
<el-button <el-button v-if="false" plain :disabled="multiple" icon="Delete" type="primary"
v-if="false" v-auth="'wallet_walletRechargeApply_del'" @click="handleDelete(selectObjs)">
plain
:disabled="multiple"
icon="Delete"
type="primary"
v-auth="'wallet_walletRechargeApply_del'"
@click="handleDelete(selectObjs)"
>
删除 删除
</el-button> </el-button>
@@ -45,30 +44,19 @@
<el-tabs class="flex-1" v-model="activeName" @tab-click="handleClickTabItem"> <el-tabs class="flex-1" v-model="activeName" @tab-click="handleClickTabItem">
<el-tab-pane v-for="v in tabItems" :key="v.id" :label="v.label" :name="v.value" /> <el-tab-pane v-for="v in tabItems" :key="v.id" :label="v.label" :name="v.value" />
</el-tabs> </el-tabs>
<right-toolbar <right-toolbar v-model:showSearch="showSearch" :export="'wallet_walletRechargeApply_export'"
v-model:showSearch="showSearch" @exportExcel="exportExcel" class="ml10 mr20" style="float: right"
:export="'wallet_walletRechargeApply_export'" @queryTable="getDataList" />
@exportExcel="exportExcel"
class="ml10 mr20"
style="float: right"
@queryTable="getDataList"
/>
</div> </div>
</div> </div>
</el-row> </el-row>
<el-table <el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:data="state.dataList" :header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
v-loading="state.loading" @sort-change="sortChangeHandle">
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
@selection-change="selectionChangHandle"
@sort-change="sortChangeHandle"
>
<el-table-column type="selection" width="40" align="center" /> <el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="80" /> <el-table-column type="index" label="#" width="80" />
<el-table-column prop="username" label="申请人" /> <el-table-column prop="username" label="申请人" />
<el-table-column prop="bizType" width="100" label="充值类型"> <el-table-column prop="bizType" width="120" label="充值类型">
<template #default="{ row }"> <template #default="{ row }">
<dict-tag :options="wallet_biz_recharge" :value="row.bizType" /> <dict-tag :options="wallet_biz_recharge" :value="row.bizType" />
</template> </template>
@@ -97,96 +85,62 @@
<el-table-column prop="remark" width="300" label="备注" /> <el-table-column prop="remark" width="300" label="备注" />
<el-table-column width="250" label="时间"> <el-table-column width="250" label="时间">
<template #default="{ row }"> <template #default="{ row }">
<div class="status"> <div v-if="false" class="status">
<span>创建时间</span> <span>创建时间</span>
<span>{{ row.createTime }} </span> <span>{{ row.createTime }} </span>
</div> </div>
<div class="status">
<span>申请时间</span>
<span>{{ row.applyTime ?? "--" }} </span>
</div>
<div class="status"> <div class="status">
<span>审批时间</span> <span>审批时间</span>
<span>{{ row.processTime ?? "--" }} </span> <span>{{ row.processTime ?? "--" }} </span>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="操作" v-auths="[
label="操作" 'wallet_walletRechargeApply_view',
v-auths="[ 'wallet_walletRechargeApply_apply',
'wallet_walletRechargeApply_view', 'wallet_walletRechargeApply_edit',
'wallet_walletRechargeApply_apply', 'wallet_walletRechargeApply_del',
'wallet_walletRechargeApply_edit', 'wallet_walletRechargeApply_check',
'wallet_walletRechargeApply_del', ]" width="300" fixed="right">
'wallet_walletRechargeApply_check',
]"
width="300"
fixed="right"
>
<template #default="{ row }"> <template #default="{ row }">
<el-button <el-button v-if="row.importTime" icon="Document" text type="primary"
v-if="row.importTime" v-auth="'wallet_walletRechargeApply_view'" @click="doInfo(row)">
icon="Document"
text
type="primary"
v-auth="'wallet_walletRechargeApply_view'"
@click="doInfo(row)"
>
数据 数据
</el-button> </el-button>
<el-button <el-button v-if="row.importTime && !row.processId" icon="Connection" text type="primary"
v-if="row.importTime && !row.processId" v-auth="'wallet_walletRechargeApply_apply'" @click="doApply(row)">
icon="Connection"
text
type="primary"
v-auth="'wallet_walletRechargeApply_apply'"
@click="doApply(row)"
>
申请 申请
</el-button> </el-button>
<el-button <el-button v-if="!row.processId" icon="edit-pen" text type="primary"
v-if="!row.processId" v-auth="'wallet_walletRechargeApply_edit'" @click="formDialogRef.openDialog(row.id)">
icon="edit-pen"
text
type="primary"
v-auth="'wallet_walletRechargeApply_edit'"
@click="formDialogRef.openDialog(row.id)"
>
编辑 编辑
</el-button> </el-button>
<el-button <el-button v-if="row.isCheckUser && row.processStatus == '1'" type="primary" size="small" link
v-if="row.isCheckUser && row.processStatus == '1'" icon="VideoPlay" @click="deal(row)" v-auth="'wallet_walletRechargeApply_check'">
type="primary"
size="small"
link
icon="VideoPlay"
@click="deal(row)"
v-auth="'wallet_walletRechargeApply_check'"
>
开始处理 开始处理
</el-button> </el-button>
<el-button <el-button
v-if="row.userId == userInfos?.user?.userId && [null, '1'].includes(row.processStatus)" v-if="row.userId == userInfos?.user?.userId && [null, '1'].includes(row.processStatus)"
icon="delete" icon="delete" text type="primary" v-auth="'wallet_walletRechargeApply_del'"
text @click="handleDelete([row.id])">
type="primary"
v-auth="'wallet_walletRechargeApply_del'"
@click="handleDelete([row.id])"
>
删除 删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" /> <pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
v-bind="state.pagination" />
</div> </div>
<!-- 编辑、新增 --> <!-- 编辑、新增 -->
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" /> <form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
<upload-excel <upload-excel ref="uploadExcelRef" title="用户信息导入" url="/wallet/wallet-recharge-apply/read-excel"
ref="uploadExcelRef" temp-url="/admin/sys-file/local/file/wallet_recharge.xlsx" @refreshDataList="getDataList(false)" />
title="用户信息导入"
url="/wallet/wallet-recharge-apply/read-excel"
temp-url="/admin/sys-file/local/file/wallet_recharge.xlsx"
@refreshDataList="getDataList(false)"
/>
<!-- 审批抽屉 --> <!-- 审批抽屉 -->
<process-drawer ref="processDrawerRef" @task-submit-event="taskSubmitEvent" /> <process-drawer ref="processDrawerRef" @task-submit-event="taskSubmitEvent" />