123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <!--
- 费用清单
- -->
- <div class="el-main">
- <div class="el-tit">
- <div class="el-t-l">费用总计</div>
- <div class="el-t-m" ms-text="data['费用总计']"></div>
- </div>
- <ul class="el-list">
- <li class="el-item" ms-repeat="data['门诊分类']">
- <div class="title"><span ms-text="el['分类名称']"></span><span ms-text="el['费用金额']"></span></div>
- <div class="list" ms-if="el['费用详情']" ms-repeat-item="el['费用详情']"><span ms-text="item['项目名称']"></span><span ms-text="item['总价']"></span></div>
- </li>
- </ul>
- </div>
- <script>
- function dsXmlToJson0102_2(xmlStr) {
- var $xmlDom = $(xmlStr),
- fee_sum = '';//费用总计
- $nodes = {
- "费用" :$xmlDom.find('component section entry')
- } ;
- return {
- data:{
- "门诊分类":(function(){
- var arr = [];
- _.each($nodes["费用"].find('group'),function(el) {
- var $ele = $(el);
- arr.push({
- "分类名称": $ele.find('type').text(),
- "费用金额":$ele.find('fee').text() ?parseFloat($ele.find('fee').text()).toFixed(2):'',
- "费用详情": (function() {
- var arr1 = [];
- _.each($ele.find('item'),function(it) {
- var $it = $(it);
- arr1.push({
- "项目名称": $it.find('value').text(),
- "总价": $it.find('total').text() ? parseFloat($it.find('total').text()).toFixed(2) : ''
- })
- })
- return arr1;
- })()
- })
- })
- fee_sum = _.reduce( _.pluck(arr, '费用金额'), function(a, b){ return a*1 + b*1; }, 0).toFixed(2);
- return arr;
- })(),
- "费用总计":fee_sum,
- }
- }
- }
- function dsXmlToJson0102_1(xmlStr) {
- var $xmlDom = $(xmlStr),
- fee_sum = '',//费用总计
- $nodes = {
- "费用" :$xmlDom
- } ;
- return {
- data:{
- "门诊分类": (function() {
- var arr = [];
- _.each($nodes["费用"].find('item'),function(it) {
- var $it = $(it);
- arr.push({
- "分类名称": $it.text(),
- "费用金额":$it.attr('total') ? parseFloat($it.attr('total')).toFixed(2):'',
- })
- })
- fee_sum = _.reduce( _.pluck(arr, '费用金额'), function(a, b){ return a*1 + b*1; }, 0).toFixed(2);
- return arr;
- })(),
- "费用总计":fee_sum,
- }
- }
- }
- </script>
|