【订单详情】

1. 修复微信小程序的兼容性,主要 productWindow 子组件不允许修改 props 的问题
pull/1/MERGE
YunaiV 2023-06-08 00:06:16 +08:00
parent ed2ea5876c
commit 16b6a37074
2 changed files with 26 additions and 14 deletions

View File

@ -16,17 +16,17 @@
<text class='stock' v-if="limitNum">: {{ attr.productSelect.quota }}</text>
</view>
</view>
<view class="iconfont icon-guanbi" @click="closeAttr"></view>
<view class="iconfont icon-guanbi" @click="close"></view>
</view>
<view class="rollTop">
<!-- 属性 key + value 列表 -->
<view class="productWinList">
<view class="item" v-for="(property, indexw) in attr.properties" :key="indexw">
<view class="item" v-for="(property, propertyIndex) in attr.properties" :key="propertyIndex">
<view class="title">{{ property.name }}</view>
<view class="listn acea-row row-middle">
<view class="itemn" :class="property.index === value.name ? 'on' : ''"
v-for="(value, indexn) in property.values" @click="clickProperty(indexw, indexn)"
:key="indexn">
v-for="(value, valueIndex) in property.values" :key="valueIndex"
@click="clickProperty(propertyIndex, valueIndex)">
{{ value.name }}
</view>
</view>
@ -64,7 +64,7 @@
<view class="joinBnt on"
v-else-if="(iScart && !attr.productSelect.stock)">已售罄</view>
</view>
<view class="mask" @touchmove.prevent :hidden="attr.cartAttr === false" @click="closeAttr"></view>
<view class="mask" @touchmove.prevent :hidden="attr.cartAttr === false" @click="close"></view>
</view>
</template>
@ -111,9 +111,9 @@
// TODO
this.$emit('iptCartNum', this.attr.productSelect.cart_num);
},
closeAttr: function() {
this.attr.cartAttr = false
},
close: function() {
this.$emit('close');
},
CartNumDes: function() {
// TODO
this.$emit('ChangeCartNum', false);
@ -125,14 +125,14 @@
/**
* 选中某个规格属性
*
* @param indexw properties 的下标
* @param indexn properties 的下标
* @param propertyIndex properties 的下标
* @param valueIndex values 的下标
*/
clickProperty: function(indexw, indexn) {
this.$set(this.attr.properties[indexw], 'index', this.attr.properties[indexw].values[indexn].name);
clickProperty: function(propertyIndex, valueIndex) {
this.$set(this.attr.properties[propertyIndex], 'index', this.attr.properties[propertyIndex].values[valueIndex].name);
let newSkuKey = this.getCheckedValueNames().join(",");
// TODO ChangeAttr selectSku
this.$emit("ChangeAttr", newSkuKey);
this.$emit("ChangeAttr", newSkuKey, propertyIndex, valueIndex);
},
/**
* 获取被选中属性值的数组

View File

@ -226,6 +226,7 @@
@ChangeAttr="ChangeAttr"
@ChangeCartNum="ChangeCartNum"
@iptCartNum="iptCartNum"
@close="closeAttr"
/>
<home></home>
<!-- 优惠劵弹窗 TODO 芋艿待实现 -->
@ -676,8 +677,11 @@
* 属性变动赋值
*
* @param newSkuKey 新的 skuKey
* @param propertyIndex properties 的下标
* @param valueIndex values 的下标
*/
ChangeAttr: function(newSkuKey) {
ChangeAttr: function(newSkuKey, propertyIndex, valueIndex) {
// SKU
let sku = this.skuMap[newSkuKey];
if (!sku) {
return;
@ -687,8 +691,16 @@
this.$set(this.attr.productSelect, "price", sku.price);
this.$set(this.attr.productSelect, "stock", sku.stock);
this.$set(this.attr.productSelect, "cart_num", 1);
// SKU
this.$set(this.attr.properties[propertyIndex], 'index', this.attr.properties[propertyIndex].values[valueIndex].name);
this.$set(this, "attrValue", newSkuKey);
},
/**
* 关闭 productWindow 弹窗
*/
closeAttr: function () {
this.$set(this.attr, "cartAttr", false);
},
/**
* 领取完毕移除当前页面领取过的优惠券展示
*/