| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- <template>
- <view class="product-service" v-if="!isHide">
- <commonWrapper :config="dataConfig">
- <view class="service-list">
- <!-- Activity -->
- <view
- class="item"
- v-if="checkList.includes(0) && (couponList.length || activity.length)"
- >
- <view class="label" :style="{ color: titleColor }">{{
- $t("活动")
- }}</view>
- <view class="content" @click="activityTap">
- <view class="tags-wrapper">
- <!-- Coupon -->
- <view
- class="tag-item"
- v-if="couponList.length"
- :style="tagStyle"
- @click.stop="activityTap"
- >
- <text class="iconfont icon-ic_sale"></text>
- {{ $t("优惠券")
- }}<text
- class="iconfont icon-you2"
- :style="{ color: activityColor }"
- ></text>
- </view>
- <!-- Activity -->
- <block v-for="(item, index) in activity" :key="index">
- <view
- class="tag-item"
- v-if="item.type === '1'"
- :style="tagStyle"
- @click.stop="goActivity(item)"
- >
- <text class="iconfont icon-miaosha1"></text>
- {{ $t("秒杀")
- }}<text
- class="iconfont icon-you2"
- :style="{ color: activityColor }"
- ></text>
- </view>
- <view
- class="tag-item"
- v-if="item.type === '2'"
- :style="tagStyle"
- @click.stop="goActivity(item)"
- >
- <text class="iconfont icon-yaoqinghaoyou1"></text>
- {{ $t("砍价")
- }}<text
- class="iconfont icon-you2"
- :style="{ color: activityColor }"
- ></text>
- </view>
- <view
- class="tag-item"
- v-if="item.type === '3'"
- :style="tagStyle"
- @click.stop="goActivity(item)"
- >
- <text class="iconfont icon-wodetuandui"></text>
- {{ $t("拼团")
- }}<text
- class="iconfont icon-you2"
- :style="{ color: activityColor }"
- ></text>
- </view>
- </block>
- </view>
- <text
- class="iconfont icon-jiantou"
- :style="{ color: contentColor }"
- ></text>
- </view>
- </view>
- <!-- Selection -->
- <view
- class="item"
- v-if="
- checkList.includes(1) && attr.productAttr && attr.productAttr.length
- "
- @click="showSpecModal"
- >
- <view class="label" :style="{ color: titleColor }">{{
- $t("选择")
- }}</view>
- <view class="content">
- <view class="text line1" :style="{ color: contentColor }">
- {{ attrTxt }}:{{ attrValue }}
- </view>
- <text
- class="iconfont icon-jiantou"
- :style="{ color: contentColor }"
- ></text>
- </view>
- </view>
- <!-- Parameters -->
- <view
- class="item"
- v-if="
- checkList.includes(2) &&
- productData.params_list &&
- productData.params_list.length
- "
- @click="openModal('specs')"
- >
- <view class="label" :style="{ color: titleColor }">{{
- $t("参数")
- }}</view>
- <view class="content">
- <view class="text line1" :style="{ color: contentColor }">
- <text
- v-for="(item, index) in productData.params_list"
- :key="index"
- >
- {{ item.name }} ·
- </text>
- </view>
- <text
- class="iconfont icon-jiantou"
- :style="{ color: contentColor }"
- ></text>
- </view>
- </view>
- <!-- Service -->
- <view
- class="item"
- v-if="
- checkList.includes(3) &&
- productData.protection_list &&
- productData.protection_list.length
- "
- @click="openModal('protection')"
- >
- <view class="label" :style="{ color: titleColor }">{{
- $t("服务")
- }}</view>
- <view class="content">
- <view class="text line1" :style="{ color: contentColor }">
- <text
- v-for="(item, index) in productData.protection_list"
- :key="index"
- >
- {{ item.title }} ·
- </text>
- </view>
- <text
- class="iconfont icon-jiantou"
- :style="{ color: contentColor }"
- ></text>
- </view>
- </view>
- </view>
- </commonWrapper>
- </view>
- </template>
- <script>
- import commonWrapper from "./commonWrapper.vue";
- export default {
- name: "homeProductService",
- components: {
- commonWrapper,
- },
- props: {
- dataConfig: {
- type: Object,
- default: () => ({}),
- },
- productData: {
- type: Object,
- default: () => ({}),
- },
- couponList: {
- type: Array,
- default: () => [],
- },
- activity: {
- type: Array,
- default: () => [],
- },
- attr: {
- type: Object,
- default: () => ({}),
- },
- attrTxt: {
- type: String,
- default: "",
- },
- attrValue: {
- type: String,
- default: "",
- },
- },
- computed: {
- isHide() {
- return this.dataConfig.isHide;
- },
- checkList() {
- return this.dataConfig.checkBoxConfig
- ? this.dataConfig.checkBoxConfig.type
- : [];
- },
- titleColor() {
- return this.dataConfig.titleColor
- ? this.dataConfig.titleColor.color[0].item
- : "#999999";
- },
- contentColor() {
- return this.dataConfig.contentColor
- ? this.dataConfig.contentColor.color[0].item
- : "#333333";
- },
- isCustomTone() {
- return (
- this.dataConfig.toneConfig && this.dataConfig.toneConfig.tabVal === 1
- );
- },
- tagStyle() {
- if (this.isCustomTone) {
- const color = this.dataConfig.activityColor
- ? this.dataConfig.activityColor.color[0].item
- : "var(--view-theme)";
- const bg = this.dataConfig.activityBgColor
- ? this.dataConfig.activityBgColor.color[0].item
- : "var(--view-minorColorT)";
- return {
- color: color,
- background: bg,
- };
- }
- return {
- color: "var(--view-theme)",
- background: "var(--view-minorColorT)",
- };
- },
- activityColor() {
- if (this.isCustomTone) {
- return this.dataConfig.activityColor
- ? this.dataConfig.activityColor.color[0].item
- : "var(--view-theme)";
- }
- return "var(--view-theme)";
- },
- },
- methods: {
- activityTap() {
- if (this.couponList.length) {
- this.$emit("showCoupon");
- } else if (this.activity.length) {
- }
- },
- goActivity(item) {
- this.$emit("goActivity", item);
- },
- showSpecModal() {
- this.$emit("showSpecModal");
- },
- openModal(type) {
- this.$emit("openModal", type);
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .product-service {
- .service-list {
- .item {
- display: flex;
- align-items: center;
- padding: 28rpx 0rpx;
- position: relative;
- .label {
- width: 80rpx;
- font-size: 28rpx;
- margin-right: 20rpx;
- }
- .content {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: space-between;
- overflow: hidden;
- .text {
- font-size: 28rpx;
- color: #333;
- }
- .tags-wrapper {
- display: flex;
- flex-wrap: wrap;
- .tag-item {
- font-size: 24rpx;
- padding: 3rpx 10rpx;
- border-radius: 30rpx;
- margin-right: 10rpx;
- display: flex;
- align-items: center;
- .iconfont {
- &:first-child {
- font-size: 24rpx;
- margin-right: 5rpx;
- }
- font-size: 18rpx;
- line-height: 22rpx;
- }
- }
- }
- .iconfont {
- font-size: 24rpx;
- }
- }
- }
- }
- }
- </style>
|