Selaa lähdekoodia

增加支付完成后的公众号引流

Joe 4 vuotta sitten
vanhempi
commit
c46144163d
6 muutettua tiedostoa jossa 28 lisäystä ja 12 poistoa
  1. 2 2
      api/home.js
  2. 0 2
      app.js
  3. 3 2
      app.json
  4. 16 5
      pages/order/success.js
  5. 1 1
      pages/order/success.wxml
  6. 6 0
      project.private.config.json

+ 2 - 2
api/home.js

@@ -30,7 +30,7 @@ const getCustomerGradeList = (params) => mGet("/"+prefix+"/getCustomerGradeList"
 //获取优惠信息-直降、立减、满减方案
 const getCustomerGradeInfo = (params) => mPost("/"+prefix+"/getCustomerGradeInfo", params);
 // 查询用户是否 关注了公众号
-const getOfficialAccounts = (params) => mGet("/" + prefix + "/whetherFollowGzh",params);
+const whetherFollowGzh = (params) => mGet("/" + prefix + "/whetherFollowGzh",params);
 
 
 export {
@@ -44,5 +44,5 @@ export {
   decryptEncryptedData,
   getCustomerGradeList,
   getCustomerGradeInfo,
-  getOfficialAccounts
+  whetherFollowGzh
 };

+ 0 - 2
app.js

@@ -21,12 +21,10 @@ App({
           code: code,
           stationId
         }).then(res => { // handle success
-          console.log(res)
           // console.log("app.js openid:"+res.openid);
           // console.log("app.js unoiid " + res.unionid)
           this.globalData.openId = res.openId;
           this.globalData.unionId = res.unionId;
-          console.log(this.globalData.unionId)
         }).catch(error => { // handle error
           console.log(error);
         })

+ 3 - 2
app.json

@@ -1,11 +1,12 @@
 {
   "pages": [
+    "pages/order/success",
     "pages/gasup/index",
     "pages/logs/logs",
     "pages/orders/myorder",
     "pages/order/create",
-    "pages/order/confirm",
-    "pages/order/success"
+    "pages/order/confirm"
+ 
   ],
   "permission": {
     "scope.userLocation": {

+ 16 - 5
pages/order/success.js

@@ -1,4 +1,4 @@
-import {getOfficialAccounts} from "../../api/home"
+import {whetherFollowGzh} from "../../api/home"
 Page({
   data: {
     iconSize: [20, 30, 40, 50, 60, 70],
@@ -7,16 +7,27 @@ Page({
     ],
     iconType: [
       'success', 'success_no_circle', 'info', 'warn', 'waiting', 'cancel', 'download', 'search', 'clear'
-    ]
+    ],
+    showOfficial:true
   },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
     var app = getApp();
-    console.log(app)
-    getOfficialAccounts({}).then((res)=>{
-      console.log(res)
+    whetherFollowGzh({
+      unionId:app.globalData.unionId,
+      stationId:app.globalData.stationId,
+    }).then((res)=>{
+      // res.retCode
+      //-5 无信息
+      //-4 没关注
+      // 0 关注了
+      if(res.retCode === 0 ){
+        this.setData({
+          showOfficial:false
+        })
+      }
     })
   }
 })

+ 1 - 1
pages/order/success.wxml

@@ -6,6 +6,6 @@
       <view class="icon-box-title">订单支付成功</view>
     </view>
   </view>
-  <view class="text"> 更多活动与优惠,请关注公众号</view>
+  <view class="text"> {{showOfficial ? "关注公众号,获取更多优惠信息" : "更多优惠,尽在我们的公众号"}} </view>
   <official-account class="official"></official-account>
 </view>

+ 6 - 0
project.private.config.json

@@ -17,6 +17,12 @@
           "pathName": "pages/gasup/index",
           "query": "",
           "scene": 1011
+        },
+        {
+          "name": "pages/order/success",
+          "pathName": "pages/order/success",
+          "query": "",
+          "scene": 1011
         }
       ]
     }