yuminge-app/yun-min-program-plugin-master/packageC/o2o/storeManage/storeManage.js

283 lines
6.9 KiB
JavaScript

// pages/storeManage/storeManage.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
language: "",
store: {
name: "",
thumb: "",
},
store_product_set: false,
income: {
money_total: 0.0,
sure_withdraw_money: 0.0,
},
status:0,
storeManageOpen:true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.checkrouter();
this.getStoreInfo();
this.showCash();
},
checkrouter() {
try {
// 推广中心是否开启该功能,没开启跳转到指定路径
let basic_info = wx.getStorageSync("yz_basic_info");
let stop_info = basic_info.popularize_page.mini.vue_route;
for (let i = 0; i < stop_info.length; i++) {
if (stop_info[i] == "storeManage") {
this.setData({
storeManageOpen:false
});
if(!basic_info.popularize_page.mini.mini_url){
wx.showModal({
content: '未开启推广权限',
showCancel:false,
success:function(res){
if(res.confirm){
wx.navigateBack({
delta: 1
});
}
}
});
}else{
wx.showToast({
title: "未开启推广权限",
duration: 1000,
icon: "none",
success: function () {
setTimeout(() => {
wx.redirectTo({
url: basic_info.popularize_page.mini.mini_url,
});
}, 1000);
},
});
}
console.log(basic_info.popularize_page.mini.mini_url + "跳转的路径");
return;
}
}
} catch (e) {
console.log(e);
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
let language = wx.getStorageSync("langIndex");
this.setData({ language: language.en });
},
getCash(){
wx.navigateTo({
url: '/packageD/buy/myOrder_v2/myOrder_v2?tag=store&isCash=1',
});
},
// 显示续费按钮
showCash() {
let urlStr = app.getNetAddresss(
"plugin.store-cashier.frontend.store.enter.enable"
);
app._getNetWork({
url: urlStr,
success: (resdata)=> {
var res = resdata.data;
if(res.result !=1 ) return app.tips(res.msg);
this.setData({
status:res.data.status
});
}
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
onShareTimeline(){},
goStoreCode(){
wx.navigateTo({
url: "/packageC/o2o/qrCode/qrCode?store_id=" + this.data.store.store_id+'&key=store',
});
},
goqrCode() {
wx.navigateTo({
url: "/packageC/o2o/qrCode/qrCode?store_id=" + this.data.store.store_id,
});
},
gostoreOrderlist() {
wx.navigateTo({
url:
"/packageA/member/myOrder_v2/myOrder_v2?status=0" + "&orderType=store",
});
},
gopresentationRecord() {
wx.navigateTo({
url:
"/packageA/member/presentationRecord_v2/presentationRecord_v2?i=" +
this.data.store.store_id +
"&type=store",
});
},
goCommodityManagement() {
wx.navigateTo({
url:
"/packageA/member/supplier/CommodityManagement/CommodityManagement?store_id=" +
this.data.store.store_id +
"&store=store",
});
},
goGoodsClassify() {
wx.navigateTo({
url:
"/packageC/o2o/GoodsClassify/GoodsClassify?store_id=" +
this.data.store.store_id,
});
// 'GoodsClassify',{store_id: store.store_id}
},
getStoreInfo() {
let that = this;
let urlStr = app.getNetAddresss(
"plugin.store-cashier.frontend.store.center.index.index"
);
app._getNetWork({
url: urlStr,
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
that.setData({
store: res.data.store,
income: res.data.income,
nearby: res.data.nearby,
specify_show: res.data.specify_show,
is_open_code:res.data.is_open_code,
my_store_order:res.data.my_store_order
});
if (res.data.store_product_set == true) {
that.setData({
store_product_set: res.data.store_product_set,
});
}
if(res.data.show_store_balance_award){
that.setData({
show_store_balance_award:res.data.show_store_balance_award
});
}
} else {
if (res.data.url && res.data.url.search('/o2o/storeApply') >= 0) {
wx.redirectTo({
url: '/packageA/member/storeApply/storeApply',
});
return;
}
wx.showToast({
icon: "none",
title: res.msg,
duration: 1500,
});
}
},
fail: function (res) {
console.log(res);
},
});
},
gowithdrawal() {
wx.navigateTo({
url: "/packageA/member/withdrawal/withdrawal",
});
},
// 跳转到优惠券管理
goDiscountsGoods() {
wx.navigateTo({
url:
"/packageB/member/commodity_coupon/commodity_coupon/commodity_coupon",
});
},
// 跳转我的门店
gomyStore() {
if (this.data.specify_show == "1") {
wx.navigateTo({
url:
"/packageC/o2o/o2oStore/o2oStore?store_id=" +
this.data.store.store_id +
"&fromHome=1",
});
} else {
wx.navigateTo({
url:
"/packageC/o2o/HomeSeller/HomeSeller?store_id=" +
this.data.store.store_id,
});
}
},
gotoStoreGroup(e) {
let key = e.currentTarget.dataset.key;
if(key == 'storeBalance'){
wx.navigateTo({
url:'/packageA/member/presentationRecord_v2/presentationRecord_v2?orderType='+key,
});
}else{
wx.navigateTo({
url:
"/packageC/o2o/o2oGroupActivitylist/o2oGroupActivitylist?store_id=" +
this.data.store.store_id,
});
}
},
//跳转到门店附近推荐商品
gorecommendlist() {
wx.navigateTo({
url:
"/packageD/o2o/recommendind/recommendind?store_id=" +
this.data.store.store_id,
});
},
//跳转导入商品
goAddGoods() {
wx.navigateTo({
url:
"/packageC/o2o/store_add_goods/store_add_goods?store_id=" +
this.data.store.store_id +
"&store=store",
});
},
});