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

2 lines
1.9 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";const e=require("../../../../../common/vendor.js"),t=require("../../../../../sheep/index.js"),o=require("../../../../../sheep/hooks/useModal.js"),a=require("../../../../../sheep/api/product/favorite.js");if(!Array){e.resolveComponent("su-fixed")()}Math;const r={__name:"detail-tabbar",props:{modelValue:{type:Object,default(){}},bg:{type:String,default:"bg-white"},bgStyles:{type:Object,default(){}},ui:{type:String,default:""},noFixed:{type:Boolean,default:!1},topRadius:{type:Number,default:0},collectIcon:{type:Boolean,default:!0},serviceIcon:{type:Boolean,default:!0},shareIcon:{type:Boolean,default:!0}},setup(r){e.reactive({});const l=r;function s(){return e=this,o=null,r=function*(){if(l.modelValue.favorite){const{code:e}=yield a.FavoriteApi.deleteFavorite(l.modelValue.id);if(0!==e)return;t.sheep.$helper.toast("取消收藏"),l.modelValue.favorite=!1}else{const{code:e}=yield a.FavoriteApi.createFavorite(l.modelValue.id);if(0!==e)return;t.sheep.$helper.toast("收藏成功"),l.modelValue.favorite=!0}},new Promise(((t,a)=>{var l=e=>{try{i(r.next(e))}catch(t){a(t)}},s=e=>{try{i(r.throw(e))}catch(t){a(t)}},i=e=>e.done?t(e.value):Promise.resolve(e.value).then(l,s);i((r=r.apply(e,o)).next())}));var e,o,r}const i=()=>{t.sheep.$router.go("/modules/mall/chat/index",{id:l.modelValue.id})};return(a,l)=>e.e({a:r.collectIcon},r.collectIcon?e.e({b:r.modelValue.favorite},r.modelValue.favorite?{c:e.unref(t.sheep).$url.static("/static/img/shop/goods/collect_1.gif")}:{d:e.unref(t.sheep).$url.static("/static/img/shop/goods/collect_0.png")},{e:e.o(s)}):{},{f:r.serviceIcon},r.serviceIcon?{g:e.unref(t.sheep).$url.static("/static/img/shop/goods/message.png"),h:e.o(i)}:{},{i:r.shareIcon},r.shareIcon?{j:e.unref(t.sheep).$url.static("/static/img/shop/goods/share.png"),k:e.o(((...t)=>e.unref(o.showShareModal)&&e.unref(o.showShareModal)(...t)))}:{},{l:e.p({bottom:!0,placeholder:!0,bg:"bg-white"})})}},l=e._export_sfc(r,[["__scopeId","data-v-a3432705"]]);wx.createComponent(l);