🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
一、买家投诉 文件路径:shop/controllers/Buyer/Service/ComplainCtl.php 视图:shop/views/default/Buyer/Service/ComplainCtl/add.php 投诉表单提交:`$('#form').validator({})` 方法:addComplain() ~~~ $add_flag = $complain_id = $this->complainBaseModel->addBase($field, true); check_rs($add_flag, $rs_row); $field2['complain_id'] = $complain_id; $field2['goods_id'] = $goods['goods_id']; $field2['goods_name'] = $goods['goods_name']; $field2['goods_price'] = $goods['goods_price']; $field2['goods_num'] = $goods['order_goods_num']; $field2['goods_image'] = $goods['goods_image']; $field2['complain_message'] = $complain_content; $field2['order_goods_id'] = $goods_id; $field2['order_goods_type'] = 1; $field2['order_id'] = $goods['order_id']; $add_flag = $this->complainGoodsModel->addGoods($field2); ~~~ 二、平台审核 文件路径:shop/controllers/Api/Trade/ComplainCtl.php 视图:shop_admin/view/default/Trade/ComplainCtl/complain.php JS:shop_admin/static/default/js/controllers/trade/complain/complain_list.js 三、卖家申诉 文件路径:shop/controllers/Seller/Service/ComplainCtl.php 视图:shop/views/default/Seller/Service/ComplainCtl/detail.php `<input id="handle_submit" type="button" class="button button_red bbc_seller_submit_btns" value="<?=__('确认提交')?>">` 申诉提交表单验证: ~~~ $('#form').validator({ ignore: ':hidden', theme: 'yellow_right', timely: 1, stopOnError: false, fields: field, valid: function (form) { //表单验证通过,提交表单 $.ajax({ url: ajax_url, data: $("#form").serialize(), success: function (a) { if (a.status == 200) { location.href = "./index.php?ctl=Seller_Service_Complain&met=index&act=detail&id=<?=$data['id']?>"; } else { Public.tips.error('<?=__('操作失败!')?>'); } } }); } }).on("click", "#handle_submit", function (e) { $(e.delegateTarget).trigger("validate"); }); ~~~ 三、买卖双方对话 * 卖家: 文件路径:shop/controllers/Seller/Service/ComplainCtl.php 视图:shop/views/default/Seller/Service/ComplainCtl/detail.php 方法:publishComplainTalk() ~~~ $("#btn_publish").click(function () { if ($("#complain_talk").val() == '') { Public.tips.error("<?=__('对话不能为空')?>"); } else { publish_complain_talk(); } }); //发布对话 function publish_complain_talk() { $.ajax({ type: 'POST', url: SITE_URL + '?ctl=Buyer_Service_Complain&met=publishComplainTalk&typ=json', cache: false, data: "complain_id=" + complain_id + "&complain_talk=" + encodeURIComponent($("#complain_talk").val()), dataType: 'json', error: function () { Public.tips.error("<?=__('对话发送失败')?>"); }, success: function (d) { if (d.msg == 'success') { $("#complain_talk").val(''); Public.tips.success("<?=__('对话发送成功')?>"); get_complain_talk(); } else { Public.tips.error("<?=__('对话发送失败')?>"); } } }); } ~~~ ~~~ $Complain_TalkModel = new Complain_TalkModel(); $flag = $Complain_TalkModel->addTalk($filed); ~~~ * 买家: 文件路径:shop/controllers/Buyer/Service/ComplainCtl.php 视图:shop/views/default/Buyer/Service/ComplainCtl/detail.php ~~~ $("#btn_publish").click(function () { if ($("#complain_talk").val() == '') { Public.tips.error("<?=__('对话不能为空')?>"); } else { publish_complain_talk(); } }); //发布对话 function publish_complain_talk() { $.ajax({ type: 'POST', url: SITE_URL + '?ctl=Buyer_Service_Complain&met=publishComplainTalk&typ=json', cache: false, data: "complain_id=" + complain_id + "&complain_talk=" + encodeURIComponent($("#complain_talk").val()), dataType: 'json', error: function () { Public.tips.error("<?=__('对话发送失败')?>"); }, success: function (d) { if (d.msg == 'success') { $("#complain_talk").val(''); Public.tips.success("<?=__('对话发送成功')?>"); get_complain_talk(); } else { Public.tips.error("<?=__('对话发送失败')?>"); } } }); } ~~~ 方法:publishComplainTalk() ~~~ $Complain_TalkModel = new Complain_TalkModel(); $flag = $Complain_TalkModel->addTalk($filed); ~~~ 四、平台仲裁 文件路径:shop/controllers/Api/Trade/ComplainCtl.php 视图:shop_admin/view/default/Trade/ComplainCtl/getComplainInfo.php JS:shop_admin/static/default/js/controllers/trade/complain/progress.js 关闭投诉、处理意见: ~~~ $('#close_form').validator({ ignore: ':hidden', theme: 'yellow_bottom', timely: 1, stopOnError: true, fields: { 'final_handle_message': 'required;' }, valid: function (form) { parent.$.dialog.confirm('确认关闭此投诉?', function () { Public.ajaxPost(SITE_URL + '?ctl=Trade_Complain&met=handleComplain&typ=json', $("#close_form").serialize(), function (data) { if (data.status == 200) { parent.Public.tips({content: '操作成功!'}); window.location.href = SITE_URL + "?ctl=Trade_Complain&met=complain&state=5"; } else { parent.Public.tips({type: 1, content: data.msg || '操作无法成功,请稍后重试!'}); } }); }, function () { }); }, }).on("click", "a#btn_handle_submit", function (e) { $(e.delegateTarget).trigger("validate"); }); ~~~ 五、店铺投诉管理 文件路径:shop/controllers/Seller/Service/ComplainCtl.php * 投诉状态:1-新投诉、2-待申诉、3-对话中、4-待仲裁、5-已关闭 ~~~ const COMPLAIN_FRESH = 1; const COMPLAIN_APPEAL = 2; const COMPLAIN_TALK = 3; const COMPLAIN_HANDLE = 4; const COMPLAIN_FINISH = 5; public static $state = array( '1' => 'new', '2' => 'appeal',//投诉通过转给被投诉人 '3' => 'talk',//被投诉人已申诉 '4' => 'handle',//提交仲裁 '5' => 'finish', ); ~~~ * 视图:根据URL获得参数act的值,判断视图 ~~~ if ($act == "detail") { $data = $this->detail(); $this->view->setMet('detail'); } else { //index.php(视图) } ~~~ 1.投诉管理列表 视图:shop/views/default/Seller/Service/ComplainCtl/index.php 方法:index() ~~~ $data = $this->complainBaseModel->getBaseList($cond_row, array('complain_datetime' => 'DESC'), $page, $rows); ~~~ 2.查看投诉详情 视图:shop/views/default/Seller/Service/ComplainCtl/detail.php 方法:detail() ~~~ $data = $this->complainBaseModel->getComplainBase($cond_row); $data['good'] = $this->complainGoodsModel->getOneByWhere(array("complain_id" => $complain_id)); ~~~ 六、用户投诉管理 1.投诉列表 文件路径:shop/controllers/Buyer/Service/ComplainCtl.php -> index() 视图:shop/views/default/Buyer/Service/ComplainCtl/index.php ~~~ $Yf_Page = new Yf_Page(); $Yf_Page->listRows = 10; $rows = $Yf_Page->listRows; $offset = request_int('firstRow', 0); $page = ceil_r($offset / $rows); $state = request_int("status"); $cond_row['user_id_accuser'] = Perm::$userId; //店铺ID if ($state) { $cond_row['complain_state'] = $state; } $data = $this->complainBaseModel->getBaseList($cond_row, array('complain_datetime' => 'DESC'), $page, $rows); ~~~ 2.投诉详情 文件路径:shop/controllers/Buyer/Service/ComplainCtl.php 视图:shop/views/default/Buyer/Service/ComplainCtl/index.php 方法:detail() ~~~ //根据获取到的act的值判断视图 if ($act == "detail") { $data = $this->detail(); $this->view->setMet('detail'); $d = $data; } $data = $this->complainBaseModel->getComplainBase($cond_row); $data['good'] = $this->complainGoodsModel->getOneByWhere(array("complain_id" => $complain_id)); $data['id'] = $complain_id; $data['order'] = $this->orderBaseModel->getOneByWhere(array('order_id' => $data['good']['order_id'])); $data['ordergoods'] = $this->orderGoodsModel->getOneByWhere(array('order_goods_id' => $data['good']['order_goods_id'])); $data['shop'] = $this->shopBaseModel->getOne($data['user_id_accused']); $shop_company = $this->shopCompanyModel->getOne($data['user_id_accused']); $data['shop']['shop_company_address'] = $shop_company['shop_company_address']; ~~~