NULL1222 6 dias atrás
pai
commit
b266e95771
2 arquivos alterados com 33 adições e 9 exclusões
  1. 32 8
      pages/tabbar/mine/address/index.js
  2. 1 1
      pages/tabbar/mine/index.js

+ 32 - 8
pages/tabbar/mine/address/index.js

@@ -3,6 +3,7 @@ Page({
   data: {
     selectMode: false,
     createuserid: "",
+    apiId: "20221022165503",
     "content": {
       nocache: true,
       pageNumber: 1,
@@ -15,14 +16,37 @@ Page({
     }
   },
   onLoad(options) {
-    // userid 参数(与 Web 一致使用 createuserid 查询地址列表)
     let createuserid = options.userid || "";
-    this.setData({
-      "content.where.createuserid": createuserid,
-      createuserid,
-      enterpriseid: options.enterpriseid || "",
-      selectMode: options.select === '1'
-    })
+    let selectMode = options.select === '1';
+    console.log("createuserid", createuserid);
+
+    if (selectMode) {
+      // 从订单页进入(select模式):使用 createuserid 查询
+      this.setData({
+        "content.where.createuserid": createuserid,
+        createuserid,
+        enterpriseid: options.enterpriseid || "",
+        selectMode: true
+      });
+    } else {
+      // 从"我的"tab进入:使用 workaddress 查询地址列表
+      this.setData({
+        apiId: "20221009155803",
+        content: {
+          nocache: true,
+          pageNumber: 1,
+          pageSize: 20,
+          pageTotal: 1,
+          where: {
+            condition: "",
+            workaddress: 1
+          }
+        },
+        createuserid,
+        enterpriseid: options.enterpriseid || "",
+        selectMode: false
+      });
+    }
     this.getList(true);
     getApp().globalData.Language.getLanguagePackage(this, '我的地址');
   },
@@ -33,7 +57,7 @@ Page({
     if (init) content.pageNumber = 1;
     if (content.pageNumber > content.pageTotal) return;
     _Http.basic({
-      "id": "20221022165503",
+      "id": this.data.apiId,
       content
     }).then(res => {
       console.log("我的地址列表", res)

+ 1 - 1
pages/tabbar/mine/index.js

@@ -41,7 +41,7 @@ Page({
         };
         this.setData({
             auth: JSON.stringify(wx.getStorageSync('auth')),
-            userMsg: JSON.stringify(wx.getStorageSync('userMsg')),
+            userMsg: wx.getStorageSync('userMsg') || {},
             site: JSON.stringify(wx.getStorageSync('siteP')),
             templetList: JSON.stringify(wx.getStorageSync('templetList')),
             languagecode: wx.getStorageSync('languagecode'),