Table of contents
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
Create Now, and add an enumeration item
2 Modify form
After the state is added, we update our form on the registration page,
select our newly added field, select our component, and set the default value. By default, we are waiting for the payment
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
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
the query condition is set to our data identifier equal to
the field to be updated by our baomingid, change the payment status to 2.
During the test, it is found that the type does not match.
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
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
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
and then return to our Payment page, jump to our payment success page after the update is successful
5 final effect
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.