zhaoxiaohai 3 лет назад
Родитель
Сommit
e531adcf8a
1 измененных файлов с 60 добавлено и 14 удалено
  1. 60 14
      packageA/borrow/index.js

+ 60 - 14
packageA/borrow/index.js

@@ -43,6 +43,9 @@ Page({
     },
     onLoad(options) {
         this.getList(true)
+        this.setData({
+            userrole: wx.getStorageSync('userrole')
+        })
     },
     /* 处理筛选 */
     handleFilter({
@@ -101,27 +104,70 @@ Page({
             })
             getApp().globalData.handleSelect = this.handleCreated.bind(this);
         } else {
-            _Http.basic({
-                "id": 20230116092702,
-                "content": {
-                    "sa_orderid": 0
-                }
-            }).then(res => {
-                console.log("按个", res)
-                if (res.msg != '成功') return wx.showToast({
-                    title: res.msg,
-                    icon: "none"
-                });
+            if (this.data.userrole == '业务员') {
                 wx.navigateTo({
-                    url: '/packageA/borrow/detail?id=' + res.data.sa_orderid,
+                    url: `/select/agent/index?params=${JSON.stringify({
+                                "id": 20220920083901,
+                                "content": {
+                                    nocache:true,
+                                    "where": {
+                                            "condition": "",
+                                            "type":9,
+                                    }
+                                }
+                        })}&radio=true`,
                 })
-            })
+                getApp().globalData.handleSelect = this.handleSingle.bind(this);
+            } else {
+                _Http.basic({
+                    "id": 20230116092702,
+                    "content": {
+                        "sa_orderid": 0
+                    }
+                }).then(res => {
+                    console.log("按个", res)
+                    if (res.msg != '成功') return wx.showToast({
+                        title: res.msg,
+                        icon: "none"
+                    });
+                    wx.navigateTo({
+                        url: '/packageA/borrow/detail?id=' + res.data.sa_orderid,
+                    })
+                })
+            }
         }
     },
+    handleSingle({
+        item
+    }) {
+        wx.showModal({
+            title: '提示',
+            content: `是否确定选择"${item.enterprisename}"创建工具借用单?`,
+            complete: (res) => {
+                if (res.confirm) _Http.basic({
+                    "id": 20230116092702,
+                    "content": {
+                        "sa_orderid": 0,
+                        sys_enterpriseid: item.sys_enterpriseid
+                    }
+                }).then(res => {
+                    console.log("按个", res)
+                    if (res.msg != '成功') return wx.showToast({
+                        title: res.msg,
+                        icon: "none"
+                    });
+                    wx.redirectTo({
+                        url: '/packageA/borrow/detail?id=' + res.data.sa_orderid,
+                    })
+                })
+            }
+        })
+
+    },
     handleCreated(e) {
         wx.showModal({
             title: '提示',
-            content: `是否确认选择“${e.item.billno}”创建借用单`,
+            content: `是否确认选择“${e.item.title}”创建借用单`,
             complete: ({
                 confirm
             }) => {