123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 'use strict';
- /**
- *
- *
- * @author lanjianrong
- * @date 2020/8/12
- * @version
- */
- $(document).ready(function () {
- $('#advance_add').click(function() {
- postData(`${window.location.pathname}/${type}/create`, {}, res => {
- const html = `<tr>
- <td><a href="/tender/${res.tid}/advance/${res.id}/detail" data-id="${res.id}">第${res.order}期</a></td>
- <td>${res.pay_ratio || 0}%</td>
- <td class="text-right">${formatMoney(res.cur_amount || 0)}</td>
- <td class="text-right">${formatMoney(res.prev_amount || 0)}</td>
- <td class="text-right">${formatMoney(res.prev_total_amount || 0)}</td>
- <td><a class="btn btn-sm" href="#file" data-toggle="modal" data-target="#file"><i class="fa fa-paperclip "></i> 3</a></td>
- <td>${auditConst.statusString[res.status]}</td>
- <td><a href="/tender/${res.tid}/advance/${res.id}/detail" class="btn btn-primary btn-sm">编辑</a></td>
- </tr>`
- $('#advanceList').prepend(html)
- $('#advance_add').remove()
- window.location.href = `${window.location.pathname}/${res.id}/detail`
- })
- return false
- })
- function formatMoney(s, dot = ',') {
- if (!s) return '0.00';
- s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(2) + '';
- let l = s.split('.')[0].split('').reverse(),
- r = s.split('.')[1];
- let t = '';
- for (let i = 0; i < l.length; i++) {
- t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? dot : '');
- }
- return t.split('').reverse().join('') + '.' + r;
- }
- })
|