songxingwei пре 2 година
родитељ
комит
16feb55b5d

+ 95 - 0
application/order/controller/SecondaryOrder.php

@@ -0,0 +1,95 @@
+<?php
+namespace app\order\controller;
+use library\Controller;
+use think\Db;
+/**
+ * 二级市场订单
+ * Class Order
+ * @package app\order\controller
+ */
+class SecondaryOrder extends Controller
+{
+    protected $table = 'store_order_info_order';
+    /**
+     * 订单列表
+     * @auth true
+     * @menu true
+     */
+    public function index()
+    {
+        $this->title = '订单管理';
+        $this->order_status = ['待支付','已支付','已取消'];
+        $order_stat = Db::table($this->table)
+            ->where('status',1)
+            ->field('pay_price')
+            ->select();
+        $this->order_num = empty($order_stat) ? 0: count($order_stat);
+        $this->total_money = empty($order_stat) ? 0: array_sum(array_column($order_stat,'pay_price'));
+        $query = $this->_query($this->table);
+        $where = [];
+        if($this->request->request('tel'))$where[]= ['u.phone','like','%'.$this->request->request('tel').'%'];
+        if($this->request->request('user_name'))$where[]= ['u.name','like','%'.$this->request->request('user_name').'%'];
+        if($this->request->request('order_no')) $where[]= ['o.order_no','like','%'.$this->request->request('order_no').'%'];
+        if($this->request->request('order_status') > -1) $where[]= ['o.status','=',$this->request->request('order_status')];
+        $query->alias('o')
+            ->field('o.* , u.name as user_name ,u.phone')
+            ->join('store_member u',' o.mid = u.id ','LEFT');
+        if(!empty($where)) $query->where($where);
+        $query ->order('o.id desc')->page();
+    }
+
+
+    /**
+     * 订单详情
+     * @auth true
+     * @menu true
+     */
+    public function detail()
+    {
+        $this->order_status = ['待支付','已支付','已取消'];
+        $this->title = '订单详情';
+        $order_id = input('id');
+        $detail = Db::table('store_order o')
+            ->field('o.* , u.name as user_name ,u.phone')
+            ->join('store_member u',' o.mid = u.id ','LEFT')
+            ->where('o.id',$order_id)
+            ->find();
+        $detail['pro_info'] = json_decode($detail['pro_info'],true);
+        $detail['pay_type'] = $detail['pay_type']=='wx' ? '微信' : '支付宝';
+        $this->assign('detail',$detail);
+        $this->fetch('detail');
+    }
+
+    /**
+     * 订单发货
+     * @auth true
+     * @menu true
+     */
+
+    public function deliver()
+    {
+        $this->title = '发货';
+        $this->express_company = Db::table('store_express_company')->field('id,express_title')->select();
+        $this->_form($this->table,'deliver');
+    }
+
+
+
+    /**
+     * 表单数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     */
+    protected function _form_filter(&$data)
+    {
+        if ($this->request->isPost() && $this->request->action() == 'deliver') {
+            $express_company =  Db::table('store_express_company')->field('id,express_title')->find($data['express_company_id']);
+            $data['express_company_title'] = $express_company['express_title'] ? $express_company['express_title'] : '';
+            $data['express_send_at'] = date("Y-m-d H:i:s");
+            $data['express_state'] = 1;
+        }
+    }
+
+
+}

+ 50 - 0
application/order/view/secondary_order/deliver.html

@@ -0,0 +1,50 @@
+<form onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body" style="height: 400px">
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">订单号</label>
+            <label class="layui-col-xs10">
+                <input name="order_no"  style="background-color: #e6e6e6" readonly value='{$vo.order_no|default=""}' placeholder="" class="layui-input">
+            </label>
+        </div>
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">快递公司</label>
+            <div class="layui-input-inline">
+                <select name="express_company_id" >
+                    {foreach $express_company as $ck=>$cv}
+                        {if $cv.id == $vo.express_company_id}
+                        <option selected value="{$cv.id}">{$cv.express_title}</option>
+                        {else}
+                        <option value="{$cv.id}">{$cv.express_title}</option>
+                        {/if}
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">物流单号</label>
+            <label class="layui-col-xs10">
+                <input name="express_send_no"  value='{$vo.express_send_no}' placeholder="请输入物流单号" class="layui-input">
+            </label>
+        </div>
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">发货时间</label>
+            <label class="layui-col-xs10">
+                <input readonly name="express_send_at"  value='{$vo.express_send_at|default=""}' placeholder="" class="layui-input">
+            </label>
+        </div>
+    </div>
+
+    <div class="hr-line-dashed"></div>
+    <div class="layui-form-item text-center">
+        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+        <input type='hidden' value='{$vo.uid}' name='uid'>
+        <button class="layui-btn" type='submit'>发货</button>
+    </div>
+</form>
+<script>
+    window.form.render();
+    $("#layui-layer-content").height(600)
+</script>

+ 91 - 0
application/order/view/secondary_order/detail.html

@@ -0,0 +1,91 @@
+<style>
+    .layui-card-body
+    {
+        height: 60%;
+    }
+</style>
+<div class="layui-card-body">
+    <div class="layui-form-item">
+        <label class="layui-form-label label-required">订单号</label>
+        <div class="layui-input-block">
+            <input  readonly  value='{$detail.order_no|default=""}' placeholder="" class="layui-input">
+        </div>
+    </div>
+
+    <div class="layui-form-item">
+        <label class="layui-form-label label-required">用户名</label>
+        <div class="layui-input-block">
+            <input  readonly  value='{$detail.user_name|default=""}' placeholder="" class="layui-input">
+        </div>
+    </div>
+    <div class="layui-form-item">
+        <label class="layui-form-label label-required">会员手机</label>
+        <div class="layui-input-block">
+            <input  readonly  value='{$detail.phone|default=""}' placeholder="" class="layui-input">
+        </div>
+    </div>
+    <div class="layui-form-item">
+        <label class="layui-form-label label-required">商品数</label>
+        <div class="layui-input-block">
+            <input readonly  value='{$detail.num|default=""}' placeholder="" class="layui-input">
+        </div>
+    </div>
+
+    <div class="layui-form-item">
+        <label class="layui-form-label label-required">藏品名称</label>
+        <div class="layui-input-block">
+            <input readonly  value='{$detail.pro_info.name|default=""}' placeholder="" class="layui-input">
+        </div>
+    </div>
+
+    <div class="layui-form-item">
+        <label class="layui-form-label label-required">商品封面</label>
+        <div class="layui-input-block">
+            <img  src="{$detail.pro_info.cover|default=''}" width="50px">
+        </div>
+    </div>
+
+
+    <div class="layui-form-item">
+        <label class="layui-form-label label-required">订单金额</label>
+        <div class="layui-input-block">
+            <input readonly  value='{$detail.pay_price|default=""}' placeholder="" class="layui-input">
+        </div>
+    </div>
+
+    <div class="layui-form-item">
+        <label class="layui-form-label label-required">支付方式</label>
+        <div class="layui-input-block">
+            <input readonly  value='{$detail.pay_type|default=""}' placeholder="" class="layui-input">
+        </div>
+    </div>
+
+
+    <div class="layui-form-item">
+        <label class="layui-form-label label-required">支付方式</label>
+        <div class="layui-input-block">
+            <input readonly  value="{$order_status[$detail.status]}{if $detail.status eq 2}({eq name='detail.cancel_state' value='1'}自动取消{/eq}{eq name='detail.cancel_state' value='2'}手动取消{/eq}){/if}" placeholder="" class="layui-input">
+        </div>
+    </div>
+
+    <div class="layui-form-item">
+        <label class="layui-form-label label-required">支付时间</label>
+        <div class="layui-input-block">
+            <input readonly  value='{$detail.pay_at|default=""}' placeholder="" class="layui-input">
+        </div>
+    </div>
+
+
+    <div class="layui-form-item">
+        <label class="layui-form-label label-required">创建时间</label>
+        <div class="layui-input-block">
+            <input readonly  value='{$detail.create_at|default=""}' placeholder="" class="layui-input">
+        </div>
+    </div>
+
+</div>
+
+<script>
+    window.form.render();
+
+</script>

+ 52 - 0
application/order/view/secondary_order/index.html

@@ -0,0 +1,52 @@
+{extend name='admin@main'}
+{block name="content"}
+<div class="think-box-shadow">
+    <div style="background-color: #e3e3c7 ;height: 50px;overflow: hidden">
+        <p style="line-height: 50px;font-size: 16px">&nbsp;&nbsp;
+            总支付单数:<span style='color:red'>{$order_num}</span> ,
+            总销售额:<span style='color:red'>{$total_money}</span>
+        </p>
+    </div>
+    {include file='goods_order/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'><input data-auto-none data-check-target='.list-check-box' type='checkbox'></th>
+            <th class='text-left nowrap'>用户名</th>
+            <th class='text-left nowrap'>手机号</th>
+            <th class='text-left nowrap'>订单金额</th>
+            <th class='text-left nowrap'>商品数量</th>
+            <th class='text-left nowrap'>订单号</th>
+            <th class='text-left nowrap'>订单状态</th>
+            <th class="text-left nowrap">支付方式</th>
+            <th class="text-left nowrap">下单时间</th>
+            <th class="text-left nowrap">支付时间</th>
+            <th class="text-left nowrap">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
+            <td class='text-left nowrap'>{$vo.user_name|default=''}</td>
+            <td class='text-left nowrap'>{$vo.phone|default=''}</td>
+            <td class='text-left nowrap'>{$vo.pay_price|default=''}</td>
+            <td class='text-left nowrap'>{$vo.num|default=''}</td>
+            <td class='text-left nowrap'>{$vo.order_no|default=''}</td>
+            <td class='text-left nowrap'>{$order_status[$vo.status]}{if $vo.status eq 2}({eq name='vo.cancel_state' value='1'}自动取消{/eq}{eq name='vo.cancel_state' value='2'}手动取消{/eq}){/if}</td>
+            <td class='text-left nowrap'>{eq name='vo.pay_type' value='wx'}微信{/eq}{eq name='vo.pay_type' value='zfb'}支付宝{/eq}</td>
+            <td class='text-left nowrap'>{$vo.create_at}</td>
+            <td class='text-left nowrap'>{$vo.pay_at}</td>
+
+            <td class='text-left nowrap'>
+                <a data-title="查看详情" class="layui-btn layui-btn-sm" data-modal='{:url("detail")}?id={$vo.id}'>查看详情</a>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+{/block}

+ 50 - 0
application/order/view/secondary_order/index_search.html

@@ -0,0 +1,50 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">订单号</label>
+            <div class="layui-input-inline">
+                <input name="order_no" value="{$Think.get.order_no|default=''}" placeholder="请输入订单号" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">手机号</label>
+            <div class="layui-input-inline">
+                <input name="tel" value="{$Think.get.tel|default=''}" placeholder="请输入手机号" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">用户名称</label>
+            <div class="layui-input-inline">
+                <input name="user_name" value="{$Think.get.user_name|default=''}" placeholder="请输入用户名称" class="layui-input">
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">订单状态</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="order_status">
+                    <option  value="-1">全部</option>
+                    {foreach $order_status as $k=>$v}
+                        {if $v}
+                            {if $Think.get.order_status eq $k}
+                            <option selected value="{$k}">{$v}</option>
+                            {else}
+                            <option  value="{$k}">{$v}</option>
+                            {/if}
+                        {/if}
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+
+
+
+
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>