| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 | const _Http = getApp().globalData.http;Component({    data: {        types: [{            name: '标准订单'        }, {            name: '项目订单'        }, {            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": {                                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(e) {            wx.showModal({                title: '提示',                content: `是否确认创建“${e.item.billno}”相关“${e.item.projectname}”项目订单?`,                complete: (res) => {                    if (res.confirm) wx.redirectTo({                        url: `/packageA/orderForm/add/add?type=项目订单&sa_contractid=${e.item.sa_contractid}&sa_projectid=${ e.item.sa_projectid}`,                    })                }            })        },        addActivityOrder({            item        }) {            console.log(item)            wx.showModal({                title: '提示',                content: `是否确定创建“${item.promname}”促销订单`,                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.msg != '成功' ? res.msg : '创建成功',                            icon: "none",                            mask: true                        });                        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)                    })                }            })        },    }})
 |