Browse Source

采购单 订单管理

dev
nizongfeng 3 years ago
parent
commit
56c24a3cd1
5 changed files with 196 additions and 14 deletions
  1. +10
    -0
      application/admin/controller/ReceiptOrder.php
  2. +18
    -0
      application/admin/service/OrderMainDao.php
  3. +17
    -1
      application/admin/service/ReceiptOrderDao.php
  4. +51
    -2
      application/admin/service/ReceiptOrderService.php
  5. +100
    -11
      application/admin/view/receipt_order/index.html

+ 10
- 0
application/admin/controller/ReceiptOrder.php View File

@@ -256,4 +256,14 @@ class ReceiptOrder extends Backend
return json($result);
}

/**
* 删除采购单
*/
public function delAll(){
$params=$this->request->post();
$service = new ReceiptOrderService();
$result = $service->delAll($params['id']);
return json($result);
}

}

+ 18
- 0
application/admin/service/OrderMainDao.php View File

@@ -216,4 +216,22 @@ class OrderMainDao
return Util::returnArrSu("", ["total" => 0, "list" => []]);
}
}

/**
* 删除采购单
* @param $id
* @return array
*/
public function delReceiptOrder($id){
try{
$data = [
"del_flag"=>1
];
$model = new OrderMain();
$model->save($data,["receipt_order_id"=>$id]);
return Util::returnArrSu();
}catch (Exception $e){
return Util::returnArrEr("将主订单从采购单下移除失败".$e->getMessage());
}
}
}

+ 17
- 1
application/admin/service/ReceiptOrderDao.php View File

@@ -88,7 +88,7 @@ class ReceiptOrderDao
public function getList($param)
{
try {
$where = [];
$where = ["a.del_flag"=>0];
if (!empty($param['name'])) {
$where['a.name'] = ["like","%".$param['name']."%"];
}
@@ -118,4 +118,20 @@ class ReceiptOrderDao
return Util::returnArrSu("", ["total" => 0, "list" => []]);
}
}

/**
* 删除
* @param $id
* @return array
*/
public function del($id){
try {
//设置收购单状态
$receiptOrder = new ReceiptOrder();
$receiptOrder->save(['del_flag' => 1], ['id' => $id]);
return Util::returnArrSu();
} catch (Exception $e) {
return Util::returnArrEr("修改状态失败" . $e->getMessage());
}
}
}

+ 51
- 2
application/admin/service/ReceiptOrderService.php View File

@@ -121,12 +121,36 @@ class ReceiptOrderService
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"]];
}
switch ($param['inReceipt']) {
case 0:
break;
case 1:
$where["receipt_order_id"] = $param['receipt_order_id'];
break;
@@ -138,4 +162,29 @@ class ReceiptOrderService
}
return $orderMainDao->getOrderListByWhere($where,$param);
}

/**
* 删除采购单
* @param $id
* @return array
*/
public function delAll($id){
Db::startTrans();
//1.删除采购单下的主订单
$orderMainDao = new OrderMainDao();
$delReceipt = $orderMainDao->delReceiptOrder($id);
if (!$delReceipt['flag']) {
Db::rollback();
return $delReceipt;
}
//2.删除采购单
$model = new ReceiptOrderDao();
$delRe = $model->del($id);
if (!$delRe['flag']) {
Db::rollback();
return $delRe;
}
Db::commit();
return Util::returnArrSu();
}
}

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

@@ -47,7 +47,7 @@
<el-button-group>
<el-button type="primary" size="mini" @click="edit(scope.row)" icon="el-icon-edit">编辑</el-button>
<el-button type="primary" size="mini" @click="editOrderDivShow(scope.row)" icon="el-icon-share">订单</el-button>
<el-button type="primary" size="mini" icon="el-icon-delete">删除</el-button>
<el-button type="primary" size="mini" icon="el-icon-delete" @click="delAll(scope.row.id)">删除</el-button>
</el-button-group>
</template>
</el-table-column>
@@ -99,7 +99,7 @@

<transition name="bounce" v-if="editOrderShow">
<el-dialog title="详情" :visible.sync="editOrderShow" width="90%" top="15px">
<el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 20px">
<el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 10px">
<div style="display: flex;width: 100%">
<el-form-item label="收款单ID:" style="width: 80%">
<div v-html="editOrder.id"></div>
@@ -121,7 +121,7 @@
<span>订单ID:</span>
<el-input v-model="orderMainListSearch.order_id" style="width: 150px;" placeholder="请输入内容"></el-input>
<span>订单状态:</span>
<el-select v-model="orderMainListSearch.order_status" placeholder="请选择" clearable>
<el-select v-model="orderMainListSearch.order_status" style="width: 150px;" placeholder="请选择" clearable>
<el-option
v-for="item in orderMainStatus"
:key="item.id"
@@ -138,8 +138,6 @@
:value="item.id">
</el-option>
</el-select>
</div>
<div class="header-search" style="width: 100%;margin-bottom: 10px">
<span>渠道:</span>
<el-select v-model="orderMainListSearch.channel_id" style="width: 150px;" placeholder="请选择" clearable>
<el-option
@@ -167,16 +165,44 @@
:value="item.id">
</el-option>
</el-select>
</div>
<div class="header-search" style="width: 100%;margin-bottom: 10px">
<span>用户名</span>
<el-input v-model="orderMainListSearch.user_name" style="width: 150px;" placeholder="请输入内容" clearable></el-input>
<span>手机号</span>
<el-input v-model="orderMainListSearch.user_phone" style="width: 150px;" placeholder="请输入内容" clearable></el-input>
<span>金额</span>
<el-input-number v-model="orderMainListSearch.startMoney" style="width: 150px;" placeholder="请输入内容" clearable></el-input-number>
~
<el-input-number v-model="orderMainListSearch.endMoney" style="width: 150px;" placeholder="请输入内容" clearable></el-input-number>
<span>时间</span>
<el-date-picker
style="width: 150px;"
v-model="orderMainListSearch.startTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
~
<el-date-picker
style="width: 150px;"
v-model="orderMainListSearch.endTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="选择日期">
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="getOrderMainData(1)">搜索</el-button>
</div>
<div>
<el-table ref="multipleTable" :data="orderMainList" border tooltip-effect="dark"
style="font-size:12px;width: 100%;margin-top: 12px">
<el-table ref="multipleTable" :data="orderMainList" border tooltip-effect="dark" style="font-size:12px;width: 100%;margin-top: 12px" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="30" :selectable="checkSelect"></el-table-column>
<el-table-column prop="id" label="订单ID" min-width="40" ></el-table-column>
<el-table-column prop="commissioner" label="专员" min-width="40" :formatter="getUserName"></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>
@@ -192,6 +218,9 @@
</el-table-column>

</el-table>
<div style="margin-top: 5px">
<el-button @click="addOrderAll()" :disabled="multipleSelection.length==0">添加到采购单</el-button>
</div>
<el-pagination
:page-size="orderMainListSearch.pageSize"
:pager-count="11"
@@ -248,20 +277,25 @@
editOrderOld:{},
editOrder:{},
orderMainListSearch:{
"receipt_order_id":0,
"inReceipt":0,
"receipt_order_id":"",
"inReceipt":"",
"order_id":"",
"channel_id":"",
"order_status":"",
"commissioner_id":"",
"user_name":"",
"user_phone":"",
"create_id":"",
"startMoney":"",
"endMoney":"",
"startTime":"",
"endTime":"",
"pageNum":1,
"pageSize":10
},
orderMainTotal:0,
orderMainList:[],
inReceipt:[
{id:0,name:"所有"},
{id:1,name:"在此收款单中"},
{id:2,name:"不在此收款单中"},
{id:3,name:"不在任何收款单中"}
@@ -275,7 +309,8 @@
{id:10,name:"已完成"},
{id:11,name:"已取消"}
],
channelList:[]
channelList:[],
multipleSelection: []
}
},
created() {
@@ -285,6 +320,15 @@

},
methods: {
checkSelect(row,index){
if (row.receipt_order_id ==0) {
return true;
}
return false;
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
getChannelList(){
axios.post("/hotel.php/cf_channel_info/getList", this.search).then((response) => {
console.log(response)
@@ -457,6 +501,18 @@
console.log(error);
});
},
addOrderAll(){
let orderId = "";
let length = this.multipleSelection.length;
for (var k = 0; k < length; k++) {
if (orderId == "") {
orderId = this.multipleSelection[k].id;
continue;
}
orderId =orderId+","+this.multipleSelection[k].id;
}
this.addOrderMain(orderId);
},
removeOrderMain(order_id){
let param = {
order_id:order_id,
@@ -476,6 +532,36 @@
}).catch(function (error) {
console.log(error);
});
},
delAll(id){
let param = {
id:id
}
this.$confirm('确定删除采购单?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios.post("/hotel.php/receipt_order/delAll", param).then((response) => {
let data = response.data;
if (data.flag) {
this.$message({
message: '移除成功!',
type: 'success'
});
this.getData(this.search.pageNum)
} else {
this.$message.error(response.msg);
}
}).catch(function (error) {
console.log(error);
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
}

}
@@ -501,5 +587,8 @@
margin-top: 12px;
background-color: white;
}
.el-form-item{
margin-bottom: 5px !important;
}
</style>
</html>

Loading…
Cancel
Save