123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- import PurchaseOrder from '../../../home/public/model/purchaseOrder.js'
- var app = getApp()
- var businessType = require('../../../../public/business-type.js')
- function handleWaitForPayData(data) {
- for (var i in data) {
- var item = data[i]
- handleData(item)
- }
- return data
- }
- function handleAllData(data) {
- var w = []
- var f = []
- var wi = 0
- var fi = 0
- for (var i in data) {
- var item = data[i]
- handleData(item)
- if (item.status == 1) {
- w.push(item)
- } else {
- f.push(item)
- }
- }
- return [data, w, f]
- }
- function handleData(item) {
- item.orderListType = businessType.OrderListType.orderListTypePurchase
- item.a = item.total_fee.toFixed(2)
- if (item.pay_for == 1 || item.pay_for == 3) {
- if (item.added) {
- item.i = 's_pay_s'
- item.title = '社保补缴'
- } else {
- item.i = 'purchase_s'
- if (item.pay_for == 1) {
- item.title = '社保缴纳'
- } else {
- item.title = '社保 (打包公积金)'
- }
- }
- } else {
- if (item.added) {
- item.i = 's_pay_a'
- item.title = '公积金补缴'
- } else {
- item.i = 'purchase_a'
- if (item.pay_for == 2) {
- item.title = '公积金缴存'
- } else {
- item.title = '公积金 (打包社保)'
- }
- }
- }
- if (item.status == 1) {
- item.s = {
- t: '等待付款',
- c: 'order-item-status-w'
- }
- item.bs = 3
- } else if (item.status == 11) {
- item.s = {
- t: '已退款',
- c: 'order-item-status-f'
- }
- item.bs = 1
- } else {
- item.s = {
- t: '交易完成',
- c: 'order-item-status-f'
- }
- item.bs = 1
- }
- var beginYear = (item.start_month / 100) | 0
- var beginMonth = item.start_month % 100
- if (item.nums > 1) {
- var endMonth = beginMonth + item.nums - 1
- beginMonth = ('00' + beginMonth).slice(-2)
- if (endMonth > 12) {
- var endYear = beginYear + 1
- endMonth = ('00' + (endMonth - 12)).slice(-2)
- var t = beginYear + '年' + beginMonth + '月-' + endYear + '年' + endMonth + '月'
- } else {
- var t = beginYear + '年' + beginMonth + '月-' + ('00' + endMonth).slice(-2) + '月'
- }
- } else {
- var t = beginYear + '年' + ('00' + beginMonth).slice(-2) + '月'
- }
- item.cancelContent = '是否要取消' + t + '的' + item.title + '订单'
- item.showTime = t
- item.ct = '参保姓名\n购买月份\n购买城市'
- item.c = item.u_name + '\n' + t + '\n' + item.city_name
- }
- // function createOrder(data) {
- // var order = new PurchaseOrder()
- // var time = getOrderTime(data.start_month, data.nums)
- // order.city = data.city_code
- // order.cityName = data.city_name
- // order.accountType = data.hukou_type
- // order.customerData = {
- // 'user_name': data.u_name,
- // 'id_card': data.id_card,
- // 'nation': '',
- // 'gender': '',
- // 'phone': '',
- // 'sbuId': data.sbuId
- // }
- // order.beginTime = time[0]
- // order.timeInterval = data.nums
- // order.endTime = time[1]
- // order.isNewCustomer = false
- // if (data.pay_for == 1) {
- // order.purchaseType = businessType.PurchaseType.socialInsurance
- // order.pack = false
- // } else if (data.pay_for == 2) {
- // order.purchaseType = businessType.PurchaseType.accumulationFund
- // order.pack = false
- // } else if (data.pay_for == 3) {
- // order.purchaseType = businessType.PurchaseType.socialInsurancePackage
- // order.pack = true
- // } else if (data.pay_for == 4) {
- // order.purchaseType = businessType.PurchaseType.accumulationFundPackage
- // order.pack = true
- // }
-
- // order.SSCard = data.new_card
- // order.socialInsurance = data.shebao
- // order.accumulationFund = (data.fund / data.nums).toFixed(2)
- // order.id = data.cid
- // order.payFor = data.pay_for
- // order.isSupplementaryPay = false
- // order.isFirstBuyShebao = data.first_sb == 0 ? false : true
- // order.isFirstBuyFund = data.first_fund == 0 ? false : true
- // app.purchase.order = order
- // }
- // function getOrderTime(b, l) {
- // var beginYear = (b / 100) | 0
- // var beginMonth = b % 100
- // if (l > 1) {
- // var endYear = beginYear
- // var endMonth = beginMonth + l - 1
- // beginMonth = ('00' + beginMonth).slice(-2)
- // if (endMonth > 12) {
- // var endYear = beginYear + 1
- // endMonth = ('00' + (endMonth - 12)).slice(-2)
- // } else {
- // endMonth = ('00' + endMonth).slice(-2)
- // }
- // return [beginYear + '年' + beginMonth + '月', endYear + '年' + endMonth + '月']
- // } else {
- // var t = beginYear + '年' + ('00' + beginMonth).slice(-2) + '月'
- // return [t, t]
- // }
- // }
- module.exports = {
- handleWaitForPayData: handleWaitForPayData,
- handleAllData: handleAllData
- }
|