mutations.js
1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import * as Types from './types';
// import { find, set } from 'lodash';
export default {
/*
* @ description: 更新二手商品详情页
* @ author: huzhiming
* @ date: 2019-11-22 19:09:49
* @ version: v1.0.0
*/
[Types.UPDATE_PRODUCT_DETAIL](state, { info }) {
state.info = { ...state.info, ...info };
},
/*
* @ description: 更新相同尺寸 二手商品列表
* @ author: huzhiming
* @ date: 2019-11-22 19:09:02
* @ version: v1.0.0
*/
[Types.UPDATE_PRODUCT_LIST](state, { data: { product_list, page_total, page }, isReset, error }) {
if (error) {
state.isShowEmpty = true;
return false;
}
if (product_list) {
if (page_total > page) {
state.isMore = true;
state.pageTotal = page_total;
state.page = page + 1;
} else {
state.isMore = false;
}
// 为了适配组件内数据,[apps/pages/second/components/second-list.vue]
product_list = product_list.map(item=>({
...item,
secondhand_image: item.image,
skup_price: item.price,
secondhandTypeName: item.sechondHandTypeName, // 修复字段单词拼写错误
size_name: item.sizeName.replace('码', '')
}));
if (isReset) {
state.productList = product_list;
} else {
state.productList = state.productList.push(...product_list);
}
}
},
[Types.UPDATE_PRODUCT_FILTER](state, { filter }) {
state.filterData = filter;
}
};