Task:点击购物车图标加入购物车

This commit is contained in:
modendeveloper
2025-01-14 23:42:33 +08:00
parent f8b6d72a59
commit 46b858b700
10 changed files with 485 additions and 24 deletions
+1
View File
@@ -21,6 +21,7 @@
<view class="flex jc-between ai-center">
<text class="price">¥{{ item.price }}</text>
<image
@click.stop="$emit('add', item)"
:src="webUrl + '/home/icon-cart.png'"
class="btn"
/>
+16 -2
View File
@@ -248,6 +248,7 @@
v-else
:item="item"
@view="goGoodsCon(item)"
@add="addToCart(item)"
/>
</view>
</view>
@@ -284,6 +285,7 @@
v-else
:item="item"
@view="goGoodsCon(item)"
@add="addToCart(item)"
/>
</view>
</view>
@@ -323,6 +325,15 @@
@click="setTopHandle"
/>
</u-back-top>
<ProductWindow
ref="attrWindow"
:attr="attr"
:cartNum="cart_num"
:showOk="true"
@changeFun="changeFun"
@ok="handleOk"
paddingBottom="200rpx"
/>
<xdd-tabbar :curr-index="0" />
</view>
</template>
@@ -334,6 +345,8 @@ import { getCouponReceive } from '@/api/user'
import { getHomeData, getShareImage } from '@/api/public'
import { sharpBannar } from '@/api/goods'
import { pageListenMixins } from '@/mixins/pageListenMixins'
import ProductWindow from '@/components/ProductWindow'
import goCartMixin from '@/mixins/goCartMixins'
import {
getCurAddress,
getLocationPromise,
@@ -344,9 +357,10 @@ export default {
name: 'IndexPage',
components: {
XddTabbar,
XddProductItem
XddProductItem,
ProductWindow
},
mixins: [pageListenMixins],
mixins: [pageListenMixins, goCartMixin],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
+14 -3
View File
@@ -56,7 +56,7 @@
<information :landmarkDataId="landmarkDataId"></information>
</view>
<view v-if="actived === 4">
<goods :goods="goods" v-if="goods.length > 0"></goods>
<goods :goods="goods" v-if="goods.length > 0" @add='addToCart($event, "productId")'></goods>
<!-- <image
v-if="isCompleteLoadGood"
:src="webUrl + '/home/no-data-bg.png'"
@@ -76,6 +76,14 @@
:show-avatar="false"
/>
<shareImg ref="shareImg"></shareImg>
<ProductWindow
ref="attrWindow"
:attr="attr"
:cartNum="cart_num"
:showOk="true"
@changeFun="changeFun"
@ok="handleOk"
/>
</view>
</template>
@@ -87,10 +95,12 @@ import {
} from "@/api/product"
import goods from "./components/goods.vue"
import { pageListenMixins } from '@/mixins/pageListenMixins'
import goCartMixin from '@/mixins/goCartMixins'
import projects from './components/projects.vue'
import culture from "./components/culture.vue"
import information from "./components/information.vue"
import shareImg from "./components/shareImg.vue"
import ProductWindow from '@/components/ProductWindow'
export default {
name: 'LandMarkPage',
components: {
@@ -98,9 +108,10 @@ export default {
projects,
culture,
information,
shareImg
shareImg,
ProductWindow
},
mixins: [pageListenMixins],
mixins: [pageListenMixins, goCartMixin],
data() {
return {
actived: 1,