detail.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. const _Http = getApp().globalData.http;
  2. let figure = null; //免运费额度
  3. import currency from "../../utils/currency";
  4. Page({
  5. data: {
  6. loading: true,
  7. sa_orderid: null,
  8. tabsActive: 0,
  9. tabsList: [{
  10. label: "产品明细",
  11. icon: "icon-tabchanpin",
  12. model: "#Product"
  13. }, {
  14. label: "附件",
  15. icon: "icon-tabfujian1",
  16. model: "#Yl_Attachment"
  17. }, {
  18. label: "订单进度",
  19. icon: "icon-tabcaozuojilu1",
  20. model: "#Progress"
  21. }, {
  22. label: "发票",
  23. icon: "icon-tabkaipiaoxinxi",
  24. model: "#Invoice"
  25. }],
  26. saletypeList: null,
  27. showMYModel: false,
  28. reminddays: 0,
  29. },
  30. onLoad(options) {
  31. this.setData({
  32. sa_orderid: options.id,
  33. order_rebate_used: wx.getStorageSync('siteP').order_rebate_used,
  34. userrole: wx.getStorageSync('userrole'),
  35. isSubmit: wx.getStorageSync('auth').worderform.options.some(v => v == 'submit'),
  36. isDelete: wx.getStorageSync('auth').worderform.options.some(v => v == 'delete'),
  37. fixATime: wx.getStorageSync('auth').worderform.options.some(v => v == 'fixATime'),
  38. });
  39. this.getDetail(true);
  40. //销售分类
  41. _Http.basic({
  42. "classname": "sysmanage.develop.optiontype.optiontype",
  43. "method": "optiontypeselect",
  44. "content": {
  45. pageSize: "999",
  46. "typename": "saletype",
  47. "parameter": {
  48. "siteid": wx.getStorageSync('siteP').siteid
  49. }
  50. }
  51. }, false).then(res => {
  52. console.log("销售分类", res)
  53. if (res.code != '1') return wx.showToast({
  54. title: res.msg,
  55. icon: "none"
  56. })
  57. this.setData({
  58. saletypeList: res.data.map(v => {
  59. v.show = v.value + '-' + v.remarks
  60. return v
  61. })
  62. })
  63. })
  64. getApp().globalData.Language.getLanguagePackage(this, 'E-订单');
  65. },
  66. /* 设置回签单 */
  67. changeSignbackstatus(e) {
  68. if (this.isEdit()) return this.setData({
  69. "detail.signbackstatus": this.data.detail.signbackstatus
  70. })
  71. this.data.detail.signbackstatus = e.detail;
  72. this.changeDetail();
  73. },
  74. /* 获取详情 */
  75. getDetail(init = false, show = true) {
  76. _Http.basic({
  77. "id": 20221108151302,
  78. "content": {
  79. nocache: true,
  80. "sa_orderid": this.data.sa_orderid
  81. }
  82. }, show).then(res => {
  83. console.log("订单详情", res)
  84. if (res.code != '1') return wx.showToast({
  85. title: res.msg,
  86. icon: "none"
  87. });
  88. let CNY = value => currency(value, {
  89. symbol: "¥",
  90. precision: 2
  91. }).format();
  92. let account = {
  93. name: "",
  94. text: ""
  95. };
  96. let accountclass = res.data.accountclass;
  97. if (accountclass.accountname) {
  98. account.name = accountclass.accountname
  99. account.text = `\n(${getApp().globalData.Language.getMapText('余额')}:${CNY(accountclass.balance)},${getApp().globalData.Language.getMapText('信用额度')}:${CNY(accountclass.creditquota)})`
  100. }
  101. this.setData({
  102. detail: res.data,
  103. loading: false,
  104. defaultamount: CNY(res.data.defaultamount),
  105. account,
  106. reminddays: res.data.contract_reminddays || 7
  107. });
  108. if (init) {
  109. this.partialRenewal(true)
  110. let content = wx.getStorageSync('userrole') == '业务员' ? {
  111. sys_enterpriseid: this.data.detail.sys_enterpriseid
  112. } : {};
  113. //业务员根据指定经销商的免运费
  114. _Http.basic({
  115. "id": 20220920084001,
  116. content
  117. }, false).then(res => {
  118. console.log("查询企业档案获取企业免邮额度", res)
  119. if (res.code != '1') return wx.showToast({
  120. title: res.msg,
  121. icon: "none"
  122. })
  123. figure = res.data.freefreightamount;
  124. this.setLogisticsMsg();
  125. })
  126. } else {
  127. this.setLogisticsMsg();
  128. }
  129. })
  130. },
  131. /* 免运费信息 */
  132. setLogisticsMsg() {
  133. let logistics = null;
  134. if (figure == -1) {
  135. logistics = '到付'
  136. } else if (figure == 0) {
  137. logistics = '预付'
  138. } else {
  139. let defaultamount = this.data.detail.defaultamount;
  140. logistics = defaultamount >= figure ? '免运费' : (getApp().globalData.Language.getMapText('差') + currency(figure).subtract(defaultamount).value + getApp().globalData.Language.getMapText('元免运费'));
  141. }
  142. this.setData({
  143. logistics
  144. })
  145. },
  146. /* 选择销售分类 */
  147. selectSaletype(e) {
  148. if (this.isEdit()) return;
  149. if (this.data.detail.type == '项目订单') return;
  150. },
  151. /* 设置销售分类 */
  152. setSaletype(e) {
  153. let {
  154. value,
  155. remarks
  156. } = this.data.saletypeList[e.detail.value];
  157. if (value == this.data.detail.saletype) return;
  158. this.setData({
  159. "detail.saletype": value,
  160. "detail.saletyperemarks": remarks
  161. })
  162. this.changeDetail();
  163. },
  164. /* 选择结算人 */
  165. selectAgent() {
  166. if (this.isEdit()) return;
  167. if (this.data.detail.type == '项目订单') return;
  168. wx.navigateTo({
  169. url: `/select/agent/index?params=${JSON.stringify({
  170. "id":20230104103702,
  171. "content": {
  172. "pageNumber": 1,
  173. "pageTotal": 1,
  174. "pageSize": 20,
  175. "where": {
  176. "condition": "",
  177. },
  178. }
  179. })}&radio=true`,
  180. });
  181. getApp().globalData.handleSelect = this.setAgeant.bind(this);
  182. },
  183. /* 设置结算人 */
  184. setAgeant({
  185. item
  186. }) {
  187. let that = this;
  188. console.log("选择经销商", item)
  189. wx.showModal({
  190. cancelText: getApp().globalData.Language.getMapText('取消'),
  191. confirmText: getApp().globalData.Language.getMapText('确定'),
  192. title: getApp().globalData.Language.getMapText('提示'),
  193. content: getApp().globalData.Language.modeBoxPrompts([{
  194. t: 1,
  195. v: '是否确认设置',
  196. r: " "
  197. }, {
  198. v: item.enterprisename,
  199. f: "“",
  200. r: "”"
  201. }, {
  202. t: 1,
  203. v: '为结算人',
  204. r: "?"
  205. }]),
  206. complete: (res) => {
  207. if (res.confirm) {
  208. let pay_enterpriseid = that.data.detail.pay_enterpriseid,
  209. sys_enterprise_financeid = that.data.detail.sys_enterprise_financeid,
  210. sa_accountclassid = that.data.detail.accountclass.sa_accountclassid;
  211. that.setData({
  212. "detail.pay_enterpriseid": item.sys_enterpriseid,
  213. "detail.sys_enterprise_financeid": item.finance[0] ? item.finance[0].sys_enterprise_financeid : 0,
  214. "detail.accountclass.sa_accountclassid": item.accounts[0] ? item.accounts[0].sa_accountclassid : 0,
  215. });
  216. that.changeDetail().then(s => {
  217. if (s.code == '1') {
  218. wx.showToast({
  219. title: getApp().globalData.Language.getMapText('设置成功'),
  220. icon: "none"
  221. });
  222. setTimeout(() => {
  223. wx.navigateBack();
  224. that.getDetail();
  225. }, 500)
  226. } else {
  227. that.setData({
  228. "detail.pay_enterpriseid": pay_enterpriseid,
  229. "detail.sys_enterprise_financeid": sys_enterprise_financeid,
  230. "detail.sa_accountclassid": sa_accountclassid
  231. });
  232. }
  233. })
  234. }
  235. }
  236. })
  237. },
  238. /* 选择收货人 */
  239. selectConsignee() {
  240. if (this.isEdit()) return;
  241. wx.navigateTo({
  242. url: `/select/address/index?params=${JSON.stringify({
  243. "id":20221009155803,
  244. "content": {
  245. nocache:true,
  246. sys_enterpriseid:this.data.detail.sys_enterpriseid,
  247. "pageNumber": 1,
  248. "pageTotal": 1,
  249. "pageSize": 20,
  250. "where": {
  251. "condition": "",
  252. workaddress:1
  253. },
  254. }
  255. })}&radio=true`,
  256. });
  257. getApp().globalData.handleSelect = this.setConsignee.bind(this);
  258. },
  259. /* 设置收货人 */
  260. setConsignee({
  261. item
  262. }) {
  263. let that = this;
  264. console.log("设置收货人", item)
  265. wx.showModal({
  266. cancelText: getApp().globalData.Language.getMapText('取消'),
  267. confirmText: getApp().globalData.Language.getMapText('确定'),
  268. title: getApp().globalData.Language.getMapText('提示'),
  269. content: getApp().globalData.Language.modeBoxPrompts([{
  270. t: 1,
  271. v: '是否确认设置',
  272. r: " "
  273. }, {
  274. v: item.name,
  275. f: "“",
  276. r: "”"
  277. }, {
  278. t: 1,
  279. v: '为收货人',
  280. r: "?"
  281. }]),
  282. complete: (res) => {
  283. if (res.confirm) {
  284. let rec_contactsid = that.data.detail.rec_contactsid;
  285. that.setData({
  286. "detail.rec_contactsid": item.contactsid
  287. });
  288. that.changeDetail().then(s => {
  289. if (s.code == '1') {
  290. wx.showToast({
  291. title: getApp().globalData.Language.getMapText('设置成功'),
  292. icon: "none"
  293. });
  294. setTimeout(() => {
  295. wx.navigateBack();
  296. that.getDetail();
  297. }, 500)
  298. } else {
  299. that.setData({
  300. "detail.rec_contactsid": rec_contactsid
  301. });
  302. }
  303. })
  304. }
  305. }
  306. })
  307. },
  308. /* 选择财务信息 */
  309. selectFinance() {
  310. if (this.isEdit()) return;
  311. wx.navigateTo({
  312. url: `/select/finance/index?params=${JSON.stringify({
  313. "id":20221013160602,
  314. "content": {
  315. nocache:true,
  316. sys_enterpriseid:this.data.detail.sys_enterpriseid,
  317. "pageNumber": 1,
  318. "pageTotal": 1,
  319. "pageSize": 20,
  320. "where": {
  321. "condition": "",
  322. },
  323. }
  324. })}&radio=true`,
  325. });
  326. getApp().globalData.handleSelect = this.setFinance.bind(this);
  327. },
  328. /* 设置财务信息 */
  329. setFinance({
  330. item
  331. }) {
  332. let that = this;
  333. console.log("设置财务信息", item)
  334. wx.showModal({
  335. cancelText: getApp().globalData.Language.getMapText('取消'),
  336. confirmText: getApp().globalData.Language.getMapText('确定'),
  337. title: getApp().globalData.Language.getMapText('提示'),
  338. content: getApp().globalData.Language.modeBoxPrompts([{
  339. t: 1,
  340. v: '是否确认设置',
  341. r: " "
  342. }, {
  343. v: item.enterprisename,
  344. f: "“",
  345. r: "”"
  346. }, {
  347. t: 1,
  348. v: '为开票单位',
  349. r: "?"
  350. }]),
  351. complete: (res) => {
  352. if (res.confirm) {
  353. let sys_enterprise_financeid = that.data.detail.sys_enterprise_financeid;
  354. that.setData({
  355. "detail.sys_enterprise_financeid": item.sys_enterprise_financeid
  356. });
  357. that.changeDetail().then(s => {
  358. if (s.code == '1') {
  359. wx.showToast({
  360. title: getApp().globalData.Language.getMapText('设置成功'),
  361. icon: "none"
  362. });
  363. setTimeout(() => {
  364. wx.navigateBack();
  365. that.getDetail();
  366. }, 500)
  367. } else {
  368. that.setData({
  369. "detail.sys_enterprise_financeid": sys_enterprise_financeid
  370. });
  371. }
  372. })
  373. }
  374. }
  375. })
  376. },
  377. //tabs 切换
  378. tabsChange({
  379. detail
  380. }) {
  381. this.setData({
  382. tabsActive: detail
  383. });
  384. this.partialRenewal();
  385. },
  386. //局部数据更新 tabs
  387. partialRenewal(init = false) {
  388. let model = this.data.tabsList[this.data.tabsActive].model;
  389. if (model) {
  390. let Component = this.selectComponent(model),
  391. {
  392. total,
  393. pageNumber,
  394. pageTotal
  395. } = Component.data.content,
  396. id = this.data.detail.sa_orderid;
  397. if (total == null || init) {
  398. Component.getList(id, init);
  399. } else if (pageNumber <= pageTotal) {
  400. Component.getList(id, false);
  401. }
  402. }
  403. },
  404. onReachBottom() {
  405. this.partialRenewal();
  406. },
  407. /* 更新数据 */
  408. changeDetail() {
  409. let data = this.data.detail,
  410. content = {
  411. "sa_orderid": data.sa_orderid,
  412. "sys_enterpriseid": data.sys_enterpriseid, //订货企业id
  413. "sa_accountclassid": data.accountclass.sa_accountclassid || 0, //营销账户类型ID
  414. projectnote: data.projectnote || "", //项目备注
  415. "sa_brandid": data.sa_brandid, //品牌ID
  416. "sys_enterprise_financeid": data.sys_enterprise_financeid || 0, //合作企业财务信息ID(开票信息)
  417. //"sa_logiscompid": data.logiscomp.sa_logiscompid || 0, 物流公司档案ID
  418. "rec_contactsid": data.rec_contactsid || 0, //合作企业联系人表ID(收货信息)
  419. "type": data.type, //订单类型
  420. "typemx": data.typemx, // 明细分类,可选
  421. "remarks": data.remarks,
  422. "saler_hrid": data.saler_hrid, //销售人员hrid,业务员hrid
  423. "tradefield": data.tradefield, //必选
  424. "pay_enterpriseid": data.pay_enterpriseid, //结算单位
  425. "rebate_userate": data.accountclass.rebate_userate, //返利金使用比例
  426. signbackstatus: data.signbackstatus,
  427. saletype: data.saletype
  428. };
  429. if (content.type = '项目订单') {
  430. content.sa_contractid = data.sa_contractid,
  431. content.sa_projectid = data.sa_projectid;
  432. }
  433. return new Promise((resolve, reject) => {
  434. _Http.basic({
  435. "id": 20221108111402,
  436. content
  437. }).then(res => {
  438. console.log("修改订单数据", res);
  439. if (res.code != '1') wx.showToast({
  440. title: res.msg,
  441. icon: "none"
  442. });
  443. resolve(res)
  444. })
  445. })
  446. },
  447. /* 修改订单备注 */
  448. changeRemarks(e) {
  449. let name = e.currentTarget.dataset.name,
  450. value = e.detail.value,
  451. remarks = this.data.detail[name],
  452. that = this;
  453. if (value == remarks) return;
  454. wx.showModal({
  455. cancelText: getApp().globalData.Language.getMapText('取消'),
  456. confirmText: getApp().globalData.Language.getMapText('确定'),
  457. title: getApp().globalData.Language.getMapText('提示'),
  458. content: getApp().globalData.Language.modeBoxPrompts([{
  459. t: 1,
  460. v: '是否确定修改',
  461. r: " "
  462. }, {
  463. t: 1,
  464. v: name == 'remarks' ? '订单' : '项目',
  465. f: "“",
  466. r: "”"
  467. }, {
  468. t: 1,
  469. v: '备注',
  470. r: "?"
  471. }]),
  472. complete: async (res) => {
  473. if (res.cancel) that.setData({
  474. [`detail[${name}]`]: remarks
  475. })
  476. if (res.confirm) {
  477. this.data.detail[name] = value;
  478. let res = await that.changeDetail();
  479. that.setData({
  480. [`detail${name}`]: res.code == '1' ? value : remarks
  481. })
  482. }
  483. }
  484. })
  485. },
  486. /* 设置是否使用返利金 */
  487. changeRebateUsed() {
  488. if (this.isEdit()) return this.setData({
  489. detail: this.data.detail
  490. })
  491. let amount = (this.data.detail.order_rebate_userate * this.data.detail.defaultamount).toFixed(2); //最大可用金额
  492. let rebatebalance = this.data.detail.rebatebalance; //返利金账户余额
  493. _Http.basic({
  494. "id": 20230218225002,
  495. "content": {
  496. "sa_orderid": this.data.sa_orderid, //订单金额
  497. "isused": this.data.detail.rebate_used == 1 ? 0 : 1, //是否使用
  498. "rebateamount": rebatebalance > amount ? amount : rebatebalance //返利金使用金额
  499. }
  500. }, false).then(res => {
  501. console.log('设置启用返利金', res)
  502. if (res.code != '1') {
  503. wx.showToast({
  504. title: res.msg,
  505. icon: "none"
  506. });
  507. this.setData({
  508. "detail.rebate_used": this.data.detail.rebate_used
  509. })
  510. return;
  511. }
  512. this.getDetail(true, false)
  513. })
  514. },
  515. /* 修改返利金 */
  516. setRebate_amount(e = 0) {
  517. let value = e.detail.value;
  518. let rebatebalance = this.data.detail.rebatebalance; //返利金账户余额
  519. value = value > rebatebalance ? rebatebalance : value;
  520. let amount = (this.data.detail.order_rebate_userate * this.data.detail.defaultamount).toFixed(2); //最大可用金额
  521. _Http.basic({
  522. "id": 20230218225002,
  523. "content": {
  524. "sa_orderid": this.data.sa_orderid, //订单金额
  525. "isused": 1, //是否使用
  526. "rebateamount": value > amount ? amount : value
  527. }
  528. }, false).then(res => {
  529. console.log('设置返利金', res)
  530. if (res.code != '1') {
  531. wx.showToast({
  532. title: res.msg,
  533. icon: "none",
  534. mask: true
  535. });
  536. this.setData({
  537. "detail.accountclass.rebate_amount": this.data.detail.accountclass.rebate_amount
  538. })
  539. } else {
  540. this.setData({
  541. "detail.accountclass.rebate_amount": value
  542. })
  543. if (value > amount || amount == 0) getApp().globalData.Language.showToast(
  544. [{
  545. t: 1,
  546. v: '返利金最大可使用',
  547. r: " "
  548. }, {
  549. v: amount,
  550. f: "“",
  551. r: "”"
  552. }, {
  553. t: 1,
  554. v: '元'
  555. }])
  556. this.getDetail(true, false)
  557. }
  558. })
  559. },
  560. /* 删除订单 */
  561. deleteItem() {
  562. let that = this;
  563. wx.showModal({
  564. cancelText: getApp().globalData.Language.getMapText('取消'),
  565. confirmText: getApp().globalData.Language.getMapText('确定'),
  566. title: getApp().globalData.Language.getMapText('提示'),
  567. content: getApp().globalData.Language.getMapText('是否确认删除订单') + '?',
  568. complete: (res) => {
  569. if (res.confirm) _Http.basic({
  570. "id": 20221108152102,
  571. "content": {
  572. "sa_orderids": [
  573. that.data.sa_orderid
  574. ]
  575. }
  576. }).then(s => {
  577. console.log("删除订单", s)
  578. if (s.code != '1') return wx.showToast({
  579. title: s.msg,
  580. icon: "none"
  581. });
  582. getApp().globalData.Language.showToast('删除成功')
  583. setTimeout(() => {
  584. /* let page = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/index');
  585. if (page) page.setData({
  586. list: page.data.list.filter(v => v.sa_orderid != that.data.sa_orderid),
  587. "content.total": page.data.content.total - 1,
  588. amount: (page.data.amount - that.data.detail.amount).toFixed(2)
  589. }); */
  590. wx.navigateBack()
  591. }, 500)
  592. })
  593. }
  594. })
  595. },
  596. /* 提交订单 */
  597. submit() {
  598. let that = this;
  599. if (['HY', 'YOSTEST1'].includes(wx.getStorageSync('userMsg').siteid)) {
  600. this.setData({
  601. showMYModel: true
  602. })
  603. } else {
  604. wx.showModal({
  605. cancelText: getApp().globalData.Language.getMapText('取消'),
  606. confirmText: getApp().globalData.Language.getMapText('确定'),
  607. title: getApp().globalData.Language.getMapText('提示'),
  608. content: getApp().globalData.Language.getMapText('是否确认提交订单') + '?',
  609. complete: (res) => {
  610. if (res.confirm) that.handleSubmit();
  611. }
  612. })
  613. }
  614. },
  615. handleSubmit(reminddays = 0) {
  616. _Http.basic({
  617. "id": 20221108153402,
  618. "content": {
  619. sa_orderid: this.data.sa_orderid,
  620. reminddays
  621. },
  622. }).then(s => {
  623. console.log("提交订单", s)
  624. wx.showToast({
  625. title: s.code != '1' ? s.msg : getApp().globalData.Language.getMapText('提交成功'),
  626. icon: "none"
  627. });
  628. if (s.code == '1') this.setData({
  629. "detail.status": "提交"
  630. })
  631. })
  632. },
  633. stepperSubmit() {
  634. this.handleSubmit(this.data.reminddays)
  635. },
  636. dialogOnClose() {
  637. this.setData({
  638. showMYModel: false
  639. })
  640. },
  641. stepperChange({
  642. detail
  643. }) {
  644. this.setData({
  645. reminddays: detail
  646. })
  647. },
  648. /* 确认订单交期 */
  649. notarize() {
  650. let that = this;
  651. wx.showModal({
  652. cancelText: getApp().globalData.Language.getMapText('取消'),
  653. confirmText: getApp().globalData.Language.getMapText('确定'),
  654. title: getApp().globalData.Language.getMapText('提示'),
  655. content: getApp().globalData.Language.getMapText('是否确认交期') + '?',
  656. complete: (res) => {
  657. if (res.confirm) _Http.basic({
  658. "id": 20221230094802,
  659. "content": {
  660. sa_orderid: that.data.sa_orderid
  661. },
  662. }).then(s => {
  663. console.log("确认交期", s)
  664. wx.showToast({
  665. title: s.code != '1' ? s.msg : getApp().globalData.Language.getMapText('确认成功'),
  666. icon: "none"
  667. });
  668. if (s.code == '1') {
  669. that.setData({
  670. "detail.status": "交期确认"
  671. })
  672. }
  673. })
  674. }
  675. })
  676. },
  677. /* 判断是否可以编辑 */
  678. isEdit() {
  679. if (this.data.detail.status != '新建') getApp().globalData.Language.showToast('当前订单状态不可设置!')
  680. if (this.data.detail.type == '特殊订单') getApp().globalData.Language.showToast('特殊订单不可设置!')
  681. return this.data.detail.status != '新建' || this.data.detail.type == '特殊订单';
  682. },
  683. /* 拷贝订单 */
  684. copyItem() {
  685. let item = this.data.detail;
  686. wx.showModal({
  687. cancelText: getApp().globalData.Language.getMapText('取消'),
  688. confirmText: getApp().globalData.Language.getMapText('确定'),
  689. title: getApp().globalData.Language.getMapText('提示'),
  690. content: getApp().globalData.Language.getMapText('是否确认复制') + `${getApp().globalData.Language.showToast(item.type)}“${item.sonum}”`,
  691. complete: (res) => {
  692. if (res.confirm) _Http.basic({
  693. "id": 20230102144502,
  694. "content": {
  695. "sa_orderid": item.sa_orderid
  696. }
  697. }).then(res => {
  698. console.log("复制订单", res)
  699. if (res.code != '1') return wx.showToast({
  700. title: res.msg,
  701. icon: "none"
  702. });
  703. wx.showModal({
  704. cancelText: getApp().globalData.Language.getMapText('取消'),
  705. confirmText: getApp().globalData.Language.getMapText('确定'),
  706. title: getApp().globalData.Language.getMapText('提示'),
  707. content: getApp().globalData.Language.showToast(item.type) + ' ' + getApp().globalData.Language.showToast('复制成功 是否立即前往'),
  708. complete: (s) => {
  709. if (s.confirm) wx.redirectTo({
  710. url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
  711. })
  712. }
  713. })
  714. })
  715. }
  716. })
  717. },
  718. /* 设置项目订单品牌领域 */
  719. setBraned() {
  720. wx.navigateTo({
  721. url: './modules/setBrand/index?id=' + this.data.sa_orderid,
  722. })
  723. },
  724. onUnload() {
  725. let page = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/index');
  726. let content = JSON.parse(JSON.stringify(page.data.content));
  727. content.pageNumber = 1;
  728. content.pageSize = (page.data.content.pageNumber - 1) * page.data.content.pageSize;
  729. _Http.basic({
  730. "id": this.data.userrole == '业务员' ? 20221111145202 : 20221224180302,
  731. content
  732. }).then(res => {
  733. console.log("订单列表", res)
  734. if (res.code != '1') return;
  735. /* 格式化价格 */
  736. if (res.data.length != 0) res.data = res.data.map(v => {
  737. v.defaultamount = currency(v.defaultamount, {
  738. symbol: "¥",
  739. precision: 2
  740. }).format();
  741. return v
  742. })
  743. page.setData({
  744. list: res.data,
  745. "content.total": res.total,
  746. amount: currency(res.tips.amount, {
  747. symbol: "¥",
  748. precision: 2
  749. }).format()
  750. })
  751. })
  752. },
  753. })