|
@@ -38,74 +38,51 @@
|
|
|
<el-radio :value="1">指定商品</el-radio>
|
|
<el-radio :value="1">指定商品</el-radio>
|
|
|
<el-radio :value="2">商品分类</el-radio>
|
|
<el-radio :value="2">商品分类</el-radio>
|
|
|
<el-radio :value="3">商品品牌</el-radio>
|
|
<el-radio :value="3">商品品牌</el-radio>
|
|
|
- <!-- <el-radio value="all">全部商品</el-radio>
|
|
|
|
|
- <el-radio value="category">选择分类</el-radio>
|
|
|
|
|
- <el-radio value="custom">手动选择</el-radio> -->
|
|
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="指定商品" v-if="diyStore.editComponent.source == 1">
|
|
<el-form-item label="指定商品" v-if="diyStore.editComponent.source == 1">
|
|
|
<div class="data-num" @click="openDialog">
|
|
<div class="data-num" @click="openDialog">
|
|
|
<span v-if="diyStore.editComponent.goodsIds.length == 0">请选择</span>
|
|
<span v-if="diyStore.editComponent.goodsIds.length == 0">请选择</span>
|
|
|
<span v-else>已选择{{ diyStore.editComponent.goodsIds.length }}个</span>
|
|
<span v-else>已选择{{ diyStore.editComponent.goodsIds.length }}个</span>
|
|
|
- <el-icon><ArrowRight /></el-icon>
|
|
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <ArrowRight />
|
|
|
|
|
+ </el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="选择分类" v-if="diyStore.editComponent.source == 'category'">
|
|
|
|
|
- <div class="flex items-center w-full">
|
|
|
|
|
- <div class="cursor-pointer ml-auto" @click="categoryShowDialogOpen">
|
|
|
|
|
- <span class="text-[var(--el-color-primary)]">{{ diyStore.editComponent.goods_category_name }}</span>
|
|
|
|
|
- <span class="iconfont iconxiangyoujiantou"></span>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <el-form-item label="选择分类" v-if="diyStore.editComponent.source == 2">
|
|
|
|
|
+ <el-cascader
|
|
|
|
|
+ v-model="diyStore.editComponent.categoryIds"
|
|
|
|
|
+ :options="categoryOptions1"
|
|
|
|
|
+ :props="cascaderProps"
|
|
|
|
|
+ placeholder="全部分类"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ collapse-tags
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="品牌" v-if="diyStore.editComponent.source == 3">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="diyStore.editComponent.brandIds"
|
|
|
|
|
+ multiple
|
|
|
|
|
+ filterable
|
|
|
|
|
+ remote
|
|
|
|
|
+ reserve-keyword
|
|
|
|
|
+ placeholder="请输入品牌名称"
|
|
|
|
|
+ :remote-method="remoteMethod"
|
|
|
|
|
+ :loading="Brandloading"
|
|
|
|
|
+ style="width: 240px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option v-for="(item, index) in BrandList" :key="index" :label="item.brandName" :value="item.id" />
|
|
|
|
|
+ <template #loading>
|
|
|
|
|
+ <svg class="circular" viewBox="0 0 50 50">
|
|
|
|
|
+ <circle class="path" cx="25" cy="25" r="20" fill="none" />
|
|
|
|
|
+ </svg>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="商品数量" v-if="diyStore.editComponent.source == 'all' || diyStore.editComponent.source == 'category'">
|
|
|
|
|
|
|
+ <el-form-item label="商品数量" v-if="diyStore.editComponent.source == '2' || diyStore.editComponent.source == '3'">
|
|
|
<el-slider class="goods-list-slider" show-input v-model="diyStore.editComponent.num" :min="1" :max="20" size="small" />
|
|
<el-slider class="goods-list-slider" show-input v-model="diyStore.editComponent.num" :min="1" :max="20" size="small" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <!-- <el-form-item label="手动选择" v-if="diyStore.editComponent.source == 'custom'">
|
|
|
|
|
- <goods-select-popup ref="goodsSelectPopupRef" v-model="diyStore.editComponent.goods_ids" :min="1" :max="99" />
|
|
|
|
|
- </el-form-item> -->
|
|
|
|
|
</el-form>
|
|
</el-form>
|
|
|
-
|
|
|
|
|
- <el-dialog v-model="categoryShowDialog" title="商品分类" width="750px" :destroy-on-close="true" :close-on-click-modal="false">
|
|
|
|
|
- <el-table
|
|
|
|
|
- :data="categoryTable.data"
|
|
|
|
|
- ref="categoryTableRef"
|
|
|
|
|
- size="large"
|
|
|
|
|
- v-loading="categoryTable.loading"
|
|
|
|
|
- height="450px"
|
|
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
|
|
- row-key="category_id"
|
|
|
|
|
- :expand-row-keys="expand_category_ids"
|
|
|
|
|
- :tree-props="{ hasChildren: 'hasChildren', children: 'child_list' }"
|
|
|
|
|
- >
|
|
|
|
|
- <template #empty>
|
|
|
|
|
- <span>{{ !categoryTable.loading ? '还没有安装应用' : '' }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- <el-table-column type="selection" width="55" />
|
|
|
|
|
- <el-table-column label="分类名称" min-width="120">
|
|
|
|
|
- <template #default="{ row }">
|
|
|
|
|
- <span class="order-2">{{ row.category_name }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column label="分类图片" width="170" align="left">
|
|
|
|
|
- <template #default="{ row }">
|
|
|
|
|
- <div class="h-[30px]">
|
|
|
|
|
- <el-image class="w-[30px] h-[30px]" :src="img(row.image)" fit="contain">
|
|
|
|
|
- <template #error>
|
|
|
|
|
- <div class="image-slot">
|
|
|
|
|
- <!-- <img class="w-[30px] h-[30px]" src="@/addon/shop/assets/category_default.png" /> -->
|
|
|
|
|
- </div>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-image>
|
|
|
|
|
- </div>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- </el-table>
|
|
|
|
|
- <div class="flex items-center justify-end mt-[15px]">
|
|
|
|
|
- <el-button type="primary" @click="saveCategoryId">确认</el-button>
|
|
|
|
|
- <el-button @click="categoryShowDialog = false">取消</el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-dialog>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="edit-attr-item-wrap">
|
|
<div class="edit-attr-item-wrap">
|
|
@@ -114,12 +91,6 @@
|
|
|
<el-form-item label="是否显示">
|
|
<el-form-item label="是否显示">
|
|
|
<el-switch v-model="diyStore.editComponent.btnStyle.control" />
|
|
<el-switch v-model="diyStore.editComponent.btnStyle.control" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="点击事件" v-if="diyStore.editComponent.btnStyle.control">
|
|
|
|
|
- <el-radio-group v-model="diyStore.editComponent.btnStyle.cartEvent">
|
|
|
|
|
- <el-radio value="detail">商品详情</el-radio>
|
|
|
|
|
- <el-radio v-if="diyStore.editComponent.style != 'style-3'" value="cart">加入购物车</el-radio>
|
|
|
|
|
- </el-radio-group>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
<el-form-item label="样式" class="!items-center" v-if="diyStore.editComponent.btnStyle.control">
|
|
<el-form-item label="样式" class="!items-center" v-if="diyStore.editComponent.btnStyle.control">
|
|
|
<div class="flex">
|
|
<div class="flex">
|
|
|
<template v-for="(item, index) in btnStyleList" :key="index">
|
|
<template v-for="(item, index) in btnStyleList" :key="index">
|
|
@@ -159,12 +130,9 @@
|
|
|
<el-form-item label="销售价" v-if="diyStore.editComponent.priceStyle.isShow">
|
|
<el-form-item label="销售价" v-if="diyStore.editComponent.priceStyle.isShow">
|
|
|
<el-switch v-model="diyStore.editComponent.priceStyle.control" />
|
|
<el-switch v-model="diyStore.editComponent.priceStyle.control" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="商品销量" v-if="diyStore.editComponent.saleStyle.isShow">
|
|
|
|
|
|
|
+ <el-form-item label="起订量" v-if="diyStore.editComponent.saleStyle.isShow">
|
|
|
<el-switch v-model="diyStore.editComponent.saleStyle.control" />
|
|
<el-switch v-model="diyStore.editComponent.saleStyle.control" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="商品标签" v-if="diyStore.editComponent.labelStyle.isShow">
|
|
|
|
|
- <el-switch v-model="diyStore.editComponent.labelStyle.control" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -227,38 +195,42 @@
|
|
|
<slot name="style"></slot>
|
|
<slot name="style"></slot>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <goods-dialog ref="goodsDialogRef" :categoryOptions="categoryOptions"></goods-dialog>
|
|
|
|
|
|
|
+ <goods-mini ref="goodsDialogRef" :categoryOptions="categoryOptions"></goods-mini>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
-// import { getCategoryTree } from '@/addon/shop/api/goods';
|
|
|
|
|
|
|
+import { categoryTree } from '@/api/pmsProduct/base';
|
|
|
|
|
+import { listBrand } from '@/api/product/brand';
|
|
|
import { img } from '@/utils/common';
|
|
import { img } from '@/utils/common';
|
|
|
import useDiyStore from '@/store/modules/diy';
|
|
import useDiyStore from '@/store/modules/diy';
|
|
|
import { ElTable } from 'element-plus';
|
|
import { ElTable } from 'element-plus';
|
|
|
-// import goodsSelectPopup from '@/addon/shop/views/goods/components/goods-select-popup.vue';
|
|
|
|
|
-const categoryOptions = ref<any>([]);
|
|
|
|
|
const goodsDialogRef = ref<any>(null);
|
|
const goodsDialogRef = ref<any>(null);
|
|
|
-
|
|
|
|
|
|
|
+const categoryOptions = ref<any>([]);
|
|
|
|
|
+const categoryOptions1 = ref<any>([]);
|
|
|
|
|
+const Brandloading = ref(false);
|
|
|
|
|
+const BrandList = ref<any>([]);
|
|
|
const diyStore: any = useDiyStore();
|
|
const diyStore: any = useDiyStore();
|
|
|
diyStore.editComponent.ignore = []; // 忽略公共属性
|
|
diyStore.editComponent.ignore = []; // 忽略公共属性
|
|
|
|
|
|
|
|
-// 组件验证
|
|
|
|
|
-diyStore.editComponent.verify = (index: number) => {
|
|
|
|
|
- const res = { code: true, message: '' };
|
|
|
|
|
|
|
+const cascaderProps = { multiple: true, value: 'id', label: 'label', children: 'children' };
|
|
|
|
|
|
|
|
- if (diyStore.value[index].source == 'category') {
|
|
|
|
|
- if (diyStore.value[index].goods_category == '') {
|
|
|
|
|
- res.code = false;
|
|
|
|
|
- res.message = '请选择商品分类';
|
|
|
|
|
- }
|
|
|
|
|
- } else if (diyStore.value[index].source == 'custom') {
|
|
|
|
|
- if (diyStore.value[index].goods_ids.length == 0) {
|
|
|
|
|
- res.code = false;
|
|
|
|
|
- res.message = '请选择商品';
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return res;
|
|
|
|
|
|
|
+/** 查询分类树 */
|
|
|
|
|
+const getCategoryTree = async () => {
|
|
|
|
|
+ categoryOptions.value = [];
|
|
|
|
|
+ categoryOptions1.value = [];
|
|
|
|
|
+ const res = await categoryTree({
|
|
|
|
|
+ platform: 0,
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: 9999
|
|
|
|
|
+ });
|
|
|
|
|
+ const list = res.data || [];
|
|
|
|
|
+ categoryOptions.value = [...list];
|
|
|
|
|
+ categoryOptions1.value = [...list];
|
|
|
|
|
+ categoryOptions.value.unshift({
|
|
|
|
|
+ id: '',
|
|
|
|
|
+ label: '全部'
|
|
|
|
|
+ });
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const categoryShowDialog = ref(false);
|
|
const categoryShowDialog = ref(false);
|
|
@@ -268,6 +240,7 @@ const categoryTable = reactive({
|
|
|
data: []
|
|
data: []
|
|
|
});
|
|
});
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
|
|
+ getCategoryTree();
|
|
|
loadCategoryList();
|
|
loadCategoryList();
|
|
|
btnStyleList.forEach((item, index, arr) => {
|
|
btnStyleList.forEach((item, index, arr) => {
|
|
|
if (item.type == 'button') {
|
|
if (item.type == 'button') {
|
|
@@ -394,6 +367,21 @@ const openDialog = () => {
|
|
|
goodsDialogRef.value.onOpen();
|
|
goodsDialogRef.value.onOpen();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+//品牌输入
|
|
|
|
|
+const remoteMethod = (query: string) => {
|
|
|
|
|
+ if (query) {
|
|
|
|
|
+ Brandloading.value = true;
|
|
|
|
|
+ listBrand({ pageNum: 1, pageSize: 100, brandName: query }).then((res) => {
|
|
|
|
|
+ Brandloading.value = false;
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ BrandList.value = res.rows || [];
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ BrandList.value = [];
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
defineExpose({});
|
|
defineExpose({});
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
@@ -402,6 +390,7 @@ defineExpose({});
|
|
|
width: 100px;
|
|
width: 100px;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.data-num {
|
|
.data-num {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
font-size: 14px;
|
|
font-size: 14px;
|