فهرست منبع

feat(oilPrice): 添加油价查询功能

- 实现了油价查询接口的调用
- 添加了地图展示加油服务网点
- 优化了证书页面的样式
- 新增了电话号码复制功能
wzg 10 ماه پیش
والد
کامیت
40a298bc11

+ 21 - 0
miniprogram/app.wxss

@@ -165,4 +165,25 @@ view {
 
 .ml50 {
   margin-left: 50rpx !important;
+}
+
+
+.title {
+  font-size: 32rpx;
+  font-family: PingFangSC-Medium, PingFang SC;
+  font-weight: 500;
+  color: #0094fe;
+  margin: 20rpx 0 20rpx 0;
+  padding-left: 30rpx;
+}
+
+.th {
+  color: #777;
+}
+
+.tr {
+  color: #333;
+  border-bottom: 1rpx solid #eee;
+  padding-top: 15rpx;
+  padding-bottom: 15rpx;
 }

BIN
miniprogram/images/gas-station.png


+ 10 - 0
miniprogram/pages/cert/cert.js

@@ -67,6 +67,16 @@ Page({
       urls: [e.currentTarget.dataset.url],
     });
   },
+  copy(e) {
+    wx.setClipboardData({
+      data: e.currentTarget.dataset.phone,
+      success(res) {
+        wx.showToast({
+          title: "复制成功",
+        });
+      },
+    });
+  },
 
   onLoad(options) {
     this.getCerts();

+ 3 - 3
miniprogram/pages/cert/cert.wxml

@@ -6,7 +6,7 @@
     <view class="w40p tac">证书名称</view>
     <view class="w40p tac">到期时间</view>
   </view>
-  <view class="df aic jcsb fs28 mt10 tr" wx:for="{{certs}}">
+  <view class="df aic jcsb fs28 mt10 tr" wx:for="{{certs}}" wx:key="index">
     <view class="w20p tac">{{index+1}}</view>
     <view class="w40p tac">{{item.certTypeName}}</view>
     <view class="w40p tac">{{item.endValidTime}}</view>
@@ -29,8 +29,8 @@
   <view class="df aic jcsb fs28 mt10 tr" wx:for="{{contacts}}">
     <view class="w40p tac">{{item.officeName}}</view>
     <view class="w20p tac">{{item.contactPerson}}</view>
-    <view class="w40p tac df aic" bind:tap="makePhoneCall" data-phone="{{item.contactPhone}}">{{item.contactPhone}}
-      <image class="tel ml10" src="../../images/tel.png" mode="aspectFit" />
+    <view class="w40p tac df aic" bind:tap="copy" data-phone="{{item.contactPhone}}">{{item.contactPhone}}
+      <image class="tel ml10" bind:tap="makePhoneCall" data-phone="{{item.contactPhone}}" src="../../images/tel.png" mode="aspectFit" />
     </view>
   </view>
 </view>

+ 2 - 20
miniprogram/pages/cert/cert.wxss

@@ -1,22 +1,4 @@
 /* pages/cert/cert.wxss */
-.title {
-  font-size: 32rpx;
-  font-family: PingFangSC-Medium, PingFang SC;
-  font-weight: 500;
-  color: #0094fe;
-  margin: 20rpx 0 20rpx 0;
-  padding-left: 30rpx;
-}
-
-.th {
-  color: #777;
-}
-
-.tr {
-  color: #333;
-  border-bottom: 1rpx solid #eee;
-  padding-bottom: 10rpx;
-}
 
 .i-img {
   width: 45vw;
@@ -33,6 +15,6 @@
 }
 
 .tel {
-  width: 50rpx;
-  height: 50rpx;
+  width: 60rpx;
+  height: 60rpx;
 }

+ 36 - 60
miniprogram/pages/oilPrice/oilPrice.js

@@ -1,66 +1,42 @@
 // 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();
   },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload() {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh() {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom() {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
-
-  }
-})
+});

+ 15 - 2
miniprogram/pages/oilPrice/oilPrice.wxml

@@ -1,2 +1,15 @@
-<!--pages/oilPrice/oilPrice.wxml-->
-<text>pages/oilPrice/oilPrice.wxml</text>
+<map style="width: 100vw;height: 60vw;" markers="{{oilPriceList}}" longitude="121" latitude="31" />
+
+<view class="title">加油服务</view>
+<view class="pl30 pr30">
+  <view class="df aic fs28 th">
+    <view class="w40p tac">加油服务商</view>
+    <view class="w20p tac">油型号</view>
+    <view class="w40p tac">油价(元/吨)</view>
+  </view>
+  <view class="df aic jcsb fs28 mt10 tr" wx:for="{{oilPriceList}}" wx:key="index">
+    <view class="w40p tac">{{item.vendorName}}</view>
+    <view class="w20p tac"></view>
+    <view class="w40p tac">{{item.price}}</view>
+  </view>
+</view>