|
|
@@ -8,7 +8,7 @@
|
|
|
<div class="tab-item-child"
|
|
|
:style="addTabForm.categoryId===item.categoryId ? 'color:' + formData.tabStyle.activeColor + ';font-weight: bold;' : 'color:' + formData.tabStyle.color">
|
|
|
{{item.categoryName}}
|
|
|
- <div class="tab-item-hot" :style="'background:' + formData.tabStyle.hotColor" v-show="item.hotTip===1"></div>
|
|
|
+ <div class="tab-item-hot" :style="'background-image: url('+ formData.tabStyle.hotImg +');background-size: 100%; background-repeat: no-repeat;'" v-show="item.hotTip===1"></div>
|
|
|
<div class="guangbiao" :style="'background:' + formData.tabStyle.bottomColor" v-if="addTabForm.categoryId===item.categoryId"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -101,8 +101,10 @@
|
|
|
<el-form-item label="下标颜色" class="goods-select-con">
|
|
|
<el-color-picker v-model="formData.tabStyle.bottomColor" size="small"></el-color-picker>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="热度点颜色" class="goods-select-con">
|
|
|
- <el-color-picker v-model="formData.tabStyle.hotColor" size="small"></el-color-picker>
|
|
|
+ <el-form-item label="推荐icon" class="goods-select-con">
|
|
|
+ <div :style="'background-image: url('+ formData.tabStyle.hotImg +');background-size: 100%; background-repeat: no-repeat;height: 100px;width: 100px;'"></div>
|
|
|
+ <el-button @click="changeImg(2)">选择</el-button>
|
|
|
+<!-- <el-color-picker v-model="formData.tabStyle.hotColor" size="small"></el-color-picker>-->
|
|
|
</el-form-item>
|
|
|
<el-form-item label="字体颜色" class="goods-select-con">
|
|
|
<el-color-picker v-model="formData.tabStyle.color" size="small"></el-color-picker>
|
|
|
@@ -123,16 +125,16 @@
|
|
|
:key="index"
|
|
|
class="goods-select-item">
|
|
|
<div @dragenter="tabdragenter($event, index)" @dragover="tabdragover($event, index)" @dragstart="tabdragstart(index)" draggable>
|
|
|
- <span class="edit-item"
|
|
|
+ <span class="edit-item" v-if="item.categoryId!=='all'"
|
|
|
@click="openadd(item)"><i class="el-icon-edit"></i></span>
|
|
|
<div class="goods-select-item-img" @click="clickTab(item)" :style="addTabForm.categoryId===item.categoryId?'font-weight: bold':''">{{item.categoryName}}</div>
|
|
|
- <span class="close-item"
|
|
|
+ <span class="close-item" v-if="item.categoryId!=='all'"
|
|
|
@click="formData.tabList.splice(index,1)"><i class="el-icon-delete"></i></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</transition-group>
|
|
|
<div class="goods-select-item">
|
|
|
- <el-button @click="openadd()">
|
|
|
+ <el-button @click="openbefore()">
|
|
|
<i class="el-icon-plus"></i>
|
|
|
</el-button>
|
|
|
</div>
|
|
|
@@ -208,6 +210,8 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<ProdsSelect v-if="dialogChooseGoods" ref="ProdsSelect" @refreshSelectProds="chooseGoodsFun"></ProdsSelect>
|
|
|
+ <!-- 弹窗, 新增图片 -->
|
|
|
+ <elx-imgbox ref="elxImgbox" @refreshPic="refreshPic" :maxSize="10" :imgSizeLimit="false"></elx-imgbox>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
@@ -220,6 +224,7 @@ import { microCreateMinis } from '../../minis'
|
|
|
import ProdsSelect from '@/components/prods-select'
|
|
|
import {treeDataTranslate} from "@/utils";
|
|
|
import category from './category.png'
|
|
|
+import ElxImgbox from "@/components/elx-imgbox/index.vue";
|
|
|
/** 商品组件 */
|
|
|
export default {
|
|
|
name: 'micro-goods-box',
|
|
|
@@ -227,6 +232,9 @@ export default {
|
|
|
props: {},
|
|
|
data () {
|
|
|
return {
|
|
|
+ resourcesUrl: process.env.VUE_APP_RESOURCES_URL,
|
|
|
+ imgchouse: 1,
|
|
|
+ elxImgboxVisible: false,
|
|
|
category: category,
|
|
|
categoryList: [],
|
|
|
loadlist: [
|
|
|
@@ -261,14 +269,15 @@ export default {
|
|
|
leftBackColor: '#fff',
|
|
|
tabStyle: {
|
|
|
bottomColor: '#EE4C0C',
|
|
|
- hotColor: '#EE4C0C',
|
|
|
+ // hotColor: '#EE4C0C',
|
|
|
+ hotImg: '',
|
|
|
rightBackColor: '#ffffff',
|
|
|
leftBackColor: '#ffffff',
|
|
|
tabOpacity: 100,
|
|
|
activeColor: '#000000',
|
|
|
color: '#333333'
|
|
|
},
|
|
|
- tabList: []
|
|
|
+ tabList: [{categoryName: '全部', categoryId: 'all'}]
|
|
|
// buy_btn_type: 1, // 购买按钮的样式
|
|
|
// button_text: '马上抢'// 购买按钮的文本
|
|
|
},
|
|
|
@@ -354,6 +363,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
+ ElxImgbox,
|
|
|
ProdsSelect
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -384,6 +394,25 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ elxImgboxHandle (type) {
|
|
|
+ // if (this.disabled) {
|
|
|
+ // return false
|
|
|
+ // }
|
|
|
+ this.elxImgboxVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.elxImgbox.init(type || 2, 1)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ refreshPic (imagePath) {
|
|
|
+ console.log(this.resourcesUrl + imagePath)
|
|
|
+ this.formData.tabStyle.hotImg = this.resourcesUrl + imagePath
|
|
|
+ },
|
|
|
+ changeImg (index) {
|
|
|
+ console.log(index)
|
|
|
+ this.currentEditIndex = index
|
|
|
+ this.elxImgboxHandle(1)
|
|
|
+ // this.canChooseImagesNum = 1
|
|
|
+ },
|
|
|
hexToRgba(hex, opacity) {
|
|
|
let str = 'rgba(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5)) + ','
|
|
|
+ parseInt('0x' + hex.slice(5, 7)) + ',' + (opacity/100) + ')';
|
|
|
@@ -407,6 +436,9 @@ export default {
|
|
|
e.preventDefault();
|
|
|
},
|
|
|
clickTab(item){
|
|
|
+ if(item.categoryId==='all'){
|
|
|
+ return
|
|
|
+ }
|
|
|
console.log(item)
|
|
|
this.addTabForm = item
|
|
|
this.getGoodsInfo(item.goods, '')
|
|
|
@@ -477,8 +509,35 @@ export default {
|
|
|
this.adddia = false
|
|
|
console.log('this.formdata',this.formData.tabList)
|
|
|
},
|
|
|
+ openbefore(){
|
|
|
+ if(this.formData.tabList.length === 1){
|
|
|
+ this.$confirm(`检测到系统配置的分类列表,是否一键导入?`, '提示', {
|
|
|
+ confirmButtonText: '立即导入',
|
|
|
+ cancelButtonText: '去自定义',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.categoryList.forEach(item => {
|
|
|
+ console.log('item',item)
|
|
|
+ let obj = {
|
|
|
+ hotTip: 0,
|
|
|
+ categoryName: item.categoryName,
|
|
|
+ categoryId: item.categoryId,
|
|
|
+ goods: [],
|
|
|
+ loadType: 1
|
|
|
+ }
|
|
|
+ this.formData.tabList.push(obj)
|
|
|
+ })
|
|
|
+ this.adddia = false
|
|
|
+ }).catch(() => {
|
|
|
+ this.openadd()
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.openadd()
|
|
|
+ }
|
|
|
+ },
|
|
|
// 获取数据列表
|
|
|
openadd (item) {
|
|
|
+
|
|
|
console.log('item',item)
|
|
|
this.addTabForm = {
|
|
|
categoryName: null,
|