# ehome-merchant

> 商户组件

Latest version **1.1.0-1** (published 2020-06-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install ehome-merchant
pnpm add ehome-merchant
yarn add ehome-merchant
bun add ehome-merchant
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0-1 |
| Published | 2020-06-07 |
| First published | 2020-02-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 5.3 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | ehome |
| Keywords | ehome-merchant |

## Links

- npm: https://www.npmjs.com/package/ehome-merchant
- npm.io page: https://npm.io/package/ehome-merchant

## Dependencies (6)

- [moment](https://npm.io/package/moment.md) ^2.24.0
- [echarts](https://npm.io/package/echarts.md) ^4.6.0
- [reqwest](https://npm.io/package/reqwest.md) ^2.0.5
- [cropperjs](https://npm.io/package/cropperjs.md) ^1.5.6
- [react-ahax](https://npm.io/package/react-ahax.md) ^1.0.3
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^9.0.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.1.0-1 (latest) — 2020-06-07
- 1.0.44 — 2020-04-21
- 1.0.39 — 2020-04-02
- 1.0.38 — 2020-04-02
- 1.0.29 — 2020-03-28
- 1.0.25 — 2020-03-25
- 1.0.21 — 2020-03-25
- 1.0.20 — 2020-03-24
- 1.0.19 — 2020-03-24
- 1.0.18 — 2020-03-23
- 1.0.17 — 2020-03-23
- 1.0.16 — 2020-03-23
- 1.0.14 — 2020-03-23
- 1.0.13 — 2020-03-18
- 1.0.12 — 2020-03-16
- … 10 more at https://npm.io/package/ehome-merchant/versions

## README

# ehome-merchant
## 发布 react组件 的脚手架
相关博客（详细说明）：<a href="https://juejin.im/post/5d6760b3e51d453b8b5fa60b">使用npm发布一个react组件</a>


#### 开发组件
+ 安装依赖：
 
  ```  bash
  npm i
  npm start
  ```

- 打包组件

  ``` bash
  npm run build
  ```

#### 组件功能测试
- 项目根目录下执行：

  ```  bash
  npm link
  cd src/example
  npm link ehome-merchant # 此处为package.json中定义的name字段
  ```
+ 修改example/src/app.js 文件内容（将原本导入开发组件替换成打包后的组件）：

  ``` bash
  // import ReactDemo from '../../src' // 组件源代码
  import ReactDemo from 'ehome-merchant'; // npm link 测试打包组件的功能
  // import 'ehome-merchant/lib/main.min.css'; // npm link 测试打包组件的功能  
  ```
  
+ 根目录执行：

  ``` bash
  npm start
  ```
  
#### 组件发布到npm
+ 查看当前使用的源地址：

  ``` bash
  npm config list
  ```
+ 如果不是官方源地址，通过下面的命令切换 npm 源：

  ``` bash
  npm config set registry http://registry.npmjs.org
  ```
+ 组件发布到 npm：

  ``` bash
  npm run lib
  npm publish
  ```
+ 取消发布（最好不要，别人可能下载了你的包）：

  ``` bash
  npm unpublish ehome-merchant --force # 此处为package.json中定义的name字段
  ```
### npm 包的使用与下载
+ 下载：

  ``` bash
  npm i ehome-merchant # 假设你的包名字叫ehome-merchant
  ```
+ 使用方法：

  ``` bash
  # 组件中引入
  import FinancialDetailsModule from 'ehome-merchant';

  <FinancialDetailsModule
    {...this.props}
    $$context={$$context}
    callBack={() => console.log(需要组件回调处理的函数)}
  />

  $$context 组件需要的参数，例如：
  $$context: {
    merchantId // 商户id
    communityId 
    namespaceId
    organizationId
    poolId // 积分池id 老接口
    memberType  // 对应接口的 platformFlag 字段； 注册时需要按模块性质给对应的参数 1-个人 2-企业
    tag1 (communityId)  // 注册时要用
    paymentPayeeType // 角色 主要是支付相关模块已经注册时要用到的字段   老的接口
    paymentPayeeId // 用户id 主要是支付相关模块要用到的字段 老的接口
  }

  // paymentPayeeType paymentPayeeId memberType poolId 这些字段需要业务提供，老的实现是分开两个个接口获取的，需要业务后端统一成一个接口返回
  ```

# 各个业务模块
  ``` bash
  // 模块名 + Module  
  例如  注册步骤 register-application --> RegisterApplicationModule
  引入注册步骤模块如：  import RegisterApplicationModule from 'ehome-merchant';

  以下是所有模块名
  [{
    name: '商户列表',
    dataType: 'business-list',
  }, {
    name: '商户设置',
    dataType: 'business-setting',
  }, {
    name: '活动管理',
    dataType: 'activity-config'
  }, {
    name: '活动促销',
    dataType: 'activity-management'
  }, {
    name: '卡券发放',
    dataType: 'cardcoupon-grant'
  }, {
    name: '卡券管理',
    dataType: 'cardcoupon-management'
  }, {
    name: '卡券记录',
    dataType: 'cardcoupon-records'
  }, {
    name: '商户主页',
    dataType: 'fund-management'
  }, {
    name: '财务明细',
    dataType: 'financial-details'
  }, {
    name: '积分账户',
    dataType: 'integral-account'
  }, {
    name: '基础设置',
    dataType: 'integral-basis'
  }, {
    name: '积分赠送',
    dataType: 'integral-give'
  }, {
    name: '积分概况',
    dataType: 'integral-overview'
  }, {
    name: '积分记录',
    dataType: 'integral-record'
  }, {
    name: '积分银行积分记录',
    dataType: 'integral-records'
  }, {
    name: '积分规则',
    dataType: 'integral-rule'
  }, {
    name: '发票管理',
    dataType: 'invoice-management'
  }, {
    name: '会员规则',
    dataType: 'member-config'
  }, {
    name: '会员列表',
    dataType: 'member-list'
  }, {
    name: '订单管理',
    dataType: 'order-management'
  }, {
    name: '商户收款码',
    dataType: 'payment-code'
  }, {
    name: '凭证管理',
    dataType: 'payment-doc'
  }, {
    name: '交易明细',
    dataType: 'trade-inquiries'
  }, {
    name: '商户信息',
    dataType: 'business-info'
  }, {
    name: '注册步骤',
    dataType: 'register-application'
  }, {
    name: '去注册',
    dataType: 'register-home'
  }]
  ```

  # 暂不支持例如 卡券促销这种多个tabs的页面，需要业务自己引入，主要原因是：避免业务组件太庞大
  ``` bash
  // 卡券促销
  import { CardcouponManagementModule, CardcouponGrantModule, CardcouponRecordsModule } from 'ehome-merchant';

  const params = {
			...this.props,
			$$context
		};

  <div className={prefixCls}>
    <FunctionTabs routes={routes} />
    <Route path={`${match.url}/cardcoupon-management`} component={CardcouponManagementModule} {...params} />
    <Route path={`${match.url}/cardcoupon-grant`} component={CardcouponGrantModule} {...params} />
    <Route path={`${match.url}/cardcoupon-records`} component={CardcouponRecordsModule} {...params} />
  </div>

  ```

  # 回调函数 callBack
   ``` bash
   import RegisterApplicationModule from 'ehome-merchant';

   <RegisterApplicationModule callBack={() => console.log(需要组件回调处理的函数)} />
   ```

---
_Source: https://npm.io/package/ehome-merchant · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
