turnover.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. Page({
  8. data: {
  9. current: 0,
  10. isEmpty: false,
  11. },
  12. getSysInfo() {
  13. swan.getSystemInfo({
  14. success: res => {
  15. var width = res.windowWidth
  16. this.setData({ width: res.windowWidth })
  17. },
  18. });
  19. setTimeout(() => {
  20. var tabWidth, tabItemWidth
  21. swan.createSelectorQuery().select('#tabWrap').boundingClientRect((rect) => {
  22. tabWidth = rect.width
  23. }).exec()
  24. swan.createSelectorQuery().select('#tabItem').boundingClientRect((rect) => {
  25. tabItemWidth = rect.width
  26. var moveX = tabWidth - tabItemWidth
  27. this.setData({ moveX })
  28. }).exec()
  29. }, 300)
  30. },
  31. initData() {
  32. swan.showLoading({
  33. title: '请稍后...',
  34. mask: true,
  35. });
  36. net.connectNeedLogin({
  37. url: url.app_host + url.getDoneSalaryList,
  38. data: {},
  39. success: (err, res) => {
  40. this.getMonth(res.data, 'isPay')
  41. },
  42. failed: (err, res) => {
  43. swan.hideLoading();
  44. businessT.showFailTips(err)
  45. }
  46. })
  47. net.connectNeedLogin({
  48. url: url.app_host + url.getUndoneSalaryList,
  49. data: {},
  50. success: (err, res) => {
  51. this.getMonth(res.data, 'notPay')
  52. swan.hideLoading();
  53. },
  54. failed: (err, res) => {
  55. swan.hideLoading();
  56. businessT.showFailTips(err)
  57. }
  58. })
  59. },
  60. getMonth(res, type) {
  61. var isPay, notPay
  62. res.forEach((item) => {
  63. item.year = String(item.opt_month).substring(0, 4)
  64. item.month = String(item.opt_month).slice(-2)
  65. item.charge = Number(item.charge).toFixed(2)
  66. item.wage = Number(item.wage).toFixed(2)
  67. item.total_fee = Number(item.total_fee).toFixed(2)
  68. item.gen_time = item.gen_time.slice(0, -3)
  69. if (item.pay_time) {
  70. item.pay_time = item.pay_time.slice(0, -3)
  71. item.payTime = item.pay_time.slice(5)
  72. }
  73. if (item.hf_time) {
  74. item.hf_time = item.hf_time.slice(0, -3)
  75. item.hfTime = item.hf_time.slice(5)
  76. }
  77. })
  78. if (type == 'isPay') {
  79. this.setData({ isPay: res })
  80. } else {
  81. this.setData({ notPay: res })
  82. }
  83. this.changData()
  84. },
  85. changData() {
  86. var list = []
  87. list[0] = this.data.notPay.slice(0, 10)
  88. list[1] = this.data.isPay.slice(0, 10)
  89. this.setData({ list })
  90. },
  91. loadMore(e) {
  92. if (e.currentTarget.dataset.index == 0) {
  93. this.data.list[0] = this.data.notPay.slice(0, this.data.list[0].length + 10)
  94. } else {
  95. this.data.list[1] = this.data.isPay.slice(0, this.data.list[1].length + 10)
  96. }
  97. this.setData({ list: this.data.list })
  98. },
  99. openModal(e) {
  100. const animation = swan.createAnimation()
  101. animation.translateY(-500).step();
  102. this.setData({
  103. modalStatus: true
  104. }, () => {
  105. this.setData({
  106. animationData: animation.export()
  107. })
  108. })
  109. var detail = this.data.list[this.data.current][e.currentTarget.dataset.index]
  110. app.globalData.customerList.forEach((item) => {
  111. if (item.id == detail.sbu_id) {
  112. detail.bank = item.bank
  113. detail.bank_code = item.bank_code.slice(-4)
  114. }
  115. })
  116. this.setData({ detail })
  117. if (e.currentTarget.dataset.type == "progress") {
  118. this.fanhuanStatus(null, true)
  119. }
  120. if(!detail.bank_code){
  121. this.setData({addCard:true})
  122. }else{
  123. this.setData({addCard:false})
  124. }
  125. this.getParams()
  126. },
  127. closeModal() {
  128. const animation = swan.createAnimation()
  129. animation.translateY(0).step();
  130. const animation1 = swan.createAnimation({ duration: 0 })
  131. animation1.translateX(0).step();
  132. this.setData({
  133. animationData: animation.export()
  134. })
  135. setTimeout(() => {
  136. this.setData({
  137. modalStatus: false,
  138. modalType: '',
  139. modalAnimation: animation1.export()
  140. })
  141. }, 400)
  142. },
  143. move(e) {
  144. const animationLine = swan.createAnimation()
  145. const animationContent = swan.createAnimation()
  146. if (e.currentTarget.dataset.index == 1) {
  147. animationLine.translateX(this.data.moveX).step()
  148. animationContent.translateX(-this.data.width).step();
  149. } else {
  150. animationLine.translateX(0).step()
  151. animationContent.translateX(0).step();
  152. }
  153. this.setData({
  154. current: e.currentTarget.dataset.index,
  155. animationLine: animationLine.export(),
  156. animationContent: animationContent.export()
  157. })
  158. },
  159. addCard() {
  160. var arr = app.globalData.customerList.filter(item => {
  161. return this.data.detail.sbu_id == item.id
  162. })
  163. swan.navigateTo({
  164. url: '../../../../public/pages/edit-bank/edit-bank?current=' + JSON.stringify(arr[0])
  165. });
  166. },
  167. getParams() {
  168. this.setData({ payData: { order_no: this.data.detail.order_no, pay_channel: 13 } })
  169. },
  170. pay() {
  171. net.connectNeedLogin({
  172. url: url.app_host + url.createSalaryOrder,
  173. data: this.data.payData,
  174. success: (err, res) => {
  175. swan.requestPolymerPayment({
  176. orderInfo: res.data,
  177. success: res => {
  178. if (app.sbuids.indexOf(this.data.detail.sbu_id) != -1) {
  179. swan.navigateTo({
  180. url: '../../../../public/pages/pay-success/pay-success?type=addCard&id=' + this.data.detail.sbu_id
  181. });
  182. }else{
  183. swan.navigateTo({
  184. url: '../../../../public/pages/pay-success/pay-success?type=share'
  185. });
  186. }
  187. },
  188. fail: err => {
  189. swan.showToast({
  190. title: '支付失败',
  191. icon: 'none'
  192. });
  193. }
  194. });
  195. },
  196. fail: (err, res) => {
  197. swan.hideLoading()
  198. businessT.showFailTips(err, '提交订单失败')
  199. },
  200. complete: () => {
  201. this.closeModal()
  202. }
  203. }, true)
  204. },
  205. payAction(e) {
  206. var detail = this.data.list[0][e.currentTarget.dataset.index]
  207. this.setData({ detail })
  208. this.getParams()
  209. this.pay()
  210. },
  211. fanhuanStatus(e, res) {
  212. var animation
  213. if (res) {
  214. animation = swan.createAnimation({ duration: 0 })
  215. } else {
  216. animation = swan.createAnimation()
  217. }
  218. animation.translateX(-this.data.width).step();
  219. this.setData({ modalType: 'progress', modalAnimation: animation.export() })
  220. },
  221. onLoad: function () {
  222. // 监听页面加载的生命周期函数
  223. this.initData()
  224. this.setData({ suffix: sysT.suffixOfClass() })
  225. },
  226. onReady: function () {
  227. // 监听页面初次渲染完成的生命周期函数
  228. this.getSysInfo()
  229. },
  230. onShow: function () {
  231. // 监听页面显示的生命周期函数
  232. swan.setPageInfo && swan.setPageInfo({
  233. title: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
  234. keywords: '我的社保,我的社保网,我的社保APP,社会保障,社保,社保代缴,公积金代缴,社会保险,五险一金,医保,医疗保险,公积金,养老,生育,工伤,失业,住房公积金,社保代理,代缴社保,公积金代理,查悦社保,大社保,亲亲小保,社保掌上通,招聘求职,创业,买房,贷款,计算器,人社局,摇号',
  235. description: '我的社保APP是为个人、企业提供社保代缴代扣、公积金代扣代缴、社保查询、公积金查询服务的名牌产品。解决个体工商户、自由职业者、待业人员、全职妈妈、创业者等的个人社保公积金断缴难题,同时解决贷款, 买房, 买车, 养老, 医疗, 生育, 医疗报销等难题。同时为企业提供全国专业社保代理和公积金代理。',
  236. articleTitle: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
  237. release_date: '2019-02-23 20:00:00',
  238. success: function () {
  239. console.log('页面基础信息设置完成');
  240. },
  241. fail: function (res) {
  242. console.log('设置失败');
  243. },
  244. })
  245. },
  246. onHide: function () {
  247. // 监听页面隐藏的生命周期函数
  248. },
  249. onUnload: function () {
  250. // 监听页面卸载的生命周期函数
  251. },
  252. onPullDownRefresh: function () {
  253. // 监听用户下拉动作
  254. },
  255. onReachBottom: function () {
  256. // 页面上拉触底事件的处理函数
  257. },
  258. onShareAppMessage: function () {
  259. // 用户点击右上角转发
  260. }
  261. });