@fle-ui/plus-choose-goods 0.0.1
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/LICENSE +1 -0
- package/README.md +17 -0
- package/es/components/icon/index.d.ts +3 -0
- package/es/components/icon/index.js +7 -0
- package/es/index.d.ts +27 -0
- package/es/index.js +532 -0
- package/es/index.less +76 -0
- package/es/utils/api.d.ts +6 -0
- package/es/utils/api.js +5 -0
- package/es/utils/common.d.ts +11 -0
- package/es/utils/common.js +9 -0
- package/es/utils/options.d.ts +25 -0
- package/es/utils/options.js +92 -0
- package/es/utils/request.d.ts +19 -0
- package/es/utils/request.js +106 -0
- package/es/utils/serviceEnv.d.ts +6 -0
- package/es/utils/serviceEnv.js +12 -0
- package/lib/components/icon/index.d.ts +3 -0
- package/lib/components/icon/index.js +13 -0
- package/lib/index.d.ts +27 -0
- package/lib/index.js +526 -0
- package/lib/index.less +76 -0
- package/lib/utils/api.d.ts +6 -0
- package/lib/utils/api.js +11 -0
- package/lib/utils/common.d.ts +11 -0
- package/lib/utils/common.js +15 -0
- package/lib/utils/options.d.ts +25 -0
- package/lib/utils/options.js +98 -0
- package/lib/utils/request.d.ts +19 -0
- package/lib/utils/request.js +112 -0
- package/lib/utils/serviceEnv.d.ts +6 -0
- package/lib/utils/serviceEnv.js +18 -0
- package/package.json +49 -0
package/es/index.less
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
@primar-color: #2c68ff;
|
|
2
|
+
|
|
3
|
+
.choose-goods-modal {
|
|
4
|
+
.fle-modal-body {
|
|
5
|
+
padding: 0 !important;
|
|
6
|
+
}
|
|
7
|
+
.fle-radio-button-wrapper {
|
|
8
|
+
padding-inline: 12px;
|
|
9
|
+
}
|
|
10
|
+
.fle-pro-query-filter-actions {
|
|
11
|
+
.fle-space-item:first-child > div {
|
|
12
|
+
flex-direction: row-reverse;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
.table-goods-wrap {
|
|
16
|
+
display: flex;
|
|
17
|
+
|
|
18
|
+
.table-goods-img-wrap {
|
|
19
|
+
width: 60px;
|
|
20
|
+
height: 60px;
|
|
21
|
+
background: #f2f2f2;
|
|
22
|
+
border-radius: 1px;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
.pro-image {
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
object-fit: cover;
|
|
31
|
+
.fle-image {
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.table-goods-content {
|
|
39
|
+
margin-left: 10px;
|
|
40
|
+
flex: 1;
|
|
41
|
+
|
|
42
|
+
.table-goods-content-title {
|
|
43
|
+
height: 34px;
|
|
44
|
+
font-size: 12px;
|
|
45
|
+
font-weight: 500;
|
|
46
|
+
color: #666666;
|
|
47
|
+
line-height: 17px;
|
|
48
|
+
text-align: left;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.table-goods-content-sub-title {
|
|
52
|
+
text-align: left;
|
|
53
|
+
height: 17px;
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
font-weight: 400;
|
|
56
|
+
color: #666666;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
text-overflow: ellipsis;
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
margin-top: 9px;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.sort-item {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
.sort-item-label {
|
|
69
|
+
font-size: 12px;
|
|
70
|
+
}
|
|
71
|
+
.sort-item-icon {
|
|
72
|
+
font-size: 10px;
|
|
73
|
+
margin-left: 4px;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
package/es/utils/api.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 金额格式化
|
|
3
|
+
* @param data
|
|
4
|
+
*/
|
|
5
|
+
type moneyType = number | string;
|
|
6
|
+
interface ShowMoneyType {
|
|
7
|
+
(data: moneyType): string;
|
|
8
|
+
}
|
|
9
|
+
export declare const showMoney: ShowMoneyType;
|
|
10
|
+
export declare const formartNum: (data: moneyType, len?: number) => number | '';
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var showMoney = function showMoney(data) {
|
|
2
|
+
return (+data / 100).toFixed(2);
|
|
3
|
+
};
|
|
4
|
+
export var formartNum = function formartNum(data) {
|
|
5
|
+
var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
6
|
+
return (data === null || data === void 0 ? void 0 : data.toString()) ? +data * +Array(Math.min(9, len + 1)).fill('0').reduce(function (str, num) {
|
|
7
|
+
return str + num;
|
|
8
|
+
}, 1) / 10 : '';
|
|
9
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const tabs: {
|
|
2
|
+
label: string;
|
|
3
|
+
key: string;
|
|
4
|
+
}[];
|
|
5
|
+
export declare const tabsSearchParamsMap: any;
|
|
6
|
+
export declare const priceRangeForOnce: {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[];
|
|
10
|
+
export declare const priceRangeForPurchase: {
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}[];
|
|
14
|
+
export declare const profitRangeForOnce: {
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
}[];
|
|
18
|
+
export declare const profitRangeForPurchase: {
|
|
19
|
+
label: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}[];
|
|
22
|
+
export declare const sortOptions: {
|
|
23
|
+
label: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}[];
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export var tabs = [{
|
|
2
|
+
label: '京东商品',
|
|
3
|
+
key: 'jd'
|
|
4
|
+
}, {
|
|
5
|
+
label: '精选商品',
|
|
6
|
+
key: 'jx'
|
|
7
|
+
}, {
|
|
8
|
+
label: '自有商品',
|
|
9
|
+
key: 'zy'
|
|
10
|
+
}, {
|
|
11
|
+
label: '鲜花蛋糕',
|
|
12
|
+
key: 'xhdg'
|
|
13
|
+
}, {
|
|
14
|
+
label: '猫超商品',
|
|
15
|
+
key: 'mc'
|
|
16
|
+
}];
|
|
17
|
+
export var tabsSearchParamsMap = {
|
|
18
|
+
jd: {
|
|
19
|
+
thirdType: 10,
|
|
20
|
+
isSelf: 0
|
|
21
|
+
},
|
|
22
|
+
jx: {
|
|
23
|
+
thirdType: 0,
|
|
24
|
+
isSelf: 0
|
|
25
|
+
},
|
|
26
|
+
zy: {
|
|
27
|
+
isSelf: 1
|
|
28
|
+
},
|
|
29
|
+
xhdg: {
|
|
30
|
+
thirdType: 40,
|
|
31
|
+
isSelf: 0
|
|
32
|
+
},
|
|
33
|
+
mc: {
|
|
34
|
+
thirdType: 50,
|
|
35
|
+
isSelf: 0
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
// 一件代发价格筛选配置 - 非营销云
|
|
39
|
+
export var priceRangeForOnce = [{
|
|
40
|
+
label: '市场价',
|
|
41
|
+
value: 'onceMarketPrice'
|
|
42
|
+
}, {
|
|
43
|
+
label: '代发价',
|
|
44
|
+
value: 'onceSalePrice'
|
|
45
|
+
}, {
|
|
46
|
+
label: '销售价',
|
|
47
|
+
value: 'onceSitePrice'
|
|
48
|
+
}];
|
|
49
|
+
// 集采价格筛选配置 - 营销云
|
|
50
|
+
export var priceRangeForPurchase = [{
|
|
51
|
+
label: '集采市场价',
|
|
52
|
+
value: 'purchaseMarketPrice'
|
|
53
|
+
}, {
|
|
54
|
+
label: '代发市场价',
|
|
55
|
+
value: 'onceMarketPrice'
|
|
56
|
+
}, {
|
|
57
|
+
label: '集采销售价',
|
|
58
|
+
value: 'purchaseSalePrice'
|
|
59
|
+
}, {
|
|
60
|
+
label: '代发销售价',
|
|
61
|
+
value: 'onceSalePrice'
|
|
62
|
+
}, {
|
|
63
|
+
label: '集采分销价',
|
|
64
|
+
value: 'purchaseSitePrice'
|
|
65
|
+
}, {
|
|
66
|
+
label: '代发分销价',
|
|
67
|
+
value: 'onceSitePrice'
|
|
68
|
+
}];
|
|
69
|
+
// 一件代发利润率筛选配置 - 非营销云
|
|
70
|
+
export var profitRangeForOnce = [{
|
|
71
|
+
label: '利润率',
|
|
72
|
+
value: 'onceSiteProfit'
|
|
73
|
+
}];
|
|
74
|
+
// 集采利润率筛选配置 - 营销云
|
|
75
|
+
export var profitRangeForPurchase = [{
|
|
76
|
+
label: '集采利润率',
|
|
77
|
+
value: 'purchaseSiteProfit'
|
|
78
|
+
}, {
|
|
79
|
+
label: '代发利润率',
|
|
80
|
+
value: 'onceSiteProfit'
|
|
81
|
+
}];
|
|
82
|
+
// 排序规则
|
|
83
|
+
export var sortOptions = [{
|
|
84
|
+
label: '推荐',
|
|
85
|
+
value: 'goods_modify_time'
|
|
86
|
+
}, {
|
|
87
|
+
label: '销售价',
|
|
88
|
+
value: 'search_sale_price_max'
|
|
89
|
+
}, {
|
|
90
|
+
label: '创建时间',
|
|
91
|
+
value: 'goods_create_time'
|
|
92
|
+
}];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
2
|
+
export interface RequestInterceptors<T> {
|
|
3
|
+
requestInterceptors?: (config: AxiosRequestConfig) => AxiosRequestConfig;
|
|
4
|
+
requestInterceptorsCatch?: (err: any) => any;
|
|
5
|
+
responseInterceptors?: (config: T) => T;
|
|
6
|
+
responseInterceptorsCatch?: (err: any) => any;
|
|
7
|
+
}
|
|
8
|
+
export interface RequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
|
|
9
|
+
interceptors?: RequestInterceptors<T>;
|
|
10
|
+
}
|
|
11
|
+
interface AxiosConfig extends AxiosRequestConfig {
|
|
12
|
+
tokenKey?: string;
|
|
13
|
+
token?: string;
|
|
14
|
+
loginErrFn?: Function;
|
|
15
|
+
errUrlFn?: Function;
|
|
16
|
+
formDataUrls?: Array<string>;
|
|
17
|
+
}
|
|
18
|
+
declare function Request(configParams: AxiosConfig): import("axios").AxiosInstance;
|
|
19
|
+
export default Request;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import "antd/es/notification/style";
|
|
2
|
+
import _notification from "antd/es/notification";
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
import Cookies from 'js-cookie';
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
// 默认配置
|
|
12
|
+
var initAxiosConfig = {
|
|
13
|
+
baseURL: undefined,
|
|
14
|
+
timeout: 30000,
|
|
15
|
+
tokenKey: 'token',
|
|
16
|
+
token: undefined,
|
|
17
|
+
loginErrFn: function loginErrFn() {} // 登录失效执行函数
|
|
18
|
+
};
|
|
19
|
+
// 初始化返回代码集合
|
|
20
|
+
var DATA_CODE = new Map([['SUCCESS', '2000'], ['LOGIN_ERROR', '100003']]);
|
|
21
|
+
// 取消请求的 token
|
|
22
|
+
var CancelToken = axios.CancelToken;
|
|
23
|
+
var source = CancelToken.source();
|
|
24
|
+
// 定义等待中的请求数组
|
|
25
|
+
var pending = [];
|
|
26
|
+
// 移除重复请求
|
|
27
|
+
var removePending = function removePending(config) {
|
|
28
|
+
for (var key in pending) {
|
|
29
|
+
var item = +key;
|
|
30
|
+
var list = pending[key];
|
|
31
|
+
// 当前请求在数组中存在时执行函数体
|
|
32
|
+
if (list.url === config.url && list.method === config.method && JSON.stringify(list.params) === JSON.stringify(config.params) && JSON.stringify(list.data) === JSON.stringify(config.data)) {
|
|
33
|
+
// 执行取消操作
|
|
34
|
+
list.cancel('操作太频繁,请稍后再试');
|
|
35
|
+
// 从数组中移除记录
|
|
36
|
+
pending.splice(item, 1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
// 请求函数
|
|
41
|
+
function Request(configParams) {
|
|
42
|
+
configParams = _objectSpread(_objectSpread({}, initAxiosConfig), configParams);
|
|
43
|
+
var service = axios.create({
|
|
44
|
+
baseURL: configParams.baseURL,
|
|
45
|
+
timeout: configParams.timeout
|
|
46
|
+
});
|
|
47
|
+
// 请求拦截器
|
|
48
|
+
service.interceptors.request.use(function (config) {
|
|
49
|
+
removePending(config);
|
|
50
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
|
51
|
+
cancelToken: source.token,
|
|
52
|
+
url: config.url,
|
|
53
|
+
headers: _objectSpread(_objectSpread({}, config.headers), {}, {
|
|
54
|
+
authority_token: configParams.token || Cookies.get(configParams.tokenKey)
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}, function (err) {
|
|
58
|
+
_notification.error({
|
|
59
|
+
message: '提示',
|
|
60
|
+
description: err.toString()
|
|
61
|
+
});
|
|
62
|
+
return Promise.reject(_objectSpread(_objectSpread({}, err), {}, {
|
|
63
|
+
data: null
|
|
64
|
+
}));
|
|
65
|
+
});
|
|
66
|
+
// 响应拦截器
|
|
67
|
+
service.interceptors.response.use(function (res) {
|
|
68
|
+
var status = res.status,
|
|
69
|
+
data = res.data,
|
|
70
|
+
statusText = res.statusText,
|
|
71
|
+
config = res.config;
|
|
72
|
+
removePending(config);
|
|
73
|
+
return new Promise(function (resolve, reject) {
|
|
74
|
+
if (status < 200 || status > 300) {
|
|
75
|
+
_notification.error({
|
|
76
|
+
message: "\u8BF7\u6C42\u9519\u8BEF: ".concat(status),
|
|
77
|
+
description: statusText
|
|
78
|
+
});
|
|
79
|
+
reject(data);
|
|
80
|
+
} else if (!data.success) {
|
|
81
|
+
if (data.code === DATA_CODE.get('LOGIN_ERROR')) {
|
|
82
|
+
var _configParams$loginEr, _configParams;
|
|
83
|
+
// 登录失效后,取消后续的 http 请求
|
|
84
|
+
source.cancel('登录失效');
|
|
85
|
+
(_configParams$loginEr = (_configParams = configParams).loginErrFn) === null || _configParams$loginEr === void 0 ? void 0 : _configParams$loginEr.call(_configParams);
|
|
86
|
+
} else {
|
|
87
|
+
_notification.error({
|
|
88
|
+
message: '提示',
|
|
89
|
+
description: data.message
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
reject(data);
|
|
93
|
+
} else {
|
|
94
|
+
resolve(data);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}, function (err) {
|
|
98
|
+
_notification.error({
|
|
99
|
+
message: '提示',
|
|
100
|
+
description: err.message
|
|
101
|
+
});
|
|
102
|
+
return Promise.reject(new Error(err.message || '服务器开小差了,请稍后再试'));
|
|
103
|
+
});
|
|
104
|
+
return service;
|
|
105
|
+
}
|
|
106
|
+
export default Request;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var baseURLMap = {
|
|
2
|
+
dev: 'https://dev-gateway.fxqifu.net/pangu',
|
|
3
|
+
test: 'https://qa-gateway.fxqifu.net/pangu',
|
|
4
|
+
qa: 'https://qa-gateway.fxqifu.net/pangu',
|
|
5
|
+
prod: 'https://gateway.fxqifu.net/pangu'
|
|
6
|
+
};
|
|
7
|
+
export var getApiHost = function getApiHost(env) {
|
|
8
|
+
return baseURLMap[env || localStorage.getItem('env') || 'prod'];
|
|
9
|
+
};
|
|
10
|
+
export var getApiUrl = function getApiUrl(url, env) {
|
|
11
|
+
return baseURLMap[env || localStorage.getItem('env') || 'prod'] + url;
|
|
12
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _icons = require("@ant-design/icons");
|
|
8
|
+
/* 采用iconfont Symbol模式
|
|
9
|
+
每次更新icon后,记得复制最新的地址哦~ */
|
|
10
|
+
var Icon = (0, _icons.createFromIconfontCN)({
|
|
11
|
+
scriptUrl: ['//at.alicdn.com/t/c/font_3161758_5bzjjx85uxv.js', '//at.alicdn.com/t/font_2562875_b3aduyabrj.js']
|
|
12
|
+
});
|
|
13
|
+
var _default = exports.default = Icon;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import type { ProColumns } from '@ant-design/pro-table';
|
|
3
|
+
import { EnvType } from './utils/serviceEnv';
|
|
4
|
+
import './index.less';
|
|
5
|
+
export interface ChooseGoodsProps {
|
|
6
|
+
open: boolean;
|
|
7
|
+
env?: EnvType;
|
|
8
|
+
token?: string;
|
|
9
|
+
loginErrFn?: any;
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
defaultSelectedGoodsIds?: React.Key[];
|
|
12
|
+
request?: Array<string>;
|
|
13
|
+
columns?: ProColumns[];
|
|
14
|
+
rowKey?: string;
|
|
15
|
+
customParams?: {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
serviceUrl?: string;
|
|
19
|
+
scroll?: {
|
|
20
|
+
x?: number;
|
|
21
|
+
y?: number;
|
|
22
|
+
};
|
|
23
|
+
onOk?: (selectedGoodsId: React.Key[], selectedGoods: any[]) => void;
|
|
24
|
+
onCancel?: () => void;
|
|
25
|
+
}
|
|
26
|
+
declare const ChooseSiteGoods: FC<ChooseGoodsProps>;
|
|
27
|
+
export default ChooseSiteGoods;
|