等风来 7 rokov pred
rodič
commit
74d3f378c2

+ 27 - 45
application/routine/controller/AuthApi.php

@@ -1273,29 +1273,17 @@ class AuthApi extends AuthController{
             ->join('__STORE_ORDER__ B','A.link_id = B.id AND B.uid = '.$uid)->select()->toArray();
         return JsonService::successful($list);
     }
-    /*
-     * 申请提现
-     */
-//    public function user_extract()
-//    {
-//        if(UserExtract::userExtract($this->userInfo,UtilService::postMore([
-//            ['type','','','extract_type'],'real_name','alipay_code','bank_code','bank_address',['price','','','extract_price']
-//        ])))
-//            return JsonService::successful('申请提现成功!');
-//        else
-//            return JsonService::fail(Extract::getErrorInfo());
-//    }
+    
     public function user_extract()
     {   $request = Request::instance();
         $list=$request->param();
         $data=$list['lists'];
-//        dump($data);
-//        dump($this->userInfo);
         if(UserExtract::userExtract($this->userInfo,$data))
             return JsonService::successful('申请提现成功!');
         else
             return JsonService::fail(UserExtract::getErrorInfo());
     }
+
 /*
  * 提现列表
  */
@@ -1315,28 +1303,20 @@ class AuthApi extends AuthController{
      * @param int $first
      * @param int $limit
      */
-    public function subordinateOrderlist($first = 0, $limit = 8)
-    { $request = Request::instance();
+    public function subordinateOrderlist($first = 0, $limit = 8){
+        $request = Request::instance();
         $lists=$request->param();
-        $xuid=$lists['uid'];$status=$lists['status'];
-        if($status==0){
-            $type='';
-        }elseif($status==1){
-            $type=4;
-        }elseif($status==2){
-            $type=3;
-        }else{
-           return false;
-        }
-        if($xuid==0){
-            $arr=User::where('spread_uid',$this->userInfo['uid'])->column('uid');
-            foreach($arr as $v){
-
-                $list = StoreOrder::getUserOrderList($v,$type,$first,$limit);
-            }
-        }else{
-            $list = StoreOrder::getUserOrderList($xuid,$type,$first,$limit);
-        }
+        $xUid = $lists['uid'];
+        $status = $lists['status'];
+        if($status == 0) $type='';
+        elseif($status == 1) $type=4;
+        elseif($status == 2) $type=3;
+        else return false;
+        $list = [];
+        if(!$xUid){
+            $arr = User::where('spread_uid',$this->userInfo['uid'])->column('uid');
+            foreach($arr as $v) $list = StoreOrder::getUserOrderList($v,$type,$first,$limit);
+        }else $list = StoreOrder::getUserOrderList($xUid,$type,$first,$limit);
         foreach ($list as $k=>$order){
             $list[$k] = StoreOrder::tidyOrder($order,true);
             if($list[$k]['_status']['_type'] == 3){
@@ -1354,16 +1334,18 @@ class AuthApi extends AuthController{
      */
     public function subordinateOrderlistmoney()
     {
-        $arr=User::where('spread_uid',$this->userInfo['uid'])->column('uid');
-        foreach($arr as $v){
-            $list = StoreOrder::getUserOrderList($v,$type='');
-        }
-
-        foreach ($list as $k=>$v){
-            $arr[]=$v['pay_price'];
-        }
-        $cont=count($list);
-        $sum=array_sum($arr);
+        $request = Request::instance();
+        $lists=$request->param();
+        $status = $lists['status'];
+        $type = '';
+        if($status == 1) $type = 4;
+        elseif($status == 2) $type = 3;
+        $arr = User::where('spread_uid',$this->userInfo['uid'])->column('uid');
+        $list = StoreOrder::getUserOrderCount(implode(',',$arr),$type);
+        $price = [];
+        foreach ($list as $k=>$v) $price[]=$v['pay_price'];
+        $cont = count($list);
+        $sum = array_sum($price);
         return JsonService::successful(['cont'=>$cont,'sum'=>$sum]);
     }
     /*

+ 11 - 0
application/routine/model/store/StoreOrder.php

@@ -644,6 +644,17 @@ class StoreOrder extends ModelBasic
         return $list;
     }
 
+    /**
+     * 获取推广人地下用户的订单金额
+     * @param string $uid
+     * @param string $status
+     * @return array
+     */
+    public static function getUserOrderCount($uid = '',$status = ''){
+        $res = self::statusByWhere($status)->where('uid','IN',$uid)->column('pay_price');
+        return $res;
+    }
+
     public static function searchUserOrder($uid,$order_id)
     {
         $order = self::where('uid',$uid)->where('order_id',$order_id)->where('is_del',0)->field('seckill_id,bargain_id,combination_id,id,order_id,pay_price,total_num,total_price,pay_postage,total_postage,paid,status,refund_status,pay_type,coupon_price,deduction_price,delivery_type')

+ 8 - 17
application/routine/model/user/UserExtract.php

@@ -38,7 +38,9 @@ class UserExtract extends ModelBasic
     public static function userExtract($userInfo,$data){
         if(!in_array($data['extract_type'],self::$extractType))
             return self::setErrorInfo('提现方式不存在');
-        $balance = bcsub($userInfo['now_money'],$data['money']);
+        $userInfo = User::get($userInfo['uid']);
+        if($data['money'] > $userInfo['now_money']) return self::setErrorInfo('余额不足');;
+        $balance = bcsub($userInfo['now_money'],$data['money'],2);
         $insertData = [
             'uid'=>$userInfo['uid'],
             'extract_type'=>$data['extract_type'],
@@ -84,24 +86,13 @@ class UserExtract extends ModelBasic
         if(!$res1) return self::setErrorInfo('提现失败');
         $res2 = User::edit(['now_money'=>$balance],$userInfo['uid'],'uid');
         $res3 = UserBill::expend('余额提现',$userInfo['uid'],'now_money','extract',$data['money'],$res1['id'],$balance,$mark);
-
         $res = $res2 && $res3;
-//        WechatTemplateService::sendTemplate(
-//            WechatUser::uidToOpenid($userInfo['uid']),
-//            WechatTemplateService::USER_BALANCE_CHANGE,
-//            [
-//                'first'=>'你好,申请余额提现成功!',
-//                'keyword1'=>'余额提现',
-//                'keyword2'=>date('Y-m-d'),
-//                'keyword3'=>$data['money'],
-//                'remark'=>'点击查看我的余额明细'
-//            ],
-//            Url::build('wap/My/balance',[],true,true)
-//            );
-        if($res)
+        self::checkTrans($res);
+        if($res){
+            //发送模板消息
             return true;
-        else
-            return self::setErrorInfo('提现失败!');
+        }
+        else return self::setErrorInfo('提现失败!');
     }
 
     /**

+ 161 - 154
application/routine/view/crmebN/pages/cash/cash.js

@@ -1,163 +1,170 @@
 var app = getApp();
 // pages/cash/cash.js
 Page({
-  data: {
-    ooo:'',
-    _num:0,
-    url: app.globalData.urlImages,
-    hiddentap: true,
-    hidde: true,
-    minmoney:'',
-    money:'',
-    index:0,
-    array:["请选择银行","招商银行","建设银行","农业银行"]
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad:function (opends) {
-    app.setBarColor();
-    var money = opends.money;
-    var that = this;
-    that.setData({
-      money: money
-    })
-    this.getUserExtractBank();
-    wx.request({
-      url: app.globalData.url + '/routine/auth_api/minmoney?uid=' + app.globalData.uid,
-      method: 'POST',
-      success: function (res) {
-        that.setData({
-          minmoney: res.data.msg
+    data: {
+        ooo:'',
+        _num:0,
+        url: app.globalData.urlImages,
+        hiddentap: true,
+        hidde: true,
+        money:'',
+        index:0,
+        array:["请选择银行","招商银行","建设银行","农业银行"]
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad:function (opends) {
+        app.setBarColor();
+        var that = this;
+        this.getUserInfo();
+        this.getUserExtractBank();
+        wx.request({
+            url: app.globalData.url + '/routine/auth_api/minmoney?uid=' + app.globalData.uid,
+            method: 'POST',
+            success: function (res) {
+                that.setData({
+                    minmoney: res.data.msg
+                })
+            }
         })
-      }
-    })
-  },
-  getUserExtractBank:function () {
-    var that = this;
-    wx.request({
-      url: app.globalData.url + '/routine/auth_api/get_user_extract_bank?uid=' + app.globalData.uid,
-      method: 'get',
-      success: function (res) {
-        that.setData({
-          array: res.data.data
+    },
+    getUserInfo:function(){
+        var that = this;
+        wx.request({
+            url: app.globalData.url + '/routine/auth_api/my?uid=' + app.globalData.uid,
+            method: 'POST',
+            success: function (res) {
+                that.setData({
+                    money: res.data.data.now_money
+                })
+            }
         });
-      }
-    });
-  },
-  cardtap:function(e){
-    var flag = this.data.hiddentap;
-    if (flag){
-      this.setData({
-        hiddentap: false
-      })
-    }else{
-      this.setData({
-        hiddentap: true
-      })
-    }  
-  },
-  idnumtap: function (e) {
-    this.setData({
-      _num: e.target.dataset.idnum,
-      hiddentap: true
-    })
-    if (e.target.dataset.idnum==1){
-      this.setData({
-        hidde: false
-      })
-    }else{
-      this.setData({
-        hidde: true
-      })
-    }
-  },
-  maskhide:function(e){
-      this.setData({
-        hiddentap: true
-      })
-  },
-  bindPickerChange:function(e){
-      this.setData({
-        index: e.detail.value
-      })
-  },
-  formSubmit:function(e){
-    var header = {
-      // 'content-type': 'application/x-www-form-urlencoded',
-      'cookie': app.globalData.sessionId//读取cookie
-    };
-    var that = this;
-    var flag = true;
-    var warn = "";
-    var minmon = that.data.minmoney;
-    var mymoney = that.data.money;
-    var list={};
-    if (that.data.hidde==true){
-      list.$name = e.detail.value.name;
-      list.cardnum = e.detail.value.cardnum;
-      list.bankname = that.data.array[that.data.index];
-      list.money = e.detail.value.money;
-      list.money = Number(list.money);
-      list.extract_type = 'bank';
-      if (list.$name == "") {
-        warn = "请填写持卡人姓名";
-      } else if (list.cardnum == "") {
-        warn = "请输入银行卡号";
-      } else if (list.bankname == "请选择银行") {
-        warn = "请选择银行";
-      } else if (list.money < minmon) {
-        warn = "请输入正确的金额"
-      } else if (list.money > mymoney) {
-        warn = "您的余额不足"
-      }else {
-        flag = false;
-      }
-      if (flag == true) {
-        wx.showModal({
-          title: '提示',
-          content: warn
+    },
+    getUserExtractBank:function () {
+        var that = this;
+        wx.request({
+            url: app.globalData.url + '/routine/auth_api/get_user_extract_bank?uid=' + app.globalData.uid,
+            method: 'get',
+            success: function (res) {
+                that.setData({
+                    array: res.data.data
+                });
+            }
+        });
+    },
+    cardtap:function(e){
+        var flag = this.data.hiddentap;
+        if (flag){
+            this.setData({
+                hiddentap: false
+            })
+        }else{
+            this.setData({
+                hiddentap: true
+            })
+        }
+    },
+    idnumtap: function (e) {
+        this.setData({
+            _num: e.target.dataset.idnum,
+            hiddentap: true
         })
-      }
-    } else {
-      list.weixin = e.detail.value.weixin;
-      list.money = e.detail.value.wmoney;
-      list.money = Number(list.money);
-      list.extract_type = 'weixin';
-      if (list.weixin == "") {
-        warn = "请填写微信号";
-      } else if (list.money < minmon) {
-        warn = "请输入正确的金额"
-      } else if (list.money > mymoney) {
-        warn = "您的余额不足"
-      } else {
-        flag = false;
-      }
-      if (flag == true) {
-        wx.showModal({
-          title: '提示',
-          content: warn
+        if (e.target.dataset.idnum==1){
+            this.setData({
+                hidde: false
+            })
+        }else{
+            this.setData({
+                hidde: true
+            })
+        }
+    },
+    maskhide:function(e){
+        this.setData({
+            hiddentap: true
         })
-      }
-    }
-    wx.request({
-      url: app.globalData.url + '/routine/auth_api/user_extract?uid=' + app.globalData.uid,
-      data: { lists: list},
-      method: 'POST',
-      header: header,
-      success: function (res) {
-        // console.log(res);
-        wx.showToast({
-          title: res.data.msg,
-          icon: 'success',
-          duration: 1500
+    },
+    bindPickerChange:function(e){
+        this.setData({
+            index: e.detail.value
         })
-        // that.setData({
-        //   mainArray: res.data.data
-        // })
-      }
-    })
-  }
-
-
+    },
+    formSubmit:function(e){
+        var header = {
+            // 'content-type': 'application/x-www-form-urlencoded',
+            'cookie': app.globalData.sessionId//读取cookie
+        };
+        var that = this;
+        var flag = true;
+        var warn = "";
+        var minmon = that.data.minmoney;
+        var mymoney = that.data.money;
+        var list={};
+        if (that.data.hidde==true){
+            list.$name = e.detail.value.name;
+            list.cardnum = e.detail.value.cardnum;
+            list.bankname = that.data.array[that.data.index];
+            list.money = e.detail.value.money;
+            list.money = Number(list.money);
+            list.extract_type = 'bank';
+            if (list.$name == "") {
+                warn = "请填写持卡人姓名";
+            } else if (list.cardnum == "") {
+                warn = "请输入银行卡号";
+            } else if (list.bankname == "请选择银行") {
+                warn = "请选择银行";
+            } else if (list.money < minmon) {
+                warn = "请输入正确的金额"
+            } else if (list.money > mymoney) {
+                warn = "您的余额不足"
+            }else {
+                flag = false;
+            }
+            if (flag == true) {
+                wx.showModal({
+                    title: '提示',
+                    content: warn
+                })
+                return false;
+            }
+        } else {
+            list.weixin = e.detail.value.weixin;
+            list.money = e.detail.value.wmoney;
+            list.money = Number(list.money);
+            list.extract_type = 'weixin';
+            if (list.weixin == "") {
+                warn = "请填写微信号";
+            } else if (list.money < minmon) {
+                warn = "请输入正确的金额"
+            } else if (list.money > mymoney) {
+                warn = "您的余额不足"
+            } else {
+                flag = false;
+            }
+            if (flag == true) {
+                wx.showModal({
+                    title: '提示',
+                    content: warn
+                })
+                return false;
+            }
+        }
+        wx.request({
+            url: app.globalData.url + '/routine/auth_api/user_extract?uid=' + app.globalData.uid,
+            data: { lists: list},
+            method: 'POST',
+            header: header,
+            success: function (res) {
+                that.setData({
+                    money: (that.data.money - list.money).toFixed(2)
+                })
+                wx.showToast({
+                    title: res.data.msg,
+                    icon: 'success',
+                    duration: 1500
+                })
+            }
+        })
+    }
 })

+ 236 - 227
application/routine/view/crmebN/pages/comment-con/comment-con.js

@@ -2,244 +2,253 @@
 var app = getApp();
 var wxh = require('../../utils/wxh.js');
 Page({
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    xinghidden:true,
-    xinghidden2:true,
-    xinghidden3: true,
-    url: app.globalData.urlImages,
-    hidden:false,
-    unique:'',
-    uni:'',
-    dataimg:[]
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (e) {
-    app.setBarColor();
-    var header = {
-      'content-type': 'application/x-www-form-urlencoded'
-    };
-    var that = this;
-    console.log(e);
-    if (e.unique) {
-      var unique = e.unique;
-      that.setData({
-        unique: unique,
-      });
-    }
-    if (e.uni){
-      that.setData({
-        uni: e.uni
-      });
-    }
-    wx.showLoading({ title: "正在加载中……" });
-    wx.request({
-      url: app.globalData.url + '/routine/auth_api/get_order_product?uid=' + app.globalData.uid,
-      data: { unique: unique},
-      method: 'get',
-      header: header,
-      success: function (res) {
-        wx.hideLoading();
-        that.setData({
-          ordercon: res.data.data
-        });
-      },
-      fail: function (res) {
-        console.log('submit fail');
-      },
-      complete: function (res) {
-        console.log('submit complete');
-      }
-    });
-  },
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-  
-  },
-  tapxing:function(e){
-    var index = e.target.dataset.index;
-    this.setData({
-      xinghidden: false,
-      xing: index
-    })
-  },
-  tapxing2: function (e) {
-    var index = e.target.dataset.index;
-    this.setData({
-      xinghidden2: false,
-      xing2: index
-    })
-  },
-  tapxing3: function (e) {
-    var index = e.target.dataset.index;
-    this.setData({
-      xinghidden3: false,
-      xing3: index
-    })
-  },
-  uploadpic:function(e){
-    var that = this;
-    wx.chooseImage({
-      count: 1,  //最多可以选择的图片总数  
-      sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有  
-      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有  
-      success: function (res) {
-        // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片  
-        var tempFilePaths = res.tempFilePaths;
-        //启动上传等待中...  
-        wx.showLoading({
-          title: '图片上传中',
-        })
-        console.log(tempFilePaths);
-        var len = tempFilePaths.length;
-        for (var i = 0; i < len; i++) {
-          wx.uploadFile({
-            url: app.globalData.url + '/routine/auth_api/upload?uid=' + app.globalData.uid,
-            filePath: tempFilePaths[i],
-            name: 'pics',
-            formData: {
-              'filename': 'pics'
-            },
-            header: {
-              "Content-Type": "multipart/form-data"
-            },
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        xinghidden:true,
+        xinghidden2:true,
+        xinghidden3: true,
+        url: '',
+        hidden:false,
+        unique:'',
+        uni:'',
+        dataimg:[]
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (e) {
+        app.setBarColor();
+        var header = {
+            'content-type': 'application/x-www-form-urlencoded'
+        };
+        var that = this;
+        console.log(e);
+        if (e.unique) {
+            var unique = e.unique;
+            that.setData({
+                unique: unique,
+            });
+        }
+        if (e.uni){
+            that.setData({
+                uni: e.uni
+            });
+        }
+        wx.showLoading({ title: "正在加载中……" });
+        wx.request({
+            url: app.globalData.url + '/routine/auth_api/get_order_product?uid=' + app.globalData.uid,
+            data: { unique: unique},
+            method: 'get',
+            header: header,
             success: function (res) {
-              wx.hideLoading();
-              console.log(res);
-              if(res.statusCode == 403){
-                   wx.showToast({
-                     title: res.data,
-                     icon: 'none',
-                     duration: 1500,
-                   })
-              } else {
-                var data = JSON.parse(res.data);
-                that.data.dataimg.push(data);
+                wx.hideLoading();
                 that.setData({
-                  dataimg: that.data.dataimg
+                    ordercon: res.data.data
                 });
-                var len2 = that.data.dataimg.length;
-                if (len2 >= 8) {
-                  that.setData({
-                    hidden: true
-                  });
-                }
-              }
             },
             fail: function (res) {
-              wx.showToast({
-                title: '上传图片失败',
+                console.log('submit fail');
+            },
+            complete: function (res) {
+                console.log('submit complete');
+            }
+        });
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+    tapxing:function(e){
+        var index = e.target.dataset.index;
+        this.setData({
+            xinghidden: false,
+            xing: index
+        })
+    },
+    tapxing2: function (e) {
+        var index = e.target.dataset.index;
+        this.setData({
+            xinghidden2: false,
+            xing2: index
+        })
+    },
+    tapxing3: function (e) {
+        var index = e.target.dataset.index;
+        this.setData({
+            xinghidden3: false,
+            xing3: index
+        })
+    },
+    delImages:function(e){
+        var that = this;
+        var dataimg = that.data.dataimg;
+        var index = e.currentTarget.dataset.id;
+        dataimg.splice(index,1);
+        that.setData({
+            dataimg: dataimg
+        })
+
+    },
+    uploadpic:function(e){
+        var that = this;
+        wx.chooseImage({
+            count: 1,  //最多可以选择的图片总数
+            sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
+            sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
+            success: function (res) {
+                // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
+                var tempFilePaths = res.tempFilePaths;
+                //启动上传等待中...
+                wx.showLoading({
+                    title: '图片上传中',
+                })
+                var len = tempFilePaths.length;
+                for (var i = 0; i < len; i++) {
+                    wx.uploadFile({
+                        url: app.globalData.url + '/routine/auth_api/upload?uid=' + app.globalData.uid,
+                        filePath: tempFilePaths[i],
+                        name: 'pics',
+                        formData: {
+                            'filename': 'pics'
+                        },
+                        header: {
+                            "Content-Type": "multipart/form-data"
+                        },
+                        success: function (res) {
+                            wx.hideLoading();
+                            if(res.statusCode == 403){
+                                wx.showToast({
+                                    title: res.data,
+                                    icon: 'none',
+                                    duration: 1500,
+                                })
+                            } else {
+                                var data = JSON.parse(res.data);
+                                data.data.url = app.globalData.url + data.data.url;
+                                that.data.dataimg.push(data);
+                                that.setData({
+                                    dataimg: that.data.dataimg
+                                });
+                                var len2 = that.data.dataimg.length;
+                                if (len2 >= 8) {
+                                    that.setData({
+                                        hidden: true
+                                    });
+                                }
+                            }
+                        },
+                        fail: function (res) {
+                            wx.showToast({
+                                title: '上传图片失败',
+                                icon: 'none',
+                                duration: 2000
+                            })
+                        }
+                    });
+                }
+            }
+        });
+    },
+    formSubmit:function(e){
+        var header = {
+            'content-type': 'application/x-www-form-urlencoded'
+        };
+        var that = this;
+        var unique = that.data.unique;
+        var comment = e.detail.value.comment;
+        var product_score = that.data.xing;
+        var service_score = that.data.xing2;
+        var pics = [];
+        var dataimg = that.data.dataimg;
+        for (var i = 0; i < dataimg.length;i++){
+            pics.push(that.data.url+dataimg[i].data.url)
+        };
+        if (comment==""){
+            wx.showToast({
+                title: '请填写你对宝贝的心得!',
                 icon: 'none',
                 duration: 2000
-              })
-            }
-          });
-        }
-      }
-    });  
-  },
-  formSubmit:function(e){
-    var header = {
-      'content-type': 'application/x-www-form-urlencoded'
-    };
-    var that = this;
-    var unique = that.data.unique;
-    var comment = e.detail.value.comment;
-    var product_score = that.data.xing;
-    var service_score = that.data.xing2;
-    var pics = []; 
-    var dataimg = that.data.dataimg;
-    for (var i = 0; i < dataimg.length;i++){
-      pics.push(that.data.url+dataimg[i].data.url)
-    };
-    if (comment==""){
-      wx.showToast({
-        title: '请填写你对宝贝的心得!',
-        icon: 'none',
-        duration: 2000
-      })
-      return false;
-    }
-    wx.showLoading({ title: "正在发布评论……" });
-    wx.request({
-      url: app.globalData.url + '/routine/auth_api/user_comment_product?uid=' + app.globalData.uid+'&unique=' + unique,
-      data: {comment: comment, product_score: product_score, service_score: service_score, pics: pics},
-      method: 'post',
-      header: header,
-      success: function (res) {
-        wx.hideLoading();
-        if (res.data.code==200){
-          wx.showToast({
-            title: '评价成功',
-            icon: 'success',
-            duration: 1000
-          })
-          setTimeout(function(){
-             wx.navigateTo({
-               url: '/pages/orders-con/orders-con?order_id='+that.data.uni,
-             })
-          },1200)
-        }else{
-          wx.showToast({
-            title: res.data.msg,
-            icon: 'none',
-            duration: 2000
-          })
+            })
+            return false;
         }
-      },
-      fail: function (res) {
-        console.log('submit fail');
-      },
-      complete: function (res) {
-        console.log('submit complete');
-      }
-    });
-  },
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-  
-  },
+        wx.showLoading({ title: "正在发布评论……" });
+        wx.request({
+            url: app.globalData.url + '/routine/auth_api/user_comment_product?uid=' + app.globalData.uid+'&unique=' + unique,
+            data: {comment: comment, product_score: product_score, service_score: service_score, pics: pics},
+            method: 'post',
+            header: header,
+            success: function (res) {
+                wx.hideLoading();
+                if (res.data.code==200){
+                    wx.showToast({
+                        title: '评价成功',
+                        icon: 'success',
+                        duration: 1000
+                    })
+                    setTimeout(function(){
+                        wx.navigateTo({
+                            url: '/pages/orders-con/orders-con?order_id='+that.data.uni,
+                        })
+                    },1200)
+                }else{
+                    wx.showToast({
+                        title: res.data.msg,
+                        icon: 'none',
+                        duration: 2000
+                    })
+                }
+            },
+            fail: function (res) {
+                console.log('submit fail');
+            },
+            complete: function (res) {
+                console.log('submit complete');
+            }
+        });
+    },
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
 
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-  
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-  
-  },
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
 
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-  
-  },
+    },
 
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-  
-  },
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-  
-  }
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
 })

+ 144 - 144
application/routine/view/crmebN/pages/promotion-order/promotion-order.js

@@ -1,154 +1,154 @@
 var app = getApp();
 // pages/promotion-order/promotion-order.js
 Page({
-  data: {
-    url: app.globalData.urlImages,
-    currentTab:"",
-    hiddens:true,
-    icondui:0,
-    icondui2: 0,
-    alloeder: ['全部订单', '已评价', '已发货'],
-    allOrder:"全部订单",
-    promoter:"推广粉丝",
-    promoterList: [],
-    orderlist:[],
-    orderconut:'',
-    ordermoney:''
-  },
+    data: {
+        url: app.globalData.urlImages,
+        currentTab:"",
+        hiddens:true,
+        icondui:0,
+        icondui2: 0,
+        alloeder: ['全部订单', '已评价', '已发货'],
+        allOrder:"全部订单",
+        promoter:"推广粉丝",
+        promoterList: [],
+        orderlist:[],
+        orderconut:'',
+        ordermoney:''
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        app.setBarColor();
+        app.setUserInfo();
+        var header = {
+            'content-type': 'application/x-www-form-urlencoded',
+        };
+        this.orderlist();
+        this.extension(header);
+        this.orderlistmoney();
+
+    },
+    extension: function (header){
+        var that = this;
+        wx.request({
+            url: app.globalData.url + '/routine/auth_api/get_spread_list?uid=' + app.globalData.uid,
+            method: 'POST',
+            header: header,
+            success: function (res) {
+                // console.log(res.data.data);
+                if (res.data.code==200){
+                    that.setData({
+                        promoterList: res.data.data.list
+                    })
+                }else{
+                    that.setData({
+                        promoterList: []
+                    })
+                }
+            }
+        });
+    },
+    spread: function () {
+        wx.navigateTo({
+            url: '../../pages/spread/spread',
+            success: function (res) { },
+            fail: function (res) { },
+            complete: function (res) { },
+        })
+    },
+
+    ordertap:function(e){
+        var currentTab = e.target.dataset.index;
+        this.setData({
+            currentTab:currentTab,
+            hiddens:false
+        })
+        console.log(this.data.currentTab)
+    },
+    icondui:function(e){
+        var that=this;
+        var icondui = e.target.dataset.ider;
 
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    app.setBarColor();
-    app.setUserInfo();
-    var header = {
-      'content-type': 'application/x-www-form-urlencoded',
-    };
-    this.orderlist();
-    this.extension(header);
-    this.orderlistmoney();
-    
-  },
-  extension: function (header){
-    var that = this;
-    wx.request({
-      url: app.globalData.url + '/routine/auth_api/get_spread_list?uid=' + app.globalData.uid,
-      method: 'POST',
-      header: header,
-      success: function (res) {
-        // console.log(res.data.data);
-        if (res.data.code==200){
-          that.setData({
-            promoterList: res.data.data.list
-          })
-        }else{
         that.setData({
-          promoterList: []
+            icondui: icondui,
+            hiddens: true,
+            allOrder: that.data.alloeder[icondui],
+            currentTab: -1
         })
+        that.orderlist();
+        this.orderlistmoney();
+    },
+    icondui2:function(e){
+        var that = this;
+        var icondui2 = e.target.dataset.ider;
+        var promoterLists = that.data.promoterList;
+        var len = promoterLists.length;
+        for (var index in promoterLists){
+            if (promoterLists[index]['uid'] == icondui2){
+                var promoter = promoterLists[index]['nickname'];
+            }
         }
-      }
-    });
-  },
-  spread: function () {
-    wx.navigateTo({
-      url: '../../pages/spread/spread',
-      success: function (res) { },
-      fail: function (res) { },
-      complete: function (res) { },
-    })
-  },
- 
-  ordertap:function(e){
-    var currentTab = e.target.dataset.index;
-    this.setData({
-     currentTab:currentTab,
-     hiddens:false
-    })
-    console.log(this.data.currentTab)
-  },
-  icondui:function(e){
-    var that=this;
-    var icondui = e.target.dataset.ider;
 
-    that.setData({
-      icondui: icondui,
-      hiddens: true,
-      allOrder: that.data.alloeder[icondui],
-      currentTab: -1
-    })
-    that.orderlist();
-  },
-  icondui2:function(e){
-    var that = this;
-    var icondui2 = e.target.dataset.ider;
-    var promoterLists = that.data.promoterList;
-    var len = promoterLists.length;
-    for (var index in promoterLists){
-      if (promoterLists[index]['uid'] == icondui2){
-        var promoter = promoterLists[index]['nickname'];
-      }
+        that.setData({
+            icondui2: icondui2,
+            hiddens: true,
+            promoter: promoter,
+            currentTab: -1
+        })
+        that.orderlist();
+    },
+    zhaoguan:function(e){
+        this.setData({
+            hiddens: true,
+            currentTab: -1
+        })
+    },
+    orderlist: function (){
+        var header = {
+            'content-type': 'application/x-www-form-urlencoded',
+        };
+        var that = this;
+        var icondui = that.data.icondui;
+        var icondui2 = that.data.icondui2;
+        wx.request({
+            url: app.globalData.url + '/routine/auth_api/subordinateOrderlist?uid=' + app.globalData.uid,
+            data: { uid: icondui2, status: icondui},
+            method: 'POST',
+            header: header,
+            success: function (res) {
+                if (res.data.code==200){
+                    that.setData({
+                        orderlist: res.data.data
+                    })
+                }else{
+                    that.setData({
+                        orderlist: []
+                    })
+                }
+            }
+        })
+    },
+    orderlistmoney: function () {
+        var that = this;
+        wx.request({
+            url: app.globalData.url + '/routine/auth_api/subordinateOrderlistmoney?uid=' + app.globalData.uid,
+            data: { status: that.data.icondui},
+            method: 'POST',
+            success: function (res) {
+                if (res.data.code == 200) {
+                    that.setData({
+                        ordermoney: res.data.data.sum,
+                        orderconut: res.data.data.cont
+                    })
+                } else {
+                    that.setData({
+                        ordermoney:'',
+                        orderconut:''
+                    })
+                }
+            }
+        })
     }
-
-    that.setData({
-      icondui2: icondui2,
-      hiddens: true,
-      promoter: promoter,
-      currentTab: -1
-    })
-    that.orderlist();
-  },
-  zhaoguan:function(e){
-    this.setData({
-      hiddens: true,
-      currentTab: -1
-    })
-  },
-  orderlist: function (){
-    var header = {
-      'content-type': 'application/x-www-form-urlencoded',
-    };
-   var that = this;
-   var icondui = that.data.icondui;
-   var icondui2 = that.data.icondui2;
-   wx.request({
-     url: app.globalData.url + '/routine/auth_api/subordinateOrderlist?uid=' + app.globalData.uid,
-     data: { uid: icondui2, status: icondui},
-     method: 'POST',
-     header: header,
-     success: function (res) { 
-       if (res.data.code==200){
-         that.setData({
-           orderlist: res.data.data
-         })
-       }else{
-       that.setData({
-         orderlist: []
-       })
-       }
-     }
-   })
- },
-  orderlistmoney: function () {
-    var that = this;
-    wx.request({
-      url: app.globalData.url + '/routine/auth_api/subordinateOrderlistmoney?uid=' + app.globalData.uid,
-      data: { uid: 0, status: 0 },
-      method: 'POST',
-      success: function (res) {
-        if (res.data.code == 200) {
-          that.setData({
-            ordermoney: res.data.data.sum,
-            orderconut: res.data.data.cont
-          })
-        } else {
-          that.setData({
-            ordermoney:'',
-            orderconut:''
-          })
-        }
-      }
-    })
-  }
-  
 })