1
|
<template>
|
1
|
<template>
|
2
|
- <div class="refund">
|
2
|
+ <div class="return">
|
3
|
<div class="title">请选择换货商品</div>
|
3
|
<div class="title">请选择换货商品</div>
|
4
|
- <div>
|
|
|
5
|
- <exchange-item v-for="good in selectedGoods" :product="good"></exchange-item>
|
|
|
6
|
- </div>
|
|
|
7
|
- <div>
|
|
|
8
|
- <product-list v-bind:list="goods" v-bind:data="exchangeData" type="exchange"></product-list>
|
|
|
9
|
- </div>
|
4
|
+ <product-list :list="goodsArr" :data="exchangeData" type="exchange"></product-list>
|
10
|
<!--换货信息-->
|
5
|
<!--换货信息-->
|
11
|
<div class="list exchange-info">
|
6
|
<div class="list exchange-info">
|
12
|
<!--address-->
|
7
|
<!--address-->
|
|
@@ -27,6 +22,7 @@ |
|
@@ -27,6 +22,7 @@ |
27
|
</select>
|
22
|
</select>
|
28
|
</div>
|
23
|
</div>
|
29
|
</div>
|
24
|
</div>
|
|
|
25
|
+
|
30
|
<feature-selector
|
26
|
<feature-selector
|
31
|
:is-visible="showFeatureSelector"
|
27
|
:is-visible="showFeatureSelector"
|
32
|
:entity="entity"
|
28
|
:entity="entity"
|
|
@@ -44,6 +40,7 @@ |
|
@@ -44,6 +40,7 @@ |
44
|
const yoho = require('yoho');
|
40
|
const yoho = require('yoho');
|
45
|
|
41
|
|
46
|
const productList = require('home/return/list.vue');
|
42
|
const productList = require('home/return/list.vue');
|
|
|
43
|
+ const productItem = require('home/return/item.vue');
|
47
|
const exchangeItem = require('home/exchange/item.vue');
|
44
|
const exchangeItem = require('home/exchange/item.vue');
|
48
|
const featureSelector = require('component/product/feature-selector.vue');
|
45
|
const featureSelector = require('component/product/feature-selector.vue');
|
49
|
|
46
|
|
|
@@ -58,7 +55,7 @@ |
|
@@ -58,7 +55,7 @@ |
58
|
entity: {},
|
55
|
entity: {},
|
59
|
exchangeData: {},
|
56
|
exchangeData: {},
|
60
|
|
57
|
|
61
|
- goods: [],
|
58
|
+ goodsArr: [],
|
62
|
address: {},
|
59
|
address: {},
|
63
|
delivery: [],
|
60
|
delivery: [],
|
64
|
|
61
|
|
|
@@ -66,19 +63,6 @@ |
|
@@ -66,19 +63,6 @@ |
66
|
indexMap: {} // goods[index].id 与 index 的映射
|
63
|
indexMap: {} // goods[index].id 与 index 的映射
|
67
|
};
|
64
|
};
|
68
|
},
|
65
|
},
|
69
|
- computed: {
|
|
|
70
|
- // 换货商品
|
|
|
71
|
- selectedGoods() {
|
|
|
72
|
- return this.goods.filter(product => {
|
|
|
73
|
- return product.checked;
|
|
|
74
|
- });
|
|
|
75
|
- },
|
|
|
76
|
- unselectedGoods() {
|
|
|
77
|
- return this.goods.filter(product => {
|
|
|
78
|
- return !product.checked;
|
|
|
79
|
- });
|
|
|
80
|
- }
|
|
|
81
|
- },
|
|
|
82
|
events: {
|
66
|
events: {
|
83
|
'feature.close': function() {
|
67
|
'feature.close': function() {
|
84
|
this.showFeatureSelector = false;
|
68
|
this.showFeatureSelector = false;
|
|
@@ -87,7 +71,6 @@ |
|
@@ -87,7 +71,6 @@ |
87
|
created() {
|
71
|
created() {
|
88
|
// 打开 更换 颜色尺码
|
72
|
// 打开 更换 颜色尺码
|
89
|
bus.$on('open.featureSelector', msg => {
|
73
|
bus.$on('open.featureSelector', msg => {
|
90
|
- this.showFeatureSelector = true;
|
|
|
91
|
this.queryProductFeature(msg.pid);
|
74
|
this.queryProductFeature(msg.pid);
|
92
|
});
|
75
|
});
|
93
|
|
76
|
|
|
@@ -102,6 +85,8 @@ |
|
@@ -102,6 +85,8 @@ |
102
|
|
85
|
|
103
|
if (res.data && res.data.goodsList) {
|
86
|
if (res.data && res.data.goodsList) {
|
104
|
res.data.goodsList.forEach((product, index) => {
|
87
|
res.data.goodsList.forEach((product, index) => {
|
|
|
88
|
+ product.checked = false;
|
|
|
89
|
+ product.change = null;
|
105
|
product.reason = {
|
90
|
product.reason = {
|
106
|
id: 0
|
91
|
id: 0
|
107
|
};
|
92
|
};
|
|
@@ -110,7 +95,7 @@ |
|
@@ -110,7 +95,7 @@ |
110
|
self.indexMap[product.productId] = index; // 生成映射
|
95
|
self.indexMap[product.productId] = index; // 生成映射
|
111
|
});
|
96
|
});
|
112
|
|
97
|
|
113
|
- this.goods = res.data.goodsList;
|
98
|
+ this.$set('goodsArr', res.data.goodsList);
|
114
|
this.$set('exchangeData', res.data);
|
99
|
this.$set('exchangeData', res.data);
|
115
|
this.$set('address', res.data.address);
|
100
|
this.$set('address', res.data.address);
|
116
|
|
101
|
|
|
@@ -140,18 +125,25 @@ |
|
@@ -140,18 +125,25 @@ |
140
|
|
125
|
|
141
|
// 商品 feature改变
|
126
|
// 商品 feature改变
|
142
|
whenFeatureChange(selection) {
|
127
|
whenFeatureChange(selection) {
|
143
|
- const index = this.indexMap[pid];
|
128
|
+ const index = this.indexMap[selection.goodsId];
|
|
|
129
|
+ const goods = this.goodsArr[index];
|
|
|
130
|
+ goods.change = {
|
|
|
131
|
+ color: selection.color.text,
|
|
|
132
|
+ size: selection.size.text,
|
|
|
133
|
+ goodsId: selection.size.goodsId,
|
|
|
134
|
+ sku: selection.size.value
|
|
|
135
|
+ }
|
|
|
136
|
+ console.log(goods.goodsId);
|
144
|
|
137
|
|
145
|
this.showFeatureSelector = false;
|
138
|
this.showFeatureSelector = false;
|
146
|
- this.goods[index]._change = {
|
|
|
147
|
-
|
|
|
148
|
- };
|
139
|
+ // this.goodsArr.$set(index, Object.assign({}, goods, change));
|
149
|
},
|
140
|
},
|
150
|
|
141
|
|
151
|
// 查询 商品 feature
|
142
|
// 查询 商品 feature
|
152
|
queryProductFeature(pid) {
|
143
|
queryProductFeature(pid) {
|
153
|
$.get(`/product/product_${pid}.json`).then(result => {
|
144
|
$.get(`/product/product_${pid}.json`).then(result => {
|
154
|
this.entity = result;
|
145
|
this.entity = result;
|
|
|
146
|
+ this.showFeatureSelector = true;
|
155
|
return result;
|
147
|
return result;
|
156
|
});
|
148
|
});
|
157
|
},
|
149
|
},
|
|
@@ -180,8 +172,8 @@ |
|
@@ -180,8 +172,8 @@ |
180
|
exchange_reason: good.reason.id,
|
172
|
exchange_reason: good.reason.id,
|
181
|
remark: good.remark,
|
173
|
remark: good.remark,
|
182
|
evidence_images: good.imageList,
|
174
|
evidence_images: good.imageList,
|
183
|
- new_goods_id: good.newGoodsId,
|
|
|
184
|
- new_product_sku: good.newProductSku
|
175
|
+ new_goods_id: good.change.goodsId,
|
|
|
176
|
+ new_product_sku: good.change.sku
|
185
|
});
|
177
|
});
|
186
|
});
|
178
|
});
|
187
|
|
179
|
|
|
@@ -227,9 +219,8 @@ |
|
@@ -227,9 +219,8 @@ |
227
|
}
|
219
|
}
|
228
|
},
|
220
|
},
|
229
|
components: {
|
221
|
components: {
|
230
|
- productList,
|
|
|
231
|
- exchangeItem,
|
|
|
232
|
- featureSelector
|
222
|
+ featureSelector,
|
|
|
223
|
+ productList
|
233
|
}
|
224
|
}
|
234
|
};
|
225
|
};
|
235
|
|
226
|
|
|
@@ -238,6 +229,13 @@ |
|
@@ -238,6 +229,13 @@ |
238
|
body {
|
229
|
body {
|
239
|
background-color: #f6f6f6;
|
230
|
background-color: #f6f6f6;
|
240
|
}
|
231
|
}
|
|
|
232
|
+
|
|
|
233
|
+ .return .title {
|
|
|
234
|
+ padding: 30px 30px 0;
|
|
|
235
|
+ color: #b0b0b0;
|
|
|
236
|
+ font-size: 28px;
|
|
|
237
|
+ line-height: 60px;
|
|
|
238
|
+ }
|
241
|
|
239
|
|
242
|
.exchange-info {
|
240
|
.exchange-info {
|
243
|
margin: 30px 0;
|
241
|
margin: 30px 0;
|