| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- "content": {
- nocache: true,
- sys_enterpriseid: "",
- pageNumber: 1,
- pageTotal: 1,
- "where": {
- "condition": "",
- "workaddress": 1
- }
- }
- },
- onLoad(options) {
- this.setData({
- "content.sys_enterpriseid": options.id
- })
- this.getList(true);
- },
- /* 获取产品 */
- getList(init = false) {
- if (init.detail != undefined) init = init.detail;
- let content = this.data.content;
- if (init) content.pageNumber = 1;
- if (content.pageNumber > content.pageTotal) return;
- _Http.basic({
- "id": "20221009155803",
- content
- }).then(res => {
- console.log("我的地址列表", res)
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none",
- mask: true
- });
- content.pageNumber = res.pageNumber + 1;
- content.pageTotal = res.pageTotal;
- res.data = res.data.filter(v => v.type != '收货')
- let list = res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- selected = "";
- try {
- selected = list.find(v => v.isdefault).contactsid
- } catch (error) {}
- this.setData({
- list,
- selected
- })
- })
- },
- /* 开始搜索 */
- onSearch({
- detail
- }) {
- if (detail == this.data.content.where.condition) return;
- this.data.content.where.condition = detail;
- this.getList(true);
- },
- // 修改默认
- radioChange({
- detail
- }) {
- let list = this.data.list,
- data = list.find(v => v.contactsid == detail)
- if (data.isdefault == 1) return;
- data.isdefault = 1;
- _Http.basic({
- "id": "20221009155703",
- "content": data
- }, false).then(res => {
- console.log(res)
- if (res.code != '1') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- this.setData({
- list
- })
- })
- },
- onClear(e) {
- this.data.content.where.condition = "";
- this.getList(true);
- },
- onReady() {
- this.selectComponent("#ListBox").setHeight(".top", this);
- }
- })
|