my-order.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  1. var businessT = require('../../../../tool/business-tool.js')
  2. var sysT = require('../../../../tool/sys-tool.js')
  3. var url = require('../../../../constant/url.js')
  4. import Net from '../../../../tool/net.js'
  5. var net = new Net()
  6. var orderModel = require('../../public/model/order-model.js')
  7. var app = getApp()
  8. var businessType = require('../../../../public/business-type.js')
  9. var pay = require('../../../../public/pay.js')
  10. Page({
  11. /**
  12. * 页面的初始数据
  13. */
  14. data: {
  15. scroll: true,
  16. isLoading: true,
  17. detailsView: {
  18. data: {},
  19. scroll: false,
  20. left: 0,
  21. hidden: true,
  22. animation: {},
  23. mt: '参保姓名\n身份证号\n购买月份\n购买城市\n订单号\n生成时间',
  24. m: '',
  25. t: '',
  26. at: '',
  27. a: '',
  28. discountU: true,
  29. discountT: ['', '', ''],
  30. discountC: 0,
  31. discountS: '未使用',
  32. sa: true,
  33. status: 1
  34. },
  35. discount: {
  36. canChoose: 0,
  37. fee: '0.00',
  38. chose: [],
  39. data: [],
  40. page: 0,
  41. finish: false,
  42. isLoading: true
  43. },
  44. tab: {
  45. id: '1',
  46. animation: {}
  47. },
  48. // bgScrollView: {
  49. // scroll: false,
  50. // left: 0
  51. // },
  52. data: [
  53. [],
  54. [],
  55. []
  56. ],//bs1是只有左边按钮,2是右边有一按钮,3都展示
  57. bgAnimation:{}
  58. },
  59. tabChoose: businessT.action(function (sender) {
  60. businessT.debugLog(sender.currentTarget.id)
  61. if (sender.currentTarget.id == this.data.tab.id) {
  62. return
  63. }
  64. // this.data.bgScrollView.scroll = true;
  65. // this.setData({
  66. // bgScrollView: this.data.bgScrollView
  67. // })
  68. var animation = wx.createAnimation({
  69. duration: 300,
  70. timingFunction: 'ease',
  71. })
  72. var bgAnimation = wx.createAnimation({
  73. duration: 300,
  74. timingFunction: 'ease',
  75. })
  76. var w = sysT.sysInfo().windowWidth
  77. var s = sender.currentTarget.id - 1
  78. animation.translateX(s * w / 3).step()
  79. // this.data.bgScrollView.left = s * sysT.sysInfo().windowWidth
  80. bgAnimation.translateX(-w * s).step()
  81. this.data.tab.id = sender.currentTarget.id
  82. this.data.tab.animation = animation.export()
  83. // this.data.bgScrollView.scroll = false;
  84. this.setData({
  85. tab: this.data.tab,
  86. // bgScrollView: this.data.bgScrollView,
  87. bgAnimation: bgAnimation.export()
  88. })
  89. }),
  90. payAction: businessT.action(function (sender) {
  91. businessT.debugLog(sender)
  92. var t = Number(this.data.tab.id)
  93. var data = this.data.data[t - 1][sender.currentTarget.id]
  94. this.showDetails(data)
  95. this.detailsScroll(1, false)
  96. }),
  97. cancelAction: businessT.action(function (sender) {
  98. businessT.debugLog(sender)
  99. if (this.data.tab.id == '1') {
  100. var item = this.data.data[0][sender.currentTarget.id]
  101. var that = this
  102. wx.showModal({
  103. title: '取消后将无法恢复',
  104. content: item.cancelContent,
  105. confirmColor: '#3296FB',
  106. cancelColor: '#3296FB',
  107. confirmText: '确定',
  108. cancelText: '取消',
  109. success: function (res) {
  110. if (res.confirm) {
  111. that.cancelOrder(item.buy_no, () => {
  112. var index = that.data.data[1].indexOf(item)
  113. that.data.data[1].splice(index, 1)
  114. that.data.data[0].splice(Number(sender.currentTarget.id), 1)
  115. that.setData({
  116. data: that.data.data
  117. })
  118. })
  119. }
  120. }
  121. })
  122. } else if (this.data.tab.id == '2') {
  123. var item = this.data.data[1][sender.currentTarget.id]
  124. var that = this
  125. wx.showModal({
  126. title: '取消后将无法恢复',
  127. content: item.cancelContent,
  128. confirmColor: '#3296FB',
  129. cancelColor: '#3296FB',
  130. confirmText: '确定',
  131. cancelText: '取消',
  132. success: function (res) {
  133. if (res.confirm) {
  134. that.cancelOrder(item.buy_no, () => {
  135. var index = that.data.data[1].indexOf(item)
  136. that.data.data[0].splice(index, 1)
  137. that.data.data[1].splice(Number(sender.currentTarget.id), 1)
  138. that.setData({
  139. data: that.data.data
  140. })
  141. })
  142. }
  143. }
  144. })
  145. }
  146. }),
  147. cancelOrder: function (no, success) {
  148. wx.showLoading({
  149. title: '正在取消订单',
  150. mask: true
  151. })
  152. net.connectNeedLogin({
  153. url: url.app_host + url.cancelPurchaseOrder,
  154. data: { buy_no: no },
  155. success: (err, res) => {
  156. if (res.code == businessType.NetworkErrorCode.success) {
  157. success()
  158. wx.hideLoading()
  159. wx.showToast({
  160. title: '取消订单成功',
  161. icon: 'none'
  162. })
  163. } else {
  164. wx.hideLoading()
  165. businessT.showFailTips(err, '取消订单失败')
  166. }
  167. },
  168. fail: (err, res) => {
  169. wx.hideLoading()
  170. businessT.showFailTips(err, '取消订单失败')
  171. }
  172. })
  173. },
  174. detailsAction: businessT.action(function (sender) {
  175. businessT.debugLog(sender)
  176. var t = Number(this.data.tab.id)
  177. var data = this.data.data[t - 1][sender.currentTarget.id]
  178. if (data.status == 1) {
  179. if (!this.data.detailsView.hidden) {
  180. return
  181. }
  182. this.getTotal(data, true)
  183. } else {
  184. this.showDetails(data)
  185. }
  186. }),
  187. getTotal: function (data, s) {
  188. wx.showLoading({
  189. title: '加载中',
  190. mask: true
  191. })
  192. var obj = {
  193. sbuId: data.sbuId,
  194. cid: data.cid,
  195. shebao_card: data.new_card,
  196. hukou_type: data.hukou_type,
  197. month: data.start_month,
  198. fund: (data.fund / data.nums).toFixed(2),
  199. nums: data.nums,
  200. pay_for: data.pay_for
  201. }
  202. var path = data.added ? url.app_host + url.getTotalSupplementaryPayFee : url.app_host + url.getTotalFee
  203. var that = this
  204. net.connectNeedLogin({
  205. url: path,
  206. data: obj,
  207. success: (err, res) => {
  208. data.total_fee = res.data.total_fee
  209. data.shebao = res.data.shebao
  210. data.shebao_charge = res.data.s_charge
  211. data.shebao_card = res.data.card_charge
  212. data.fund = res.data.fund
  213. data.fund_charge = res.data.f_charge
  214. wx.hideLoading()
  215. if (s) {
  216. that.showDetails(data)
  217. } else {
  218. that.pay()
  219. }
  220. },
  221. fail: (err, res) => {
  222. wx.hideLoading()
  223. businessT.showFailTips(err, '提交订单失败')
  224. }
  225. }, true)
  226. },
  227. detailsPay: businessT.action(function (sender) {
  228. businessT.debugLog(sender)
  229. this.detailsScroll(1, true)
  230. }),
  231. detailsScroll: function (i, a) {
  232. this.data.detailsView.scroll = true
  233. this.data.detailsView.sa = a
  234. this.setData({
  235. detailsView: this.data.detailsView
  236. })
  237. this.data.detailsView.left = i * sysT.sysInfo().windowWidth
  238. this.data.detailsView.scroll = false;
  239. this.setData({
  240. detailsView: this.data.detailsView
  241. })
  242. },
  243. showDetails: function (data) {
  244. if (!this.data.detailsView.hidden) {
  245. return
  246. }
  247. this.data.detailsView.data = data
  248. this.data.detailsView.status = data.status
  249. if (this.data.detailsView.discountC == 0) {
  250. this.data.detailsView.discountS = '暂无优惠券'
  251. } else {
  252. this.data.detailsView.discountS = '未使用'
  253. }
  254. businessT.debugLog(data)
  255. var title
  256. var content
  257. if (data.pay_for == 1 || data.pay_for == 3) {
  258. title = '参保姓名'
  259. } else {
  260. title = '购买人姓名'
  261. }
  262. title = title + '\n身份证号\n购买月份\n购买城市'
  263. content = data.u_name + '\n' + data.id_card + '\n' + data.showTime + '\n' + data.city_name
  264. if (data.status == 2) {
  265. title = title + '\n支付方式'
  266. content = content + '\n' + data.pay_channel
  267. }
  268. if (data.pay_no.length != 0) {
  269. title = title + '\n流水号'
  270. content = content + '\n' + data.pay_no
  271. }
  272. if (data.status == 1) {
  273. title = title + '\n生成时间'
  274. } else {
  275. title = title + '\n成交时间'
  276. }
  277. content = content + '\n' + data.time
  278. this.data.detailsView.mt = title
  279. this.data.detailsView.m = content
  280. this.data.detailsView.t = data.a
  281. // this.data.detailsView.id = i
  282. var at = ''
  283. var a = ''
  284. if (data.shebao > 0) {
  285. at = at + '社保'
  286. a = a + '¥' + data.shebao.toFixed(2)
  287. }
  288. if (data.shebao_card > 0) {
  289. at = at + '\n社保卡'
  290. a = a + '\n¥' + data.shebao_card.toFixed(2)
  291. }
  292. if (data.fund > 0) {
  293. if (at != '') {
  294. at = at + '\n'
  295. a = a + '\n'
  296. }
  297. at = at + '公积金'
  298. a = a + '¥' + data.fund.toFixed(2)
  299. }
  300. at = at + '\n服务费'
  301. a = a + '\n¥' + (data.shebao_charge + data.fund_charge).toFixed(2)
  302. this.data.detailsView.at = at
  303. this.data.detailsView.a = a
  304. this.data.discount = {
  305. canChoose: data.nums,
  306. fee: '0.00',
  307. chose: [],
  308. data: [],
  309. page: 0,
  310. finish: false,
  311. isLoading: true
  312. }
  313. this.data.detailsView.discountT = this.getDiscountTips()
  314. this.data.detailsView.hidden = false
  315. //为了兼容iOS低版本系统,不能用bottom,所以计算margan-top的位置
  316. sysT.adaptor()
  317. businessT.debugLog(sysT.sysInfo().windowHeight)
  318. var s = this.data.detailsView.suffix == '-X' ? -1068 : -1000
  319. s = sysT.rpxToPx() * s
  320. this.data.detailsView.top = sysT.sysInfo().windowHeight - s
  321. this.setData({
  322. detailsView: this.data.detailsView,
  323. scroll: false
  324. })
  325. setTimeout(function () {
  326. var animation = wx.createAnimation({
  327. duration: 300,
  328. timingFunction: 'ease',
  329. })
  330. // animation.bottom('0rpx').step()
  331. animation.translateY(s).step()
  332. this.data.detailsView.animation = animation.export()
  333. this.setData({
  334. detailsView: this.data.detailsView
  335. })
  336. }.bind(this), 100)
  337. },
  338. hiddenDetails: businessT.action(function (sender) {
  339. this.detailsScroll(0, false)
  340. var animation = wx.createAnimation({
  341. duration: 300,
  342. timingFunction: 'ease',
  343. })
  344. animation.translateY(0).step()
  345. this.data.detailsView.animation = animation.export()
  346. this.setData({
  347. detailsView: this.data.detailsView
  348. })
  349. setTimeout(function () {
  350. this.data.detailsView.hidden = true
  351. this.setData({
  352. detailsView: this.data.detailsView,
  353. scroll: true
  354. })
  355. }.bind(this), 300)
  356. }),
  357. getOrderData: function () {
  358. wx.showLoading({
  359. title: '加载中',
  360. mask: true
  361. })
  362. net.connectNeedLogin({
  363. url: url.app_host + url.getMyOrder,
  364. data: {},
  365. success: (err, res) => {
  366. this.data.data = orderModel.handleAllData(res.data)
  367. this.data.isLoading = false
  368. this.setData({
  369. data: this.data.data,
  370. isLoading: this.data.isLoading
  371. })
  372. wx.hideLoading()
  373. },
  374. fail: (err, res) => {
  375. wx.hideLoading()
  376. businessT.showFailTips(err, '加载失败')
  377. setTimeout(function () {
  378. wx.navigateBack({
  379. })
  380. }.bind(this), 1000)
  381. }
  382. }, true)
  383. },
  384. uploadDiscountView: businessT.action(function (sender) {
  385. businessT.debugLog('upload')
  386. if (this.data.discount.isLoading || this.data.discount.finish) {
  387. return
  388. }
  389. this.data.discount.isLoading = true
  390. this.getCashCouponList()
  391. businessT.debugLog('abc')
  392. }),
  393. getCashCouponList: function () {
  394. var page = this.data.discount.page + 1
  395. net.connectNeedLogin({
  396. url: url.app_host + url.getCashCoupon,
  397. data: {
  398. phone: app.globalData.userInfo.phone,
  399. page: page,
  400. expired: 0
  401. },
  402. success: (err, res) => {
  403. this.getCashCouponListSuccess(res)
  404. this.data.discount.isLoading = false
  405. wx.hideLoading()
  406. },
  407. fail: (err, res) => {
  408. this.data.discount.isLoading = false
  409. x.hideLoading()
  410. businessT.showFailTips(err, '加载失败')
  411. }
  412. }, true)
  413. },
  414. getCashCouponListSuccess: function (res) {
  415. this.data.discount.page = res.currentPage
  416. var data = res.data.list
  417. for (var index in data) {
  418. var item = data[index]
  419. if (item.status == 1 && item.expired == 0) {
  420. var now = new Date().format('yyyy-MM-dd h:m:s')
  421. var nowDate = now.slice(0, 10)
  422. var endDate = item.end_time.slice(0, 10)
  423. if (nowDate == endDate) {
  424. item.p = '今天过期'
  425. } else {
  426. var tempNowDate = nowDate + ' 00:00:00'
  427. var tempEndDate = endDate + ' 00:00:00'
  428. var d = businessT.dateDiff('d', tempNowDate, tempEndDate)
  429. if (tempEndDate == item.end_time) {
  430. d -= 1
  431. }
  432. if (d == 0) {
  433. item.p = '今天过期'
  434. } else {
  435. item.p = '还有' + d + '天过期'
  436. }
  437. }
  438. } else {
  439. if (item.status == 1) {
  440. item.p = '已过期'
  441. } else {
  442. item.p = '已使用'
  443. }
  444. }
  445. item.end = item.end_time.slice(0, 10)
  446. }
  447. this.data.discount.data = this.data.discount.data.concat(res.data.list)
  448. if (res.data.list.length < 10) {
  449. this.data.discount.finish = true
  450. } else {
  451. this.data.discount.finish = false
  452. }
  453. this.setData({
  454. discount: this.data.discount
  455. })
  456. },
  457. getDiscountCount: function () {
  458. net.connectNeedLogin({
  459. url: url.app_host + url.getCashCouponCount,
  460. data: {
  461. phone: app.globalData.userInfo.phone
  462. },
  463. success: (err, res) => {
  464. this.data.detailsView.discountC = res.data.total
  465. if (this.data.detailsView.discountC == 0) {
  466. this.data.detailsView.discountS = '暂无优惠券'
  467. } else {
  468. this.data.detailsView.discountS = '未使用'
  469. }
  470. }
  471. }, true)
  472. },
  473. getDiscountTips: function () {
  474. if (this.data.discount.chose.length > 0) {
  475. return ['您已选中优惠券 ' + this.data.discount.chose.length + ' 张,共可抵用', '¥' + this.data.discount.fee, '']
  476. }
  477. return ['您当前下了 ' + this.data.discount.canChoose + ' 个月订单,可同时选 ', this.data.discount.canChoose, ' 张优惠券']
  478. },
  479. chooseDiscount: businessT.action(function (sender) {
  480. if (this.data.detailsView.discountC == 0) {
  481. wx.showToast({
  482. title: '暂无优惠券',
  483. })
  484. return
  485. }
  486. this.detailsScroll(2, true)
  487. if (this.data.discount.data.length == 0) {
  488. wx.showLoading({
  489. title: '加载中',
  490. mask: true
  491. })
  492. this.getCashCouponList()
  493. }
  494. }),
  495. //点击选择优惠券
  496. chooseAction: businessT.action(function (sender) {
  497. businessT.debugLog(this.data.discount.chose)
  498. businessT.debugLog(sender.currentTarget.id)
  499. var c = Number(sender.currentTarget.id)
  500. var s = this.data.discount.chose.indexOf(c)
  501. businessT.debugLog(s)
  502. if (s >= 0) {
  503. this.data.discount.chose.splice(s, 1)
  504. } else {
  505. if (this.data.discount.canChoose <= this.data.discount.chose.length) {
  506. wx.showToast({
  507. title: '本次购买只可选择' + this.data.discount.canChoose + '张抵用券',
  508. icon: 'none'
  509. })
  510. return
  511. }
  512. this.data.discount.chose.push(c)
  513. }
  514. var fee = 0
  515. for (var i in this.data.discount.chose) {
  516. var index = this.data.discount.chose[i]
  517. fee += this.data.discount.data[index].coupon_price
  518. }
  519. this.data.discount.fee = fee.toFixed(2)
  520. this.data.detailsView.discountT = this.getDiscountTips()
  521. this.setData({
  522. discount: this.data.discount,
  523. detailsView: this.data.detailsView
  524. })
  525. }, 100),
  526. confirmDiscount: businessT.action(function (sender) {
  527. if (this.data.discount.chose.length > 0) {
  528. this.data.detailsView.discountS = '-¥' + this.data.discount.fee
  529. } else {
  530. this.data.detailsView.discountS = '未使用'
  531. }
  532. this.setData({
  533. detailsView: this.data.detailsView
  534. })
  535. this.detailsScroll(1, true)
  536. }),
  537. pay: function () {
  538. wx.showLoading({
  539. title: '正在提交订单',
  540. mask: true
  541. })
  542. pay.prepay({
  543. success: e => {
  544. var data = this.data.detailsView.data
  545. if (data.pay_for == businessType.PurchasePayFor.socialInsurance) {
  546. this.createSocialInsuranceOrder(businessType.ResultServeyType.resultServeyTypeSB)
  547. } else if (data.pay_for == businessType.PurchasePayFor.socialInsurancePackage) {
  548. this.createSocialInsuranceOrder(businessType.ResultServeyType.resultServeyTypePack)
  549. } else if (data.pay_for == businessType.PurchasePayFor.accumulationFund) {
  550. this.createAccumulationFundOrder(businessType.ResultServeyType.resultServeyTypeAF)
  551. } else if (data.pay_for == businessType.PurchasePayFor.accumulationFundPackage) {
  552. this.createAccumulationFundOrder(businessType.ResultServeyType.resultServeyTypePack)
  553. }
  554. },
  555. fail: e => {
  556. wx.hideLoading()
  557. businessT.showFailTips(err, '提交订单失败')
  558. }
  559. })
  560. },
  561. detailsConfirmPay: businessT.action(function (sender) {
  562. var data = this.data.detailsView.data
  563. this.getTotal(data, false)
  564. }),
  565. createSocialInsuranceOrder: function (type) {
  566. var data = this.data.detailsView.data
  567. var obj = this.getParameters({
  568. fund: data.fund
  569. })
  570. var path = data.added ? url.app_host + url.createShebaoSupplementaryPayOrder : url.app_host + url.createShebaoOrder
  571. var that = this
  572. net.connectNeedLogin({
  573. url: path,
  574. data: obj,
  575. success: (err, res) => {
  576. pay.wxPay({
  577. data: res.data,
  578. success: e => {
  579. if (obj.sb_wage > 0) {
  580. that.checkSurvey(true, type)
  581. } else {
  582. that.checkSurvey(false, type)
  583. }
  584. },
  585. fail: e => {
  586. wx.hideLoading()
  587. businessT.showFailTips(err, '提交订单失败')
  588. }
  589. })
  590. },
  591. fail: (err, res) => {
  592. wx.hideLoading()
  593. businessT.showFailTips(err, '提交订单失败')
  594. }
  595. }, true)
  596. },
  597. createAccumulationFundOrder: function (type) {
  598. businessT.debugLog(this.data.detailsView.data)
  599. var data = this.data.detailsView.data
  600. var obj = this.getParameters({
  601. buyShebao: data.shebao == 0 ? 0 : 1,
  602. fund: data.fund / data.nums
  603. })
  604. var path = data.added ? url.app_host + url.createFundSupplementaryPayOrder : url.app_host + url.createFundOrder
  605. var that = this
  606. net.connectNeedLogin({
  607. url: path,
  608. data: obj,
  609. success: (err, res) => {
  610. pay.wxPay({
  611. data: res.data,
  612. success: e => {
  613. if (obj.sb_wage > 0) {
  614. that.checkSurvey(true, type)
  615. } else {
  616. that.checkSurvey(false, type)
  617. }
  618. },
  619. fail: e => {
  620. wx.hideLoading()
  621. businessT.showFailTips(err, '提交订单失败')
  622. }
  623. })
  624. },
  625. fail: (err, res) => {
  626. wx.hideLoading()
  627. businessT.showFailTips(err, '提交订单失败')
  628. }
  629. }, true)
  630. },
  631. checkSurvey: function (isNeedSalary, type) {
  632. var pages = getCurrentPages()
  633. if (isNeedSalary) {
  634. pages[0].route('../../public/pages/pay-success/pay-success?type=salary')
  635. return
  636. } else {
  637. net.connectNeedLogin({
  638. url: url.app_host + url.checkSurvey,
  639. data: {},
  640. success: (err, res) => {
  641. wx.hideLoading()
  642. if (res.data) {
  643. pages[0].route('../../public/pages/pay-success/pay-success?type=survey&surveyType=' + type)
  644. } else {
  645. this.queryPayPriceDifference()
  646. }
  647. },
  648. fail: (err, res) => {
  649. wx.hideLoading()
  650. pages[0].route('../../public/pages/pay-success/pay-success?type=share')
  651. }
  652. }, false)
  653. }
  654. },
  655. queryPayPriceDifference: function () {
  656. var pages = getCurrentPages()
  657. net.connectNeedLogin({
  658. url: url.app_host + url.queryPayPriceDifference,
  659. data: {},
  660. success: (err, res) => {
  661. wx.hideLoading()
  662. if (res.data > 0) {
  663. pages[0].route('../../public/pages/pay-success/pay-success?type=pay')
  664. } else {
  665. pages[0].route('../../public/pages/pay-success/pay-success?type=share')
  666. }
  667. },
  668. fail: (err, res) => {
  669. wx.hideLoading()
  670. pages[0].route('../../public/pages/pay-success/pay-success?type=share')
  671. }
  672. }, true)
  673. },
  674. getParameters: function (par) {
  675. var data = this.data.detailsView.data
  676. var ids = ''
  677. for (var i in this.data.discount.chose) {
  678. var item = this.data.discount.data[this.data.discount.chose[i]]
  679. if (i == 0) {
  680. ids = ids + item.id
  681. } else {
  682. ids = ids + ',' + item.id
  683. }
  684. }
  685. var np = {
  686. sbuId: data.sbuId,
  687. cid: data.cid,
  688. shebao_card: data.new_card,
  689. hukou_type: data.hukou_type,
  690. month: data.start_month,
  691. nums: data.nums,
  692. first_sb: data.first_sb,
  693. first_fund: data.first_fund,
  694. working: data.working,
  695. sb_wage: data.sb_wage,
  696. pay_channel: 5,
  697. couponuser_id: ids
  698. }
  699. for (var key in par) {
  700. np[key] = par[key]
  701. }
  702. return np
  703. },
  704. /**
  705. * 生命周期函数--监听页面加载
  706. */
  707. onLoad: function (options) {
  708. this.data.detailsView.suffix = sysT.suffixOfClass()
  709. this.getOrderData()
  710. this.getDiscountCount()
  711. },
  712. /**
  713. * 生命周期函数--监听页面初次渲染完成
  714. */
  715. onReady: function () {
  716. },
  717. /**
  718. * 生命周期函数--监听页面显示
  719. */
  720. onShow: function () {
  721. },
  722. /**
  723. * 生命周期函数--监听页面隐藏
  724. */
  725. onHide: function () {
  726. },
  727. /**
  728. * 生命周期函数--监听页面卸载
  729. */
  730. onUnload: function () {
  731. },
  732. /**
  733. * 页面相关事件处理函数--监听用户下拉动作
  734. */
  735. onPullDownRefresh: function () {
  736. },
  737. /**
  738. * 页面上拉触底事件的处理函数
  739. */
  740. onReachBottom: function () {
  741. },
  742. /**
  743. * 用户点击右上角分享
  744. */
  745. onShareAppMessage: function () {
  746. return {
  747. path: '/page/home/index',
  748. imageUrl: '../../../../icon/public/share_img.png',
  749. title: '自助缴社保公积金,覆盖200多个城市,专业团队操作'
  750. }
  751. }
  752. })