浏览代码

快捷创建订单

xiaohaizhao 1 年之前
父节点
当前提交
280db7f5c3
共有 2 个文件被更改,包括 48 次插入5 次删除
  1. 46 4
      packageA/orderForm/index.js
  2. 2 1
      packageA/orderForm/index.wxml

+ 46 - 4
packageA/orderForm/index.js

@@ -49,7 +49,7 @@ Page({
       }
     };
     this.getList()
-    // this.getBrand()
+    this.getBrand()
     this.getDomain()
   },
   /* 获取产品 */
@@ -146,9 +146,7 @@ Page({
       }
     }, false).then(res => {
       console.log("查询品牌", res)
-      if (res.msg == '成功') this.setData({
-        "filtratelist[0].list": res.data
-      });
+      if (res.msg == '成功') this.data.brandList = res.data
     })
   },
   /* 获取领域 */
@@ -191,5 +189,49 @@ Page({
     downCount = setTimeout(() => {
       this.getList(true);
     }, 300);
+  },
+  createOrder() {
+    if (this.data.brandList.length == 1 && this.data.filtratelist[1].list.length == 1) {
+
+      wx.showModal({
+        title: '提示',
+        content: '是否确定创建标准订单',
+        complete: ({
+          confirm
+        }) => {
+          if (confirm) _Http.basic({
+            "id": 20221108111402,
+            content: {
+              sa_orderid: 0,
+              rec_contactsid: 0,
+              pay_enterpriseid: 0,
+              sa_contractid: 0,
+              sa_projectid: 0,
+              "sa_brandid": this.data.brandList[0].sa_brandid, //品牌ID
+              "type": "标准订单", //订单类型
+              "tradefield": this.data.filtratelist[1].list[0].tradefield, //必选
+              sys_enterpriseid: 0
+            }
+          }).then(res => {
+            console.log("创建标准订单", res);
+            wx.showToast({
+              title: res.msg != '成功' ? res.msg : '创建成功',
+              icon: "none",
+              mask: true
+            });
+            if (res.msg == '成功') setTimeout(() => {
+              wx.navigateTo({
+                url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
+              });
+            }, 500)
+          })
+        }
+      })
+
+    } else {
+      wx.navigateTo({
+        url: '/packageA/orderForm/add/add?type=标准订单',
+      })
+    }
   }
 })

+ 2 - 1
packageA/orderForm/index.wxml

@@ -21,7 +21,8 @@
         <List list="{{list}}" hidePrice='{{hidePrice}}' />
         <view style="height:150rpx;" />
     </Yl_ListBox>
-    <Float wx:if="{{isInsert}}" />
+    <!-- <Float wx:if="{{isInsert}}" /> -->
+    <Yl_FloatingButton wx:if="{{isInsert}}" bindtap="createOrder" />
 </view>
 
 <view class="DrawerClose {{modalName=='viewModal'?'show':''}}" bindtap="hideModal">