CRMEB/view/crmebN/pages/promotion-order/promotion-order.js
sugar1569 af7cfc8967 修复商城首页默认的是“商城首页”,改为后台小程序名称为标题
修改产品列表页标题为产品列表
修复收货地址标题错别字
修复首页分享显示“小程序”改为显示小程序名称
修复会员详情积分余额数据错误bug
修复会员详情积分记录和余额纪录bug
去掉load授权页面
修复小程序推广二维码页面默认显示CRMEB小程序,改为后台小程序名字
修复推广人订单时间未格式化bug
2019-04-02 17:40:17 +08:00

160 lines
3.8 KiB
JavaScript

var app = getApp();
var util = require('../../utils/util.js');
// 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:''
},
/**
* 生命周期函数--监听页面加载
*/
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;
that.setData({
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'];
}
}
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){
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: 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:''
})
}
}
})
}
})