actions.js
6.76 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
import * as Types from './types';
import {first, get, flatten} from 'lodash';
export default {
/**
* 获取商品详细信息及尺码列表信息
* @param commit
* @param productId
* @param page
* @param refresh
* @returns {Promise<void>}
*/
async fetchProduct({commit}, {productId, page = 1, refresh = false}) {
commit(Types.FETCH_ORDER_PRODUCT_REQUEST);
let result;
if (refresh) {
const results = await Promise.all(Array.from(new Array(page)).map((v, i) => {
return this.$api.get('/api/ufo/seller/entryGoodsSizeList', {
productId,
page: i + 1
});
}));
result = {
code: 200,
data: {
productInfo: get(first(results), 'data.productInfo'),
data: flatten(results.map(r => get(r, 'data.data', [])))
}
};
} else {
result = await this.$api.get('/api/ufo/seller/entryGoodsSizeList', {
productId,
page
});
}
if (result && result.code === 200) {
commit(Types.FETCH_ORDER_PRODUCT_SUCCESS, {
order: result.data,
refresh
});
} else {
commit(Types.FETCH_ORDER_PRODUCT_FAILED);
}
},
/**
* 获取未入驻商家出售的商品详情
* @param commit
* @param orderCode
* @returns {Promise<void>}
*/
async fetchOrder({commit}, {orderCode}) {
commit(Types.FETCH_NOENTRY_ORDER_PRODUCT_REQUEST);
let result;
result = await this.$api.get('/api/order/detail', {
orderCode,
tabType: 'sell'
});
console.log('fetchOrder= ', result);
if (result && result.code === 200) {
commit(Types.FETCH_NOENTRY_ORDER_PRODUCT_SUCCESS, {
order: result
});
} else {
result = { alg: 'SALT_MD5',
code: 200,
data:
{ attributes: 1,
bankTransferFee: '-¥0.09',
bidType: 0,
buttons: [ [Object], [Object] ],
createTime: '2019-09-29 10:54:00',
earnestMoney: 0.36,
earnestMoneyStr: '¥0.36',
goodsInfo:
{ batchNo: 1226211663688,
bidType: 0,
colorName: '黑色',
entryFlag: false,
goodImg:
'http://img11.static.yhbimg.com/goodsimg/2019/02/25/10/018b0d26a7e4bc0b39a93c329dd8c13d8e.jpg?imageMogr2/thumbnail/{width}x{height}/background/d2hpdGU=/position/center/quality/80',
goodPrice: '9.00',
leastPrice: 9,
leastPriceOfSkuTips: '最低现货价¥9',
price: 9,
productId: 10001266,
productName: 'Air Jordan 1 复刻黑绿脚趾 范闲',
sizeName: '37',
skup: 19168,
storageId: 10090816 },
income: '¥8.47',
isAdvance: 'N',
isPaid: 1,
orderCode: 1226211663688,
payment: 2,
paymentStr: '支付宝',
platformFee:
{ amount: '-¥0.44',
appraiseFee: '¥0.01',
goodsPaymentRatePercent: '4.70%',
packageFee: '¥0.01',
payChannelPercentage: '1.00%',
serviceFee: '¥0.42' },
secendLevelCreateTime: 1569725640,
statusDetail:
{ detailDesc: '商品出售中,待买家购买',
expressShow: false,
paymentTips: '交易成功后自动退还',
statuStr: '出售中',
status: 1 },
submitOrderTimeStr: '2019-09-29 10:54:00',
uid: 349709,
userAddress:
{ address: '嘉陵江东街18号南京国家广告产****17楼',
address_id: 2396242,
area: '江苏省 南京市 建邺区 建邺区新城科技园',
areaCode: '320105400',
consignee: '*骏',
isUpdate: 'N',
mobile: '138****0257',
phone: '',
zipCode: '' } },
md5: 'aa8b0d59cf55a6266304ac1edf6dbd43',
message: '订单详情' };
commit(Types.FETCH_NOENTRY_ORDER_PRODUCT_SUCCESS, {
order: result
});
// commit(Types.FETCH_NOENTRY_ORDER_PRODUCT_FAILED);
}
},
/**
* 不卖了
* @param commit
* @param payload
* @returns {Promise<void>}
*/
async postNoSale({commit}, payload) {
commit(Types.POST_NOSALE_REQUEST);
const result = await this.$api.get('/api/ufo/sellerOrder/batchDownShelf', payload);
console.log('下架=', result);
if (result && result.code === 200) {
commit(Types.POST_NOSALE_SUCCESS, {
order: result.data
});
} else {
commit(Types.POST_CALCPRICE_FAILED);
}
return result || {};
},
/**
* 入驻商家试算调价
* @param commit
* @param payload
* @returns {Promise<*|{}>}
*/
async postCalcPrice({commit}, payload) {
commit(Types.POST_CALCPRICE_REQUEST);
const result = await this.$api.get('/api/ufo/sellerOrder/computeAdjustPrice', payload);
if (result && result.code === 200) {
commit(Types.POST_CALCPRICE_SUCCESS, {
order: result.data
});
} else {
commit(Types.POST_CALCPRICE_FAILED);
}
return result || {};
},
/**
* 未入驻商家试算调价
* @param commit
* @param payload
* @returns {Promise<{}>}
*/
async postNoEntryCalcPrice({commit}, payload) {
commit(Types.POST_NOENTRY_CALCPRICE_REQUEST);
const result = await this.$api.get('/api/ufo/notEntrySeller/computeChangePrice', payload);
if (result && result.code === 200) {
commit(Types.POST_NOENTRY_CALCPRICE_SUCCESS, {
order: result.data
});
} else {
commit(Types.POST_NOENTRY_CALCPRICE_FAILED);
}
return result || {};
},
/**
* 调价
* @param commit
* @param payload
* @returns {Promise<*|{}>}
*/
async postChangePrice({commit}, payload) {
commit(Types.POST_CHANGE_PRICE_REQUEST);
const result = await this.$api.get('/api/ufo/sellerOrder/batchAdjustPrice', payload);
if (result && result.code === 200) {
commit(Types.POST_CHANGEPRICE_SUCCESS, {
order: result.data
});
} else {
commit(Types.POST_CHANGEPRICE_FAILED);
}
return result || {};
},
/**
* 未入驻商家调价
* @param commit
* @param payload
* @returns {Promise<*|{}>}
*/
async postNoEntryChangePrice({commit}, payload) {
commit(Types.POST_NOENTRY_CHANGE_PRICE_REQUEST);
const result = await this.$api.get('/api/ufo/notEntrySeller/changePrice', payload);
if (result && result.code === 200) {
commit(Types.POST_NOENTRY_CHANGE_PRICE_SUCCESS, {
order: result.data
});
} else {
commit(Types.POST_NOENTRY_CHANGE_PRICE_FAILED);
}
return result || {};
}
};