quickBuy.js 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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. ui: {
  12. t: '',
  13. icon: 's',
  14. item: [{ t: '真实姓名' }, { t: '身份证号' }, { t: '户籍性质' }, { t: '所在城市' }]
  15. },
  16. salarySwitch: false
  17. },
  18. initData() {
  19. var item = this.data.ui.item, hukou, year, month, needSalary, inputSalary, fundSwitch, sheBaoSwitch,buyFund,buySheBao
  20. if (this.data.type == 0) {
  21. this.data.ui.t = '社保一键续缴'
  22. this.data.ui.icon = 's'
  23. buySheBao=true
  24. if (this.data.data.fund_price) {
  25. fundSwitch = true
  26. buyFund=true
  27. } else {
  28. fundSwitch = false
  29. buyFund=false
  30. }
  31. } else {
  32. buyFund=true
  33. this.data.ui.t = '公积金一键续存'
  34. this.data.ui.icon = 'a'
  35. sheBaoSwitch = this.data.data.buyShebao
  36. buySheBao= this.data.data.buyShebao
  37. }
  38. if (this.data.data.hukou_type == 1) {
  39. hukou = '本地城镇'
  40. } else if (this.data.data.hukou_type == 2) {
  41. hukou = '本地农村'
  42. } else if (this.data.data.hukou_type == 3) {
  43. hukou = '外地城镇'
  44. } else {
  45. hukou = '外地农村'
  46. }
  47. item[0].v = this.data.name
  48. item[1].v = this.data.data.id_card
  49. item[2].v = hukou
  50. wxyj.wxyjData.city.forEach((i) => {
  51. if (i.id == this.data.data.city_code) {
  52. this.setData({ city: i.name })
  53. }
  54. return
  55. })
  56. item[3].v = this.data.city
  57. year = String(this.data.data.start_month).substring(0, 4)
  58. month = String(this.data.data.start_month).slice(-2)
  59. if (month.indexOf(0) == 0) {
  60. month = month.slice(-1)
  61. }
  62. if (this.data.data.wage_flow) {
  63. needSalary = true
  64. inputSalary = true
  65. } else {
  66. needSalary = false
  67. inputSalary = false
  68. }
  69. var salary = swan.getStorageSync(key.StorageKey.minSalary)
  70. this.setData({
  71. ui: this.data.ui,
  72. year,
  73. month,
  74. needSalary,
  75. inputSalary,
  76. salary,
  77. fundSwitch,
  78. sheBaoSwitch,
  79. buyFund,
  80. buySheBao
  81. })
  82. },
  83. switchAction(e) {
  84. // if (!wxyj.wxyjData.data.wxyj[0].fund_buy && this.data.type == 2) {
  85. // this.setData({ buySheBao: 1 })
  86. // swan.showModal({
  87. // title: '',
  88. // content: '该地区不支持单独购买公积金,请选择购买社保。',
  89. // confirmColor: '#3296FB',
  90. // confirmText: '确定',
  91. // showCancel: false,
  92. // })
  93. // this.setData({ buySheBao: true })
  94. // return
  95. // }
  96. if (e.currentTarget.id == "work") {
  97. this.data.salarySwitch = !this.data.salarySwitch
  98. if (this.data.salarySwitch) {
  99. this.data.inputSalary = false
  100. } else {
  101. this.data.inputSalary = true
  102. }
  103. if (this.data.salarySwitch) { this.data.wage = 0 }
  104. } else if (e.currentTarget.id == "fund") {
  105. this.data.buyFund = !this.data.buyFund
  106. } else if (e.currentTarget.id == "shebao") {
  107. this.data.buySheBao = !this.data.buySheBao
  108. }
  109. this.setData({
  110. salarySwitch: this.data.salarySwitch,
  111. inputSalary: this.data.inputSalary,
  112. buyFund: this.data.buyFund,
  113. buySheBao: this.data.buySheBao
  114. })
  115. },
  116. openJobModal() {
  117. const animation = swan.createAnimation()
  118. animation.translateY(-500).step();
  119. this.setData({
  120. modalStatus: true
  121. }, () => {
  122. this.setData({
  123. animationData: animation.export()
  124. })
  125. })
  126. },
  127. closeJobModal() {
  128. const animation = swan.createAnimation()
  129. animation.translateY(0).step();
  130. this.setData({
  131. animationData: animation.export()
  132. })
  133. setTimeout(() => {
  134. this.setData({
  135. modalStatus: false,
  136. })
  137. }, 400)
  138. },
  139. chooseDate() {
  140. swan.navigateTo({
  141. url: '../choose-date/choose-date?quickPay=true&date=' + this.data.data.start_month,
  142. });
  143. },
  144. inputAction(e) {
  145. this.setData({ wage: e.detail.value })
  146. },
  147. btnAction(e) {
  148. if (this.data.needSalary && this.data.inputSalary&&this.data.buySheBao) {
  149. if (!this.data.wage || this.data.wage < this.data.salary || this.data.wage > 5000) {
  150. swan.showToast({
  151. title: '请填写范围内的社保流水',
  152. icon: 'none',
  153. });
  154. return
  155. }
  156. }
  157. wxyj.wxyjData.order.buyShebao = this.data.data.buyShebao
  158. wxyj.wxyjData.order.cid = this.data.data.cid
  159. if(this.data.buyFund){
  160. wxyj.wxyjData.order.fund = this.data.data.fund_price
  161. }else{
  162. wxyj.wxyjData.order.fund = 0
  163. }
  164. wxyj.wxyjData.order.hukou_type = this.data.data.hukou_type
  165. wxyj.wxyjData.order.nums = e.currentTarget.id
  166. if (!this.data.salarySwitch) {
  167. wxyj.wxyjData.order.working = 0
  168. if (!this.data.wage) {
  169. wxyj.wxyjData.order.sb_wage = 0
  170. } else {
  171. wxyj.wxyjData.order.sb_wage = this.data.wage
  172. }
  173. } else {
  174. wxyj.wxyjData.order.working = 1
  175. wxyj.wxyjData.order.sb_wage = 0
  176. }
  177. if (this.data.month.length == 1 && this.data.month < 10) {
  178. this.data.month = '0' + this.data.month
  179. }
  180. wxyj.wxyjData.order.month = this.data.year + this.data.month
  181. if (this.data.buyFund && this.data.buySheBao) {
  182. wxyj.wxyjData.order.pack = true
  183. } else {
  184. wxyj.wxyjData.order.pack = false
  185. }
  186. if (this.data.type == 0) {
  187. wxyj.wxyjData.order.pay_for = 1
  188. if (this.data.buyFund) {
  189. wxyj.wxyjData.order.pay_for = 3
  190. }
  191. } else {
  192. wxyj.wxyjData.order.pay_for = 2
  193. if (this.data.buySheBao) {
  194. wxyj.wxyjData.order.pay_for = 4
  195. }
  196. }
  197. var order = wxyj.wxyjData.order
  198. net.connectNeedLogin({
  199. url: url.app_host + url.getTotalFee,
  200. data: {
  201. sbuId: order.sbuId,
  202. key: app.loginStatus.key,
  203. cid: order.cid,
  204. month: order.month,
  205. nums: order.nums,
  206. newCard: order.newCard,
  207. shebao_card: order.shebao_card ? order.shebao_card : 0,
  208. hukou_type: order.hukou_type,
  209. pay_for:order.pay_for,
  210. fund: order.fund
  211. },
  212. success: (err, res) => {
  213. swan.hideLoading();
  214. if(this.data.type==0){
  215. var orderStatus=0
  216. }else{
  217. var orderStatus=2
  218. }
  219. swan.navigateTo({
  220. url: '../pay/pay?nums=' + wxyj.wxyjData.order.nums + '&city=' + this.data.city + '&hukou=' + this.data.ui.item[2].v + '&type=0' + '&price=' + JSON.stringify(res.data)+'&orderStatus='+orderStatus
  221. })
  222. },
  223. fail: (err, res) => {
  224. swan.hideLoading();
  225. businessT.showFailTips(err)
  226. }
  227. }, true)
  228. },
  229. onLoad: function (e) {
  230. // 监听页面加载的生命周期函数
  231. swan.setPageInfo && swan.setPageInfo({
  232. title: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
  233. keywords: '我的社保,我的社保网,我的社保APP,社会保障,社保,社保代缴,公积金代缴,社会保险,五险一金,医保,医疗保险,公积金,养老,生育,工伤,失业,住房公积金,社保代理,代缴社保,公积金代理,查悦社保,大社保,亲亲小保,社保掌上通,招聘求职,创业,买房,贷款,计算器,人社局,摇号',
  234. description: '我的社保APP是为个人、企业提供社保代缴代扣、公积金代扣代缴、社保查询、公积金查询服务的名牌产品。解决个体工商户、自由职业者、待业人员、全职妈妈、创业者等的个人社保公积金断缴难题,同时解决贷款, 买房, 买车, 养老, 医疗, 生育, 医疗报销等难题。同时为企业提供全国专业社保代理和公积金代理。',
  235. articleTitle: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
  236. release_date: '2019-02-23 20:00:00',
  237. success: function () {
  238. console.log('页面基础信息设置完成');
  239. },
  240. fail: function (res) {
  241. console.log('设置失败');
  242. },
  243. })
  244. this.setData({ type: Number(e.type), data: JSON.parse(e.data), name: e.name })
  245. this.initData()
  246. },
  247. onReady: function () {
  248. // 监听页面初次渲染完成的生命周期函数
  249. },
  250. onShow: function () {
  251. // 监听页面显示的生命周期函数
  252. },
  253. onHide: function () {
  254. // 监听页面隐藏的生命周期函数
  255. },
  256. onUnload: function () {
  257. // 监听页面卸载的生命周期函数
  258. },
  259. onPullDownRefresh: function () {
  260. // 监听用户下拉动作
  261. },
  262. onReachBottom: function () {
  263. // 页面上拉触底事件的处理函数
  264. },
  265. onShareAppMessage: function () {
  266. // 用户点击右上角转发
  267. }
  268. });