master
parent
61602c3adb
commit
eccbae3b69
|
|
@ -312,4 +312,42 @@ export function updateBrand(data) {
|
|||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 新增分类
|
||||
export function addClassification(data) {
|
||||
return request8081({
|
||||
baseUrl: 'http://193.112.94.36:8081',
|
||||
url: '/mall/classification/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取分类树状结构
|
||||
export function getClassificationTree(storeId) {
|
||||
return request8081({
|
||||
baseUrl: 'http://193.112.94.36:8081',
|
||||
url: `/mall/classification/getTree/${storeId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 修改分类名称
|
||||
export function updateClassification(data) {
|
||||
return request8081({
|
||||
baseUrl: 'http://193.112.94.36:8081',
|
||||
url: '/mall/classification/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除分类
|
||||
export function deleteClassification(classificationId) {
|
||||
return request8081({
|
||||
baseUrl: 'http://193.112.94.36:8081',
|
||||
url: `/mall/classification/delete/${classificationId}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,269 @@
|
|||
<template>
|
||||
<view class="container">
|
||||
<!-- 顶部导航栏 -->
|
||||
<view class="navbar">
|
||||
<view class="back-btn" @click="goBack">
|
||||
<text class="back-icon">←</text>
|
||||
</view>
|
||||
<view class="title">选择品牌</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-box">
|
||||
<input type="text" placeholder="搜索品牌名称" class="search-input" v-model="searchKeyword" />
|
||||
</view>
|
||||
|
||||
<!-- 品牌树状列表 -->
|
||||
<view class="brand-tree">
|
||||
<!-- 一级品牌项 -->
|
||||
<view v-for="(brand, index) in filteredBrandList" :key="index" class="level1-item">
|
||||
<view class="level1-header">
|
||||
<text class="expand-icon" @click="toggleExpand(index)">{{ brand.expanded ? '▼' : '▶' }}</text>
|
||||
<text class="level1-name" @click="toggleExpand(index)">{{ brand.name }}</text>
|
||||
<view class="action-buttons">
|
||||
<!-- 选择一级品牌按钮 -->
|
||||
<text class="select-btn" @click.stop="selectBrand(brand.name, brand.id, null)">选择</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 二级子品牌容器 -->
|
||||
<view v-if="brand.expanded && brand.children && brand.children.length > 0" class="level2-container">
|
||||
<!-- 二级品牌项 -->
|
||||
<view v-for="(subBrand, subIndex) in brand.children" :key="subIndex" class="level2-item">
|
||||
<text class="level2-name">{{ subBrand.name }}</text>
|
||||
<text class="select-btn" @click.stop="selectBrand(brand.name, brand.id, subBrand.name, subBrand.id)">选择</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部添加按钮 -->
|
||||
<view class="add-brand-btn" @click="goToAddBrand">
|
||||
<text class="add-btn-icon">+</text>
|
||||
<text>添加品牌</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getBrandTree } from '@/api/product'
|
||||
import { getStoreId } from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
brandList: [],
|
||||
searchKeyword: '',
|
||||
storeId: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 过滤品牌列表
|
||||
filteredBrandList() {
|
||||
if (!this.searchKeyword.trim()) {
|
||||
return this.brandList
|
||||
}
|
||||
const keyword = this.searchKeyword.toLowerCase().trim()
|
||||
return this.brandList.filter(brand => {
|
||||
// 检查一级品牌是否匹配
|
||||
const matchesLevel1 = brand.name.toLowerCase().includes(keyword)
|
||||
// 检查二级品牌是否有匹配项
|
||||
const matchesLevel2 = brand.children && brand.children.some(subBrand => subBrand.name.toLowerCase().includes(keyword))
|
||||
return matchesLevel1 || matchesLevel2
|
||||
})
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 获取门店ID
|
||||
this.storeId = getStoreId()
|
||||
// 加载品牌列表
|
||||
this.loadBrandList()
|
||||
},
|
||||
methods: {
|
||||
// 加载品牌列表
|
||||
async loadBrandList() {
|
||||
try {
|
||||
const res = await getBrandTree()
|
||||
if (res.code === 200) {
|
||||
// 为每个一级品牌添加expanded属性,默认为true
|
||||
this.brandList = res.data.map(brand => ({
|
||||
...brand,
|
||||
expanded: true,
|
||||
children: brand.children || []
|
||||
}))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取品牌列表失败:', error)
|
||||
}
|
||||
},
|
||||
// 切换品牌展开/收起
|
||||
toggleExpand(index) {
|
||||
this.brandList[index].expanded = !this.brandList[index].expanded
|
||||
},
|
||||
// 选择品牌
|
||||
selectBrand(brandName, brandId, subBrandName, subBrandId) {
|
||||
// 构造返回数据
|
||||
const selectedBrand = {
|
||||
brandName: subBrandName || brandName,
|
||||
brandId: subBrandId || brandId,
|
||||
parentBrandName: subBrandName ? brandName : null,
|
||||
parentBrandId: subBrandName ? brandId : null
|
||||
}
|
||||
// 返回结果给上一页
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
success: () => {
|
||||
// 触发品牌选择事件
|
||||
uni.$emit('brandSelected', selectedBrand)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 返回上一页
|
||||
goBack() {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
},
|
||||
// 跳转到添加品牌页面
|
||||
goToAddBrand() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/addBrand/addBrand'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 导航栏 */
|
||||
.navbar {
|
||||
background-color: #e62318;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx 30rpx;
|
||||
position: relative;
|
||||
height: 88rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.back-icon {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
/* 搜索框 */
|
||||
.search-box {
|
||||
background-color: #fff;
|
||||
padding: 16rpx 30rpx;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 6rpx;
|
||||
padding: 18rpx;
|
||||
font-size: 28rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 品牌树 */
|
||||
.brand-tree {
|
||||
flex: 1;
|
||||
padding: 20rpx 30rpx;
|
||||
}
|
||||
|
||||
.level1-item {
|
||||
background-color: #fff;
|
||||
border-radius: 8rpx;
|
||||
margin-bottom: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.level1-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx 30rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.expand-icon {
|
||||
font-size: 24rpx;
|
||||
margin-right: 15rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.level1-name {
|
||||
font-size: 28rpx;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.select-btn {
|
||||
background-color: #e62318;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
padding: 10rpx 20rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
/* 二级子品牌容器 */
|
||||
.level2-container {
|
||||
display: flex;
|
||||
padding: 24rpx 30rpx;
|
||||
gap: 24rpx;
|
||||
flex-wrap: wrap;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.level2-item {
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 8rpx;
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.level2-name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 底部添加按钮 */
|
||||
.add-brand-btn {
|
||||
background-color: #e62318;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24rpx;
|
||||
font-size: 30rpx;
|
||||
margin: 0 30rpx 30rpx 30rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.add-btn-icon {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
</style>
|
||||
35
pages.json
35
pages.json
|
|
@ -127,29 +127,18 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/Import /Import ",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/userStores/userStores",
|
||||
"style": {
|
||||
"navigationBarTitleText": "用户门店关联"
|
||||
}
|
||||
},
|
||||
"path": "pages/import/import",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/userStores/userStores",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/expired/expired",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "pages/expired/expired",
|
||||
"style": {
|
||||
|
|
@ -167,6 +156,18 @@
|
|||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/BrandSelector/BrandSelector",
|
||||
"style": {
|
||||
"navigationBarTitleText": "选择品牌"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/category/category",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,184 @@
|
|||
<template>
|
||||
<view v-if="visible" class="brand-selector-overlay" @click="handleClose">
|
||||
<view class="brand-selector-container" @click.stop>
|
||||
<!-- 头部 -->
|
||||
<view class="selector-header">
|
||||
<view class="header-left" @click="handleClose">
|
||||
<text class="close-icon">×</text>
|
||||
</view>
|
||||
<view class="header-title">选择品牌</view>
|
||||
<view class="header-right" @click="handleConfirm">
|
||||
<text class="confirm-btn">完成</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-box">
|
||||
<input
|
||||
class="search-input"
|
||||
type="text"
|
||||
placeholder="搜索品牌名称"
|
||||
v-model="searchKeyword"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 品牌列表 -->
|
||||
<view class="brand-list">
|
||||
<view
|
||||
class="brand-item"
|
||||
:class="{active: selectedBrand === item.name}"
|
||||
v-for="item in filteredBrandList"
|
||||
:key="item.name"
|
||||
@click="selectBrand(item.name)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 品牌管理入口 -->
|
||||
<view class="brand-management" @click="handleToBrandManagement">
|
||||
<text class="management-text">品牌管理</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'BrandSelector',
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
defaultValue: {
|
||||
type: String,
|
||||
default: '默认品牌'
|
||||
},
|
||||
brandList: {
|
||||
type: Array,
|
||||
default: () => [{ name: '默认品牌' }]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
selectedBrand: this.defaultValue,
|
||||
searchKeyword: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
defaultValue(newVal) {
|
||||
this.selectedBrand = newVal
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filteredBrandList() {
|
||||
if (!this.searchKeyword) return this.brandList
|
||||
return this.brandList.filter(item =>
|
||||
item.name.includes(this.searchKeyword)
|
||||
)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
selectBrand(brandName) {
|
||||
this.selectedBrand = brandName
|
||||
},
|
||||
handleConfirm() {
|
||||
this.$emit('confirm', this.selectedBrand)
|
||||
this.handleClose()
|
||||
},
|
||||
handleClose() {
|
||||
this.$emit('close')
|
||||
},
|
||||
handleToBrandManagement() {
|
||||
this.$emit('toBrandManagement')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.brand-selector-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.brand-selector-container {
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
max-height: 80vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.selector-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
.close-icon {
|
||||
font-size: 36rpx;
|
||||
color: #666;
|
||||
}
|
||||
.header-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
.confirm-btn {
|
||||
font-size: 30rpx;
|
||||
color: #E62429;
|
||||
}
|
||||
}
|
||||
|
||||
.search-box {
|
||||
padding: 20rpx 30rpx;
|
||||
.search-input {
|
||||
width: 100%;
|
||||
padding: 20rpx;
|
||||
background: #f5f5f5;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.brand-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
.brand-item {
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
position: relative;
|
||||
&.active {
|
||||
color: #E62429;
|
||||
&::after {
|
||||
content: "✓";
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.brand-management {
|
||||
padding: 30rpx;
|
||||
text-align: center;
|
||||
color: #1677FF;
|
||||
font-size: 28rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -240,15 +240,85 @@
|
|||
/>
|
||||
</view>
|
||||
|
||||
<!-- 商品品牌 -->
|
||||
<view class="setting-item flex-row-between">
|
||||
<!-- 商品品牌(点击触发弹窗) -->
|
||||
<view class="setting-item flex-row-between" @click="showBrandSelector = true; getBrandData()">
|
||||
<view class="setting-label">商品品牌</view>
|
||||
<input
|
||||
class="item-input"
|
||||
type="text"
|
||||
placeholder="请输入商品品牌"
|
||||
v-model="goodsInfo.brand"
|
||||
/>
|
||||
<view class="flex-row">
|
||||
<text class="selected-value">{{ goodsInfo.brand || '请选择品牌' }}</text>
|
||||
<text class="right-arrow">></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 品牌选择弹窗(完全匹配参考代码+图片) -->
|
||||
<view v-if="showBrandSelector" class="brand-selector-overlay" @click="closeBrandSelector">
|
||||
<view class="brand-selector-container" @click.stop>
|
||||
<!-- 头部 -->
|
||||
<view class="selector-header">
|
||||
<view class="header-left" @click="closeBrandSelector">
|
||||
<text class="close-icon">×</text>
|
||||
</view>
|
||||
<view class="header-title">选择品牌</view>
|
||||
<view class="header-right" @click="confirmSelectedBrand">
|
||||
<text class="confirm-btn">完成</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-box">
|
||||
<input
|
||||
class="search-input"
|
||||
type="text"
|
||||
placeholder="搜索品牌名称"
|
||||
v-model="brandSearchKeyword"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 品牌列表(二级树状结构) -->
|
||||
<view class="brand-list">
|
||||
<!-- 普通品牌项 - 默认品牌 -->
|
||||
<view
|
||||
class="brand-item"
|
||||
:class="{active: selectedBrand === '默认品牌'}"
|
||||
@click="selectBrand('默认品牌')"
|
||||
>
|
||||
默认品牌
|
||||
</view>
|
||||
|
||||
<!-- 动态生成品牌列表 -->
|
||||
<template v-for="brand in brandData">
|
||||
<!-- 父节点 -->
|
||||
<view
|
||||
class="brand-parent-item"
|
||||
@click="toggleBrandExpand(brand.id)"
|
||||
:key="brand.id"
|
||||
>
|
||||
<text
|
||||
class="expand-icon"
|
||||
:class="{expanded: expandedBrands[brand.id]}"
|
||||
>▼</text>
|
||||
<text class="parent-text">{{ brand.brandName }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 子节点(展开时显示) -->
|
||||
<view v-if="expandedBrands[brand.id]" class="brand-child-item" :key="brand.id + '-children'">
|
||||
<view
|
||||
v-for="child in brand.children"
|
||||
:key="child.id"
|
||||
class="brand-item child"
|
||||
:class="{active: selectedBrand === child.brandName}"
|
||||
@click="selectBrand(child.brandName)"
|
||||
>
|
||||
{{ child.brandName }}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<!-- 品牌管理入口 -->
|
||||
<view class="brand-management" @click="goToBrandManagement">
|
||||
<text class="management-text">品牌管理</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品编码 -->
|
||||
|
|
@ -273,7 +343,6 @@
|
|||
<script>
|
||||
import { getProductDetail, updateProduct, updateProductWithFile } from '@/api/product'
|
||||
import { getStoreId } from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
name: 'GoodsEdit',
|
||||
data() {
|
||||
|
|
@ -288,7 +357,7 @@ export default {
|
|||
stock: 1,
|
||||
buyPrice: 1.0,
|
||||
category: '默认',
|
||||
brand: '默认品牌',
|
||||
brand: '那', // 匹配图片默认选中
|
||||
code: '1',
|
||||
shelfCode: '',
|
||||
productionDate: ''
|
||||
|
|
@ -314,7 +383,13 @@ export default {
|
|||
{ label: '6个月', days: 180 },
|
||||
{ label: '8个月', days: 240 },
|
||||
{ label: '10个月', days: 300 }
|
||||
]
|
||||
],
|
||||
// 品牌选择弹窗相关
|
||||
showBrandSelector: false,
|
||||
brandSearchKeyword: '',
|
||||
selectedBrand: '那', // 匹配图片默认选中
|
||||
brandData: [], // 品牌数据
|
||||
expandedBrands: {} // 记录展开状态的对象
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
|
|
@ -420,11 +495,12 @@ export default {
|
|||
stock: data.stockQuantity || this.goodsInfo.stock,
|
||||
buyPrice: data.costPrice || this.goodsInfo.buyPrice,
|
||||
category: this.goodsInfo.category,
|
||||
brand: this.goodsInfo.brand,
|
||||
brand: data.productBrand || this.goodsInfo.brand,
|
||||
code: data.productCode || this.goodsInfo.code
|
||||
};
|
||||
|
||||
this.activePrice = data.storePrice || this.goodsInfo.salePrice;
|
||||
this.selectedBrand = data.productBrand || this.goodsInfo.brand;
|
||||
|
||||
if (data.shelfLife) {
|
||||
this.switchStatus.expire = true;
|
||||
|
|
@ -506,7 +582,8 @@ export default {
|
|||
shelfLife: this.switchStatus.expire ? this.expireSettings.days : null,
|
||||
approaching: this.switchStatus.expire ? this.expireSettings.warnDays : null,
|
||||
productionDate: this.goodsInfo.productionDate || '',
|
||||
storeId: storeId
|
||||
storeId: storeId,
|
||||
productBrand: this.goodsInfo.brand
|
||||
};
|
||||
|
||||
const res = await updateProductWithFile(this.goodsInfo.imageUrl || '', formData);
|
||||
|
|
@ -535,6 +612,54 @@ export default {
|
|||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
// 获取品牌数据
|
||||
async getBrandData() {
|
||||
try {
|
||||
const res = await uni.request({
|
||||
url: 'http://193.112.94.36:8081/mall/brand/getTree/2',
|
||||
method: 'GET'
|
||||
});
|
||||
|
||||
if (res[1] && res[1].data && res[1].data.code === 200) {
|
||||
this.brandData = res[1].data.data;
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '获取品牌数据失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取品牌数据失败:', error);
|
||||
uni.showToast({
|
||||
title: '网络请求失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 品牌选择弹窗方法
|
||||
selectBrand(brandName) {
|
||||
this.selectedBrand = brandName;
|
||||
},
|
||||
confirmSelectedBrand() {
|
||||
this.goodsInfo.brand = this.selectedBrand;
|
||||
this.showBrandSelector = false;
|
||||
this.brandSearchKeyword = '';
|
||||
},
|
||||
closeBrandSelector() {
|
||||
this.showBrandSelector = false;
|
||||
this.brandSearchKeyword = '';
|
||||
},
|
||||
toggleBrandExpand(brandId) {
|
||||
this.$set(this.expandedBrands, brandId, !this.expandedBrands[brandId]);
|
||||
},
|
||||
goToBrandManagement() {
|
||||
this.showBrandSelector = false;
|
||||
uni.navigateTo({
|
||||
url: '/pages/addBrand/addBrand'
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -889,4 +1014,126 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 商品品牌选中值样式
|
||||
.selected-value {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
// --------------------------
|
||||
// 品牌选择弹窗样式(完全匹配参考代码)
|
||||
// --------------------------
|
||||
.brand-selector-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.brand-selector-container {
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
max-height: 80vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.selector-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
.close-icon {
|
||||
font-size: 36rpx;
|
||||
color: #666;
|
||||
}
|
||||
.header-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
.confirm-btn {
|
||||
font-size: 30rpx;
|
||||
color: #E62429;
|
||||
}
|
||||
}
|
||||
|
||||
.search-box {
|
||||
padding: 20rpx 30rpx;
|
||||
.search-input {
|
||||
width: 100%;
|
||||
padding: 20rpx;
|
||||
background: #f5f5f5;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.brand-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
// 普通品牌项
|
||||
.brand-item {
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
position: relative;
|
||||
&.active {
|
||||
color: #E62429;
|
||||
&::after {
|
||||
content: "✓";
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
// 子节点样式
|
||||
&.child {
|
||||
padding-left: 60rpx;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
}
|
||||
|
||||
// 父节点样式
|
||||
.brand-parent-item {
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.expand-icon {
|
||||
font-size: 24rpx;
|
||||
margin-right: 10rpx;
|
||||
color: #999;
|
||||
transition: transform 0.2s ease;
|
||||
&.expanded {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
.parent-text {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.brand-management {
|
||||
padding: 30rpx;
|
||||
text-align: center;
|
||||
color: #1677FF;
|
||||
font-size: 28rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -145,7 +145,7 @@ export default {
|
|||
uni.navigateBack({ delta: 1 });
|
||||
},
|
||||
goImport() {
|
||||
uni.navigateTo({ url: '/pages/Import/Import' });
|
||||
uni.navigateTo({ url: '/pages/import/import' });
|
||||
},
|
||||
goNoCode() {
|
||||
uni.navigateTo({ url: '/pages/NoCode/NoCode' });
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@
|
|||
goToCategoryManagement() {
|
||||
this.$refs.popup.close();
|
||||
uni.navigateTo({
|
||||
url: '/pages/categoryManagement/categoryManagement'
|
||||
url: '/pages/category/category'
|
||||
});
|
||||
},
|
||||
// 品牌管理
|
||||
|
|
|
|||
Loading…
Reference in New Issue