Browse Source

修复商城首页默认的是“商城首页”,改为后台小程序名称为标题
修改产品列表页标题为产品列表
修复收货地址标题错别字
修复首页分享显示“小程序”改为显示小程序名称
修复会员详情积分余额数据错误bug
修复会员详情积分记录和余额纪录bug
去掉load授权页面
修复小程序推广二维码页面默认显示CRMEB小程序,改为后台小程序名字
修复推广人订单时间未格式化bug

sugar1569 6 năm trước cách đây
mục cha
commit
af7cfc8967

+ 153 - 24
view/crmebN/app.js

@@ -1,55 +1,184 @@
-//app.js
 var app = getApp();
 // var wxh = require('../../utils/wxh.js');
 App({
-  onLaunch: function () {
+  onLaunch: function (option) {
     // 展示本地存储能力
-    var that = this;
+    var that = this; 
+    if (option.query.hasOwnProperty('scene')) {
+      var sceneCode = option.query.scene.split('-');
+      if (sceneCode.length == 1) { //分享链接进入获取推广人二维码ID
+        that.globalData.spreadid = sceneCode[0];
+      } else if (sceneCode.length == 2) { //扫码进入进入获取推广人二维码ID
+        that.globalData.spreadid = sceneCode[0];
+        if (sceneCode[1]){
+          wx.reLaunch({ url: option.path + '?id=' + sceneCode[1] });
+        } 
+      }
+    }
     var logs = wx.getStorageSync('logs') || []
     logs.unshift(Date.now())
     wx.setStorageSync('logs', logs)
-    that.getRoutineStyle();
+    that.getRoutineConfig();
   },
   globalData: {
-    routineStyle:'#ffffff',
+    config:null,//小程序相关配置
     uid: null,
-    openPages:'',
-    spid:0,
+    uidShare:null,//我的推广二维码ID
+    openid:'',
+    openPages:'',//记录要访问的页面
+    spreadid: 0,//推广人二维码ID 2.5.36
+    spid:0,//推广人二维码ID
     urlImages: '',
-    url: 'https://shop.crmeb.net/'
+    url: 'https://shop.crmeb.net/',
   },
-  getRoutineStyle:function(){
+  //获取小程序配置
+  getRoutineConfig:function(){
     var that = this;
     wx.request({
-      url: that.globalData.url + '/routine/login/get_routine_style',
+      url: that.globalData.url + '/routine/logins/get_routine_config',
       method: 'post',
       dataType  : 'json',
       success: function (res) {
-        that.globalData.routineStyle = res.data.data.routine_style;
-        that.setBarColor();
+        if(res.data.code == 200 ){
+          that.globalData.config = res.data.data.routine_config;
+          that.setBarColor('#FFFFFF');
+        }else{
+          wx.showToast({
+            title: '请求接口错误',
+            icon: 'none',
+            duration: 1500,
+          })
+        }
+      },
+      fail:function(){
+        wx.showToast({
+          title: '配置信息获取失败',
+          icon: 'none',
+          duration: 1500,
+        })
       }
     })
   },
-  setBarColor:function(){
+  setBarColor: function (routine_style = '#FFFFFF'){
     var that = this;
-    wx.setNavigationBarColor({
-      frontColor: '#000000',
-      backgroundColor: that.globalData.routineStyle,
-    })
+      wx.setNavigationBarColor({
+        frontColor: '#000000',
+        backgroundColor: routine_style,
+      })
   },
   setUserInfo : function(){
     var that = this;
-    if (that.globalData.uid == null) {//是否存在用户信息,如果不存在跳转到首页123456
-      wx.showToast({
-        title: '用户信息获取失败!',
-        icon: 'none',
-        duration: 1500,
-      })
+    if (that.globalData.uid == null) {//是否存在用户信息,如果不存在跳转到首页
       setTimeout(function () {
         wx.navigateTo({
-          url: '/pages/load/load',
+          url: '/pages/loading/loading',
         })
       }, 1500)
     }
   },
+  rp: function (n) {
+    var cnum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
+    var s = '';
+    n = '' + n; // 数字转为字符串
+    for (var i = 0; i < n.length; i++) {
+      s += cnum[parseInt(n.charAt(i))];
+    }
+    return s;
+  },
+  U: function (opt) {
+    var m = opt.m || 'routine', c = opt.c || 'auth_api', a = opt.a || 'index', q = opt.q || '',
+      p = opt.p || {}, params = '', gets = '';
+    params = Object.keys(p).map(function (key) {
+      return key + '/' + p[key];
+    }).join('/');
+    gets = Object.keys(q).map(function (key) {
+      return key + '=' + q[key];
+    }).join('&');
+    return this.globalData.url + '/' + m + '/' + c + '/' + a + '/uid/' + this.globalData.uid + (params == '' ? '' : '/' + params) + (gets == '' ? '' : '?' + gets) + '&uid='+this.globalData.uid;
+  },
+  baseGet: function (url, successCallback, errorCallback) {
+    var that = this;
+    var header = {
+      'content-type': 'application/x-www-form-urlencoded'
+    };
+    wx.request({
+      url: url,
+      method: 'get',
+      header: header,
+      success: function (res) {
+        if (res.data.code == 200) {
+          successCallback && successCallback(res.data);
+        } else {
+          errorCallback && errorCallback(res.data);
+          that.Tips({ title: res.data.msg });
+        }
+      }, fail: function (res) {
+        console.log('submit fail');
+      },
+      complete: function (res) {
+
+      }
+    });
+  },
+  Tips: function (opt, to_url) {
+    var title = opt.title || '', icon = opt.icon || 'none', endtime = opt.endtime || 2000;
+    wx.showToast({
+      title: title,
+      icon: 'none',
+      duration: endtime,
+    })
+    if (to_url != undefined) {
+      if (typeof to_url == 'object') {
+        var tab = to_url.tab || 1, url = to_url.url || '';
+        switch (tab) {
+          case 1:
+            //一定时间后跳转至 table
+            setTimeout(function () {
+              wx.switchTab({
+                url: url
+              })
+            }, endtime);
+            break;
+          case 2:
+            //跳转至非table页面
+            setTimeout(function () {
+              wx.navigateTo({
+                url: url,
+              })
+            }, endtime);
+            break;
+          case 3:
+            //返回上页面
+            setTimeout(function () {
+              wx.navigateBack({
+                delta: parseInt(url),
+              })
+            }, endtime);
+            break;
+          case 4:
+            //关闭当前所有页面跳转至非table页面
+            setTimeout(function () {
+              wx.reLaunch({
+                url: url,
+              })
+            }, endtime);
+            break;
+          case 5:
+            //关闭当前页面跳转至非table页面
+            setTimeout(function () {
+              wx.redirectTo({
+                url: url,
+              })
+            }, endtime);
+            break;
+        }
+      } else {
+        setTimeout(function () {
+          wx.navigateTo({
+            url: to_url,
+          })
+        }, endtime);
+      }
+    }
+  },
 })

+ 4 - 4
view/crmebN/app.json

@@ -1,7 +1,7 @@
-  {
-    "pages": [
+{
+  "pages": [
     "pages/loading/loading",
-    "pages/load/load",
+    "pages/sign/sign",
     "pages/login-status/login-status",
     "pages/payment/payment",
     "pages/home/home",
@@ -80,4 +80,4 @@
       }
     ]
   }
-}
+}

BIN
view/crmebN/images/carts.png


BIN
view/crmebN/images/fenlei.png


BIN
view/crmebN/images/sign-bg.jpg


+ 6 - 1
view/crmebN/pages/cash/cash.js

@@ -163,8 +163,13 @@ Page({
         wx.showToast({
           title: res.data.msg,
           icon: 'success',
-          duration: 1500
+          duration: 1000
         })
+        setTimeout(function () {
+          wx.navigateTo({
+            url: "pages/user/user"
+          })
+        }, 1200)
       }
     })
   }

+ 1 - 1
view/crmebN/pages/cash/cash.wxml

@@ -7,7 +7,7 @@
 </view>
     <form bindsubmit="formSubmit">
         <view class='information' hidden='{{_num==0?false:true}}'>
-            <view class='information-li flex'><label>持卡人</label><input type='text' placeholder-class='placeholder' placeholder='某某人' name="name"/></view>
+            <view class='information-li flex'><label>持卡人</label><input type='text' placeholder-class='placeholder' placeholder='真实姓名' name="name"/></view>
             <view class='information-li flex'><label>卡号</label><input type='number' placeholder-class='placeholder' placeholder='请输入银行卡号' name="cardnum"></input></view>
              <view class='information-li flex'><label>提现金额</label><input type='number' placeholder-class='placeholder' placeholder='最低提现金额为{{minmoney}}' name="money"></input></view>
             <view class='information-li flex'>

+ 2 - 18
view/crmebN/pages/coupon-status/coupon-status.json

@@ -1,19 +1,3 @@
-{"navigationBarTitleText": "优惠券",
- "list": [
-  {
-    "term": "满1000元使用",
-    "time": "2017/09/26至2017/10/26使用",
-    "money": "500"
-  },
-  {
-    "term": "满1000元使用",
-    "time": "2017/09/26至2017/10/26使用",
-    "money": "500"
-  },
-  {
-    "term": "满1000元使用",
-    "time": "2017/09/26至2017/10/26使用",
-    "money": "500"
-  }
-]
+{
+  "navigationBarTitleText": "优惠券"
 }

+ 1 - 1
view/crmebN/pages/login-status/login-status.js

@@ -28,7 +28,7 @@ Page({
   getSiteServicePhone:function(){
     var that = this;
     wx.request({
-      url: app.globalData.url + '/routine/login/get_site_service_phone',
+      url: app.globalData.url + '/routine/logins/get_site_service_phone',
       method: 'post',
       dataType  : 'json',
       success: function (res) {

+ 1 - 1
view/crmebN/pages/miao-list/miao-list.wxml

@@ -19,7 +19,7 @@
                 <view class='text-text'>{{item.title}}</view>
                 <view class='flex list-left'>
                     <view>
-                        <view class='text-money'>¥<text class='text-num'>{{item.price}}</text><text class='text-money2'>¥{{item.price}}</text></view>
+                        <view class='text-money'>¥<text class='text-num'>{{item.price}}</text><text class='text-money2'>¥{{item.ot_price}}</text></view>
                         <view class='text-b'>已抢{{item.sales}}{{item.unit_name}}<text class='text-tiao'><text class='tiao-red'></text></text></view>
                     </view>
                     <view class='text-but' hover-class='none'>马上抢</view>

+ 1 - 1
view/crmebN/pages/new-list/new-list.json

@@ -1,3 +1,3 @@
 {
-  "navigationBarTitleText": "咨询列表"
+  "navigationBarTitleText": "资讯列表"
 }

+ 3 - 2
view/crmebN/pages/orders-list/orders-list.wxml

@@ -41,8 +41,9 @@
                   <image src='{{url}}{{item.productInfo.image}}'></image>
                   <view class='item-info flex'>
                     <view class='title'>{{item.productInfo.store_name}}</view>
-                    <view class='res'>{{item.productInfo.store_name}}</view>
-                    <view class='price'><text>¥</text>{{item.productInfo.price}}<text class='count'>X{{item.cart_num}}</text></view>
+                    <view class='res' wx:if="{{item.productInfo.attrInfo}}">{{item.productInfo.attrInfo.suk}}</view>
+          <view class='price' wx:if="{{item.productInfo.attrInfo}}"><text>¥</text>{{item.productInfo.attrInfo.price}}<text class='count'>x{{item.cart_num}}</text></view>
+          <view class='price' wx:else><text>¥</text>{{item.productInfo.price}}<text class='count'>x{{item.cart_num}}</text></view>
                   </view>
                 </view>  
               </view>

+ 1 - 1
view/crmebN/pages/payment/payment.js

@@ -59,7 +59,7 @@ Page({
         var jsConfig = res.data.data;
         if (res.data.code == 200) {
           wx.requestPayment({
-            timeStamp: jsConfig.timeStamp,
+            timeStamp: jsConfig.timestamp,
             nonceStr: jsConfig.nonceStr,
             package: jsConfig.package,
             signType: jsConfig.signType,

+ 35 - 11
view/crmebN/pages/product-countdown/index.js

@@ -29,6 +29,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    app.globalData.openPages = '/pages/product-countdown/index?id=' + options.id + '&scene=' + app.globalData.uid;
     app.setBarColor();
     app.setUserInfo();
     if (options.id){
@@ -89,16 +90,28 @@ Page({
         id: that.data.seckillId
       },
       success: function (res) {
-        console.log(res);
-        that.setData({
-          SeckillList: res.data.data.storeInfo,
-          replyCount: res.data.data.replyCount,
-          reply: res.data.data.reply
-        });
-        var timeStamp = that.data.SeckillList.stop_time;
-        wxh.time(timeStamp, that);
-        WxParse.wxParse('description', 'html', that.data.SeckillList.description, that, 0);
-      }
+        if(res.data.code == 200){
+          that.setData({
+            SeckillList: res.data.data.storeInfo,
+            replyCount: res.data.data.replyCount,
+            reply: res.data.data.reply
+          });
+          var timeStamp = that.data.SeckillList.stop_time;
+          wxh.time(timeStamp, that);
+          WxParse.wxParse('description', 'html', that.data.SeckillList.description, that, 0);
+        }else{
+          if (app.globalData.uid == null) {//是否存在用户信息,如果不存在跳转到首页
+            setTimeout(function () { wx.navigateTo({ url: '/pages/loading/loading' }) }, 1500)
+          } else {
+            wx.showToast({
+              title: res.data.msg,
+              icon: 'none',
+              duration: 1000
+            });
+            setTimeout(function () { wx.navigateBack({}); }, 1200);
+          }
+        }
+       }
     })
   },
   parameterShow: function (e) {
@@ -248,6 +261,17 @@ Page({
    * 用户点击右上角分享
    */
   onShareAppMessage: function () {
-
+    return {
+      title: that.data.productSelect.store_name,
+      path: app.globalData.openPages,
+      // imageUrl: that.data.url + that.data.product.image,
+      success: function () {
+        wx.showToast({
+          title: '分享成功',
+          icon: 'success',
+          duration: 2000
+        })
+      }
+    }
   }
 })

+ 2 - 1
view/crmebN/pages/productSort/productSort.js

@@ -187,7 +187,7 @@ Page({
         for(var i=0;i<len;i++){
             if (arr[i].id == that.data.cid){
                 that.setData({
-                    total: arr[i].cate_name+ '/全部',
+                    total: arr[i].cate_name+ '全部',
                     taber: $taber
                 })
             }
@@ -218,6 +218,7 @@ Page({
             cid: '',
             sid: '',
             hiddendown: true,
+            total: '全部商品'
         })
         that.getProductList();
     },

+ 1 - 1
view/crmebN/pages/productSort/productSort.json

@@ -1 +1 @@
-{"navigationBarTitleText": "分类"}
+{"navigationBarTitleText": "产品列表页"}

+ 6 - 4
view/crmebN/pages/promotion-card/promotion-card.js

@@ -8,7 +8,8 @@ Page({
   data: {
     url: app.globalData.url,
     code:'',
-    userinfo: app.globalData
+    userinfo: [],
+    routine_name: ''
   },
 
   /**
@@ -21,14 +22,15 @@ Page({
     var header = {
       'content-type': 'application/x-www-form-urlencoded',
     };
+    that.setData({
+      routine_name:app.globalData.config.routine_name
+    })
     wx.request({
       url: app.globalData.url + '/routine/auth_api/my?uid=' + app.globalData.uid,
       method: 'POST',
       header: header,
       success: function (res) {
-        console.log(res)
         if (res.data.code == 200) {
-
           that.setData({
             userinfo: res.data.data
           })
@@ -47,7 +49,7 @@ Page({
     };
     var that = this;
     wx.request({
-      url: app.globalData.url + '/routine/auth_api/get_code?uid=' + app.globalData.uid,
+      url: app.globalData.url + '/routine/auth_api/get_routine_code?uid=' + app.globalData.uid,
       method: 'get',
       header: header,
       success: function (res) {

+ 1 - 1
view/crmebN/pages/promotion-card/promotion-card.wxml

@@ -1,7 +1,7 @@
 <view class='promotion-card'>
     <view class='title flex'>
         <view class='line'></view>
-        <view class='name'>推荐小程序</view>
+        <view class='name'>{{routine_name}}</view>
         <view class='line'></view>
     </view>
     <view class='white-bg'>

+ 6 - 1
view/crmebN/pages/promotion-order/promotion-order.js

@@ -1,4 +1,5 @@
 var app = getApp();
+var util = require('../../utils/util.js');
 // pages/promotion-order/promotion-order.js
 Page({
   data: {
@@ -119,8 +120,12 @@ Page({
      header: header,
      success: function (res) { 
        if (res.data.code==200){
+         var data = res.data.data;
+         for (var index in data){
+           data[index].add_time = util.tsFormatTime(data[index].add_time, 'Y-M-D');
+         }
          that.setData({
-           orderlist: res.data.data
+           orderlist: data
          })
        }else{
        that.setData({

+ 4 - 4
view/crmebN/pages/promotion-order/promotion-order.wxml

@@ -28,12 +28,12 @@
             <view class='order-flag'>{{item._status._title}}</view>
         </view>
 
-        <view class='li-item flex' wx:for="{{item.cartInfo}}">
-             <image src='{{url}}{{item.productInfo.image}}'></image>
+        <view class='li-item flex' wx:for="{{item.cartInfo}}" wx:key wx:for-item="itemCart">
+             <image src='{{url}}{{itemCart.productInfo.image}}'></image>
              <view class='item-text'>
-                 <view class='item-title line2'>{{item.productInfo.store_name}}</view>
+                 <view class='item-title line2'>{{itemCart.productInfo.store_name}}</view>
                  <view class='item-time'>下单日期: {{item.add_time}}</view>
-                 <view class='item-money'>¥<text>{{item.productInfo.price}}</text>.00</view>
+                 <view class='item-money'>¥<text>{{itemCart.productInfo.price}}</text></view>
              </view>
         </view>
       

+ 20 - 1
view/crmebN/utils/util.js

@@ -14,6 +14,25 @@ const formatNumber = n => {
   return n[1] ? n : '0' + n
 }
 
+var tsFormatTime = function(timestamp, format) {
+  const formateArr = ['Y', 'M', 'D', 'h', 'm', 's'];
+  let returnArr = [];
+  let date = new Date(timestamp * 1000);
+  let year = date.getFullYear()
+  let month = date.getMonth() + 1
+  let day = date.getDate()
+  let hour = date.getHours()
+  let minute = date.getMinutes()
+  let second = date.getSeconds()
+  returnArr.push(year, month, day, hour, minute, second);
+  returnArr = returnArr.map(formatNumber);
+  for (var i in returnArr) {
+    format = format.replace(formateArr[i], returnArr[i]);
+  }
+  return format;
+
+}
 module.exports = {
-  formatTime: formatTime
+  formatTime: formatTime,
+  tsFormatTime: tsFormatTime,
 }

+ 0 - 4
view/crmebN/utils/wxh.js

@@ -1,5 +1,3 @@
-var URl = 'https://qipei.9gt.net';
-// var apikey = '?appid=21&appkey=zb34e7d15453e97507ef794cf7b051zbefvgfdedfgt'
 //购物车减
 var carmin = function (that){
     var num = that.data.num;
@@ -144,8 +142,6 @@ var tapsize = function(that,e){
   })
 }
 module.exports = {
-  URl: URl,//要引用的函数 xx:xx
-  // apikey: apikey,
   carmin: carmin,
   carjia: carjia,
   time: time,

+ 1 - 0
view/crmebN/wxParse/wxParse.wxss

@@ -97,6 +97,7 @@ view{
 .wxParse-img{
     /*background-color: #efefef;*/
     overflow: hidden;
+    margin-top:-6rpx;
 }
 
 .wxParse-blockquote {