123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- 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)
- })
- }
- })
- },
- }
- })
|