E-commerce promotion background logic

In the final analysis, the so-called marketing of e-commerce is the change of order amount; If we clearly know the calculation process of order amount, we only need to follow the calculation process of the system for promotion, so we don't have to worry about the overlap or conflict between various promotion types. When we know this relationship, we can divide marketing activities into three types: change commodity price, change commodity subtotal price and change order price, because no matter what marketing can be described as change price in the final analysis.

Any addition, deletion, check and change in the shopping cart must recalculate the promotion, so the calculation of promotion becomes particularly important. It feels that JD has achieved the ultimate promotion.

In terms of mode, our company's promotion is equivalent to JD's self-management, so many of them refer to JD's self-management, but we can't be as powerful as JD's promotion.

Here, we will share with you our promotion, which only involves the logic part of the background interface.

The function of the interface is to enter the commodity list and return the commodity list after promotion grouping.

First of all, I would like to state two points:

1、 It is not a general promotion design, but the promotion design and logic currently supported by our company;

2、 The author's level is limited and he can't draw pictures, so the pictures are ugly and thick. I hope you don't mind;

3、 Don't talk about performance

No more nonsense. Let's officially start...

Promotion type

As mentioned earlier, promotion is to change the price in the final analysis. In our place, the promotion of other single products is to change the commodity price; The conditional promotion is equivalent to changing the subtotal price; As for gift promotion, it is not designed to change the price, which can be considered as a type of single product promotion.

Mainstream process

"The same type is mutually exclusive through entities, and different types can overlap each other." This is the basic principle of designing e-commerce promotion system summarized by others, and I agree with it.

The main process of the above interface is to apply single product promotion first, and then conditional promotion. A little more detail is like this:

First deal with the gift promotion, mount the gift to the main commodity (the commodity in the shopping cart added by the original user, I call it the main commodity), and then apply the single product promotion.

During single product promotion, it is likely that the same commodity will hit multiple single product promotions. Only one promotion can be taken at this time. The calculation logic here is as follows:

For example:

Item a hit four promotions, They are: promotion 1 is reduced by 2 yuan, promotion 2 is reduced by 20%, and promotion 3 is reduced by 1 yuan. Assuming that the original price of a is 10 yuan, then after calculation, promotion 1 is 8 yuan, promotion 2 is 8 yuan, and promotion 3 is 9 yuan. At this time, promotion 3 should be eliminated. Assuming that the creation time of promotion 2 is later than promotion 1, then it should be taken [promotion 2]. That is, product a finally hits [promotion 2]. The original price is 10 yuan and the promotion price is 8 yuan.

Process for calculating commodity price

A little explanation:

Purchase restriction process

Here are two points to note:

Conditional promotion grouping

The same product may hit multiple conditional promotions, and only one conditional promotion can be applied to each product (that is, each product can only belong to one group)

We say that the same type of promotion cannot be superimposed, and different types of promotion can be superimposed. Here, single product promotion and single product promotion cannot be superimposed, conditional promotion and conditional promotion cannot be superimposed, and single product and condition can be superimposed.

This is the end of the program. We have completed the processing of single product promotion. Next, we will deal with conditional promotion. When deciding which conditions should be finally applied to the promotion of goods, our principle is as follows:

1. Give priority to qualified promotions

This sentence means that suppose commodity a, Product B meets the step of [promotion 1] 100 minus 20. At the same time, both a and B hit [promotion 2], but they do not meet the condition of [promotion 2], because it is assumed that the minimum step of [promotion 2] is 150 minus 30. At this time, although both a and B hit [promotion 1] and [promotion 2], a and B meet the requirements together [promotion 1] is 100 minus 20, so promotion a and B should finally take [promotion 2]

2. When multiple promotion conditions are met at the same time, take the one created later (the latest creation time)

As in the above example, suppose that the total amount of a and B is 160 yuan, Then they all meet [promotion 1] and [promotion 2]. Assuming that [promotion 2] is created later, the final hit condition promotion should take [promotion 2]. Moreover, they should be removed from the commodity group of [promotion 1] (PS: because a commodity can only belong to one group, that is, only one conditional promotion can be applied). JD has calculated each promotion here and left the decision of which promotion to use to the user. We don't make it so complicated here.

Having said so much, I may feel a little dizzy. Here is an example

Suppose there are four products a, B, C and D, and promotion 1234 is four promotions

As shown in the figure, [promotion 1] refers to all commodities, and all four a, B, C and d hit [promotion 1]. In other words, there are a, B, C and D in the commodity group of [promotion 1]

There are a and C in the product group of promotion 2

There are a and B in the product group of [promotion 3]

There are a, B and C in the product group of [promotion 4]

Suppose that promotions 1, 2, 3 and 4 are created sequentially, that is, 4 is created the latest and 1 is created the earliest

Suppose again that a + B + C meets one of the ladder conditions of [promotion 4], a + B meets one of the ladder conditions of [promotion 3], and a + B + C + D meets the ladder conditions of the lowest level of [promotion 1]

Then, the final promotion group should be as follows:

The product groups of [promotion 4] are: A, B, C

The commodity group of promotion 3 is empty

The commodity group of promotion 2 is empty

The product group of [promotion 1] includes: D, and it does not meet the lowest ladder, because a + B + C + D used to meet the lowest ladder, but now only D is left. Of course, it does not meet the lowest ladder

Conditional promotion group calculation

In terms of code implementation, there are two layers of loops:

Partial code implementation

The code may be like this. The code snippet of conditional promotion is posted below

Returned data interface

The final return should be a list, and each element in the list represents a conditional promotion (i.e. grouping)

The interface may look like this:

reference resources

http://www.woshipm.com/pd/741573.html

http://www.woshipm.com/pd/594963.html

http://www.woshipm.com/pd/716781.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>