修改商品规格选择错乱的问题
This commit is contained in:
@ -66,6 +66,7 @@ export default {
|
|||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
mounted: function() {
|
mounted: function() {
|
||||||
|
console.log(this);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeAttr: function() {
|
closeAttr: function() {
|
||||||
@ -81,7 +82,8 @@ export default {
|
|||||||
// 修改商品规格不生效的原因:
|
// 修改商品规格不生效的原因:
|
||||||
// H5端下面写法,attr更新,但是除H5外其他端不支持,
|
// H5端下面写法,attr更新,但是除H5外其他端不支持,
|
||||||
// 尽量避免下面的骚写法,不要在子组件内更新props
|
// 尽量避免下面的骚写法,不要在子组件内更新props
|
||||||
// this.attr.productAttr[res.indexw].index = res.indexn;
|
// 这里修改是为了能获取到被选中的属性
|
||||||
|
this.attr.productAttr[indexw].index = indexn;
|
||||||
let that = this;
|
let that = this;
|
||||||
let value = that
|
let value = that
|
||||||
.getCheckedValue()
|
.getCheckedValue()
|
||||||
@ -100,6 +102,7 @@ export default {
|
|||||||
getCheckedValue: function() {
|
getCheckedValue: function() {
|
||||||
let productAttr = this.attr.productAttr;
|
let productAttr = this.attr.productAttr;
|
||||||
let value = [];
|
let value = [];
|
||||||
|
console.log(productAttr)
|
||||||
for (let i = 0; i < productAttr.length; i++) {
|
for (let i = 0; i < productAttr.length; i++) {
|
||||||
for (let j = 0; j < productAttr[i].attrValueArr.length; j++) {
|
for (let j = 0; j < productAttr[i].attrValueArr.length; j++) {
|
||||||
if (productAttr[i].index === j) {
|
if (productAttr[i].index === j) {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<view class="start" :class="'star' + item.star"></view>
|
<view class="start" :class="'star' + item.star"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="time">{{ item.add_time }} {{ item.suk }}</view>
|
<view class="time">{{ dataFormat(item.addTime) }} {{ item.suk }}</view>
|
||||||
<view class="evaluate-infor">{{ item.comment }}</view>
|
<view class="evaluate-infor">{{ item.comment }}</view>
|
||||||
<view class="imgList acea-row">
|
<view class="imgList acea-row">
|
||||||
<view class="pictrue" v-for="(itemn, eq) in item.picturesArr" :key="eq">
|
<view class="pictrue" v-for="(itemn, eq) in item.picturesArr" :key="eq">
|
||||||
@ -26,6 +26,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { dataFormat } from "@/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "UserEvaluation",
|
name: "UserEvaluation",
|
||||||
props: {
|
props: {
|
||||||
@ -38,6 +40,8 @@ export default {
|
|||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
mounted: function() {},
|
mounted: function() {},
|
||||||
methods: {}
|
methods: {
|
||||||
|
dataFormat,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -330,6 +330,7 @@ export default {
|
|||||||
getProductDetail(that.id, form)
|
getProductDetail(that.id, form)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
that.$set(that, "storeInfo", res.data.storeInfo);
|
that.$set(that, "storeInfo", res.data.storeInfo);
|
||||||
|
// 给 attr 赋值,将请求回来的规格赋值给 attr
|
||||||
that.$set(that.attr, "productAttr", res.data.productAttr);
|
that.$set(that.attr, "productAttr", res.data.productAttr);
|
||||||
that.$set(that, "productValue", res.data.productValue);
|
that.$set(that, "productValue", res.data.productValue);
|
||||||
that.$set(that, "replyCount", res.data.replyCount);
|
that.$set(that, "replyCount", res.data.replyCount);
|
||||||
@ -496,11 +497,15 @@ export default {
|
|||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
},
|
},
|
||||||
changeattr: function(msg) {
|
changeattr: function(msg) {
|
||||||
|
// 修改了规格
|
||||||
|
console.log(msg)
|
||||||
this.attr.cartAttr = msg;
|
this.attr.cartAttr = msg;
|
||||||
this.isOpen = false;
|
this.isOpen = false;
|
||||||
},
|
},
|
||||||
//选择属性;
|
//选择属性;
|
||||||
ChangeAttr: function(res) {
|
ChangeAttr: function(res) {
|
||||||
|
// 修改了规格
|
||||||
|
console.log(res)
|
||||||
let productSelect = this.productValue[res.value];
|
let productSelect = this.productValue[res.value];
|
||||||
if (productSelect) {
|
if (productSelect) {
|
||||||
this.attr.productAttr[res.indexw].index = res.indexn;
|
this.attr.productAttr[res.indexw].index = res.indexn;
|
||||||
|
Reference in New Issue
Block a user