Browse Source

Merge branch 'rperform' of 39.97.239.116:gyfl/xyzshop into rtest

stanley-king 3 years ago
parent
commit
dd7ea39472
2 changed files with 105 additions and 16 deletions
  1. 8 1
      admin/control/merchant.php
  2. 97 15
      admin/templates/default/merchant.price.php

+ 8 - 1
admin/control/merchant.php

@@ -220,10 +220,12 @@ class merchantControl extends SystemControl
             $card_types = $_POST['cardtype'];
             $card_types = $_POST['cardtype'];
             $specs = $_POST['spec'];
             $specs = $_POST['spec'];
             $prices = $_POST['price'];
             $prices = $_POST['price'];
+            $extra_prices = $_POST['extra_price'];
             foreach ($card_types as $key => $card_type) {
             foreach ($card_types as $key => $card_type) {
                 $data['card_type'] = $card_type;
                 $data['card_type'] = $card_type;
                 $data['spec'] = intval($specs[$key]);
                 $data['spec'] = intval($specs[$key]);
                 $data['price'] = ncPriceFormat($prices[$key]);
                 $data['price'] = ncPriceFormat($prices[$key]);
+                $data['extra_price'] = ncPriceFormat($extra_prices[$key]);
                 $params[] = $data;
                 $params[] = $data;
             }
             }
 
 
@@ -232,6 +234,7 @@ class merchantControl extends SystemControl
                     $insert['mchid'] = $mchid;
                     $insert['mchid'] = $mchid;
                     $insert['spec'] = $param['spec'];
                     $insert['spec'] = $param['spec'];
                     $insert['price'] = $param['price'];
                     $insert['price'] = $param['price'];
+                    $insert['extra_price'] = $param['extra_price'];
                     $insert['card_types'] = $param['card_type'];
                     $insert['card_types'] = $param['card_type'];
                     $insert['quality'] = $quality;
                     $insert['quality'] = $quality;
                     $inserts[] = $insert;
                     $inserts[] = $insert;
@@ -376,7 +379,9 @@ class merchantControl extends SystemControl
                     $value['spec'] = intval($item['spec']);
                     $value['spec'] = intval($item['spec']);
                     $result["{$card_type}-{$value['spec']}"] = ['card_type' => $card_type,
                     $result["{$card_type}-{$value['spec']}"] = ['card_type' => $card_type,
                         'spec' => intval($item['spec']),
                         'spec' => intval($item['spec']),
-                        'price' => $item['price']];
+                        'price' => $item['price'],
+                        'extra_price' => $item['extra_price']
+                        ];
                 }
                 }
             }
             }
             return $result;
             return $result;
@@ -397,8 +402,10 @@ class merchantControl extends SystemControl
 
 
                 if (array_key_exists($cardtype_spec, $mech_specs)) {
                 if (array_key_exists($cardtype_spec, $mech_specs)) {
                     $data['price'] = $mech_specs[$cardtype_spec]['price'];
                     $data['price'] = $mech_specs[$cardtype_spec]['price'];
+                    $data['extra_price'] = $mech_specs[$cardtype_spec]['extra_price'];
                 } else {
                 } else {
                     $data['price'] = 0;
                     $data['price'] = 0;
+                    $data['extra_price'] = 0;
                 }
                 }
 
 
                 $result[$value['card_type']][] = $data;
                 $result[$value['card_type']][] = $data;

+ 97 - 15
admin/templates/default/merchant.price.php

@@ -128,10 +128,22 @@
                                     </div>
                                     </div>
                                 </div>
                                 </div>
                             </th>
                             </th>
+                            <th class="w150 align-center">
+                                附加费用
+                                <div class="batch" style="display: inline-block"><i class="icon-edit" title="批量操作"></i>
+                                    <div class="batch-input" style="display:none;">
+                                        <h6>批量设置费率(百分比):</h6>
+                                        <a href="javascript:void(0)" class="close">X</a>
+                                        <input name="" type="text" class="text price"/>
+                                        <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="extra_price">设置</a><span
+                                                class="arrow"></span>
+                                    </div>
+                                </div>
+                            </th>
                         </tr>
                         </tr>
 
 
                         <tbody class="tbody">
                         <tbody class="tbody">
-                        <?php foreach ($output['goods'][1] as $k => $v) { ?>
+                        <?php foreach ($output['goods'][mtopcard\PetroChinaCard] as $k => $v) { ?>
                                 <tr class="w500">
                                 <tr class="w500">
                                     <td class="w150 align-center">
                                     <td class="w150 align-center">
                                         <?php echo $v['goods_name']; ?>
                                         <?php echo $v['goods_name']; ?>
@@ -142,9 +154,13 @@
                                         <input type="hidden" class="num" name="spec[]" value="<?php echo $v['spec']; ?>">
                                         <input type="hidden" class="num" name="spec[]" value="<?php echo $v['spec']; ?>">
                                     </td>
                                     </td>
                                     <td class="w150 align-center tdVal">
                                     <td class="w150 align-center tdVal">
-                                        <input type="text" name="price[]" class="txt val"
+                                        <input type="text" name="price[]" class="txt price"
                                                value="<?php echo $v['price']; ?>">
                                                value="<?php echo $v['price']; ?>">
                                     </td>
                                     </td>
+                                    <td class="w150 align-center tdVals">
+                                        <input type="text" name="extra_price[]" class="txt extra_price"
+                                               value="<?php echo $v['extra_price']; ?>">
+                                    </td>
                                 </tr>
                                 </tr>
                         <?php } ?>
                         <?php } ?>
                         </tbody>
                         </tbody>
@@ -167,9 +183,21 @@
                                     </div>
                                     </div>
                                 </div>
                                 </div>
                             </th>
                             </th>
+                            <th class="w150 align-center">
+                                附加费用
+                                <div class="batch" style="display: inline-block"><i class="icon-edit" title="批量操作"></i>
+                                    <div class="batch-input" style="display:none;">
+                                        <h6>批量设置费率(百分比):</h6>
+                                        <a href="javascript:void(0)" class="close">X</a>
+                                        <input name="" type="text" class="text price"/>
+                                        <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="extra_price">设置</a><span
+                                                class="arrow"></span>
+                                    </div>
+                                </div>
+                            </th>
                         </tr>
                         </tr>
                         <tbody class="tbody">
                         <tbody class="tbody">
-                        <?php foreach ($output['goods'][2] as $k => $v) { ?>
+                        <?php foreach ($output['goods'][mtopcard\SinopecCard] as $k => $v) { ?>
                             <tr class="w500">
                             <tr class="w500">
                                 <td class="w150 align-center">
                                 <td class="w150 align-center">
                                     <?php echo $v['goods_name']; ?>
                                     <?php echo $v['goods_name']; ?>
@@ -180,9 +208,13 @@
                                     <input type="hidden" class="num" name="spec[]" value="<?php echo $v['spec']; ?>">
                                     <input type="hidden" class="num" name="spec[]" value="<?php echo $v['spec']; ?>">
                                 </td>
                                 </td>
                                 <td class="w150 align-center">
                                 <td class="w150 align-center">
-                                    <input type="text" name="price[]" class="txt val"
+                                    <input type="text" name="price[]" class="txt price"
                                            value="<?php echo $v['price']; ?>">
                                            value="<?php echo $v['price']; ?>">
                                 </td>
                                 </td>
+                                <td class="w150 align-center tdVals">
+                                    <input type="text" name="extra_price[]" class="txt extra_price"
+                                           value="<?php echo $v['extra_price']; ?>">
+                                </td>
                             </tr>
                             </tr>
                         <?php } ?>
                         <?php } ?>
                         </tbody>
                         </tbody>
@@ -207,9 +239,21 @@
                                     </div>
                                     </div>
                                 </div>
                                 </div>
                             </th>
                             </th>
+                            <th class="w150 align-center">
+                                附加费用
+                                <div class="batch" style="display: inline-block"><i class="icon-edit" title="批量操作"></i>
+                                    <div class="batch-input" style="display:none;">
+                                        <h6>批量设置费率(百分比):</h6>
+                                        <a href="javascript:void(0)" class="close">X</a>
+                                        <input name="" type="text" class="text price"/>
+                                        <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="extra_price">设置</a><span
+                                                class="arrow"></span>
+                                    </div>
+                                </div>
+                            </th>
                         </tr>
                         </tr>
                         <tbody class="tbody">
                         <tbody class="tbody">
-                        <?php foreach ($output['goods'][4] as $k => $v) { ?>
+                        <?php foreach ($output['goods'][mtopcard\ChinaMobileCard] as $k => $v) { ?>
                             <tr class="w500">
                             <tr class="w500">
                                 <td class="w150 align-center">
                                 <td class="w150 align-center">
                                     <?php echo $v['goods_name']; ?>
                                     <?php echo $v['goods_name']; ?>
@@ -220,9 +264,13 @@
                                     <input type="hidden" class="num" name="spec[]" value="<?php echo $v['spec']; ?>">
                                     <input type="hidden" class="num" name="spec[]" value="<?php echo $v['spec']; ?>">
                                 </td>
                                 </td>
                                 <td class="w150 align-center tdVal">
                                 <td class="w150 align-center tdVal">
-                                    <input type="text" name="price[]" class="txt val"
+                                    <input type="text" name="price[]" class="txt price"
                                            value="<?php echo $v['price']; ?>">
                                            value="<?php echo $v['price']; ?>">
                                 </td>
                                 </td>
+                                <td class="w150 align-center tdVals">
+                                    <input type="text" name="extra_price[]" class="txt extra_price"
+                                           value="<?php echo $v['extra_price']; ?>">
+                                </td>
                             </tr>
                             </tr>
                         <?php } ?>
                         <?php } ?>
                         </tbody>
                         </tbody>
@@ -245,9 +293,21 @@
                                     </div>
                                     </div>
                                 </div>
                                 </div>
                             </th>
                             </th>
+                            <th class="w150 align-center">
+                                附加费用
+                                <div class="batch" style="display: inline-block"><i class="icon-edit" title="批量操作"></i>
+                                    <div class="batch-input" style="display:none;">
+                                        <h6>批量设置费率(百分比):</h6>
+                                        <a href="javascript:void(0)" class="close">X</a>
+                                        <input name="" type="text" class="text price"/>
+                                        <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="extra_price">设置</a><span
+                                                class="arrow"></span>
+                                    </div>
+                                </div>
+                            </th>
                         </tr>
                         </tr>
                         <tbody class="tbody">
                         <tbody class="tbody">
-                        <?php foreach ($output['goods'][5] as $k => $v) { ?>
+                        <?php foreach ($output['goods'][mtopcard\ChinaUnicomCard] as $k => $v) { ?>
                             <tr class="w500">
                             <tr class="w500">
                                 <td class="w150 align-center">
                                 <td class="w150 align-center">
                                     <?php echo $v['goods_name']; ?>
                                     <?php echo $v['goods_name']; ?>
@@ -258,9 +318,13 @@
                                     <input type="hidden" class="num" name="spec[]" value="<?php echo $v['spec']; ?>">
                                     <input type="hidden" class="num" name="spec[]" value="<?php echo $v['spec']; ?>">
                                 </td>
                                 </td>
                                 <td class="w150 align-center tdVal">
                                 <td class="w150 align-center tdVal">
-                                    <input type="text" name="price[]" class="txt val"
+                                    <input type="text" name="price[]" class="txt price"
                                            value="<?php echo $v['price']; ?>">
                                            value="<?php echo $v['price']; ?>">
                                 </td>
                                 </td>
+                                <td class="w150 align-center tdVals">
+                                    <input type="text" name="extra_price[]" class="txt extra_price"
+                                           value="<?php echo $v['extra_price']; ?>">
+                                </td>
                             </tr>
                             </tr>
                         <?php } ?>
                         <?php } ?>
                         </tbody>
                         </tbody>
@@ -285,9 +349,21 @@
                                     </div>
                                     </div>
                                 </div>
                                 </div>
                             </th>
                             </th>
+                            <th class="w150 align-center">
+                                附加费用
+                                <div class="batch" style="display: inline-block"><i class="icon-edit" title="批量操作"></i>
+                                    <div class="batch-input" style="display:none;">
+                                        <h6>批量设置费率(百分比):</h6>
+                                        <a href="javascript:void(0)" class="close">X</a>
+                                        <input name="" type="text" class="text price"/>
+                                        <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="extra_price">设置</a><span
+                                                class="arrow"></span>
+                                    </div>
+                                </div>
+                            </th>
                         </tr>
                         </tr>
                         <tbody class="tbody">
                         <tbody class="tbody">
-                        <?php foreach ($output['goods'][6] as $k => $v) { ?>
+                        <?php foreach ($output['goods'][mtopcard\ChinaTelecomCard] as $k => $v) { ?>
                             <tr class="w500">
                             <tr class="w500">
                                 <td class="w150 align-center">
                                 <td class="w150 align-center">
                                     <?php echo $v['goods_name']; ?>
                                     <?php echo $v['goods_name']; ?>
@@ -298,9 +374,13 @@
                                     <input type="hidden" class="num" name="spec[]" value="<?php echo $v['spec']; ?>">
                                     <input type="hidden" class="num" name="spec[]" value="<?php echo $v['spec']; ?>">
                                 </td>
                                 </td>
                                 <td class="w150 align-center tdVal">
                                 <td class="w150 align-center tdVal">
-                                    <input type="text" name="price[]" class="txt val"
+                                    <input type="text" name="price[]" class="txt price"
                                            value="<?php echo $v['price']; ?>">
                                            value="<?php echo $v['price']; ?>">
                                 </td>
                                 </td>
+                                <td class="w150 align-center tdVals">
+                                    <input type="text" name="extra_price[]" class="txt extra_price"
+                                           value="<?php echo $v['extra_price']; ?>">
+                                </td>
                             </tr>
                             </tr>
                         <?php } ?>
                         <?php } ?>
                         </tbody>
                         </tbody>
@@ -371,7 +451,9 @@
         });
         });
         $('.batch-input > .ncsc-btn-mini').click(function () {
         $('.batch-input > .ncsc-btn-mini').click(function () {
             var _value = $(this).prev().val();
             var _value = $(this).prev().val();
-            // console.log('_value', _value)
+            var _type = $(this).attr('data-type');
+            _type = '.' + _type;
+            // console.log('_type', _type)
             var trs = $(this).parents('.setTable').children('.tbody').children()
             var trs = $(this).parents('.setTable').children('.tbody').children()
             var trsArr = []
             var trsArr = []
             trs.each(function () {
             trs.each(function () {
@@ -383,11 +465,11 @@
             var _valArr = []
             var _valArr = []
             if (_value && _value > 0 && _value <= 200) {
             if (_value && _value > 0 && _value <= 200) {
                 for (var i = 0; i < trsArr.length; i++) {
                 for (var i = 0; i < trsArr.length; i++) {
-                    _valArr[i] = (parseInt(trsArr[i]) / 100 * _value).toFixed(2)
+                    _valArr[i] = (parseInt(trsArr[i]) / 100 * _value).toFixed(3)
                 }
                 }
                 // console.log('_valArr', _valArr, trsArr)
                 // console.log('_valArr', _valArr, trsArr)
-                let vals =  $(this).parents('.setTable').children('.tbody').find('.val')
-                console.log('vals', vals)
+                let vals =  $(this).parents('.setTable').children('.tbody').find(_type)
+                // console.log('vals', vals)
                 for (let j= 0; j< vals.length;j++) {
                 for (let j= 0; j< vals.length;j++) {
                     // console.log('vals[j]', j, vals[j], _valArr[j])
                     // console.log('vals[j]', j, vals[j], _valArr[j])
                     vals[j].value = _valArr[j]
                     vals[j].value = _valArr[j]
@@ -398,7 +480,7 @@
                     _valArr[i] = 0
                     _valArr[i] = 0
                 }
                 }
                 // console.log('_valArr', _valArr, trsArr)
                 // console.log('_valArr', _valArr, trsArr)
-                let vals =  $(this).parents('.setTable').children('.tbody').find('.val')
+                let vals =  $(this).parents('.setTable').children('.tbody').find(_type)
                 console.log('vals', vals)
                 console.log('vals', vals)
                 for (let j= 0; j< vals.length;j++) {
                 for (let j= 0; j< vals.length;j++) {
                     // console.log('vals[j]', j, vals[j], _valArr[j])
                     // console.log('vals[j]', j, vals[j], _valArr[j])