| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808 | 
							- const _Http = getApp().globalData.http;
 
- let figure = null; //免运费额度
 
- import currency from "../../utils/currency";
 
- Page({
 
-     data: {
 
-         loading: true,
 
-         sa_orderid: null,
 
-         tabsActive: 0,
 
-         tabsList: [{
 
-             label: "产品明细",
 
-             icon: "icon-tabchanpin",
 
-             model: "#Product"
 
-         }, {
 
-             label: "附件",
 
-             icon: "icon-tabfujian1",
 
-             model: "#Yl_Attachment"
 
-         }, {
 
-             label: "订单进度",
 
-             icon: "icon-tabcaozuojilu1",
 
-             model: "#Progress"
 
-         }, {
 
-             label: "发票",
 
-             icon: "icon-tabkaipiaoxinxi",
 
-             model: "#Invoice"
 
-         }],
 
-         saletypeList: null,
 
-         showMYModel: false,
 
-         reminddays: 0,
 
-     },
 
-     onLoad(options) {
 
-         const authOptions = wx.getStorageSync('auth').worderform.options;
 
-         const checkPermission = (permission) => authOptions.includes(permission);
 
-         this.setData({
 
-             sa_orderid: options.id,
 
-             order_rebate_used: wx.getStorageSync('siteP').order_rebate_used,
 
-             userrole: wx.getStorageSync('userrole'),
 
-             isSubmit: checkPermission('submit'),
 
-             isDelete: checkPermission("delete"),
 
-             fixATime: checkPermission("fixATime"),
 
-             isRecall: checkPermission("recall"),
 
-             isSure: checkPermission("sure"),
 
-             ProductFile: checkPermission("ProductFile"),
 
-             siteid: wx.getStorageSync('userMsg').siteid
 
-         });
 
-         this.getDetail(true);
 
-         //销售分类
 
-         _Http.basic({
 
-             "classname": "sysmanage.develop.optiontype.optiontype",
 
-             "method": "optiontypeselect",
 
-             "content": {
 
-                 pageSize: "999",
 
-                 "typename": "saletype",
 
-                 "parameter": {
 
-                     "siteid": wx.getStorageSync('siteP').siteid
 
-                 }
 
-             }
 
-         }, false).then(res => {
 
-             console.log("销售分类", res)
 
-             if (res.code != '1') return wx.showToast({
 
-                 title: res.msg,
 
-                 icon: "none"
 
-             })
 
-             this.setData({
 
-                 saletypeList: res.data.map(v => {
 
-                     v.show = v.value + '-' + v.remarks
 
-                     return v
 
-                 })
 
-             })
 
-         })
 
-         getApp().globalData.Language.getLanguagePackage(this, 'E-订单');
 
-     },
 
-     /* 设置回签单 */
 
-     changeSignbackstatus(e) {
 
-         if (this.isEdit()) return this.setData({
 
-             "detail.signbackstatus": this.data.detail.signbackstatus
 
-         })
 
-         this.data.detail.signbackstatus = e.detail;
 
-         this.changeDetail();
 
-     },
 
-     /* 获取详情 */
 
-     getDetail(init = false, show = true) {
 
-         _Http.basic({
 
-             "id": 20221108151302,
 
-             "content": {
 
-                 nocache: true,
 
-                 "sa_orderid": this.data.sa_orderid
 
-             }
 
-         }, show).then(res => {
 
-             console.log("订单详情", res)
 
-             if (res.code != '1') return wx.showToast({
 
-                 title: res.msg,
 
-                 icon: "none"
 
-             });
 
-             let CNY = value => currency(value, {
 
-                 symbol: "¥",
 
-                 precision: 2
 
-             }).format();
 
-             let account = {
 
-                 name: "",
 
-                 text: ""
 
-             };
 
-             let accountclass = res.data.accountclass;
 
-             if (accountclass.accountname) {
 
-                 account.name = accountclass.accountname
 
-                 account.text = `\n(${getApp().globalData.Language.getMapText('余额')}:${CNY(accountclass.balance)},${getApp().globalData.Language.getMapText('信用额度')}:${CNY(accountclass.creditquota)})`
 
-             }
 
-             this.setData({
 
-                 detail: res.data,
 
-                 loading: false,
 
-                 defaultamount: CNY(res.data.defaultamount),
 
-                 account,
 
-                 reminddays: res.data.contract_reminddays || 7
 
-             });
 
-             if (init) {
 
-                 this.partialRenewal(true)
 
-                 let content = wx.getStorageSync('userrole') == '业务员' ? {
 
-                     sys_enterpriseid: this.data.detail.sys_enterpriseid
 
-                 } : {};
 
-                 //业务员根据指定经销商的免运费
 
-                 _Http.basic({
 
-                     "id": 20220920084001,
 
-                     content
 
-                 }, false).then(res => {
 
-                     console.log("查询企业档案获取企业免邮额度", res)
 
-                     if (res.code != '1') return wx.showToast({
 
-                         title: res.msg,
 
-                         icon: "none"
 
-                     })
 
-                     figure = res.data.freefreightamount;
 
-                     this.setLogisticsMsg();
 
-                 })
 
-             } else {
 
-                 this.setLogisticsMsg();
 
-             }
 
-         })
 
-     },
 
-     /* 免运费信息 */
 
-     setLogisticsMsg() {
 
-         let logistics = null;
 
-         if (figure == -1) {
 
-             logistics = '到付'
 
-         } else if (figure == 0) {
 
-             logistics = '预付'
 
-         } else {
 
-             let defaultamount = this.data.detail.defaultamount;
 
-             logistics = defaultamount >= figure ? '免运费' : (getApp().globalData.Language.getMapText('差') + currency(figure).subtract(defaultamount).value + getApp().globalData.Language.getMapText('元免运费'));
 
-         }
 
-         this.setData({
 
-             logistics
 
-         })
 
-     },
 
-     /* 选择销售分类 */
 
-     selectSaletype(e) {
 
-         if (this.isEdit()) return;
 
-         if (this.data.detail.type == '项目订单') return;
 
-     },
 
-     /* 设置销售分类 */
 
-     setSaletype(e) {
 
-         let {
 
-             value,
 
-             remarks
 
-         } = this.data.saletypeList[e.detail.value];
 
-         if (value == this.data.detail.saletype) return;
 
-         this.setData({
 
-             "detail.saletype": value,
 
-             "detail.saletyperemarks": remarks
 
-         })
 
-         this.changeDetail();
 
-     },
 
-     /* 选择结算人 */
 
-     selectAgent() {
 
-         if (this.isEdit()) return;
 
-         if (this.data.detail.type == '项目订单') return;
 
-         wx.navigateTo({
 
-             url: `/select/agent/index?params=${JSON.stringify({ 
 
- 				"id":20230104103702,
 
- 				"content": {
 
- 					"pageNumber": 1, 
 
- 					"pageTotal": 1, 
 
- 					"pageSize": 20,
 
- 					"where": {
 
- 						"condition": "",
 
- 						}, 
 
- 				}
 
- 			 })}&radio=true`,
 
-         });
 
-         getApp().globalData.handleSelect = this.setAgeant.bind(this);
 
-     },
 
-     /* 设置结算人 */
 
-     setAgeant({
 
-         item
 
-     }) {
 
-         let that = this;
 
-         console.log("选择经销商", 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: '是否确认设置',
 
-                 r: " "
 
-             }, {
 
-                 v: item.enterprisename,
 
-                 f: "“",
 
-                 r: "”"
 
-             }, {
 
-                 t: 1,
 
-                 v: '为结算人',
 
-                 r: "?"
 
-             }]),
 
-             complete: (res) => {
 
-                 if (res.confirm) {
 
-                     let pay_enterpriseid = that.data.detail.pay_enterpriseid,
 
-                         sys_enterprise_financeid = that.data.detail.sys_enterprise_financeid,
 
-                         sa_accountclassid = that.data.detail.accountclass.sa_accountclassid;
 
-                     that.setData({
 
-                         "detail.pay_enterpriseid": item.sys_enterpriseid,
 
-                         "detail.sys_enterprise_financeid": item.finance[0] ? item.finance[0].sys_enterprise_financeid : 0,
 
-                         "detail.accountclass.sa_accountclassid": item.accounts[0] ? item.accounts[0].sa_accountclassid : 0,
 
-                     });
 
-                     that.changeDetail().then(s => {
 
-                         if (s.code == '1') {
 
-                             wx.showToast({
 
-                                 title: getApp().globalData.Language.getMapText('设置成功'),
 
-                                 icon: "none"
 
-                             });
 
-                             setTimeout(() => {
 
-                                 wx.navigateBack();
 
-                                 that.getDetail();
 
-                             }, 500)
 
-                         } else {
 
-                             that.setData({
 
-                                 "detail.pay_enterpriseid": pay_enterpriseid,
 
-                                 "detail.sys_enterprise_financeid": sys_enterprise_financeid,
 
-                                 "detail.sa_accountclassid": sa_accountclassid
 
-                             });
 
-                         }
 
-                     })
 
-                 }
 
-             }
 
-         })
 
-     },
 
-     /* 选择收货人 */
 
-     selectConsignee() {
 
-         if (this.isEdit()) return;
 
-         wx.navigateTo({
 
-             url: `/select/address/index?params=${JSON.stringify({ 
 
- 				"id":20221009155803,
 
- 				"content": {
 
- 					nocache:true,
 
- 					sys_enterpriseid:this.data.detail.sys_enterpriseid,
 
- 					"pageNumber": 1, 
 
- 					"pageTotal": 1, 
 
- 					"pageSize": 20,
 
- 					"where": {
 
- 						"condition": "",
 
- 						workaddress:1
 
- 						}, 
 
- 				}
 
- 			 })}&radio=true`,
 
-         });
 
-         getApp().globalData.handleSelect = this.setConsignee.bind(this);
 
-     },
 
-     /* 设置收货人 */
 
-     setConsignee({
 
-         item
 
-     }) {
 
-         let that = this;
 
-         console.log("设置收货人", 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: '是否确认设置',
 
-                 r: " "
 
-             }, {
 
-                 v: item.name,
 
-                 f: "“",
 
-                 r: "”"
 
-             }, {
 
-                 t: 1,
 
-                 v: '为收货人',
 
-                 r: "?"
 
-             }]),
 
-             complete: (res) => {
 
-                 console.log(res)
 
-                 if (res.confirm) {
 
-                     let rec_contactsid = that.data.detail.rec_contactsid;
 
-                     that.setData({
 
-                         "detail.rec_contactsid": item.contactsid
 
-                     });
 
-                     that.changeDetail().then(s => {
 
-                         if (s.code == '1') {
 
-                             wx.showToast({
 
-                                 title: getApp().globalData.Language.getMapText('设置成功'),
 
-                                 icon: "none"
 
-                             });
 
-                             setTimeout(() => {
 
-                                 wx.navigateBack();
 
-                                 that.getDetail();
 
-                             }, 500)
 
-                         } else {
 
-                             that.setData({
 
-                                 "detail.rec_contactsid": rec_contactsid
 
-                             });
 
-                         }
 
-                     })
 
-                 }
 
-             }
 
-         })
 
-     },
 
-     /* 选择财务信息 */
 
-     selectFinance() {
 
-         if (this.isEdit()) return;
 
-         wx.navigateTo({
 
-             url: `/select/finance/index?params=${JSON.stringify({ 
 
- 				"id":20221013160602,
 
- 				"content": {
 
- 					nocache:true,
 
- 					sys_enterpriseid:this.data.detail.sys_enterpriseid,
 
- 					"pageNumber": 1, 
 
- 					"pageTotal": 1, 
 
- 					"pageSize": 20,
 
- 					"where": {
 
- 						"condition": "",
 
- 					}, 
 
- 				}
 
- 			 })}&radio=true`,
 
-         });
 
-         getApp().globalData.handleSelect = this.setFinance.bind(this);
 
-     },
 
-     /* 设置财务信息 */
 
-     setFinance({
 
-         item
 
-     }) {
 
-         let that = this;
 
-         console.log("设置财务信息", 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: '是否确认设置',
 
-                 r: " "
 
-             }, {
 
-                 v: item.enterprisename,
 
-                 f: "“",
 
-                 r: "”"
 
-             }, {
 
-                 t: 1,
 
-                 v: '为开票单位',
 
-                 r: "?"
 
-             }]),
 
-             complete: (res) => {
 
-                 if (res.confirm) {
 
-                     let sys_enterprise_financeid = that.data.detail.sys_enterprise_financeid;
 
-                     that.setData({
 
-                         "detail.sys_enterprise_financeid": item.sys_enterprise_financeid
 
-                     });
 
-                     that.changeDetail().then(s => {
 
-                         if (s.code == '1') {
 
-                             wx.showToast({
 
-                                 title: getApp().globalData.Language.getMapText('设置成功'),
 
-                                 icon: "none"
 
-                             });
 
-                             setTimeout(() => {
 
-                                 wx.navigateBack();
 
-                                 that.getDetail();
 
-                             }, 500)
 
-                         } else {
 
-                             that.setData({
 
-                                 "detail.sys_enterprise_financeid": sys_enterprise_financeid
 
-                             });
 
-                         }
 
-                     })
 
-                 }
 
-             }
 
-         })
 
-     },
 
-     //tabs 切换
 
-     tabsChange({
 
-         detail
 
-     }) {
 
-         this.setData({
 
-             tabsActive: detail
 
-         });
 
-         this.partialRenewal();
 
-     },
 
-     //局部数据更新 tabs
 
-     partialRenewal(init = false) {
 
-         let model = this.data.tabsList[this.data.tabsActive].model;
 
-         if (model) {
 
-             let Component = this.selectComponent(model),
 
-                 {
 
-                     total,
 
-                     pageNumber,
 
-                     pageTotal
 
-                 } = Component.data.content,
 
-                 id = this.data.detail.sa_orderid;
 
-             if (total == null || init) {
 
-                 Component.getList(id, init);
 
-             } else if (pageNumber <= pageTotal) {
 
-                 Component.getList(id, false);
 
-             }
 
-         }
 
-     },
 
-     onReachBottom() {
 
-         this.partialRenewal();
 
-     },
 
-     /* 更新数据 */
 
-     changeDetail() {
 
-         let data = this.data.detail,
 
-             content = {
 
-                 "sa_orderid": data.sa_orderid,
 
-                 "sys_enterpriseid": data.sys_enterpriseid, //订货企业id
 
-                 "sa_accountclassid": data.accountclass.sa_accountclassid || 0, //营销账户类型ID
 
-                 projectnote: data.projectnote || "", //项目备注
 
-                 "sa_brandid": data.sa_brandid, //品牌ID
 
-                 "sys_enterprise_financeid": data.sys_enterprise_financeid || 0, //合作企业财务信息ID(开票信息)
 
-                 //"sa_logiscompid": data.logiscomp.sa_logiscompid || 0, 物流公司档案ID
 
-                 "rec_contactsid": data.rec_contactsid || 0, //合作企业联系人表ID(收货信息)
 
-                 "type": data.type, //订单类型
 
-                 "typemx": data.typemx, // 明细分类,可选
 
-                 "remarks": data.remarks,
 
-                 "saler_hrid": data.saler_hrid, //销售人员hrid,业务员hrid
 
-                 "tradefield": data.tradefield, //必选
 
-                 "pay_enterpriseid": data.pay_enterpriseid, //结算单位
 
-                 "rebate_userate": data.accountclass.rebate_userate, //返利金使用比例
 
-                 signbackstatus: data.signbackstatus,
 
-                 saletype: data.saletype
 
-             };
 
-         if (content.type = '项目订单') {
 
-             content.sa_contractid = data.sa_contractid,
 
-                 content.sa_projectid = data.sa_projectid;
 
-         }
 
-         return new Promise((resolve, reject) => {
 
-             _Http.basic({
 
-                 "id": 20221108111402,
 
-                 content
 
-             }).then(res => {
 
-                 console.log("修改订单数据", res);
 
-                 if (res.code != '1') wx.showToast({
 
-                     title: res.msg,
 
-                     icon: "none"
 
-                 });
 
-                 resolve(res)
 
-             })
 
-         })
 
-     },
 
-     /* 修改订单备注 */
 
-     changeRemarks(e) {
 
-         let name = e.currentTarget.dataset.name,
 
-             value = e.detail.value,
 
-             remarks = this.data.detail[name],
 
-             that = this;
 
-         if (value == remarks) return;
 
-         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: '是否确定修改',
 
-                 r: " "
 
-             }, {
 
-                 t: 1,
 
-                 v: name == 'remarks' ? '订单' : '项目',
 
-                 f: "“",
 
-                 r: "”"
 
-             }, {
 
-                 t: 1,
 
-                 v: '备注',
 
-                 r: "?"
 
-             }]),
 
-             complete: async (res) => {
 
-                 if (res.cancel) that.setData({
 
-                     [`detail[${name}]`]: remarks
 
-                 })
 
-                 if (res.confirm) {
 
-                     this.data.detail[name] = value;
 
-                     let res = await that.changeDetail();
 
-                     that.setData({
 
-                         [`detail${name}`]: res.code == '1' ? value : remarks
 
-                     })
 
-                 }
 
-             }
 
-         })
 
-     },
 
-     /* 设置是否使用返利金 */
 
-     changeRebateUsed() {
 
-         if (this.isEdit()) return this.setData({
 
-             detail: this.data.detail
 
-         })
 
-         let amount = (this.data.detail.order_rebate_userate * this.data.detail.defaultamount).toFixed(2); //最大可用金额
 
-         let rebatebalance = this.data.detail.rebatebalance; //返利金账户余额
 
-         _Http.basic({
 
-             "id": 20230218225002,
 
-             "content": {
 
-                 "sa_orderid": this.data.sa_orderid, //订单金额
 
-                 "isused": this.data.detail.rebate_used == 1 ? 0 : 1, //是否使用
 
-                 "rebateamount": rebatebalance > amount ? amount : rebatebalance //返利金使用金额
 
-             }
 
-         }, false).then(res => {
 
-             console.log('设置启用返利金', res)
 
-             if (res.code != '1') {
 
-                 wx.showToast({
 
-                     title: res.msg,
 
-                     icon: "none"
 
-                 });
 
-                 this.setData({
 
-                     "detail.rebate_used": this.data.detail.rebate_used
 
-                 })
 
-                 return;
 
-             }
 
-             this.getDetail(true, false)
 
-         })
 
-     },
 
-     /* 修改返利金 */
 
-     setRebate_amount(e = 0) {
 
-         let value = e.detail.value;
 
-         let rebatebalance = this.data.detail.rebatebalance; //返利金账户余额
 
-         value = value > rebatebalance ? rebatebalance : value;
 
-         let amount = (this.data.detail.order_rebate_userate * this.data.detail.defaultamount).toFixed(2); //最大可用金额
 
-         _Http.basic({
 
-             "id": 20230218225002,
 
-             "content": {
 
-                 "sa_orderid": this.data.sa_orderid, //订单金额
 
-                 "isused": 1, //是否使用
 
-                 "rebateamount": value > amount ? amount : value
 
-             }
 
-         }, false).then(res => {
 
-             console.log('设置返利金', res)
 
-             if (res.code != '1') {
 
-                 wx.showToast({
 
-                     title: res.msg,
 
-                     icon: "none",
 
-                     mask: true
 
-                 });
 
-                 this.setData({
 
-                     "detail.accountclass.rebate_amount": this.data.detail.accountclass.rebate_amount
 
-                 })
 
-             } else {
 
-                 this.setData({
 
-                     "detail.accountclass.rebate_amount": value
 
-                 })
 
-                 if (value > amount || amount == 0) getApp().globalData.Language.showToast(
 
-                     [{
 
-                         t: 1,
 
-                         v: '返利金最大可使用',
 
-                         r: " "
 
-                     }, {
 
-                         v: amount,
 
-                         f: "“",
 
-                         r: "”"
 
-                     }, {
 
-                         t: 1,
 
-                         v: '元'
 
-                     }])
 
-                 this.getDetail(true, false)
 
-             }
 
-         })
 
-     },
 
-     /* 删除订单 */
 
-     deleteItem() {
 
-         let that = this;
 
-         wx.showModal({
 
-             cancelText: getApp().globalData.Language.getMapText('取消'),
 
-             confirmText: getApp().globalData.Language.getMapText('确定'),
 
-             title: getApp().globalData.Language.getMapText('提示'),
 
-             content: getApp().globalData.Language.getMapText('是否确认删除订单') + '?',
 
-             complete: (res) => {
 
-                 if (res.confirm) _Http.basic({
 
-                     "id": 20221108152102,
 
-                     "content": {
 
-                         "sa_orderids": [
 
-                             that.data.sa_orderid
 
-                         ]
 
-                     }
 
-                 }).then(s => {
 
-                     console.log("删除订单", s)
 
-                     if (s.code != '1') return wx.showToast({
 
-                         title: s.msg,
 
-                         icon: "none"
 
-                     });
 
-                     getApp().globalData.Language.showToast('删除成功')
 
-                     setTimeout(() => {
 
-                         /*  let page = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/index');
 
-                          if (page) page.setData({
 
-                              list: page.data.list.filter(v => v.sa_orderid != that.data.sa_orderid),
 
-                              "content.total": page.data.content.total - 1,
 
-                              amount: (page.data.amount - that.data.detail.amount).toFixed(2)
 
-                          }); */
 
-                         wx.navigateBack()
 
-                     }, 500)
 
-                 })
 
-             }
 
-         })
 
-     },
 
-     /* 提交订单 */
 
-     submit() {
 
-         let that = this;
 
-         if (['HY', 'YOSTEST1'].includes(wx.getStorageSync('userMsg').siteid)) {
 
-             this.setData({
 
-                 showMYModel: true
 
-             })
 
-         } else {
 
-             wx.showModal({
 
-                 cancelText: getApp().globalData.Language.getMapText('取消'),
 
-                 confirmText: getApp().globalData.Language.getMapText('确定'),
 
-                 title: getApp().globalData.Language.getMapText('提示'),
 
-                 content: getApp().globalData.Language.getMapText('是否确认提交订单') + '?',
 
-                 complete: (res) => {
 
-                     if (res.confirm) that.handleSubmit();
 
-                 }
 
-             })
 
-         }
 
-     },
 
-     handleSubmit(reminddays = 0) {
 
-         _Http.basic({
 
-             "id": 20221108153402,
 
-             "content": {
 
-                 sa_orderid: this.data.sa_orderid,
 
-                 reminddays
 
-             },
 
-         }).then(s => {
 
-             console.log("提交订单", s)
 
-             wx.showToast({
 
-                 title: s.code != '1' ? s.msg : getApp().globalData.Language.getMapText('提交成功'),
 
-                 icon: "none"
 
-             });
 
-             if (s.code == '1') this.getDetail(true, false)
 
-         })
 
-     },
 
-     confirmSubmit() {
 
-         let that = this;
 
-         wx.showModal({
 
-             cancelText: getApp().globalData.Language.getMapText('取消'),
 
-             confirmText: getApp().globalData.Language.getMapText('确定'),
 
-             title: getApp().globalData.Language.getMapText('提示'),
 
-             content: getApp().globalData.Language.getMapText('是否确认提交订单') + '?',
 
-             complete: (res) => {
 
-                 if (res.confirm) _Http.basic({
 
-                     "id": 2025011514120303,
 
-                     "content": {
 
-                         sa_orderid: that.data.sa_orderid,
 
-                         reminddays: that.data.reminddays
 
-                     },
 
-                 }).then(s => {
 
-                     console.log("确定提交订单", s)
 
-                     wx.showToast({
 
-                         title: s.code != '1' ? s.msg : getApp().globalData.Language.getMapText('提交成功'),
 
-                         icon: "none"
 
-                     });
 
-                     if (s.code == '1') that.getDetail(true, false)
 
-                 })
 
-             }
 
-         })
 
-     },
 
-     recall() {
 
-         let that = this;
 
-         wx.showModal({
 
-             cancelText: getApp().globalData.Language.getMapText('取消'),
 
-             confirmText: getApp().globalData.Language.getMapText('确定'),
 
-             title: getApp().globalData.Language.getMapText('提示'),
 
-             content: getApp().globalData.Language.getMapText('是否确认撤回订单') + '?',
 
-             complete: (res) => {
 
-                 if (res.confirm) _Http.basic({
 
-                     "id": 20230301190202,
 
-                     "content": {
 
-                         sa_orderid: that.data.sa_orderid
 
-                     },
 
-                 }).then(s => {
 
-                     console.log("确定提交订单", s)
 
-                     wx.showToast({
 
-                         title: s.code != '1' ? s.msg : getApp().globalData.Language.getMapText('撤回成功'),
 
-                         icon: "none"
 
-                     });
 
-                     if (s.code == '1') that.getDetail(true, false)
 
-                 })
 
-             }
 
-         })
 
-     },
 
-     stepperSubmit() {
 
-         this.handleSubmit(this.data.reminddays)
 
-     },
 
-     dialogOnClose() {
 
-         this.setData({
 
-             showMYModel: false
 
-         })
 
-     },
 
-     stepperChange({
 
-         detail
 
-     }) {
 
-         this.setData({
 
-             reminddays: detail
 
-         })
 
-     },
 
-     /* 确认订单交期 */
 
-     notarize() {
 
-         let that = this;
 
-         wx.showModal({
 
-             cancelText: getApp().globalData.Language.getMapText('取消'),
 
-             confirmText: getApp().globalData.Language.getMapText('确定'),
 
-             title: getApp().globalData.Language.getMapText('提示'),
 
-             content: getApp().globalData.Language.getMapText('是否确认交期') + '?',
 
-             complete: (res) => {
 
-                 if (res.confirm) _Http.basic({
 
-                     "id": 20221230094802,
 
-                     "content": {
 
-                         sa_orderid: that.data.sa_orderid
 
-                     },
 
-                 }).then(s => {
 
-                     console.log("确认交期", s)
 
-                     wx.showToast({
 
-                         title: s.code != '1' ? s.msg : getApp().globalData.Language.getMapText('确认成功'),
 
-                         icon: "none"
 
-                     });
 
-                     if (s.code == '1') {
 
-                         that.setData({
 
-                             "detail.status": "交期确认"
 
-                         })
 
-                     }
 
-                 })
 
-             }
 
-         })
 
-     },
 
-     /* 判断是否可以编辑 */
 
-     isEdit() {
 
-         if (this.data.detail.status != '新建') getApp().globalData.Language.showToast('当前订单状态不可设置!')
 
-         if (this.data.detail.type == '特殊订单') getApp().globalData.Language.showToast('特殊订单不可设置!')
 
-         return this.data.detail.status != '新建' || this.data.detail.type == '特殊订单';
 
-     },
 
-     /* 拷贝订单 */
 
-     copyItem() {
 
-         let item = this.data.detail;
 
-         wx.showModal({
 
-             cancelText: getApp().globalData.Language.getMapText('取消'),
 
-             confirmText: getApp().globalData.Language.getMapText('确定'),
 
-             title: getApp().globalData.Language.getMapText('提示'),
 
-             content: getApp().globalData.Language.getMapText('是否确认复制') + `${getApp().globalData.Language.showToast(item.type)}“${item.sonum}”`,
 
-             complete: (res) => {
 
-                 if (res.confirm) _Http.basic({
 
-                     "id": 20230102144502,
 
-                     "content": {
 
-                         "sa_orderid": item.sa_orderid
 
-                     }
 
-                 }).then(res => {
 
-                     console.log("复制订单", res)
 
-                     if (res.code != '1') return wx.showToast({
 
-                         title: res.msg,
 
-                         icon: "none"
 
-                     });
 
-                     wx.showModal({
 
-                         cancelText: getApp().globalData.Language.getMapText('取消'),
 
-                         confirmText: getApp().globalData.Language.getMapText('确定'),
 
-                         title: getApp().globalData.Language.getMapText('提示'),
 
-                         content: getApp().globalData.Language.showToast(item.type) + ' ' + getApp().globalData.Language.showToast('复制成功 是否立即前往'),
 
-                         complete: (s) => {
 
-                             if (s.confirm) wx.redirectTo({
 
-                                 url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
 
-                             })
 
-                         }
 
-                     })
 
-                 })
 
-             }
 
-         })
 
-     },
 
-     /* 设置项目订单品牌领域 */
 
-     setBraned() {
 
-         wx.navigateTo({
 
-             url: './modules/setBrand/index?id=' + this.data.sa_orderid,
 
-         })
 
-     },
 
-     onUnload() {
 
-         let page = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/index');
 
-         let content = JSON.parse(JSON.stringify(page.data.content));
 
-         content.pageNumber = 1;
 
-         content.pageSize = (page.data.content.pageNumber - 1) * page.data.content.pageSize;
 
-         _Http.basic({
 
-             "id": this.data.userrole == '业务员' ? 20221111145202 : 20221224180302,
 
-             content
 
-         }).then(res => {
 
-             console.log("订单列表", res)
 
-             if (res.code != '1') return;
 
-             /* 格式化价格 */
 
-             if (res.data.length != 0) res.data = res.data.map(v => {
 
-                 v.defaultamount = currency(v.defaultamount, {
 
-                     symbol: "¥",
 
-                     precision: 2
 
-                 }).format();
 
-                 return v
 
-             })
 
-             page.setData({
 
-                 list: res.data,
 
-                 "content.total": res.total,
 
-                 amount: currency(res.tips.amount, {
 
-                     symbol: "¥",
 
-                     precision: 2
 
-                 }).format()
 
-             })
 
-         })
 
-     },
 
- })
 
 
  |