Fix:5184 【商城小程序】猜你喜欢商品列表,点击购物车图标商品未添加购物车

This commit is contained in:
linxi
2026-05-08 18:37:35 +08:00
parent 2da80cd30b
commit 02e1015594
+20 -6
View File
@@ -109,7 +109,7 @@
<view v-if="item.isNegotiable === 1" class="v12-primary-text v12-font-32 v12-font-weight" @clicks.stop="goRoom(item)"> <view v-if="item.isNegotiable === 1" class="v12-primary-text v12-font-32 v12-font-weight" @clicks.stop="goRoom(item)">
价格面议 价格面议
</view> </view>
<view class="btn"> <view class="btn" @click.stop="addToCart(item, 'productId')">
<image <image
:src="webUrl + '/home/icon-cart.png'" :src="webUrl + '/home/icon-cart.png'"
class="img-icon" class="img-icon"
@@ -309,14 +309,14 @@
:key="attr" :key="attr"
:class="{ :class="{
'on': attr.check, 'on': attr.check,
'disabled': getAttrItemData(attr.attr).stock === 0 'disabled': getAttrItemData1(attr.attr).stock === 0
}" }"
class="attr" class="attr"
@click="attrItemClick(attr, attrIndex, index)" @click="attrItemClick(attr, attrIndex, index)"
> >
{{ attr.attr }} {{ attr.attr }}
<text <text
v-if="getAttrItemData(attr.attr).stock === 0" v-if="getAttrItemData1(attr.attr).stock === 0"
class="tag" class="tag"
>缺货</text> >缺货</text>
</view> </view>
@@ -368,28 +368,41 @@
</view> </view>
</u-popup> </u-popup>
<ProductWindow
ref="attrWindow"
:attr="attr"
:cartNum="cart_num"
:showOk="true"
@changeFun="changeFun"
@ok="handleOk(() => this.getCart())"
/>
<xdd-tabbar :curr-index="2" /> <xdd-tabbar :curr-index="2" />
</view> </view>
</template> </template>
<script> <script>
import XddTabbar from '@/components/xdd-tabbar' import XddTabbar from '@/components/xdd-tabbar'
import ProductWindow from '@/components/ProductWindow'
import {getAddressList, getUserLike} from "@/api/user"; import {getAddressList, getUserLike} from "@/api/user";
import { import {
changeCartNum, changeCartNum,
getCartGroup, getCartGroup,
postCartDel, postCartDel,
postCartAdd,
getCartGoodAttr, getCartGoodAttr,
cartGoodChangeAttr cartGoodChangeAttr
} from '@/api/store' } from '@/api/store'
import CheckboxIcon from '@/components/CheckboxIcon.vue' import CheckboxIcon from '@/components/CheckboxIcon.vue'
import { pageListenMixins } from '@/mixins/pageListenMixins' import { pageListenMixins } from '@/mixins/pageListenMixins'
import goCartMixin from '@/mixins/goCartMixins'
import { mapGetters } from 'vuex'
import cookie from "@/utils/store/cookie" import cookie from "@/utils/store/cookie"
export default { export default {
components: { components: {
CheckboxIcon, CheckboxIcon,
XddTabbar XddTabbar,
ProductWindow
}, },
mixins: [pageListenMixins], mixins: [pageListenMixins, goCartMixin],
data() { data() {
return { return {
webUrl: this.$VUE_APP_RESOURCES_URL, webUrl: this.$VUE_APP_RESOURCES_URL,
@@ -415,6 +428,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['isLogin']),
total() { total() {
let price = 0 let price = 0
this.list.forEach(item => { this.list.forEach(item => {
@@ -766,7 +780,7 @@ export default {
uni.hideLoading() uni.hideLoading()
}) })
}, },
getAttrItemData(attr) { getAttrItemData1(attr) {
let result = { let result = {
stock: 0 stock: 0
} }