Pārlūkot izejas kodu

Merge branch '新功能开发/根据领域选择账户' into 德莱宝测试除了手机登录不合并

# Conflicts:
#	utils/Http.js
xiaohaizhao 1 gadu atpakaļ
vecāks
revīzija
6997748677
2 mainītis faili ar 81 papildinājumiem un 1 dzēšanām
  1. 73 1
      packageA/orderForm/add/add.js
  2. 8 0
      packageA/orderForm/add/add.wxml

+ 73 - 1
packageA/orderForm/add/add.js

@@ -9,6 +9,7 @@ Page({
         loading: false,
         sa_brandid: null,
         tradefield: null,
+        sa_accountclassid: 0,
         brandList: [],
         domainList: [],
         type: "标准订单",
@@ -18,6 +19,7 @@ Page({
         this.setData({
             type: e.currentTarget.dataset.name
         })
+        this.getAccList();
     },
     onLoad(options) {
         this.getOrderList()
@@ -30,7 +32,35 @@ Page({
         if (this.data.userrole == '经销商') {
             this.getBrand();
             this.getDomain();
+        };
+
+
+        let domainrelatedaccounts = wx.getStorageSync('domainrelatedaccounts');
+        if (domainrelatedaccounts.length) {
+            this.setData({
+                domainrelatedaccounts
+            })
+        } 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)
+                    this.setData({
+                        domainrelatedaccounts
+                    })
+                }
+            })
         }
+        console.log(domainrelatedaccounts)
     },
     /* 获取品牌 */
     getBrand(id) {
@@ -104,6 +134,7 @@ Page({
                 tradefield: res.data[0].tradefield,
                 skeletonShow: false
             });
+            this.getAccList();
         })
     },
     /* 选择领域 */
@@ -115,6 +146,46 @@ Page({
         this.setData({
             tradefield: item.tradefield
         })
+        this.getAccList();
+    },
+    onSelectAcc(e) {
+        let {
+            item
+        } = e.currentTarget.dataset;
+        console.log(item)
+        this.setData({
+            sa_accountclassid: item.sa_accountclassid
+        })
+    },
+    getAccList() {
+        this.setData({
+            optionalAccount: [],
+            sa_accountclassid: 0
+        })
+        if (['标准订单', '特殊订单'].includes(this.data.type || '标准订单')) {
+            let tradefield = this.data.domainrelatedaccounts.find(v => v.value == this.data.tradefield);
+            if (tradefield) _Http.basic({
+                "id": 20221008134803,
+                "version": 1,
+                "content": {
+                    "pageNumber": 1,
+                    "pageTotal": 1,
+                    "pageSize": 9999,
+                    "where": {
+                        "condition": "",
+                        "isused": 1,
+                        "isnotspecialfund": this.data.type == '标准订单' ? 0 : 1, //是否专用
+                    },
+                }
+            }).then(res => {
+                console.log("账户列表", res)
+                let list = res.data.filter(v => tradefield.subvalues.some(s => s == v.sa_accountclassid))
+                if (res.msg == '成功') this.setData({
+                    optionalAccount: list,
+                    sa_accountclassid: list.length ? list[0].sa_accountclassid : 0
+                })
+            })
+        }
     },
     submit() {
         if (this.data.userrole == '业务员' && !this.data.agency.sys_enterpriseid) {
@@ -144,7 +215,8 @@ Page({
                 "sa_brandid": this.data.sa_brandid, //品牌ID
                 "type": this.data.type, //订单类型
                 "tradefield": this.data.tradefield, //必选
-                sys_enterpriseid: this.data.agency.sys_enterpriseid
+                sys_enterpriseid: this.data.agency.sys_enterpriseid,
+                sa_accountclassid: this.data.sa_accountclassid
             }
         }).then(res => {
             this.setData({

+ 8 - 0
packageA/orderForm/add/add.wxml

@@ -42,6 +42,14 @@
     </view>
 </view>
 
+<view class="groud" wx:if="{{optionalAccount.length>1}}">
+    <view class="label">
+        选择账户
+    </view>
+    <view class="content">
+        <van-button custom-class='but {{item.sa_accountclassid==sa_accountclassid?"active":""}}' wx:for="{{optionalAccount}}" wx:key="sa_accountclassid" data-item="{{item}}" bindtap="onSelectAcc">{{item.accountname}}</van-button>
+    </view>
+</view>
 
 <!-- 底部 -->
 <view style="height: 150rpx;" />