tp5 修改

       
    
                <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                    <thead>
                    <tr>

                        <th class="center">
                            <label>
                                <input type="checkbox" class="ace" />
                                <span class="lbl"></span>
                            </label>
                        </th>
                        <th>商品编号</th>
                        <th>商品名称</th>
                        <th>商品图片</th>
                        <th>所属分类</th>
                        <th>水果重量</th>
                        <th>水果库存</th>
                        <th>已销售量</th>
                        <th>产地</th>
                        <th>销售价</th>
                        <th>会员价</th>
                        <th>是否上架</th>
                        <th>是否参与活动</th>
                        <th>操作</th>
                    </tr>
                    </thead>

                    <tbody class="body">
                    {foreach name='data' item='v'}
                    <tr>
                        <td class="center">
                            <label>
                                <input type="checkbox" class ='box' name="box" alt="{$v.f_id}"/>
                                <span class="lbl"></span>
                            </label>
                        </td>


                        <td>{$v.f_id}</td>
                        <td>{$v.f_name}</td>
                        <td><img src="<?php echo $v['f_img'];?>" alt="" width="50"></td>
                        <td>{$v.t_name}</td>
                        <td>{$v.f_weight}</td>
                        <td>{$v.f_surplus}</td>
                        <td>{$v.f_sale}</td>
                        <td>{$v.f_place}</td>
                        <td>{$v.m_price}</td>
                        <td>{$v.v_price}</td>
                        <td>
                            {if condition="$v.is_show == 1"}
                             上架
                            {else /}
                         下架
                            {/if}
                        </td>
                        <td>
                            {if condition="$v.is_hot== 1"}
                             参与活动
                            {else /}
                         不参与活动
                            {/if}
                        </td>
                        <td>
                            <a href="{:url('index/Goods/modify')}?fid={$v.f_id}">编辑</a>
                            <button class="del" alt="{$v.f_id}">删除</button>
                        </td>

                    </tr>
                    {/foreach}



                    </tbody>
                </table>
                <center>
                <table >
                <div><div class="pages">{$page}</div>
                    <input type="button" class="quan" value="全选">
                    <input type="button" class="fan" value="反选">
                    <input type="button" class="pishan" value="批删">
                    <input type="text" class="pa" value="{$num}"></div>

                </table>
                </center>
            </div><!-- /.table-responsive -->
        </div><!-- /span -->
    </div><!-- /row -->

	//单条修改渲染
	public function modify(){
       $fid=$_GET['fid'];
		$res=db('sg_fruits')
			->join('sg_type','sg_fruits.t_id = sg_type.t_id')
			->where("f_id =$fid")
			->find();
//		$res=Db::table('sg_fruits')->where("f_id =$fid")->find();
		//分类
		$re= db('sg_type')->select();
		$this->view->engine->layout(true);
		$this->assign('data',$res);
		$this->assign('re',$re);
		return view('modify');

	}
	//接值修改
	public function upto(){
    $data=$_POST;
		$f_id=$data['f_id'];
		$file = request()->file('img');
		if($file){
			// 移动到框架应用根目录/public/uploads/ 目录下
			$info = $file->move(ROOT_PATH . 'public/uploads');

//			var_dump($info) ;die;

			if($info){
				// 成功上传后 获取上传信息
				$a=$info->getSaveName();
				$imgp= str_replace("\\","/",$a);
				$imgpath='uploads/'.$imgp;

				$data['f_img']= $imgpath;
				$resd=Db::table('sg_fruits')->where("f_id=$f_id")->update($data);
				if($resd){
					$this->redirect("goods/lists");
				}
}
			}else{
//根据商品id修改
					$res=Db::table('sg_fruits')->where("f_id=$f_id")->update($data);
			if($res){
				$this->redirect("goods/lists");
			}

		}

	}





  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值