You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
simple-yewu/frontend/views/gift/ajax-company-index.php

46 lines
1.7 KiB

<?php
use common\models\CarGiftT;
?>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table" style="table-layout: fixed;">
<?php
foreach($items as $item) {
?>
<tr>
<td width="200" height="25" class="bg_tr"><?=$item->name?></td>
<td height="25" class="td_bg">
<?php
$my_gifts = CarGiftT::find()
->where('order_id='.$order_id.' and strategy_id='.$item->id)
->all();
$tmp_ids = array();
foreach($my_gifts as $my_gift) {
$tmp_ids[] = $my_gift->gift_id;
}
$my_gift_total = count($tmp_ids);
for($i = 0; $i < $item->sel_count; $i++) {
echo '礼品: ';
echo '<select name="gifts[]">';
echo '<option value="0">请选择</option>';
$gift_items = $item->gifts;
$flag = false;
foreach($gift_items as $gift_item) {
echo '<option value="'.$item->id.'-'.$gift_item->id.'"';
for($j = 0; $j < $my_gift_total; $j++) {
if(!$flag && $tmp_ids[$j] == $gift_item->id) {
echo ' selected ';
$tmp_ids[$j] = '';
$flag = true;
}
}
echo '>'.$gift_item->name.'</option>';
}
echo '</select>';
}
?>
</td>
</tr>
<?php
}
?>
</table>