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?type=标准订单', }) 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) { wx.navigateTo({ url: `/packageA/orderForm/add/add?type=项目订单&sa_contractid=${e.item.sa_contractid}&sa_projectid=${ e.item.sa_projectid}`, }) } /* _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) }) */ } }) } } })