| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- // pages/oilPrice/oilPrice.js
- import { postApi } from "../../apis/api";
- Page({
- data: {
- oilPriceList: [],
- },
- async getOilPriceList() {
- let { data } = await postApi("/fuel/list", {});
- if (data.status === 0) {
- this.setData({
- oilPriceList: data.result.map((item, index) => {
- return {
- id: index,
- latitude: item.fuelShipLatitude,
- longitude: item.fuelShipLongitude,
- iconPath:
- "https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/miniapp-static%2Fgas-station.png",
- width: 40,
- height: 40,
- ...item,
- callout: {
- content: item.vendorName,
- display: "ALWAYS",
- bgColor: "none",
- },
- };
- }),
- });
- } else {
- this.setData({
- oilPriceList: [],
- });
- wx.showToast({
- title: data.msg,
- icon: "none",
- });
- }
- },
- onLoad(options) {
- this.getOilPriceList();
- },
- });
|