Commit c0e716a6 by Jaxon

style: 格式化

1 parent 577a2aba
<template>
<div class="d2-container-full">
<!-- <el-scrollbar> -->
<div v-if="$slots.header"
ref="header"
class="d2-container-full__header"
:class="active ? 'active' : 'close'">
<slot name="header" />
<D2HeaderSwitch />
</div>
<div ref="body"
class="d2-container-full__body">
<slot />
</div>
<div v-if="$slots.footer"
ref="footer"
class="d2-container-full__footer">
<slot name="footer" />
</div>
<!-- </el-scrollbar> -->
<div class="d2-container-full">
<!-- <el-scrollbar> -->
<div v-if="$slots.header"
ref="header"
class="d2-container-full__header"
:class="active ? 'active' : 'close'">
<slot name="header" />
<D2HeaderSwitch />
</div>
<div ref="body"
class="d2-container-full__body">
<slot />
</div>
<div v-if="$slots.footer"
ref="footer"
class="d2-container-full__footer">
<slot name="footer" />
</div>
<!-- </el-scrollbar> -->
</div>
</template>
<script>
......
<template>
<div v-if="show" class="d2-header-switch" :class="{ 'd2-header-switch--active': isActive }" @click="handleClick">
<d2-el-icon :name="name" />
<li :class="$store.state.d2admin.tsearch.active ? 'fa fa-compress' : 'fa fa-expand'" />
</div>
</template>
<script>
import { mapMutations } from 'vuex'
export default {
data() {
return {
isActive: false,
path: ''
}
},
computed: {
show() {
return true
},
name() {
return this.$store.state.d2admin.tsearch.active ? 'top-right' : 'bottom-left'
}
},
mounted() {
setTimeout(() => (this.isActive = true), 0)
},
methods: {
...mapMutations('d2admin/tsearch', ['toggle']),
// 点击按钮的时候跳转到源代码
handleClick() {
this.toggle()
}
}
}
</script>
<style lang="scss" scoped>
.d2-header-switch {
$borderRadius: 30px;
$paddingLR: 30px;
$paddingTB: 2px;
$fontSize: 12px;
// $rightOuter: $paddingLR/2;
$rightOuter: calc($paddingLR / 2);
opacity: 0;
position: absolute;
z-index: 2000;
right: 20%;
bottom: -17px;
font-size: $fontSize;
line-height: $fontSize;
font-weight: bold;
border-radius: 0 0 $borderRadius $borderRadius;
padding: $paddingTB $paddingLR;
background-color: rgba(#fff, 1);
border: 1px solid #dcdfe6;
border-top: none;
color: #606266;
transition: all 0.3s;
@extend %unable-select;
&.d2-header-switch--active {
opacity: 1;
}
}
</style>
<template>
<div v-if="show"
class="d2-header-switch"
:class="{ 'd2-header-switch--active': isActive }"
@click="handleClick">
<d2-el-icon :name="name" />
<li :class="$store.state.d2admin.tsearch.active ? 'fa fa-compress' : 'fa fa-expand'" />
</div>
</template>
<script>
import { mapMutations } from "vuex";
export default {
data() {
return {
isActive: false,
path: "",
};
},
computed: {
show() {
return true;
},
name() {
return this.$store.state.d2admin.tsearch.active ? "top-right" : "bottom-left";
},
},
mounted() {
setTimeout(() => (this.isActive = true), 0);
},
methods: {
...mapMutations("d2admin/tsearch", ["toggle"]),
// 点击按钮的时候跳转到源代码
handleClick() {
this.toggle();
},
},
};
</script>
<style lang="scss" scoped>
.d2-header-switch {
$borderRadius: 30px;
$paddingLR: 30px;
$paddingTB: 2px;
$fontSize: 12px;
// $rightOuter: $paddingLR/2;
$rightOuter: calc($paddingLR / 2);
opacity: 0;
position: absolute;
z-index: 2000;
right: 20%;
bottom: -17px;
font-size: $fontSize;
line-height: $fontSize;
font-weight: bold;
border-radius: 0 0 $borderRadius $borderRadius;
padding: $paddingTB $paddingLR;
background-color: rgba(#fff, 1);
border: 1px solid #dcdfe6;
border-top: none;
color: #606266;
transition: all 0.3s;
@extend %unable-select;
&.d2-header-switch--active {
opacity: 1;
}
}
</style>
......@@ -45,6 +45,7 @@
<i class="suffix">{{ item.unit }}</i>
</template>
</el-input>
<el-input v-if="item.type === 'textarea'"
v-model.trim="formData[item.name]"
class="desc-input"
......@@ -53,6 +54,7 @@
:maxlength="item.maxlength"
:placeholder="item.label"
:rows="4" />
<!-- 选择框 -->
<el-select v-else-if="item.type === 'select'"
v-model="formData[item.name]"
......@@ -67,6 +69,7 @@
:label="subItem[item.optionLabel]"
:value="subItem[item.optionId]" />
</el-select>
<!-- 可添加选项选择框 -->
<el-select v-else-if="item.type === 'special-select'"
v-model="formData[item.name]"
......@@ -167,6 +170,7 @@
</div>
</div>
</el-select>
<template v-else-if="item.type === 'button'">
<div v-if="item.name === 'linkMerchants'">
<div class="add-btns">
......@@ -224,6 +228,7 @@
</el-table>
</div>
</template>
<template v-else-if="item.type === 'relatePro'">
<div class="add-btns">
<el-button type="primary"
......@@ -277,6 +282,7 @@
</p>
</div>
</template>
<template v-else-if="item.type === 'photo'">
<p class="photo-top-tips">
{{ item.topTips }}
......@@ -318,6 +324,7 @@
</div>
</template>
</template>
<template v-else-if="item.type === 'video'">
<p class="photo-top-tips">
{{ item.topTips }}
......@@ -359,6 +366,7 @@
</div>
</template>
</template>
<template v-else-if="item.type === 'descList'">
<el-row class="desc-btns">
<el-button size="small" @click="handleAddDesc(2, item)">
......@@ -404,6 +412,7 @@
</div>
</el-row>
</template>
<span v-else>
{{
item.name ? formData[item.name] : item.value
......
export default {
namespaced: true,
state: {
// 列表搜索框状态
active: true
},
mutations: {
/**
* @description 切换状态
* @param {Object} state state
*/
toggle(state) {
state.active = !state.active
},
/**
* @description 设置搜索框状态
* @param {Object} state state
* @param {Boolean} active active
*/
set(state, active) {
state.active = active
}
namespaced: true,
state: {
// 列表搜索框状态
active: true,
},
mutations: {
/**
* @description 切换状态
* @param {Object} state state
*/
toggle(state) {
state.active = !state.active;
},
/**
* @description 设置搜索框状态
* @param {Object} state state
* @param {Boolean} active active
*/
set(state, active) {
state.active = active;
},
},
actions: {
reset({ state }) {
state.active = true
}
}
}
},
actions: {
reset({ state }) {
state.active = true;
},
},
};
<template>
<div class="detail-wrapper">
<Descriptions :data="packages" :schema="packagesSchema" />
<el-divider class="divider"></el-divider>
<div v-for="(productData, index) in productList"
:key="productData.id"
class="product-detail-wrapper">
<Product :product="productData"
:edit-state="VIEW_MODE.VIEW"
:base-scene-code="baseSceneCode"
:show-business-line="false"
:show-sales-proportion-percent="false"
:show-settlement-type="false"
:show-gift-cost="false"
:merchant-id-list="merchantIdList"
:show-penetration-rate="false"
use-parent-mode
@update:upgradeGoods="handleUpdateProduct($event, index)" />
<el-divider class="divider"></el-divider>
</div>
<div class="detail-wrapper">
<Descriptions :data="packages" :schema="packagesSchema" />
<el-divider class="divider"></el-divider>
<div v-for="(productData, index) in productList"
:key="productData.id"
class="product-detail-wrapper">
<Product use-parent-mode
:base-scene-code="baseSceneCode"
:edit-state="VIEW_MODE.VIEW"
:merchant-id-list="merchantIdList"
:product="productData"
:show-business-line="false"
:show-gift-cost="false"
:show-penetration-rate="false"
:show-sales-proportion-percent="false"
:show-settlement-type="false"
@update:upgradeGoods="handleUpdateProduct($event, index)" />
<el-divider class="divider"></el-divider>
</div>
</div>
</template>
<script>
......
<template>
<div class="detail-wrapper">
<Descriptions :data="product" :schema="filterSchema">
<template #upgradeGoodsId-value>
<div class="sub-desc-wrapper">
<Descriptions :data="product" :schema="subFormItems" />
</div>
</template>
</Descriptions>
</div>
<div class="detail-wrapper">
<Descriptions :data="product" :schema="filterSchema">
<template #upgradeGoodsId-value>
<div class="sub-desc-wrapper">
<Descriptions :data="product" :schema="subFormItems" />
</div>
</template>
</Descriptions>
</div>
</template>
<script>
......
<template>
<div class="">
<Detail v-if="editState === VIEW_MODE.VIEW"
v-bind="$attrs"
:merchant-id-list="merchantIdList"
:product="product"
v-on="$listeners" />
<Modify v-if="editState === VIEW_MODE.EDIT || editState === VIEW_MODE.SAVING"
v-bind="$attrs"
ref="modifyRef"
:merchant-id-list="merchantIdList"
:product="product"
v-on="$listeners" />
</div>
<div class="">
<Detail v-if="editState === VIEW_MODE.VIEW"
v-bind="$attrs"
:merchant-id-list="merchantIdList"
:product="product"
v-on="$listeners" />
<Modify v-if="editState === VIEW_MODE.EDIT || editState === VIEW_MODE.SAVING"
v-bind="$attrs"
ref="modifyRef"
:merchant-id-list="merchantIdList"
:product="product"
v-on="$listeners" />
</div>
</template>
<script>
......
<template>
<div class="edit-page product-shelving-wrapper">
<div class="title-wrapper">
<span class="title">上架商品及套餐</span>
<div class="select-wrapper">
<RemoteSelect ref="remoteSelectRef"
v-model="tabsActive"
:options.sync="tabs.list"
class="tab-select"
:fetch-api="getTitleOptions"
placeholder="请输入相关名称以搜索"
immediate
:disabled="isEdit()"
size="mini"
:popper-append-to-body="false"
:field-name="{
value: 'id',
label: 'productName',
}"
:multiple="false"
:collapse-tags="false"
@change="handleTitleSelectChange($event)">
<template #options="{ row }">
<div class="tab-select-options-wrapper">
<span class="label">
{{ row.productName }}
</span>
<span v-if="useEdit && isView(editState)"
class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(row)">
</span>
</div>
</template>
</RemoteSelect>
<div class="edit-page product-shelving-wrapper">
<div class="title-wrapper">
<span class="title">上架商品及套餐</span>
<div class="select-wrapper">
<RemoteSelect ref="remoteSelectRef"
v-model="tabsActive"
class="tab-select"
placeholder="请输入相关名称以搜索"
size="mini"
immediate
:collapse-tags="false"
:disabled="isEdit()"
:fetch-api="getTitleOptions"
:field-name="{
value: 'id',
label: 'productName',
}"
:multiple="false"
:options.sync="tabs.list"
:popper-append-to-body="false"
@change="handleTitleSelectChange($event)">
<template #options="{ row }">
<div class="tab-select-options-wrapper">
<span class="label">
{{ row.productName }}
</span>
<span v-if="useEdit && isView(editState)"
class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(row)">
</span>
</div>
<div v-if="useEdit && isView(editState)" class="actions-wrapper">
<el-dropdown @command="handleAppendProductPackages">
<el-button plain size="small">
新增
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="goodsDefaultForm">
商品
</el-dropdown-item>
<el-dropdown-item command="packagesDefaultForm">
套餐
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div>
<div class="content-wrapper">
<template v-if="tabsActive && tabs.list && tabs.list.length || (!isEmpty(productDetail) || productDetail.productType)">
<div v-if="useEdit" class="actions-wrapper">
<el-button v-if="isView(editState)"
plain
style="width:160px"
size="small"
type="primary"
@click="handleChangeEditState">
编辑
</el-button>
<div v-else>
<el-button style="width:160px"
class="cancel-btn"
size="small"
@click="handleCancelEdit">
取消
</el-button>
<el-button style="width:160px"
type="primary"
size="small"
@click="saveEdit">
保存
</el-button>
</div>
</template>
</RemoteSelect>
</div>
<div v-if="useEdit && isView(editState)" class="actions-wrapper">
<el-dropdown @command="handleAppendProductPackages">
<el-button size="small" plain>
新增
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="goodsDefaultForm">
商品
</el-dropdown-item>
<el-dropdown-item command="packagesDefaultForm">
套餐
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div>
</div>
<div class="content-wrapper">
<template v-if="tabsActive && tabs.list && tabs.list.length || (!isEmpty(productDetail) || productDetail.productType)">
<div v-if="useEdit" class="actions-wrapper">
<el-button v-if="isView(editState)"
size="small"
style="width:160px"
type="primary"
plain
@click="handleChangeEditState">
编辑
</el-button>
<div v-else>
<el-button class="cancel-btn"
size="small"
style="width:160px"
@click="handleCancelEdit">
取消
</el-button>
<el-button size="small"
style="width:160px"
type="primary"
@click="saveEdit">
保存
</el-button>
</div>
<div v-if="hasMerchantIdList" class="tabs-wrapper">
<Product v-if="productDetail.productType === 1"
ref="productRefs"
:key="tabsActive + productDetail.productName"
:edit-state="editState"
:merchant-id-list="merchantIdList"
:base-scene-code="baseSceneCode"
:product="productDetail || { detailList: [] }"
@update:upgradeGoods="handleProductUpdateUpgradeGoods" />
<Combo v-if="productDetail.productType === 2"
ref="packageRefs"
:key="tabsActive"
:prefix="$data._prefix"
:merchant-id-list="merchantIdList"
:edit-state="editState"
:base-scene-code="baseSceneCode"
:shelf-type="shelfType"
:packages="productDetail || { detailList: [] }"
@update:packages="handleComboUpdatePackages" />
</div>
</div>
</template>
<Empty v-else
:use-tips="useEdit"
@create="handleAppendProductPackages" />
<div v-if="hasMerchantIdList" class="tabs-wrapper">
<Product v-if="productDetail.productType === 1"
:key="tabsActive + productDetail.productName"
ref="productRefs"
:base-scene-code="baseSceneCode"
:edit-state="editState"
:merchant-id-list="merchantIdList"
:product="productDetail || { detailList: [] }"
@update:upgradeGoods="handleProductUpdateUpgradeGoods" />
<Combo v-if="productDetail.productType === 2"
:key="tabsActive"
ref="packageRefs"
:base-scene-code="baseSceneCode"
:edit-state="editState"
:merchant-id-list="merchantIdList"
:packages="productDetail || { detailList: [] }"
:prefix="$data._prefix"
:shelf-type="shelfType"
@update:packages="handleComboUpdatePackages" />
</div>
</template>
<Empty v-else
:use-tips="useEdit"
@create="handleAppendProductPackages" />
</div>
</div>
</template>
<script>
......
......@@ -363,10 +363,12 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
return h("span", "-");
}
const types = [goodsInfo?.goodsTypeName];
if (goodsInfo?.secondaryGoodsTypeName)
if (goodsInfo?.secondaryGoodsTypeName) {
types.push(goodsInfo?.secondaryGoodsTypeName);
if (goodsInfo?.thirdLevelGoodsTypeName)
}
if (goodsInfo?.thirdLevelGoodsTypeName) {
types.push(goodsInfo?.thirdLevelGoodsTypeName);
}
return h(
"span",
types ? types.join("/") : "-",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!