Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@byhealth/points

Package Overview
Dependencies
Maintainers
1
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@byhealth/points

**防伪积分:** 公共模块防伪积分,在多个项目中应用,因此抽出来避免重复工作。 文件大小```69kb```

  • 1.0.3-1
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

公共防伪积分模块(SCRM Beta版本切换)

防伪积分: 公共模块防伪积分,在多个项目中应用,因此抽出来避免重复工作。 文件大小69kb

测试地址

tips:

1、涉及微信环境,jssdk授权config时需要授权扫码( jsApiList:['scanQRCode'] );

2、通过方式引入js时将在window对象中全局 ___Points___ 构造方法,使用构造方法时务必在资源文件引入之后使用,如有命名上的冲突请自行处理

3、模块css部分由js动态插入用页面,命名使用到hash,但也不排除有冲突和被复写的可能性

项目维护说明

安装
npm i
运行

运行开发环境

npm run dev

打包Uat环境

npm run build:uat

打包发布Uat环境

./deploy.sh

打包生产环境

npm run build

测试demo时确认demo 资源目录位置

项目发布说明

将master分支下dist目录内文件发布至cdn 路径下

http://cdn-yyj.4000916916.com/yyj/2018/points/

安装install

1、npm或yarn安装

npm install @byhealth/points@1.0.3-0
yarn add @byhealth/points@1.0.3-0

构造方法:new Points(Options)

基本用法:

import points from '@byhealth/points';

const Point = new points({
    uatApiBase: 'http://wx-test.by-health.com'
});

const {
    showSecuritycode
} = Point;

const options = {
    memberPhone: '13888888888'
};

const callback = (data) => {
    console.log(data);
    console.log('do something!!!');
}

// 显示防伪积分登录框
showSecuritycode(options, callback)

自定义入口UI用法

import points from '@byhealth/points';

const customPoint = new points({
    async: false, 
    securitycodeDom:'securitycodeDom', 
    phoneDom:'phoneDom', 
    QrDom:'QrDom', 
    submitDom:'submitDom', 
    uatApiBase: 'http://wx-test.by-health.com'
});

const { 
    customSecuritycode, 
} = customPoint;

const options = {
    memberPhone: '13888888888'
};

const callback = (data) => {
    console.log(data);
    console.log('do something!!!');
}

customSecuritycode(options, callback)

Api 调用防伪积分

默认ui直接显示防伪积分弹窗

showSecuritycode(options, callback)

自定义入口ui时调用下面方法初始化积分入口

customSecuritycode(options, callback)

参数:options = {...}

参数名必选类型说明
memberId二选一int消费者手机号码(memberId与memberPhone二选一)
memberPhone二选一string消费者手机号码(memberId与memberPhone二选一,已登陆传消费者会员id,未登陆或未注册传入消费者手机号码)
storeIdstring非必填:如线下门店的积分传入门店机构ID(默认微信虚拟门店1-WAYZ2)
clerkIdint非必填:如线下门店的积分传入店员员工ID
channelTypeint渠道表,详情查看渠道表(默认传4,微信渠道)参数说明见附表
requestIdint请求编号

回调:callback: (data: any) => void

注意:回调返回结果即为积分接口返回结果,为了保留积分模块的灵活性这里的回调不只是积分成功才发生,失败情况也会调用回调,请在使用时根据业务需要来进行处理

data值是积分接口返回,示例如下

{
  "integralId": 152, //扫码积分记录ID
  "txnSn": "1536056422468",  //扫码积分交易号
  "memberId": 1, //消费者会员ID
  "antifakecode": "9704745945724262", //防伪码
  "storeId": "1", //门店机构ID
  "clerkId": 1,   //店员员工ID
  "productId": 459, //产品ID
  "points": 168,    //产品的积分值(不含额外赠送的积分值)
  "channelType": 1, //渠道类型,具体参考渠道类型表
  "comment": "官网积分", //积分备注
  "status": 1, //积分记录状态,0:提交状态 ,1:已成功 -1:已取消
  "createTime": "2018-09-04T10:20:22.442Z",
  "updateTime": "2018-09-04T10:20:22.442Z",
  "requestId": "sdasdsadsadasdasd",
  "poiAvailableValue": 7575  //用户积分
}

私有API

暴露部分私有方法,方便小型项目使用

**1. initData: () => void 初始化防伪码和条形码数据 **

Points.initData()

2. showLoading: () => void 显示loading

Points.showLoading()

3. hideLoading: () => void 隐藏loading

Points.hideLoading()

4. showMsg: (msg: string, title: string) => any 显示弹窗

@param msg — 弹窗内容,可以使用HTMLdom

@param title — 弹窗标题

Points.showMsg('<div>这是弹窗文字</div>', '这是弹窗标题')

5. hideMsg: ƒ () 隐藏弹窗

points.hideMsg()

6. validate

引用包validate-by-health,查询api文档请访问:https://github.com/by-healthFED/validate

7. wechat

引用包share-wechat,查询api文档请访问:https://github.com/by-healthFED/share-wechat

8. nativeApp

引用包@byhealth/native-app-jssdk,查询api文档请访问:https://github.com/by-healthFED/native-app-jssdk


附表一:渠道类型对照表

channelType=value说明
1终端门店(APP)
2终端门店POS
3PC网站
4微信(默认)
5CRM
6会员店平台
7电话
8二维码
9瓶盖防伪
10条形码
11H5页面
12短信

FAQs

Package last updated on 17 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc