订单状态流程
This commit is contained in:
parent
fbe942b36e
commit
b2a175ab24
@ -96,6 +96,13 @@ class OrderController extends Controller
|
||||
$order->transaction_status = $order->transaction_status;
|
||||
$order->transaction_status_name = $transactionStatuses[$order->transaction_status];
|
||||
|
||||
$order->extends = [
|
||||
'cancel_remark' => $order->extends['cancel_remark'] ?? '',
|
||||
'refund_channel' => $order->extends['refund_channel'] ?? '',
|
||||
'refund_account' => $order->extends['refund_account'] ?? '',
|
||||
'refund_remark' => $order->extends['refund_remark'] ?? '',
|
||||
];
|
||||
|
||||
return res($order, '订单详情', 201);
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,13 @@ class OrderController extends Controller
|
||||
$order->transaction_status_name = $transactionStatuses[$order->transaction_status];
|
||||
$order->logistics_company_name = $logistics[$order->logistics_company] ?? '';
|
||||
|
||||
$order->extends = [
|
||||
'cancel_remark' => $order->extends['cancel_remark'] ?? '',
|
||||
'refund_channel' => $order->extends['refund_channel'] ?? '',
|
||||
'refund_account' => $order->extends['refund_account'] ?? '',
|
||||
'refund_remark' => $order->extends['refund_remark'] ?? '',
|
||||
];
|
||||
|
||||
return res($order, '订单详情', 201);
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,7 @@ class OrderService extends Service
|
||||
'address' => ['max:255'],
|
||||
'order_status' => ['in:0,1,2,3,4'],
|
||||
'transaction_status' => ['in:0,1,2'],
|
||||
'extends' => ['array'],
|
||||
];
|
||||
|
||||
$message = [
|
||||
@ -141,6 +142,8 @@ class OrderService extends Service
|
||||
throw new NotExistException('订单不存在或已删除');
|
||||
}
|
||||
|
||||
$node->extends = array_merge($node->extends, $attributes['extends']);
|
||||
|
||||
$this->orderRepository->setModel($node)->update($attributes);
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,10 @@ class Order extends Model
|
||||
{
|
||||
protected $table = 'virtual_orders';
|
||||
|
||||
protected $casts = [
|
||||
'extends' => 'array',
|
||||
];
|
||||
|
||||
public function cards()
|
||||
{
|
||||
return $this->hasMany(OrderCard::class, 'order_id', 'id');
|
||||
|
@ -35,9 +35,9 @@ class CreateVirtualOrdersTable extends Migration
|
||||
$table->string('logistics_no', 64)->default('')->comment('物流单号');
|
||||
$table->tinyInteger('order_status')->unsigned()->default(0)->after('mobile')->comment('订单状态(0:已下单 1:已取消 2:已出库 3:已发货 4:已签收)');
|
||||
$table->tinyInteger('transaction_status')->unsigned()->default(0)->after('order_status')->comment('收款状态(0:未收款 1:已收款 2:已退款)');
|
||||
$table->text('cancel_remark')->nullable()->comment('取消备注');
|
||||
$table->text('logistics_remark')->nullable()->comment('物流备注');
|
||||
$table->text('remark')->nullable()->comment('订单备注');
|
||||
$table->text('extends')->nullable()->comment('扩展信息(cancel_remark:取消备注 refund_channel:退款频道 refund_account:退款账号 refund_remark:退款备注)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTestsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tests', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('sn', 32)->default('')->comment('编号');
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['sn', 'deleted_at']);
|
||||
|
||||
$table->comment('测试');
|
||||
$table->setIncrement(100);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tests');
|
||||
}
|
||||
}
|
@ -60,6 +60,11 @@
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title" v-if="data.order_status === 1">取消理由:</div>
|
||||
<div class="ui-list-content">{{data.extends.cancel_remark}}</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">支付状态:</div>
|
||||
<div class="ui-list-content">
|
||||
@ -67,7 +72,17 @@
|
||||
<Button type="success" v-else>{{data.transaction_status_name}}</Button>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list" v-if="data.transaction_status === 2">
|
||||
<div class="ui-list-title">退款方式:</div>
|
||||
<div class="ui-list-content">{{data.extends.refund_channel}}</div>
|
||||
<div class="ui-list-title">退款账号:</div>
|
||||
<div class="ui-list-content">{{data.extends.refund_account}}</div>
|
||||
<div class="ui-list-title">退款备注:</div>
|
||||
<div class="ui-list-content">{{data.extends.refund_remark}}</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<Divider>物流信息</Divider>
|
||||
<ul>
|
||||
<li class="ui-list">
|
||||
|
@ -31,8 +31,13 @@ export default {
|
||||
cancel_remark: '',
|
||||
logistics: null,
|
||||
logisticsParams: {
|
||||
'logistics_company': '',
|
||||
'logistics_no': ''
|
||||
logistics_company: '',
|
||||
logistics_no: ''
|
||||
},
|
||||
refundParams: {
|
||||
channel: '',
|
||||
account: '',
|
||||
remark: ''
|
||||
},
|
||||
table_titles: [
|
||||
{
|
||||
@ -135,7 +140,7 @@ export default {
|
||||
if (this.haveJurisdiction('show')) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'success',
|
||||
type: 'dashed',
|
||||
size: 'small',
|
||||
disabled: false,
|
||||
icon: 'md-eye'
|
||||
@ -160,12 +165,13 @@ export default {
|
||||
|
||||
if (this.haveJurisdiction('update')) {
|
||||
// 未收款 -> 已收款
|
||||
if (row.transaction_status === 0) {
|
||||
if (row.transaction_status === 0 && row.order_status !== 1) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'error',
|
||||
type: 'success',
|
||||
size: 'small',
|
||||
disabled: false
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
@ -189,30 +195,100 @@ export default {
|
||||
}, '确认收款'));
|
||||
}
|
||||
|
||||
// 已收款 -> 已退款
|
||||
if (row.transaction_status === 1 && row.order_status < 2) {
|
||||
// 已收款 -> 已退款 (要先取消订单)
|
||||
if (row.transaction_status === 1 && row.order_status === 1) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'error',
|
||||
size: 'small',
|
||||
disabled: false
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: () => {
|
||||
this.$Modal.confirm({
|
||||
title: '提示',
|
||||
content: '请确认是否进行退款?',
|
||||
title: '请填写退款信息并确认',
|
||||
render: (h) => {
|
||||
let refundHtml = [];
|
||||
|
||||
let Options = [];
|
||||
Options.push(h('Option', { props: { key: 'bank', value: 'bank' } }, '银行转账'));
|
||||
Options.push(h('Option', { props: { key: 'alipay', value: 'alipay' } }, '支付宝转账'));
|
||||
|
||||
refundHtml.push(h('Select', {
|
||||
props: {
|
||||
value: this.refundParams.channel,
|
||||
placeholder: '请选择退款方式...'
|
||||
},
|
||||
class: ['umar-b10'],
|
||||
on: {
|
||||
'on-change': (val) => {
|
||||
this.refundParams.channel = val;
|
||||
}
|
||||
}
|
||||
}, Options));
|
||||
|
||||
refundHtml.push(h('Input', {
|
||||
props: {
|
||||
value: this.refundParams.account,
|
||||
autofocus: true,
|
||||
placeholder: '请输入退款账号...'
|
||||
},
|
||||
class: ['umar-b10'],
|
||||
on: {
|
||||
'input': (val) => {
|
||||
this.refundParams.account = val;
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
refundHtml.push(h('Input', {
|
||||
props: {
|
||||
value: this.refundParams.remark,
|
||||
autofocus: true,
|
||||
placeholder: '请输入退款备注...'
|
||||
},
|
||||
class: ['umar-b10'],
|
||||
on: {
|
||||
'input': (val) => {
|
||||
this.refundParams.remark = val;
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
return h('div', refundHtml);
|
||||
},
|
||||
onOk: () => {
|
||||
if (!this.refundParams.channel) {
|
||||
this.$Message.error('请选择退款方式');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.refundParams.account) {
|
||||
this.$Message.error('请输入退款账号');
|
||||
return;
|
||||
}
|
||||
|
||||
API.update({
|
||||
transaction_status: 2
|
||||
transaction_status: 2,
|
||||
extends: {
|
||||
refund_channel: this.refundParams.channel,
|
||||
refund_account: this.refundParams.account,
|
||||
refund_remark: this.refundParams.remark
|
||||
}
|
||||
}, row.id).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$Message.success('退款成功');
|
||||
this.$Message.success('修改成功');
|
||||
this.request();
|
||||
}
|
||||
|
||||
this.refundParams.channel = '';
|
||||
this.refundParams.account = '';
|
||||
this.refundParams.remark = '';
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -225,7 +301,8 @@ export default {
|
||||
props: {
|
||||
type: 'info',
|
||||
size: 'small',
|
||||
disabled: false
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
@ -236,7 +313,7 @@ export default {
|
||||
props: {
|
||||
value: this.cancel_remark,
|
||||
autofocus: true,
|
||||
placeholder: '请输入取消理由...'
|
||||
placeholder: '...'
|
||||
},
|
||||
on: {
|
||||
'input': (val) => {
|
||||
@ -245,17 +322,25 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
title: '提示',
|
||||
content: '是否确认取消订单?',
|
||||
title: '请输入取消理由',
|
||||
onOk: () => {
|
||||
if (!this.cancel_remark) {
|
||||
this.$Message.error('请输入取消理由');
|
||||
return;
|
||||
}
|
||||
|
||||
API.update({
|
||||
order_status: 1,
|
||||
cancel_remark: ''
|
||||
extends: {
|
||||
cancel_remark: this.cancel_remark
|
||||
}
|
||||
}, row.id).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$Message.success('取消成功');
|
||||
this.request();
|
||||
}
|
||||
|
||||
this.cancel_remark = '';
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -267,7 +352,8 @@ export default {
|
||||
props: {
|
||||
type: 'warning',
|
||||
size: 'small',
|
||||
disabled: false
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
@ -297,7 +383,8 @@ export default {
|
||||
props: {
|
||||
type: 'warning',
|
||||
size: 'small',
|
||||
disabled: false
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
@ -365,7 +452,8 @@ export default {
|
||||
props: {
|
||||
type: 'warning',
|
||||
size: 'small',
|
||||
disabled: false
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
|
2
public/js/app.f12ecf05.js
Normal file
2
public/js/app.f12ecf05.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.f12ecf05.js.map
Normal file
1
public/js/app.f12ecf05.js.map
Normal file
File diff suppressed because one or more lines are too long
2
public/js/chunk-6d306fd9.ac044022.js
Normal file
2
public/js/chunk-6d306fd9.ac044022.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/chunk-6d306fd9.ac044022.js.map
Normal file
1
public/js/chunk-6d306fd9.ac044022.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-6d306fd9.729cc3c7.css rel=prefetch><link href=/js/chunk-00ae0766.4cb97496.js rel=prefetch><link href=/js/chunk-6d306fd9.153bfc83.js rel=prefetch><link href=/css/app.36043160.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.725c2cac.js rel=preload as=script><link href=/js/chunk-vendors.02a4e5bc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.36043160.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.02a4e5bc.js></script><script src=/js/app.725c2cac.js></script></body></html>
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-6d306fd9.729cc3c7.css rel=prefetch><link href=/js/chunk-00ae0766.4cb97496.js rel=prefetch><link href=/js/chunk-6d306fd9.ac044022.js rel=prefetch><link href=/css/app.36043160.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.f12ecf05.js rel=preload as=script><link href=/js/chunk-vendors.02a4e5bc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.36043160.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.02a4e5bc.js></script><script src=/js/app.f12ecf05.js></script></body></html>
|
Loading…
x
Reference in New Issue
Block a user