a-pay.js 18 KB

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