const _Http = getApp().globalData.http; Component({ data: { types: [{ value: '标准订单', name: getApp().globalData.Language.getMapText('标准订单') }, { value: '项目订单', name: getApp().globalData.Language.getMapText('项目订单') }, { value: '工具订单', name: getApp().globalData.Language.getMapText('工具订单') }], actionShow: false, }, lifetimes: { attached: function () { getApp().globalData.Language.getLanguagePackage(this) } }, methods: { /* 挑选新增订单类型 */ onSelect() { this.setData({ actionShow: true }) }, /* 选择订单类型 */ selectType({ detail }) { switch (detail.value) { case '标准订单': wx.navigateTo({ url: '/packageA/orderForm/add/add?type=标准订单', }) break; case '项目订单': /* 前去挑选合同 */ wx.navigateTo({ url: `/select/contract/index?params=${JSON.stringify({ "id": 20230103150802, "content": { nocache: true, "pageNumber": 1, "pageTotal": 1, "total": null, "pageSize": 20, "where": { "condition": "" } } })}&radio=false` }) getApp().globalData.handleSelect = this.addProjectOrder.bind(this); break; case '促销订单': /* 前去挑选合同 */ wx.navigateTo({ url: `/select/activity/index?params=${JSON.stringify({ "id": 20220103140003, "content": { "version": 1, "nocache": true, "pageNumber": 1, "pageTotal": 1, "where": { "condition": "" }, "sort": [] } })}&radio=false` }) getApp().globalData.handleSelect = this.addActivityOrder.bind(this); break; case '工具订单': wx.navigateTo({ url: '/packageA/orderForm/add/add?type=工具订单', }) break; } this.onCancel(); }, /* 取消选择订单类型 */ onCancel() { this.setData({ actionShow: false }) }, /* 创建项目订单 */ addProjectOrder({ item }) { wx.showModal({ cancelText: getApp().globalData.Language.getMapText('取消'), confirmText: getApp().globalData.Language.getMapText('确定'), title: getApp().globalData.Language.getMapText('提示'), content: getApp().globalData.Language.joint([{ t: 1, v: '是否确认创建' }, { v: item.billno, f: "“", r: '”' }, { t: 1, v: '相关' }, { v: item.projectname, f: "“", r: '”' }, { t: 1, v: '项目订单', r: '?' }]), complete: (res) => { if (res.confirm) _Http.basic({ "id": 20230103141402, "content": { "sys_enterpriseid": item.sys_enterpriseid, //订货企业id,可不传,默认取当前账号的 "sa_contractid": item.sa_contractid, //合同ID, "sa_projectid": item.sa_projectid, //工程项目表ID, }, }).then(res => { console.log("新建项目订单", res) if (res.code != '1') return wx.showToast({ title: res.msg, icon: "none", mask: true }) if (res.code == '1') 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) }) } }) }, addActivityOrder({ item }) { wx.showModal({ cancelText: getApp().globalData.Language.getMapText('取消'), confirmText: getApp().globalData.Language.getMapText('确定'), title: getApp().globalData.Language.getMapText('提示'), content: getApp().globalData.Language.joint([{ t: 1, v: '是否确定创建' }, { v: item.promname, f: "“", r: '”' }, { t: 1, v: '促销订单', r: '?' }]), complete: (s) => { if (s) _Http.basic({ "id": 20221108111402, content: { sa_orderid: 0, sa_accountclassid: item.sa_accountclassid, rec_contactsid: 0, pay_enterpriseid: 0, sa_contractid: 0, sa_projectid: 0, sa_promotionid: item.sa_promotionid, "sa_brandid": item.sa_brandid, //品牌ID "type": '促销订单', //订单类型 "tradefield": item.tradefield, //必选 } }).then(res => { console.log("创建促销订单", res); wx.showToast({ title: res.code != '1' ? res.msg : getApp().globalData.Language.getMapText('创建成功'), icon: "none", mask: true }); if (res.code == '1') 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) }) } }) }, } })