Feat:寻看点和抽奖

This commit is contained in:
lifizer
2024-02-06 12:42:46 +08:00
parent c88b6aa8a8
commit f3115fe7c8
73 changed files with 5324 additions and 6887 deletions
+29 -15
View File
@@ -429,11 +429,11 @@
<text style="text-align: center;">购物车</text>
</view>
<view style="position: relative;" class="item" @click="toHome">
<view class="iconfont icon-shouye-xianxing"></view>
<view style="text-align: center;">首页</view>
<view class="item" @click="doneFavorite">
<!-- <view class="iconfont icon-shouye-xianxing"></view>-->
<image style="width: 40rpx;height: 40rpx" :src="webUrl+'/20240113230535491918.png'" mode="scaleToFill" v-if="isFavorite"/>
<image style="width: 40rpx;height: 40rpx" :src="webUrl+'/20240122001533781400.png'" mode="scaleToFill" v-else/>
<view style="text-align: center;">收藏</view>
</view>
@@ -447,7 +447,6 @@
</view>
</view>
</view>
<!-- <CouponPop v-on:changeFun="changeFun" :coupon="coupon"></CouponPop>-->
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cart_num"/>
<StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
:posterData="posterData" :goodId="id"></StorePoster>
@@ -491,7 +490,7 @@ import {getCurAddress, getLocation, getUrlParam} from "@/utils/common.js";
import cookie from "@/utils/store/cookie";
import {famousGoodsShareImage, secKillGoodsShareImage} from "@/api/share";
import CouponsPopup from "@/components/CouponsPopup.vue"
import { formatContent } from '@/utils/util.js'
import {addProduct, checkProduct, removeProduct} from "@/api/favorite";
export default {
name: "GoodsCon",
@@ -573,6 +572,8 @@ export default {
webUrl: this.$VUE_APP_RESOURCES_URL,
// v9-2
show: false,
uniqueId: null,
isFavorite: false
};
},
computed: mapGetters(["isLogin", "location", "userInfo"]),
@@ -669,6 +670,13 @@ export default {
} else {
this.productConClass = "product-con";
}
},
attr: {
deep: true,
handler(newVal, oldVal) {
this.uniqueId = newVal.productSelect.unique || null
if (this.uniqueId) this.checkFavorite()
}
}
},
methods: {
@@ -886,11 +894,8 @@ export default {
toggleProductInfo() {
this.isProductInfoExpand = !this.isProductInfoExpand;
},
toHome() {
this.$yrouter.switchTab("/pages/home/index");
},
goShoppingCart() {
this.$yrouter.switchTab("/pages/shop/ShoppingCart/index");
this.$yrouter.switchTab("/pages/cart");
},
goCustomerList() {
this.$yrouter.push({
@@ -963,10 +968,6 @@ export default {
// /\<img/gi,
// '<img style="display:block;max-width:100%;height:auto;"'
// );
if (res.data.storeInfo.description) {
console.log(res.data.storeInfo.description)
res.data.storeInfo.description = formatContent(res.data.storeInfo.description)
}
that.$set(that, "storeInfo", res.data.storeInfo);
that.isWenwan = res.data.isWenwan;
@@ -1300,6 +1301,19 @@ export default {
changeCoupons() {
this.show = !this.show
},
async checkFavorite() {
const res = await checkProduct(this.id, this.uniqueId)
if (res.success) this.isFavorite = res.data.hasFavorite
},
async doneFavorite() {
if (this.isFavorite) {
const res = await removeProduct(this.id, this.uniqueId)
if (res.success) this.isFavorite = false
} else {
const res = await addProduct(this.id, this.uniqueId)
if (res.success) this.isFavorite = true
}
}
}
};
</script>
File diff suppressed because it is too large Load Diff