<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                這一章主要講的是商品的購買功能還有實現商品的列表功能 我先把幾個頁面的代碼放上來吧 支付頁面shopddan.html: ~~~ <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <link rel="stylesheet" href="__INDEXSS__/css/shopddan.css"> <title></title> </head> <body> <div class="shopddan"> <footer class="footer"><a href="{:url('playshop?id=' . $shopdid->getData('id'))}" class="footergoum"><span class="shopspan">支付訂單¥{$shopjiag.jiage}</span></a></footer> </div> </body> </html> ~~~ 商品列表shoppta.html: ~~~ <!--平臺商品頁面--> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>平臺自營</title> <link rel="stylesheet" href="__INDEXSS__/css/shoppta.css"> <link rel="stylesheet" href="__ADMINS__/css/xadmin.css"> <script src="__ADMINS__/lib/layui/layui.js" charset="utf-8"></script> </head> <body> <div class="shophea"> <div class="shoptitle"> <img src="" /> </div> <div class="shopsou"> <button class="fanhui" type="submit">返回</button><input class="sousuo" type="text" name="" /><button type="submit" class="soubut">搜索</button> </div> <div class="filtrate_term"> <ul class="seul"> <!--<tr>--> <li class="onea"><a href="" name="list_sort_index">默認</a></li><li class="oneb"><a href="" name="list_sort_sales">銷量</a></li><li class="onec"><a href="" name="list_sort_price">價格</a></li><li class="oned"><a href="" name="list_sort_date">最新</a></li> <!--</tr>--> </ul> </div> <div class="jianxi"> </div> <div class="shoplie"> <table class="clearfixp_right"> {volist name="shopcx" id="shopzs" key="key"} <tr class="shopad"> <th> <div><a href="{:url('ptaishop?id=' . $shopzs->getData('id'))}" name="product_item" dd_name="商品"> <p class="img"><img class="imashop" src="__INDEXTP__/{$shopzs.imga}" alt="{$shopzs.title}" ></p> <p class="name" style="margin: 8px ;font-size: 18px;"><img width="80px" height="25px" src="__INDEXTP__/{$shopzs.paitaitb}">{$shopzs.title}</p></a><p class="price"><span class="reda" style="float: left;font-size: 15px;">¥{$shopzs.jiage}</span></p> </div> </th> </tr> {/volist} </table> </div> <div class="layui-card-body "> <div class="page"> <div> {$page} </div> </div> </div> <!--底部固定菜單欄--> <!--<footer class="footer">底部固定菜單</footer>--> </div> </body> </html> ~~~ 商品詳情ptaishop.html: ~~~ <!--平臺商品詳情--> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>商品詳情</title> <link rel="stylesheet" href="__INDEXSS__/css/ptaishop.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.3.3/css/swiper.min.css"> </head> <body> <div class="shophea"> <div class="xqimage"> <div class="swiper-wrapper"> <img class="swiper-slide" src="__INDEXTP__/{$shopzs.imga}" /> <img class="swiper-slide" src="__INDEXTP__/{$shopzs.imgb}" /> <img class="swiper-slide" src="__INDEXTP__/{$shopzs.imgc}" /> </div> </div> <div class="shoptitle"> <p style="font-size: 30px; margin:0px 0 0 0 ;"><img style="margin: 0px 0 0 0;" align="top" width="120px" height="40px" src="__INDEXTP__/{$shopzs.paitaitb}">{$shopzs.title}</p> </div> <div class="shopxxi"> <span style="color: #00FFFF;">商品銷量:{$shopzs.volume} &nbsp;&nbsp;商品庫存:{$shopzs.stock}</span> </div> <div class="shoppjia"> <span><img style="margin: 0px 0 0 0;" align="top" width="100%" height="100%" src="__INDEXTP__/{$shopzs.paitaitb}"></span> </div> <div class="shopxiaq"> <span>商品詳情</span> </div> <div class="jiange"> <span style="width: 100%;height: 100%;">{$shopzs.xiangqwz}</span> {volist name="shopimg" id="shopxqimg" key="key"} <img width="100%" height="100%" src="__INDEXTP__/{$shopxqimg.xqimage}" /> {/volist} </br> <p>-----到底了-----</p> </br> </br> </br> </br> </div> <div> </div> <footer class="footer"><a href="{:url('dindan?id=' . $shopzs->getData('id'))}" class="footergoum" style="font-size: 50px;">立即購買</a></footer> </div> </body> <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.3.3/js/swiper.min.js"></script> <script type="text/javascript"> var mySwiper = new Swiper('.xqimage',{ // direction: 'vertical', //上下滑動 // // loop設置為true。會在原本slide前后復制若干個slide(默認一個)并在合適的時候切換,讓Swiper看起來是循環的。 loop:true, // 使用分頁導航 pagination:{ el:'.daohanfy', clickable :true, }, // }); </script> </html> ~~~ 上面這幾個頁面也沒有什么新的技術涉及到的,也就一個footer標簽吧,主要是用在固定菜單欄上的 下面我把控制器類代碼放上來吧還有模型代碼 控制器shopgou.php: ~~~ <?php /** * Created by PhpStorm. * User: Administrator * Date: 2017/6/23 * Time: 18:54 */ namespace app\index\controller; use app\index\model\Shopxian; use think\Controller; use app\admin\model\Commodi; use think\Db; use app\index\model\Namex; use think\Request; use app\index\model\Danshop; use think\Session; class Shopgou extends Controller{ /** * @return mixed * @throws \think\exception\DbException商品列表頁面,加載6個數據 */ public function shoppta(){ $shopcx = Commodi::paginate(6); // 分頁變量 $page = $shopcx->render(); $this->assign('shopcx',$shopcx); $this->assign('page',$page); return $this->fetch('shoppta'); } /** * @param string $id * @return mixed * @throws \think\exception\DbException商品詳情頁面數據加載 */ public function ptaishop($id = ''){ $shopzs = Commodi::get($id); $time = $shopzs['addtime']; // 獲取詳情圖片 $shopimg = Db::name('shangpp')->where('shopid','=',$id)->where('atime','=',$time)->select(); $this->assign('shopzs',$shopzs); $this->assign('shopimg',$shopimg); return $this->fetch('ptaishop'); } /** * @param string $id * @return mixed|void * @throws \think\exception\DbException訂單支付頁面 */ public function dindan($id = ''){ if (!session('susername') || !session('spassword')){ return $this->error('未登錄',url('index/login/index')); }else { $ddinfo = Db::name('ddanshop'); $request = Request::instance(); $ids = $request->session('ids'); $info = Commodi::get($id); $shopid['ddanid'] = $id; $shopid['gerenid'] = $ids; //訂單狀態 $shopid['ddzt'] = 0; $shopid['shoptime'] = $info['addtime']; $shopxx = Db::name('shopsp')->where('id','=',$id)->find(); $shopxa = Db::name('shopsp')->where('id','=',$id)->value('imga'); $shopid['imga'] = $shopxa; $json = json_encode($shopxx); $shopid['goods'] = $json; $ddangr = $ddinfo->insert($shopid); $ddid = $ddinfo->getLastInsID(); $ddshop = Danshop::get($ddid); $this->assign('shopdid',$ddshop); $this->assign('shopjiag', $info); return $this->fetch('shopddan'); } } /** * @param string $id * @throws \think\exception\DbException訂單支付功能 */ public function playshop($id = ''){ if (!session('susername') || !session('spassword')){ return $this->error('未登錄',url('index/login/index')); }else { $ztinfo = Db::name('ddanshop'); $ddanid = $ztinfo->where('id','=',$id)->value('ddanid'); $info = Commodi::get($ddanid); $request = Request::instance(); $ids = $request->session('ids'); $geren = Namex::get($ids); $shopjg = $info['jiage']; $gerenjg = $geren['balance']; // dump ($id); if ($shopjg > $gerenjg) { $this->error('余額不足請充值'); } else { $gryue = $gerenjg - $shopjg; $grye['balance'] = $gryue; $ddzt['ddzt'] = 1; $shopid = $ztinfo->where('id','=',$id)->where('gerenid','=',$ids)->where('ddanid','=',$ddanid)->update($ddzt); $upye = Db::name('name')->where('id', '=', $ids)->update($grye); } if ($upye) { $this->redirect(url('index/index/index')); } else { $this->error($upye->getError()); } } } } ~~~ 模型類ddanshop.php: ~~~ <?php /** * Created by PhpStorm. * User: Administrator * Date: 2017/6/29 * Time: 16:12 */ namespace app\index\model; use think\Model; class Danshop extends Model{ protected $name = 'ddanshop'; } ~~~ 其他也是差不多的,并沒有太多改變;
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看