|
|
<?php
namespace App\Admin\Extensions;
use App\Admin\Common\LinkUrl;use App\Models\ImsCjdcOrder;use App\Models\ImsCjdcOrderMain;use App\Models\LanzuOrderGoods;use App\Models\LanzuServiceHorseman;use Dcat\Admin\Admin;use Dcat\Admin\Support\LazyRenderable;use Endroid\QrCode\Exceptions\DataDoesntExistsException;
class MyDetailPage extends LazyRenderable{
protected static $js = [LinkUrl::VUE_JS, LinkUrl::ELEMENT_UI_JS]; protected static $css = [LinkUrl::DETAIL_CSS, LinkUrl::ELEMENT_UI_CSS];
public function render() { //>>1.主订单数据
$order = ImsCjdcOrderMain::getOrderData($this->order_id); if ($order) { //>>2.获取子订单
$result = ImsCjdcOrder::getOrdersData($order['global_order_id']); $orders = json_encode($result['orders']); $showRefund = json_encode($result['show_refund']); Admin::script( <<<JS var orders = JSON.stringify($orders) var show_refund = JSON.stringify($showRefund) var app = new Vue({ el:"#detail", data:{ dialogFormVisible: false, order_num: "{$order['order_num']}", name: "{$order['name']}", state: "{$order['state']}", created_at: "{$order['created_at']}", updated_at: "{$order['updated_at']}", pay_type: "{$order['pay_type']}", shipping_type: "{$order['shipping_type']}", tel: "{$order['tel']}", delivery_time_note: "{$order['delivery_time_note']}", refuse_refund_note: "{$order['refuse_refund_note']}", total_refund_note: "{$order['total_refund_note']}", address: "{$order['address']}", note: "{$order['note']}", money: "{$order['money']}", total_money: "{$order['total_money']}", services_money: "{$order['services_money']}", coupon_money: "{$order['coupon_money']}", delivery_money: "{$order['delivery_money']}", horseman_name: "{$order['horseman_name']}", distance: "{$order['delivery_distance']}", orders: JSON.parse(orders), show_refund: JSON.parse(show_refund), refund_2:"退款", refund_3:"已同意退款", refund_goods_name:"", global_order_id:"{$order['global_order_id']}", user_id:"{$order['user_id']}", order_goods_id:null, order_child_id:null, show_refund_2:true, show_refund_3:false, }, methods: { refundNote(name,order_goods_id,order_child_id) { this.dialogFormVisible = true; this.order_goods_id=order_goods_id; this.order_child_id=order_child_id; this.refund_goods_name ="退款备注商品 ["+name+"]" ; }, refundConfirm() { if (this.total_refund_note==''){ this.\$message({message: '请备注退款原因!',type: 'warning'}) return false; } this.\$confirm('是否同意该商品退款?', '提示', { confirmButtonText: '同意', cancelButtonText: '取消', type: 'warning' }).then(() => { that = this; $.ajax({ url: "order_goods_refund", type: "get", contentType: "text/html; charset=utf-8", dataType: "json", data: { user_id:that.user_id, note:that.total_refund_note, global_order_id:that.global_order_id, order_child_id:that.order_child_id, order_goods_id:that.order_goods_id }, success: function (res) { if (1){ that.\$message({ message: '退款成功', type: 'success' }) that.show_refund[that.order_goods_id].show_refund_2=false that.show_refund[that.order_goods_id].show_refund_3=true } that.dialogFormVisible = false; }, error: function (xhr, err) { console.log("错误", err) } }); }).catch(() => { }); } } });JS );
} return view('orderdetail'); }
}
|