소스 검색

修正前存档

Joe 4 년 전
부모
커밋
16aad8555e
6개의 변경된 파일68개의 추가작업 그리고 46개의 파일을 삭제
  1. 7 3
      api/home.js
  2. 1 1
      pages/order/confirm.js
  3. 43 32
      pages/order/create.js
  4. 4 4
      pages/order/create.wxml
  5. 3 0
      pages/order/create.wxss
  6. 10 6
      setting.js

+ 7 - 3
api/home.js

@@ -31,8 +31,10 @@ const getCustomerGradeList = (params) => mGet("/"+prefix+"/getCustomerGradeList"
 const getCustomerGradeInfo = (params) => mPost("/"+prefix+"/getCustomerGradeInfo", params);
 // 查询用户是否 关注了公众号
 const whetherFollowGzh = (params) => mGet("/" + prefix + "/whetherFollowGzh",params);
-
-
+// 查询加油界面的图片列表
+const getStationPicList = (params) => mGet("/" + prefix + "/getStationPicList",params);
+// 查询加油的提示信息
+const getStationNoticeInfo = (params) => mGet("/" + prefix + "/getStationNoticeInfo",params);
 export {
   getStationList,
   getOilGunList,
@@ -44,5 +46,7 @@ export {
   decryptEncryptedData,
   getCustomerGradeList,
   getCustomerGradeInfo,
-  whetherFollowGzh
+  whetherFollowGzh,
+  getStationPicList,
+  getStationNoticeInfo
 };

+ 1 - 1
pages/order/confirm.js

@@ -220,7 +220,7 @@ Page({
           "userType": "2"
         }).then(res => { // handle success
           //判断封装接口请求成功
-          if (res.retCode == 0) {
+          if (res.retCode === 0) {
             //判断随行付支付网关是否请求成功
             if (res.data.code == '0000') {
               let timeStamp = res.data.respData.payTimeStamp;

+ 43 - 32
pages/order/create.js

@@ -1,13 +1,19 @@
 // pages/order/index.js
 import Toast from '@vant/weapp/toast/toast';
-import { isDemo } from '../../setting'
+import {
+  isDemo,
+  stationId
+} from '../../setting'
+
 import {
   getOilGunList,
   postOrderInfo,
   saveAppUserInfo,
   getMpOpenId,
   decryptEncryptedData,
-  getCustomerGradeInfo
+  getCustomerGradeInfo,
+  getStationPicList,
+  getStationNoticeInfo
 } from "../../api/home"
 
 const app = getApp();
@@ -42,17 +48,18 @@ Page({
     iconType: [
       'success', 'success_no_circle', 'info', 'warn', 'waiting', 'cancel', 'download', 'search', 'clear'
     ],
+    notice: ""
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    this.init()
+
     var userInfoValue = wx.getStorageSync('userInfo')
     try {
       if (userInfoValue) {
-        // Do something with return value
-        // console.log("本地缓存中的userInfo:" + userInfoValue);
         try {
           var mobileValue = wx.getStorageSync('mobilePhone')
           if (mobileValue) {
@@ -71,25 +78,35 @@ Page({
     } catch (e) {
       // Do something when catch error
     }
-    // console.log(options)
-    // if (options.q) {
-    //   let scan_url = decodeURIComponent(options.q);
-    //   app.stationId = this.gup('stationId', scan_url);
-    //   // wx.showToast({
-    //   //   title: 'id1:' +app.stationId
-    //   // })
-    // } else {
-    //   // var stationId = app.stationId;
-    //   // wx.showToast({
-    //   //   title: 'id2:' + stationId
-    //   // })
-    // }
+  },
+
+  init() {
+    // 加载页面所需资源
+    //获取轮播图
+    getStationPicList({
+      stationId: app.globalData.stationId
+    }).then((res) => {
+      this.setData({
+        images: res.data.map((ele) => {
+          return ele.url
+        })
+      })
+    })
+    //获取通知信息
+    getStationNoticeInfo({
+      stationId: app.globalData.stationId
+    }).then((res) => {
+      this.setData({
+        notice: res.data.notice
+      })
+    })
 
     getOilGunList({
       stationId: app.globalData.stationId
     }).then(res => { // handle success 
       // console.log(res.data);
       // res.data.length
+      console.log(res)
       if (res.retCode == 0) {
         var gasArr = [];
         for (let i = 0; i < res.data.length; i++) {
@@ -105,7 +122,9 @@ Page({
     }).catch(error => { // handle error
       console.log(error);
     })
+
   },
+
   gup: function (name, url) {
     if (!url) url = location.href;
     name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
@@ -115,6 +134,7 @@ Page({
     return results == null ? null : results[1];
   },
 
+
   /**
    * 生命周期函数--监听页面显示
    */
@@ -134,7 +154,7 @@ Page({
     let gunNo = event.target.dataset.index;
     let gunName = event.target.dataset.oilname;
     let oilPrice = event.target.dataset.oilprice;
-    let gunType = event.target.dataset.guntype; 
+    let gunType = event.target.dataset.guntype;
     app.oilGunNum = gunNo;
     app.oilGunName = gunName;
     app.oilPrice = oilPrice;
@@ -302,7 +322,7 @@ Page({
                   }
                   /**************计算优惠结束****************/
                   //请求后台创建订单接口,获取订单号
-                  if(isDemo){
+                  if (isDemo) {
                     console.log("演示项目,已经为您修改实收金额");
                     totalMoney = "0.01"
                   }
@@ -340,7 +360,7 @@ Page({
             } else { //非油品订单
               totalMoney = orderAmt;
               youHuiAmount = 0;
-              if(isDemo){
+              if (isDemo) {
                 console.log("演示项目,已经为您修改实收金额");
                 totalMoney = "0.01"
               }
@@ -379,7 +399,6 @@ Page({
           Toast.fail(e);
         }
       } else {
-        // console.log("app.globalData中的userInfo:" + app.globalData.userInfo);
         this.showDialogLogin(); //调用登录弹窗
       }
     } catch (e) {
@@ -420,10 +439,11 @@ Page({
 
   getUserInfo: function (e) {
     let that = this;
-    // console.log(e)
+
     // 获取用户信息
     wx.getSetting({
       success(res) {
+        console.log(res)
         // console.log("res", res)
         if (res.authSetting['scope.userInfo']) {
           // console.log("已授权=====")
@@ -436,10 +456,6 @@ Page({
                 data: res.userInfo,
                 key: 'userInfo',
               })
-              // console.log("minaOpenid:"+app.mpOpenId);
-              // console.log("blogNickName:"+res.userInfo.nickName);
-              // console.log("sexFlag:"+res.userInfo.gender === 1?'M':'F');
-              // console.log("blogProfilePhoto:"+res.userInfo.avatarUrl);
               that.showDialogPhone(); //调用一键获取手机号弹窗
               that.setData({
                 userInfo: res.userInfo,
@@ -496,9 +512,6 @@ Page({
   getPhoneNumber: function (e) {
     let that = this;
     let app = getApp();
-    // console.log(e.detail.errMsg)
-    // console.log("iv:" + e.detail.iv)
-    // console.log("encryptedData:" + e.detail.encryptedData)
     if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
       that.setData({
         showModalPhone: false,
@@ -526,8 +539,6 @@ Page({
               stationId: app.globalData.stationId
             }).then(res => { // handle success 
               // console.log("sessionKey:" + res.session_key);
-              console.log("aaaaaaaaaaaa")
-              console.log(app)
               decryptEncryptedData({
                 sessionKey: res.sessionKey,
                 encryptedData: encryptedData,
@@ -547,7 +558,7 @@ Page({
                   "unionId": app.globalData.unionId
                 }).then(res => { // handle success 
                   // console.log(res.data);
-                  if (res.retCode == 0 || res.retCode == -1) {
+                  if (res.retCode == 0) {
                     // console.log("保存app用户信息成功:"+app.globalData.userInfo);
                     // console.log("保存app用户信息成功。。。");
                     app.globalData.phoneNumber = mobilePhone;

+ 4 - 4
pages/order/create.wxml

@@ -1,10 +1,10 @@
 <!--pages/createorder/index.wxml-->
 <view>
   <swiper indicator-dots="{{true}}" indicator-color="rgba(255,255,255,0.5)" indicator-active-color="#ffffff" autoplay
-    circular interval="5000" class="my-swipe" centeredSlides="true" autoHeight="true">
+    circular interval="4000" class="my-swipe" centeredSlides="true" autoHeight="true">
     <block wx:for="{{images}}" wx:key="index">
-      <swiper-item>
-        <image src="{{item}}" class="img" mode="aspectFill" data-previewurl='{{images}}' data-currenturl='{{item}}'>
+      <swiper-item class="item">
+        <image src="{{item}}" class="img" mode="scaleToFill" data-previewurl='{{images}}' data-currenturl='{{item}}'>
         </image>
       </swiper-item>
     </block>
@@ -15,7 +15,7 @@
       <text class="small2" wx:if="{{gas == 0}}">选择所加油枪号</text>
       <text class="span" bindtap="clickMore">更多></text>
     </view>
-    <van-notice-bar left-icon="volume-o" text="92#:最高优惠¥1.5/L  95#:最高优惠¥1.3/L"></van-notice-bar>
+    <van-notice-bar left-icon="volume-o" text="{{notice}}"></van-notice-bar>
     <van-row gutter="10">
       <van-col span="8" wx:for="{{gasarr}}" wx:key="index" class="gas">
         <van-button type="{{gas==item.oilGunNo?'primary':'default'}}" block data-index="{{item.oilGunNo}}"

+ 3 - 0
pages/order/create.wxss

@@ -11,8 +11,11 @@
   z-index: 1;
   height: 185px;
 }
+
 .my-swipe .img {
   width: 100%;
+  height:100%;
+  border-radius: 20rpx;
 }
 .wx-swiper-dots {
   margin-bottom: 20px;

+ 10 - 6
setting.js

@@ -1,9 +1,9 @@
 // 接口  定义接口前缀:demo-演示版  api-正式版
 
-// 是否为演示项目
-export const isDemo = true;
-export const showIndex = false;
-export const gasupList = true; 
+
+
+// export const showIndex = false;
+// export const gasupList = true; 
 // 是否开始
 
 // appid
@@ -12,16 +12,20 @@ export const gasupList = true;
 // 智慧油驿站
 // 山东石化879站
 
-
+export const isDemo = true;
 export const prefix='demo';
 export const appId = 'wxe1135cd390b38a54'
 export const stationId = 1
 
-
+// export const isDemo = false;
 // export const prefix='api';
 // export const appId = 'wx5285c34adff1069d'
 // export const  stationId = 5;
 
+// export const isDemo = false;
+// export const prefix='demo';
+// export const appId = 'wx260022ef93ba0148'
+// export const  stationId = 118;