Browse Source

添加项目合同

zhaoxiaohai 2 years ago
parent
commit
389f2f71e0

+ 3 - 2
app.json

@@ -12,7 +12,7 @@
         "shopping/index",
         "orderForm/index",
         "orderForm/detail",
-        "orderForm/add"
+        "orderForm/add/add"
       ]
     },
     {
@@ -21,7 +21,8 @@
         "product/index",
         "agent/index",
         "address/index",
-        "finance/index"
+        "finance/index",
+        "contract/index"
       ]
     }
   ],

+ 0 - 0
packageA/orderForm/add.js → packageA/orderForm/add/add.js


+ 0 - 0
packageA/orderForm/add.json → packageA/orderForm/add/add.json


+ 0 - 0
packageA/orderForm/add.scss → packageA/orderForm/add/add.scss


+ 0 - 0
packageA/orderForm/add.skeleton.wxml → packageA/orderForm/add/add.skeleton.wxml


+ 0 - 0
packageA/orderForm/add.skeleton.wxss → packageA/orderForm/add/add.skeleton.wxss


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


+ 86 - 0
packageA/orderForm/add/float/index.js

@@ -0,0 +1,86 @@
+const _Http = getApp().globalData.http;
+
+Component({
+  data: {
+    types: [{
+      name: '标准订单'
+    }, {
+      name: '项目订单'
+    }],
+    actionShow: false,
+  },
+  methods: {
+    /* 挑选新增订单类型 */
+    onSelect() {
+      this.setData({
+        actionShow: true
+      })
+    },
+    /* 选择订单类型 */
+    selectType({
+      detail
+    }) {
+      switch (detail.name) {
+        case '标准订单':
+          wx.navigateTo({
+            url: '/packageA/orderForm/add/add',
+          })
+          break;
+        case '项目订单':
+          /* 前去挑选合同 */
+          wx.navigateTo({
+            url: `/select/contract/index?params=${JSON.stringify({
+              "id": 20230103150802,
+              "content": {
+                  "pageNumber": 1,
+                  "pageTotal": 1,
+                  "total": null,
+                  "pageSize": 20,
+                  "where": {
+                      "condition": ""
+                  }
+              }
+          })}&radio=false`,
+          })
+          getApp().globalData.handleSelect = this.addProjectOrder.bind(this);
+          break;
+      }
+      this.onCancel();
+    },
+    /* 取消选择订单类型 */
+    onCancel() {
+      this.setData({
+        actionShow: false
+      })
+    },
+    addProjectOrder(e) {
+      wx.showModal({
+        title: '提示',
+        content: `是否确认创建“${e.item.billno}”相关“${e.item.projectname}”项目订单?`,
+        complete: (res) => {
+          if (res.confirm) _Http.basic({
+            "id": 20230103141402,
+            "content": {
+              sa_orderid: 0,
+              "sa_contractid": e.item.sa_contractid, //合同ID,
+              "sa_projectid": e.item.sa_projectid, //工程项目表ID,
+            }
+          }).then(res => {
+            console.log("创建商品订单", res)
+            wx.showToast({
+              title: res.msg != '成功' ? res.msg : '创建成功',
+              icon: "none"
+            });
+            if (res.msg == '成功') setTimeout(() => {
+              wx.redirectTo({
+                url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
+              });
+              let page = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/index');
+              if (page) page.getList(true);
+            }, 500)
+          })
+        }
+      })
+    }
+  }
+})

+ 4 - 0
packageA/orderForm/add/float/index.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 1 - 0
packageA/orderForm/add/float/index.scss

@@ -0,0 +1 @@
+/* packageA/orderForm/add/float/index.wxss */

+ 2 - 0
packageA/orderForm/add/float/index.wxml

@@ -0,0 +1,2 @@
+<Yl_FloatingButton bindtap="onSelect" />
+<van-action-sheet show="{{ actionShow }}" actions="{{ types }}" cancel-text="取消" bind:select='selectType' bind:cancel='onCancel' bind:click-overlay='onCancel' />

+ 56 - 4
packageA/orderForm/index.js

@@ -2,8 +2,8 @@ const _Http = getApp().globalData.http;
 
 Page({
     data: {
-        active: 1,
         loading: true,
+        active: 1,
         amount: 0,
         "content": {
             "isExport": 0,
@@ -19,9 +19,34 @@ Page({
             },
             sort: []
         },
+        filter: [{
+            label: "品牌",
+            index: null,
+            showName: "brandname", //显示字段
+            valueKey: "brandname", //返回Key
+            selectKey: "brandname", //传参 代表选着字段 不传参返回整个选择对象
+            value: "", //选中值
+            list: []
+        }, {
+            label: "领域",
+            index: null,
+            showName: "tradefield", //显示字段
+            valueKey: "tradefield", //返回Key
+            selectKey: "tradefield", //传参 代表选着字段 不传参返回整个选择对象
+            value: "", //选中值
+            list: []
+        }]
     },
     onLoad(options) {
         this.getList()
+        this.getBrand()
+        this.getDomain()
+    },
+    /* 处理筛选 */
+    handleFilter({
+        detail
+    }) {
+        console.log(detail)
     },
     /* 获取产品 */
     getList(init = false) {
@@ -82,9 +107,36 @@ Page({
     setListHeight() {
         this.selectComponent("#ListBox").setHeight(".tips", this);
     },
-    add() {
-        wx.navigateTo({
-            url: '/packageA/orderForm/add',
+    /* 获取品牌 */
+    getBrand() {
+        _Http.basic({
+            "id": 20220924163702,
+            "content": {
+                "pageSize": 9999,
+            }
+        }, false).then(res => {
+            console.log("查询品牌", res)
+            if (res.msg == '成功') this.setData({
+                "filter[0].list": res.data
+            });
+        })
+    },
+    /* 获取领域 */
+    getDomain() {
+        _Http.basic({
+            "id": 20221223141802,
+            "content": {
+                "pageNumber": 1,
+                "pageSize": 9999,
+                "where": {
+                    "condition": ""
+                }
+            }
+        }, false).then(res => {
+            console.log("获取领域", res)
+            if (res.msg == '成功') this.setData({
+                "filter[1].list": res.data
+            });
         })
     },
 })

+ 2 - 1
packageA/orderForm/index.json

@@ -1,5 +1,6 @@
 {
   "usingComponents": {
-    "List": "./modules/list/index"
+    "List": "./modules/list/index",
+    "Float":"./add/float/index"
   }
 }

+ 4 - 2
packageA/orderForm/index.wxml

@@ -16,5 +16,7 @@
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
     <List list="{{list}}" />
 </Yl_ListBox>
-
-<Yl_FloatingButton bindtap="add" />
+<!-- 新建浮动按钮 -->
+<Float />
+<!-- 筛选条件 -->
+<Yl_Filtrate id='Filtrate' list="{{filter}}" bind:handle="handleFilter" dateRange='{{false}}' />