Jelajahi Sumber

根据领域授权选择账户

xiaohaizhao 1 tahun lalu
induk
melakukan
55cb5272df
3 mengubah file dengan 56 tambahan dan 5 penghapusan
  1. 13 1
      app.js
  2. 1 1
      packageA/orderForm/detail.js
  3. 42 3
      select/account/index.js

+ 13 - 1
app.js

@@ -27,8 +27,20 @@ App({
 			}
 		})
 
+		//获取领域对应账户
+		this.globalData.http.basic({
+			"classname": "sysmanage.develop.optiontype.optiontype",
+			"method": "optiontypeselect",
+			"content": {
+				"pageNumber": 1,
+				"pageSize": 9999,
+				"typename": "domainrelatedaccounts"
+			}
+		}).then(res => {
+			console.log("查询领域对应列表", res)
+			wx.setStorageSync('domainrelatedaccounts', res.msg == '成功' ? res.data : [])
+		})
 		console.log(this.globalData.http.baseUrl.replace("https", "wss").replace("http", "ws") + '/yos/webSocket/' + wx.getStorageSync('userMsg').token)
-
 		this.globalData.SocketTask.onOpen(function (res) {
 			that.globalData.socketEstablish = true;
 		})

+ 1 - 1
packageA/orderForm/detail.js

@@ -185,7 +185,7 @@ Page({
 						"isnotspecialfund": this.data.detail.type == '标准订单' ? 0 : 1, //是否专用
 						}, 
 				}
-			 })}&radio=true`,
+			 })}&radio=true&tradefield=${this.data.detail.tradefield}`,
 		});
 		getApp().globalData.handleSelect = this.setAccount.bind(this);
 	},

+ 42 - 3
select/account/index.js

@@ -11,7 +11,8 @@ Page({
     result: [], //返回结果
     radio: false, //是否为单选
     idname: "sa_accountclassid", //idkey
-    showName: "accountname"
+    showName: "accountname",
+    subvalues: []
   },
   onLoad(options) {
     if (options.params) {
@@ -24,12 +25,48 @@ Page({
         params
       });
     }
+
     this.setData({
       radio: options.radio ? true : false,
       idname: options.idname || this.data.idname,
       showName: options.showName || this.data.showName,
     });
-    this.getList()
+    let that = this;
+
+    if (options.tradefield) {
+      let domainrelatedaccounts = wx.getStorageSync('domainrelatedaccounts');
+      if (domainrelatedaccounts.length) {
+        query()
+      } else {
+        _Http.basic({
+          "classname": "sysmanage.develop.optiontype.optiontype",
+          "method": "optiontypeselect",
+          "content": {
+            "pageNumber": 1,
+            "pageSize": 9999,
+            "typename": "domainrelatedaccounts"
+          }
+        }).then(res => {
+          console.log("查询领域对应列表", res)
+          if (res.msg == '成功' && res.data.length) {
+            domainrelatedaccounts = res.data;
+            wx.setStorageSync('domainrelatedaccounts', domainrelatedaccounts)
+            query()
+          }
+        })
+      }
+
+      function query() {
+        let item = domainrelatedaccounts.find(v => v.value == options.tradefield);
+        that.setData({
+          subvalues: item ? item.subvalues : []
+        })
+        that.getList()
+      }
+    } else {
+      that.getList()
+    }
+
   },
   getList(init = false) {
     //init 用于初始化分页
@@ -37,7 +74,8 @@ Page({
     let params = this.data.params;
     if (init) params.content.pageNumber = 1
     if (params.content.pageNumber > params.content.pageTotal) return;
-
+    let subvalues = this.data.subvalues;
+    if (subvalues.length) params.pageSize = 9999
     _Http.basic(params).then(res => {
       console.log("选择账户列表", res)
       this.selectComponent('#ListBox').RefreshToComplete();
@@ -45,6 +83,7 @@ Page({
         title: res.msg,
         icon: "none"
       })
+      if (subvalues.length) res.data = res.data.filter(v => subvalues.includes(v.sa_accountclassid + ""))
       res.data = res.data.map(v => {
         v.balance = CNY(v.balance)
         v.creditquota = CNY(v.creditquota)