Git Product home page Git Product logo

pos-react's Introduction

POS Project v1

POS收银机 版本:v1

需求描述

商店里进行购物结算时会使用收银机(POS)系统,这台收银机会在结算时根据客户的购物车(Cart)中的商品(Item)和商店正在进行的优惠活动(Promotion)进行结算和打印购物清单。

已知该商店正在对部分商品进行“买二赠一”的优惠活动。

我们需要实现一个名为printInventory函数,该函数能够将指定格式的数据作为参数输入,然后在浏览器的控制台中输出结算清单的文本。

输入格式(样例):

[
    'ITEM000001',
    'ITEM000001',
    'ITEM000001',
    'ITEM000001',
    'ITEM000001',
    'ITEM000003-2',
    'ITEM000005',
    'ITEM000005',
    'ITEM000005'
]

其中对'ITEM000003-2'来说,"-"之前的是标准的条形码,"-"之后的是数量。 当我们购买需要称量的物品的时候,由称量的机器生成此类条形码,收银机负责识别生成小票。

清单内容(样例):

***<没钱赚商店>购物清单***
名称:可口可乐,数量:3瓶,单价:3.00(元),小计:6.00(元)
名称:羽毛球,数量:5个,单价:1.00(元),小计:4.00(元)
名称:苹果,数量:2斤,单价:5.50(元),小计:11.00(元)
----------------------
挥泪赠送商品:
名称:可口可乐,数量:1瓶
名称:羽毛球,数量:1个
----------------------
总计:21.00(元)
节省:4.00(元)
**********************

如何使用

首先初次下载完需要安装依赖:

  npm install

然后才能执行测试:

  npm start

提交订单,并查看console,可以看到给后端传的具体项目。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.