|
|
@@ -13,12 +13,12 @@
|
|
|
</template>
|
|
|
</up-form-item>
|
|
|
|
|
|
- <!-- 商家类目 -->
|
|
|
- <view class="card-title" v-if="!isProductCenter">商家类目</view>
|
|
|
- <up-form-item class="form-item" label="商家类目" prop="merchantCategoryId" :borderBottom="false"
|
|
|
+ <!-- 商品类目 -->
|
|
|
+ <view class="card-title" v-if="!isProductCenter">商品类目</view>
|
|
|
+ <up-form-item class="form-item" label="商品类目" prop="merchantCategoryId" :borderBottom="false"
|
|
|
@click="showMerchantCategory = true" :required="true" v-if="!isProductCenter">
|
|
|
<up-input v-model="formData.merchantCategoryDisplayName" disabled disabledColor="#ffffff"
|
|
|
- placeholder="请选择商家类目" inputAlign="right" border="none"></up-input>
|
|
|
+ placeholder="请选择商品类目" inputAlign="right" border="none"></up-input>
|
|
|
<template #right>
|
|
|
<up-icon name="arrow-right"></up-icon>
|
|
|
</template>
|
|
|
@@ -287,7 +287,7 @@
|
|
|
</view>
|
|
|
</up-popup>
|
|
|
|
|
|
- <!-- 商家类目选择弹窗 -->
|
|
|
+ <!-- 商品类目选择弹窗 -->
|
|
|
<up-popup
|
|
|
:show="showMerchantCategory"
|
|
|
@close="showMerchantCategory = false"
|
|
|
@@ -297,7 +297,7 @@
|
|
|
>
|
|
|
<view class="popup-content">
|
|
|
<view class="popup-header">
|
|
|
- <text class="popup-title">选择商家类目</text>
|
|
|
+ <text class="popup-title">选择商品类目</text>
|
|
|
</view>
|
|
|
|
|
|
<category-selector
|
|
|
@@ -374,8 +374,8 @@
|
|
|
const formData = ref({
|
|
|
categoryIds: [], // 选中的分类ID数组
|
|
|
categoryDisplayName: '', // 显示的分类名称
|
|
|
- merchantCategoryId: [], // 选中的商家类目ID数组(单选:长度始终为1)
|
|
|
- merchantCategoryDisplayName: '', // 显示的商家类目名称
|
|
|
+ merchantCategoryId: [], // 选中的商品类目ID数组(单选:长度始终为1)
|
|
|
+ merchantCategoryDisplayName: '', // 显示的商品类目名称
|
|
|
tempName: '', // 显示的运费模板名称
|
|
|
tempIds: [],
|
|
|
storeName: '',
|
|
|
@@ -407,7 +407,7 @@
|
|
|
const categoryData = ref([]);
|
|
|
const categoryRef = ref();
|
|
|
|
|
|
- // 商家类目相关
|
|
|
+ // 商品类目相关
|
|
|
const showMerchantCategory = ref(false);
|
|
|
const merchantCategoryData = ref([]);
|
|
|
const merchantCategoryRef = ref();
|
|
|
@@ -464,7 +464,7 @@
|
|
|
type: 'array',
|
|
|
required: true,
|
|
|
len: 1,
|
|
|
- message: '请选择一个商家类目',
|
|
|
+ message: '请选择一个商品类目',
|
|
|
trigger: ['blur','change']
|
|
|
},
|
|
|
storeName: {
|
|
|
@@ -575,22 +575,22 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 获取商家类目列表
|
|
|
+ // 获取商品类目列表
|
|
|
async function getMerchantCategoryList(){
|
|
|
try {
|
|
|
const { data } = await getMerchantCategory();
|
|
|
- console.log('原始商家类目数据:', data);
|
|
|
+ console.log('原始商品类目数据:', data);
|
|
|
|
|
|
merchantCategoryData.value = data.map(item => ({
|
|
|
id: item.id,
|
|
|
name: item.categoryName,
|
|
|
child: []
|
|
|
}));
|
|
|
- console.log('适配后的商家类目数据:', merchantCategoryData.value);
|
|
|
+ console.log('适配后的商品类目数据:', merchantCategoryData.value);
|
|
|
|
|
|
} catch (error) {
|
|
|
- console.error('获取商家类目失败:', error);
|
|
|
- uni.showToast({ title: '获取商家类目失败', icon: 'none' });
|
|
|
+ console.error('获取商品类目失败:', error);
|
|
|
+ uni.showToast({ title: '获取商品类目失败', icon: 'none' });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -663,7 +663,7 @@
|
|
|
productImages.value = [];
|
|
|
|
|
|
console.log('分类IDs:', formData.value.categoryIds);
|
|
|
- console.log('商家类目IDs:', formData.value.merchantCategoryId);
|
|
|
+ console.log('商品类目IDs:', formData.value.merchantCategoryId);
|
|
|
console.log('运费模板IDs:', formData.value.tempIds);
|
|
|
|
|
|
await nextTick();
|
|
|
@@ -725,7 +725,7 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 设置商家类目选择器
|
|
|
+ // 设置商品类目选择器
|
|
|
if (merchantCategoryRef.value && formData.value.merchantCategoryId.length > 0) {
|
|
|
await nextTick();
|
|
|
if (merchantCategoryRef.value.setSelectedIds) {
|
|
|
@@ -767,9 +767,9 @@
|
|
|
console.log('分类选择变化:', result);
|
|
|
}
|
|
|
|
|
|
- // 商家类目选择变化
|
|
|
+ // 商品类目选择变化
|
|
|
const onMerchantCategoryChange = (result) => {
|
|
|
- console.log('商家类目选择变化:', result);
|
|
|
+ console.log('商品类目选择变化:', result);
|
|
|
}
|
|
|
|
|
|
// 确认分类选择
|
|
|
@@ -798,25 +798,25 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 确认商家类目选择
|
|
|
+ // 确认商品类目选择
|
|
|
const confirmMerchantCategory = () => {
|
|
|
if (merchantCategoryRef.value) {
|
|
|
let selectedIds = merchantCategoryRef.value.getSelectedIds()
|
|
|
|
|
|
if (selectedIds.length === 0) {
|
|
|
- uni.showToast({ title: '请选择一个商家类目', icon: 'none' })
|
|
|
+ uni.showToast({ title: '请选择一个商品类目', icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
if (selectedIds.length > 1) {
|
|
|
selectedIds = [selectedIds[0]]
|
|
|
- uni.showToast({ title: '商家类目仅支持选择一个', icon: 'none' })
|
|
|
+ uni.showToast({ title: '商品类目仅支持选择一个', icon: 'none' })
|
|
|
}
|
|
|
|
|
|
formData.value.merchantCategoryId = selectedIds
|
|
|
formData.value.merchantCategoryDisplayName = getMerchantCategoryDisplayName(selectedIds)
|
|
|
|
|
|
showMerchantCategory.value = false
|
|
|
- console.log('最终选中的商家类目ID(单选):', selectedIds)
|
|
|
+ console.log('最终选中的商品类目ID(单选):', selectedIds)
|
|
|
setTimeout(() => {
|
|
|
if (formRef.value) {
|
|
|
formRef.value.validateField('merchantCategoryId');
|
|
|
@@ -858,7 +858,7 @@
|
|
|
return names.join('、')
|
|
|
}
|
|
|
|
|
|
- // 生成商家类目显示名称
|
|
|
+ // 生成商品类目显示名称
|
|
|
const getMerchantCategoryDisplayName = (selectedIds) => {
|
|
|
if (!selectedIds || selectedIds.length === 0) return ''
|
|
|
|