Loading…

Product bargaining

# Preface This tutorial is based on the "apifm-wxapi" module and teaches you how to quickly implement small program development, so you may need to understand the following knowledge points first: ["Creating HelloWorld Project"](https://www.yuque.com/apifm/doc/hezlrm) ["Use "apifm-wxapi" to quickly develop small programs"](https://www.yuque.com/apifm/doc/mdldsd) ["Register for free to open the backend and obtain an exclusive domain name"](https://www.yuque.com/apifm/doc/qr6l4m) In this case, some functions require the user to log in before they can be operated, which means token authorization is required. Please understand first: ["WeChat Mini Program login to obtain openid and third-party tokens"](https://www.yuque.com/apifm/doc/kaygbw) The bargaining function in this example requires the support of the product function. How can you bargain without a product, so you must first understand: ["Using apifm-wxapi to develop WeChat Mini Program stores/categories/products/collections"](https://www.yuque.com/apifm/doc/excd2w) # Modules that need to be enabled Log in to the "First Step" registration background, left menu --> Factory settings --> Module management Find and enable the following modules, then press F5 to refresh the background interface. You will be able to see all the function menus required for this case: _The menu in this case is "Marketing Assistance" --> "Bargaining Settings" + "Bargaining Participating User Management" + "Bargaining Details"_ 1. Product bargaining # Set up price bargaining in the background For the selected product, you need to set up the bargaining first: limit the total number of copies, the minimum price, the amount of money that can be discounted each time [range], and the effective time period for bargaining. --- ### Get product bargaining settings ```javascript WXAPI.kanjiaSet(goodsId) ``` > Read the bargain setting information of a certain product: total number of copies, base price, (random) amount that can be discounted each time, and start and end time > > For details, you can go to the backend bargaining setting interface to learn about the setting column. > ### Initiate [Create] price bargaining, and then invite friends to help you bargain for the lowest price ```javascript WXAPI.kanjiaJoin(token, kjid) ``` > Each user can only participate once for the same kjid. Calling this method multiple times will return the last bargaining information. > > If the user is not satisfied with the last bargaining result, he can call the **clear** method below to clear the last bargaining record and initiate a new bargaining process. > ### Details of the bargaining I initiated [Create] ```javascript WXAPI.kanjiaMyJoinInfo(token, kjid) ``` > Check the current progress [progress] of the bargaining initiated by me > > It can also be used as a basis for judging whether to participate in bargaining. > ### Give up the last bargain ```javascript WXAPI.kanjiaClear(token, kjid) ``` > Because each user can only participate in the same kjid once, if the user wants to initiate bargaining again, he must first give up the previous bargaining before proceeding. > > After this operation, you will not be able to find the bargaining record for the current kjid, and the bargaining data will be cleared. You can call the **kanjiaJoin** method again to create a new bargaining > ### Bargain details ```javascript WXAPI.kanjiaDetail(kjid, joiner) ``` > The joiner parameter is the uid of the user who initiated [create] price bargaining. In the above example, joiner = 979527 > > You can check the progress of the bargain created by someone, see how many people participated and how much the current price has been reduced. > ### Help friends bargain ```javascript WXAPI.kanjiaHelp(token, kjid, joiner, remark) ``` > Help friends bargain. After calling this method, the friend's current price will become closer and closer to the reserve price. > > The joiner parameter is the uid of the user who initiated [create] price bargaining. In the above example, joiner = 979527 > > After the lowest price is reduced or the deadline expires, you will no longer be able to help your friends bargain. > ### Check the amount I cut off for my friends ```javascript WXAPI.kanjiaHelpDetail(token, kjid, joiner) ``` > Query the amount I helped cut for the current kjid > > The joiner parameter is the uid of the user who initiated [create] price bargaining. In the above example, joiner = 979527 > _More usage methods about apifm-wxapi: _ ["apifm-wxapi Instructions for Use"](https://github.com/gooking/apifm-wxapi/blob/master/instructions.md) _Download the Demo code of this case: _ ["apifm-wxapi using Demo program"](https://github.com/gooking/apifm-wxapi-demo) Looking forward to your progress! grateful!