| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910 |
- var _customState = {};
- var APP_TYPE = 'APP_N9NPHVTQLPBPO8MR6WFG';
- var CUSTOMER_FORM_UUID = 'FORM-NO966791YOK2XKW9DMSEGD5L1IN73UHW3ME6LR1';
- var STORAGE_KEY = 'tyson.customer-info-query.selected-customer';
- var requestSequence = 0;
- var FIELDS = {
- customerNumber: 'textField_l6em70k2',
- customerName: 'textField_l6em70k4'
- };
- export function didMount() {
- var cached = null;
- try {
- cached = JSON.parse(window.localStorage.getItem(STORAGE_KEY) || 'null');
- } catch (e) {
- cached = null;
- }
- this.setCustomState({
- keyword: cached && cached.customerNumber ? cached.customerNumber + ' - ' + (cached.customerName || '') : '',
- searching: false,
- customers: [],
- selectedCustomer: cached && cached.customerNumber ? cached : null,
- queryType: 'balance',
- querying: false,
- result: null,
- error: '',
- searchVisible: false
- });
- }
- export function didUnmount() {
- if (this._customerSearchTimer) {
- clearTimeout(this._customerSearchTimer);
- }
- }
- export function setQueryType(queryType) {
- this.setCustomState({
- queryType: queryType,
- result: null,
- error: ''
- });
- this.forceUpdate();
- }
- export function updateKeyword(value) {
- var self = this;
- var keyword = value || '';
- self.setCustomState({
- keyword: keyword,
- searchVisible: true,
- error: ''
- });
- self.forceUpdate();
- if (self._customerSearchTimer) {
- clearTimeout(self._customerSearchTimer);
- }
- if (keyword.trim().length < 2) {
- self.setCustomState({
- customers: [],
- searching: false
- });
- self.forceUpdate();
- return;
- }
- self._customerSearchTimer = setTimeout(function () {
- self.searchCustomers(keyword.trim());
- }, 300);
- }
- export function searchCustomers(keyword) {
- var self = this;
- var base = {
- formUuid: CUSTOMER_FORM_UUID,
- appType: APP_TYPE,
- currentPage: 1,
- pageSize: 20
- };
- var codeCondition = [{
- key: FIELDS.customerNumber,
- value: keyword,
- type: 'TEXT',
- operator: 'contains',
- componentName: 'TextField'
- }];
- var nameCondition = [{
- key: FIELDS.customerName,
- value: keyword,
- type: 'TEXT',
- operator: 'contains',
- componentName: 'TextField'
- }];
- self.setCustomState({
- searching: true
- });
- self.forceUpdate();
- var codeParams = {};
- var nameParams = {};
- Object.keys(base).forEach(key => {
- codeParams[key] = base[key];
- nameParams[key] = base[key];
- });
- codeParams.searchFieldJson = JSON.stringify(codeCondition);
- nameParams.searchFieldJson = JSON.stringify(nameCondition);
- return Promise.all([self.utils.yida.searchFormDatas(codeParams), self.utils.yida.searchFormDatas(nameParams)]).then(function (responses) {
- var seen = {};
- var customers = [];
- responses.forEach(response => {
- var rows = response && response.data || response && response.content && response.content.data || [];
- rows.forEach(row => {
- var formData = row.formData || {};
- var customerNumber = formData[FIELDS.customerNumber];
- if (customerNumber && !seen[customerNumber]) {
- seen[customerNumber] = true;
- customers.push({
- customerNumber: customerNumber,
- customerName: formData[FIELDS.customerName] || ''
- });
- }
- });
- });
- self.setCustomState({
- customers: customers,
- searching: false
- });
- self.forceUpdate();
- }).catch(function (error) {
- self.setCustomState({
- searching: false,
- customers: []
- });
- self.utils.toast({
- title: error && error.message ? error.message : '客户查询失败',
- type: 'error'
- });
- self.forceUpdate();
- });
- }
- export function selectCustomer(customer) {
- try {
- window.localStorage.setItem(STORAGE_KEY, JSON.stringify(customer));
- } catch (e) {
- // The query remains usable when browser storage is unavailable.
- }
- this.setCustomState({
- selectedCustomer: customer,
- keyword: customer.customerNumber + ' - ' + customer.customerName,
- searchVisible: false,
- customers: [],
- result: null,
- error: ''
- });
- this.forceUpdate();
- }
- export function clearCustomer() {
- try {
- window.localStorage.removeItem(STORAGE_KEY);
- } catch (e) {
- // Ignore storage cleanup errors.
- }
- this.setCustomState({
- keyword: '',
- selectedCustomer: null,
- customers: [],
- result: null,
- error: ''
- });
- this.forceUpdate();
- }
- export function queryCustomerInfo() {
- var self = this;
- var state = self.getCustomState();
- var selected = state.selectedCustomer;
- if (!selected) {
- self.utils.toast({
- title: '请先选择客户',
- type: 'warning'
- });
- return;
- }
- var dataSourceName = state.queryType === 'balance' ? 'customerBalance' : 'customerUnlockOrders';
- var dataSource = self.dataSourceMap && self.dataSourceMap[dataSourceName];
- if (!dataSource || !dataSource.load) {
- var availableDataSources = self.dataSourceMap ? Object.keys(self.dataSourceMap).join(', ') : '未初始化';
- var message = '查询数据源不可用:' + dataSourceName + ';当前数据源:' + availableDataSources;
- self.setCustomState({
- error: message,
- result: null
- });
- self.utils.toast({
- title: message,
- type: 'error'
- });
- self.forceUpdate();
- return;
- }
- self.setCustomState({
- querying: true,
- error: '',
- result: null
- });
- self.forceUpdate();
- var request = {
- inputs: JSON.stringify({
- Headers: {
- 'Content-Type': 'application/json'
- },
- Query: {},
- Body: {
- requestID: self.createRequestId(),
- CUSTOMER_NUMBER: selected.customerNumber,
- CUSTOMER_NAME: selected.customerName
- }
- })
- };
- try {
- return Promise.resolve(dataSource.load(request)).then(function (result) {
- self.handleQueryResponse(result);
- }).catch(function (error) {
- self.setCustomState({
- querying: false,
- result: null,
- error: error && error.message ? error.message : 'SAP查询失败'
- });
- self.utils.toast({
- title: error && error.message ? error.message : 'SAP查询失败',
- type: 'error'
- });
- self.forceUpdate();
- });
- } catch (error) {
- self.setCustomState({
- querying: false,
- result: null,
- error: error && error.message ? error.message : 'SAP查询初始化失败'
- });
- self.utils.toast({
- title: error && error.message ? error.message : 'SAP查询初始化失败',
- type: 'error'
- });
- self.forceUpdate();
- }
- }
- export function handleQueryResponse(result) {
- var response = result && result.Response !== undefined ? result.Response : result;
- response = response && response.content !== undefined ? response.content : response;
- response = response && response.serviceReturnValue !== undefined ? response.serviceReturnValue : response;
- if (typeof response === 'string') {
- try {
- response = JSON.parse(response);
- } catch (e) {
- var responseText = response.toLowerCase();
- var gatewayMessage = responseText.indexOf('502 bad gateway') >= 0 || responseText.indexOf('503 service unavailable') >= 0 || responseText.indexOf('<html') >= 0 || responseText.indexOf('<head') >= 0 ? 'SAP查询服务暂时不可用,请稍后重试' : 'SAP查询服务返回格式异常';
- this.setCustomState({
- querying: false,
- result: null,
- error: gatewayMessage
- });
- this.utils.toast({
- title: gatewayMessage,
- type: 'error'
- });
- this.forceUpdate();
- return;
- }
- }
- if (response && response.success === false) {
- var responseMessage = response.message || response.errorMsg || 'SAP查询失败';
- this.setCustomState({
- querying: false,
- result: null,
- error: responseMessage
- });
- this.utils.toast({
- title: responseMessage,
- type: 'error'
- });
- this.forceUpdate();
- return;
- }
- if (response && response.STATUS && response.STATUS !== 'S') {
- var sapMessage = response.MESSAGE || 'SAP查询失败,状态=' + response.STATUS;
- this.setCustomState({
- querying: false,
- result: null,
- error: sapMessage
- });
- this.utils.toast({
- title: sapMessage,
- type: 'error'
- });
- this.forceUpdate();
- return;
- }
- var message = response && response.MESSAGE;
- var errorItem = response && response.ITEM && response.ITEM.filter(item => item && item.ERRO_MESSAGE)[0];
- if (message || errorItem) {
- var errorMessage = message || errorItem.ERRO_MESSAGE;
- this.setCustomState({
- querying: false,
- result: null,
- error: errorMessage
- });
- this.utils.toast({
- title: errorMessage,
- type: 'error'
- });
- this.forceUpdate();
- return;
- }
- this.setCustomState({
- querying: false,
- result: response || {}
- });
- this.forceUpdate();
- }
- export function createRequestId() {
- requestSequence += 1;
- if (window.crypto && window.crypto.randomUUID) {
- return window.crypto.randomUUID();
- }
- if (window.crypto && window.crypto.getRandomValues) {
- var values = new Uint32Array(4);
- window.crypto.getRandomValues(values);
- return values[0].toString(16) + '-' + values[1].toString(16) + '-' + values[2].toString(16) + '-' + values[3].toString(16);
- }
- return Date.now().toString(36) + '-' + requestSequence.toString(36) + '-' + Math.random().toString(36).slice(2);
- }
- export function formatAmount(value) {
- var amount = Number(value || 0);
- if (isNaN(amount)) {
- return value || '-';
- }
- return amount.toLocaleString('zh-CN', {
- minimumFractionDigits: 2,
- maximumFractionDigits: 2
- });
- }
- export function formatDate(value) {
- if (!value) {
- return value || '-';
- }
- var text = String(value);
- if (text.length === 8) {
- return text.slice(0, 4) + '-' + text.slice(4, 6) + '-' + text.slice(6, 8);
- }
- var matched = text.match(/^(\d{4}-\d{2}-\d{2})/);
- return matched ? matched[1] : text;
- }
- export function formatTime(value) {
- if (!value) {
- return '-';
- }
- var matched = String(value).match(/T(\d{2}:\d{2}:\d{2})/);
- return matched ? matched[1] : String(value);
- }
- export function renderBalanceSummary(result) {
- return <div style={styles.balanceSummary}><div><span style={styles.summaryLabel}>客户组</span><strong>{result.CUSTOMER_GROUP || '-'}</strong></div><div><span style={styles.summaryLabel}>客户组描述</span><strong>{result.CUSTOMER_GROUP_DESC || '-'}</strong></div><div><span style={styles.summaryLabel}>总风险金额</span><strong style={styles.summaryAmount}>{this.formatAmount(result.TOTAL_RISK_AMT)}</strong></div></div>;
- }
- export function renderBalance(state, mobile) {
- var result = state.result || {};
- var items = result.ITEM || [];
- if (!items.length) {
- return <div style={styles.empty}>未查询到余额数据</div>;
- }
- return <div>{this.renderBalanceSummary(result)}<div style={mobile ? styles.balanceTableWrapMobile : styles.tableWrap}><table className="customer-query-table" style={mobile ? styles.balanceTableMobile : styles.table}><thead><tr><th>公司代码</th><th>币种</th><th>未结金额</th></tr></thead><tbody>{items.map((item, index) => <tr key={index}><td>{item.COMPANY_CODE || '-'}</td><td>{item.CURRENCY || '-'}</td><td style={styles.amountHighlight}>{this.formatAmount(item.OUTSTAND_AMT)}</td></tr>)}</tbody></table></div></div>;
- }
- export function renderOrders(state, mobile) {
- var items = state.result && state.result.ITEM || [];
- if (!items.length) {
- return <div style={styles.empty}>未查询到收款解锁订单</div>;
- }
- if (mobile) {
- return <div>{items.map((item, index) => <div key={index} style={styles.orderCard}><div style={styles.orderCardHeader}><strong style={styles.orderCardNumber}>{item.SALES_ORDER || '-'}</strong><span style={item.RELEASE_STATUS === 'S' ? styles.statusSuccess : styles.statusError}>{item.RELEASE_STATUS === 'S' ? '成功' : '失败'}</span></div><div style={styles.orderCardGrid}><div><span>公司代码</span><b>{item.COMPANY_CODE || '-'}</b></div><div><span>销售组织</span><b>{item.SALES_ORG || '-'}</b></div><div><span>订单金额</span><b style={styles.orderCardAmount}>{this.formatAmount(item.SALES_AMOUNT)} {item.CURRENCY || ''}</b></div><div><span>释放日期</span><b>{this.formatDate(item.RELEASE_DATE)}</b></div><div><span>释放时间</span><b>{this.formatTime(item.RELEASE_TIME)}</b></div></div></div>)}</div>;
- }
- return <div style={styles.tableWrap}><table className="customer-query-table" style={styles.table}><thead><tr><th>公司代码</th><th>销售订单号</th><th>销售组织</th><th>订单金额</th><th>币种</th><th>释放日期</th><th>释放时间</th><th>状态</th></tr></thead><tbody>{items.map((item, index) => <tr key={index}><td>{item.COMPANY_CODE || '-'}</td><td style={styles.orderCell}>{item.SALES_ORDER || '-'}</td><td>{item.SALES_ORG || '-'}</td><td style={styles.amountCell}>{this.formatAmount(item.SALES_AMOUNT)}</td><td>{item.CURRENCY || '-'}</td><td>{this.formatDate(item.RELEASE_DATE)}</td><td>{this.formatTime(item.RELEASE_TIME)}</td><td><span style={item.RELEASE_STATUS === 'S' ? styles.statusSuccess : styles.statusError}>{item.RELEASE_STATUS === 'S' ? '成功' : '失败'}</span></td></tr>)}</tbody></table></div>;
- }
- export function renderJsx() {
- var self = this;
- var state = self.getCustomState();
- var mobile = self.utils.isMobile();
- var selected = state.selectedCustomer;
- var result = state.result;
- return <div style={styles.page}>
- <style>{'.customer-query-table th{background:#EEF4F0;color:#405149;font-weight:700;white-space:nowrap;padding:10px 12px;border-bottom:1px solid #D7E1DB}.customer-query-table td{padding:9px 12px;border-bottom:1px solid #E7ECE9;white-space:nowrap}.customer-query-table tbody tr:last-child td{border-bottom:0}.customer-query-table tbody tr:nth-child(even){background:#FAFCFB}.customer-query-table tbody tr:hover{background:#F1F6F3}'}</style>
- <div style={styles.shell}>
- <div style={styles.header}><div><div style={styles.eyebrow}>CUSTOMER SERVICE</div><h1 style={styles.title}>客户信息查询</h1><p style={styles.subtitle}>查询客户余额与收款解锁订单</p></div></div>
- <section style={styles.panel}>
- <div style={mobile ? styles.queryStack : styles.queryRow}>
- <div style={styles.customerField}>
- <div style={styles.fieldLabel}>选择客户</div>
- <div style={styles.searchWrap}>
- <input key={selected ? selected.customerNumber : 'empty'} defaultValue={state.keyword || ''} placeholder="输入客户编码或名称,至少 2 个字符" onChange={e => {
- self.updateKeyword(e.target.value);
- }} onFocus={e => {
- self.setCustomState({
- searchVisible: true
- });
- self.forceUpdate();
- }} style={styles.input} />
- {selected && <button type="button" onClick={e => {
- self.clearCustomer();
- }} style={styles.clearButton}>清除</button>}
- {state.searchVisible && (state.searching || state.customers && state.customers.length > 0) && <div style={styles.searchMenu}>
- {state.searching && <div style={styles.searchHint}>正在搜索客户...</div>}
- {!state.searching && state.customers.map(customer => <button type="button" key={customer.customerNumber} onClick={e => {
- self.selectCustomer(customer);
- }} style={styles.customerOption}><b>{customer.customerNumber}</b><span>{customer.customerName || '未维护名称'}</span></button>)}
- </div>}
- </div>
- </div>
- <div style={styles.queryTypeField}>
- <div style={styles.fieldLabel}>查询内容</div>
- <div style={styles.switchRow}>
- <span style={state.queryType === 'balance' ? styles.switchLabelActive : styles.switchLabel}>客户余额</span>
- <button type="button" aria-label="切换查询内容" onClick={e => {
- self.setQueryType(state.queryType === 'balance' ? 'unlockOrders' : 'balance');
- }} style={state.queryType === 'balance' ? styles.switchTrack : styles.switchTrackActive}><span style={state.queryType === 'balance' ? styles.switchThumb : styles.switchThumbActive}></span></button>
- <span style={state.queryType === 'unlockOrders' ? styles.switchLabelActive : styles.switchLabel}>收款解锁订单</span>
- </div>
- </div>
- <div style={mobile ? styles.queryActionFieldMobile : styles.queryActionField}>
- {!mobile && <div style={styles.fieldLabel}>操作</div>}
- <button type="button" disabled={state.querying} onClick={e => {
- if (!selected) {
- self.setCustomState({
- error: '请先选择客户后再查询',
- result: null
- });
- self.forceUpdate();
- return;
- }
- self.queryCustomerInfo();
- }} style={state.querying || !selected ? mobile ? styles.queryDisabledMobile : styles.queryDisabled : mobile ? styles.queryButtonMobile : styles.queryButton}>{state.querying ? '查询中...' : '查询'}</button>
- </div>
- </div>
- {!selected && <div style={styles.validationHint}>请选择客户后再查询</div>}
- </section>
- {state.error && <div style={styles.error}>{state.error}</div>}
- {result && <section style={styles.resultPanel}>
- <div style={styles.resultHeader}><div><div style={styles.eyebrow}>{state.queryType === 'balance' ? 'BALANCE' : 'UNLOCKED ORDERS'}</div><h2 style={styles.resultTitle}>{state.queryType === 'balance' ? '客户余额' : '收款解锁订单'}</h2></div><div style={styles.customerSummary}><span>客户编码:{result.CUSTOMER_NUMBER || selected && selected.customerNumber || '-'}</span><span>客户名称:{result.CUSTOMER_NAME || selected && selected.customerName || '-'}</span></div></div>
- {state.queryType === 'balance' ? self.renderBalance(state, mobile) : self.renderOrders(state, mobile)}
- </section>}
- {!result && !state.error && <div style={styles.empty}>选择客户和查询内容后,可查看对应的 SAP 信息。</div>}
- </div>
- <div style={{
- display: 'none'
- }}>{this.state && this.state.timestamp}</div>
- </div>;
- }
- var styles = {
- page: {
- minHeight: '100vh',
- background: '#F4F6F5',
- color: '#17211E',
- fontFamily: 'Microsoft YaHei, Arial, sans-serif',
- padding: '20px 16px 40px'
- },
- shell: {
- maxWidth: 1120,
- margin: '0 auto'
- },
- header: {
- padding: '12px 0 22px',
- borderBottom: '1px solid #DCE3DF',
- marginBottom: 20,
- textAlign: 'center'
- },
- eyebrow: {
- color: '#3B6C55',
- fontSize: 11,
- fontWeight: 700,
- letterSpacing: 1.2,
- marginBottom: 6
- },
- title: {
- margin: 0,
- fontSize: 28,
- lineHeight: 1.2,
- letterSpacing: '-0.5px'
- },
- subtitle: {
- margin: '8px 0 0',
- color: '#66746E',
- fontSize: 14
- },
- panel: {
- background: '#FFFFFF',
- border: '1px solid #DCE3DF',
- padding: 20,
- boxShadow: '0 10px 28px rgba(25,48,38,.06)'
- },
- fieldLabel: {
- color: '#405149',
- fontSize: 13,
- fontWeight: 700,
- margin: '0 0 8px'
- },
- queryRow: {
- display: 'flex',
- alignItems: 'flex-end',
- gap: 14
- },
- queryStack: {
- display: 'flex',
- flexDirection: 'column',
- gap: 14
- },
- customerField: {
- flex: 1,
- minWidth: 260
- },
- queryTypeField: {
- width: 280
- },
- queryActionField: {
- width: 110
- },
- queryActionFieldMobile: {
- width: '100%'
- },
- searchWrap: {
- position: 'relative'
- },
- input: {
- width: '100%',
- boxSizing: 'border-box',
- minHeight: 46,
- border: '1px solid #B7C5BD',
- borderRadius: 4,
- padding: '0 72px 0 13px',
- fontSize: 15,
- outline: 'none',
- background: '#fff'
- },
- clearButton: {
- position: 'absolute',
- right: 8,
- top: 8,
- border: 0,
- background: '#EEF3F0',
- color: '#466253',
- minHeight: 30,
- borderRadius: 3,
- padding: '0 10px',
- cursor: 'pointer'
- },
- searchMenu: {
- position: 'absolute',
- zIndex: 20,
- top: 49,
- left: 0,
- right: 0,
- maxHeight: 280,
- overflowY: 'auto',
- background: '#fff',
- border: '1px solid #B7C5BD',
- boxShadow: '0 12px 24px rgba(22,43,34,.14)'
- },
- searchHint: {
- padding: 14,
- color: '#66746E',
- fontSize: 13
- },
- customerOption: {
- display: 'flex',
- width: '100%',
- minHeight: 48,
- padding: '10px 13px',
- gap: 12,
- alignItems: 'center',
- border: 0,
- borderBottom: '1px solid #EDF1EE',
- background: '#fff',
- textAlign: 'left',
- cursor: 'pointer',
- color: '#17211E'
- },
- switchRow: {
- display: 'flex',
- minHeight: 44,
- alignItems: 'center',
- justifyContent: 'space-between',
- gap: 8
- },
- switchLabel: {
- color: '#89958F',
- fontSize: 13,
- whiteSpace: 'nowrap'
- },
- switchLabelActive: {
- color: '#24563E',
- fontSize: 13,
- fontWeight: 700,
- whiteSpace: 'nowrap'
- },
- switchTrack: {
- position: 'relative',
- width: 46,
- height: 24,
- flex: '0 0 46px',
- padding: 0,
- border: 0,
- borderRadius: 12,
- background: '#24563E',
- cursor: 'pointer'
- },
- switchTrackActive: {
- position: 'relative',
- width: 46,
- height: 24,
- flex: '0 0 46px',
- padding: 0,
- border: 0,
- borderRadius: 12,
- background: '#D76F2B',
- cursor: 'pointer'
- },
- switchThumb: {
- position: 'absolute',
- top: 3,
- left: 3,
- width: 18,
- height: 18,
- borderRadius: '50%',
- background: '#fff',
- boxShadow: '0 1px 3px rgba(0,0,0,.22)'
- },
- switchThumbActive: {
- position: 'absolute',
- top: 3,
- right: 3,
- width: 18,
- height: 18,
- borderRadius: '50%',
- background: '#fff',
- boxShadow: '0 1px 3px rgba(0,0,0,.22)'
- },
- queryButton: {
- width: '100%',
- minHeight: 46,
- border: 0,
- borderRadius: 4,
- background: '#D76F2B',
- color: '#fff',
- fontSize: 15,
- fontWeight: 700,
- cursor: 'pointer'
- },
- queryDisabled: {
- width: '100%',
- minHeight: 46,
- border: 0,
- borderRadius: 4,
- background: '#C8D0CB',
- color: '#FFFFFF',
- fontSize: 15,
- fontWeight: 700,
- cursor: 'not-allowed'
- },
- queryButtonMobile: {
- width: '100%',
- minHeight: 42,
- border: 0,
- borderRadius: 4,
- background: '#D76F2B',
- color: '#fff',
- fontSize: 14,
- fontWeight: 700,
- cursor: 'pointer'
- },
- queryDisabledMobile: {
- width: '100%',
- minHeight: 42,
- border: 0,
- borderRadius: 4,
- background: '#C8D0CB',
- color: '#FFFFFF',
- fontSize: 14,
- fontWeight: 700,
- cursor: 'not-allowed'
- },
- validationHint: {
- marginTop: 8,
- color: '#9B3D15',
- fontSize: 12
- },
- resultPanel: {
- background: '#FFFFFF',
- border: '1px solid #DCE3DF',
- margin: '20px auto 0',
- padding: 24,
- maxWidth: 1120,
- boxSizing: 'border-box'
- },
- resultHeader: {
- display: 'flex',
- justifyContent: 'center',
- alignItems: 'center',
- flexDirection: 'column',
- gap: 8,
- borderBottom: '1px solid #E7ECE9',
- paddingBottom: 16,
- marginBottom: 18,
- textAlign: 'center'
- },
- resultTitle: {
- margin: 0,
- fontSize: 22
- },
- customerSummary: {
- display: 'flex',
- justifyContent: 'center',
- flexWrap: 'wrap',
- gap: '4px 16px',
- color: '#5D6B64',
- fontSize: 13,
- textAlign: 'center'
- },
- balanceSummary: {
- display: 'flex',
- justifyContent: 'center',
- gap: 40,
- marginBottom: 18,
- padding: '14px 18px',
- background: '#F6F9F7',
- border: '1px solid #DDE6E0',
- color: '#405149',
- textAlign: 'center'
- },
- summaryLabel: {
- display: 'block',
- marginBottom: 5,
- color: '#718078',
- fontSize: 12,
- fontWeight: 400
- },
- summaryAmount: {
- color: '#1D6141',
- fontVariantNumeric: 'tabular-nums'
- },
- empty: {
- padding: '36px 18px',
- marginTop: 20,
- textAlign: 'center',
- color: '#7A8881',
- background: '#FFFFFF',
- border: '1px dashed #C9D5CE',
- fontSize: 14
- },
- error: {
- marginTop: 20,
- padding: '12px 14px',
- background: '#FFF1EB',
- border: '1px solid #F1B895',
- color: '#9B3D15',
- fontSize: 14
- },
- tableWrap: {
- overflowX: 'auto',
- border: '1px solid #DDE6E0',
- borderRadius: 4,
- background: '#FFFFFF'
- },
- table: {
- width: '100%',
- borderCollapse: 'collapse',
- fontSize: 13,
- minWidth: 620,
- textAlign: 'center',
- lineHeight: 1.35
- },
- balanceTableWrapMobile: {
- overflowX: 'auto',
- border: '1px solid #DDE6E0',
- borderRadius: 4,
- background: '#FFFFFF'
- },
- balanceTableMobile: {
- width: '100%',
- borderCollapse: 'collapse',
- fontSize: 12,
- minWidth: 300,
- textAlign: 'center',
- lineHeight: 1.2
- },
- amountCell: {
- textAlign: 'right',
- fontVariantNumeric: 'tabular-nums'
- },
- amountHighlight: {
- textAlign: 'right',
- color: '#1D6141',
- fontWeight: 700,
- fontVariantNumeric: 'tabular-nums'
- },
- nameCell: {
- textAlign: 'left',
- minWidth: 150
- },
- orderCell: {
- fontFamily: 'Consolas, monospace',
- fontWeight: 700
- },
- orderCard: {
- marginBottom: 10,
- padding: '13px 14px',
- border: '1px solid #DDE6E0',
- borderRadius: 4,
- background: '#FFFFFF'
- },
- orderCardHeader: {
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- paddingBottom: 10,
- marginBottom: 10,
- borderBottom: '1px solid #E7ECE9'
- },
- orderCardNumber: {
- fontFamily: 'Consolas, monospace',
- color: '#17211E',
- fontSize: 15
- },
- orderCardGrid: {
- display: 'grid',
- gridTemplateColumns: '1fr 1fr',
- gap: '10px 14px',
- color: '#64726B',
- fontSize: 12
- },
- orderCardAmount: {
- color: '#1D6141',
- fontVariantNumeric: 'tabular-nums'
- },
- mobileCard: {
- border: '1px solid #DFE7E2',
- padding: 15,
- marginBottom: 10,
- background: '#FBFCFB'
- },
- cardTop: {
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'center',
- marginBottom: 14
- },
- currency: {
- color: '#5F6E66',
- fontSize: 12
- },
- metric: {
- display: 'flex',
- justifyContent: 'space-between',
- gap: 12,
- padding: '8px 0',
- borderTop: '1px solid #E7ECE9',
- color: '#64726B',
- fontSize: 13
- },
- highlight: {
- color: '#1D6141',
- fontWeight: 700
- },
- detailGrid: {
- display: 'grid',
- gridTemplateColumns: '1fr 1fr',
- gap: '8px 12px',
- fontSize: 13,
- color: '#64726B'
- },
- statusSuccess: {
- display: 'inline-block',
- padding: '3px 8px',
- borderRadius: 12,
- color: '#1D6141',
- background: '#E4F1E8',
- fontSize: 12,
- fontWeight: 700
- },
- statusError: {
- display: 'inline-block',
- padding: '3px 8px',
- borderRadius: 12,
- color: '#A83B27',
- background: '#FCE9E4',
- fontSize: 12,
- fontWeight: 700
- }
- };
- export function getCustomState(key) {
- if (typeof _customState === "undefined") {
- return key ? undefined : {};
- }
- if (key) {
- return _customState[key];
- }
- return Object.assign({}, _customState);
- }
- export function setCustomState(newState) {
- if (typeof _customState === "undefined") {
- return;
- }
- Object.keys(newState || {}).forEach(function(key) {
- _customState[key] = newState[key];
- });
- this.forceUpdate();
- }
- export function forceUpdate() {
- this.setState({ timestamp: new Date().getTime() });
- }
|