|
|
|
@ -6,6 +6,16 @@ |
|
|
|
|
<text>利润空间(元)</text> |
|
|
|
|
</view> |
|
|
|
|
<view class="classifyContainer"> |
|
|
|
|
<view class="category"> |
|
|
|
|
<view class="rangeHandle" @click="addCatego(list.length)"> |
|
|
|
|
<view class="addFlag">+</view> |
|
|
|
|
<text>新增分类模板</text> |
|
|
|
|
</view> |
|
|
|
|
<view class="rangeHandle" @click="delCatego('',1)" style="border-left:1px solid #E2E2E2;"> |
|
|
|
|
<view class="delBtn">-</view> |
|
|
|
|
<text>删除分类模板</text> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="classifyItem" v-for="(item,index_1) in list" :key="index_1"> |
|
|
|
|
<view class="classTitle"> |
|
|
|
|
<view class="category_box" @click="onCategory(item.category,index_1)"> |
|
|
|
@ -48,15 +58,8 @@ |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="category"> |
|
|
|
|
<view class="rangeHandle" @click="addCatego(list.length)"> |
|
|
|
|
<view class="addFlag">+</view> |
|
|
|
|
<text>新增分类模板</text> |
|
|
|
|
</view> |
|
|
|
|
<view class="rangeHandle" @click="delCatego('',1)" style="border-left:1px solid #E2E2E2;"> |
|
|
|
|
<view class="delBtn">-</view> |
|
|
|
|
<text>删除分类模板</text> |
|
|
|
|
</view> |
|
|
|
|
<view class="ruleText" v-if="type==1"> |
|
|
|
|
备注:利润低于_元的商品不展示在商城里。 |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="price-fd"> |
|
|
|
@ -69,7 +72,6 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
category |
|
|
|
|
import * as newFunApi from '@/api/newFun' |
|
|
|
|
import setRange from './components/setRange.vue' |
|
|
|
|
import category from './components/category.vue' |
|
|
|
@ -115,14 +117,14 @@ |
|
|
|
|
return item === obj.category_id; |
|
|
|
|
}); |
|
|
|
|
}).map(function(obj) { |
|
|
|
|
return obj.name; |
|
|
|
|
return obj.name + '等'; |
|
|
|
|
}); |
|
|
|
|
item_1.category_name = name.join(',') |
|
|
|
|
item_1.price_list.forEach((item_2, index_2) => { |
|
|
|
|
item_2.startProfit = (Number(item_2.min) * (Number(item_2 |
|
|
|
|
.add_price_rate) / 100)).toFixed(2); |
|
|
|
|
item_2.endProfit = (Number(item_2.max) * (Number(item_2 |
|
|
|
|
.add_price_rate) / 100)).toFixed(2); |
|
|
|
|
item_2.startProfit = Number((Number(item_2.min) * (Number(item_2 |
|
|
|
|
.add_price_rate) / 100)).toFixed(2)); |
|
|
|
|
item_2.endProfit = Number((Number(item_2.max) * (Number(item_2 |
|
|
|
|
.add_price_rate) / 100)).toFixed(2)); |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.list = data.list |
|
|
|
@ -302,30 +304,40 @@ |
|
|
|
|
}, |
|
|
|
|
// 选择分类 |
|
|
|
|
onCategory(categoryId, index) { |
|
|
|
|
let newId = [] |
|
|
|
|
this.categoryIndex = index; |
|
|
|
|
this.activeIndex = []; |
|
|
|
|
// let newId = [] |
|
|
|
|
// this.list.forEach((item, index) => { |
|
|
|
|
// if (item.category) { |
|
|
|
|
// newId.push(item.category.split(",").map(item => Number(item))) |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// console.log(newId) |
|
|
|
|
// this.activeIndex = newId |
|
|
|
|
if (typeof categoryId == 'number') {} else { |
|
|
|
|
let arr = categoryId.split(",") |
|
|
|
|
this.activeIndex = arr.map(item => Number(item)); |
|
|
|
|
} |
|
|
|
|
console.log(this.activeIndex) |
|
|
|
|
// if (newId.length > 0) { |
|
|
|
|
this.$refs.category.afterSale = true; |
|
|
|
|
// } |
|
|
|
|
this.list.forEach((item, index) => { |
|
|
|
|
if (item.category) { |
|
|
|
|
newId = newId.concat((item.category.split(",").map(item => Number(item)))) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
let list = Array.from(new Set(newId)); |
|
|
|
|
this.activeIndex = list |
|
|
|
|
uni.setStorageSync('list', list) |
|
|
|
|
this.$refs.category.afterSale = true; |
|
|
|
|
}, |
|
|
|
|
// 获取分类 |
|
|
|
|
getChoseCategory(res) { |
|
|
|
|
let nameList = []; |
|
|
|
|
let list = []; |
|
|
|
|
console.log(this.list[this.categoryIndex].category, this.categoryIndex) |
|
|
|
|
if (this.list[this.categoryIndex].category) { |
|
|
|
|
list = this.list[this.categoryIndex].category.split(",").map(item => Number(item)) |
|
|
|
|
} |
|
|
|
|
let newList = list.concat(res.category_id); |
|
|
|
|
|
|
|
|
|
this.categoryList.forEach(item1 => { |
|
|
|
|
newList.forEach(item2 => { |
|
|
|
|
if (item1.category_id == item2) { |
|
|
|
|
nameList.push(item1.name) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
console.log(nameList, newList) |
|
|
|
|
this.list[this.categoryIndex].category_name = nameList.join(','); |
|
|
|
|
this.list[this.categoryIndex].category = newList.join(',') |
|
|
|
|
this.$refs.category.afterSale = false; |
|
|
|
|
this.list[this.categoryIndex].category_name = res.category_name; |
|
|
|
|
this.list[this.categoryIndex].category = res.category_id |
|
|
|
|
}, |
|
|
|
|
// 新增分类 |
|
|
|
|
addCatego(index) { |
|
|
|
@ -360,6 +372,16 @@ |
|
|
|
|
padding-bottom: 60upx; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.ruleText { |
|
|
|
|
margin: 30rpx 50rpx; |
|
|
|
|
font-size: 28upx; |
|
|
|
|
font-family: PingFang SC, PingFang SC; |
|
|
|
|
font-weight: 400; |
|
|
|
|
color: #8B8B8B; |
|
|
|
|
line-height: 32px; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
::v-deep .uni-input-wrapper { |
|
|
|
|
width: 180rpx !important; |
|
|
|
|
text-align: center !important; |
|
|
|
|