order.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  1. var businessT = require('../../../tool/business-tool.js')
  2. var sysT = require('../../../tool/sys-tool.js')
  3. var url = require('../../../constant/url.js')
  4. var key = require('../../../constant/key.js')
  5. import Net from '../../../tool/net.js'
  6. var net = new Net()
  7. var app = getApp()
  8. var wxyj = require('../../../public/wxyj.js')
  9. Page({
  10. data: {
  11. type: '',
  12. haveType: 0,
  13. isFirstbuySheBao: false,
  14. isFirstBuyFund: false,
  15. buyFund: false,
  16. buySheBao: false,
  17. currentCard: [0, '不办卡'],
  18. salary: 0,
  19. shebaoPrice: 0,
  20. fundPrice: 0,
  21. serviceMoney: 0,
  22. cheapMoney: 0,
  23. cheap: false,
  24. disable: false,
  25. isJob: false,
  26. wageMoney: '',
  27. totalMoneyArr: [0, 0],
  28. totalMoney: 0
  29. },
  30. setTitle() {
  31. if (this.data.type == 0) {
  32. swan.setNavigationBarTitle({
  33. title: '社保信息',
  34. })
  35. } else if (this.data.type == 1) {
  36. swan.setNavigationBarTitle({
  37. title: '社保补缴信息',
  38. })
  39. } else if (this.data.type == 2) {
  40. swan.setNavigationBarTitle({
  41. title: '公积金信息',
  42. })
  43. } else if (this.data.type == 3) {
  44. swan.setNavigationBarTitle({
  45. title: '公积金补缴信息',
  46. })
  47. }
  48. },
  49. initData(isFirst) {
  50. var index
  51. if (wxyj.wxyjData.type == 1) {
  52. index = 0
  53. } else {
  54. index = 1
  55. }
  56. if (this.data.type == 1) {
  57. var tips = wxyj.wxyjData.data.wxyj[index].shebao_note
  58. if (tips && typeof (tips) == "string") {
  59. this.setData({
  60. tips: tips.split('\n')
  61. })
  62. }
  63. } else if (this.data.type == 3) {
  64. var tips = wxyj.wxyjData.data.wxyj[index].fund_note
  65. if (tips && typeof (tips) == "string") {
  66. this.setData({
  67. tips: tips.split('\n')
  68. })
  69. }
  70. }
  71. if (this.data.type == 0 || this.data.type == 1) {
  72. this.setData({ buySheBao: true, buyFund: false })
  73. } else {
  74. this.setData({ buySheBao: false, buyFund: true })
  75. }
  76. if (this.data.type == 0 || this.data.type == 2) {
  77. wxyj.wxyjData.order.nums = wxyj.wxyjData.data.wxyj[index].nums
  78. var year = Number(String(wxyj.wxyjData.data.wxyj[index].month).slice(0, 4))
  79. var month = Number(String(wxyj.wxyjData.data.wxyj[index].month).slice(-2))
  80. var data = wxyj.wxyjData.data.wxyj[index]
  81. data.funds.forEach((item) => {
  82. if (String(item.min).indexOf('.') != -1) {
  83. item.min = parseInt(item.min) + 1
  84. }
  85. if (String(item.max).indexOf('.') != -1) {
  86. item.max = parseInt(item.max)
  87. }
  88. })
  89. this.setData({
  90. data,
  91. startYear: year,
  92. startMonth: month,
  93. nums: wxyj.wxyjData.order.nums
  94. })
  95. if (this.data.nums == 1) {
  96. this.setData({
  97. endYear: year,
  98. endMonth: month,
  99. })
  100. } else {
  101. if (month + this.data.nums > 13) {
  102. this.setData({
  103. endYear: year + 1,
  104. endMonth: month + this.data.nums - 13,
  105. })
  106. } else {
  107. this.setData({
  108. endYear: year,
  109. endMonth: month + this.data.nums - 1,
  110. })
  111. }
  112. }
  113. } else {
  114. wxyj.wxyjData.order.nums = 1
  115. var year = Number(String(wxyj.wxyjData.data.wxyj[index].month).slice(0, 4))
  116. var month = Number(String(wxyj.wxyjData.data.wxyj[index].month).slice(-2))
  117. if (month == 1) {
  118. this.setData({
  119. data: wxyj.wxyjData.data.wxyj[index],
  120. startYear: year - 1,
  121. startMonth: 12,
  122. endYear: year - 1,
  123. endMonth: 12,
  124. nums: 1
  125. })
  126. } else {
  127. this.setData({
  128. data: wxyj.wxyjData.data.wxyj[index],
  129. startYear: year,
  130. startMonth: month - 1,
  131. endYear: year,
  132. endMonth: month - 1,
  133. nums: 1
  134. })
  135. }
  136. }
  137. if (this.data.data.shebao_type.indexOf('标准') != -1) {
  138. this.setData({ haveType: false })
  139. } else {
  140. this.setData({ haveType: true })
  141. }
  142. if (!this.data.data.fund_buy && this.data.type == 2) {
  143. this.setData({ buySheBao: true })
  144. this.data.pack = true
  145. }
  146. this.initOrder()
  147. if (!isFirst) {
  148. this.refreshData()
  149. }
  150. },
  151. openModal(e) {
  152. var pickerData
  153. if (e.currentTarget.dataset.type == 'city') {
  154. pickerData = this.data.city.concat()
  155. } else if (e.currentTarget.dataset.type == 'type') {
  156. if (this.data.type == 0) {
  157. pickerData = [['一档', '二档']]
  158. } else {
  159. pickerData = [['一档(补缴)', '二档(补缴)']]
  160. }
  161. } else if (e.currentTarget.dataset.type == 'hukou') {
  162. pickerData = [['本地城镇', '本地农村', '外地城镇', '外地农村']]
  163. } else if (e.currentTarget.dataset.type == 'card') {
  164. pickerData = [['不办卡', '新办卡(不支持补办)']]
  165. }
  166. this.chooseCityModal = this.selectComponent("#chooseCityModal");
  167. this.chooseCityModal.openModal(pickerData, e.currentTarget.dataset.type)
  168. },
  169. changeCurrent(e) {
  170. if (e.detail.type == "city") {
  171. var type, http, buyFund, buySheBao
  172. if (this.data.type == 0 || this.data.type == 1) {
  173. type = 1
  174. buySheBao = true
  175. buyFund = false
  176. } else {
  177. type = 2
  178. buySheBao = false
  179. buyFund = true
  180. }
  181. if (this.data.type == 0 || this.data.type == 2) {
  182. http = url.getNormalPurchaseData
  183. } else {
  184. http = url.getSupplementaryPurchaseData
  185. }
  186. net.connectNeedLogin({
  187. url: url.app_host + http,
  188. data: { city_code: e.detail.data.id, type },
  189. success: (err, res) => {
  190. if (this.data.type == 2 || this.data.type == 3) {
  191. if (!res.data.wxyj[0].fund_buy2 || (!res.data.wxyj[0].pack && !res.data.wxyj[0].fund_buy)) {
  192. swan.showToast({
  193. title: '该城市不能购买公积金',
  194. icon: 'none',
  195. mask: true
  196. });
  197. return
  198. }
  199. }
  200. wxyj.wxyjData.type = 1
  201. wxyj.wxyjData.currentCity = e.detail.data
  202. wxyj.wxyjData.lastValue = e.detail.lastValue
  203. wxyj.wxyjData.data = res.data
  204. this.setData({
  205. currentCity: e.detail.data,
  206. isFirstbuySheBao: false,
  207. isFirstBuyFund: false,
  208. pack: false,
  209. buyFund,
  210. buySheBao,
  211. fundPrice: 0,
  212. salary: 0,
  213. isJob: false,
  214. wageMoney: ''
  215. })
  216. var arr = res.data.wxyj[0].shebaos[1].data.filter(item => {
  217. return item.i == 12
  218. })
  219. if (arr.length && arr[0].n.indexOf('年缴') != -1) {
  220. this.setData({ yearPay: true, yearPayMoney: arr[0].p })
  221. } else {
  222. this.setData({ yearPay: false, yearPayMoney: 0 })
  223. }
  224. this.initData()
  225. if (this.data.type == 2 || this.data.type == 3) { return }
  226. this.getPrice(true)
  227. },
  228. fail: (err, res) => {
  229. swan.hideLoading()
  230. swan.showToast({
  231. title: '加载数据失败!请检查网络设置!',
  232. icon: 'none'
  233. })
  234. }
  235. }, true)
  236. } else if (e.detail.type == "type") {
  237. wxyj.wxyjData.type = e.detail.index
  238. if (e.detail.index == 0) {
  239. this.setData({
  240. data: wxyj.wxyjData.data.wxyj[1],
  241. isJob: false,
  242. wageMoney: ''
  243. })
  244. } else {
  245. this.setData({
  246. data: wxyj.wxyjData.data.wxyj[0],
  247. isJob: false,
  248. wageMoney: ''
  249. })
  250. }
  251. this.initOrder()
  252. this.getPrice(true)
  253. } else if (e.detail.type == "hukou") {
  254. wxyj.wxyjData.hukou = e.detail.data
  255. wxyj.wxyjData.detailIndex = e.detail.index
  256. this.setData({ currentHukou: e.detail.data })
  257. this.initOrder()
  258. this.getPrice(true)
  259. } else if (e.detail.type == "card") {
  260. if (e.detail.index == 0) {
  261. this.setData({ currentCard: [0, '不办卡'] })
  262. } else {
  263. this.setData({ currentCard: [1, '新办卡'] })
  264. }
  265. this.initOrder()
  266. }
  267. this.refreshData()
  268. swan.hideLoading();
  269. },
  270. chooseDate() {
  271. swan.navigateTo({
  272. url: '../choose-date/choose-date?type=' + this.data.type
  273. })
  274. },
  275. refreshData() {
  276. var fundTotalPrice = this.data.fundPrice * this.data.nums,
  277. fundMin = this.data.data.funds[wxyj.wxyjData.detailIndex].min,
  278. fundMax = this.data.data.funds[wxyj.wxyjData.detailIndex].max,
  279. needWage
  280. if (String(fundMin).indexOf('.') != -1) {
  281. fundMin = parseInt(fundMin) + 1
  282. } else {
  283. fundMin = parseInt(fundMin)
  284. }
  285. fundMax = parseInt(fundMax)
  286. if (this.data.data.sb_wage) {
  287. needWage = true
  288. } else {
  289. needWage = false
  290. }
  291. if (this.data.type == 2 && !this.data.buySheBao) { needWage = false }
  292. this.setData({
  293. currentType: this.data.data.shebao_type,
  294. cardPrice: this.data.data.shebao_card_charge,
  295. fundTotalPrice,
  296. fundPriceRange: [fundMin, fundMax],
  297. ep: this.data.data.funds[wxyj.wxyjData.detailIndex].e,
  298. pp: this.data.data.funds[wxyj.wxyjData.detailIndex].p,
  299. needWage
  300. })
  301. if (!this.data.data.pack) {
  302. this.setData({ disable: true })
  303. }
  304. this.initOrder()
  305. this.countServiceMoney()
  306. this.countTotalMoney()
  307. },
  308. switchAction(e) {
  309. if (e.currentTarget.dataset.type == 'buyFund') {
  310. if (!this.data.data.pack) {
  311. this.setData({ buyFund: '' })
  312. swan.showToast({
  313. title: '该城市不支持打包购买',
  314. icon: 'none',
  315. mask: true
  316. });
  317. this.setData({ buyFund: false })
  318. return
  319. } else if (!this.data.data.fund_buy2) {
  320. this.setData({ buyFund: '' })
  321. swan.showToast({
  322. title: '该城市暂不支持购买公积金',
  323. icon: 'none',
  324. mask: true
  325. });
  326. this.setData({ buyFund: false })
  327. return
  328. }
  329. this.data.buyFund = !this.data.buyFund
  330. this.setData({ buyFund: this.data.buyFund })
  331. if (!this.data.buyFund) {
  332. this.data.isFirstBuyFund = false
  333. this.setData({
  334. pack: false,
  335. fundPrice: 0
  336. })
  337. } else {
  338. this.setData({
  339. pack: true
  340. })
  341. }
  342. } else if (e.currentTarget.dataset.type == 'buySheBao') {
  343. this.getSheBaoMoney()
  344. if (!this.data.data.pack) {
  345. this.setData({ buySheBao: '' })
  346. swan.showToast({
  347. title: '该城市不支持打包购买',
  348. icon: 'none',
  349. mask: true
  350. })
  351. this.setData({ buySheBao: false })
  352. return
  353. }
  354. if (!this.data.data.fund_buy && this.data.type == 2) {
  355. this.setData({ buySheBao: 1 })
  356. swan.showModal({
  357. title: '',
  358. content: '该地区不支持单独购买公积金,请选择购买社保。',
  359. confirmColor: '#3296FB',
  360. confirmText: '确定',
  361. showCancel: false,
  362. })
  363. this.setData({ buySheBao: true })
  364. return
  365. }
  366. this.data.buySheBao = !this.data.buySheBao
  367. this.setData({ buySheBao: this.data.buySheBao })
  368. if (!this.data.buySheBao) {
  369. this.data.isFirstbuySheBao = false
  370. this.setData({
  371. pack: false
  372. })
  373. } else {
  374. this.setData({
  375. pack: true
  376. })
  377. }
  378. } else if (e.currentTarget.dataset.type == 'isFirstBuySheBao') {
  379. this.data.isFirstbuySheBao = !this.data.isFirstbuySheBao
  380. } else if (e.currentTarget.dataset.type == 'isFirstBuyFund') {
  381. this.data.isFirstBuyFund = !this.data.isFirstBuyFund
  382. } else if (e.currentTarget.dataset.type == 'job') {
  383. this.data.isJob = !this.data.isJob
  384. }
  385. this.setData({
  386. isFirstbuySheBao: this.data.isFirstbuySheBao,
  387. isFirstBuyFund: this.data.isFirstBuyFund,
  388. buyFund: this.data.buyFund,
  389. buySheBao: this.data.buySheBao,
  390. isJob: this.data.isJob
  391. })
  392. this.refreshData()
  393. },
  394. inputAction(e) {
  395. if (e.currentTarget.dataset.type == "wage") {
  396. this.setData({
  397. wageMoney: e.detail.value
  398. })
  399. } else {
  400. var salary = e.detail.value / ((this.data.ep + this.data.pp) / 100).toFixed(2)
  401. this.setData({
  402. salary: parseInt(salary)
  403. })
  404. if (e.detail.value) {
  405. this.setData({ fundPrice: e.detail.value })
  406. } else {
  407. this.setData({ fundPrice: 0 })
  408. }
  409. }
  410. this.refreshData()
  411. },
  412. countServiceMoney() {
  413. var cheapMoney, cheapTotalMoney
  414. cheapMoney = this.data.data.shebao_charge + this.data.data.fund_charge - this.data.data.package_charge
  415. cheapTotalMoney = cheapMoney * this.data.nums
  416. cheapMoney = cheapMoney.toFixed(2)
  417. cheapTotalMoney = cheapTotalMoney.toFixed(2)
  418. if (this.data.type == 0) {
  419. if (!this.data.buyFund) {
  420. this.data.cheap = false
  421. this.data.serviceMoney = (this.data.data.shebao_charge) * this.data.nums
  422. } else {
  423. this.data.serviceMoney = (this.data.data.package_charge) * this.data.nums
  424. this.data.cheap = true
  425. }
  426. } else if (this.data.type == 1 || this.data.type == 3) {
  427. this.data.serviceMoney = (this.data.data.added_charge) * this.data.nums
  428. } else if (this.data.type == 2) {
  429. if (!this.data.buySheBao) {
  430. this.data.cheap = false
  431. this.data.serviceMoney = (this.data.data.fund_charge) * this.data.nums
  432. } else {
  433. this.data.serviceMoney = (this.data.data.package_charge) * this.data.nums
  434. this.data.cheap = true
  435. }
  436. }
  437. this.setData({
  438. cheap: this.data.cheap,
  439. cheapMoney,
  440. cheapTotalMoney,
  441. serviceMoney: this.data.serviceMoney.toFixed(2)
  442. })
  443. },
  444. countTotalMoney() {
  445. var
  446. shebaoPrice = Number(this.data.shebaoPrice),
  447. serviceMoney = Number(this.data.serviceMoney),
  448. fundTotalPrice = this.data.fundTotalPrice,
  449. totalMoney, totalMoneyArr = []
  450. if (this.data.type == 0) {
  451. if (!this.data.buyFund) {
  452. totalMoney = shebaoPrice + serviceMoney
  453. } else {
  454. totalMoney = shebaoPrice + serviceMoney + fundTotalPrice
  455. }
  456. } else if (this.data.type == 1) {
  457. totalMoney = shebaoPrice + serviceMoney
  458. } else if (this.data.type == 2) {
  459. if (!this.data.buySheBao) {
  460. totalMoney = fundTotalPrice + serviceMoney
  461. } else {
  462. totalMoney = shebaoPrice + serviceMoney + fundTotalPrice
  463. }
  464. } else if (this.data.type == 3) {
  465. totalMoney = fundTotalPrice + serviceMoney
  466. }
  467. if (this.data.currentCard[0] == 1) {
  468. totalMoney += this.data.cardPrice
  469. }
  470. totalMoney = String(totalMoney.toFixed(2))
  471. totalMoneyArr[0] = totalMoney.substring(0, totalMoney.length - 2)
  472. totalMoneyArr[1] = totalMoney.slice(-2)
  473. this.setData({
  474. totalMoney: totalMoney,
  475. totalMoneyArr: totalMoneyArr
  476. })
  477. },
  478. btnAction() {
  479. if (this.data.buyFund) {
  480. if (!this.data.fundPrice && this.data.buySheBao) {
  481. swan.showToast({
  482. title: '打包时需要填写公积金金额',
  483. icon: 'none',
  484. mask: true
  485. })
  486. return
  487. } else if (this.data.fundPrice < this.data.fundPriceRange[0] || this.data.fundPrice > this.data.fundPriceRange[1] || !this.data.fundPrice) {
  488. swan.showToast({
  489. title: '请填写缴费范围内的公积金金额',
  490. icon: 'none',
  491. mask: true
  492. })
  493. return
  494. }
  495. } else if (this.data.needWage && !this.data.isJob && this.data.type != 1) {
  496. if (this.data.wageMoney < swan.getStorageSync(key.StorageKey.minSalary) || this.data.wageMoney > 5000) {
  497. swan.showToast({
  498. title: '请填写范围内的社保流水',
  499. icon: 'none',
  500. mask: true
  501. })
  502. return
  503. }
  504. }
  505. new Promise(resolve => {
  506. var order = wxyj.wxyjData.order, http, status
  507. if (this.data.type == 0 || this.data.type == 2) {
  508. http = url.getTotalFee
  509. } else {
  510. http = url.getTotalSupplementaryPayFee
  511. }
  512. net.connectNeedLogin({
  513. url: url.app_host + http,
  514. data: {
  515. sbuId: order.sbuId,
  516. key: app.loginStatus.key,
  517. cid: order.cid,
  518. month: order.month,
  519. nums: order.nums,
  520. newCard: order.newCard,
  521. shebao_card: order.shebao_card ? order.shebao_card : 0,
  522. hukou_type: order.hukou_type,
  523. pay_for: order.pay_for,
  524. fund: order.fund
  525. },
  526. success: (err, res) => {
  527. swan.hideLoading();
  528. this.setData({ shebaoPrice: res.data.shebao.toFixed(2), totalMoneyData: res.data })
  529. this.countServiceMoney()
  530. this.countTotalMoney()
  531. resolve()
  532. },
  533. fail: (err, res) => {
  534. swan.hideLoading();
  535. businessT.showFailTips(err)
  536. }
  537. }, true)
  538. }).then(() => {
  539. if (this.data.buyFund) {
  540. this.getLastFund()
  541. } else {
  542. this.goNext()
  543. }
  544. })
  545. },
  546. initOrder() {
  547. wxyj.wxyjData.order.key = app.loginStatus.key
  548. wxyj.wxyjData.order.cid = this.data.data.id
  549. wxyj.wxyjData.order.hukou_type = wxyj.wxyjData.detailIndex + 1
  550. wxyj.wxyjData.order.nums = this.data.nums
  551. wxyj.wxyjData.order.first_sb = this.data.isFirstbuySheBao ? 1 : 0
  552. wxyj.wxyjData.order.first_fund = this.data.isFirstBuyFund ? 1 : 0
  553. wxyj.wxyjData.order.fund = this.data.buyFund ? this.data.fundPrice : 0
  554. if (this.data.startMonth < 10) {
  555. wxyj.wxyjData.order.month = this.data.startYear + '0' + this.data.startMonth
  556. } else {
  557. wxyj.wxyjData.order.month = this.data.startYear + String(this.data.startMonth)
  558. }
  559. if (this.data.currentCard[0]) {
  560. wxyj.wxyjData.order.newCard = true
  561. } else {
  562. wxyj.wxyjData.order.newCard = false
  563. }
  564. if (this.data.type == 0 || this.data.type == 1) {
  565. wxyj.wxyjData.order.buyShebao = true
  566. if (this.data.pack) {
  567. wxyj.wxyjData.order.pay_for = "3"
  568. } else {
  569. wxyj.wxyjData.order.pay_for = "1"
  570. }
  571. } else {
  572. wxyj.wxyjData.order.buyShebao = this.data.buySheBao
  573. if (this.data.pack) {
  574. wxyj.wxyjData.order.pay_for = "4"
  575. } else {
  576. wxyj.wxyjData.order.pay_for = "2"
  577. }
  578. }
  579. if (this.data.isJob) {
  580. wxyj.wxyjData.order.working = 1
  581. wxyj.wxyjData.order.sb_wage = 0
  582. } else {
  583. wxyj.wxyjData.order.working = 0
  584. wxyj.wxyjData.order.sb_wage = this.data.wageMoney ? this.data.wageMoney : 0
  585. }
  586. },
  587. getPrice(notShowFail) {
  588. var order = wxyj.wxyjData.order, http, status
  589. if (this.data.type == 0 || this.data.type == 2) {
  590. http = url.getTotalFee
  591. } else {
  592. http = url.getTotalSupplementaryPayFee
  593. }
  594. swan.showLoading({
  595. title: '请稍后...',
  596. mask: true,
  597. });
  598. net.connectNeedLogin({
  599. url: url.app_host + http,
  600. data: {
  601. sbuId: order.sbuId,
  602. key: app.loginStatus.key,
  603. cid: order.cid,
  604. month: order.month,
  605. nums: order.nums,
  606. newCard: order.newCard,
  607. shebao_card: order.shebao_card ? order.shebao_card : 0,
  608. hukou_type: order.hukou_type,
  609. pay_for: order.pay_for,
  610. fund: order.fund
  611. },
  612. success: (err, res) => {
  613. swan.hideLoading();
  614. this.setData({ shebaoPrice: res.data.shebao.toFixed(2), totalMoneyData: res.data })
  615. this.countServiceMoney()
  616. this.countTotalMoney()
  617. },
  618. fail: (err, res) => {
  619. swan.hideLoading();
  620. this.getSheBaoMoney()
  621. if (notShowFail) return
  622. businessT.showFailTips(err)
  623. }
  624. }, true)
  625. },
  626. getSheBaoMoney() {
  627. var shebaoData = this.data.data.shebaos[wxyj.wxyjData.detailIndex].data
  628. this.setData({ shebaoData })
  629. var shebaoPrice = 0
  630. shebaoData.forEach((item) => {
  631. item.p = Number(item.p).toFixed(2)
  632. shebaoPrice += Number(item.p)
  633. })
  634. if (this.data.yearPayMoney && this.data.nums > 1) {
  635. shebaoPrice = shebaoPrice * this.data.nums - this.data.yearPayMoney * (this.data.nums - 1)
  636. } else {
  637. shebaoPrice = shebaoPrice * this.data.nums
  638. }
  639. this.setData({ shebaoPrice: shebaoPrice.toFixed(2) })
  640. this.refreshData()
  641. },
  642. getLastFund(n) {
  643. var order = wxyj.wxyjData.order
  644. net.connectNeedLogin({
  645. url: url.app_host + url.getFundOfBuyBefore,
  646. data: {
  647. sbuId: order.sbuId,
  648. city_code: wxyj.wxyjData.currentCity.id
  649. },
  650. success: (err, res) => {
  651. this.setData({ lastFund: res.data })
  652. if (res.data > this.data.fundPrice) {
  653. swan.showModal({
  654. content: '你最近一次缴公积金金额为' + res.data + '元,若非系统调整请不要随意更改',
  655. confirmText: '我知道了',
  656. confirmColor: '#3296FB',
  657. showCancel: false
  658. });
  659. this.setData({ fundPrice: res.data })
  660. this.refreshData()
  661. return
  662. } else if (res.data < this.data.fundPrice) {
  663. swan.showModal({
  664. content: '你最近一次缴公积金金额为' + res.data + '元,若非系统调整请不要随意更改',
  665. showCancel: true,
  666. cancelText: '继续购买',
  667. cancelColor: '#3296FB',
  668. confirmText: '返回修改',
  669. confirmColor: '#3296FB',
  670. success: res => {
  671. if (res.confirm) {
  672. this.setData({ fundPrice: this.data.lastFund })
  673. this.refreshData()
  674. } else {
  675. this.refreshData()
  676. this.goNext()
  677. }
  678. },
  679. });
  680. } else {
  681. this.goNext()
  682. }
  683. },
  684. fail: (err, res) => {
  685. this.goNext()
  686. }
  687. }, true)
  688. },
  689. openJobModal() {
  690. const animation = swan.createAnimation()
  691. animation.translateY(-500).step();
  692. this.setData({
  693. modalStatus: true
  694. }, () => {
  695. this.setData({
  696. animationData: animation.export()
  697. })
  698. })
  699. },
  700. closeJobModal() {
  701. const animation = swan.createAnimation()
  702. animation.translateY(0).step();
  703. this.setData({
  704. animationData: animation.export()
  705. })
  706. setTimeout(() => {
  707. this.setData({
  708. modalStatus: false,
  709. })
  710. }, 400)
  711. },
  712. goNext() {
  713. swan.navigateTo({
  714. url: '../pay/pay?nums=' + this.data.nums + '&city=' + this.data.currentCity.name + '&hukou=' + this.data.currentHukou + '&type=' + this.data.type + '&orderStatus=' + this.data.type + '&price=' + JSON.stringify(this.data.totalMoneyData)
  715. })
  716. },
  717. onLoad: function (res) {
  718. // 监听页面加载的生命周期函数
  719. swan.setPageInfo && swan.setPageInfo({
  720. title: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
  721. keywords: '我的社保,我的社保网,我的社保APP,社会保障,社保,社保代缴,公积金代缴,社会保险,五险一金,医保,医疗保险,公积金,养老,生育,工伤,失业,住房公积金,社保代理,代缴社保,公积金代理,查悦社保,大社保,亲亲小保,社保掌上通,招聘求职,创业,买房,贷款,计算器,人社局,摇号',
  722. description: '我的社保APP是为个人、企业提供社保代缴代扣、公积金代扣代缴、社保查询、公积金查询服务的名牌产品。解决个体工商户、自由职业者、待业人员、全职妈妈、创业者等的个人社保公积金断缴难题,同时解决贷款, 买房, 买车, 养老, 医疗, 生育, 医疗报销等难题。同时为企业提供全国专业社保代理和公积金代理。',
  723. articleTitle: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
  724. release_date: '2019-02-23 20:00:00',
  725. success: function () {
  726. },
  727. fail: function (res) {
  728. },
  729. })
  730. var wage = swan.getStorageSync(key.StorageKey.minSalary)
  731. wage = wage + '元-5000元'
  732. this.setData({
  733. suffix: sysT.suffixOfClass(),
  734. type: res.type,
  735. city: [wxyj.wxyjData.province, wxyj.wxyjData.city],
  736. currentCity: wxyj.wxyjData.currentCity,
  737. currentHukou: wxyj.wxyjData.hukou,
  738. suffix: sysT.suffixOfClass(),
  739. wage
  740. })
  741. this.setTitle()
  742. this.initData(true)
  743. this.getPrice(true)
  744. },
  745. onReady: function (res) {
  746. // 监听页面初次渲染完成的生命周期函数
  747. },
  748. onShow: function () {
  749. // 监听页面显示的生命周期函数
  750. if (wxyj.wxyjData.startTime) {
  751. this.setData({
  752. startYear: wxyj.wxyjData.startTime[0],
  753. startMonth: wxyj.wxyjData.startTime[1],
  754. endYear: wxyj.wxyjData.endTime[0],
  755. endMonth: wxyj.wxyjData.endTime[1],
  756. nums: wxyj.wxyjData.order.nums,
  757. })
  758. }
  759. this.refreshData()
  760. this.initOrder()
  761. this.getSheBaoMoney()
  762. },
  763. onHide: function () {
  764. // 监听页面隐藏的生命周期函数
  765. },
  766. onUnload: function () {
  767. // 监听页面卸载的生命周期函数
  768. wxyj.wxyjData.startTime = ''
  769. wxyj.wxyjData.endTime = ''
  770. },
  771. onPullDownRefresh: function () {
  772. // 监听用户下拉动作
  773. },
  774. onReachBottom: function () {
  775. // 页面上拉触底事件的处理函数
  776. },
  777. onShareAppMessage: function () {
  778. // 用户点击右上角转发
  779. }
  780. });