purchase-s-imformation.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. var sysT = require('../../../../tool/sys-tool.js')
  2. var businessT = require('../../../../tool/business-tool.js')
  3. var purchaseO = require('../../public/model/purchaseOrder.js')
  4. var p = require('../../public/model/public.js')
  5. var publicData = require('../../../../constant/data.js')
  6. var key = require('../../../../constant/key.js')
  7. var purchaseData = require('../../public/model/purchase-details.js')
  8. var handleData = require('../../public/model/purchase-imformation.js')
  9. var app = getApp()
  10. var url = require('../../../../constant/url.js')
  11. import Net from '../../../../tool/net.js'
  12. var net = new Net()
  13. var businessType = require('../../../../public/business-type.js')
  14. Page({
  15. /**
  16. * 页面的初始数据
  17. */
  18. data: {
  19. adapter: {
  20. suffix: '',
  21. bgHeight: '',
  22. isSupplementaryPay: false,
  23. },
  24. choseCity: {
  25. v: [0, 0],
  26. d: {}
  27. },
  28. header: [
  29. { lt: '开始月份', lc: '', b: '', rt: '结束月份', rc: '', la: 'chooseTime', ra: 'chooseTime' },
  30. { lt: '所在城市', lc: '', b: '', rt: '户籍性质', rc: '', lr: [], rr: [] },
  31. ],
  32. tips: { t: '同时购买公积金,公积金服务费立减'},
  33. data: [
  34. { t: '本城市首次参保', c: false, i: '1'},//switch
  35. { t: '社保卡办理', c: '', r: [], v: 0, i: '2' },//pick
  36. { t: '办理费用', c: '', d: '缴费成功后2-6个月出卡' },
  37. { t: '是否购买公积金', c: false, i: '3' },//switch
  38. { t: '本城市首次缴公积金', c: false, i: '4' },//switch
  39. { t: '缴费金额', p: '', v: '', i: '1' },
  40. { l: '工资基数(参考)\n企业比例\n个人比例', r: '' },
  41. { t: '公积金费用', c: ''},
  42. { t: '社保流水', p: '', v: '', s: false, i: '2' },
  43. { t: '参保方案', c: '', r: [], s: false, i: '5' },//pick
  44. { t: '是否在职', s: false, tips: true, c: false, i: '5' },//switch
  45. ],
  46. sData: {
  47. t: { t: '社保费用', c: '' }
  48. },
  49. sTotals: [0, 0],
  50. charges: {
  51. pack: false,
  52. f: 0,
  53. r: ''
  54. },
  55. minSalary: 2500,
  56. tipsInfo:{ h: true, a: '' },
  57. shebaoTips: {
  58. s: false,
  59. t: []
  60. },
  61. },
  62. chooseTime: businessT.action(function (sender) {
  63. wx.navigateTo({
  64. url: '../choose-date/choose-date?type=double',
  65. })
  66. }),
  67. finishChooseDate: function (date) {
  68. businessT.debugLog(date)
  69. var order = p.getOrder()
  70. var tempTimeInterval = order.timeInterval
  71. var tempBeginTime = order.beginTime
  72. var tempEndTime = order.endTime
  73. var beginMonth = date.beginMonth % 100
  74. var endMonth = date.endMonth % 100
  75. if (date.endMonth - date.beginMonth + 1 > 12) {
  76. order.timeInterval = endMonth + 12 - beginMonth + 1
  77. }
  78. else {
  79. order.timeInterval = date.endMonth - date.beginMonth + 1
  80. }
  81. if (beginMonth < 10) {
  82. order.beginTime = ((date.beginMonth / 100) | 0) + '年0' + beginMonth + '月'
  83. } else {
  84. order.beginTime = ((date.beginMonth / 100) | 0) + '年' + beginMonth + '月'
  85. }
  86. if (endMonth < 10) {
  87. order.endTime = ((date.endMonth / 100) | 0) + '年0' + endMonth + '月'
  88. } else {
  89. order.endTime = ((date.endMonth / 100) | 0) + '年' + endMonth + '月'
  90. }
  91. this.data.header[0].lc = order.beginTime
  92. this.data.header[0].rc = order.endTime
  93. this.data.header[0].b = order.timeInterval + '个月'
  94. this.setData({
  95. header: this.data.header
  96. })
  97. handleData.calculateBuyTotalFee({
  98. success: res => {
  99. this.handleCalculateData()
  100. },
  101. failure: err => {
  102. order.beginTime = tempBeginTime
  103. order.endTime = tempEndTime
  104. order.timeInterval = tempTimeInterval
  105. this.data.header[0].lc = order.beginTime
  106. this.data.header[0].rc = order.endTime
  107. this.data.header[0].b = order.timeInterval + '个月'
  108. this.setData({
  109. header: this.data.header
  110. })
  111. }
  112. })
  113. },
  114. chooseAccount: function (sender) {
  115. var index = sender.detail.value
  116. var order = p.getOrder()
  117. var tempAccountType = order.accountType
  118. this.changeAccount(Number(index) + 1)
  119. handleData.calculateBuyTotalFee({
  120. success: res => {
  121. this.handleCalculateData()
  122. },
  123. failure: err => {
  124. this.changeAccount(tempAccountType)
  125. }
  126. })
  127. },
  128. changeAccount: function (a) {
  129. var order = p.getOrder()
  130. order.accountType = a
  131. this.changeAccountData()
  132. this.setData({
  133. header: this.data.header,
  134. data: this.data.data,
  135. sData: this.data.sData
  136. })
  137. },
  138. getData: function (cityId) {
  139. wx.showLoading({
  140. title: '加载中',
  141. mask: true
  142. })
  143. var order = p.getOrder()
  144. var path = order.isSupplementaryPay ? url.getSupplementaryPurchaseData : url.getNormalPurchaseData
  145. net.connect({
  146. url: url.app_host + path,
  147. method: 'POST',
  148. data: {
  149. city_code: cityId,
  150. type: 1
  151. },
  152. success: (err, res) => {
  153. if (Object.prototype.toString.call(res.data) == '[object Array]' && res.data.length > 0) {
  154. var indexOfScenario = 0
  155. if (order.isSupplementaryPay) {
  156. var canContinue = false
  157. for (var index in res.data) {
  158. var data = res.data[index]
  159. if (data.addedf_num != 0) {
  160. canContinue = true
  161. indexOfScenario = Number(index)
  162. break
  163. }
  164. }
  165. if (!canContinue) {
  166. this.getDataFail()
  167. wx.showModal({
  168. title: '',
  169. content: '您选择的城市不支持补缴社保',
  170. confirmColor: '#3296FB',
  171. cancelColor: '#3296FB',
  172. confirmText: '确定',
  173. showCancel: false,
  174. success: function (res) {
  175. }
  176. })
  177. return
  178. }
  179. }
  180. var tempPurchaseDataArr = app.purchase.purchaseDataArray
  181. var tempPurchase = app.purchase.purchaseData
  182. var tempOrder = order.copy()
  183. purchaseData.handleData(res.data)
  184. // if (indexOfScenario != 0) {
  185. // app.purchase.purchaseData = app.purchase.purchaseDataArray[indexOfScenario]
  186. // }
  187. purchaseData.changeShebaoDataToCustomerData()
  188. order.cityName = this.data.choseCity.d.name
  189. handleData.calculateBuyTotalFee({
  190. success: res => {
  191. this.getDataSuccess()
  192. this.handleCalculateData()
  193. },
  194. failure: err => {
  195. app.purchase.purchaseDataArray = tempPurchaseDataArr
  196. app.purchase.purchaseData = tempPurchase
  197. p.setOrder(tempOrder)
  198. purchaseData.changeShebaoDataToCustomerData()
  199. this.handleData()
  200. wx.hideLoading()
  201. }
  202. })
  203. } else {
  204. this.getDataFail()
  205. businessT.showFailTips({ code: 0, msg: '' }, '加载失败')
  206. }
  207. },
  208. fail: (err, res) => {
  209. this.getDataFail()
  210. businessT.showFailTips(err, '加载失败')
  211. }
  212. }, true)
  213. },
  214. getDataSuccess: function () {
  215. wx.hideLoading()
  216. var order = p.getOrder()
  217. this.handleData()
  218. if (order.isSupplementaryPay) {
  219. wx.setStorageSync(key.StorageKey.lastCity_s, this.data.choseCity.d)
  220. } else {
  221. wx.setStorageSync(key.StorageKey.lastCity_n, this.data.choseCity.d)
  222. }
  223. },
  224. getDataFail: function () {
  225. wx.hideLoading()
  226. var order = p.getOrder()
  227. this.data.choseCity.d = { name: order.cityName, id: order.city }
  228. this.data.header[1].lc = this.data.choseCity.d.name
  229. this.setData({
  230. header: this.data.header
  231. })
  232. },
  233. chooseCity: function (sender) {
  234. businessT.debugLog('abc')
  235. businessT.debugLog(sender.detail.value)
  236. //防止第一列还在滑动就确定,再次展示会错位
  237. this.data.header[1].lr[1] = publicData.purchaseCity[(publicData.purchaseCity.p)[sender.detail.value[0]].id]
  238. this.data.choseCity.v = sender.detail.value
  239. var pr = publicData.purchaseCity.p[sender.detail.value[0]].id
  240. var c = publicData.purchaseCity[pr][sender.detail.value[1]]
  241. if (!c) {
  242. c = publicData.purchaseCity[pr][0]
  243. this.data.choseCity.v[1] = 0
  244. }
  245. this.data.header[1].lc = c.name
  246. this.data.choseCity.d = c
  247. this.setData({
  248. header: this.data.header
  249. })
  250. this.getData(c.id)
  251. },
  252. chooseCityColumn: function (sender) {
  253. if (sender.detail.column == 0) {
  254. this.data.header[1].lr[1] = publicData.purchaseCity[(publicData.purchaseCity.p)[sender.detail.value].id]
  255. this.data.choseCity.v = [sender.detail.value, 0]
  256. this.setData({
  257. header: this.data.header
  258. })
  259. }
  260. },
  261. switchAction: function (sender) {
  262. businessT.debugLog(sender)
  263. var order = p.getOrder()
  264. if (sender.currentTarget.id == '1') {
  265. order.isFirstBuyShebao = sender.detail.value
  266. this.data.data[0].c = sender.detail.value
  267. } else if (sender.currentTarget.id == '3') {
  268. if (app.purchase.purchaseData.funds[order.accountType - 1][1] <= 0 || !app.purchase.purchaseData.pack) {
  269. wx.showToast({
  270. title: '该城市不支持打包购买',
  271. icon: 'none'
  272. })
  273. p.setOrderPack(false)
  274. this.data.data[3].c = false
  275. } else {
  276. p.setOrderPack(sender.detail.value)
  277. this.data.data[3].c = sender.detail.value
  278. this.data.data[4].c = order.isFirstBuyFund
  279. }
  280. this.handleCalculateData()
  281. return
  282. } else if (sender.currentTarget.id == '4') {
  283. order.isFirstBuyFund = sender.detail.value
  284. this.data.data[4].c = sender.detail.value
  285. } else if (sender.currentTarget.id == '5') {
  286. order.isInOffice = sender.detail.value
  287. this.data.data[10].c = sender.detail.value
  288. this.data.data[8].s = !sender.detail.value
  289. }
  290. this.setData({
  291. data: this.data.data
  292. })
  293. },
  294. changeAccountData: function () {
  295. var order = p.getOrder()
  296. var purchase = app.purchase.purchaseData
  297. this.data.header[1].rc = publicData.accounts[order.accountType - 1]
  298. this.data.data[5].p = purchase.funds[order.accountType - 1][0] + '元-' + purchase.funds[order.accountType - 1][1] + '元'
  299. this.data.data[6].r = purchaseData.getWageBase() + '元\n' + purchase.funds[order.accountType - 1][2] + '%\n' + purchase.funds[order.accountType - 1][3] + '%'
  300. },
  301. pickerAction: function (sender) {
  302. businessT.debugLog(sender)
  303. var order = p.getOrder()
  304. if (sender.currentTarget.id == '2') {
  305. var tempSSCard = order.SSCard
  306. this.changeSSCard(sender.detail.value)
  307. handleData.calculateBuyTotalFee({
  308. success: res => {
  309. this.handleCalculateData()
  310. },
  311. failure: err => {
  312. this.changeSSCard(tempSSCard)
  313. }
  314. })
  315. } else if (sender.currentTarget.id == '5') {
  316. if (!order.isSupplementaryPay && app.purchase.purchaseDataArray.length > sender.detail.value) {
  317. var data = app.purchase.purchaseDataArray[sender.detail.value]
  318. var tempData = app.purchase.purchaseData
  319. businessT.debugLog(app.purchase.purchaseData)
  320. app.purchase.purchaseData = data
  321. businessT.debugLog(app.purchase.purchaseData)
  322. purchaseData.changeShebaoDataToCustomerData()
  323. this.handleData()
  324. handleData.calculateBuyTotalFee({
  325. success: res => {
  326. this.handleCalculateData()
  327. },
  328. failure: err => {
  329. app.purchase.publicData = tempData
  330. purchaseData.changeShebaoDataToCustomerData()
  331. this.handleData()
  332. }
  333. })
  334. }
  335. }
  336. },
  337. changeSSCard: function (v) {
  338. var order = p.getOrder()
  339. order.SSCard = v
  340. this.data.data[1].c = publicData.ssCards[order.SSCard].substr(0, 3)
  341. this.data.data[1].v = order.SSCard
  342. this.setData({
  343. data: this.data.data
  344. })
  345. },
  346. inputAction: function (sender) {
  347. businessT.debugLog(sender)
  348. if (sender.currentTarget.id == '1') {
  349. this.changeFund(sender.detail.value)
  350. } else if (sender.currentTarget.id == '2') {
  351. this.changeSalary(sender.detail.value)
  352. }
  353. },
  354. changeSalary: function(salary) {
  355. var order = p.getOrder()
  356. order.salary = salary
  357. this.data.data[8].v = salary
  358. this.setData({
  359. data: this.data.data
  360. })
  361. },
  362. changeFund: function(fund) {
  363. var order = p.getOrder()
  364. var purchase = app.purchase.purchaseData
  365. order.accumulationFund = fund
  366. this.data.data[5].v = fund
  367. this.data.data[6].r = purchaseData.getWageBase() + '元\n' + purchase.funds[order.accountType - 1][2] + '%\n' + purchase.funds[order.accountType - 1][3] + '%'
  368. if (order.timeInterval == 1) {
  369. this.data.data[7].c = '¥ ' + Number(order.accumulationFund).toFixed(0) + '/月'
  370. } else {
  371. this.data.data[7].c = '¥ ' + (Number(order.accumulationFund) * order.timeInterval).toFixed(0) + ' (共' + order.timeInterval + '月)'
  372. }
  373. this.data.sTotals = this.getAmount()
  374. this.setData({
  375. data: this.data.data,
  376. sTotals: this.data.sTotals
  377. })
  378. },
  379. nextStep: businessT.action(function (sender) {
  380. var order = p.getOrder()
  381. var fund = Number(order.accumulationFund)
  382. var purchase = app.purchase.purchaseData
  383. if (order.pack && fund == 0) {
  384. wx.showToast({
  385. title: '请填写缴费范围内的公积金金额',
  386. icon: 'none'
  387. })
  388. return
  389. }
  390. if (order.pack && (fund > purchase.funds[order.accountType - 1][1] || fund < purchase.funds[order.accountType - 1][0])) {
  391. wx.showToast({
  392. title: '请填写缴费范围内的公积金金额',
  393. icon: 'none'
  394. })
  395. return
  396. }
  397. if (!order.isSupplementaryPay && purchase.sb_wage) {
  398. var salary = Number(order.salary)
  399. if (!order.isInOffice) {
  400. if (salary == 0) {
  401. wx.showToast({
  402. title: '请填写范围内的社保流水',
  403. icon: 'none'
  404. })
  405. return
  406. }
  407. if (salary < this.data.minSalary || salary > 5000) {
  408. wx.showToast({
  409. title: '请填写范围内的社保流水',
  410. icon: 'none'
  411. })
  412. return
  413. }
  414. }
  415. businessT.debugLog(salary)
  416. order.isNeedSalary = true
  417. } else {
  418. order.isNeedSalary = false
  419. }
  420. businessT.debugLog(order)
  421. var that = this
  422. handleData.handleImformation((fund) => {
  423. that.changeFund(fund)
  424. })
  425. }),
  426. handleData: function () {
  427. var order = p.getOrder()
  428. this.data.header[1].lc = order.cityName
  429. this.data.header[0].lc = order.beginTime
  430. this.data.header[0].rc = order.endTime
  431. this.data.header[0].b = order.timeInterval + '个月'
  432. var purchase = app.purchase.purchaseData
  433. this.data.data[0].c = order.isFirstBuyShebao
  434. this.data.data[1].r = publicData.ssCards
  435. this.data.data[1].c = publicData.ssCards[order.SSCard].substr(0, 3)
  436. this.data.data[1].v = order.SSCard
  437. // this.data.data[2].c = '¥ ' + purchase.shebao_card_charge.toFixed(2)
  438. var dis = purchase.shebao_charge + purchase.fund_charge - purchase.package_charge
  439. if (dis != (dis | 0)) {
  440. dis = dis.toFixed(2)
  441. }
  442. this.data.tips.t = '同时购买公积金,公积金服务费立减' + dis + '元/月'
  443. this.data.data[3].c = order.pack
  444. this.data.data[4].c = order.isFirstBuyFund
  445. this.data.data[5].v = order.accumulationFund
  446. // this.data.data[5].p = purchase.funds[order.accountType - 1][0] + '元-' + purchase.funds[order.accountType - 1][1] + '元'
  447. // this.data.data[6].r = purchaseData.getWageBase() + '元\n' + purchase.funds[order.accountType - 1][2] + '%\n' + purchase.funds[order.accountType - 1][3] + '%'
  448. // this.data.data[7].c = '¥ ' + (purchase.package_charge - purchase.fund_charge + Number(order.accumulationFund)).toFixed(2) + '/月'
  449. // this.data.data[7].d = '含服务费' + (purchase.package_charge - purchase.fund_charge) + '元/月'
  450. this.data.data[10].s = purchase.sb_wage
  451. this.data.data[8].s = !order.isInOffice && purchase.sb_wage
  452. this.data.minSalary = wx.getStorageSync(key.StorageKey.minSalary)
  453. this.data.data[8].p = this.data.minSalary + '元-5000元'
  454. if (app.purchase.purchaseDataArray.length > 1) {
  455. this.data.data[9].s = true
  456. var v = []
  457. for (var i in app.purchase.purchaseDataArray) {
  458. v.push(app.purchase.purchaseDataArray[i].shebao_type)
  459. }
  460. this.data.data[9].r = v
  461. } else {
  462. this.data.data[9].s = false
  463. this.data.data[9].r = []
  464. }
  465. this.data.data[9].c = purchase.shebao_type
  466. this.changeAccountData()
  467. if (order.isSupplementaryPay) {
  468. if (purchase.shebao_note == '') {
  469. this.data.shebaoTips.t = []
  470. } else {
  471. this.data.shebaoTips.t = purchase.shebao_note.split('\n')
  472. }
  473. } else {
  474. if (purchase.shebao_desc == '') {
  475. this.data.shebaoTips.t = []
  476. } else {
  477. this.data.shebaoTips.t = purchase.shebao_desc.split('\n')
  478. }
  479. }
  480. if (order.isSupplementaryPay && this.data.shebaoTips.t.length > 0) {
  481. this.data.shebaoTips.s = true
  482. } else {
  483. this.data.shebaoTips.s = false
  484. }
  485. this.setData({
  486. adapter: this.data.adapter,
  487. tips: this.data.tips,
  488. header: this.data.header,
  489. data: this.data.data,
  490. sData: this.data.sData,
  491. choseCity: this.data.choseCity,
  492. shebaoTips: this.data.shebaoTips
  493. })
  494. },
  495. wxvoid: function () {
  496. },
  497. tipsInfo: businessT.action(function (sender) {
  498. if (!this.data.tipsInfo.h) {
  499. return
  500. }
  501. this.data.tipsInfo.h = false
  502. this.setData({
  503. tipsInfo: this.data.tipsInfo
  504. })
  505. var animation = wx.createAnimation({
  506. duration: 300,
  507. timingFunction: 'ease',
  508. })
  509. animation.bottom('0rpx').step()
  510. this.setData({
  511. tipsInfo: {
  512. a: animation.export(),
  513. h: false
  514. }
  515. })
  516. }),
  517. dismissSalaryInfo: businessT.action(function (sender) {
  518. var animation = wx.createAnimation({
  519. duration: 300,
  520. timingFunction: 'ease',
  521. })
  522. animation.bottom('-800rpx').step()
  523. this.setData({
  524. tipsInfo: {
  525. a: animation.export(),
  526. h: false
  527. }
  528. })
  529. setTimeout(function () {
  530. this.data.tipsInfo.h = true
  531. this.setData({
  532. tipsInfo: this.data.tipsInfo
  533. })
  534. }.bind(this), 300)
  535. }),
  536. handleCalculateData: function () {
  537. var total = handleData.getTotal()
  538. var order = p.getOrder()
  539. var charges = this.getCharge()
  540. this.data.data[2].c = '¥ ' + total[1]
  541. if (order.timeInterval == 1) {
  542. this.data.sData.t.c = '¥ ' + total[0] + '/月'
  543. this.data.data[7].c = '¥ ' + Number(order.accumulationFund).toFixed(0) + '/月'
  544. if (order.pack) {
  545. this.data.charges.pack = true
  546. this.data.charges.f = '¥ ' + charges[1] + '/月'
  547. this.data.charges.r = '已优惠' + charges[2] + '元'
  548. } else {
  549. this.data.charges.pack = false
  550. this.data.charges.f = '¥ ' + charges[0] + '/月'
  551. }
  552. } else {
  553. this.data.sData.t.c = '¥ ' + total[0] + ' (共' + order.timeInterval + '月)'
  554. this.data.data[7].c = '¥ ' + (Number(order.accumulationFund) * order.timeInterval).toFixed(0) + ' (共' + order.timeInterval + '月)'
  555. if (order.pack) {
  556. this.data.charges.pack = true
  557. this.data.charges.f = '¥ ' + charges[1] + ' (共' + order.timeInterval + '月)'
  558. this.data.charges.r = '已优惠' + charges[2] + '元'
  559. } else {
  560. this.data.charges.pack = false
  561. this.data.charges.f = '¥ ' + charges[0] + ' (共' + order.timeInterval + '月)'
  562. }
  563. }
  564. this.data.sTotals = this.getAmount()
  565. this.setData({
  566. data: this.data.data,
  567. sData: this.data.sData,
  568. sTotals: this.data.sTotals,
  569. charges: this.data.charges,
  570. firstCalculate: true
  571. })
  572. },
  573. firstCalculateTotal: function () {
  574. handleData.calculateBuyTotalFee({
  575. success: res => {
  576. this.handleCalculateData()
  577. },
  578. failure: err => {
  579. setTimeout(function () {
  580. wx.navigateBack({
  581. })
  582. }.bind(this), 1000)
  583. }
  584. })
  585. },
  586. getCharge: function () {
  587. var order = p.getOrder()
  588. var purchaseData = app.purchase.purchaseData
  589. if (order.isSupplementaryPay) {
  590. var charge = (purchaseData.added_charge * order.timeInterval).toFixed(0)
  591. return [String(charge), '', '']
  592. }
  593. if (order.pack) {
  594. var packCharge = (purchaseData.package_charge * order.timeInterval).toFixed(0)
  595. var reduce = ((purchaseData.shebao_charge + purchaseData.fund_charge - purchaseData.package_charge) * order.timeInterval).toFixed(0)
  596. return ['', String(packCharge), String(reduce)]
  597. }
  598. var charge = (purchaseData.shebao_charge * order.timeInterval).toFixed(0)
  599. return [String(charge), '', '']
  600. },
  601. getAmount: function () {
  602. var order = p.getOrder()
  603. var t = handleData.getTotal()
  604. var amout = (Number(t[0]) + Number(t[1]))
  605. var charge = this.getCharge()
  606. amout += (Number(charge[0]) + Number(charge[1]))
  607. if (order.pack) {
  608. amout += (order.accumulationFund * order.timeInterval)
  609. }
  610. amout = String(amout.toFixed(2))
  611. return [amout.substr(0, amout.length - 2), amout.substr(amout.length - 2, 2)]
  612. },
  613. /**
  614. * 生命周期函数--监听页面加载
  615. */
  616. onLoad: function (options) {
  617. handleData.setOut(true)
  618. sysT.adaptor()
  619. var order = p.getOrder()
  620. // var purchase = app.purchase.purchaseData
  621. // if (order.isSupplementaryPay) {
  622. // if (order.purchaseType == businessType.PurchaseType.socialInsurance || order.purchaseType == businessType.PurchaseType.socialInsurancePackage) {
  623. // this.data.tips.t = purchase.shebao_note.split('\n')
  624. // } else {
  625. // this.data.tips.t = purchase.fund_note.split('\n')
  626. // }
  627. // this.data.tips.s = true
  628. // } else {
  629. // this.data.tips.s = false
  630. // }
  631. wx.setNavigationBarTitle({
  632. title: order.isSupplementaryPay ? '社保补缴信息' : '社保信息'
  633. })
  634. this.data.adapter = {
  635. suffix: sysT.suffixOfClass(),
  636. bgHeight: sysT.usableHeight(112),
  637. isSupplementaryPay: order.isSupplementaryPay
  638. }
  639. var cityData = [publicData.purchaseCity.p, publicData.purchaseCity[(publicData.purchaseCity.p)[0].id]]
  640. this.data.header[1].lr = cityData
  641. this.data.header[1].rr = publicData.accounts
  642. this.data.choseCity.d = { name: order.cityName, id: order.city }
  643. this.handleData()
  644. this.firstCalculateTotal()
  645. },
  646. /**
  647. * 生命周期函数--监听页面初次渲染完成
  648. */
  649. onReady: function () {
  650. },
  651. /**
  652. * 生命周期函数--监听页面显示
  653. */
  654. onShow: function () {
  655. },
  656. /**
  657. * 生命周期函数--监听页面隐藏
  658. */
  659. onHide: function () {
  660. },
  661. /**
  662. * 生命周期函数--监听页面卸载
  663. */
  664. onUnload: function () {
  665. handleData.finish()
  666. },
  667. /**
  668. * 页面相关事件处理函数--监听用户下拉动作
  669. */
  670. onPullDownRefresh: function () {
  671. },
  672. /**
  673. * 页面上拉触底事件的处理函数
  674. */
  675. onReachBottom: function () {
  676. },
  677. /**
  678. * 用户点击右上角分享
  679. */
  680. // onShareAppMessage: function () {
  681. // }
  682. })