acdr-ui/dist/dev/mp-weixin/modules/mall/goods/components/detail/detail-tabbar.js.map

1 line
5.5 KiB
Plaintext
Raw Normal View History

2024-09-19 07:20:14 +08:00
{"version":3,"file":"detail-tabbar.js","sources":["../../../../../../../../src/modules/mall/goods/components/detail/detail-tabbar.vue","../../../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL3NyYy9tb2R1bGVzL21hbGwvZ29vZHMvY29tcG9uZW50cy9kZXRhaWwvZGV0YWlsLXRhYmJhci52dWU"],"sourcesContent":["<!-- 商品详情的底部导航 -->\r\n<template>\r\n <su-fixed bottom placeholder bg=\"bg-white\">\r\n <view class=\"ui-tabbar-box\">\r\n <view class=\"ui-tabbar ss-flex ss-col-center ss-row-between\">\r\n <view\r\n v-if=\"collectIcon\"\r\n class=\"detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center\"\r\n @tap=\"onFavorite\"\r\n >\r\n <block v-if=\"modelValue.favorite\">\r\n <image\r\n class=\"item-icon\"\r\n :src=\"sheep.$url.static('/static/img/shop/goods/collect_1.gif')\"\r\n mode=\"aspectFit\"\r\n />\r\n <view class=\"item-title\">已收藏</view>\r\n </block>\r\n <block v-else>\r\n <image\r\n class=\"item-icon\"\r\n :src=\"sheep.$url.static('/static/img/shop/goods/collect_0.png')\"\r\n mode=\"aspectFit\"\r\n />\r\n <view class=\"item-title\">收藏</view>\r\n </block>\r\n </view>\r\n <view\r\n v-if=\"serviceIcon\"\r\n class=\"detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center\"\r\n @tap=\"onChat\"\r\n >\r\n <image\r\n class=\"item-icon\"\r\n :src=\"sheep.$url.static('/static/img/shop/goods/message.png')\"\r\n mode=\"aspectFit\"\r\n />\r\n <view class=\"item-title\">客服</view>\r\n </view>\r\n <view\r\n v-if=\"shareIcon\"\r\n class=\"detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center\"\r\n @tap=\"showShareModal\"\r\n >\r\n <image\r\n class=\"item-icon\"\r\n :src=\"sheep.$url.static('/static/img/shop/goods/share.png')\"\r\n mode=\"aspectFit\"\r\n />\r\n <view class=\"item-title\">分享</view>\r\n </view>\r\n <slot></slot>\r\n </view>\r\n </view>\r\n </su-fixed>\r\n</template>\r\n\r\n<script setup>\r\n/**\r\n *\r\n * 底部导航\r\n *\r\n * @property {String} bg \t\t\t \t\t\t- 背景颜色Class\r\n * @property {String} ui \t\t\t \t\t\t- 自定义样式Class\r\n * @property {Boolean} noFixed \t\t \t\t\t- 是否定位\r\n * @property {Boolean} topRadius \t\t \t\t- 上圆角\r\n */\r\nimport { reactive } from 'vue'\r\nimport sheep from '@/sheep'\r\nimport { showShareModal } from '@/sheep/hooks/useModal'\r\nimport FavoriteApi from '@/sheep/api/product/favorite'\r\n\r\n// 数据\r\nconst state = reactive({})\r\n\r\n// 接收参数\r\nconst props = defineProps({\r\n modelValue: {\r\n type: Object,\r\n default() {},\r\n },\r\n bg: {\r\n type: String,\r\n default: 'bg-white',\r\n },\r\n bgStyles: {\r\n type: Object,\r\n default() {},\r\n },\r\n ui: {\r\n type: String,\r\n default: '',\r\n },\r\n\r\n noFixed: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n topRadius: {\r\n type: Number,\r\n default: 0,\r\n },\r\n collectIcon: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n serviceIcon: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n shareIcon: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n})\r\n\r\nasync function onFavorite() {\r\n // 情况一:取消收藏\r\n if (props.modelValue.favorite) {\r\n const { code } = await FavoriteApi.deleteFavorite(props.modelValue.id)\r\n if (code !== 0) {\r\n return\r\n }\r\n sheep.$helper.toast('取消收藏')\r\n props.modelValue.favorite = false\r\n // 情况二:添加收藏\r\n } else {\r\n const { code } = await FavoriteApi.createFavorite(props.modelValue.id)\r\n if (code !== 0) {\r\n return\r\n }\r\n sheep.$helper.toast('收藏成功')\r\n p