liche update for admin order purchase manger
This commit is contained in:
@@ -63,6 +63,18 @@ class Main extends HD_Controller
|
||||
//array('name' => '查看详情', 'url' => '/sys/company?app_id=' . $this->app_id),
|
||||
),
|
||||
);
|
||||
|
||||
//消费订单
|
||||
$this->load->model('apporder/order_purchase_model');
|
||||
$value = $this->order_purchase_model->count(array('app_id' => $this->app_id));
|
||||
$list[] = array(
|
||||
'title' => '消费订单(笔)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/order/purchase?app_id=' . $this->app_id),
|
||||
),
|
||||
);
|
||||
|
||||
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
|
||||
/*小程序设置 end*/
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* Notes:订单管理
|
||||
* Created on: 2019/12/12 13:46
|
||||
* Created by: dengbw
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
Class Purchase extends HD_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('app/app_model');
|
||||
$this->load->model('apporder/order_purchase_model');
|
||||
|
||||
$this->load->service('apporder/order_service');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return $this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
|
||||
$searchAry = array(
|
||||
'sid' => '订单号',
|
||||
'uname' => '买家姓名',
|
||||
'mobile' => '买家手机号',
|
||||
'item_title' => '标题',
|
||||
'app_uid' => '用户ID'
|
||||
);
|
||||
|
||||
$statusAry = $this->order_service->statusAry();
|
||||
$statusDAry = $this->order_service->statusDetailAry();
|
||||
$paywayAry = $this->order_service->paywayAry();
|
||||
|
||||
$where = array('app_id' => $params['app_id']);
|
||||
|
||||
if($params['search_v']){
|
||||
switch($params['search_k']){
|
||||
case 'uname':
|
||||
case 'mobile':
|
||||
case 'item_title':
|
||||
$where["{$params['search_k']} like '%{$params['search_v']}%'"] = null;
|
||||
break;
|
||||
default:
|
||||
$where[$params['search_k']] = $params['search_v'];
|
||||
}
|
||||
}
|
||||
!$params['search_k'] && $params['search_k'] = 'sid';
|
||||
|
||||
if($params['status']){
|
||||
$where['status'] = $params['status'];
|
||||
} else {
|
||||
$params['status'] = '';
|
||||
}
|
||||
|
||||
if($params['status_detail']){
|
||||
$where['status_detail'] = $params['status_detail'];
|
||||
} else{
|
||||
$params['status_detail'] = '';
|
||||
}
|
||||
|
||||
if ($params['time']) {
|
||||
$time = explode(' ~ ', $params['time']);
|
||||
$time[0] && $where["c_time >="] = strtotime($time[0] . ' 00:00:00');
|
||||
$time[1] && $where["c_time <="] = strtotime($time[1] . ' 23:59:59');
|
||||
}
|
||||
|
||||
if (strlen($params['payway']) > 0) {
|
||||
$where['payway'] = $params['payway'];
|
||||
} else {
|
||||
$params['payway'] = '';
|
||||
}
|
||||
|
||||
$total = $this->order_purchase_model->count($where);
|
||||
|
||||
$lists = array();
|
||||
if($total){
|
||||
$orderby = 'id desc';
|
||||
$select = 'id,sid,item_title,item_num,item_price,total_price,pay_price,
|
||||
uname,mobile,payway,status,status_detail,c_time';
|
||||
$rows = $this->order_purchase_model->select($where, $orderby, $params['page'], $params['size'], $select);
|
||||
foreach($rows as $v){
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'sid' => $v['sid'],
|
||||
'uname' => $v['uname'],
|
||||
'mobile' => $v['mobile'],
|
||||
'title' => $v['item_title'],
|
||||
'c_time' => date('Y-m-d H:i:s', $v['c_time']),
|
||||
'item_price_name' => "¥{$v['item_price']}*{$v['item_num']}",
|
||||
'pay_price_name' => "¥{$v['pay_price']}",
|
||||
'status_name' => $statusDAry[$v['status']][$v['status_detail']],
|
||||
'payway_name' => $paywayAry[$v['payway']],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['_title'] = '消费订单管理';
|
||||
$this->data['searchAry'] = $searchAry;
|
||||
$this->data['statusAry'] = $statusAry;
|
||||
$this->data['statusDAry'] = $statusDAry;
|
||||
$this->data['paywayAry'] = $paywayAry;
|
||||
$this->data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total);
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
return $this->show_view('/order/purchase/lists', true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
// TODO: Implement get() method.
|
||||
}
|
||||
|
||||
public function add(){
|
||||
// TODO: Implement add() method.
|
||||
}
|
||||
|
||||
public function edit(){
|
||||
// TODO: Implement edit() method.
|
||||
}
|
||||
|
||||
public function del(){
|
||||
// TODO: Implement del() method.
|
||||
}
|
||||
|
||||
public function batch(){
|
||||
// TODO: Implement batch() method.
|
||||
}
|
||||
|
||||
public function export(){
|
||||
// TODO: Implement export() method.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
<div class="coms-table-wrap mt10" id="vue-app">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/order/purchase/lists">
|
||||
<input type="hidden" value="<?= $_GET['spm'] ?>" name="spm"/>
|
||||
<input type="hidden" name="app_id" v-model="params.app_id"/>
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">订单搜索:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="search_k" id="search_k" v-model="params.search_k">
|
||||
<option :value="i" v-for="(v,i) in searchAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w300">
|
||||
<input id="search_v" name="search_v" type="text" v-model="params.search_v"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">订单状态:</label>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select name="status" v-model="params.status">
|
||||
<option value="">选择状态</option>
|
||||
<option :value="i" v-for="(v,i) in statusAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select id="status_detail" name="status_detail" v-model="params.status_detail">
|
||||
<option value="">选择详细状态</option>
|
||||
<option :value="i" v-for="(v,i) in statusDetailAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">付款方式:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="payway" v-model="params.payway">
|
||||
<option value="">选择方式</option>
|
||||
<option :value="i" v-for="(v,i) in paywayAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom:0px;"></div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w300">
|
||||
<input id="order-lists-time" type="text" name="time" value="<?= $params['time'] ?>"
|
||||
autocomplete="off"
|
||||
placeholder="下单时间范围"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl mb10" style="margin-top: 5px">
|
||||
<div class="am-para-inline w300">
|
||||
<a class="mr10 order-lists-time-btn" href="javascript:void (0);" data-date="today">今天</a>
|
||||
<a class="mr10 order-lists-time-btn" href="javascript:void (0);"
|
||||
data-date="yesterday">昨日</a>
|
||||
<a class="mr10 order-lists-time-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
|
||||
<a class="mr10 order-lists-time-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"><input type="checkbox" data-check-target=".order-ids"><span>全选</span></th>
|
||||
<th width="10%"><span>买家</span></th>
|
||||
<th width=""><span>标题</span></th>
|
||||
<th width="10%"><span>下单时间</span></th>
|
||||
<th width="10%"><span>单价*数量</span></th>
|
||||
<th width="10%"><span>实付金额</span></th>
|
||||
<th width="10%"><span>订单状态</span></th>
|
||||
<th width="10%"><span>付款方式</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(item,index) in lists">
|
||||
<tr>
|
||||
<td colspan="8" style="border-right: none;text-align: left">
|
||||
<span>
|
||||
<input type="checkbox" name="ids[]" class="order-ids"
|
||||
:value="'+item.id+'"/>订单号:{{item.sid}}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">{{item.uname}}<br/>{{item.mobile}}</td>
|
||||
<td>{{item.title}}</td>
|
||||
<td>{{item.c_time}}</td>
|
||||
<td>{{item.item_price_name}}</td>
|
||||
<td>{{item.pay_price_name}}</td>
|
||||
<td>{{item.status_name}}</td>
|
||||
<td>{{item.payway_name}}</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
<label class="checkall">
|
||||
<input type="checkbox" data-check-target=".order-ids">全选</label>
|
||||
<div class="am-para-inline w120" style="display: none">
|
||||
<select data-update-group="" data-list-target=".order-ids" data-action="/biz/case/visits/batch"
|
||||
data-field="ifcheck">
|
||||
<option value="">批量操作</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<link rel="stylesheet" type="text/css" href="/static/js/plugin/autocomplete/styles.css?t=2020221">
|
||||
<script>
|
||||
require(['laydate', 'autocomplete'], function (laydate) {
|
||||
//日期范围
|
||||
laydate.render({elem: '#order-lists-time', range: '~'});
|
||||
$('.order-lists-time-btn').click(function () {
|
||||
var type = $(this).data('date'), date = '', d_obj = new Date();
|
||||
switch (type) {
|
||||
case 'today':
|
||||
date = d_obj.Format('yyyy-MM-dd');
|
||||
date = date + ' ~ ' + date;
|
||||
break;
|
||||
case 'yesterday':
|
||||
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
|
||||
date = date + ' ~ ' + date;
|
||||
break;
|
||||
case '7day':
|
||||
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
|
||||
break;
|
||||
case '30day':
|
||||
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
|
||||
break;
|
||||
}
|
||||
$('#order-lists-time').val(date);
|
||||
});
|
||||
});
|
||||
|
||||
var vue_obj;
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-app',
|
||||
data: {
|
||||
params: [],
|
||||
searchAry: [],
|
||||
statusAry:[],
|
||||
statusDAry:[],
|
||||
statusDetailAry:[],
|
||||
paywayAry:[],
|
||||
lists: []
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.lists = <?=json_encode($lists)?>;
|
||||
vm.searchAry = <?=json_encode($searchAry)?>;
|
||||
vm.statusAry = <?=json_encode($statusAry)?>;
|
||||
vm.statusDAry = <?=json_encode($statusDAry)?>;
|
||||
vm.paywayAry = <?=json_encode($paywayAry)?>;
|
||||
},
|
||||
methods: {},
|
||||
watch: {
|
||||
"params.status":function(nv, ov){
|
||||
var vm = this;
|
||||
if('' != nv){
|
||||
vm.statusDetailAry = vm.statusDAry[nv];
|
||||
} else {
|
||||
vm.statusDetailAry = [];
|
||||
}
|
||||
if(undefined == vm.statusDetailAry[vm.params.status_detail]){
|
||||
vm.params.status_detail = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: xuxb
|
||||
* Date: 2020/6/11
|
||||
* Time: 20:59
|
||||
*/
|
||||
class Order_service extends HD_Service{
|
||||
protected $app_id;
|
||||
protected $app_key;
|
||||
|
||||
/**
|
||||
* 二级状态
|
||||
* @var array
|
||||
*/
|
||||
protected static $statusDetailAry = array(
|
||||
'1' => array("11" => '待支付', "12" => '超时未支付', "13" => '已取消'),
|
||||
//20,28复合订单才用到
|
||||
'2' => array('20' => '进行中', "21" => '待核销', "22" => '已核销', "23" => '核销码过期未退款', "24" => '核销码过期已退款', "25" => '待发货', "26" => '待收货', "27" => '已收货', '28' => '已完成'),
|
||||
'3' => array("31" => '申请退款', "32" => '退款中', "33" => '已退款', "34" => '退款失败', '35' => '部分退款')
|
||||
);
|
||||
|
||||
/**
|
||||
* 一级状态
|
||||
* @var array
|
||||
*/
|
||||
protected static $statusAry = array('1' => '支付环节', '2' => '支付后环节', '3' => '申请退款');
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
* @var array
|
||||
*/
|
||||
protected static $paywayAry = array('1' => '账户余额', '2' => '微信', '3' => '支付宝', '4' => '银联', '5' => '市民优选', '6' => '农行', '7' => '微信-银商','8'=> '云闪付');
|
||||
|
||||
/**
|
||||
* 物流
|
||||
* @var array
|
||||
*/
|
||||
protected static $expressAry = array(
|
||||
'0' => '自提', '1' => '顺丰速运', '2' => '百世快递', '3' => '中通快递', '4' => '申通快递', '5' => '圆通速递', '6' => '韵达速递', '7' => '邮政快递包裹'
|
||||
, '8' => 'EMS', '9' => '天天快递', '10' => '京东物流', '11' => '国通快递', '12' => '优速快递', '13' => '德邦', '14' => '快捷快递'
|
||||
, '15' => '宅急送', '16' => '安捷快递', '17' => '亚马逊物流'
|
||||
);
|
||||
|
||||
function __construct($param = array()){
|
||||
parent::__construct();
|
||||
|
||||
$this->log_dir = lcfirst(get_class($this)) . "_" . $this->app_id;
|
||||
|
||||
$this->load->model('app/app_model');
|
||||
$this->load->library('hd_exception');
|
||||
|
||||
if($param['app_id']){
|
||||
$this->init($param['app_id']);
|
||||
}
|
||||
}
|
||||
|
||||
function init($app_id){
|
||||
$this->app_id = $app_id;
|
||||
$this->log_dir = lcfirst(get_class($this)) . "_" . $this->app_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态值,默认取二维数组
|
||||
* @param null $k1 取二级状态列表
|
||||
* @param null $k2 和k1一起取具体的状态值
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function statusDetailAry($k1 = null, $k2 = null){
|
||||
$ary = self::$statusDetailAry;
|
||||
$v = $this->ary($ary, $k1, $k2);
|
||||
|
||||
return $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* 一级状态,默认数数组
|
||||
* @param null $k
|
||||
* @return array|mixed
|
||||
*/
|
||||
function statusAry($k = null){
|
||||
$ary = self::$statusAry;
|
||||
$v = $this->ary($ary, $k);
|
||||
|
||||
return $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付类型,默认取数组
|
||||
* @param null $k
|
||||
* @return array|mixed
|
||||
*/
|
||||
function paywayAry($k = null){
|
||||
$ary = self::$paywayAry;
|
||||
|
||||
$v = $this->ary($ary, $k);
|
||||
|
||||
return $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物流
|
||||
* @param null $k
|
||||
* @return mixed
|
||||
*/
|
||||
public function expressAry($k = null)
|
||||
{
|
||||
$ary = self::$expressAry;
|
||||
|
||||
$v = $this->ary($ary, $k);
|
||||
|
||||
return $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ary
|
||||
* @param $k1
|
||||
* @param $k2
|
||||
* @return mixed
|
||||
*/
|
||||
private function ary($ary, $k1 = null, $k2 = null){
|
||||
if($k1 && $k2){
|
||||
$v = $ary[$k1][$k2];
|
||||
} elseif($k1) {
|
||||
$v = $ary[$k1];
|
||||
} else {
|
||||
$v = $ary;
|
||||
}
|
||||
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user