作者 郭鑫
1 个管道 的构建 通过 耗费 1 秒

页面修改

... ... @@ -198,39 +198,19 @@ class MemberController extends CommentController
// 取消订单/确认完成
public function changeStatus(){
$data = $this->request->param();
if($data['type'] == 1){
// 取消
$where_order['id'] = $data['id'];
$where_order['status'] = 3;
$order = Db::name('Order')->where($where_order)->find();
}else if($data['type'] == 2){
// 确认完成
$where_order['status'] = 6;
$where_order['id'] = $data['logId'];
}
$where_order['id'] = $data['id'];
$where_order['status'] = 3;
$order = Db::name('Order')->where($where_order)->find();
if($order){
if($data['type'] == 1){
// 取消
$up['status'] = 5;
}else if($data['type'] == 2){
// 确认完成
$up['status'] = 7;
}
$up['status'] = 5;
$up['update_time'] = time();
$res = Db::name('Order')->where($where_order)->update($up);
if($data['type'] == 1){
// 取消
$meg = '取消';
}else if($data['type'] == 2){
// 确认完成
$meg = '确认完成';
}
if($res){
$this->apiResponse('1',$meg."成功");
$this->apiResponse('1',"取消成功");
}else{
$this->apiResponse('0',$meg.'取消失败');
$this->apiResponse('0','取消失败');
}
}else{
$this->apiResponse('0','状态错误');
... ... @@ -238,6 +218,27 @@ class MemberController extends CommentController
}
// 确认完成
public function sureStatus(){
$data = $this->request->param();
// 确认完成
$where_order['status'] = 6;
$where_order['id'] = $data['id'];
$log = Db::name('CompareLog')->where($where_order)->find();
if($log){
$up['status'] = 7;
$up['update_time'] = time();
$res = Db::name('CompareLog')->where($where_order)->update($up);
if($res){
$this->apiResponse('1',"确认完成成功");
}else{
$this->apiResponse('0','确认完成失败');
}
}else{
$this->apiResponse('0','状态错误');
}
}
// 评价1
public function common(){
if($this->request->isPost()){
... ...
... ... @@ -85,10 +85,10 @@ function def() {
" <div class=\"footbtn\">\n" ;
// 2待审核,3审核通过,待付款,4审核未通过,5已取消,6待完成,7待评价,8已评价
if(val.orderStatus == 3){
html += "<p class=\"cancelorder\" onclick='change("+val.id+","+val.logId+",1)'>取消订单</p>\n" +
html += "<p class=\"cancelorder\" onclick='change("+val.id+")'>取消订单</p>\n" +
" <p class=\"sureorder \" onclick='toPay("+val.id+")'>付款</p>" ;
}else if(val.orderStatus == 6){
html += "<p class=\"sureorder\" onclick='change("+val.id+","+val.logId+",2)'>确认完成</p>" ;
html += "<p class=\"sureorder\" onclick='sure("+val.logId+")'>确认完成</p>" ;
}else if(val.orderStatus == 7){
html += "<p class=\"sureorder\" onclick='common("+val.id+")'>评价</p>\n" ;
}
... ... @@ -118,38 +118,51 @@ function jump(id) {
url = url[0] + '/id/' + id + ".html";
window.location.href = url;
}
// 取消/确认
function change(id,type) {
if(type == 1){
// 取消
function change(id) {
window.event.stopPropagation();
var a=confirm("是否取消订单");
if(a==true){
order(id,type)
$.ajax({
type: 'POST',
url: "{:url('Member/changeStatus')}",
data: {
'id':id,
},
success: function (res) {
// console.log(res);
popup(res.message);
if(res.code == 1){
setTimeout("def()",2500);
}
},
error: function (res) {
// console.log(res);
}
});
}
}else{
order(id,type)
}
}
function order(id,type) {
// 确认
function sure(id) {
$.ajax({
type: 'POST',
url: "{:url('Member/changeStatus')}",
url: "{:url('Member/sureStatus')}",
data: {
'id':id,
'type':type,
},
success: function (res) {
console.log(res);
// console.log(res);
popup(res.message);
if(res.code == 1){
setTimeout("def()",2500);
}
},
error: function (res) {
console.log(res);
// console.log(res);
}
});
}
//评价页面
function common(id) {
var url = "{:url('Member/common')}";
... ...