Loading…

Merchant Delivery Service Plug-in Tutorial

# Enable plugin 1. If you are a free member, it is a pity that you cannot use the plug-in function of apifm for the time being; 2. If you are a professional version member, log in to the backend, go to "Factory settings" --> "Plugin management" on the left menu, find the "Delivery Service" plug-in, and purchase it online to activate it; 3. If you are a value-added member, you don’t need to do anything, you can use all plug-in functions for free; # enable module On the left menu "Factory settings" --> "Module management", find the "Delivery Service" module, enable the module and refresh the page. You will be able to see delivery-related menus in the left menu "Delivery Service". ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1600932887464-c0921b7f-febb-4064-be98-95e1c7742be7.png) # Instructions for use ## Shipping settings ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1600933330043-549d4096-f08d-47cd-b6cc-9cb93d3cc116.png) ### Alert the delivery person when there is a new delivery order + Turn on order grabbing mode + Configure "order grabbing template message number" + "order grabbing template message content" After configuring the above information, if a new delivery order is generated, the delivery person will receive the information reminder and click on the information to quickly enter the mini program (provided that the "mini program page path" is configured)If the delivery person sets an area number, only delivery people in the area (shopIdZt) where the current order is located can receive the message. ### The system automatically dispatches orders If "automatic order dispatch" is turned on and the delivery order is not actively grabbed by a delivery person within a certain period of time, the system will automatically assign the order to other delivery persons who can accept the order. ## Charge delivery fee based on delivery distance If there is such a demand, free delivery within 1 km, a delivery fee of 5 yuan for 1 to 5 kilometers, and a delivery fee of 30 yuan for 5 to 10 kilometers, then how should it be set? ### Create charging rules First, you need to create delivery fee collection rules, as shown below: ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1600933074602-89fa2fd5-db48-498a-bf51-256fcdae77c5.png) ### Front-end display delivery fee Front-end coding calculates the delivery distance based on the user's delivery address and merchant address, and then obtains the matching delivery fee record according to the following front-end interface: ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1598932693443-688d2760-d999-4faa-8d09-86ac95557ea8.png) ["Frontend API docs"](#) Return example: ```json { "code": 0, "data": [ { "dateAdd": "2020-09-01 11:51:08", "distance": 1, "fwf1Min": 0, "fwf1Name": "Basic service fee", "fwf1Number": 0, "fwf1Type": 0, "fwf2Min": 0, "fwf2Name": "Freight", "fwf2Number": 0, "fwf2Type": 0, "id": 143, "userId": 2, "ztDiscounts": 0 }, { "dateAdd": "2020-09-01 11:52:04", "distance": 5, "fwf1Min": 0, "fwf1Name": "Basic service fee", "fwf1Number": 5, "fwf1Type": 0, "fwf2Min": 0, "fwf2Name": "Freight", "fwf2Number": 0, "fwf2Type": 0, "id": 144, "userId": 2, "ztDiscounts": 0 }, { "dateAdd": "2020-09-01 11:52:14", "distance": 10, "fwf1Min": 0, "fwf1Name": "Basic service fee", "fwf1Number": 30, "fwf1Type": 0, "fwf2Min": 0, "fwf2Name": "Freight", "fwf2Number": 0, "fwf2Type": 0, "id": 145, "userId": 2, "ztDiscounts": 0 } ], "msg": "success" } ``` ### Create an order interface to specify service fee rules To create an order interface, you need to add a new parameter: peisongFeeId The value passed is the id field corresponding to the delivery fee rule record read by the interface in the previous step. ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1598932895928-d4b7f86a-06f4-429d-87ac-58e57cc8ed09.png) ## Delivery Personnel Management ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1600933397493-a6a0f70b-87d1-4be5-b39b-e0516b993933.png) ### Working status 0 Available to take orders 1 Resting 2 On the way 3 In service ### Identity type 0 disabled 1 delivery person/rider 2 administrator (can dispatch orders) ### openid settings Ask the delivery person to follow your service account, and you can view the openid of each delivery person. After filling in the openid, order information will be pushed to the delivery person through your service account. ["How to check the openid of a user with a service account"](https://www.yuque.com/apifm/doc/dbtods) ## Order delivery process ###➊Specified orders require delivery If you need to use the delivery process, that is to say, after the user places an order, the system will automatically generate a delivery order, which can then be assigned to the corresponding delivery person for delivery in an automatic/manual/order grabbing manner. Then, you must specify that the order needs to be automatically shipped when creating the order: Create an order interface and specify parameters: autoPeisong = true ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1600934536448-93edee6e-bc9a-4be0-aa78-e184a1e0f43b.png) ###➋The system automatically generates delivery orders If autoPeisong=true is specified when creating an order, the system will automatically create a delivery order in the following steps: + For cash on delivery orders, a delivery order will be created immediately after placing the order + Create a delivery order when the user completes payment + The administrator background setting is to create a delivery order for paid + Administrator uses user balance to pay for orders in the background When the system generates a delivery order, it will also generate and record the order details of the delivery order (when it was created, when the order was received, when delivery was started, when delivery was completed, etc.);At the same time, the mall order status will be set to shipped status.. Therefore, for this type of order, in addition to the status of the mall order, the overall order situation needs to be displayed to the user based on the status of the corresponding delivery order. The order list/order details will return two statuses at the same time: + status -1 Closed order 0 Pending payment 1 Paid and awaiting shipment 2 Shipped and awaiting confirmation 3 Confirmed receipt and awaiting evaluation 4 Evaluated + peisongStatus 1 Waiting for order; 2 Waiting for pickup (meal); 3 Delivery; 4 Completed; 5 Canceled; 6 Reserved; 7 Reserved; 8 Reserved; 9 Returning; 10 Returned; ###➌Notify all delivery persons of new orders According to the new order reminder configuration in "Delivery Settings", the corresponding delivery person is reminded to pick up the order. ### ➍Delivery personnel grab orders When the order grabbing mode is turned on in "Delivery Settings", all orders to be received can be read through the front-end delivery order grab list interface. The delivery staff will consider whether to accept the order based on their actual situation, call the order receiving interface, and complete the order grabbing operation: ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1600938493212-56e23bfb-e837-4c4b-8241-3e7e08a52561.png) ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1600938509436-6f2bfe2f-386a-4dd9-8295-210bdd204497.png) ###➎The system automatically dispatches orders if the order is not grabbed after timeout After turning on automatic order delivery, if the delivery order times out, the system will automatically dispatch the order to the delivery person. ###➏Administrator manually dispatches orders Administrators in delivery person management can manually assign a delivery order to a delivery person. ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1600940282165-7b7a8a22-068b-4fe9-aebc-3c0939d4b538.png) ###➐Delivery service Complete the final delivery service through the corresponding front-end interface ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1600940367487-89e45264-1fca-4718-a9f7-c595bd1c75ff.png) ## Troubleshooting If the order does not generate a delivery note, follow the steps below to troubleshoot: 1. The order interface does not pass the autoPeisong parameter, and this parameter must pass true; 2. Check the store where your product belongs, edit, and see if the longitude and latitude are not filled in, because delivery involves calculating distance and requires longitude and latitude information; 3. When placing an order, did you not enter the longitude and latitude of the delivery address? If the longitude and latitude of the destination were not entered, a delivery order will not be generated;