JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 89
  • Score
    100M100P100Q75392F
  • License MIT

购物车订单金额计算、四舍五入、零元筐等核心逻辑 SDK(Vite 打包)

Package Exports

  • order-processing-sdk
  • order-processing-sdk/dist/order-processing-sdk.es.js
  • order-processing-sdk/dist/order-processing-sdk.umd.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (order-processing-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

订单处理 SDK

轻量级、零依赖的订单金额计算 & 购物车处理 SDK,支持四舍五入、向上取整、抹零、五舍六入、零元筐、押筐、附加费、反推单价/重量等业务逻辑,即插即用。

npm i order-processing-sdk
import OrderProcessingSDK from 'order-processing-sdk'

const cart = [
  { calAmount: 12.34, borrowAmount: 0, borrowNum: 0, originalBorrowPrice: 2 }
]
const billing = { customerId: '1001', customerName: '张三', freeBasket: false }

const detail = await OrderProcessingSDK.handleShopCar(cart, billing, 0)
// 0=四舍五入  1=向上取整  2=不处理  3=抹零  4=五舍六入
console.log(detail.totalCalAmount)   // 12
console.log(detail.totalChangeDiff)  // -0.34
方法 说明
handleShopCar(items, billing, roundType) 单订单处理(核心)
batchProcessOrders(orders, billing, roundType) 批量处理
calculateOrderStats(items) 统计:总数/总额/均值/最大/最小
syncProductCheckStatus(...) 购物车与货品勾选状态同步
handleBillingData(row, opts) 行级开单计算(金额/重量/附加费/押筐)

MIT © qinxingxing