s-pay.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  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 app = getApp()
  7. var wxyj = require('../../../../public/wxyj.js')
  8. Page({
  9. // 页面的初始数据
  10. data: {
  11. ui: [
  12. { p1: "89", p2: "¥89.00" },
  13. ['本地城镇', '本地农村', '外地城镇', '外地农村'],
  14. [
  15. { c: '重要说明(必读)', d: ['以前曾在单位参保过的,第一次下单购买前,请先确认前单位是否已经减员。若因前单位没有减员的,导致购买不成功,本平台不负责哦。', '本平台仅支持代缴服务,不支持生育津贴、住房补贴等申领,不支持住院等大额医疗报销,且不出具任何相关证明。'] },
  16. { c: '社保减员注意事项', d: ['若您停止购买后,本平台通常会于次月截止时间后的一周操作减员(部分地区可能会有延迟),需提前减员的用户,请提前3-7工作日联系客服。', '如果您当月申请减员后,又想重新购买当月的社保,请务必先联系客服撤销减员,避免漏缴。'] }
  17. ],
  18. ['购买流程', '平台优势', '常见问题', '温馨提示'],
  19. ['覆盖城市最广,且每个城市提供专职客服服务', '百万用户点赞过,再也不担心收钱不买'],
  20. [{ c: '专业团队操作', p: 'advantage_professional' }, { c: '百万用户点赞', p: 'advantage_like' }, { c: '品质有保证', p: 'advantage_quality' }],
  21. ['避免因错过了截止时间忘记下单,造成社保断缴的,建议一次性购买多个月份。若有新的工作单位,未缴费的月份可申请退款。若申请退费,请于该月份截止购买前联系客服。', '凡带有“年缴”标识的,首月会一次性收取一年费用,年费会因地区和缴费月份不同稍有变化。', '带有“预收费用”的城市,因社保局已确定调费,但上调金额未定,固将预收一定的费用。待社保局确定上调金额后,我们会统一清算,多退少补(如:杭州市一般于6月份公布,但须从当年1月份开始执行)。', '每年政府会调整社保缴费基数,我们会在第一时间通知您。若因政府调整通知滞后导致划扣金额不准确的,我们承诺多退少补,童叟无欺。', '本套餐适合于18岁至法定退休年龄之间的用户购买。']
  22. ],
  23. index: 0,
  24. dataset: ['city', 'type', 'hukou'],
  25. currentData: [{ t: '参保城市', c: '广州' }, { t: '参保方案', c: '二档' }, { t: '户籍性质', c: '本地城镇' }],//当前选择的数据
  26. typeStatus: '',//参保方案是否可选
  27. city: [],
  28. lineX: 0,//蓝线的位置
  29. currentCity: { name: '广州', id: '1001' },
  30. currentType: 0,
  31. detailIndex: 0,
  32. time: '',
  33. haveYearPay: false,
  34. totalPrice: [{ c: '', p: '' }],
  35. scrollInto: '',
  36. scrollTop: '',
  37. scrollHeight: 0,
  38. anchor: 'anchor',
  39. anchorIndex: 0,
  40. n: 0,
  41. canMoveLine: false
  42. },
  43. goDetail() {
  44. console.log(this.data.data)
  45. var cha = sysT.sysInfo().system.indexOf("iOS") == 0 ? 'iOS' : 'Android'
  46. var hk = this.data.detailIndex + 1
  47. swan.navigateTo({
  48. url: '../../../../public/pages/html/html?host=https://www.wodeshebao.com/calc/app_index.html&f=' + cha + '&c=' + this.data.data.city_code + '&cid=' + this.data.data.id + '&hk=' + hk
  49. });
  50. },
  51. goNext(e) {
  52. if (app.loginStatus.isLogin) {
  53. if (!e.currentTarget.dataset.type) {
  54. swan.navigateTo({
  55. url: '../../../../public/pages/choose-person/choose-person?type=0'
  56. });
  57. } else {
  58. swan.navigateTo({
  59. url: '../../../../public/pages/choose-person/choose-person?type=0&quickBuy=' + e.currentTarget.dataset.type
  60. });
  61. }
  62. }
  63. else {
  64. swan.navigateTo({
  65. url: '../../../login/pages/shebaoLogin/shebaoLogin',
  66. })
  67. }
  68. },
  69. openModal(e) {
  70. var pickerData
  71. if (e.currentTarget.dataset.type == 'city') {
  72. pickerData = this.data.city
  73. } else if (e.currentTarget.dataset.type == 'type') {
  74. pickerData = [['一档', '二档']]
  75. } else if (e.currentTarget.dataset.type == 'hukou') {
  76. pickerData = [['本地城镇', '本地农村', '外地城镇', '外地农村']]
  77. }
  78. this.chooseCityModal = this.selectComponent("#chooseCityModal");
  79. this.chooseCityModal.openModal(pickerData, e.currentTarget.dataset.type)
  80. },
  81. initData() {
  82. swan.showLoading({
  83. title: '请稍后...',
  84. mask: true,
  85. });
  86. this.data.currentCity = wxyj.wxyjData.currentCity
  87. this.data.currentData[0].c = this.data.currentCity.name
  88. net.connect({
  89. url: url.app_host + url.getNormalPurchaseData,
  90. data: { city_code: this.data.currentCity.id, type: 1 },
  91. method: "POST",
  92. success: (err, res) => {
  93. swan.hideLoading()
  94. var index
  95. if (wxyj.wxyjData.type == 1) {
  96. index = 0
  97. this.data.currentData[1].c = '二档'
  98. } else {
  99. index = 1
  100. this.data.currentData[1].c = '一档'
  101. }
  102. wxyj.wxyjData.data = res.data
  103. this.setData({ sale: wxyj.wxyjData.data.sb_vol, data: wxyj.wxyjData.data.wxyj[index], servicePrice: wxyj.wxyjData.data.wxyj[index].shebao_charge.toFixed(2) })
  104. if (this.data.data.shebao_type.indexOf('标准') !=-1) {
  105. this.setData({ typeStatus: false })
  106. } else {
  107. this.setData({ typeStatus: true })
  108. }
  109. this.moveLine(null, wxyj.wxyjData.detailIndex)
  110. this.refreshData(true)
  111. },
  112. fail: (err, res) => {
  113. swan.hideLoading()
  114. swan.showToast({
  115. title: '加载数据失败!请检查网络设置!',
  116. icon: 'none'
  117. })
  118. }
  119. }, true)
  120. },
  121. initCity() {
  122. net.connect({
  123. url: url.app_host + url.getPurchaseCity,
  124. data: '',
  125. success: (err, res) => {
  126. var arr1 = [], arr2 = []
  127. res.data.forEach(function (item) {
  128. if (item.isCity) {
  129. arr1.push(item)
  130. } else {
  131. arr2.push(item)
  132. }
  133. })
  134. wxyj.wxyjData.city = [...arr1]
  135. wxyj.wxyjData.province = [...arr2]
  136. },
  137. fail: (err, res) => {
  138. swan.showToast({
  139. title: '加载数据失败!请检查网络设置!',
  140. icon: 'none'
  141. })
  142. }
  143. }, true)
  144. },
  145. refreshData(isFirst) {
  146. if (typeof(this.data.data.shebao_desc)=='string'&&this.data.data.shebao_desc) {
  147. this.data.data.shebao_desc = this.data.data.shebao_desc.split('\n')
  148. }
  149. this.data.currentData[2].c= wxyj.wxyjData.hukou
  150. this.setData({
  151. currentData: this.data.currentData,
  152. detailIndex: wxyj.wxyjData.detailIndex,
  153. data: this.data.data,
  154. city: [wxyj.wxyjData.province, wxyj.wxyjData.city]
  155. })
  156. this.haveYearPay(isFirst)
  157. this.countTime(isFirst)
  158. this.countPrice(isFirst)
  159. },
  160. changeCurrent(e) {
  161. if (e.detail.type == "city") {
  162. wxyj.wxyjData.currentCity = e.detail.data
  163. wxyj.wxyjData.lastValue = e.detail.lastValue
  164. wxyj.wxyjData.type = 1
  165. this.data.currentData[1].c = '二档'
  166. this.setData({ currentCity: e.detail.data })
  167. this.initData()
  168. this.refreshHeight()
  169. } else if (e.detail.type == "type") {
  170. wxyj.wxyjData.type = e.detail.index
  171. if (e.detail.index == 0) {
  172. this.data.data = wxyj.wxyjData.data.wxyj[1]
  173. this.data.currentData[1].c = '一档'
  174. } else if (e.detail.index == 1) {
  175. this.data.data = wxyj.wxyjData.data.wxyj[0]
  176. this.data.currentData[1].c = '二档'
  177. }
  178. this.refreshData(true)
  179. } else if (e.detail.type == "hukou") {
  180. wxyj.wxyjData.hukou = e.detail.data
  181. this.data.currentData[2].c = wxyj.wxyjData.hukou
  182. this.moveLine(null, e.detail.index)
  183. this.setData({
  184. detailIndex: e.detail.index
  185. })
  186. }
  187. swan.hideLoading();
  188. this.setData({ currentData: this.data.currentData })
  189. },
  190. moveLine(e, index) {
  191. if (e) {
  192. var n = e.currentTarget.dataset.index
  193. this.setData({ lineX: 190 * n, detailIndex: n })
  194. if (n == 0) {
  195. wxyj.wxyjData.hukou = '本地城镇'
  196. } else if (n == 1) {
  197. wxyj.wxyjData.hukou = '本地农村'
  198. } else if (n == 2) {
  199. wxyj.wxyjData.hukou = '外地城镇'
  200. } else if (n == 3) {
  201. wxyj.wxyjData.hukou = '外地农村'
  202. }
  203. wxyj.wxyjData.detailIndex = n
  204. this.setData({ currentData: this.data.currentData, detailIndex: n })
  205. }
  206. if (index || index == 0) {
  207. this.setData({ lineX: 190 * index, detailIndex: index })
  208. }
  209. this.refreshHeight()
  210. this.refreshData()
  211. },
  212. countTime(isFirst) {
  213. if (isFirst) {
  214. var sYear, sMonth
  215. var day = new Date().getDate()
  216. var eMonth = new Date().getMonth() + 1
  217. if (day > this.data.data.inc_date) {
  218. eMonth += 1
  219. }
  220. if (eMonth > 12) {
  221. eMonth = 1
  222. }
  223. sYear = String(this.data.data.month).slice(0, 4)
  224. sMonth = String(this.data.data.month).slice(4)
  225. this.setData({
  226. time: { 'sYear': sYear, 'sMonth': sMonth, 'eMonth': eMonth, 'eDay': this.data.data.inc_date }
  227. })
  228. }
  229. },
  230. haveYearPay(isFirst) {
  231. if (isFirst) {
  232. var data = this.data.data.shebaos
  233. data.forEach((item, index) => {
  234. if (item.data.length != 0) {
  235. item.data.forEach((item2, index2) => {
  236. if (item2.n.indexOf('(年缴)') != -1) {
  237. item2.n = item2.n.slice(0, 7)
  238. item.data.splice(index2, 1)
  239. this.setData({
  240. haveYearPay: true,
  241. yearPayData: item2
  242. })
  243. wxyj.wxyjData.haveYearPay = true,
  244. wxyj.wxyjData.yearPayData =item2
  245. } else {
  246. this.setData({
  247. haveYearPay: false
  248. })
  249. wxyj.wxyjData.haveYearPay = false
  250. wxyj.wxyjData.yearPayData =''
  251. }
  252. })
  253. }
  254. })
  255. }
  256. },
  257. countPrice(isFirst) {
  258. var data = this.data.data.shebaos
  259. if (isFirst) {
  260. var arr = []
  261. data.forEach(function (item) {
  262. item.data.sort(function sort(a, b) {
  263. return a.i - b.i
  264. })
  265. item.data.forEach(function (i) {
  266. i.p = Number(i.p).toFixed(2)
  267. })
  268. })
  269. this.setData({ data: this.data.data })
  270. }
  271. var totalPrice = 0
  272. if (this.data.data.shebaos[this.data.detailIndex].data.length != 0) {
  273. this.data.data.shebaos[this.data.detailIndex].data.forEach((item) => {
  274. totalPrice += Number(item.p)
  275. })
  276. totalPrice=totalPrice.toFixed(2)
  277. var totalPrice2=Number(totalPrice).toFixed(2)
  278. if (this.data.haveYearPay) {
  279. totalPrice = (Number(totalPrice) + this.data.yearPayData.p).toFixed(2)
  280. }
  281. }
  282. if (this.data.haveYearPay) {
  283. this.setData({
  284. totalPrice: [{ c: '本年首月套餐费用', p: totalPrice }, { c: '非首月套餐费用', p: totalPrice2 }]
  285. })
  286. } else {
  287. this.setData({
  288. totalPrice: [{ c: '套餐费用', p: totalPrice }]
  289. })
  290. }
  291. },
  292. anchorAction(e) {
  293. var moveX = Math.ceil((this.data.anchorWidth - this.data.anchorItemWidth * 4) / 3 + this.data.anchorItemWidth)
  294. var n = e.currentTarget.dataset.index
  295. this.setData({ anchorIndex: n })
  296. var animation = swan.createAnimation({
  297. duration: 300
  298. });
  299. if (n == 0) {
  300. animation.translateX(0).step();
  301. this.setData({
  302. scrollTop: this.data.anchorY + Math.random(),
  303. animationData: animation.export()
  304. })
  305. } else if (n == 1) {
  306. animation.translateX(moveX).step();
  307. this.setData({
  308. scrollTop: this.data.advantageY + Math.random(),
  309. animationData: animation.export()
  310. })
  311. } else if (n == 2) {
  312. animation.translateX(moveX * 2).step();
  313. this.setData({
  314. scrollTop: this.data.askY + Math.random(),
  315. animationData: animation.export()
  316. })
  317. } else if (n == 3) {
  318. animation.translateX(moveX * 3).step();
  319. this.setData({
  320. scrollTop: this.data.tipsY + Math.random(),
  321. animationData: animation.export()
  322. })
  323. }
  324. },
  325. countHeight() {
  326. swan.getSystemInfo({
  327. success: res => {
  328. this.setData({
  329. scrollHeight: res.screenHeight - res.statusBarHeight - res.navigationBarHeight
  330. })
  331. }
  332. })
  333. },
  334. refreshHeight() {
  335. //页面高度变化后,重新获取每个锚点的位置
  336. setTimeout(() => {
  337. swan.createSelectorQuery().select('#wrapBox').boundingClientRect((rect) => {
  338. if (!rect) {
  339. return
  340. }
  341. var newHeight = parseInt(rect.height)
  342. var disHeight = newHeight - this.data.oldHeight
  343. var anchorY = this.data.anchorY + disHeight
  344. var progressY = this.data.progressY + disHeight
  345. var advantageY = this.data.advantageY + disHeight
  346. var askY = this.data.askY + disHeight
  347. var tipsY = this.data.tipsY + disHeight
  348. this.setData({
  349. oldHeight: newHeight,
  350. anchorY,
  351. progressY,
  352. advantageY,
  353. askY,
  354. tipsY
  355. })
  356. }).exec()
  357. }, 400)
  358. },
  359. scrollAction(e) {
  360. var moveX = Math.ceil((this.data.anchorWidth - this.data.anchorItemWidth * 4) / 3 + this.data.anchorItemWidth)
  361. var scrollTop = e.detail.scrollTop
  362. if (scrollTop > this.data.anchorY) {
  363. this.setData({
  364. anchor: 'anchorPosition'
  365. })
  366. } else if (scrollTop < this.data.anchorY) {
  367. this.setData({
  368. anchor: 'anchor'
  369. })
  370. }
  371. var animation = swan.createAnimation({
  372. duration: 300
  373. });
  374. if (scrollTop < this.data.advantageY) {
  375. animation.translateX(0).step();
  376. this.setData({
  377. anchorIndex: 0,
  378. animationData: animation.export()
  379. })
  380. } else if (scrollTop > this.data.advantageY && scrollTop < this.data.askY) {
  381. animation.translateX(moveX).step();
  382. this.setData({
  383. anchorIndex: 1,
  384. animationData: animation.export()
  385. })
  386. } else if (scrollTop > this.data.askY && scrollTop < this.data.tipsY) {
  387. animation.translateX(moveX * 2).step();
  388. this.setData({
  389. anchorIndex: 2,
  390. animationData: animation.export(),
  391. })
  392. } else if (scrollTop > this.data.tipsY) {
  393. animation.translateX(moveX * 3).step();
  394. this.setData({
  395. anchorIndex: 3,
  396. animationData: animation.export()
  397. })
  398. }
  399. this.setData({ n: scrollTop })
  400. },
  401. countAnchorPosition() {
  402. swan.createSelectorQuery().select('#wrapBox').boundingClientRect((rect) => {
  403. this.setData({
  404. oldHeight: parseInt(rect.height)
  405. })
  406. }).exec()
  407. swan.createSelectorQuery().select('#anchor').boundingClientRect((rect) => {
  408. var top = parseInt(rect.top)
  409. this.setData({
  410. anchorY: top
  411. })
  412. }).exec()
  413. swan.createSelectorQuery().select('#advantage').boundingClientRect((rect) => {
  414. var top = parseInt(rect.top)
  415. this.setData({
  416. advantageY: top
  417. })
  418. }).exec()
  419. swan.createSelectorQuery().select('#ask').boundingClientRect((rect) => {
  420. var top = parseInt(rect.top)
  421. this.setData({
  422. askY: top
  423. })
  424. }).exec()
  425. var tips='#tips'+this.data.suffix
  426. swan.createSelectorQuery().select(tips).boundingClientRect((rect) => {
  427. var top = parseInt(rect.top)
  428. this.setData({
  429. tipsY: top
  430. })
  431. }).exec()
  432. swan.createSelectorQuery().select('#anchorWrap').boundingClientRect((rect) => {
  433. this.setData({
  434. anchorWidth: rect.width
  435. })
  436. }).exec()
  437. swan.createSelectorQuery().select('.anchorItem').boundingClientRect((rect) => {
  438. this.setData({
  439. anchorItemWidth: rect.width
  440. })
  441. }).exec()
  442. },
  443. hotline(e) {
  444. this.hot = this.selectComponent("#hotline")
  445. this.hot.openModal(true);
  446. },
  447. showYearPay() {
  448. swan.showModal({
  449. title: '提示',
  450. content: '凡带年缴标识的首月一次性收取一年费用\n年费会因缴费首月稍有不同',
  451. showCancel: false,
  452. confirmText: '知道了',
  453. confirmColor: '#3296FB',
  454. });
  455. },
  456. // goKefu(e){
  457. // swan.navigateTo({
  458. // url: '../../../../public/pages/html/html?host=https://www.sobot.com/chat/h5/index.html&sysNum=a73ea222d7284f7c8801e60e6054e985&partnerId=2180427&tel='+ app.globalData.userInfo.phone+'&uname='+ app.globalData.userInfo.phone+'&remark=BDXCX_SHEBAO&titleFlag=3&powered=false&telShowFlag=true&telFlag=true'
  459. // })
  460. // },
  461. // 页面的生命周期函数 – 监听页面加载
  462. onLoad(res) {
  463. this.countHeight()
  464. this.initCity()
  465. this.setData({ suffix: sysT.suffixOfClass() })
  466. },
  467. // 页面的生命周期函数 – 监听页面初次渲染完成
  468. onReady(res) {
  469. setTimeout(()=>{
  470. this.countAnchorPosition()
  471. },400)
  472. // this.moveLine(null, wxyj.wxyjData.detailIndex)
  473. },
  474. // 页面的生命周期函数 – 监听页面显示
  475. onShow(res) {
  476. this.data.currentData[0].c = wxyj.wxyjData.currentCity.name
  477. this.data.currentData[2].c = wxyj.wxyjData.hukou
  478. this.setData({ currentData: this.data.currentData })
  479. this.initData()
  480. swan.setPageInfo && swan.setPageInfo({
  481. title: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
  482. keywords: '我的社保,我的社保网,我的社保APP,社会保障,社保,社保代缴,公积金代缴,社会保险,五险一金,医保,医疗保险,公积金,养老,生育,工伤,失业,住房公积金,社保代理,代缴社保,公积金代理,查悦社保,大社保,亲亲小保,社保掌上通,招聘求职,创业,买房,贷款,计算器,人社局,摇号',
  483. description: '我的社保APP是为个人、企业提供社保代缴代扣、公积金代扣代缴、社保查询、公积金查询服务的名牌产品。解决个体工商户、自由职业者、待业人员、全职妈妈、创业者等的个人社保公积金断缴难题,同时解决贷款, 买房, 买车, 养老, 医疗, 生育, 医疗报销等难题。同时为企业提供全国专业社保代理和公积金代理。',
  484. articleTitle: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
  485. release_date: '2019-02-23 20:00:00',
  486. success: function () {
  487. console.log('页面基础信息设置完成');
  488. },
  489. fail: function (res) {
  490. console.log('设置失败');
  491. },
  492. })
  493. },
  494. // 页面的生命周期函数 – 监听页面隐藏
  495. onHide(res) {
  496. },
  497. // 页面的生命周期函数 – 监听页面卸载
  498. onUnload(res) {
  499. },
  500. // 页面的生命周期函数 – 监听页面重启,单击重启按钮时触发
  501. onForceReLaunch(res) {
  502. },
  503. // 页面的事件处理函数 – 监听用户下拉动作
  504. onPullDownRefresh(res) {
  505. },
  506. // 页面的事件处理函数 – 上拉触底事件的处理函数
  507. onReachBottom(res) {
  508. },
  509. // 页面的事件处理函数 – 用户点击右上角转发
  510. onShareAppMessage(res) {
  511. },
  512. // 页面的事件处理函数 – 页面滚动触发事件的处理函数
  513. onPageScroll(res) {
  514. },
  515. // 页面的事件处理函数 – 当前是 tab 页时,点击 tab 时触发
  516. onTabItemTap(res) {
  517. }
  518. });