npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gh-sdk-web

v0.0.7

Published

国惠健康js sdk

Readme

国惠SDK

功能介绍

  • 创建订单及去支付,会自动根据所在平台跳转对应收银台,同时解决了用户一次性买超多数量商品无法支付的问题。
  • 在国惠App网页内使用时,可调用国惠App暴露的特定方法,如获取定位 打开地图 跳转路由等

使用方法示例

  • npm 方式

    1. 在项目根目录下执行

      npm install gh-sdk-web
    2. 使用示例

       import GhSdkWeb from 'gh-sdk-web'
       // appId与appKey是从初始url链接上获取的query参数
       // dev: 国惠测试环境, pre: 国惠预发环境, prod: 国惠生产环境; 根据你想调用的环境来设置
       const ghSdkWebIns = new GhSdkWeb(appId, appKey, 'dev')
      
       async function startPay() {
         try {
           // 下单参数示例
           const orderParams = {
             orderMerchantCode: 'SJ20240425001',
             storeCode: 'MD96421830',
             orderRefCode: '17473625575376',
             orderAmt: '38.90',
             costAdjust: '0.00',
             freight: '0.00',
             orderDateTime: '2025-05-16 10:29:17',
             orderMerchantUrl: 'https://pk-mall-test.huayione.com/jointLoginGuoHui/type/order/c/17473625575373',
             orderMerchantBackUrl: 'https://pk-mall-test.huayione.com/b2c/Callback/guohuipay',
             comment: '',
             orderTransContent: [
               {
                 barCode: '',
                 localCode: '20474',
                 productName: '小葵花 小儿柴桂退热颗粒 5g*12袋 小儿外感发热',
                 unit: '盒',
                 price: '38.90',
                 qty: 1,
                 subTotal: '38.90',
                 imageURL: 'https://img13.360buyimg.com/n12/jfs/t1/235054/4/8144/118526/657905a6F813d4501/5948429f08ee5221.jpg'
               }
             ],
             referenceDetails: [
               {
                 barCode: '',
                 localCode: '20474',
                 productName: '小葵花 小儿柴桂退热颗粒 5g*12袋 小儿外感发热',
                 unit: '盒',
                 price: '38.90',
                 qty: 1,
                 subTotal: '38.90',
                 imageURL: 'https://img13.360buyimg.com/n12/jfs/t1/235054/4/8144/118526/657905a6F813d4501/5948429f08ee5221.jpg'
               }
             ],
             orderCardbindMobile: '19937029543',
             terminal: '4'
           }
      
           await ghSdkWebIns.createOrderAndStartPay(orderParams)
         } catch (error) {
           // 国惠下单支付失败处理
           console.log('国惠下单支付发生错误------>', error)
         }
       }
  • script 引入方式

        <script src="https://ghhealth.oss-cn-hangzhou.aliyuncs.com/js-resource/gh-sdk-web/v${package_version}/gh-sdk-web.umd.cjs"></script>
        <!-- 例如 -->
        <!-- <script src="https://ghhealth.oss-cn-hangzhou.aliyuncs.com/js-resource/gh-sdk-web/v${0.0.7}/gh-sdk-web.umd.cjs"></script> -->
        <script>
          // appId与appKey是从初始url链接上获取的query参数,
          // dev: 国惠测试环境, pre: 国惠预发环境, prod: 国惠生产环境; 根据你想调用的环境来设置
          const ghSdkWebIns = new GhSdkWeb(appId, appKey, 'dev')
          async function startPay() {
            try {
              // 下单参数示例
              const orderParams = {
                orderMerchantCode: 'SJ20240425001',
                storeCode: 'MD96421830',
                orderRefCode: '17473625575376',
                orderAmt: '38.90',
                costAdjust: '0.00',
                freight: '0.00',
                orderDateTime: '2025-05-16 10:29:17',
                orderMerchantUrl: 'https://pk-mall-test.huayione.com/jointLoginGuoHui/type/order/c/17473625575373',
                orderMerchantBackUrl: 'https://pk-mall-test.huayione.com/b2c/Callback/guohuipay',
                comment: '',
                orderTransContent: [
                  {
                    barCode: '',
                    localCode: '20474',
                    productName: '小葵花 小儿柴桂退热颗粒 5g*12袋 小儿外感发热',
                    unit: '盒',
                    price: '38.90',
                    qty: 1,
                    subTotal: '38.90',
                    imageURL: 'https://img13.360buyimg.com/n12/jfs/t1/235054/4/8144/118526/657905a6F813d4501/5948429f08ee5221.jpg'
                  }
                ],
                referenceDetails: [
                  {
                    barCode: '',
                    localCode: '20474',
                    productName: '小葵花 小儿柴桂退热颗粒 5g*12袋 小儿外感发热',
                    unit: '盒',
                    price: '38.90',
                    qty: 1,
                    subTotal: '38.90',
                    imageURL: 'https://img13.360buyimg.com/n12/jfs/t1/235054/4/8144/118526/657905a6F813d4501/5948429f08ee5221.jpg'
                  }
                ],
                orderCardbindMobile: '19937029543',
                terminal: '4'
              }
    
              await ghSdkWebIns.createOrderAndStartPay(orderParams)
            } catch (error) {
              // 国惠下单支付失败处理
              console.log('国惠下单支付发生错误------>', error)
            }
          }
        </script>
    

type类型

  interface GhBridgeMessageObjType {
    type: 'getLocation' | 'getAppVersion' | 'createOrder' | 'openMap' | 'jumpRoute'; // App内的方法名
    routePath?: string; // 路由地址 type=jumpRoute时须传
    routeMethod?: 'toNamed' | 'offNamed' | 'offAllNamed' | 'offAndToNamed' | 'launchUri'; // 路由方法
    params?: any; // 参数
  }

api

| 方法名 | 说明 | 参数 | 返回值 | | ------- | ------------ | -------------- | ---- | | new GhSdkWeb | 生成GhSdkWeb实例 | appId: String(初始url上的参数), appKey: String(初始url上的参数), env: 'dev'、'pre'、'prod' (你当前的环境) | GhSdkWeb实例 | | createOrderAndStartPay | 创建订单后跳转收银台 | orderParams: Object | Promise | | callAppWithResult | 调用App方法并且返回结果 | messageObj: GhBridgeMessageObjType | Promise | | callAppWithNoResult | 调用App方法不返回结果 | messageObj: GhBridgeMessageObjType | void |