@fonixtree/magic-design 2.0.33 → 2.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/assets/fonts/.DS_Store +0 -0
- package/es/common/AffiliateProductModal/index.js +582 -0
- package/es/common/AffiliateProductModal/index.less +146 -0
- package/es/common/ProductModal/index.js +1 -2
- package/es/common/ProductSource/index.js +42 -10
- package/es/composite-comp/common/components/AffiliateProductItem/imgs/icon-Balance2.svg +9 -0
- package/es/composite-comp/common/components/AffiliateProductItem/imgs/icon-Koin.svg +40 -0
- package/es/composite-comp/common/components/AffiliateProductItem/index.js +175 -0
- package/es/composite-comp/common/components/AffiliateProductItem/index.less +107 -0
- package/es/composite-comp/dito/components/AffiliateRecommend/defaultJSON.js +243 -0
- package/es/composite-comp/dito/components/AffiliateRecommend/index.js +90 -0
- package/es/composite-comp/dito/components/AffiliateRecommend/mobile/index.js +656 -0
- package/es/composite-comp/dito/components/AffiliateRecommend/mobile/index.less +76 -0
- package/es/composite-comp/dito/components/AffiliateRecommend/pc/index.js +725 -0
- package/es/composite-comp/dito/components/AffiliateRecommend/pc/index.less +124 -0
- package/es/composite-comp/dito/config-panels/AffiliateRecommendConfig/RecommendConfigContent/index.js +102 -0
- package/es/composite-comp/dito/config-panels/AffiliateRecommendConfig/RecommendConfigContent/index.less +0 -0
- package/es/composite-comp/dito/config-panels/AffiliateRecommendConfig/RecommendConfigGroup/index.js +145 -0
- package/es/composite-comp/dito/config-panels/AffiliateRecommendConfig/RecommendConfigGroup/index.less +16 -0
- package/es/composite-comp/dito/config-panels/AffiliateRecommendConfig/imgs/defaultImg.png +0 -0
- package/es/composite-comp/dito/config-panels/AffiliateRecommendConfig/index.js +141 -0
- package/es/composite-comp/dito/config-panels/RecommendConfig/RecommendConfigGroup/index.js +10 -9
- package/es/composite-comp/dito/second-config-panels/AffiliateRecommendSecondConfig/AIRecommendation/index.js +431 -0
- package/es/composite-comp/dito/second-config-panels/AffiliateRecommendSecondConfig/index.js +214 -0
- package/es/composite-comp/dito/second-config-panels/AffiliateRecommendSecondConfig/index.less +15 -0
- package/es/constants/component-types.js +9 -3
- package/es/constants/index.js +4 -0
- package/es/core/Designer/ConfigPanel/index.js +7 -2
- package/es/core/Renderer/index.js +18 -11
- package/es/meta-comp/components/Text/index.js +16 -0
- package/es/utils/businessUtil.js +6 -1
- package/lib/assets/fonts/.DS_Store +0 -0
- package/lib/common/AffiliateProductModal/index.js +582 -0
- package/lib/common/AffiliateProductModal/index.less +146 -0
- package/lib/common/ProductModal/index.js +1 -2
- package/lib/common/ProductSource/index.js +42 -10
- package/lib/composite-comp/common/components/AffiliateProductItem/imgs/icon-Balance2.svg +9 -0
- package/lib/composite-comp/common/components/AffiliateProductItem/imgs/icon-Koin.svg +40 -0
- package/lib/composite-comp/common/components/AffiliateProductItem/index.js +175 -0
- package/lib/composite-comp/common/components/AffiliateProductItem/index.less +107 -0
- package/lib/composite-comp/dito/components/AffiliateRecommend/defaultJSON.js +243 -0
- package/lib/composite-comp/dito/components/AffiliateRecommend/index.js +90 -0
- package/lib/composite-comp/dito/components/AffiliateRecommend/mobile/index.js +656 -0
- package/lib/composite-comp/dito/components/AffiliateRecommend/mobile/index.less +76 -0
- package/lib/composite-comp/dito/components/AffiliateRecommend/pc/index.js +725 -0
- package/lib/composite-comp/dito/components/AffiliateRecommend/pc/index.less +124 -0
- package/lib/composite-comp/dito/config-panels/AffiliateRecommendConfig/RecommendConfigContent/index.js +102 -0
- package/lib/composite-comp/dito/config-panels/AffiliateRecommendConfig/RecommendConfigContent/index.less +0 -0
- package/lib/composite-comp/dito/config-panels/AffiliateRecommendConfig/RecommendConfigGroup/index.js +145 -0
- package/lib/composite-comp/dito/config-panels/AffiliateRecommendConfig/RecommendConfigGroup/index.less +16 -0
- package/lib/composite-comp/dito/config-panels/AffiliateRecommendConfig/imgs/defaultImg.png +0 -0
- package/lib/composite-comp/dito/config-panels/AffiliateRecommendConfig/index.js +141 -0
- package/lib/composite-comp/dito/config-panels/RecommendConfig/RecommendConfigGroup/index.js +10 -9
- package/lib/composite-comp/dito/second-config-panels/AffiliateRecommendSecondConfig/AIRecommendation/index.js +431 -0
- package/lib/composite-comp/dito/second-config-panels/AffiliateRecommendSecondConfig/index.js +214 -0
- package/lib/composite-comp/dito/second-config-panels/AffiliateRecommendSecondConfig/index.less +15 -0
- package/lib/constants/component-types.js +9 -3
- package/lib/constants/index.js +4 -0
- package/lib/core/Designer/ConfigPanel/index.js +7 -2
- package/lib/core/Renderer/index.js +18 -11
- package/lib/meta-comp/components/Text/index.js +16 -0
- package/lib/utils/businessUtil.js +6 -1
- package/package.json +1 -1
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _antd = require("antd");
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _commonUtil = require("../../utils/commonUtil");
|
|
15
|
+
|
|
16
|
+
var _Iconfont = _interopRequireDefault(require("../Iconfont"));
|
|
17
|
+
|
|
18
|
+
var _currencyUtil = require("../../utils/currencyUtil");
|
|
19
|
+
|
|
20
|
+
require("./index.less");
|
|
21
|
+
|
|
22
|
+
var _locale = require("../../locale");
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
30
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
31
|
+
__assign = Object.assign || function (t) {
|
|
32
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
33
|
+
s = arguments[i];
|
|
34
|
+
|
|
35
|
+
for (var p in s) {
|
|
36
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return t;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return __assign.apply(this, arguments);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
47
|
+
function adopt(value) {
|
|
48
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
49
|
+
resolve(value);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
54
|
+
function fulfilled(value) {
|
|
55
|
+
try {
|
|
56
|
+
step(generator.next(value));
|
|
57
|
+
} catch (e) {
|
|
58
|
+
reject(e);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function rejected(value) {
|
|
63
|
+
try {
|
|
64
|
+
step(generator["throw"](value));
|
|
65
|
+
} catch (e) {
|
|
66
|
+
reject(e);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function step(result) {
|
|
71
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
79
|
+
var _ = {
|
|
80
|
+
label: 0,
|
|
81
|
+
sent: function sent() {
|
|
82
|
+
if (t[0] & 1) throw t[1];
|
|
83
|
+
return t[1];
|
|
84
|
+
},
|
|
85
|
+
trys: [],
|
|
86
|
+
ops: []
|
|
87
|
+
},
|
|
88
|
+
f,
|
|
89
|
+
y,
|
|
90
|
+
t,
|
|
91
|
+
g;
|
|
92
|
+
return g = {
|
|
93
|
+
next: verb(0),
|
|
94
|
+
"throw": verb(1),
|
|
95
|
+
"return": verb(2)
|
|
96
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
97
|
+
return this;
|
|
98
|
+
}), g;
|
|
99
|
+
|
|
100
|
+
function verb(n) {
|
|
101
|
+
return function (v) {
|
|
102
|
+
return step([n, v]);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function step(op) {
|
|
107
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
108
|
+
|
|
109
|
+
while (_) {
|
|
110
|
+
try {
|
|
111
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
112
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
113
|
+
|
|
114
|
+
switch (op[0]) {
|
|
115
|
+
case 0:
|
|
116
|
+
case 1:
|
|
117
|
+
t = op;
|
|
118
|
+
break;
|
|
119
|
+
|
|
120
|
+
case 4:
|
|
121
|
+
_.label++;
|
|
122
|
+
return {
|
|
123
|
+
value: op[1],
|
|
124
|
+
done: false
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
case 5:
|
|
128
|
+
_.label++;
|
|
129
|
+
y = op[1];
|
|
130
|
+
op = [0];
|
|
131
|
+
continue;
|
|
132
|
+
|
|
133
|
+
case 7:
|
|
134
|
+
op = _.ops.pop();
|
|
135
|
+
|
|
136
|
+
_.trys.pop();
|
|
137
|
+
|
|
138
|
+
continue;
|
|
139
|
+
|
|
140
|
+
default:
|
|
141
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
142
|
+
_ = 0;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
147
|
+
_.label = op[1];
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
152
|
+
_.label = t[1];
|
|
153
|
+
t = op;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (t && _.label < t[2]) {
|
|
158
|
+
_.label = t[2];
|
|
159
|
+
|
|
160
|
+
_.ops.push(op);
|
|
161
|
+
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (t[2]) _.ops.pop();
|
|
166
|
+
|
|
167
|
+
_.trys.pop();
|
|
168
|
+
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
op = body.call(thisArg, _);
|
|
173
|
+
} catch (e) {
|
|
174
|
+
op = [6, e];
|
|
175
|
+
y = 0;
|
|
176
|
+
} finally {
|
|
177
|
+
f = t = 0;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (op[0] & 5) throw op[1];
|
|
182
|
+
return {
|
|
183
|
+
value: op[0] ? op[1] : void 0,
|
|
184
|
+
done: true
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
var __spreadArrays = void 0 && (void 0).__spreadArrays || function () {
|
|
190
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
|
|
191
|
+
s += arguments[i].length;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++) {
|
|
195
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
|
|
196
|
+
r[k] = a[j];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return r;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
var formatData = function formatData(list) {
|
|
204
|
+
list.map(function (item) {
|
|
205
|
+
item.preSalesPrice = (0, _currencyUtil.formatCurrencyWithSymbol)(item.salesPrice);
|
|
206
|
+
item.preMarketPrice = (0, _currencyUtil.formatCurrencyWithSymbol)(item.marketPrice);
|
|
207
|
+
});
|
|
208
|
+
return list;
|
|
209
|
+
}; // const promType = {
|
|
210
|
+
// FLASH_SALE: '2',
|
|
211
|
+
// GROUP_BUY: '4',
|
|
212
|
+
// };
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
var Option = _antd.Select.Option; // const InputGroup = Input.Group;
|
|
216
|
+
|
|
217
|
+
var AffiliateProductModal = function AffiliateProductModal(props) {
|
|
218
|
+
var handleModalSave = props.handleModalSave,
|
|
219
|
+
closeModal = props.closeModal,
|
|
220
|
+
visible = props.visible,
|
|
221
|
+
_a = props.defaultList,
|
|
222
|
+
defaultList = _a === void 0 ? [] : _a,
|
|
223
|
+
_b = props.maxSelect,
|
|
224
|
+
maxSelect = _b === void 0 ? 20 : _b;
|
|
225
|
+
|
|
226
|
+
var _c = (0, _react.useState)(defaultList),
|
|
227
|
+
selectedList = _c[0],
|
|
228
|
+
setSelectedList = _c[1];
|
|
229
|
+
|
|
230
|
+
var _d = (0, _react.useState)([]),
|
|
231
|
+
catgsList = _d[0],
|
|
232
|
+
setCatgsList = _d[1]; // const [brandsList, setBrandsList] = useState([]);
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
var _e = (0, _react.useState)([]),
|
|
236
|
+
selCatgsList = _e[0],
|
|
237
|
+
setSelCatgsList = _e[1];
|
|
238
|
+
|
|
239
|
+
var _f = (0, _react.useState)(''),
|
|
240
|
+
productName = _f[0],
|
|
241
|
+
setProductName = _f[1];
|
|
242
|
+
|
|
243
|
+
var _g = (0, _react.useState)(''),
|
|
244
|
+
affiliateProductCode = _g[0],
|
|
245
|
+
setProductCode = _g[1]; // const [minPrice, setMinPrice] = useState('');
|
|
246
|
+
// const [maxPrice, setMaxPrice] = useState('');
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
var _h = (0, _react.useState)([]),
|
|
250
|
+
goodsList = _h[0],
|
|
251
|
+
setGoodsList = _h[1];
|
|
252
|
+
|
|
253
|
+
var _j = (0, _react.useState)(false),
|
|
254
|
+
loading = _j[0],
|
|
255
|
+
setLoading = _j[1];
|
|
256
|
+
|
|
257
|
+
var _k = (0, _react.useState)(defaultList.map(function (v) {
|
|
258
|
+
return v.affiliateProductId;
|
|
259
|
+
})),
|
|
260
|
+
selectedRowKeys = _k[0],
|
|
261
|
+
setSelectedRowKeys = _k[1];
|
|
262
|
+
|
|
263
|
+
var rowSelection = {
|
|
264
|
+
selectedRowKeys: selectedRowKeys,
|
|
265
|
+
onSelect: function onSelect(record, selected, selectedRows) {
|
|
266
|
+
if (selected) {
|
|
267
|
+
if (selectedList.length === maxSelect) {
|
|
268
|
+
_antd.message.warning("Max " + maxSelect);
|
|
269
|
+
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (selectedList.length < maxSelect) {
|
|
274
|
+
setSelectedList(__spreadArrays(selectedList, formatData([record])));
|
|
275
|
+
}
|
|
276
|
+
} else {
|
|
277
|
+
setSelectedList(selectedList.filter(function (v) {
|
|
278
|
+
return v.affiliateProductId !== record.affiliateProductId;
|
|
279
|
+
}));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
setSelectedRowKeys(selectedRows.map(function (v) {
|
|
283
|
+
return v === null || v === void 0 ? void 0 : v.affiliateProductId;
|
|
284
|
+
}));
|
|
285
|
+
},
|
|
286
|
+
getCheckboxProps: function getCheckboxProps(record) {
|
|
287
|
+
return {
|
|
288
|
+
productName: record.productName
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
var _l = (0, _react.useState)({
|
|
294
|
+
pageSize: 20,
|
|
295
|
+
current: 1,
|
|
296
|
+
total: 0
|
|
297
|
+
}),
|
|
298
|
+
paginationParams = _l[0],
|
|
299
|
+
setPaginationParams = _l[1];
|
|
300
|
+
|
|
301
|
+
var delSelectedItem = function delSelectedItem(index) {
|
|
302
|
+
console.log(selectedRowKeys, index, 2223);
|
|
303
|
+
var rowKeys = JSON.parse(JSON.stringify(selectedRowKeys));
|
|
304
|
+
rowKeys.splice(index, 1);
|
|
305
|
+
setSelectedRowKeys(rowKeys);
|
|
306
|
+
var rows = JSON.parse(JSON.stringify(selectedList));
|
|
307
|
+
rows.splice(index, 1);
|
|
308
|
+
setSelectedList(rows);
|
|
309
|
+
}; // 请求商品列表
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
var queryGoods = function queryGoods(data) {
|
|
313
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
314
|
+
var url, res;
|
|
315
|
+
return __generator(this, function (_a) {
|
|
316
|
+
switch (_a.label) {
|
|
317
|
+
case 0:
|
|
318
|
+
url = "/designer/v1/" + window.magicDesign.MBaseUrl + "/distributor/product/list";
|
|
319
|
+
data.state = 'Valid';
|
|
320
|
+
return [4
|
|
321
|
+
/*yield*/
|
|
322
|
+
, (0, _commonUtil.commonFetch)(url, data, 'GET')];
|
|
323
|
+
|
|
324
|
+
case 1:
|
|
325
|
+
res = _a.sent();
|
|
326
|
+
setLoading(false);
|
|
327
|
+
paginationParams.total = res.total;
|
|
328
|
+
setPaginationParams(paginationParams);
|
|
329
|
+
setGoodsList(res.list || []);
|
|
330
|
+
return [2
|
|
331
|
+
/*return*/
|
|
332
|
+
];
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
}; // 请求类目
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
var queryOfferCatgs = function queryOfferCatgs() {
|
|
340
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
341
|
+
var url, res;
|
|
342
|
+
return __generator(this, function (_a) {
|
|
343
|
+
switch (_a.label) {
|
|
344
|
+
case 0:
|
|
345
|
+
url = "/designer/v1/" + window.magicDesign.MBaseUrl + "/distributor/catg/list";
|
|
346
|
+
return [4
|
|
347
|
+
/*yield*/
|
|
348
|
+
, (0, _commonUtil.commonFetch)(url, {
|
|
349
|
+
state: 'Valid'
|
|
350
|
+
}, 'GET')];
|
|
351
|
+
|
|
352
|
+
case 1:
|
|
353
|
+
res = _a.sent(); // const tree = listToTree(res, 'affiliateCatgId');
|
|
354
|
+
|
|
355
|
+
console.log('---d', res);
|
|
356
|
+
setCatgsList(res);
|
|
357
|
+
return [2
|
|
358
|
+
/*return*/
|
|
359
|
+
];
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
}; // 请求品牌
|
|
364
|
+
// const queryBrands = async () => {
|
|
365
|
+
// const url = `/designer/v1/${window.magicDesign.MBaseUrl}/distributor/brand/list`;
|
|
366
|
+
// let res = await commonFetch(url, { state: 'Valid' }, 'GET');
|
|
367
|
+
// setBrandsList(res);
|
|
368
|
+
// };
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
(0, _react.useEffect)(function () {
|
|
372
|
+
queryOfferCatgs(); // queryBrands();
|
|
373
|
+
}, []);
|
|
374
|
+
(0, _react.useEffect)(function () {
|
|
375
|
+
// console.log('---defaultList', defaultList);
|
|
376
|
+
setSelectedList(defaultList);
|
|
377
|
+
setSelectedRowKeys(defaultList.map(function (v) {
|
|
378
|
+
return v.affiliateProductId;
|
|
379
|
+
}));
|
|
380
|
+
}, [visible]);
|
|
381
|
+
|
|
382
|
+
var reset = function reset() {
|
|
383
|
+
setSelCatgsList([]);
|
|
384
|
+
setProductName('');
|
|
385
|
+
setProductCode('');
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
var columns = [{
|
|
389
|
+
title: (0, _locale.i18n)('IMAGE'),
|
|
390
|
+
dataIndex: 'imgUrls',
|
|
391
|
+
render: function render(imgUrls) {
|
|
392
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
393
|
+
className: "prodImg",
|
|
394
|
+
style: {
|
|
395
|
+
backgroundImage: "url(" + ((imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.length) > 0 ? imgUrls[0] : null) + ")"
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
},
|
|
399
|
+
width: 60
|
|
400
|
+
}, {
|
|
401
|
+
title: (0, _locale.i18n)('PRODUCT_NAME'),
|
|
402
|
+
dataIndex: 'productName',
|
|
403
|
+
width: 120,
|
|
404
|
+
ellipsis: true
|
|
405
|
+
}, {
|
|
406
|
+
title: (0, _locale.i18n)('PRODUCT_CODE'),
|
|
407
|
+
dataIndex: 'affiliateProductCode',
|
|
408
|
+
width: 120,
|
|
409
|
+
ellipsis: true
|
|
410
|
+
}, {
|
|
411
|
+
title: (0, _locale.i18n)('PRICE'),
|
|
412
|
+
dataIndex: 'productPrice',
|
|
413
|
+
width: 100,
|
|
414
|
+
ellipsis: true,
|
|
415
|
+
render: function render(text, record) {
|
|
416
|
+
return /*#__PURE__*/_react["default"].createElement("span", null, (0, _currencyUtil.formatCurrencyWithSymbol)(record.productPrice));
|
|
417
|
+
}
|
|
418
|
+
}, {
|
|
419
|
+
title: (0, _locale.i18n)('BRAND'),
|
|
420
|
+
dataIndex: 'affiliateBrandName',
|
|
421
|
+
width: 100,
|
|
422
|
+
ellipsis: true
|
|
423
|
+
}];
|
|
424
|
+
return /*#__PURE__*/_react["default"].createElement(_antd.Modal, {
|
|
425
|
+
cancelText: (0, _locale.i18n)('CANCEL'),
|
|
426
|
+
draggable: false,
|
|
427
|
+
footer: null,
|
|
428
|
+
okText: "OK",
|
|
429
|
+
onCancel: closeModal,
|
|
430
|
+
onOk: handleModalSave,
|
|
431
|
+
title: (0, _locale.i18n)('PRODUCT_SELECT'),
|
|
432
|
+
visible: visible,
|
|
433
|
+
width: "1200px",
|
|
434
|
+
wrapClassName: "modalCot"
|
|
435
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
436
|
+
className: "proModalWrap"
|
|
437
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
438
|
+
className: "content"
|
|
439
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
440
|
+
className: "leftCot"
|
|
441
|
+
}, /*#__PURE__*/_react["default"].createElement(_antd.Form, {
|
|
442
|
+
layout: "vertical"
|
|
443
|
+
}, /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, {
|
|
444
|
+
label: "Category"
|
|
445
|
+
}, /*#__PURE__*/_react["default"].createElement(_antd.Select // defaultValue={data[0].id}
|
|
446
|
+
, {
|
|
447
|
+
onChange: function onChange(value) {
|
|
448
|
+
setSelCatgsList(value);
|
|
449
|
+
},
|
|
450
|
+
placeholder: "Please select",
|
|
451
|
+
style: {
|
|
452
|
+
width: 241
|
|
453
|
+
}
|
|
454
|
+
}, catgsList.map(function (item) {
|
|
455
|
+
return /*#__PURE__*/_react["default"].createElement(Option, {
|
|
456
|
+
key: item.affiliateCatgId,
|
|
457
|
+
value: item.affiliateCatgId
|
|
458
|
+
}, item.catgName);
|
|
459
|
+
}))), /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, {
|
|
460
|
+
label: "Product Name"
|
|
461
|
+
}, /*#__PURE__*/_react["default"].createElement(_antd.Input, {
|
|
462
|
+
onChange: function onChange(e) {
|
|
463
|
+
setProductName(e.target.value);
|
|
464
|
+
},
|
|
465
|
+
placeholder: (0, _locale.i18n)('PLEASE_INPUT'),
|
|
466
|
+
size: "small",
|
|
467
|
+
value: productName
|
|
468
|
+
})), /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, {
|
|
469
|
+
label: "SKU Code"
|
|
470
|
+
}, /*#__PURE__*/_react["default"].createElement(_antd.Input, {
|
|
471
|
+
className: "inputStyle",
|
|
472
|
+
onChange: function onChange(e) {
|
|
473
|
+
setProductCode(e.target.value);
|
|
474
|
+
},
|
|
475
|
+
placeholder: (0, _locale.i18n)('PLEASE_INPUT'),
|
|
476
|
+
size: "small",
|
|
477
|
+
value: affiliateProductCode
|
|
478
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
479
|
+
className: "buttonStyle"
|
|
480
|
+
}, /*#__PURE__*/_react["default"].createElement(_antd.Button, {
|
|
481
|
+
onClick: function onClick() {
|
|
482
|
+
reset();
|
|
483
|
+
},
|
|
484
|
+
size: "small"
|
|
485
|
+
}, (0, _locale.i18n)('RESET')), /*#__PURE__*/_react["default"].createElement(_antd.Button, {
|
|
486
|
+
onClick: function onClick() {
|
|
487
|
+
setLoading(true);
|
|
488
|
+
paginationParams.current = 1;
|
|
489
|
+
queryGoods({
|
|
490
|
+
productName: productName,
|
|
491
|
+
affiliateProductCode: affiliateProductCode,
|
|
492
|
+
CatgId: selCatgsList,
|
|
493
|
+
pageSize: paginationParams.pageSize,
|
|
494
|
+
pageIndex: paginationParams.current,
|
|
495
|
+
state: 'Valid'
|
|
496
|
+
});
|
|
497
|
+
},
|
|
498
|
+
size: "small",
|
|
499
|
+
style: {
|
|
500
|
+
marginRight: 8
|
|
501
|
+
},
|
|
502
|
+
type: "primary"
|
|
503
|
+
}, (0, _locale.i18n)('QUERY'))))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
504
|
+
className: "rightCot"
|
|
505
|
+
}, /*#__PURE__*/_react["default"].createElement(_antd.Table, {
|
|
506
|
+
columns: columns,
|
|
507
|
+
dataSource: goodsList,
|
|
508
|
+
loading: loading,
|
|
509
|
+
pagination: __assign(__assign({}, paginationParams), {
|
|
510
|
+
onChange: function onChange(page) {
|
|
511
|
+
setLoading(true);
|
|
512
|
+
paginationParams.current = page;
|
|
513
|
+
setPaginationParams(paginationParams);
|
|
514
|
+
queryGoods({
|
|
515
|
+
productName: productName,
|
|
516
|
+
affiliateProductCode: affiliateProductCode,
|
|
517
|
+
// minPrice: formatBackendCurrency(minPrice),
|
|
518
|
+
// maxPrice: formatBackendCurrency(maxPrice),
|
|
519
|
+
CatgId: selCatgsList,
|
|
520
|
+
pageSize: paginationParams.pageSize,
|
|
521
|
+
pageIndex: paginationParams.current,
|
|
522
|
+
state: 'Valid'
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
}),
|
|
526
|
+
rowKey: "affiliateProductId",
|
|
527
|
+
rowSelection: rowSelection,
|
|
528
|
+
scroll: {
|
|
529
|
+
y: 500
|
|
530
|
+
}
|
|
531
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
532
|
+
className: "selectedCot"
|
|
533
|
+
}, selectedList.map(function (item, index) {
|
|
534
|
+
var _a;
|
|
535
|
+
|
|
536
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
537
|
+
key: index,
|
|
538
|
+
className: "selectedItem"
|
|
539
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
540
|
+
alt: "",
|
|
541
|
+
className: "selectedItemImg",
|
|
542
|
+
src: ((_a = item === null || item === void 0 ? void 0 : item.imgUrls) === null || _a === void 0 ? void 0 : _a.length) > 0 ? item.imgUrls[0] : null,
|
|
543
|
+
title: item.productName
|
|
544
|
+
}), /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
|
|
545
|
+
className: "selectedItemClose",
|
|
546
|
+
color: "#000",
|
|
547
|
+
onClick: function onClick() {
|
|
548
|
+
return delSelectedItem(index);
|
|
549
|
+
},
|
|
550
|
+
size: 12,
|
|
551
|
+
type: "icon-close"
|
|
552
|
+
}));
|
|
553
|
+
})))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
554
|
+
className: "footer"
|
|
555
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
556
|
+
className: "total"
|
|
557
|
+
}, (0, _locale.i18n)('SELECTED'), ' ', /*#__PURE__*/_react["default"].createElement("span", {
|
|
558
|
+
className: "totalNum"
|
|
559
|
+
}, selectedList.length, "/", maxSelect)), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_antd.Button, {
|
|
560
|
+
onClick: function onClick() {
|
|
561
|
+
// console.log('---ok s', selectedList);
|
|
562
|
+
if (handleModalSave) {
|
|
563
|
+
handleModalSave(selectedList);
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
if (closeModal) {
|
|
567
|
+
closeModal();
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
style: {
|
|
571
|
+
marginRight: 10
|
|
572
|
+
},
|
|
573
|
+
type: "primary"
|
|
574
|
+
}, (0, _locale.i18n)('OK')), /*#__PURE__*/_react["default"].createElement(_antd.Button, {
|
|
575
|
+
onClick: function onClick() {
|
|
576
|
+
return closeModal && closeModal();
|
|
577
|
+
}
|
|
578
|
+
}, (0, _locale.i18n)('CANCEL'))))));
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
var _default = AffiliateProductModal;
|
|
582
|
+
exports["default"] = _default;
|