forked from natuka/web.puabadge.com
代码提交
This commit is contained in:
1 parent
fbb14eafe4
commit
9f472390d9
6 files changed
+64
-147
No files matched your search
+29
-34
@@ -14,8 +14,16 @@
|
||||
<div class="order-type-item-title">
|
||||
{{ toValueWithout("产品类型") }}
|
||||
</div>
|
||||
<div class="order-type-item-title" v-if="productTypeConfig">
|
||||
{{ toValueWithout(productTypeConfig.name) }}
|
||||
<div class="order-type-item-title" v-if="typeName">
|
||||
{{ toValueWithout(typeName) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="order-type-item" v-if="prodId">
|
||||
<div class="order-type-item-title">
|
||||
{{ toValueWithout("主体类型") }}
|
||||
</div>
|
||||
<div class="order-type-item-title" v-if="subjectName">
|
||||
{{ toValueWithout(subjectName) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -322,39 +330,30 @@ const prodId = ref(0)
|
||||
const prop = ref('')
|
||||
const typeId = ref(0)
|
||||
const subjectId = ref(0)
|
||||
|
||||
const typeName = ref('')
|
||||
const subjectName = ref('')
|
||||
const getOrderStat = () => {
|
||||
badgeApi.getOrderStat({}).then((res: any) => {
|
||||
orderStat.value = res
|
||||
const oldProdId = prodId.value
|
||||
const oldTypeId = typeId.value
|
||||
prodId.value = res.prod_id
|
||||
prop.value = res.prop
|
||||
typeId.value = res.type_id
|
||||
typeName.value = res.type_name
|
||||
subjectId.value = res.subject_id
|
||||
subjectName.value = res.subject_name
|
||||
if (res.type_id === 4) {
|
||||
getKindList()
|
||||
} else {
|
||||
// 非类型4的产品需要获取形状列表
|
||||
// 如果产品ID或类型ID发生变化,重置选中的形状
|
||||
if (oldProdId !== res.prod_id || oldTypeId !== res.type_id) {
|
||||
mountsId.value = 0
|
||||
}
|
||||
} else if (res.type_id === 8) {
|
||||
mountsId.value = 0
|
||||
getmountsList()
|
||||
} else if (res.type_id === 9) {
|
||||
method.value = 1
|
||||
scenePropsInputs.value = ['']
|
||||
scene_prop.value = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 计算属性:当前产品类型配置
|
||||
const productTypeConfig = computed(() => {
|
||||
return config.productTypes[typeId.value]
|
||||
})
|
||||
|
||||
// 计算属性:是否是宠物主体
|
||||
const isPetSubject = computed(() => {
|
||||
return config.subjectTypes.pet.prodIds.includes(prodId.value)
|
||||
})
|
||||
|
||||
// 计算属性:是否显示照片示例
|
||||
const shouldShowPhotoExample = computed(() => {
|
||||
return config.productLimits.photoExampleTypes.includes(prop.value)
|
||||
@@ -373,19 +372,14 @@ const shouldShowMultiView = computed(() => {
|
||||
const kindList = ref([])
|
||||
const getKindList = () => {
|
||||
badgeApi.getKindList({
|
||||
support_subject: getSupportSubject(),
|
||||
type_id: 4
|
||||
prod_id: prodId.value
|
||||
}).then((res: any) => {
|
||||
kindList.value = res.list
|
||||
kindId.value = res.list && res.list[0]?.id
|
||||
})
|
||||
}
|
||||
|
||||
const getSupportSubject = (): number => {
|
||||
return isPetSubject.value
|
||||
? config.subjectTypes.pet.supportSubject
|
||||
: config.subjectTypes.person.supportSubject
|
||||
}
|
||||
|
||||
|
||||
const kindId = ref(0)
|
||||
const kindChange = (id: number) => {
|
||||
@@ -407,7 +401,7 @@ const getmountsList = () => {
|
||||
if (!prodId.value || !typeId.value) {
|
||||
return
|
||||
}
|
||||
badgeApi.getShapeList({
|
||||
badgeApi.getMountsList({
|
||||
prod_id: prodId.value,
|
||||
type_id: typeId.value
|
||||
}).then((res: any) => {
|
||||
@@ -639,7 +633,6 @@ const getPid = async () => {
|
||||
})
|
||||
const params = {
|
||||
prod_id: prodId.value,
|
||||
extend_value: -1,
|
||||
type_id: typeId.value,
|
||||
subject_id: subjectId.value
|
||||
}
|
||||
@@ -740,7 +733,10 @@ const createLog = () => {
|
||||
prod_id: prodId.value,
|
||||
type_id: typeId.value,
|
||||
kind_id: kindId.value,
|
||||
subject_id: subjectId.value
|
||||
subject_id: subjectId.value,
|
||||
scene_prop: typeId.value === 9 && method.value === 2 && scene_prop.value ? scene_prop.value : undefined,
|
||||
mounts_id: mountsId.value || undefined,
|
||||
method: method.value
|
||||
}
|
||||
badgeApi.createLog(params).then(() => {
|
||||
closeToast()
|
||||
@@ -758,9 +754,7 @@ const createLog = () => {
|
||||
prod_id: prodId.value,
|
||||
type_id: typeId.value,
|
||||
kind_id: kindId.value,
|
||||
mounts_id: mountsId.value || undefined,
|
||||
subject_id: subjectId.value,
|
||||
scene_prop: typeId.value === 9 && method.value === 2 && scene_prop.value ? scene_prop.value : undefined
|
||||
subject_id: subjectId.value
|
||||
},
|
||||
})
|
||||
}, 1000);
|
||||
@@ -1074,6 +1068,7 @@ onMounted(() => {
|
||||
}
|
||||
.kind-box-item {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 6px 10px;
|
||||
background: #f5f5f5;
|
||||
border-radius: 8px;
|
||||
|
||||
Reference in new issue
Block a user