123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- '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
- })
- $('#advanceList').on('click', `a[href="#file"]`, function() {
- const { fileList = [] } = advanceList.find(item => item.id === parseInt($(this).data('id')))
- $('#file-content').empty()
- let html = `<thead>
- <tr>
- <th>文件名</th>
- <th>上传时间</th>
- <th>操作</th>
- </tr>
- </thead>`
- fileList.forEach(file => {
- html+= `<tr>
- <td>${file.filename}</td>
- <td>${new Date(file.create_time).toLocaleDateString()}</td>
- <td>
- <a href="/${file.filepath}" target="_blank" title="下载"><i class="fa fa-download"></i></a>
- </td>
- </tr>`
- })
- $('#file-content').append(html)
- })
- 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;
- }
- })
|