Browse Source

单个退款商品

master
lanzu_qinsheng 5 years ago
parent
commit
3c390816a8
  1. 21
      app/Admin/Common/LinkUrl.php
  2. 1
      app/Admin/Controllers/Type.php
  3. 46
      app/Admin/Extensions/MyDetailPage.php
  4. 7
      app/Admin/Extensions/OrderStateHandle.php
  5. 0
      public/css/detail.css
  6. 3
      resources/views/orderdetail.php

21
app/Admin/Common/LinkUrl.php

@ -0,0 +1,21 @@
<?php
namespace App\Admin\Common;
class LinkUrl
{
/**
* js
*/
const VUE_JS = 'https://cdn.jsdelivr.net/npm/vue';
const ELEMENT_UI_JS = 'https://unpkg.com/element-ui/lib/index.js';
/**
* css
*/
const ELEMENT_UI_CSS="https://unpkg.com/element-ui/lib/theme-chalk/index.css";
const DETAIL_CSS = 'css/detail.css';
}

1
app/Admin/Controllers/Type.php

@ -36,4 +36,5 @@ class Type
const BALANCE_USER_TYPE_CS = 4; //社区提现类型
const BALANCE_USER_TYPE_STORE= 5; //商户提现类型
}

46
app/Admin/Extensions/MyDetailPage.php

@ -3,6 +3,7 @@
namespace App\Admin\Extensions;
use App\Admin\Common\LinkUrl;
use App\Models\ImsCjdcOrder;
use App\Models\ImsCjdcOrderMain;
use App\Models\LanzuOrderGoods;
@ -14,30 +15,29 @@ use Endroid\QrCode\Exceptions\DataDoesntExistsException;
class MyDetailPage extends LazyRenderable
{
protected static $js = ['https://cdn.jsdelivr.net/npm/vue'];
protected static $css = ['css/deatail.css'];
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::where('id',$this->order_id)->first()->toArray();
if ($order){
$order['created_at'] = date('Y-m-d H:i:s',$order['created_at']);
$order['updated_at'] =$order['updated_at'] ? date('Y-m-d H:i:s',$order['updated_at']):null;
$order = ImsCjdcOrderMain::where('id', $this->order_id)->first()->toArray();
if ($order) {
$order['created_at'] = date('Y-m-d H:i:s', $order['created_at']);
$order['updated_at'] = $order['updated_at'] ? date('Y-m-d H:i:s', $order['updated_at']) : null;
$order['pay_type'] = config('order.pay_type')[$order['pay_type']];
$order['shipping_type'] = config('order.shipping_type')[$order['shipping_type']];
$order['horseman_name'] = LanzuServiceHorseman::getName($order['horseman_id']);
//>>2.获取子订单
$orders = ImsCjdcOrder::with('user')->with('store')
->where('order_main_id',$order['id'])->get()->toArray();
if (count($orders)){
foreach ($orders as &$or){
if (substr($or['store']['logo'],0,4)!='http'){
$or['store']['logo'] = env('IMG_HOST').'/'.$or['store']['logo'];
->where('order_main_id', $order['id'])->get()->toArray();
if (count($orders)) {
foreach ($orders as &$or) {
if (substr($or['store']['logo'], 0, 4) != 'http') {
$or['store']['logo'] = env('IMG_HOST') . '/' . $or['store']['logo'];
}
$or['goods'] = LanzuOrderGoods::where('order_id',$or['id'])->get()->toArray();
$or['goods'] = LanzuOrderGoods::where('order_id', $or['id'])->get()->toArray();
}
}
//dd($orders);
@ -74,6 +74,26 @@ class MyDetailPage extends LazyRenderable
horseman_name: "{$order['horseman_name']}",
orders: JSON.parse(orders)
},
methods: {
refund() {
this.\$confirm('是否同意该商品退款?', '提示', {
confirmButtonText: '同意',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.\$message({
type: 'success',
message: '操作成功!'
});
}).catch(() => {
});
}
}
});
JS

7
app/Admin/Extensions/OrderStateHandle.php

@ -36,8 +36,7 @@ class OrderStateHandle extends RowAction
$id = $this->getKey();
$orderMain = new ImsCjdcOrderMain();
$state = $request->get('state');
$res = $orderMain->modifyState($id,$state);
if ($res&&$state==4){
if ($state==4){
$order = $orderMain::where('id',$id)->first();
//记录分账流水
$result = json_decode(Rpc::separateAccounts($id,$order->user_id));
@ -47,10 +46,10 @@ class OrderStateHandle extends RowAction
Log::error('订单完成时分账接口调用失败',$result);
return $this->response()->error('操作失败')->refresh();
}
}elseif ($res&&$state==9){//同意退款
}elseif ($state==9){//同意退款
}
$res = $orderMain->modifyState($id,$state);
if ($res==true){
return $this->response()->success('操作成功')->refresh();
}else{

0
public/css/deatail.css → public/css/detail.css

3
resources/views/orderdetail.php

@ -47,8 +47,10 @@
<div>
<span class="price">/{{goods.goods_unit}}</span>
<span style="float: right;">X {{goods.number}}</span>
</div>
<p class="mb-0" style="color: red;font-size: 1.4rem;">{{goods.price}}</p>
<el-button type="info" style="float: right;" @click="refund()">退款审核</el-button>
</div>
</div>
<p v-if="item.note">店铺备注: ({{item.note}})</p>
@ -67,3 +69,4 @@
</div>
<!-- 店铺END -->
</div>
Loading…
Cancel
Save