Browse Source

解决ios登录问题以及商品购买数量增加问题

sharp-agezi 5 years ago
parent
commit
85d3409781
2 changed files with 17 additions and 13 deletions
  1. 10 7
      pages/buy/buy.js
  2. 7 6
      pages/login/login.js

+ 10 - 7
pages/buy/buy.js

@@ -1692,8 +1692,9 @@ Page({
   //绑定加数量事件
   addCount(e) {
     var that = this;
-    var showNum = that.data.showNum;
+    var showNum = that.data.showNum * 1;
     let num = this.data.minNumber;
+    console.log(showNum, num,"showNum")
     if (num >= showNum){
       that.setData({
         hiddenmodal: false,
@@ -1707,6 +1708,7 @@ Page({
       }, 1000)
       return false;
     }else{
+      console.log(num, showNum)
       num++;
       if (num == showNum){
         this.setData({
@@ -1722,13 +1724,13 @@ Page({
 
   //绑定减数量事件
   minusCount(e) {
-    let num = this.data.minNumber;
-    let minnum = this.data.num;
+    let that = this;
+    let num = that.data.minNumber;
+    let minnum = that.data.num;
     if (num <= minnum) {
       that.setData({
         hiddenmodal: false,
         modalCont: '起订量为' + minnum + '件',
-        minNumber: showNum
       })
       setTimeout(function () {
         that.setData({
@@ -1738,7 +1740,7 @@ Page({
       return false;
     }
     num--;
-    this.setData({
+    that.setData({
       "minNumber": num
     })
   },
@@ -1995,7 +1997,7 @@ Page({
     var specifications = this.data.title;
 
     var comGroupId = [];
-
+    console.log(number,"点击购买时获取的数量")
     var styleName1 = '', styleName2 = '', styleName3 = '', styleName4 = '', styleName5 = '';
     var styleId1 = '', styleId2 = '', styleId3 = '', styleId4 = '', styleId5 = '';
 
@@ -2198,7 +2200,7 @@ Page({
       var cyc = that.data.cycle;
       var minNumber = that.data.minNumber;
       var limitNum = that.data.num;//起订量
-
+      console.log("第二次获取", that.data.minNumber)
       var allPrice = parseFloat(that.data.showPrice);//商品总价格【价格 + 礼盒价格】 
       var goodPrice = parseFloat(that.data.showPrice) - parseFloat(that.data.clickBoxPrice);//商品单独的价格
 
@@ -2206,6 +2208,7 @@ Page({
       if (id == 0) {//加入购物车
 
         let num = parseInt(that.data.minNumber);
+        consolle.log("商品数量",num)
         let oldNum = parseInt(that.data.cartNum);
         let newNum = oldNum + num;
         if (newNum > 99) {

+ 7 - 6
pages/login/login.js

@@ -52,8 +52,9 @@ Page({
    * 生命周期函数--监听页面卸载
    */
   onUnload: function (e) {
-    console.log(e,"监听页面卸载")
+    
     if (this.data.back == 2 && this.data.onUnload){ //表示需要返回2级,给首页
+      console.log(e, "监听页面卸载")
       wx.reLaunch({
         url: '/pages/index/index'
       })
@@ -115,7 +116,10 @@ Page({
           })
         } else {
           wx.setStorageSync('channelIdObj', res.data)
-          
+            console.log(that.data.type, "that.data.type")
+            that.setData({
+              onUnload: false, //表示离开,不是返回操作
+            })
             wx.request({
               url: host + '/getMyChannelInfo',
               method: 'get',
@@ -124,10 +128,7 @@ Page({
               },
               success(res) {
                 wx.setStorageSync('channelName', res.data.channel.channelName)
-                console.log(that.data.type, "that.data.type")    
-                that.setData({
-                  onUnload:false, //表示离开,不是返回操作
-                })
+                
                 if(that.data.type ==1){
                   console.log(that.data.url,"that.data.url")              
                     wx.switchTab({