添加onPageLoadInitAuth函数判断登录
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -27,11 +27,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -62,16 +62,24 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('ErpAccount/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpAccount/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderEdit(e: any) {
|
||||
@@ -142,7 +150,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -27,11 +27,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -62,16 +62,24 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('ErpCrm/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpCrm/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderEdit(e: any) {
|
||||
@@ -114,7 +122,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -27,11 +27,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -62,16 +62,24 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('ErpDepot/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpDepot/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderEdit(e: any) {
|
||||
@@ -129,7 +137,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FinanceItemTypeArr, FinanceItemTypeObj } from '@/utils/config';
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -30,11 +30,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -65,13 +65,20 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('ErpFinanceItem/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
// if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
// this.getList(this.data.params.curr_page - 1);
|
||||
// }
|
||||
this.setData({ count: toNumber(res.data?.count), list: list });
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpFinanceItem/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
// if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
// this.getList(this.data.params.curr_page - 1);
|
||||
// }
|
||||
this.setData({ count: toNumber(res.data?.count), list: list, isLogin: true });
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -130,7 +137,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -27,11 +27,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -62,13 +62,20 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('OrderCategory/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
// if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
// this.getList(this.data.params.curr_page - 1);
|
||||
// }
|
||||
this.setData({ count: toNumber(res.count), list: list });
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('OrderCategory/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
// if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
// this.getList(this.data.params.curr_page - 1);
|
||||
// }
|
||||
this.setData({ count: toNumber(res.count), list: list, isLogin: true });
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -127,7 +134,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -27,11 +27,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -62,16 +62,24 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('OrderStep/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
// if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
// this.getList(this.data.params.curr_page - 1);
|
||||
// }
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('OrderStep/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
// if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
// this.getList(this.data.params.curr_page - 1);
|
||||
// }
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -128,7 +136,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import { getAuthInfo, toArray } from '@/utils/util';
|
||||
|
||||
Page({
|
||||
@@ -14,18 +14,24 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
getList() {
|
||||
post('CompanyProcessV2/getChildProcess', { process_id: this.data.process_id }).then(
|
||||
(res: any) => {
|
||||
this.setData({ list: toArray(res.data) });
|
||||
},
|
||||
);
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('CompanyProcessV2/getChildProcess', { process_id: this.data.process_id })
|
||||
.then((res: any) => {
|
||||
this.setData({ list: toArray(res.data), isLogin: true });
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -37,7 +43,7 @@ Page({
|
||||
wx.setNavigationBarTitle({ title: decodeURIComponent(title) });
|
||||
}
|
||||
this.data.process_id = process_id;
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<t-cell-group custom-style="margin: 0">
|
||||
<block wx:for="{{list}}" wx:key="index">
|
||||
<t-cell title="{{item.process_name}}" note="{{item.process_code}}" data-index="{{index}}"
|
||||
bind:tap="onChildProcess" description="提成值: {{item.bonus_value || '未配置'}}">
|
||||
description="提成值: {{item.bonus_value || '未配置'}}">
|
||||
<view slot="left-icon" style="color: #999;line-height: 1.5;">
|
||||
{{index + 1}}
|
||||
</view>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import { getAuthInfo, getDataSet, toArray } from '@/utils/util';
|
||||
|
||||
Page({
|
||||
@@ -13,15 +13,23 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
getList() {
|
||||
post('CompanyProcessV2/getParentProcess').then((res: any) => {
|
||||
this.setData({ list: toArray(res.data) });
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('CompanyProcessV2/getParentProcess')
|
||||
.then((res: any) => {
|
||||
this.setData({ list: toArray(res.data), isLogin: true });
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onChildProcess(e: any) {
|
||||
@@ -38,7 +46,7 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(_options) {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -27,11 +27,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -62,16 +62,24 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('ProductType/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
// if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
// this.getList(this.data.params.curr_page - 1);
|
||||
// }
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ProductType/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
// if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
// this.getList(this.data.params.curr_page - 1);
|
||||
// }
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -130,7 +138,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -27,11 +27,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -62,16 +62,24 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('ErpCrm/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpCrm/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderEdit(e: any) {
|
||||
@@ -114,7 +122,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import { toArray, toNumber } from '@/utils/util';
|
||||
|
||||
Page({
|
||||
@@ -14,40 +14,47 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.getList();
|
||||
},
|
||||
init() {},
|
||||
|
||||
getList() {
|
||||
post('Index/index')
|
||||
.then((res: any) => {
|
||||
const process_count = toArray(res.process_count).filter((el) => {
|
||||
el.count = toNumber(el.count);
|
||||
return el.count > 0;
|
||||
});
|
||||
const arr = toArray(res.seven_process_count).filter((el) => {
|
||||
el.count = toNumber(el.count);
|
||||
return el.count > 0;
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('Index/index')
|
||||
.then((res: any) => {
|
||||
const process_count = toArray(res.process_count).filter((el) => {
|
||||
el.count = toNumber(el.count);
|
||||
return el.count > 0;
|
||||
});
|
||||
const arr = toArray(res.seven_process_count).filter((el) => {
|
||||
el.count = toNumber(el.count);
|
||||
return el.count > 0;
|
||||
});
|
||||
|
||||
const map = new Map<string, any>();
|
||||
arr.forEach((el) => {
|
||||
if (!map.has(el.date)) {
|
||||
map.set(el.date, []);
|
||||
}
|
||||
map.get(el.date).push(el);
|
||||
const map = new Map<string, any>();
|
||||
arr.forEach((el) => {
|
||||
if (!map.has(el.date)) {
|
||||
map.set(el.date, []);
|
||||
}
|
||||
map.get(el.date).push(el);
|
||||
});
|
||||
// console.log([...map.values()]);
|
||||
this.setData({
|
||||
seven_process_count: [...map.values()],
|
||||
process_count: process_count,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
})
|
||||
.finally(() => {
|
||||
wx.stopPullDownRefresh();
|
||||
});
|
||||
// console.log([...map.values()]);
|
||||
this.setData({
|
||||
seven_process_count: [...map.values()],
|
||||
process_count: process_count,
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
wx.stopPullDownRefresh();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -64,7 +71,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { base, defaultAvatarUrl } from '@/utils/config';
|
||||
import { login } from '@/utils/https';
|
||||
import { Subscribe } from '@/utils/subscribe';
|
||||
import { isArray, setStorage } from '@/utils/util';
|
||||
import { getCurrentPageRoute, isArray } from '@/utils/util';
|
||||
// import { IStorage } from "@/utils/storage";
|
||||
|
||||
// const app = getApp();
|
||||
@@ -10,26 +10,26 @@ import { isArray, setStorage } from '@/utils/util';
|
||||
Component({
|
||||
options: { addGlobalClass: true },
|
||||
properties: {
|
||||
isLogin: Boolean,
|
||||
loading: Boolean,
|
||||
// isLogin: Boolean,
|
||||
// loading: Boolean,
|
||||
isAuth: null,
|
||||
customStyle: null,
|
||||
hasTabBar: null,
|
||||
},
|
||||
|
||||
// attached() {
|
||||
// this.setData({ isLogin: getStorage("isLogin") == 1 });
|
||||
|
||||
// console.log("attached");
|
||||
// Subscribe.on("isLogin", getCurrentPageRoute(), () => {
|
||||
// this.setData({ isLogin: getStorage("isLogin") == 1 });
|
||||
// console.log("监听到 isLogin 变化:");
|
||||
// });
|
||||
// },
|
||||
// detached() {
|
||||
// console.log("detached");
|
||||
// Subscribe.off("isLogin", getCurrentPageRoute());
|
||||
// },
|
||||
attached() {
|
||||
// this.setData({ isLogin: getStorage('isLogin') == 1 });
|
||||
// console.log('attached');
|
||||
Subscribe.on('isLogin', getCurrentPageRoute(), (data: any) => {
|
||||
// console.log(data);
|
||||
this.setData({ isLogin: data, loading: false });
|
||||
// console.log('监听到 isLogin 变化:');
|
||||
});
|
||||
},
|
||||
detached() {
|
||||
// console.log('detached');
|
||||
Subscribe.off('isLogin', getCurrentPageRoute());
|
||||
},
|
||||
|
||||
data: {
|
||||
avatarUrl: defaultAvatarUrl,
|
||||
@@ -39,14 +39,14 @@ Component({
|
||||
companyList: [],
|
||||
encryptedData: '',
|
||||
iv: '',
|
||||
isLogin: false,
|
||||
loading: true,
|
||||
},
|
||||
methods: {
|
||||
handleLogin(e: any) {
|
||||
this.triggerEvent('handleLogin', e.detail);
|
||||
},
|
||||
getPhoneNumberToast() {
|
||||
setStorage('isLogin', 1);
|
||||
Subscribe.set('isLogin', 'zzzuz');
|
||||
wx.showToast({ title: '请先勾选协议', icon: 'none' });
|
||||
},
|
||||
changeAgreementCheck(event: any) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -35,11 +35,12 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
|
||||
this.getData();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
@@ -87,16 +88,24 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('ErpAccount/flow', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpAccount/flow', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -137,7 +146,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -32,11 +32,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -78,16 +78,24 @@ Page({
|
||||
} else {
|
||||
delete temp.process_state;
|
||||
}
|
||||
|
||||
post('ErpFinance/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpFinance/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderDetail(e: any) {
|
||||
@@ -135,7 +143,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { OSSBaseUrl } from '@/utils/config';
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
formatFileSize,
|
||||
@@ -29,25 +29,12 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
|
||||
getList() {
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
post('ErpFinance/info', temp).then((res: any) => {
|
||||
const data = toObject(res.data);
|
||||
const info = toObject(data.info);
|
||||
wx.setNavigationBarTitle({ title: `${info.bill_no} 详情` });
|
||||
this.setData({
|
||||
detail: toArray(info.rows),
|
||||
info: info,
|
||||
});
|
||||
});
|
||||
post('ErpFinance/fileList', temp).then((res: any) => {
|
||||
this.setData({
|
||||
files: toArray(res.data).map((el) => {
|
||||
@@ -59,6 +46,29 @@ Page({
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getList() {
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpFinance/info', temp)
|
||||
.then((res: any) => {
|
||||
const data = toObject(res.data);
|
||||
const info = toObject(data.info);
|
||||
wx.setNavigationBarTitle({ title: `${info.bill_no} 详情` });
|
||||
this.setData({
|
||||
detail: toArray(info.rows),
|
||||
info: info,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onPreview(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
@@ -78,7 +88,7 @@ Page({
|
||||
onLoad(options) {
|
||||
const { head_id } = options;
|
||||
this.data.params.head_id = head_id;
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -32,11 +32,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -78,16 +78,24 @@ Page({
|
||||
} else {
|
||||
delete temp.process_state;
|
||||
}
|
||||
|
||||
post('ErpFinance/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpFinance/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderDetail(e: any) {
|
||||
@@ -135,7 +143,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { OSSBaseUrl } from '@/utils/config';
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
formatFileSize,
|
||||
@@ -29,25 +29,12 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
|
||||
getList() {
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
post('ErpFinance/info', temp).then((res: any) => {
|
||||
const data = toObject(res.data);
|
||||
const info = toObject(data.info);
|
||||
wx.setNavigationBarTitle({ title: `${info.bill_no} 详情` });
|
||||
this.setData({
|
||||
detail: toArray(info.rows),
|
||||
info: info,
|
||||
});
|
||||
});
|
||||
post('ErpFinance/fileList', temp).then((res: any) => {
|
||||
this.setData({
|
||||
files: toArray(res.data).map((el) => {
|
||||
@@ -59,6 +46,29 @@ Page({
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getList() {
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpFinance/info', temp)
|
||||
.then((res: any) => {
|
||||
const data = toObject(res.data);
|
||||
const info = toObject(data.info);
|
||||
wx.setNavigationBarTitle({ title: `${info.bill_no} 详情` });
|
||||
this.setData({
|
||||
detail: toArray(info.rows),
|
||||
info: info,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onPreview(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
@@ -78,7 +88,7 @@ Page({
|
||||
onLoad(options) {
|
||||
const { head_id } = options;
|
||||
this.data.params.head_id = head_id;
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -32,11 +32,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -78,16 +78,24 @@ Page({
|
||||
} else {
|
||||
delete temp.process_state;
|
||||
}
|
||||
|
||||
post('ErpFinance/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpFinance/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderDetail(e: any) {
|
||||
@@ -135,7 +143,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { OSSBaseUrl } from '@/utils/config';
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
formatFileSize,
|
||||
@@ -29,25 +29,12 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
|
||||
getList() {
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
post('ErpFinance/info', temp).then((res: any) => {
|
||||
const data = toObject(res.data);
|
||||
const info = toObject(data.info);
|
||||
wx.setNavigationBarTitle({ title: `${info.bill_no} 详情` });
|
||||
this.setData({
|
||||
detail: toArray(info.rows),
|
||||
info: info,
|
||||
});
|
||||
});
|
||||
post('ErpFinance/fileList', temp).then((res: any) => {
|
||||
this.setData({
|
||||
files: toArray(res.data).map((el) => {
|
||||
@@ -59,6 +46,29 @@ Page({
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getList() {
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpFinance/info', temp)
|
||||
.then((res: any) => {
|
||||
const data = toObject(res.data);
|
||||
const info = toObject(data.info);
|
||||
wx.setNavigationBarTitle({ title: `${info.bill_no} 详情` });
|
||||
this.setData({
|
||||
detail: toArray(info.rows),
|
||||
info: info,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onPreview(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
@@ -78,7 +88,7 @@ Page({
|
||||
onLoad(options) {
|
||||
const { head_id } = options;
|
||||
this.data.params.head_id = head_id;
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -19,16 +19,17 @@ Page({
|
||||
list: [] as any[],
|
||||
count: 0,
|
||||
sort: [{ label: '创建日期', value: 'create_date' }],
|
||||
isLogin: false,
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -59,26 +60,34 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('Log/loginList', temp).then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list.map((el) => {
|
||||
el.address = '';
|
||||
if (el.detail) {
|
||||
const obj = JSON.parse(el.detail);
|
||||
const arr = ['province', 'city']
|
||||
.map((key) => obj[key]) // 取出字段值
|
||||
.filter(Boolean);
|
||||
el.address = arr.length ? arr.join(',') : '';
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('Log/loginList', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
return el;
|
||||
}),
|
||||
});
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list.map((el) => {
|
||||
el.address = '';
|
||||
if (el.detail) {
|
||||
const obj = JSON.parse(el.detail);
|
||||
const arr = ['province', 'city']
|
||||
.map((key) => obj[key]) // 取出字段值
|
||||
.filter(Boolean);
|
||||
el.address = arr.length ? arr.join(',') : '';
|
||||
}
|
||||
return el;
|
||||
}),
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -96,7 +105,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -19,16 +19,17 @@ Page({
|
||||
list: [] as any[],
|
||||
count: 0,
|
||||
sort: [{ label: '创建日期', value: 'create_date' }],
|
||||
isLogin: false,
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -59,16 +60,24 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('Log/operateList', temp).then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('Log/operateList', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data?.list);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.data?.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -86,7 +95,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -30,11 +30,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -76,13 +76,20 @@ Page({
|
||||
} else {
|
||||
delete temp.process_state;
|
||||
}
|
||||
|
||||
post('Departments/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({ list: list });
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('Departments/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({ list: list, isLogin: true });
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -113,7 +120,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -25,16 +25,17 @@ Page({
|
||||
{ value: '2', label: '已审核' },
|
||||
],
|
||||
sort: [{ label: '创建日期', value: 'create_date' }],
|
||||
isLogin: false,
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -76,13 +77,20 @@ Page({
|
||||
} else {
|
||||
delete temp.process_state;
|
||||
}
|
||||
|
||||
post('Groups/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({ list: list });
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('Groups/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({ list: list, isLogin: true });
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onGroupTap(e: any) {
|
||||
@@ -122,7 +130,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import { getAuthInfo, toArray } from '@/utils/util';
|
||||
|
||||
Page({
|
||||
@@ -8,53 +8,62 @@ Page({
|
||||
data: {
|
||||
list: [] as any[],
|
||||
group_id: '',
|
||||
isLogin: false,
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
|
||||
getList() {
|
||||
post('Groups/getGrpRights', { group_id: this.data.group_id }).then((res: any) => {
|
||||
const list = toArray(res.right_tree);
|
||||
const rights = `${res.rights || ''}`.split(',');
|
||||
this.data.list.length = 0;
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('Groups/getGrpRights', { group_id: this.data.group_id })
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.right_tree);
|
||||
const rights = `${res.rights || ''}`.split(',');
|
||||
this.data.list.length = 0;
|
||||
|
||||
toArray(list).forEach((menu) => {
|
||||
const arr: any[] = [];
|
||||
toArray(menu.children).forEach((menu2) => {
|
||||
let flag = false;
|
||||
toArray(menu2.children).forEach((fun) => {
|
||||
fun.web_checked = rights.includes(`${fun.function_id}`);
|
||||
if (fun.web_checked) {
|
||||
flag = true;
|
||||
toArray(list).forEach((menu) => {
|
||||
const arr: any[] = [];
|
||||
toArray(menu.children).forEach((menu2) => {
|
||||
let flag = false;
|
||||
toArray(menu2.children).forEach((fun) => {
|
||||
fun.web_checked = rights.includes(`${fun.function_id}`);
|
||||
if (fun.web_checked) {
|
||||
flag = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (flag) {
|
||||
arr.push({
|
||||
menu_ch_name: menu2.menu_ch_name,
|
||||
menu_id: menu2.menu_id,
|
||||
functions: toArray(menu2.children),
|
||||
});
|
||||
}
|
||||
});
|
||||
if (arr.length) {
|
||||
this.data.list.push({
|
||||
menu_ch_name: menu.menu_ch_name,
|
||||
menu_id: menu.menu_id,
|
||||
children: arr,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (flag) {
|
||||
arr.push({
|
||||
menu_ch_name: menu2.menu_ch_name,
|
||||
menu_id: menu2.menu_id,
|
||||
functions: toArray(menu2.children),
|
||||
});
|
||||
}
|
||||
// console.log(this.data.list);
|
||||
this.setData({ list: this.data.list, isLogin: true });
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
if (arr.length) {
|
||||
this.data.list.push({
|
||||
menu_ch_name: menu.menu_ch_name,
|
||||
menu_id: menu.menu_id,
|
||||
children: arr,
|
||||
});
|
||||
}
|
||||
});
|
||||
// console.log(this.data.list);
|
||||
this.setData({ list: this.data.list });
|
||||
});
|
||||
},
|
||||
|
||||
@@ -65,7 +74,7 @@ Page({
|
||||
this.data.group_id = `${options.group_id}`;
|
||||
wx.setNavigationBarTitle({ title: `${decodeURIComponent(`${options.name}`)} 权限` });
|
||||
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import { getAuthInfo, toArray } from '@/utils/util';
|
||||
|
||||
Page({
|
||||
@@ -7,53 +7,62 @@ Page({
|
||||
*/
|
||||
data: {
|
||||
list: [] as any[],
|
||||
isLogin: false,
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
|
||||
getList() {
|
||||
post('Groups/myAuth').then((res: any) => {
|
||||
const list = toArray(res.right_tree);
|
||||
const rights = `${res.rights || ''}`.split(',');
|
||||
this.data.list.length = 0;
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('Groups/myAuth')
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.right_tree);
|
||||
const rights = `${res.rights || ''}`.split(',');
|
||||
this.data.list.length = 0;
|
||||
|
||||
toArray(list).forEach((menu) => {
|
||||
const arr: any[] = [];
|
||||
toArray(menu.children).forEach((menu2) => {
|
||||
let flag = false;
|
||||
toArray(menu2.children).forEach((fun) => {
|
||||
fun.web_checked = rights.includes(`${fun.function_id}`);
|
||||
if (fun.web_checked) {
|
||||
flag = true;
|
||||
toArray(list).forEach((menu) => {
|
||||
const arr: any[] = [];
|
||||
toArray(menu.children).forEach((menu2) => {
|
||||
let flag = false;
|
||||
toArray(menu2.children).forEach((fun) => {
|
||||
fun.web_checked = rights.includes(`${fun.function_id}`);
|
||||
if (fun.web_checked) {
|
||||
flag = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (flag) {
|
||||
arr.push({
|
||||
menu_ch_name: menu2.menu_ch_name,
|
||||
menu_id: menu2.menu_id,
|
||||
functions: toArray(menu2.children),
|
||||
});
|
||||
}
|
||||
});
|
||||
if (arr.length) {
|
||||
this.data.list.push({
|
||||
menu_ch_name: menu.menu_ch_name,
|
||||
menu_id: menu.menu_id,
|
||||
children: arr,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (flag) {
|
||||
arr.push({
|
||||
menu_ch_name: menu2.menu_ch_name,
|
||||
menu_id: menu2.menu_id,
|
||||
functions: toArray(menu2.children),
|
||||
});
|
||||
}
|
||||
// console.log(this.data.list);
|
||||
this.setData({ list: this.data.list, isLogin: true });
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
if (arr.length) {
|
||||
this.data.list.push({
|
||||
menu_ch_name: menu.menu_ch_name,
|
||||
menu_id: menu.menu_id,
|
||||
children: arr,
|
||||
});
|
||||
}
|
||||
});
|
||||
// console.log(this.data.list);
|
||||
this.setData({ list: this.data.list });
|
||||
});
|
||||
},
|
||||
|
||||
@@ -61,7 +70,7 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(_options) {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -31,16 +31,17 @@ Page({
|
||||
user_id: wx.getStorageSync('user_id'),
|
||||
depOption: [] as any[],
|
||||
groupsOption: [] as any[],
|
||||
isLogin: false,
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
this.getOrderStep();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
@@ -106,13 +107,20 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('Users/getStaff', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({ count: toNumber(res.count), list: list });
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('Users/getStaff', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({ count: toNumber(res.count), list: list, isLogin: true });
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onReinstatedStaff(e: any) {
|
||||
@@ -170,7 +178,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { base } from '@/utils/config';
|
||||
import { checkSesskey, loginStatusPage, post } from '@/utils/https';
|
||||
import { Subscribe } from '@/utils/subscribe';
|
||||
import { getStorage, toObject } from '@/utils/util';
|
||||
|
||||
Page({
|
||||
@@ -59,6 +60,7 @@ Page({
|
||||
complete: (res: any) => {
|
||||
if (res.confirm) {
|
||||
post('Applet/loginOut').then(() => {
|
||||
Subscribe.set('isLogin', false);
|
||||
this.setData({ isLogin: false });
|
||||
checkSesskey({ showLoading: false, showError: false })
|
||||
.then(() => {})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -28,11 +28,12 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
|
||||
this.getData();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
@@ -86,16 +87,24 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('GoodsBatch/goodsBatchList', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('GoodsBatch/goodsBatchList', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -124,7 +133,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
<view slot="header">{{ item.batch_no }}</view>
|
||||
<view slot="content">
|
||||
<card-item-plugin label="自定义批号" value="{{item.batch_custom_no}}" />
|
||||
<card-item-plugin label="保质期" value="{{item.expire_date}}" />
|
||||
<card-item-plugin label="商品名称" value="{{item.goods_name}}" />
|
||||
<card-item-plugin label="商品编码" value="{{item.goods_code}}" />
|
||||
<card-item-plugin label="保质期" value="{{item.expire_date}}" />
|
||||
<card-item-plugin label="批次单位" value="{{item.unit_ch_name}}" />
|
||||
<card-item-plugin label="批次单价" value="{{item.batch_price}}" />
|
||||
<card-item-plugin label="库存" value="{{item.batch_nums}}" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -26,11 +26,12 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
|
||||
this.getData();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
@@ -74,16 +75,24 @@ Page({
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
|
||||
post('GoodsBatch/getBatchLogList', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('GoodsBatch/getBatchLogList', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -96,7 +105,7 @@ Page({
|
||||
if (title) {
|
||||
wx.setNavigationBarTitle({ title });
|
||||
}
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -28,11 +28,12 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
|
||||
this.getData();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
@@ -134,15 +135,24 @@ Page({
|
||||
if (!temp.goods_class) {
|
||||
delete temp.goods_class;
|
||||
}
|
||||
post('ErpGoods/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpGoods/list', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -180,7 +190,7 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(_options) {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -28,11 +28,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getGoodsAttr();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getGoodsAttr();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -57,19 +57,27 @@ Page({
|
||||
this.getList();
|
||||
},
|
||||
getGoodsAttr() {
|
||||
post('GoodsAttr/list').then((res: any) => {
|
||||
this.data.goodsSubAttr = {};
|
||||
toArray(res?.data?.list).forEach((el) => {
|
||||
toArray(el.sub_attr).forEach((ell) => {
|
||||
this.data.goodsSubAttr[ell.attr_id] = {
|
||||
...ell,
|
||||
p_attr_name: el.attr_name,
|
||||
};
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('GoodsAttr/list')
|
||||
.then((res: any) => {
|
||||
this.data.goodsSubAttr = {};
|
||||
toArray(res?.data?.list).forEach((el) => {
|
||||
toArray(el.sub_attr).forEach((ell) => {
|
||||
this.data.goodsSubAttr[ell.attr_id] = {
|
||||
...ell,
|
||||
p_attr_name: el.attr_name,
|
||||
};
|
||||
});
|
||||
});
|
||||
// console.log(this.data.goodsSubAttr);
|
||||
this.setData({ goodsSubAttr: this.data.goodsSubAttr, isLogin: true });
|
||||
this.getList();
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
// console.log(this.data.goodsSubAttr);
|
||||
this.setData({ goodsSubAttr: this.data.goodsSubAttr });
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
getList() {
|
||||
@@ -109,7 +117,7 @@ Page({
|
||||
if (title) {
|
||||
wx.setNavigationBarTitle({ title: decodeURIComponent(title) });
|
||||
}
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getGoodsAttr());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -33,11 +33,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -79,16 +79,24 @@ Page({
|
||||
} else {
|
||||
delete temp.process_state;
|
||||
}
|
||||
|
||||
post('ErpDepot/depotHeadList', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpDepot/depotHeadList', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderDetail(e: any) {
|
||||
@@ -142,7 +150,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { OSSBaseUrl } from '@/utils/config';
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
formatFileSize,
|
||||
@@ -29,29 +29,38 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
|
||||
getList() {
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
post('ErpDepot/info', temp).then((res: any) => {
|
||||
const info = toObject(res.info);
|
||||
wx.setNavigationBarTitle({ title: `${info.bill_no} 详情` });
|
||||
this.setData({
|
||||
files: toArray(res.files).map((el) => {
|
||||
el._file_type = getFileType(el.file_name);
|
||||
el.file_path = `${OSSBaseUrl}${el.file_path}`;
|
||||
el._file_size = formatFileSize(el.file_size);
|
||||
return el;
|
||||
}),
|
||||
detail: toArray(res.rows),
|
||||
info: info,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpDepot/info', temp)
|
||||
.then((res: any) => {
|
||||
const info = toObject(res.info);
|
||||
wx.setNavigationBarTitle({ title: `${info.bill_no} 详情` });
|
||||
this.setData({
|
||||
files: toArray(res.files).map((el) => {
|
||||
el._file_type = getFileType(el.file_name);
|
||||
el.file_path = `${OSSBaseUrl}${el.file_path}`;
|
||||
el._file_size = formatFileSize(el.file_size);
|
||||
return el;
|
||||
}),
|
||||
detail: toArray(res.rows),
|
||||
info: info,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onPreview(e: any) {
|
||||
@@ -73,7 +82,7 @@ Page({
|
||||
onLoad(options) {
|
||||
const { head_id } = options;
|
||||
this.data.params.head_id = head_id;
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -32,11 +32,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -78,16 +78,24 @@ Page({
|
||||
} else {
|
||||
delete temp.process_state;
|
||||
}
|
||||
|
||||
post('ErpDepot/depotHeadList', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpDepot/depotHeadList', temp)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderDetail(e: any) {
|
||||
@@ -135,7 +143,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { OSSBaseUrl } from '@/utils/config';
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
formatFileSize,
|
||||
@@ -29,29 +29,38 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
|
||||
getList() {
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
post('ErpDepot/info', temp).then((res: any) => {
|
||||
const info = toObject(res.info);
|
||||
wx.setNavigationBarTitle({ title: `${info.bill_no} 详情` });
|
||||
this.setData({
|
||||
files: toArray(res.files).map((el) => {
|
||||
el._file_type = getFileType(el.file_name);
|
||||
el.file_path = `${OSSBaseUrl}${el.file_path}`;
|
||||
el._file_size = formatFileSize(el.file_size);
|
||||
return el;
|
||||
}),
|
||||
detail: toArray(res.rows),
|
||||
info: info,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ErpDepot/info', temp)
|
||||
.then((res: any) => {
|
||||
const info = toObject(res.info);
|
||||
wx.setNavigationBarTitle({ title: `${info.bill_no} 详情` });
|
||||
this.setData({
|
||||
files: toArray(res.files).map((el) => {
|
||||
el._file_type = getFileType(el.file_name);
|
||||
el.file_path = `${OSSBaseUrl}${el.file_path}`;
|
||||
el._file_size = formatFileSize(el.file_size);
|
||||
return el;
|
||||
}),
|
||||
detail: toArray(res.rows),
|
||||
info: info,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onPreview(e: any) {
|
||||
@@ -73,7 +82,7 @@ Page({
|
||||
onLoad(options) {
|
||||
const { head_id } = options;
|
||||
this.data.params.head_id = head_id;
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
@@ -30,11 +30,11 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
@@ -64,15 +64,24 @@ Page({
|
||||
getList(curr: number = 1) {
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
post('CompanyProcessV2/processOrd', this.data.params).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
});
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('CompanyProcessV2/processOrd', this.data.params)
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
isLogin: true,
|
||||
});
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
confirmDialog() {
|
||||
@@ -113,7 +122,7 @@ Page({
|
||||
title: decodeURIComponent(options.title || ''),
|
||||
});
|
||||
this.data.params.process_id = `${options.process_id || ''}`;
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* YangXB 2021.11.24
|
||||
* */
|
||||
import { base, http } from './config';
|
||||
import { Subscribe } from './subscribe';
|
||||
import { getStorage, isArray, setStorage, toArray, toastError } from './util';
|
||||
/**
|
||||
* 请求
|
||||
@@ -44,12 +45,11 @@ const request = (url: string, options: any, config = { showLoading: true, showEr
|
||||
resolve(request.data);
|
||||
} else {
|
||||
if (config.showError != false) {
|
||||
wx.showToast({
|
||||
title: request.data.err_msg,
|
||||
icon: 'none',
|
||||
});
|
||||
wx.showToast({ title: request.data.err_msg, icon: 'none' });
|
||||
}
|
||||
if (request.data.err_code == 110000) {
|
||||
Subscribe.set('isLogin', false);
|
||||
|
||||
// const currentPage = getCurrentPage();
|
||||
// console.log(currentPage);
|
||||
// if (
|
||||
@@ -147,6 +147,7 @@ export const loginStatus = () => {
|
||||
setStorage('auth_info', res.auth_info);
|
||||
setStorage('session_id', res.session_id);
|
||||
getUsersConfigList();
|
||||
Subscribe.set('isLogin', true);
|
||||
resolve(res);
|
||||
})
|
||||
.catch((err: any) => {
|
||||
@@ -155,7 +156,9 @@ export const loginStatus = () => {
|
||||
if (isArray(res.data)) {
|
||||
post('Applet/loginOut').then(() => {
|
||||
checkSesskey({ showLoading: false, showError: false })
|
||||
.then(() => {})
|
||||
.then(() => {
|
||||
Subscribe.set('isLogin', false);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('checkSesskey', err);
|
||||
});
|
||||
@@ -201,6 +204,7 @@ export const onPageLoadInitAuth = (
|
||||
initFun()
|
||||
.then((_res) => {
|
||||
// console.log('onPageLoadInitAuth', res);
|
||||
Subscribe.set('isLogin', true);
|
||||
that.setData({ isLogin: true, loading: false });
|
||||
that.init?.();
|
||||
})
|
||||
|
||||
@@ -9,8 +9,8 @@ function triggerEvent(key: string, data: any) {
|
||||
});
|
||||
}
|
||||
// 也可以触发一个通用的 'change' 事件
|
||||
if (listeners["change"]) {
|
||||
listeners["change"].forEach((callback: any) => {
|
||||
if (listeners['change']) {
|
||||
listeners['change'].forEach((callback: any) => {
|
||||
callback({ key, data });
|
||||
});
|
||||
}
|
||||
@@ -45,15 +45,15 @@ export const Subscribe = {
|
||||
* @param functionKey 唯一的函数key(用于取消订阅的)
|
||||
* @param callback 回调函数
|
||||
*/
|
||||
on(key: string, functionKey: string, callback: () => void) {
|
||||
on(key: string, functionKey: string, callback: (data: any) => void) {
|
||||
if (!listeners[key]) {
|
||||
listeners[key] = [];
|
||||
}
|
||||
if (typeof callback == "function") {
|
||||
(callback as IFun)["$$functionKey"] = functionKey;
|
||||
if (typeof callback == 'function') {
|
||||
(callback as IFun)['$$functionKey'] = functionKey;
|
||||
listeners[key].push(callback);
|
||||
} else {
|
||||
console.log("订阅事件 callback 必须是函数");
|
||||
console.log('订阅事件 callback 必须是函数');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user