The registration function of the training registration applet is perfect


At present, our registration function has built a basic version. In the future, we need to display the information that the user has registered, and we need to add a status to show whether the user has successfully paid.

1 Modify the data source

Open our registration data source, add a payment status field, select enumeration as the type, click
insert image description here
Create Now, and add an enumeration item
insert image description here

2 Modify form

After the state is added, we update our form on the registration page,
insert image description here
select our newly added field, select our component, and set the default value. By default, we are waiting for the payment
insert image description here
state to be used by the system. There is no need to show it to the user. Switch to the style Tab, hide our components
insert image description here

3 Modify the status when the payment is successful

On the payment page, we modify the status of the data when we click the payment button. First select the data source, and choose the method to update a single item. If
insert image description here
the query condition is set to our data identifier equal to
insert image description here
the field to be updated by our baomingid, change the payment status to 2.
insert image description here
During the test, it is found that the type does not match.
insert image description here
This is because our enumeration value storage is a string, and what we are currently giving is a number type, re-enter it and enclose it in quotation marks
insert image description here

4 Create a registration success page

After we update successfully, we will jump to the successful registration page. We need to create a page first. Click the icon created on the page. The page
insert image description here
insert image description here
will mainly display the prompt message of successful registration. When you click to return to the home page, you can return to the home page. The event settings are as follows
insert image description here
and then return to our Payment page, jump to our payment success page after the update is successful
insert image description here

5 final effect

insert image description here

Summarize

This article mainly introduces the control of data through state. It is still a very common business scenario to set state for data, and modify the state to different values ​​at different stages to facilitate the operation of business processes. Of course, payment is not so simple in reality. Usually, you need to be the main body of the enterprise, open a merchant account, and call WeChat payment.

Fortunately, it is not complicated to develop the payment function of Wechat. You only need to create the API of WeChat payment and call it on the front end. Students who need it can refer to the official document to develop it step by step.

Guess you like

Origin blog.csdn.net/u012877217/article/details/132181041