| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- content: {
- loading: false,
- sa_contractid: "",
- nocache: true,
- pageNumber: 1,
- pageSize: 20,
- pageTotal: 1,
- total: 0,
- where: {
- "condition": "",
- }
- },
- list: [],
- },
- getList(init = false) {
- const content = this.data.content;
- if (init) content.pageNumber = 1;
- if (content.pageNumber > content.pageTotal) return;
- _Http.basic({
- id: 20240923153304,
- content
- }).then(res => {
- console.log("通讯录列表", res)
- if (res.code != '1') return wx.showToast({
- title: res.msg,
- icon: "none"
- });
- content.pageNumber = res.pageNumber + 1;
- content.pageTotal = res.pageTotal;
- content.total = res.total;
- this.setData({
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- content
- })
- })
- },
- onLoad(options) {
- if (options.id) this.setData({
- 'content.sa_contractid': options.id
- });
- this.getList();
- },
- onClick(e) {
- if (this.data.loading) return;
- const {
- item
- } = e.currentTarget.dataset,
- sa_contractid = this.data.content.sa_contractid;
- this.data.loading = true;
- _Http.basic({
- "id": "20240923153004",
- "content": {
- sa_contractid,
- "sys_phonebookid": item.sys_phonebookid
- }
- }).then(res => {
- console.log("添加合同联系人", res)
- this.data.loading = false;
- wx.showToast({
- title: res.code != '1' ? res.msg : '添加成功',
- icon: "none",
- mask: res.code == '1'
- })
- if (res.code == '1') setTimeout(() => {
- wx.navigateBack()
- getCurrentPages().forEach(v => {
- if (v.__route__ == 'packageA/contract/detail') {
- let page = v.selectComponent("#Contacts");
- page.getList(sa_contractid, true)
- }
- });
- }, 500)
- })
- },
- onSearch({
- detail
- }) {
- this.setData({
- 'content.where.condition': detail ? detail : ""
- });
- this.getList(true);
- },
- onClear() {
- this.setData({
- 'content.where.condition': ""
- });
- this.getList(true);
- },
- onReachBottom() {
- this.getList();
- },
- })
|