moonsflyer 2 месяцев назад
Родитель
Сommit
943215ec88

+ 0 - 94
app/admin/controller/after_sale/AfterSale.php

@@ -1,94 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | likeshop开源商城系统
-// +----------------------------------------------------------------------
-// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
-// | gitee下载:https://gitee.com/likeshop_gitee
-// | github下载:https://github.com/likeshop-github
-// | 访问官网:https://www.likeshop.cn
-// | 访问社区:https://home.likeshop.cn
-// | 访问手册:http://doc.likeshop.cn
-// | 微信公众号:likeshop技术社区
-// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
-// |  likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
-// | 禁止对系统程序代码以任何目的,任何形式的再发布
-// | likeshop团队版权所有并拥有最终解释权
-// +----------------------------------------------------------------------
-// | author: likeshop.cn.team
-// +----------------------------------------------------------------------
-
-
-namespace app\admin\controller\after_sale;
-
-use app\common\basics\AdminBase;
-use app\common\server\JsonServer;
-use app\common\model\Freight;
-use app\common\model\after_sale\AfterSale as AfterSaleModel;
-use app\admin\logic\after_sale\AfterSaleLogic;
-use think\exception\ValidateException;
-
-/**
- * Class AfterSale
- * @package app\admin\controller\after_sale
- */
-class AfterSale extends AdminBase
-{
-    /**
-     * @notes 售后列表
-     * @return \think\response\Json|\think\response\View
-     * @author suny
-     * @date 2021/7/13 6:59 下午
-     */
-    public function lists()
-    {
-        if ($this->request->isAjax()) {
-            $get = $this->request->get();
-            return JsonServer::success('', AfterSaleLogic::list($get));
-        }
-        $data = AfterSaleLogic::list();
-        // 售后状态
-        $status = AfterSaleModel::getStatusDesc(true);
-        $status = AfterSaleLogic::getStatus($status);
-        $all = AfterSaleLogic::getAll();
-        return view('', [
-            'data' => $data,
-            'all' => $all,
-            'status' => $status
-        ]);
-    }
-
-    /**
-     * @notes 售后详情
-     * @return \think\response\View
-     * @author suny
-     * @date 2021/7/13 6:59 下午
-     */
-    public function detail()
-    {
-        $id = $this->request->get('id');
-        $detail = AfterSaleLogic::getDetail($id);
-        return view('', [
-            'detail' => $detail
-        ]);
-    }
-
-
-    /**
-     * @notes 导出Excel
-     * @return \think\response\Json
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @author 段誉
-     * @date 2022/4/24 10:20
-     */
-    public function export()
-    {
-        $params = $this->request->get();
-        $result = AfterSaleLogic::list($params, true);
-        if(false === $result) {
-            return JsonServer::error(AfterSaleLogic::getError() ?: '导出失败');
-        }
-        return JsonServer::success('', $result);
-    }
-}

+ 0 - 344
app/admin/logic/after_sale/AfterSaleLogic.php

@@ -1,344 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | likeshop开源商城系统
-// +----------------------------------------------------------------------
-// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
-// | gitee下载:https://gitee.com/likeshop_gitee
-// | github下载:https://github.com/likeshop-github
-// | 访问官网:https://www.likeshop.cn
-// | 访问社区:https://home.likeshop.cn
-// | 访问手册:http://doc.likeshop.cn
-// | 微信公众号:likeshop技术社区
-// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
-// |  likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
-// | 禁止对系统程序代码以任何目的,任何形式的再发布
-// | likeshop团队版权所有并拥有最终解释权
-// +----------------------------------------------------------------------
-// | author: likeshop.cn.team
-// +----------------------------------------------------------------------
-
-namespace app\admin\logic\after_sale;
-
-use app\common\basics\Logic;
-use app\common\enum\GoodsEnum;
-use app\common\enum\PayEnum;
-use app\common\model\after_sale\{AfterSale, AfterSaleLog};
-use app\common\enum\ShopEnum;
-use app\common\model\order\Order as OrderModel;
-use app\common\model\shop\Shop;
-use app\common\server\AreaServer;
-use app\common\server\ConfigServer;
-use app\common\server\ExportExcelServer;
-use app\common\server\UrlServer;
-use think\facade\Db;
-
-/**
- * 售后管理-逻辑
- * Class GoodsLogic
- * @package app\shop\logic\goods
- */
-class AfterSaleLogic extends Logic
-{
-
-    /**
-     * @notes 售后列表
-     * @param array $get
-     * @return array
-     * @author suny
-     * @date 2021/7/14 9:56 上午
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\db\exception\DataNotFoundException
-     */
-    public static function list($get = [], $is_export = false)
-    {
-
-        $after_sale = new AfterSale();
-        $where = [];
-        $page = '1';
-        $limit = '10';
-        $where[] = ['o.delete', '=', 0];
-        $where[] = ['a.del', '=', 0];
-        //售后状态
-        if (isset($get['type']) && $get['type'] != '') {
-            $where[] = ['a.status', '=', $get['type']];
-        }
-
-        //订单搜素
-        if (!empty($get['search_key']) && !empty($get['keyword'])) {
-            $keyword = $get['keyword'];
-            switch ($get['search_key']) {
-                case 'sn':
-                    $where[] = ['a.sn', 'like', '%' . $keyword . '%'];
-                    break;
-                case 'order_sn':
-                    $where[] = ['o.order_sn', 'like', '%' . $keyword . '%'];
-                    break;
-                case 'goods_name':
-                    $where[] = ['g.goods_name', 'like', '%' . $keyword . '%'];
-                    break;
-                case 'user_sn':
-                    $where[] = ['u.sn', 'like', '%' . $keyword . '%'];
-                    break;
-                case 'nickname':
-                    $where[] = ['u.nickname', 'like', '%' . $keyword . '%'];
-                    break;
-                case 'user_mobile':
-                    $where[] = ['u.mobile', 'like', '%' . $keyword . '%'];
-                    break;
-            }
-        }
-
-        if (isset($get['status']) && $get['status'] != '') {
-            $where[] = ['a.status', '=', $get['status']];
-        }
-
-        //下单时间
-        if (isset($get['start_time']) && $get['start_time'] != '') {
-            $where[] = ['a.create_time', '>=', strtotime($get['start_time'])];
-        }
-        if (isset($get['end_time']) && $get['end_time'] != '') {
-            $where[] = ['a.create_time', '<=', strtotime($get['end_time'])];
-        }
-
-        if (isset($get['page']) && $get['page'] != '') {
-            $page = $get['page'];
-        }
-
-        if (isset($get['limit']) && $get['limit'] != '') {
-            $limit = $get['limit'];
-        }
-
-        // 导出excel
-        if (true === $is_export) {
-            return self::export($where);
-        }
-
-        $field = 'a.id,a.sn,a.status,a.order_id,a.order_goods_id,
-        a.user_id,a.refund_type,a.create_time,a.refund_price,
-        o.order_status,o.shop_id,o.pay_way';
-
-        $count = $after_sale
-            ->alias('a')
-            ->join('order o', 'o.id = a.order_id')
-            ->join('user u', 'u.id = a.user_id')
-            ->join('order_goods g', 'g.id = a.order_goods_id')
-            ->join('shop s', 's.id = o.shop_id')
-            ->with(['order_goods', 'user', 'order', 'shop'])
-            ->where($where)
-            ->group('a.id')
-            ->count();
-
-        $lists = $after_sale
-            ->alias('a')
-            ->field($field)
-            ->join('order o', 'o.id = a.order_id')
-            ->join('user u', 'u.id = a.user_id')
-            ->join('order_goods g', 'g.id = a.order_goods_id')
-            ->join('shop s', 's.id = o.shop_id')
-            ->with(['order_goods', 'user', 'order', 'shop'])
-            ->where($where)
-            ->page($page, $limit)
-            ->order('a.id desc')
-            ->append(['user.base_avatar', 'order_goods.base_image'])
-            ->group('a.id')
-            ->select()->toArray();
-
-        foreach ($lists as &$list) {
-            $list['order']['pay_way'] = PayEnum::getPayWay($list['order']['pay_way']);
-            $list['order']['order_status'] = OrderModel::getOrderStatus($list['order']['order_status']);
-            $list['refund_type'] = AfterSale::getRefundTypeDesc($list['refund_type']);
-//            $list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
-            $list['status'] = AfterSale::getStatusDesc($list['status']);
-            $list['user']['avatar'] = UrlServer::getFileUrl($list['user']['avatar']);
-            $list['shop']['logo'] = UrlServer::getFileUrl($list['shop']['logo']);
-            foreach ($list['order_goods'] as &$good) {
-                $good['image'] = empty($good['spec_image']) ?
-                    UrlServer::getFileUrl($good['image']) : UrlServer::getFileUrl($good['spec_image']);
-            }
-        }
-        return ['count' => $count, 'lists' => $lists];
-    }
-
-    /**
-     * @notes 售后详情
-     * @param $id
-     * @return array
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @author suny
-     * @date 2021/7/14 9:56 上午
-     */
-    public static function getDetail($id)
-    {
-
-        $after_sale = new AfterSale();
-        $result = $after_sale
-            ->with(['order_goods', 'user', 'order', 'logs'])
-            ->where('id', $id)
-            ->find()->toArray();
-        $result['refund_type_text'] = AfterSale::getRefundTypeDesc($result['refund_type']);
-        $result['status_text'] = AfterSale::getStatusDesc($result['status']);
-        $result['order']['pay_way'] = PayEnum::getPayWay($result['order']['pay_way']);
-        $result['order']['order_status'] = OrderModel::getOrderStatus($result['order']['order_status']);
-
-        foreach ($result['order_goods'] as &$good) {
-            $good['image'] = empty($good['spec_image']) ?
-                UrlServer::getFileUrl($good['image']) : UrlServer::getFileUrl($good['spec_image']);
-        }
-
-        foreach ($result['logs'] as &$log) {
-
-            $log['log_img'] = '';
-            $log['log_remark'] = '';
-            switch ($log['channel']) {
-                //会员申请售后
-                case AfterSaleLog::USER_APPLY_REFUND:
-                    $log['log_img'] = empty($result['refund_image']) ? '' : UrlServer::getFileUrl($result['refund_image']);
-                    $refund_reason = empty($result['refund_reason']) ? '未知' : $result['refund_reason'];
-                    $refund_remark = empty($result['refund_remark']) ? '暂无' : $result['refund_remark'];
-                    $log['log_remark'] = '退款原因(' . $refund_reason . ')' . '退款说明(' . $refund_remark . ')';
-                    break;
-                //会员发快递
-                case AfterSaleLog::USER_SEND_EXPRESS:
-                    $log['log_img'] = empty($result['express_image']) ? '' : UrlServer::getFileUrl($result['express_image']);
-                    $express_name = $result['express_name'];
-                    $invoice_no = $result['invoice_no'];
-                    $express_remark = empty($result['express_remark']) ? '暂无' : $result['express_remark'];
-                    $log['log_remark'] = '快递公司(' . $express_name . ')' . '单号(' . $invoice_no . ')' . '备注说明(' . $express_remark . ')';
-                    break;
-                //商家拒绝退款 //商家拒绝收货
-                case AfterSaleLog::SHOP_REFUSE_REFUND:
-                case AfterSaleLog::SHOP_REFUSE_TAKE_GOODS:
-                    $admin_remark = empty($result['admin_remark']) ? '暂无' : $result['admin_remark'];
-                    $log['log_remark'] = '备注:' . $admin_remark;
-                    break;
-            }
-
-        }
-
-        $result['shop_address'] = self::getShopAddress();
-        return $result;
-    }
-
-    /**
-     * @notes 获取商家地址
-     * @return string
-     * @author suny
-     * @date 2021/7/14 9:57 上午
-     */
-    public static function getShopAddress()
-    {
-
-        $shop_province = ConfigServer::get('shop', 'province_id', '');
-        $shop_city = ConfigServer::get('shop', 'city_id', '');
-        $shop_district = ConfigServer::get('shop', 'district_id', '');
-        $shop_address = ConfigServer::get('shop', 'address', '');
-        $shop_contact = ConfigServer::get('shop', 'contact', '');
-        $shop_mobile = ConfigServer::get('shop', 'mobile', '');
-        if (empty($shop_province) || empty($shop_city) || empty($shop_district)) {
-            $arr = [];
-        } else {
-            $arr = [$shop_province, $shop_city, $shop_district];
-        }
-        $shop_address = AreaServer::getAddress($arr, $shop_address);
-        return $shop_address . '(' . $shop_contact . ',' . $shop_mobile . ')';
-    }
-
-    /**
-     * @notes 全部数量
-     * @return int
-     * @author suny
-     * @date 2021/7/14 9:57 上午
-     */
-    public static function getAll()
-    {
-        $where[] = ['o.delete', '=', 0];
-        $where[] = ['a.del', '=', 0];
-
-        return AfterSale::alias('a')
-            ->where($where)
-            ->join('order o', 'a.order_id = o.id')
-            ->count('a.id');
-    }
-
-    /**
-     * @notes 获取统计数量
-     * @param $status
-     * @return array
-     * @author suny
-     * @date 2021/7/14 9:57 上午
-     */
-    public static function getStatus($status)
-    {
-
-        foreach ($status as $key => $value) {
-            $count = AfterSale::alias('a')
-                ->join('order o', 'a.order_id = o.id')
-                ->where(['status' => $key, 'o.delete' => 0,'a.del'=>0])
-                ->count('a.id');
-            $data[] = $value . "(" . $count . ")";
-        }
-        return $data;
-    }
-
-
-
-    /**
-     * @notes 导出Excel
-     * @param array $condition
-     * @return array|false
-     * @author 段誉
-     * @date 2022/4/24 10:10
-     */
-    public static function export($condition = [])
-    {
-        try {
-            $field = 'a.sn,a.refund_type,a.refund_price,a.status,a.create_time,
-            u.nickname,o.order_sn,s.name as shop_name, s.type as shop_type';
-
-            $lists = (new AfterSale())
-                ->alias('a')
-                ->field($field)
-                ->join('order o', 'o.id = a.order_id')
-                ->join('user u', 'u.id = a.user_id')
-                ->join('order_goods g', 'g.id = a.order_goods_id')
-                ->join('shop s', 's.id = o.shop_id')
-                ->with(['order_goods', 'user', 'order'])
-                ->where($condition)
-                ->order('a.id desc')
-                ->group('a.id')
-                ->select()->toArray();
-
-            foreach ($lists as &$list) {
-                $list['refund_type'] = AfterSale::getRefundTypeDesc($list['refund_type']);
-                $list['status'] = AfterSale::getStatusDesc($list['status']);
-                $list['shop_type'] = ShopEnum::getShopTypeDesc($list['shop_type']);
-            }
-
-            $excelFields = [
-                'shop_name' => '商家名称',
-                'shop_type' => '商家类型',
-                'sn' => '售后单号',
-                'nickname' => '用户昵称',
-                'order_sn' => '订单编号',
-                'refund_type' => '售后方式',
-                'refund_price' => '售后金额',
-                'status' => '售后状态',
-                'create_time' => '申请时间',
-            ];
-
-            $export = new ExportExcelServer();
-            $export->setFileName('售后');
-            $result = $export->createExcel($excelFields, $lists);
-
-            return ['url' => $result];
-
-        } catch (\Exception $e) {
-            self::$error = $e->getMessage();
-            return false;
-        }
-    }
-}

+ 0 - 410
app/admin/view/after_sale/after_sale/detail.html

@@ -1,410 +0,0 @@
-{layout name="layout2" /}
-<style>
-    .div-flex {
-        display: flex;
-        align-items: center;
-        justify-content: left;
-    }
-    .width-160 {
-        width: 200px;
-    }
-    .layui-table th {
-        text-align: center;
-    }
-    .table-margin{
-        margin-left: 50px;
-        margin-right: 50px;
-        text-align: center;
-    }
-    .image{
-        height:80px;
-        width: 80px;
-    }
-
-    .mt50{
-        margin-left: 50px;
-    }
-
-</style>
-
-<div class="layui-card-body" >
-    <!--基本信息-->
-    <div class="layui-form" lay-filter="layuiadmin-form-after-sale" id="layuiadmin-form-after-sale" >
-        <input type="hidden" class="after_sale_id" name="after_sale_id" value="{$detail.id}">
-
-        <div class="layui-form-item">
-            <fieldset class="layui-elem-field layui-field-title">
-                <legend>售后信息</legend>
-            </fieldset>
-        </div>
-
-        <div class="layui-form-item div-flex">
-            <label class="layui-form-label ">售后单号:</label>
-            <div class="width-160">{$detail.sn}</div>
-            <label class="layui-form-label ">申请时间:</label>
-            <div class="width-160">{$detail.create_time}</div>
-            <label class="layui-form-label ">退款方式:</label>
-            <div class="width-160 refund_type_text">{$detail.refund_type_text}</div>
-        </div>
-
-        <div class="layui-form-item div-flex">
-            <label class="layui-form-label ">退款金额:</label>
-            <div class="width-160 refund_price_text">¥{$detail.refund_price}</div>
-            <label class="layui-form-label ">退款原因:</label>
-            <div class="width-160 ">{$detail.refund_reason}</div>
-            <label class="layui-form-label ">退款说明:</label>
-            <div class="width-160">{$detail.refund_remark}</div>
-        </div>
-
-        <div class="layui-form-item div-flex">
-            <label class="layui-form-label ">申请状态:</label>
-            <div class="width-160">{$detail.status_text}</div>
-            <label class="layui-form-label ">售后说明:</label>
-            <div class="width-160">{$detail.admin_remark}</div>
-        </div>
-
-        <div class="layui-form-item">
-            <fieldset class="layui-elem-field layui-field-title">
-                <legend>订单信息</legend>
-            </fieldset>
-        </div>
-
-        <div class="layui-form-item div-flex">
-            <label class="layui-form-label ">订单编号:</label>
-            <div class="width-160">{$detail.order.order_sn}</div>
-            <label class="layui-form-label ">订单金额:</label>
-            <div class="width-160">¥{$detail.order.order_amount}</div>
-            <label class="layui-form-label ">付款方式:</label>
-            <div class="width-160 pay_way_text">{$detail.order.pay_way}</div>
-        </div>
-
-        <div class="layui-form-item div-flex">
-            <label class="layui-form-label ">配送方式:</label>
-            <div class="width-160">{$detail.order.delivery_type_text}</div>
-            <label class="layui-form-label ">订单状态:</label>
-            <div class="width-160">{$detail.order.order_status}</div>
-        </div>
-
-        <div class="layui-form-item">
-            <fieldset class="layui-elem-field layui-field-title">
-                <legend>会员信息</legend>
-            </fieldset>
-        </div>
-
-        <div class="layui-form-item div-flex">
-            <label class="layui-form-label ">会员编号:</label>
-            <div class="width-160">{$detail.user.sn}</div>
-            <label class="layui-form-label ">会员昵称:</label>
-            <div class="width-160">{$detail.user.nickname}</div>
-            <label class="layui-form-label ">手机号码:</label>
-            <div class="width-160">{$detail.user.mobile}</div>
-        </div>
-
-        <div class="layui-form-item div-flex">
-            <label class="layui-form-label ">性别:</label>
-            <div class="width-160">{$detail.user.sex}</div>
-            <label class="layui-form-label ">注册时间:</label>
-            <div class="width-160">{$detail.user.create_time}</div>
-        </div>
-
-        <div class="layui-form-item">
-            <fieldset class="layui-elem-field layui-field-title">
-                <legend>退款商品</legend>
-            </fieldset>
-        </div>
-
-        <div class="layui-form-item table-margin">
-            <table class="layui-table">
-                <colgroup>
-                    <col width="250">
-                    <col width="100">
-                    <col width="100">
-                    <col width="100">
-                </colgroup>
-                <thead>
-                <tr>
-                    <th>商品信息</th>
-                    <th>价格(元)</th>
-                    <th>数量</th>
-                    <th>小计(元)</th>
-                </tr>
-                </thead>
-                <tbody>
-                {foreach $detail.order_goods as $k => $goods}
-                <tr>
-                    <td>
-                        <div style="text-align: left">
-                            <div class="layui-col-md3">
-                                <img src="{$goods.image}" class="image-show image" >
-                            </div>
-                            <div class="layui-col-md9">
-                                <p style="margin-top: 10px">{$goods.goods_name}</p>
-                                <br>
-                                <p>{$goods.spec_value}</p>
-                            </div>
-                        </div>
-                    </td>
-                    <td>¥{$goods.goods_price}</td>
-                    <td>{$goods.goods_num}</td>
-                    <td>{$goods.total_price}</td>
-                </tr>
-                {/foreach}
-                <tr>
-                    <td colspan="3"></td>
-                    <td style="text-align: left;">
-                        <div>退款金额:<span style="color: red">¥{$detail.refund_price}</span> </div>
-                    </td>
-                </tr>
-                </tbody>
-            </table>
-        </div>
-
-        {if condition = "$detail.status egt 3 && $detail.invoice_no neq null && $detail.refund_type eq 1"}
-        <div class="layui-form-item">
-            <fieldset class="layui-elem-field layui-field-title">
-                <legend>收货信息</legend>
-            </fieldset>
-        </div>
-
-        <div class="layui-form-item div-flex">
-            <label class="layui-form-label ">快递公司:</label>
-            <div class="width-160">{$detail.express_name}</div>
-            <label class="layui-form-label ">快递单号:</label>
-            <div class="width-160">{$detail.invoice_no}</div>
-            <label class="layui-form-label ">快递说明:</label>
-            <div class="width-160">{$detail.express_remark}</div>
-        </div>
-
-        <div class="layui-form-item div-flex">
-            <label class="layui-form-label ">退货地址:</label>
-            <div class="width-160 refund_address_text">{$detail.shop_address}</div>
-            <label class="layui-form-label ">入库方式:</label>
-            <div class="width-160"></div>
-            <label class="layui-form-label ">收货时间:</label>
-            <div class="width-160">{$detail.confirm_take_time}</div>
-        </div>
-        {/if}
-
-        <div class="layui-form-item">
-            <fieldset class="layui-elem-field layui-field-title">
-                <legend>售后操作</legend>
-                <br>
-                <div>温馨提醒</div>
-                <div>订单整体退款后,优惠券会退还给会员。</div>
-            </fieldset>
-        </div>
-        
-        <div class="layui-form-item">
-            <fieldset class="layui-elem-field layui-field-title">
-                <legend>售后日志</legend>
-            </fieldset>
-        </div>
-
-        <div class="layui-form-item div-flex">
-            <div class="layui-input-block ">
-            <ul class="layui-timeline">
-                {volist name="$detail.logs" id="vo"}
-                <li class="layui-timeline-item">
-                    <i class="layui-icon layui-timeline-axis"></i>
-                    <div class="layui-timeline-content layui-text">
-                        <h3 class="layui-timeline-title">{$vo.content}({$vo.create_time})</h3>
-                        <!--日志备注-->
-                        {notempty name="$vo.log_remark"}
-                        <h4>{$vo.log_remark}</h4>
-                        {/notempty}
-                        <!--日志图片-->
-                        {notempty name="$vo.log_img"}
-                            <img src="{$vo.log_img}" alt="" width="80" height="80" class="image-show">
-                        {/notempty}
-                    </div>
-                </li>
-                {/volist}
-            </ul>
-            </div>
-        </div>
-
-    </div>
-</div>
-
-
-<script type="text/javascript">
-    //注意:选项卡 依赖 element 模块,否则无法进行功能性操作
-
-    layui.config({
-        version:"{$front_version}",
-        base: '/static/plug/layui-admin/dist/layuiadmin/' //静态资源所在路径
-    }).extend({
-        index: 'lib/index' //主入口模块
-    }).use(['index', 'element', 'jquery', 'like'], function () {
-        var $ = layui.$;
-        var like = layui.like;
-
-        //主图放大
-        $(document).on('click', '.image-show', function () {
-            var src = $(this).attr('src');
-            like.showImg(src,400);
-        });
-
-        var id = $('.after_sale_id').val();
-        var pay_way = $('.pay_way_text').text();
-        var refund_type = $('.refund_type_text').text();
-        var refund_price = $('.refund_price_text').text();
-        var refund_address = $('.refund_address_text').text();
-
-        //商家同意
-        $('#agree').click(function () {
-            layer.confirm(
-                "提示:该笔订单通过" + pay_way + "付款,商家同意后,退款将自动原路退回会员账户。"+"<br/>"+
-                "退款方式:"+ refund_type + "<br/>"+
-                "退款金额:"+ "<span style='color: red'>"+refund_price+"</span>", {
-                btn: ['确认','取消'] //按钮
-            }, function(){
-                like.ajax({
-                    url: '{:url("after_sale/agree")}'
-                    , data: {'id': id}
-                    , type: 'post'
-                    , success: function (res) {
-                        if (res.code == 1) {
-                            layui.layer.msg(res.msg, {
-                                offset: '15px'
-                                , icon: 1
-                                , time: 1000
-                            },function () {
-                                location.reload();
-                            });
-                        }
-                    }
-                });
-            });
-        });
-
-        //商家拒绝
-        $('#refuse').click(function () {
-            layer.confirm(
-                "提示:请与会员协商后确认拒绝申请,会员可再次发起退款。"+"<br/>"+
-                "退款方式:"+ refund_type + "<br/>"+
-                "退款金额:"+ "<span style='color: red'>"+refund_price+"</span>"+ "<br/>"+
-                "拒绝原因:"+"<textarea id='remark' name='remark' class='layui-textarea' type='text' style='height:100px'></textarea>", {
-                    btn: ['确认','取消'] //按钮
-                }, function(){
-                    var remark = $('#remark').val();
-                    if (remark == null || remark == undefined || remark == ''){
-                        layer.msg('请填写拒绝原因!');
-                        return false;
-                    }
-                    like.ajax({
-                        url: '{:url("after_sale/refuse")}'
-                        , data: {'id': id,'remark':remark}
-                        , type: 'post'
-                        , success: function (res) {
-                            if (res.code == 1) {
-                                layui.layer.msg(res.msg, {
-                                    offset: '15px'
-                                    , icon: 1
-                                    , time: 1000
-                                },function () {
-                                    location.reload();
-                                });
-                            }
-                        }
-                    });
-                    return false;
-                });
-        });
-
-
-        //商家收货
-        $('#take_goods').click(function () {
-            layer.confirm(
-                "提示:该笔订单通过" + pay_way + "付款,商家同意后,退款将自动原路退回会员账户。"+"<br/>"+
-                "退款方式:"+ refund_type + "<br/>"+
-                "退款金额:"+ "<span style='color: red'>"+refund_price+"</span>"+ "<br/>"+
-                "退货地址:"+ refund_address, {
-                    btn: ['确认','取消'] //按钮
-                }, function(){
-                    like.ajax({
-                        url: '{:url("after_sale/take")}'
-                        , data: {'id': id}
-                        , type: 'post'
-                        , success: function (res) {
-                            if (res.code == 1) {
-                                layui.layer.msg(res.msg, {
-                                    offset: '15px'
-                                    , icon: 1
-                                    , time: 1000
-                                },function () {
-                                    location.reload();
-                                });
-                            }
-                        }
-                    });
-                });
-        });
-
-
-
-        //商家拒绝收货
-        $('#refuse_goods').click(function () {
-            layer.confirm(
-                "提示:请与会员协商后确认拒绝申请,会员可再次发起退款。"+"<br/>"+
-                "退款方式:"+ refund_type + "<br/>"+
-                "退款金额:"+ "<span style='color: red'>"+refund_price+"</span>"+ "<br/>"+
-                "拒绝原因:"+"<textarea id='remark' name='remark' class='layui-textarea' type='text' style='height:100px'></textarea>", {
-                    btn: ['确认','取消'] //按钮
-                }, function(){
-                    var remark = $('#remark').val();
-                    if (remark == null || remark == undefined || remark == ''){
-                        layer.msg('请填写拒绝原因!');
-                        return false;
-                    }
-                    like.ajax({
-                        url: '{:url("after_sale/refuseGoods")}'
-                        , data: {'id': id,'remark':remark}
-                        , type: 'post'
-                        , success: function (res) {
-                            if (res.code == 1) {
-                                layui.layer.msg(res.msg, {
-                                    offset: '15px'
-                                    , icon: 1
-                                    , time: 1000
-                                },function () {
-                                    location.reload();
-                                });
-                            }
-                        }
-                    });
-                    return false;
-                });
-        });
-
-
-
-        //确认退款
-        $('#confirm').click(function () {
-            layer.confirm(
-                "提示:该笔订单通过" + pay_way + "付款,商家确认退款后,退款将自动原路退回会员账户。"+"<br/>"+
-                "退款方式:"+ refund_type + "<br/>"+
-                "退款金额:"+ "<span style='color: red'>"+refund_price+"</span>",  {
-                    btn: ['确认','取消'] //按钮
-                }, function(){
-                    like.ajax({
-                        url: '{:url("after_sale/confirm")}'
-                        , data: {'id': id}
-                        , type: 'post'
-                        , success: function (res) {
-                            if (res.code == 1) {
-                                layui.layer.msg(res.msg, {
-                                    offset: '15px'
-                                    , icon: 1
-                                    , time: 1000
-                                },function () {
-                                    location.reload();
-                                });
-                            }
-                        }
-                    });
-                });
-        });
-
-    });
-</script>

+ 0 - 369
app/admin/view/after_sale/after_sale/lists.html

@@ -1,369 +0,0 @@
-{layout name="layout1" /}
-<style>
-    .layui-table-cell {
-        height:auto;
-    }
-    .goods-content>div:not(:last-of-type) {
-        border-bottom:1px solid #DCDCDC;
-    }
-    .goods-data::after{
-        display: block;
-        content: '';
-        clear: both;
-    }
-    .goods_name_hide{
-        overflow:hidden;
-        white-space:nowrap;
-        text-overflow: ellipsis;
-    }
-    .operation-btn {
-        margin: 5px;
-    }
-    .table-operate{
-        text-align: left;
-        font-size:14px;
-        padding:0 5px;
-        height:auto;
-        overflow:visible;
-        text-overflow:inherit;
-        white-space:normal;
-        word-break: break-all;
-    }
-</style>
-
-<div class="wrapper">
-    <div class="layui-card">
-        <div class="layui-card-body">
-            <div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4">
-                <div class="layui-colla-item">
-                    <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2>
-                    <div class="layui-colla-content layui-show">
-                        <p>*会员提交的售后退款订单列表。</p>
-                        <p>*订单状态处于待收货,已完成(在售后退款时效内)时,会员可提交售后退款。</p>
-                        <p>*退货退款售后申请店铺需要确认收货后才能退款。</p>
-                        <p>*店铺同意退款后处于等待退款状态,由平台会自动进行原路退款操作。</p>
-                    </div>
-                </div>
-            </div>
-        </div>
-        <div class="layui-tab layui-tab-card" lay-filter="tab-all">
-
-            <ul class="layui-tab-title">
-                <li data-type='' class="layui-this">全部({$all})</li>
-                {foreach $status as $item => $val}
-                <li data-type="{$item}">{$val}</li>
-                {/foreach}
-            </ul>
-            <div class="layui-card-body layui-form">
-                <div class="layui-form-item">
-                    <div class="layui-row">
-                        <div class="layui-inline">
-                            <label class="layui-form-label">售后搜索:</label>
-                            <div class="layui-input-block">
-                                <select name="search_key" id="search_key">
-                                    <option value="sn">售后单号</option>
-                                    <option value="order_sn">订单编号</option>
-                                    <option value="goods_name">商品名称</option>
-                                    <option value="user_sn">会员编号</option>
-                                    <option value="nickname">会员昵称</option>
-                                    <option value="user_mobile">手机号码</option>
-                                </select>
-                            </div>
-                        </div>
-
-                        <div class="layui-inline">
-                            <input type="text" name="keyword" id="keyword" placeholder="请输入搜索内容"
-                                   autocomplete="off" class="layui-input">
-                        </div>
-
-
-                        <div class="layui-inline status">
-                            <label class="layui-form-label">申请状态:</label>
-                            <div class="layui-input-block">
-                                <select name="status" id="status">
-                                    <option value="">全部</option>
-                                    {foreach $status as $item => $val}
-                                    <option value="{$item}">{$val}</option>
-                                    {/foreach}
-                                </select>
-                            </div>
-                        </div>
-                    </div>
-                    <div class="layui-row">
-                        <div class="layui-inline">
-                            <label class="layui-form-label">申请时间:</label>
-                            <div class="layui-input-inline">
-                                <div class="layui-input-inline">
-                                    <input type="text" name="start_time" class="layui-input" id="start_time"
-                                           placeholder="" autocomplete="off">
-                                </div>
-                            </div>
-                            <div class="layui-input-inline" style="margin-right: 5px;width: 20px;">
-                                <label class="layui-form-mid">至</label>
-                            </div>
-                            <div class="layui-input-inline">
-                                <input type="text" name="end_time" class="layui-input" id="end_time"
-                                       placeholder="" autocomplete="off">
-                            </div>
-                        </div>
-
-                        <div class="layui-inline">
-                            <button class="layui-btn layui-btn-sm layuiadmin-btn-ad {$view_theme_color}" lay-submit
-                                    lay-filter="after-sale-search">查询
-                            </button>
-                            <button class="layui-btn layui-btn-sm layuiadmin-btn-ad layui-btn-primary " lay-submit
-                                    lay-filter="after-sale-clear-search">清空查询
-                            </button>
-                            <button class="layui-btn layui-btn-sm layuiadmin-btn-ad layui-btn-primary " lay-submit
-                                    lay-filter="data-export">导出
-                            </button>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            <div class="layui-tab-item layui-show">
-                <div class="layui-card">
-
-                    <div class="layui-card-body">
-                        <table id="after-sale-lists" lay-filter="after-sale-lists"></table>
-
-                        <script type="text/html" id="after-sale-operation">
-                            <div style="text-align: left;margin-left: 10px">
-                                <a class="layui-btn layui-btn-primary layui-btn-sm" lay-event="detail">售后详情</a>
-                            </div>
-                        </script>
-
-                        <script type="text/html" id="image">
-                            <img src="{{d.image}}" style="height:80px;width: 80px" class="image-show">
-                        </script>
-
-                        <!--商家信息-->
-                        <script type="text/html" id="shop">
-                            <img src="{{d.shop.logo}}" style="height:80px;width: 80px" class="image-show">
-                            <div style="text-align: left" class="layui-input-inline">
-                                <p>商家编号:{{d.shop.id}}</p>
-                                <p>商家名称:{{d.shop.name}}</p>
-                                <p>商家类型:{{d.shop.type_desc}}</p>
-                            </div>
-                        </script>
-                        <!--订单信息-->
-                        <script type="text/html" id="order">
-                            <div style="text-align: left">
-                                <p>订单编号:{{d.order.order_sn}}</p>
-                                <p>订单金额:{{d.order.total_amount}}</p>
-                                <p>付款方式:{{d.order.pay_way}}</p>
-                                <p>订单状态:{{d.order.order_status}}</p>
-                            </div>
-                        </script>
-
-                        <!--会员信息-->
-                        <script type="text/html" id="user">
-                            <img src="{{d.user.avatar}}" style="height:80px;width: 80px" class="image-show">
-                            <div class="layui-input-inline"  style="text-align: left">
-                                <p>会员编号:{{d.user.sn}}</p>
-                                <p>昵称:{{d.user.nickname}}</p>
-                            </div>
-                        </script>
-
-                        <!--商品信息-->
-                        <script type="text/html" id="goods">
-                            <div class="goods-content">
-                                {{#  layui.each(d.order_goods, function(index, item){ }}
-                                <div style="text-align: left;" class="goods-info">
-                                    <img src="{{ item.image }}" style="height:80px;width: 80px" class="image-show layui-col-md4">
-                                    <div class="layui-input-inline layui-col-md8">
-                                        <span class="layui-col-md7 goods_name_hide">{{ item.goods_name }}</span>
-                                        <span class="layui-col-md5">¥{{ item.goods_price }}</span>
-                                        <br>
-                                        <span class="layui-col-md7 goods_name_hide">{{ item.spec_value }}</span>
-                                        <span class="layui-col-md5">{{ item.goods_num }}件</span>
-                                    </div>
-                                </div>
-                                {{#  }); }}
-                            </div>
-                        </script>
-
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-</div>
-<script>
-    layui.config({
-        version:"{$front_version}",
-        base: '/static/lib/' //静态资源所在路径
-    }).use(['form'], function(){
-        var $ = layui.$
-            , form = layui.form
-            , table = layui.table
-            , element = layui.element
-            , laydate = layui.laydate;
-
-        //图片放大
-        $(document).on('click', '.image-show', function () {
-            var src = $(this).attr('src');
-            like.showImg(src,400);
-        });
-
-        //监听搜索
-        form.on('submit(after-sale-search)', function (data) {
-            var field = data.field;
-            //执行重载
-            table.reload('after-sale-lists', {
-                where: field,
-                page: {
-                    curr: 1
-                }
-            });
-        });
-        //清空查询
-        form.on('submit(after-sale-clear-search)', function () {
-            $('#keyword').val('');
-            $('#order_status').val('');
-            $('#goods_name').val('');
-            $('#pay_way').val('');
-            $('#order_type').val('');
-            $('#order_source').val('');
-            $('#start_time').val('');
-            $('#end_time').val('');
-            $('#delivery_type').val('');
-            $('#status').val('');
-            form.render('select');
-            //刷新列表
-            table.reload('after-sale-lists', {
-                where: [],
-                page: {
-                    curr: 1
-                }
-            });
-        });
-
-
-        // 导出
-        form.on('submit(data-export)', function (data) {
-            var field = data.field;
-            like.ajax({
-                url: '{:url("after_sale.after_sale/export")}'
-                , data: field
-                , type: 'get'
-                , success: function (res) {
-                    if (res.code == 1) {
-                        window.location.href = res.data.url;
-                    }
-                }
-            });
-        });
-
-        //日期时间范围
-        laydate.render({
-            elem: '#start_time'
-            ,type: 'datetime'
-            ,trigger: 'click'
-            ,done: function (value, date, endDate) {
-                var startDate = new Date(value).getTime();
-                var endTime = new Date($('#end_time').val()).getTime();
-                if (endTime < startDate) {
-                    layer.msg('结束时间不能小于开始时间');
-                    $('#start_time').val($('#end_time').val());
-                }
-            }
-        });
-
-
-        laydate.render({
-            elem: '#end_time'
-            ,type: 'datetime'
-            ,trigger: 'click'
-            ,done: function (value, date, endDate) {
-                var startDate = new Date($('#start_time').val()).getTime();
-                var endTime = new Date(value).getTime();
-                console.log(startDate);
-                if (endTime < startDate) {
-                    layer.msg('结束时间不能小于开始时间');
-                    $('#end_time').val($('#start_time').val());
-                }
-            }
-        });
-
-        //获取列表
-        getList('');
-        //切换列表
-        element.on('tab(tab-all)', function (data) {
-            $('#keyword').val('');
-            $('#order_status').val('');
-            $('#goods_name').val('');
-            $('#pay_way').val('');
-            $('#order_type').val('');
-            $('#start_time').val('');
-            $('#end_time').val('');
-            $('#delivery_type').val('');
-            $('#status').val('');
-            form.render('select');
-            var type = $(this).attr('data-type');
-            getList(type);
-            if (type !== ''){
-                $('.order_status').hide();
-            }else {
-                $('.order_status').show();
-            }
-        });
-
-        function getList(type) {
-            table.render({
-                elem: '#after-sale-lists'
-                , url: '{:url("after_sale.after_sale/lists")}?type=' + type
-                , cols: [[
-                    {field:'id',title: 'id',width:60,align: 'center'}
-                    , {field: 'shop', title: '商家信息', align: 'center',templet:'#shop',width:230}
-                    , {field: 'sn', title: '售后单号', align: 'center',width:160}
-                    , {field: 'order', title: '订单信息', align: 'center',templet:'#order',width:230}
-                    , {field: 'user', title: '会员信息', templet:'#user',width:300}
-                    , {field: 'order_goods', title: '退款商品', align: 'center',templet:'#goods',width:300}
-                    , {field: 'refund_type', title: '退款方式', align: 'center',width:100}
-                    , {field: 'refund_price', title: '退款金额', align: 'center',width:100}
-                    , {field: 'status', title: '售后状态', align: 'center',width:100}
-                    , {field: 'create_time', title: '申请时间', align: 'center',width:100}
-                    , {fixed: 'right', title: '操作', width: 300, align: 'center', toolbar: '#after-sale-operation'}
-                ]]
-                , page: true
-                , text: {none: '暂无数据!'}
-                ,response: {
-                    statusCode: 1
-                }
-                , parseData: function (res) {
-                    return {
-                        "code": res.code,
-                        "msg": res.msg,
-                        "count": res.data.count,
-                        "data": res.data.lists,
-                    };
-                }
-                ,done: function(res, curr, count){
-                    // 解决操作栏因为内容过多换行问题
-                    $(".layui-table-main tr").each(function (index, val) {
-                        $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
-                        $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
-                    });
-                }
-            });
-        }
-        //监听工具条
-        table.on('tool(after-sale-lists)', function (obj) {
-            var id = obj.data.id;
-            if(obj.event === 'detail'){
-                layer.open({
-                    type: 2
-                    ,title: '售后详情'
-                    ,content: '{:url("after_sale.after_sale/detail")}?id='+id
-                    ,area: ['90%', '90%']
-                    ,btn: ['返回']
-                    ,yes: function(index, layero){
-                        layer.close(index);
-                        table.reload('after-sale-lists'); //数据刷新
-                    }
-                })
-            }
-        });
-    });
-</script>