detail.js 27 KB

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