Files
yshopb2c-uniapp/components/ProductWindow.vue
Gao xiaosong 728deeaa35 1、购买选择规格属性点不了
2、购物车列表点击管理 点击收藏功能去掉
3、下单点击积分抵扣没反应
4、待收货 列表查看物流点击没反应,详情查看物流可以点
5、添加地址选择地区无效
6、个人中心我的余额点进去点击账单记录一直正在加载中,点击下全部就出来了,应该你没带默认参数
8、订单点击评价没反应
9、小程序订单核销没上 你那边先根据路径判断隐藏下
10、我的推广,里面样式有问题,点击海报里面空白
11、分类点击 会分类Tab页分类一级比一级低
12、拼团详情客服功能隐藏去掉,其他地方有客服功能的都去掉
2020-04-11 01:44:10 +08:00

116 lines
3.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<view class="product-window" :class="attr.cartAttr === true ? 'on' : ''">
<view class="textpic acea-row row-between-wrapper">
<view class="pictrue">
<image :src="attr.productSelect.image" class="image" />
</view>
<view class="text">
<view class="line1">{{ attr.productSelect.store_name }}</view>
<view class="money font-color-red">
<text class="num">{{ attr.productSelect.price }}</text>
<text class="stock">库存: {{ attr.productSelect.stock }}</text>
</view>
</view>
<view class="iconfont icon-guanbi" @click="closeAttr"></view>
</view>
<view class="productWinList">
<view class="item" v-for="(item, indexw) in attr.productAttr" :key="indexw">
<view class="title">{{ item.attrName }}</view>
<view class="listn acea-row row-middle">
<view
class="itemn"
:class="item.index == indexn ? 'on' : ''"
v-for="(itemn, indexn) in item.attrValue"
@click="tapAttr(indexw, indexn)"
:key="indexn"
>{{ itemn.attr }}</view>
</view>
</view>
</view>
<view class="cart">
<view class="title">数量</view>
<view class="carnum acea-row row-left">
<view class="item reduce" :class="cartNum <= 1 ? 'on' : ''" @click="CartNumDes">-</view>
<view class="item num">{{ cartNum }}</view>
<view
class="item plus"
:class="
cartNum >= attr.productSelect.stock
? 'on'
: ''
"
@click="CartNumAdd"
>+</view>
</view>
</view>
</view>
<view class="mask" @touchmove.prevent :hidden="attr.cartAttr === false" @click="closeAttr"></view>
</view>
</template>
<script>
export default {
name: "ProductWindow",
props: {
attr: {
type: Object,
default: () => {}
},
cartNum: {
type: Number,
default: () => 1
}
},
data: function() {
return {};
},
mounted: function() {
console.log(this.attr);
},
methods: {
closeAttr: function() {
this.$emit("changeFun", { action: "changeattr", value: false });
},
CartNumDes: function() {
this.$emit("changeFun", { action: "ChangeCartNum", value: false });
},
CartNumAdd: function() {
this.$emit("changeFun", { action: "ChangeCartNum", value: 1 });
},
tapAttr: function(indexw, indexn) {
// 修改商品规格不生效的原因:
// H5端下面写法attr更新但是除H5外其他端不支持
// 尽量避免下面的骚写法不要在子组件内更新props
// this.attr.productAttr[res.indexw].index = res.indexn;
let that = this;
let value = that
.getCheckedValue()
.sort()
.join(",");
that.$emit("changeFun", {
action: "ChangeAttr",
value: {
value,
indexw,
indexn
}
});
},
//获取被选中属性;
getCheckedValue: function() {
let productAttr = this.attr.productAttr;
let value = [];
for (let i = 0; i < productAttr.length; i++) {
for (let j = 0; j < productAttr[i].attrValueArr.length; j++) {
if (productAttr[i].index === j) {
value.push(productAttr[i].attrValueArr[j]);
}
}
}
return value;
}
}
};
</script>