206 lines
5.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

let util = require('../../../../utils/util')
// const apiArr = require('../../../api/water_filter')
const apiArr = require('../../../../api/partner')
const app = getApp({ allowDefault: true })
// packages/partner/pages/partner.js
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
nav_list:{},
foot_width:"",
funcList:[
{
text:"设备管理",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon2.png?1",
url:"/packages/partner/pages/device/device",
},
{
text:"师傅管理",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon6.png?1",
url:"../master/master",
},
{
text:"收银台",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon7.png?1",
// url:"../pages/desk/desk",
},
{
text:"分配经销商",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/partner_icon_new1.png",
url:"/packages/partner/pages/distributor/distributor",
},
{
text:"设备库存",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/equipmentStock.png",
url:"/packages/partner/pages/equipmentStock/equipmentStock",
},
{
text:"滤芯库存",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/filterStock.png",
url:"/packages/partner/pages/filterStock/filterStock",
},
{
text:"消息订阅",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/SubscribeMessageIcon.png",
url:"/pages/SubscribeMessage/SubscribeMessage",
},
],
Info:"",
order:"",
},
back(){
wx.reLaunch({
url: '/pages/newLogin/newLogin',
})
},
editAdmin(){
wx.navigateTo({
url: '/packages/partner/pages/editAdmin/editAdmin',
})
},
padToEightDigits(number) {
// 将数字转换为字符串,并使用 padStart 补足到 8 位
return String(number).padStart(8, '0');
},
getOrderList(){
let that = this
let admin = wx.getStorageSync('admin')
util.postUrl4(apiArr.getPartnerOrder,{
dealer_id:admin.shop_id
},res=>{
that.setData({
order:res
})
})
},
getParter(){
let that =this
wx.showLoading({
title: '加载中...',
mask:true
})
let admin = wx.getStorageSync('admin')
util.postUrl4(apiArr.getPartner,{
deal_id:admin.shop_id
},res=>{
wx.hideLoading()
res.No = that.padToEightDigits(res.deal_id)
if(res.deal_icon){
res.deal_icon = res.deal_icon.startsWith('http')?res.deal_icon:util.img_url + res.deal_icon
}
console.log(admin.shop_id);
if(admin.shop_id != 1){
let funcList = that.data.funcList
funcList.splice(7,1)
that.setData({
funcList
})
}
that.setData({
Info:res
})
})
},
jump(e){
console.log(e);
if(!e.currentTarget.dataset.url){
return wx.showToast({
title: '功能暂未开通',
icon:"none"
})
}
wx.navigateTo({
url: e.currentTarget.dataset.url,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
// that.getOrderList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.getParter()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage(){
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义分享图片路径
}
},
})