商品发布/详情与类型管理支持隐藏式归属商家端类型选择。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-22 16:26:43 +08:00
parent 578f534571
commit 42fc1425aa
3 changed files with 73 additions and 5 deletions

View File

@@ -74,7 +74,23 @@
<el-option label="商家端" :value="3" />
<el-option label="隐藏式" :value="4" />
</el-select>
<div class="form-tip">1点单正常 / 2审核专用 / 3商家端 / 4扫管事码后点单可见抢单池也可见</div>
<div class="form-tip">1点单正常 / 2审核专用 / 3商家端 / 4扫管事码后点单可见</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" v-if="form.shenhezhuangtai === 4">
<el-col :span="12">
<el-form-item label="归属商家端">
<el-select v-model="form.guishu_leixing_id" clearable placeholder="可选,归属哪个商家端类型" popper-class="custom-select-dropdown">
<el-option
v-for="type in merchantTypes"
:key="type.id"
:label="type.jieshao"
:value="type.id"
/>
</el-select>
<div class="form-tip">有归属时点单写入订单的抢单类型为该商家端类型</div>
</el-form-item>
</el-col>
</el-row>
@@ -294,6 +310,7 @@ const form = reactive({
tupian_url: '',
guize_tupian: '',
shenhezhuangtai: 1,
guishu_leixing_id: null,
create_time: null,
imagePreview: '',
newImageFile: null,
@@ -372,6 +389,7 @@ const hasChanges = () => {
jieshao: form.jieshao,
xiadan_xuzhi: form.xiadan_xuzhi,
shenhezhuangtai: form.shenhezhuangtai,
guishu_leixing_id: form.guishu_leixing_id || null,
tupian_url: form.tupian_url,
guize_tupian: form.guize_tupian
}
@@ -390,6 +408,7 @@ const hasChanges = () => {
jieshao: originalForm.jieshao,
xiadan_xuzhi: originalForm.xiadan_xuzhi,
shenhezhuangtai: originalForm.shenhezhuangtai,
guishu_leixing_id: originalForm.guishu_leixing_id || null,
tupian_url: originalForm.tupian_url,
guize_tupian: originalForm.guize_tupian
}
@@ -416,7 +435,8 @@ const enterEditMode = () => {
xiadan_xuzhi: product.value.xiadan_xuzhi || '',
tupian_url: product.value.tupian_url,
guize_tupian: product.value.guize_tupian,
shenhezhuangtai: product.value.shenhezhuangtai
shenhezhuangtai: product.value.shenhezhuangtai,
guishu_leixing_id: product.value.guishu_leixing_id || null
})
Object.assign(form, {
id: product.value.id,
@@ -437,6 +457,7 @@ const enterEditMode = () => {
tupian_url: product.value.tupian_url,
guize_tupian: product.value.guize_tupian,
shenhezhuangtai: product.value.shenhezhuangtai,
guishu_leixing_id: product.value.guishu_leixing_id || null,
create_time: product.value.create_time,
imagePreview: '',
newImageFile: null,
@@ -498,6 +519,7 @@ const saveProduct = async () => {
formData.append('jieshao', form.jieshao || '')
formData.append('xiadan_xuzhi', form.xiadan_xuzhi || '')
formData.append('shenhezhuangtai', form.shenhezhuangtai)
formData.append('guishu_leixing_id', form.guishu_leixing_id || '')
// 图片处理:如果有新文件,传文件;否则传原有的 url可能为空后端自行处理
if (form.newImageFile) {
@@ -644,6 +666,7 @@ const fetchProductDetail = async () => {
tupian_url: product.value.tupian_url,
guize_tupian: product.value.guize_tupian,
shenhezhuangtai: product.value.shenhezhuangtai,
guishu_leixing_id: product.value.guishu_leixing_id || null,
create_time: product.value.create_time,
imagePreview: '',
newImageFile: null,

View File

@@ -192,6 +192,25 @@
/>
</el-select>
</el-form-item>
<el-form-item label="审核状态" prop="shenhezhuangtai">
<el-radio-group v-model="addForm.shenhezhuangtai">
<el-radio :label="1">正常</el-radio>
<el-radio :label="2">审核专用</el-radio>
<el-radio :label="3">商家端</el-radio>
<el-radio :label="4">隐藏式</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="addForm.shenhezhuangtai === 4" label="归属商家端">
<el-select v-model="addForm.guishu_leixing_id" clearable placeholder="可选,归属哪个商家端类型">
<el-option
v-for="type in merchantTypeOptions"
:key="type.id"
:label="type.jieshao"
:value="type.id"
/>
</el-select>
<div class="form-tip">有归属时点单写入订单的抢单类型为该商家端类型</div>
</el-form-item>
<el-form-item label="抢单要求类型" prop="yaoqiuleixing">
<el-radio-group v-model="addForm.yaoqiuleixing">
<el-radio :label="1">会员</el-radio>
@@ -607,6 +626,8 @@ const addForm = reactive({
ewai_dashou_fencheng: 0,
jieshao: '',
xiadan_xuzhi: '',
shenhezhuangtai: 1,
guishu_leixing_id: null,
imageFile: null,
imagePreview: ''
})
@@ -616,9 +637,11 @@ const addRules = {
kucun: [{ required: true, message: '请输入库存', trigger: 'blur' }],
leixing_id: [{ required: true, message: '请选择类型', trigger: 'change' }],
zhuanqu_id: [{ required: true, message: '请选择专区', trigger: 'change' }],
shenhezhuangtai: [{ required: true, message: '请选择审核状态', trigger: 'change' }],
yaoqiuleixing: [{ required: true, message: '请选择抢单要求类型', trigger: 'change' }],
imageFile: [{ required: true, message: '请上传商品图片', trigger: 'change' }]
}
const merchantTypeOptions = computed(() => typeList.value.filter(t => Number(t.shenhezhuangtai) === 3))
const zonesFilteredByType = computed(() => {
if (!addForm.leixing_id) return []
let zones = zoneList.value.filter(z => z.leixing_id === addForm.leixing_id)
@@ -673,6 +696,8 @@ const resetAddForm = () => {
ewai_dashou_fencheng: 0,
jieshao: '',
xiadan_xuzhi: '',
shenhezhuangtai: 1,
guishu_leixing_id: null,
imageFile: null,
imagePreview: ''
})
@@ -703,6 +728,8 @@ const submitAddProduct = async () => {
formData.append('yaoqiuleixing', addForm.yaoqiuleixing)
formData.append('jieshao', addForm.jieshao || '')
formData.append('xiadan_xuzhi', addForm.xiadan_xuzhi || '')
formData.append('shenhezhuangtai', addForm.shenhezhuangtai)
formData.append('guishu_leixing_id', addForm.shenhezhuangtai === 4 ? (addForm.guishu_leixing_id || '') : '')
formData.append('fencheng_type', addForm.fencheng_type)
if (addForm.yaoqiuleixing === 1) {
if (addForm.huiyuan_id) formData.append('huiyuan_id', addForm.huiyuan_id)

View File

@@ -164,6 +164,17 @@
<el-radio :label="4">隐藏式</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="typeForm.shenhezhuangtai === 4" label="归属商家端" prop="guishu_leixing_id">
<el-select v-model="typeForm.guishu_leixing_id" clearable placeholder="可选,归属哪个商家端类型">
<el-option
v-for="t in merchantTypeOptions"
:key="t.id"
:label="t.jieshao"
:value="t.id"
/>
</el-select>
<div class="tip">点单后订单抢单类型会归到所选商家端类型抢单池按商家端展示</div>
</el-form-item>
<el-form-item label="吃龙虾商品类型" prop="is_special_type">
<el-switch v-model="typeForm.is_special_type" />
<div class="tip">开启后该商品类型为吃龙虾专用类型</div>
@@ -337,10 +348,11 @@ const isTypeEdit = ref(false)
const originalType = ref({})
const typeForm = reactive({
id: null, jieshao: '', tupian_url: '', yaoqiuleixing: 1,
huiyuan_id: '', yongjin: null, shenhezhuangtai: 1,
huiyuan_id: '', yongjin: null, shenhezhuangtai: 1, guishu_leixing_id: null,
is_special_type: false, is_cross_enabled: false, sync_to_products: false,
imageFile: null, imagePreview: ''
})
const merchantTypeOptions = computed(() => typeList.value.filter(t => Number(t.shenhezhuangtai) === 3))
const typeRules = {
jieshao: [{ required: true, message: '请输入类型名称', trigger: 'blur' }],
yaoqiuleixing: [{ required: true, message: '请选择抢单要求类型', trigger: 'change' }],
@@ -364,9 +376,10 @@ const editType = (type) => {
jieshao: type.jieshao,
tupian_url: type.tupian_url,
yaoqiuleixing: Number(type.yaoqiuleixing),
huiyuan_id: type.huiyuan_id || '',
huiyuan_id: type.huiyuan_id or '',
yongjin: type.yongjin,
shenhezhuangtai: Number(type.shenhezhuangtai),
guishu_leixing_id: type.guishu_leixing_id || null,
is_special_type: !!type.is_special_type,
is_cross_enabled: type.is_cross_enabled,
sync_to_products: false,
@@ -379,7 +392,7 @@ const editType = (type) => {
const resetTypeForm = () => {
Object.assign(typeForm, {
id: null, jieshao: '', tupian_url: '', yaoqiuleixing: 1,
huiyuan_id: '', yongjin: null, shenhezhuangtai: 1,
huiyuan_id: '', yongjin: null, shenhezhuangtai: 1, guishu_leixing_id: null,
is_special_type: false, is_cross_enabled: false, sync_to_products: false,
imageFile: null, imagePreview: ''
})
@@ -444,6 +457,11 @@ const submitType = async () => {
formData.append('shenhezhuangtai', typeForm.shenhezhuangtai)
formData.append('is_special_type', typeForm.is_special_type)
formData.append('is_cross_enabled', typeForm.is_cross_enabled)
if (typeForm.shenhezhuangtai === 4) {
formData.append('guishu_leixing_id', typeForm.guishu_leixing_id || '')
} else {
formData.append('guishu_leixing_id', '')
}
if (typeForm.yaoqiuleixing === 1) {
if (typeForm.huiyuan_id) formData.append('huiyuan_id', typeForm.huiyuan_id)
} else {