Browse Source

订单优化

dev
nizongfeng 3 years ago
parent
commit
e3c4190655
8 changed files with 465 additions and 34 deletions
  1. +11
    -0
      application/admin/controller/OrderMain.php
  2. +61
    -0
      application/admin/service/OrderMainService.php
  3. +0
    -1
      application/admin/view/order_main/add.html
  4. +0
    -1
      application/admin/view/order_main/edit.html
  5. +369
    -31
      application/admin/view/order_main/index.html
  6. +1
    -1
      application/admin/view/receipt_order/index.html
  7. +6
    -0
      public/view/order_main/add.html
  8. +17
    -0
      public/view/order_main/edit.html

+ 11
- 0
application/admin/controller/OrderMain.php View File

@@ -478,4 +478,15 @@ class OrderMain extends Backend
$result = $orderMain->allowField(true)->save($params);
}

/**
* 获取订单列表
* @return \think\response\Json
*/
public function getOrderList(){
$params=$this->request->post();
$orderMainService = new OrderMainService();
$result = $orderMainService->getOrderList($params);
return json($result);
}

}

+ 61
- 0
application/admin/service/OrderMainService.php View File

@@ -268,4 +268,65 @@ class OrderMainService
$orderMain["subOrderList"]=$subOrderList['data'];
return Util::returnArrSu("成功",$orderMain);
}

/**
* 获取订单列表
* @param $param
* @return array
*/
public function getOrderList($param){
$orderMainDao = new OrderMainDao();
$where = ["id"=>["neq",""]];
if (!empty($param['order_id'])) {
$where["id"]=$param['order_id'];
}
if (!empty($param['channel_id'])) {
$where['channel_id'] = $param['channel_id'];
}
if ($param['order_status'] != '') {
$where['order_status'] = $param['order_status'];
}
if (!empty($param['commissioner_id'])) {
$where['commissioner_id'] = $param['commissioner_id'];
}
if (!empty($param['user_name'])) {
$where['user_name'] = ["like","'%".$param['user_name']."%'"];
}
if (!empty($param['user_phone'])) {
$where['user_phone'] = $param['user_phone'];
}
if (!empty($param['create_id'])) {
$where['create_id'] = $param['create_id'];
}
//金额区间查询
if (!empty($param['startMoney'])&& empty($param['endMoney'])) {
$where['total_amount'] = [">=",$param['startMoney']];
}
if (!empty($param['endMoney']) && empty($param['startMoney'])) {
$where['total_amount'] = ["<=",$param['endMoney']];
}
if (!empty($param['endMoney']) && !empty($param['startMoney'])) {
$where['total_amount'] = ["between",[$param['startMoney'],$param['endMoney']]];
}
//时间区间查询
if (!empty($param['startTime']) && empty($param['endTime'])) {
$where['create_time'] = [">=",$param['startTime']." 00:00:00"];
}
if (!empty($param['endTime'])&& empty($param['startTime'])) {
$where['create_time'] = ["<=",$param['endTime']." 23:59:59"];
}
if(!empty($param['endTime'])&& !empty($param['startTime'])){
$where['create_time'] = ["between",[$param['startTime']." 00:00:00",$param['endTime']." 23:59:59"]];
}
if ($param['receipt_order_status'] !== '') {
$where['receipt_order_status'] = $param['receipt_order_status'];
}
if ($param['receipt_order_id'] !== '') {
$where['receipt_order_id'] = $param['receipt_order_id'];
}
if ($param['channel_order_no'] != '') {
$where['channel_order_no'] = $param['channel_order_no'];
}
return $orderMainDao->getOrderListByWhere($where,$param);
}
}

+ 0
- 1
application/admin/view/order_main/add.html View File

@@ -1 +0,0 @@
<script>window.id = ''</script><!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>single</title><link href=/static/css/app.6e3c84d5d9c1c5d70bd94155aca59b77.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.4c0083d0663e37ad75dc.js></script><script type=text/javascript src=/static/js/app.8876ed90b80514fec34d.js></script></body></html>

+ 0
- 1
application/admin/view/order_main/edit.html View File

@@ -1 +0,0 @@
<input id="c-id" type="hidden" value="{$row.id}"><script>window.id = document.getElementById('c-id').value</script><!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>single</title><link href=/static/css/app.6e3c84d5d9c1c5d70bd94155aca59b77.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.4c0083d0663e37ad75dc.js></script><script type=text/javascript src=/static/js/app.8876ed90b80514fec34d.js></script></body></html>

+ 369
- 31
application/admin/view/order_main/index.html View File

@@ -1,35 +1,373 @@
<div class="panel panel-default panel-intro">
{:build_heading()}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app" class="table">
<div>
<div class="header-search" style="width: 100%;margin-bottom: 10px">
<span>订单ID:</span>
<el-input v-model="search.order_id" style="width: 150px;" placeholder="请输入内容"></el-input>
<span>订单状态:</span>
<el-select v-model="search.order_status" style="width: 150px;" placeholder="请选择" clearable>
<el-option
v-for="item in orderMainStatus"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<span>收款单ID:</span>
<el-input v-model="search.receipt_order_id" style="width: 150px;" placeholder="请输入内容"></el-input>
<span>收款单状态</span>
<el-select v-model="search.receipt_order_status" style="width: 150px;" placeholder="请选择" clearable>
<el-option
v-for="item in receiptStatus"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="header-search" style="width: 100%;margin-bottom: 10px">
<span>用户名</span>
<el-input v-model="search.user_name" style="width: 150px;" placeholder="请输入内容" clearable></el-input>
<span>渠道订单号:</span>
<el-input v-model="search.channel_order_no" style="width: 150px;" placeholder="请输入内容"></el-input>
<span>渠道:</span>
<el-select v-model="search.channel_id" style="width: 150px;" placeholder="请选择" clearable>
<el-option
v-for="item in channelList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<span>专员</span>
<el-select v-model="search.commissioner_id" style="width: 150px;" placeholder="请选择" clearable>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<span>下单人</span>
<el-select v-model="search.create_id" style="width: 150px;" placeholder="请选择" clearable>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="header-search" style="width: 100%;margin-bottom: 10px">
<span>手机号</span>
<el-input v-model="search.user_phone" style="width: 150px;" placeholder="请输入内容" clearable></el-input>
<span>金额</span>
<el-input-number v-model="search.startMoney" style="width: 170px;" placeholder="请输入内容" clearable></el-input-number>
~
<el-input-number v-model="search.endMoney" style="width: 170px;" placeholder="请输入内容" clearable></el-input-number>
<span>时间</span>
<el-date-picker
style="width: 150px;"
v-model="search.startTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
~
<el-date-picker
style="width: 150px;"
v-model="search.endTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="选择日期">
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button>
<el-button type="primary" icon="el-icon-plus" @click="addShow=true" >新增</el-button>
</div>

<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('order_main/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<!-- <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('order_main/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
<!-- <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('order_main/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('order_main/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
<el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark"
style="font-size:12px;width: 100%;margin-top: 12px">
<el-table-column prop="id" label="订单ID" min-width="40" ></el-table-column>
<el-table-column prop="commissioner" label="专员" min-width="40" ></el-table-column>
<el-table-column prop="channel_name" label="渠道" min-width="80" ></el-table-column>
<el-table-column prop="channel_order_no" label="渠道订单号" min-width="90" ></el-table-column>
<el-table-column prop="create_id" label="下单人" min-width="50" :formatter="getUserName"></el-table-column>
<el-table-column prop="user_name" label="用户名称" min-width="50" ></el-table-column>
<el-table-column prop="user_phone" label="手机号" min-width="60" ></el-table-column>
<el-table-column prop="total_amount" label="总金额" min-width="40" ></el-table-column>
<el-table-column prop="order_status" label="状态" min-width="40" :formatter="getOrderMainStatus"></el-table-column>
<el-table-column prop="create_time" label="下单时间" min-width="80" ></el-table-column>
<el-table-column prop="receipt_order_id" label="收款单ID" min-width="40" ></el-table-column>
<el-table-column prop="receipt_order_name" label="收款单名称" min-width="80" ></el-table-column>
<el-table-column label="操作" min-width="180">
<template slot-scope="scope">
<el-button-group>
<el-button type="primary" size="mini" @click="edit(scope.row.id)" icon="el-icon-edit">编辑</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="delAll(scope.row.id)">删除</el-button>
</el-button-group>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-size="search.pageSize"
:pager-count="11"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
:current-page="search.pageNum"
:page-sizes="[10, 20, 30, 40, 50]"
@size-change="sizeChange"
@current-change="getData"
@prev-click="getData"
@next-click="getData"
></el-pagination>
</div>
<transition name="bounce" v-if="addShow">
<el-dialog title="新增订单" :visible.sync="addShow" width="90%" height="100%" top="15px">
<iframe src="/view/order_main/add.html" frameborder="0" width="99%" id="addPageShow" onload="this.height=100"></iframe>
</el-dialog>
</transition>
<transition name="bounce" v-if="editShow">
<el-dialog title="编辑订单" :visible.sync="editShow" width="90%" height="100%" top="15px">
<iframe :src="editPageShowUrl" frameborder="0" width="99%" id="editPageShow" onload="this.height=100"></iframe>
</el-dialog>
</transition>
</div>
</body>
<!-- import Vue before Element -->
<script src="/assets/js/vue/vue.js"></script>
<!-- import JavaScript -->
<script src="/assets/js/vue/index.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/javascript">
function reinitIframe(){
try{
var iframe = document.getElementById("addPageShow");
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
console.log(height);
}catch (ex){}
try{
var iframe1 = document.getElementById("editPageShow");
var bHeight1 = iframe1.contentWindow.document.body.scrollHeight;
var dHeight1 = iframe1.contentWindow.document.documentElement.scrollHeight;
var height1 = Math.max(bHeight1, dHeight1);
iframe1.height = height1;
console.log(height1);
}catch (ex){}
}
window.setInterval("reinitIframe()", 200);
</script>
<script>
new Vue({
el: '#app',
data: function () {
return {
search: {
"receipt_order_id":"",
"receipt_order_status":"",
"order_id":"",
"channel_order_no":"",
"channel_id":"",
"order_status":"",
"commissioner_id":"",
"user_name":"",
"user_phone":"",
"create_id":"",
"startMoney":"",
"endMoney":"",
"startTime":"",
"endTime":"",
"pageNum":1,
"pageSize":10
},
total: 0,
tableData: [],
province: [],
city: [],
area:[],
editShow:false,
editPageShowUrl:"",
addShow:false,
//收款单状态 0:未收款 1:收款中 2已收款
receiptStatus:[
{id:0,name:"未收款"},
{id:1,name:"收款中"},
{id:2,name:"已收款"},
],
//0待处理 1已确认 2部分取消 10已完成 11已取消
orderMainStatus:[
{id:0,name:"待处理"},
{id:1,name:"已确认"},
{id:2,name:"部分取消"},
{id:3,name:"处理中"},
{id:10,name:"已完成"},
{id:11,name:"已取消"}
],
userList: [],
channelList:[],
multipleSelection: []

<div class="dropdown btn-group {:$auth->check('order_main/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
</ul>
</div>
}
},
created() {
window.addEventListener("message", e => {
this.editShow = false
this.addShow = false
});
this.getAdminUser();
this.getChannelList();
this.getProvince();
this.getData(1)
},
watch: {
"search.province" : function (newVal,oldVal){
this.city = []
this.area = []
this.search.city=""
this.search.area=""
if (newVal==''){
return false;
}
let row = {
"province":newVal
}
axios.post("/hotel.php/ajax/areaList", row).then((response) => {
let data = response.data;
if (data.flag) {
this.city = data.data;

</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('order_main/edit')}"
data-operate-del="{:$auth->check('order_main/del')}"
width="100%">
</table>
</div>
</div>
} else {
this.$message.error(data.msg);
}
}).catch(function (error) {
console.log(error);
});
},
"search.city" : function (newVal,oldVal){
this.area = []
this.search.area=""
if (newVal == "") {
return false;
}
let row = {
province:this.search.province,
city:newVal
}
axios.post("/hotel.php/ajax/areaList", row).then((response) => {
let data = response.data;
if (data.flag) {
this.area = data.data;
} else {
this.$message.error(data.msg);
}
}).catch(function (error) {
console.log(error);
});

</div>
</div>
</div>
},
},
methods: {
getChannelList(){
axios.post("/hotel.php/cf_channel_info/getList", this.search).then((response) => {
console.log(response)
let data = response.data;
this.channelList = data.list;
}).catch(function (error) {
console.log(error);
});
},
getUserName(info) {
for (let i = 0; i < this.userList.length; i++) {
if (this.userList[i].id == info.create_id) {
return this.userList[i].name
}
}
return "-"
},
getOrderMainStatus(info){
for (let i = 0; i < this.orderMainStatus.length; i++) {
if (this.orderMainStatus[i].id == info.order_status) {
return this.orderMainStatus[i].name
}
}
return "-"
},
getAdminUser() {
axios.post("/hotel.php/auth/admin/getList", this.search).then((response) => {
this.userList = response.data.list;
}).catch(function (error) {
console.log(error);
});
},
getProvince(){
axios.post("/hotel.php/ajax/areaList", {}).then((response) => {
let data = response.data;
if (data.flag) {
this.province = data.data;
} else {
this.$message.error(data.msg);
}
}).catch(function (error) {
console.log(error);
});
},
sizeChange(pageSize) {
this.search.pageSize = pageSize;
this.getData(this.search.pageNum)
},
edit(id){
this.editPageShowUrl="/view/order_main/edit.html?id="+id;
this.editShow=true;
},
//獲取列表
getData(page) {
this.search.pageNum = page;
axios.post("/hotel.php/order_main/getOrderList", this.search).then((response) => {
let data = response.data;
if (data.flag) {
this.tableData = data.data.list;
this.total = data.data.total;
} else {
this.$message.error(response.msg);
}
}).catch(function (error) {
console.log(error);
});
},
}
})
</script>
<style lang="scss" scoped>
.el-table thead {
background-color: #5a5e66 !important;
}

.header-search {
font-size: 14px;
font-weight: 900;
}

body {
background-color: white;
}

.table {
width: 100%;
font-size: 12px;
margin-top: 12px;
background-color: white;
}
.el-form-item{
margin-bottom: 5px !important;
}
</style>
</html>

+ 1
- 1
application/admin/view/receipt_order/index.html View File

@@ -108,7 +108,7 @@
<div v-html="editOrder.name"></div>
</el-form-item>
<el-form-item label="收款单状态:" style="width: 80%">
<el-radio-group v-model="editOrder.status" size="mini" disabled="true">
<el-radio-group v-model="editOrder.status" size="mini" disabled>
<el-radio-button label="0">未收款</el-radio-button>
<el-radio-button label="1">收款中</el-radio-button>
<el-radio-button label="2">已收款</el-radio-button>


+ 6
- 0
public/view/order_main/add.html View File

@@ -0,0 +1,6 @@
<script>
window.id = ''
function close(){
window.parent.postMessage('message', window.location.protocol+"//"+window.location.host);
}
</script><!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>single</title><link href=/static/css/app.6e3c84d5d9c1c5d70bd94155aca59b77.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.4c0083d0663e37ad75dc.js></script><script type=text/javascript src=/static/js/app.8876ed90b80514fec34d.js></script></body></html>

+ 17
- 0
public/view/order_main/edit.html View File

@@ -0,0 +1,17 @@
<script>
window.id = getQueryVariable("id")
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
function close(){
window.parent.postMessage('message', window.location.protocol+"//"+window.location.host);
}
</script>
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>single</title><link href=/static/css/app.6e3c84d5d9c1c5d70bd94155aca59b77.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.4c0083d0663e37ad75dc.js></script><script type=text/javascript src=/static/js/app.8876ed90b80514fec34d.js></script></body></html>

Loading…
Cancel
Save