store/packageA/member/SupplierCenter/SupplierCenter.js

181 lines
4.2 KiB
JavaScript

// pages/member/SupplierCenter/SupplierCenter.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
language: '',
mainInfo: '',
cost_money: '',
money_total: '',
order_amount: '',
order_count: '',
supplier_id: '',
mid: '',
insuclShow:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
if (options.uid) {
this.setData({
mid: options.uid
});
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
let language = wx.getStorageSync('langIndex');
this.setData({ 'language': language.en});
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this._initData();
this._getSupplierInfo();
this.isShowdetail();
},
isShowdetail(){
let that = this;
let urlStr = app.getNetAddresss("plugin.supplier.frontend.index.policyControl");
app._getNetWork({
url: urlStr,
success: function(resdata) {
var res = resdata.data;
console.log(res);
if (res.result == 1) {
if(res.data == 1){
that.setData({
insuclShow:true
});
}else if(res.data == 0){
that.setData({
insuclShow:false
});
}
} else {
wx.showToast({
icon: 'none',
title: res.msg,
duration: 1500
});
}
},
fail: function(res) {
console.log(res);
}
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {},
onChange(event) {
this.setData({
activeNames: event.detail
});
},
_getSupplierInfo() {
let that = this;
let urlStr = app.getNetAddresss('plugin.supplier.frontend.index.index');
let json = {
member_id: this.data.mid
};
app._postNetWork({
url: urlStr,
showToastIn: false,
data: json,
success: function(resdata) {
var res = resdata.data;
if (res.result == 1) {
that.setData({
supplier_id: res.data.data.supplier_id,
cost_money: res.data.data.cost_money,
money_total: res.data.data.money_total,
order_amount: res.data.data.order_amount,
order_count: res.data.data.order_count,
mainInfo: res.data.data.member_model,
supplierSet:res.data.data.set
});
}
},
fail: function(res) {
wx.showToast({
icon: 'none',
title: res,
duration: 1500
});
}
});
},
goToInfo(e) {
let res = e.currentTarget.dataset.num;
if (res === '1') {
wx.navigateTo({
url: '/packageA/member/supplier/SupInfoManage/SupInfoManage?member_id=' + this.data.mid
});
} else if (res === '2') {
wx.navigateTo({
url: '/packageA/member/supplier/CommodityManagement/CommodityManagement?store_id=' + this.data.supplier_id +
'&store=supplier'
});
} else if (res === '3') {
wx.navigateTo({
url: '/packageA/member/myOrder_v2/myOrder_v2?status=0&orderType=supplier'
});
} else if (res === '4') {
wx.navigateTo({
url: '/packageA/member/presentationRecord_v2/presentationRecord_v2?orderType=supplier&member_id=' + this.data.mid
});
} else if (res === '5') {
wx.navigateTo({
url: '/packageA/member/balance/supplier_withdrawals/supplier_withdrawals?supplier=supplier&member_id=' + this.data
.mid
});
}else if (res === '6') {
wx.navigateTo({
url: '/packageD/warranty/warrantyind/warrantyind'
});
}
},
_initData() {
this.setData({
mainInfo: '',
cost_money: '',
money_total: '',
order_amount: '',
order_count: '',
supplier_id: ''
});
}
});