Commit f6ae77815f0c729c92223277e92477ae26656387

Authored by yvan.ni
1 parent 1d0b5d6b

app.js 里面有佣金的统一代码

Showing 1 changed file with 53 additions and 1 deletions
@@ -51,7 +51,7 @@ App({ @@ -51,7 +51,7 @@ App({
51 config: null, //门店参数 51 config: null, //门店参数
52 config2: null, //门店配置 52 config2: null, //门店配置
53 code: null, 53 code: null,
54 - user_id:null,// 6520210,//6520119 qa 4687 6519901 zs 10153869 54 + user_id:null,// qa-6519858,//
55 buy_now: null, 55 buy_now: null,
56 picklist: null, //门店列表 56 picklist: null, //门店列表
57 wuliuprice: null, //物流价格表 57 wuliuprice: null, //物流价格表
@@ -1024,6 +1024,58 @@ App({ @@ -1024,6 +1024,58 @@ App({
1024 if(!this.globalData.scene) return false; 1024 if(!this.globalData.scene) return false;
1025 if(this.globalData.sp_scene.indexOf(this.globalData.scene)==-1) return false; 1025 if(this.globalData.sp_scene.indexOf(this.globalData.scene)==-1) return false;
1026 return true; 1026 return true;
  1027 + },
  1028 +
  1029 + is_distribut:async function (th){
  1030 + var isok=1;
  1031 + var dis=null;
  1032 + await this.promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{
  1033 + dis=rs.data.data;
  1034 + if( dis && dis.switch==0){
  1035 + isok=0;
  1036 + }
  1037 + })
  1038 + if(!isok) return false;
  1039 + await this.promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=2",{}).then(rs=>{
  1040 + if(rs.data.code==0){
  1041 + var arr = rs.data.data.pageData;
  1042 + if (arr.length > 0) {
  1043 + var item=arr[0];
  1044 + if(item.is_sy==0){
  1045 + var now = Date.parse(new Date());now = now / 1000;
  1046 + if(item.end_time<now) {
  1047 + isok=0;
  1048 + }
  1049 + }
  1050 + }else{
  1051 + isok=0;
  1052 + }
  1053 + }
  1054 + })
  1055 + if(!isok) return false;
  1056 + //dis.is_yongjin_dk=1;
  1057 + th.data.dis_config=dis;
  1058 + //如果有开启佣金抵扣
  1059 + if(th.data.dis_config.is_yongjin_dk && this.globalData.userInfo.is_distribut){
  1060 + th.setData({can_commission:1});
  1061 + }
  1062 + },
  1063 +
  1064 + //获取佣金的比例
  1065 + get_commission(first_money,second_money,third_money,th) {
  1066 + if(getApp().globalData.userInfo.is_distribut){
  1067 + var pattern = th.data.dis_config.pattern; // 分销模式
  1068 + var first_rate = th.data.dis_config.first_rate; // 一级比例
  1069 + var second_rate = th.data.dis_config.second_rate; // 二级比例
  1070 + var third_rate = th.data.dis_config.third_rate; // 三级比例
  1071 +
  1072 + if(this.globalData.userInfo.first_leader){
  1073 + return parseFloat(first_money);
  1074 + }else{
  1075 + return parseFloat(first_money)+parseFloat(second_money)+parseFloat(third_money);
  1076 + }
  1077 + }
1027 } 1078 }
1028 1079
  1080 +
1029 }); 1081 });