salary
qsh 5 months ago
parent d22a380612
commit 4c692c48e3
  1. 14
      src/api/clue/clueField.js
  2. 5
      src/api/clue/index.js
  3. 14
      src/api/clue/orderField.js
  4. 40
      src/api/mall/product/productField.js
  5. 4
      src/api/mall/purchase/index.js
  6. 11
      src/api/system/set/index.js
  7. 2
      src/components/Descriptions/src/Descriptions.vue
  8. 4
      src/components/UploadFile/src/UploadFile.vue
  9. 78
      src/views/Clue/Pool/Comp/DialogSuccess.vue
  10. 19
      src/views/Clue/Pool/Comp/DrawerClue.vue
  11. 79
      src/views/Clue/Pool/index.vue
  12. 216
      src/views/MiniMall/MallSet/Comp/FieldProduct.vue
  13. 34
      src/views/MiniMall/MallSet/Comp/GeneralSet.vue
  14. 98
      src/views/MiniMall/Product/add.vue
  15. 40
      src/views/MiniMall/Product/index.vue
  16. 2
      src/views/MiniMall/Purchase/Comp/DialogAdd.vue
  17. 25
      src/views/MiniMall/Purchase/Comp/DialogAudit.vue
  18. 2
      src/views/MiniMall/Purchase/index.vue

@ -2,32 +2,32 @@ import request from '@/config/axios'
// 创建
export const createField = (data) => {
return request.post({ url: '/admin-api/crm/clue-param/create', data })
return request.post({ url: '/admin-api/crm/param/create', data: { ...data, module: 1 } })
}
// 更新
export const updateField = (data) => {
return request.put({ url: '/admin-api/crm/clue-param/update', data })
return request.put({ url: '/admin-api/crm/param/update', data })
}
// 删除
export const deleteField = (id) => {
return request.delete({ url: `/admin-api/crm/clue-param/delete?id=${id}` })
return request.delete({ url: `/admin-api/crm/param/delete?id=${id}` })
}
// 获得
export const getField = (id) => {
return request.get({ url: `/admin-api/crm/clue-param/get?id=${id}` })
return request.get({ url: `/admin-api/crm/param/get?id=${id}` })
}
// 获得精简信息列表
export const getSimpleFieldList = () => {
return request.get({ url: '/admin-api/crm/clue-param/simple-list' })
return request.get({ url: '/admin-api/crm/param/simple-list', params: { module: 1 } })
}
// 获取自定义字段
export const getDiyFieldList = () => {
return request.get({ url: '/admin-api/crm/clue-param/get-diy-param' })
return request.get({ url: '/admin-api/crm/param/get-diy-param', params: { module: 1 } })
}
// 状态修改
@ -36,5 +36,5 @@ export const updateFieldStatus = (signParamId, status) => {
signParamId,
status
}
return request.put({ url: '/admin-api/crm/clue-param/status/update', data: data })
return request.put({ url: '/admin-api/crm/param/status/update', data: data })
}

@ -44,3 +44,8 @@ export const getClueCount = async () => {
export const getOpearateRecord = async (params) => {
return await request.get({ url: '/admin-api/crm/clue-operate-record/list', params })
}
// 获取公海线索
export const getPublicClue = async (data) => {
return await request.put({ url: '/admin-api/crm/sch-clue/public/save', data })
}

@ -2,32 +2,32 @@ import request from '@/config/axios'
// 创建
export const createField = (data) => {
return request.post({ url: '/admin-api/crm/sign-param/create', data })
return request.post({ url: '/admin-api/crm/param/create', data: { ...data, module: 2 } })
}
// 更新
export const updateField = (data) => {
return request.put({ url: '/admin-api/crm/sign-param/update', data })
return request.put({ url: '/admin-api/crm/param/update', data })
}
// 删除
export const deleteField = (id) => {
return request.delete({ url: `/admin-api/crm/sign-param/delete?id=${id}` })
return request.delete({ url: `/admin-api/crm/param/delete?id=${id}` })
}
// 获得
export const getField = (id) => {
return request.get({ url: `/admin-api/crm/sign-param/get?id=${id}` })
return request.get({ url: `/admin-api/crm/param/get?id=${id}` })
}
// 获得精简信息列表
export const getSimpleFieldList = () => {
return request.get({ url: '/admin-api/crm/sign-param/simple-list' })
return request.get({ url: '/admin-api/crm/param/simple-list', params: { module: 2 } })
}
// 获取自定义字段
export const getDiyFieldList = () => {
return request.get({ url: '/admin-api/crm/sign-param/get-diy-param' })
return request.get({ url: '/admin-api/crm/param/get-diy-param', params: { module: 2 } })
}
// 状态修改
@ -36,5 +36,5 @@ export const updateFieldStatus = (signParamId, status) => {
signParamId,
status
}
return request.put({ url: '/admin-api/crm/sign-param/status/update', data: data })
return request.put({ url: '/admin-api/crm/param/status/update', data: data })
}

@ -0,0 +1,40 @@
import request from '@/config/axios'
// 创建
export const createField = (data) => {
return request.post({ url: '/admin-api/crm/param/create', data: { ...data, module: 3 } })
}
// 更新
export const updateField = (data) => {
return request.put({ url: '/admin-api/crm/param/update', data })
}
// 删除
export const deleteField = (id) => {
return request.delete({ url: `/admin-api/crm/param/delete?id=${id}` })
}
// 获得
export const getField = (id) => {
return request.get({ url: `/admin-api/crm/param/get?id=${id}` })
}
// 获得精简信息列表
export const getSimpleFieldList = () => {
return request.get({ url: '/admin-api/crm/param/simple-list', params: { module: 3 } })
}
// 获取自定义字段
export const getDiyFieldList = () => {
return request.get({ url: '/admin-api/crm/param/get-diy-param', params: { module: 3 } })
}
// 状态修改
export const updateFieldStatus = (signParamId, status) => {
const data = {
signParamId,
status
}
return request.put({ url: '/admin-api/crm/param/status/update', data: data })
}

@ -20,6 +20,6 @@ export const deletePurchase = async (id) => {
}
// 审核
export const auditPurchase = async (params) => {
return await request.get({ url: '/admin-api/crm/erp-purchase/audit', params })
export const auditPurchase = async (data) => {
return await request.post({ url: '/admin-api/crm/erp-purchase/audit', data })
}

@ -0,0 +1,11 @@
import request from '@/config/axios'
// 通过key,查询内容
export const getConfigByConfigKey = (params) => {
return request.get({ url: '/admin-api/crm/config/getConfigByConfigKey', params })
}
// 保存配置项
export const updateConfig = (data) => {
return request.put({ url: '/admin-api/crm/config/update', data })
}

@ -131,7 +131,7 @@ const toggleClick = () => {
<DictTag :type="item.dictType" :value="data[item.field] + ''" />
</slot>
<slot v-else-if="item.isEditor">
<div v-dompurify-html="data[item.field]"></div>
<div v-if="data[item.field]" v-dompurify-html="data[item.field]"></div>
</slot>
<slot v-else :name="item.field" :row="data">{{ data[item.field] }}</slot>
</template>

@ -23,10 +23,10 @@
>
<el-button type="primary"><Icon icon="ep:upload-filled" />选取文件</el-button>
<template v-if="isShowTip" #tip>
<div style="font-size: 8px">
<div style="font-size: 12px">
大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
</div>
<div style="font-size: 8px">
<div style="font-size: 12px">
格式为 <b style="color: #f56c6c">{{ fileType.join('/') }}</b> 的文件
</div>
</template>

@ -1,6 +1,6 @@
<template>
<Dialog title="成交登记" v-model="show" width="800px">
<Descriptions :data="info" :schema="schema" :columns="2" />
<Descriptions :data="info" :schema="showSchema" :columns="2" />
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px" class="mt-20px">
<el-row :gutter="20">
<el-col :span="12" :offset="0">
@ -42,48 +42,60 @@
</Dialog>
</template>
<script setup>
<script setup name="DialogSuccess">
import * as ClueApi from '@/api/clue'
import { formatDate } from '@/utils/formatTime'
const show = ref(false)
const form = ref({})
const rules = ref({})
const info = ref({})
const schema = ref([
{
field: 'name',
label: '线索名称'
},
{
field: 'specsName',
label: '联系方式'
},
{
field: 'supplier',
label: '意向状态'
},
{
field: 'supplier',
label: '创建时间'
},
{
field: 'purchaseCount',
label: '诉求',
span: 2
},
{
field: 'remark',
label: '备注',
isEditor: true,
span: 2
const props = defineProps({
schema: {
type: Array
}
])
})
const showSchema = computed(() => {
const arr = [
{
field: 'requirement',
label: '诉求',
span: 2
},
{
field: 'remark',
label: '备注',
isEditor: true,
span: 2
}
]
return [...props.schema, ...arr]
})
function open(val) {
show.value = true
info.value = { ...val }
async function open(id) {
try {
resetForm(id)
const data = await ClueApi.getClue(id)
info.value = { ...data, ...data.diyParams }
show.value = true
} catch (error) {
console.log(error)
}
}
defineExpose({ open }) // open
function resetForm(id) {
form.value = {
clueId: id,
dealDate: formatDate(new Date()),
state: true,
payPrice: 0,
remark: undefined
}
}
function handleSave() {
console.log('保存成功')
}

@ -19,8 +19,12 @@
<el-tag type="success">{{ info.intentionState }}</el-tag>
</div>
<div>
<el-button type="primary" plain @click="handleUpdate">修改</el-button>
<el-button type="danger" plain @click="handleRemove">删除</el-button>
<el-button type="primary" v-hasPermi="['clue:pool:update']" plain @click="handleUpdate">
修改
</el-button>
<el-button type="danger" v-hasPermi="['clue:pool:delete']" plain @click="handleRemove">
删除
</el-button>
</div>
</div>
</el-skeleton>
@ -37,7 +41,13 @@
<!-- 详细信息 -->
<el-tabs v-model="infoIndex" type="border-card">
<el-tab-pane label="跟进记录" name="followRecord">
<el-button class="mb-10px" type="primary" @click="addFollow">添加跟进记录</el-button>
<el-button
v-hasPermi="['clue:pool:update']"
class="mb-10px"
type="primary"
@click="addFollow"
>添加跟进记录</el-button
>
<el-timeline>
<el-timeline-item
v-for="item in followRecordList"
@ -148,7 +158,8 @@ const showSchema = computed(() => {
{
field: 'remark',
label: '备注',
span: 2
span: 2,
isEditor: true
}
]
return [...props.schema, ...arr]

@ -94,30 +94,42 @@
>
详情
</el-button>
<el-button
type="primary"
link
@click="handleEdit(scope.row)"
v-hasPermi="['clue:pool:update']"
>
修改
</el-button>
<el-button
type="primary"
link
@click="handleSuccess(scope.row)"
v-hasPermi="['clue:pool:enroll']"
>
登记
</el-button>
<el-button
type="primary"
link
v-hasPermi="['clue:pool:release']"
@click="handleRelease(scope.row.clueId)"
>
释放
</el-button>
<template v-if="queryType != 4">
<el-button
type="primary"
link
@click="handleEdit(scope.row)"
v-hasPermi="['clue:pool:update']"
>
修改
</el-button>
<el-button
type="primary"
link
@click="handleSuccess(scope.row)"
v-hasPermi="['clue:pool:enroll']"
>
登记
</el-button>
<el-button
type="primary"
link
v-hasPermi="['clue:pool:release']"
@click="handleRelease(scope.row.clueId)"
>
释放
</el-button>
</template>
<template v-else>
<el-button
type="primary"
link
v-hasPermi="['clue:pool:gain']"
@click="handleGain(scope.row.clueId)"
>
获取
</el-button>
</template>
</template>
</el-table-column>
</SSTable>
@ -136,7 +148,7 @@
@get-list="getTableList"
@update="handleEdit"
/>
<DialogSuccess ref="successRef" />
<DialogSuccess ref="successRef" :schema="allSchemas.formSchema" />
<DialogFollow ref="followRef" @success="getTableList" />
</div>
</template>
@ -256,7 +268,7 @@ async function makeCall(phone) {
//
function handleSuccess(row) {
successRef.value.open(row)
successRef.value.open(row.clueId)
}
//
@ -280,6 +292,21 @@ function handleRelease(id) {
})
}
function handleGain(id) {
message.confirm('是否确认获取公海线索?').then(() => {
try {
ClueApi.getPublicClue({
clueId: id,
publicClue: false
}).then(() => {
message.success('获取成功')
})
} finally {
getTableList()
}
})
}
const userOptions = ref([])
onMounted(() => {
getUserOption().then((data) => {

@ -2,45 +2,55 @@
<el-row :gutter="80">
<el-col :span="10" :offset="0">
<el-button class="mb-10px" type="primary" @click="handleInsert">新增属性</el-button>
<el-table :data="tableList">
<el-table-column prop="name" label="名称" />
<el-table-column label="启用状态">
<el-table :data="tableList" :row-class-name="setRowClass" @row-click="handleRowClick">
<el-table-column prop="label" label="名称" />
<el-table-column prop="field" label="属性编码" />
<el-table-column prop="component" label="类型" width="200px">
<template #default="{ row }">
{{ typeOptions.find((it) => it.value == row.component).label }}
</template>
</el-table-column>
<el-table-column label="启用状态" width="100">
<template #default="{ row }">
<el-switch
v-model="row.status"
:active-value="1"
:inactive-value="0"
:disabled="!row.canUpdate"
:active-value="0"
:inactive-value="1"
@change="changeStatus(row)"
/>
</template>
</el-table-column>
<el-table-column label="操作" width="80px">
<template #default="{ row }">
<el-button
type="primary"
text
:disabled="!row.canUpdate"
style="padding: 0"
@click="remove(row)"
<el-button type="primary" text style="padding: 0" @click="remove(row.clueParamId)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="14" :offset="0">
<el-form :model="form" ref="fieldForm" :rules="rules" label-width="80px" :inline="false">
<el-form-item label="属性名称" prop="name">
<el-input v-model="form.name" placeholder="请输入属性名称" />
<el-col :span="14" :offset="0" v-if="tableList.length || formType == 'create'">
<el-form :model="form" ref="fieldForm" :rules="rules" label-width="100px" :inline="false">
<el-form-item label="属性名称" prop="label">
<el-input v-model="form.label" placeholder="请输入属性名称" />
</el-form-item>
<el-form-item prop="field">
<template #label>
<div class="flex justify-center" style="align-items: center">
<span>属性编码</span>
<Tooltip message="请输入字母或数字,必须以字母开头" />
</div>
</template>
<el-input v-model="form.field" placeholder="请输入属性编码" />
</el-form-item>
<el-form-item label="属性类型" prop="type">
<el-form-item label="属性类型" prop="component">
<el-select
v-model="form.type"
v-model="form.component"
placeholder="请选择属性类型"
clearable
filterable
style="width: 100%"
@change="form.options = []"
>
<el-option
v-for="item in typeOptions"
@ -51,72 +61,174 @@
</el-select>
</el-form-item>
<el-form-item
v-if="['Checkbox', 'Radio', 'Select'].includes(form.type)"
v-if="['Checkbox', 'Radio', 'Select'].includes(form.component)"
label="选项"
prop="option"
key="option"
prop="options"
key="options"
>
<div>
<el-button type="primary" @click="optionList.push([])"> 新增选项 </el-button>
<el-button type="primary" @click="handleAddOption"> 新增选项 </el-button>
<div
class="flex justify-between mt-10px"
v-for="(item, index) in optionList"
v-for="(item, index) in form.options"
:key="index"
>
<el-input v-model="item.label" placeholder="请输入选项内容" clearable />
<el-button type="primary" text @click="optionList.splice(index, 1)">删除</el-button>
<el-input
v-model="item.name"
placeholder="请输入选项内容"
clearable
style="width: 300px !important"
@blur="item.id = item.name"
/>
<el-button type="primary" text @click="form.options.splice(index, 1)">删除</el-button>
</div>
</div>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button type="primary" :disabled="formLoading" @click="onSubmit">保存</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
</template>
<script setup>
const tableList = ref([{ name: '单位', status: 0, canUpdate: true }])
<script setup name="FieldProduct">
import * as FieldApi from '@/api/mall/product/productField'
import { getDictOptions } from '@/utils/dict'
const message = useMessage() //
const { t } = useI18n() //
const tableList = ref([])
const currentRowId = ref('')
function setRowClass({ row }) {
return row.field == currentRowId.value ? 'current-row' : ''
}
function handleRowClick(row) {
formType.value = 'update'
currentRowId.value = row.field
form.value = { ...row }
}
const form = ref({
name: undefined,
type: undefined,
option: undefined
label: undefined,
field: '',
component: undefined,
options: [],
status: 0,
isCustom: true,
isForm: true,
isSearch: true,
isTable: true
})
const typeOptions = ref([
{ label: '输入框', value: 'Input' },
{ label: '多选', value: 'Checkbox' },
{ label: '单选', value: 'Radio' },
{ label: '下拉选', value: 'Select' },
{ label: '开关', value: 'Switch' },
{ label: '日期选择', value: 'DatePicker' },
{ label: '时间选择', value: 'TimePicker' },
{ label: '富文本', value: 'Editor' },
{ label: '图片', value: 'UploadImg' },
{ label: '文件', value: 'UploadFile' }
])
const loading = ref(false)
const typeOptions = ref([])
const rules = {}
const rules = {
label: { required: true, message: '名称不可为空', trigger: 'blur' },
field: { required: true, message: '编码不可为空', trigger: 'blur' },
component: { required: true, message: '类型不可为空', trigger: 'change' }
}
async function getList() {
loading.value = true
try {
const data = await FieldApi.getDiyFieldList()
tableList.value = data
if (data.length) {
handleRowClick(data[0])
}
} finally {
loading.value = false
}
}
const optionList = ref([])
const formType = ref('')
function handleInsert() {
console.log('新增')
formType.value = 'create'
form.value = {
label: undefined,
field: '',
component: undefined,
options: [],
status: 0,
isCustom: true,
isForm: true,
isSearch: true,
isTable: true
}
}
function changeStatus(row) {
console.log(row.status)
async function remove(id) {
try {
//
await message.delConfirm()
//
await FieldApi.deleteField(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch (err) {
console.log(err)
}
}
function remove(row) {
console.log(row.status)
async function changeStatus(row) {
try {
//
await message.confirm('是否确认修改状态')
await FieldApi.updateFieldStatus(row.clueParamId, row.status)
message.success('修改成功')
//
await getList()
} catch {
//
row.status = row.status == 0 ? 1 : 0
}
}
function onSubmit() {
console.log('保存')
const fieldForm = ref()
const formLoading = ref(false)
function handleAddOption() {
if (form.value.options) {
form.value.options.push({})
} else {
form.value.options = []
}
}
async function onSubmit() {
//
if (!fieldForm.value) return
const valid = await fieldForm.value.validate()
if (!valid) return
//
formLoading.value = true
try {
if (formType.value === 'create') {
await FieldApi.createField(form.value)
message.success(t('common.createSuccess'))
} else {
await FieldApi.updateField(form.value)
message.success(t('common.updateSuccess'))
}
//
getList()
} finally {
formLoading.value = false
}
}
onMounted(() => {
typeOptions.value = getDictOptions('attribute_type')
getList()
})
</script>
<style lang="scss" scoped></style>

@ -1,34 +1,50 @@
<template>
<el-form :model="form" ref="formRef" label-width="auto">
<el-form-item label="采购申请自动通过">
<el-radio-group v-model="form.autoAuditPurchase">
<el-radio :label="true"> </el-radio>
<el-radio :label="false"> </el-radio>
<el-radio-group v-model="form.purchaseAuditAutoCompleteConfig">
<el-radio label="true"> </el-radio>
<el-radio label="false"> </el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button @click="getData">刷新</el-button>
</el-form-item>
</el-form>
</template>
<script setup name="BasicSettingMall">
import * as ConfigApi from '@/api/system/set'
const message = useMessage()
const form = ref({
autoAuditPurchase: 0
purchaseAuditAutoCompleteConfig: 'true'
})
const info = ref({})
function getData() {
form.value = {
autoAuditPurchase: 1
}
ConfigApi.getConfigByConfigKey({ configKey: 'purchaseAuditAutoCompleteConfig' }).then((data) => {
info.value = data
form.value = {
purchaseAuditAutoCompleteConfig: data.configValue
}
})
}
function onSubmit() {
message.success('保存成功')
const data = {
...info,
purchaseAuditAutoCompleteConfig: form.value.purchaseAuditAutoCompleteConfig
}
ConfigApi.updateConfig(data).then(() => {
message.success('保存成功')
})
}
onMounted(() => {
getData()
})
</script>
<style lang="scss" scoped></style>

@ -33,6 +33,38 @@
</el-select>
</el-form-item>
</el-col>
<el-col
:span="8"
:offset="0"
v-for="fieldItem in diyFieldList"
:key="fieldItem.clueParamId"
>
<el-form-item :label="fieldItem.label" :prop="fieldItem.field">
<component :is="componentMap[fieldItem.component]" v-model="form[fieldItem.field]">
<template v-if="fieldItem.component == 'Select'">
<el-option
v-for="item in fieldItem.options"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</template>
<template v-else-if="fieldItem.component == 'Radio'">
<el-radio v-for="item in fieldItem.options" :key="item.id" :label="item.id">
{{ item.name }}
</el-radio>
</template>
<template v-else-if="fieldItem.component == 'Checkbox'">
<el-checkbox
v-for="item in fieldItem.options"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</template>
</component>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
@ -51,7 +83,7 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-row :gutter="20" v-if="!formLoading">
<el-col :span="24" :offset="0">
<el-form-item label="轮播图" prop="carouselImages">
<UploadImgs v-model="form.carouselImages" height="100px" width="100px" />
@ -143,21 +175,25 @@
</el-tabs>
<div class="mt-20px flex justify-center">
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button plain>重置</el-button>
<el-button plain @click="router.replace('/MiniMall/product')">返回列表</el-button>
</div>
<ProductAttributesAddForm ref="attributesAddFormRef" :propertyList="form.productSpecList" />
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { getDiyFieldList } from '@/api/mall/product/productField'
import * as PropertyApi from '@/api/mall/product/property'
import * as ProductApi from '@/api/mall/product/index'
import ProductAttributesAddForm from './Comp/ProductAttributesAddForm.vue'
import * as BrandApi from '@/api/mall/product/brand'
import * as CategoryApi from '@/api/mall/product/category'
import { handleTree } from '@/utils/tree'
import { isObject } from '@/utils/is.ts'
import { componentMap } from '@/components/Form/src/componentMap'
const route = useRoute()
const router = useRouter()
const message = useMessage() //
const { t } = useI18n() //
@ -184,7 +220,11 @@ const opts = ref({
category: []
})
const diyFieldList = ref([])
async function getOptions() {
getDiyFieldList().then((data) => {
diyFieldList.value = data
})
BrandApi.getSimpleBrandList().then((data) => {
opts.value.brand = data || []
})
@ -329,24 +369,35 @@ const spuForm = ref()
function onSubmit() {
spuForm.value.validate(async (valid) => {
if (valid && validateSku()) {
// , server
const deepCopyFormData = cloneDeep(unref(form.value))
deepCopyFormData.productSpecList = deepCopyFormData.skuList
if (deepCopyFormData.productCategory && deepCopyFormData.productCategory.length) {
deepCopyFormData.productCategory = deepCopyFormData.productCategory.at(-1)
}
delete deepCopyFormData.skuList
//
const data = deepCopyFormData
const id = route.query.id
if (!id) {
await ProductApi.createProduct(data)
message.success(t('common.createSuccess'))
} else {
await ProductApi.updateProduct(data)
message.success(t('common.updateSuccess'))
try {
if (valid && validateSku()) {
// , server
const deepCopyFormData = cloneDeep(unref(form.value))
deepCopyFormData.productSpecList = deepCopyFormData.skuList
if (deepCopyFormData.productCategory && deepCopyFormData.productCategory.length) {
deepCopyFormData.productCategory = deepCopyFormData.productCategory.at(-1)
}
delete deepCopyFormData.skuList
//
let data = {
...deepCopyFormData,
diyParams: {}
}
for (let i = 0; i < diyFieldList.value.length; i++) {
const element = diyFieldList.value[i]
data.diyParams[element.field] = data[element.field]
}
const id = route.query.id
if (!id) {
await ProductApi.createProduct(data)
message.success(t('common.createSuccess'))
} else {
await ProductApi.updateProduct(data)
message.success(t('common.updateSuccess'))
}
}
} catch (error) {
console.log(error)
}
})
}
@ -414,10 +465,15 @@ const getDetail = async () => {
formLoading.value = true
try {
const res = await ProductApi.getProduct(route.query.id)
const propList = getPropertyList(res.productSpecList)
let diyField = {}
if (res.diyParams) {
diyField = isObject(res.diyParams) ? res.diyParams : JSON.parse(res.diyParams)
}
const propList = getPropertyList(res?.productSpecList || [])
form.value = {
...res,
skuList: res.productSpecList,
...diyField,
skuList: res?.productSpecList || [],
productSpecList: propList
}
} finally {

@ -81,7 +81,15 @@
</el-table-column>
<el-table-column label="简介" min-width="70" prop="productIntro" />
<el-table-column :formatter="dateFormatter" label="创建时间" prop="createTime" width="180" />
<el-table-column fixed="right" label="操作" min-width="80">
<el-table-column v-for="item in diyFieldList" :key="item.clueParamId" :label="item.label">
<template #default="{ row }">
<div v-if="item.component == 'DatePicker'">
{{ formatDate(row[item.field]) }}
</div>
<div v-else>{{ row[item.field] }}</div>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="100">
<template #default="{ row }">
<!-- TODO详情可以后面点做哈 -->
<el-button
@ -113,12 +121,14 @@
</template>
<script setup name="Product">
import { dateFormatter } from '@/utils/formatTime'
import { getDiyFieldList } from '@/api/mall/product/productField'
import { dateFormatter, formatDate } from '@/utils/formatTime'
import { createImageViewer } from '@/components/ImageViewer'
import * as ProductApi from '@/api/mall/product'
import * as BrandApi from '@/api/mall/product/brand'
import * as CategoryApi from '@/api/mall/product/category'
import { handleTree } from '@/utils/tree'
import { isObject } from '@/utils/is.ts'
const { currentRoute, push } = useRouter()
const message = useMessage() //
@ -162,13 +172,20 @@ async function getList() {
params.productCategory = params.productCategory.at(-1)
}
const data = await ProductApi.getProductPage(params)
tableList.value = data.list.map((prod) => ({
...prod,
properties: prod.productSpecList[0].properties.map((item) => ({
propertyId: item.propertyId,
label: item.propertyName
}))
}))
tableList.value = data.list.map((prod) => {
let diyField = {}
if (prod.diyParams) {
diyField = isObject(prod.diyParams) ? prod.diyParams : JSON.parse(prod.diyParams)
}
return {
...prod,
...diyField,
properties: prod.productSpecList[0].properties.map((item) => ({
propertyId: item.propertyId,
label: item.propertyName
}))
}
})
total.value = data.total
} finally {
loading.value = false
@ -187,7 +204,12 @@ function handleQuery() {
getList()
}
const diyFieldList = ref([])
async function getOptions() {
getDiyFieldList().then((data) => {
diyFieldList.value = data
})
BrandApi.getSimpleBrandList().then((data) => {
opts.value.brand = data || []
})

@ -99,6 +99,8 @@ import * as WarehouseApi from '@/api/mall/warehouse'
const { t } = useI18n() //
const message = useMessage() //
const emit = defineEmits(['success'])
const props = defineProps({
opts: {
type: Object,

@ -6,8 +6,8 @@
<el-col :span="24" :offset="0">
<el-form-item label="审核" prop="isPass">
<el-radio-group v-model="form.isPass">
<el-radio :label="2">通过</el-radio>
<el-radio :label="3">驳回</el-radio>
<el-radio :label="true">通过</el-radio>
<el-radio :label="false">驳回</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@ -23,13 +23,15 @@
<template #footer>
<span>
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="handleSave"> </el-button>
<el-button :disabled="formLoading" type="primary" @click="handleSave"> </el-button>
</span>
</template>
</Dialog>
</template>
<script setup name="DialogAuditPurchase">
import { auditPurchase } from '@/api/mall/purchase'
const message = useMessage() //
const dialogVisible = ref(false) //
const form = ref({})
@ -65,7 +67,7 @@ const open = (val, flag) => {
]
schema.value = [...schema.value, ...arr]
} else {
form.value.isPass = 2
form.value.isPass = true
form.value.auditRemark = ''
}
}
@ -119,8 +121,19 @@ const resetSchema = () => {
]
}
function handleSave() {
console.log('保存')
const formLoading = ref(false)
const emit = defineEmits(['getList'])
async function handleSave() {
try {
formLoading.value = true
await auditPurchase(form.value)
message.success('审核完成')
dialogVisible.value = false
//
emit('getList')
} finally {
formLoading.value = false
}
}
</script>

@ -125,7 +125,7 @@
/>
<DialogAdd :opts="opts" ref="creatPurchase" />
<DialogAudit ref="auditPurchase" />
<DialogAudit ref="auditPurchase" @get-list="getList" />
</div>
</template>

Loading…
Cancel
Save