s-payback.js 20 KB

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