排单
This commit is contained in:
parent
6573f3f28d
commit
00ca6bf95d
@ -80,9 +80,10 @@ class VdActivated extends Command
|
||||
$where = "WHERE {$table}.{$reference} = {$as}.{$reference}::int8";
|
||||
|
||||
$sql = trim("UPDATE {$table} SET {$updates} {$from} {$where}");
|
||||
$fixSimArray = implode(',', array_pluck($array, 'sim'));
|
||||
|
||||
DB::statement($sql);
|
||||
|
||||
$fixSimArray = implode(',', array_pluck($array, 'sim'));
|
||||
DB::statement("select fix_timelines('{{$fixSimArray}}'::INT8[]);");
|
||||
}
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ class OrderController extends Controller
|
||||
'transaction_status' => $item->transaction_status,
|
||||
'transaction_status_name' => $transactionStatuses[$item->transaction_status],
|
||||
'remark' => $item->remark ?? '',
|
||||
'order_at' => (string) $item->order_at,
|
||||
'deleted_at' => (string) $item->deleted_at,
|
||||
'order_at' => (string)$item->order_at,
|
||||
'deleted_at' => (string)$item->deleted_at,
|
||||
'area' => $item->area ?? [],
|
||||
'address' => $item->address ?? '',
|
||||
'contacts' => $item->contacts,
|
||||
@ -133,8 +133,8 @@ class OrderController extends Controller
|
||||
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
*/
|
||||
* 订单详情
|
||||
*/
|
||||
public function show(Dicts $dicts, $id)
|
||||
{
|
||||
if (!$order = app(OrderRepository::class)->find($id)) {
|
||||
@ -158,9 +158,9 @@ class OrderController extends Controller
|
||||
$order->order_status_name = $orderStatues[$order->order_status];
|
||||
$order->transaction_status_name = $transactionStatuses[$order->transaction_status];
|
||||
$order->logistics_company_name = $logistics[$order->logistics_company] ?? '';
|
||||
$order->unit_price = sprintf('%.02f', $order->unit_price/100);
|
||||
$order->total_price = sprintf('%.02f', $order->total_price/100);
|
||||
$order->custom_price = sprintf('%.02f', $order->custom_price/100);
|
||||
$order->unit_price = sprintf('%.02f', $order->unit_price / 100);
|
||||
$order->total_price = sprintf('%.02f', $order->total_price / 100);
|
||||
$order->custom_price = sprintf('%.02f', $order->custom_price / 100);
|
||||
|
||||
$order->extends = [
|
||||
'cancel_remark' => $order->extends['cancel_remark'] ?? '',
|
||||
@ -337,12 +337,32 @@ class OrderController extends Controller
|
||||
*/
|
||||
public function upgrade()
|
||||
{
|
||||
|
||||
|
||||
$attributes = $this->request->all();
|
||||
|
||||
$order = $this->orderService->upgrade($attributes);
|
||||
|
||||
return res($order, '修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 非销售订单排单
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function shipNotBase()
|
||||
{
|
||||
$orderId = $this->request->get('order_id');
|
||||
|
||||
$file = $this->request->file('file');
|
||||
$simArray = ImportService::load($file, ['sim']);
|
||||
$simArray = array_pluck($simArray, 'sim');
|
||||
|
||||
$simArray = array_map(function ($item) {
|
||||
return intval(trim(str_replace("\t", '', $item)));
|
||||
}, $simArray);
|
||||
|
||||
$order = $this->orderService->storeByOrder($orderId, $simArray);
|
||||
|
||||
return res($order, '排单成功');
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ $router->group(['prefix' => 'virtual', 'as' => 'virtual', 'middleware' => ['admi
|
||||
$router->get('/orders/cards', ['as' => 'orders.cards', 'uses' => 'OrderController@cards']);
|
||||
$router->get('/orders/cards-export', ['as' => 'orders.cardsExport', 'uses' => 'OrderController@cardsExport']);
|
||||
$router->post('/orders/ship', ['as' => 'orders.ship', 'uses' => 'OrderController@ship']);
|
||||
$router->post('/orders/ship-not-base', ['as' => 'orders.shipNotBase', 'uses' => 'OrderController@shipNotBase']);
|
||||
|
||||
// 客户管理
|
||||
$router->get('/cards/index', ['as' => 'cards.index', 'uses' => 'CardController@index']);
|
||||
|
@ -74,9 +74,9 @@ class OrderService extends Service
|
||||
$res->map(function ($item) use ($orderShipments) {
|
||||
$item->company = CompanyService::load($item->company_id);
|
||||
$item->package = PackageService::load($item->package_id);
|
||||
$item->unit_price = sprintf('%.02f', $item->unit_price/100);
|
||||
$item->total_price = sprintf('%.02f', $item->total_price/100);
|
||||
$item->custom_price = sprintf('%.02f', $item->custom_price/100);
|
||||
$item->unit_price = sprintf('%.02f', $item->unit_price / 100);
|
||||
$item->total_price = sprintf('%.02f', $item->total_price / 100);
|
||||
$item->custom_price = sprintf('%.02f', $item->custom_price / 100);
|
||||
$item->refunds = $orderShipments[$item->id]['refunds'] ?? 0;
|
||||
$item->shipments = isset($orderShipments[$item->id]) ? $orderShipments[$item->id]['counts'] - $orderShipments[$item->id]['refunds'] : 0;
|
||||
});
|
||||
@ -101,9 +101,9 @@ class OrderService extends Service
|
||||
$res = $this->orderRepository->select($select)->withConditions($conditions)->applyConditions()->first()->toArray();
|
||||
|
||||
$res['total_price'] = $res['total_price'] ?? 0;
|
||||
$res['total_price'] = sprintf('%.02f', $res['total_price']/100);
|
||||
$res['total_price'] = sprintf('%.02f', $res['total_price'] / 100);
|
||||
$res['transacted_price'] = $res['transacted_price'] ?? 0;
|
||||
$res['transacted_price'] = sprintf('%.02f', $res['transacted_price']/100);
|
||||
$res['transacted_price'] = sprintf('%.02f', $res['transacted_price'] / 100);
|
||||
unset($res['company']);
|
||||
unset($res['package']);
|
||||
|
||||
@ -584,16 +584,16 @@ class OrderService extends Service
|
||||
|
||||
foreach ($res as $card) {
|
||||
$orderCards[] = [
|
||||
'type' => $attributes['type'],
|
||||
'sim' => $card->sim,
|
||||
'order_id' => $orderId,
|
||||
'company_id' => $attributes['company_id'],
|
||||
'package_id' => $product['package_id'],
|
||||
'counts' => $cardCounts[$card->sim],
|
||||
'unit_price' => $product['price'],
|
||||
'created_at' => $order_at,
|
||||
'updated_at' => $order_at,
|
||||
];
|
||||
'type' => $attributes['type'],
|
||||
'sim' => $card->sim,
|
||||
'order_id' => $orderId,
|
||||
'company_id' => $attributes['company_id'],
|
||||
'package_id' => $product['package_id'],
|
||||
'counts' => $cardCounts[$card->sim],
|
||||
'unit_price' => $product['price'],
|
||||
'created_at' => $order_at,
|
||||
'updated_at' => $order_at,
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@ -604,6 +604,8 @@ class OrderService extends Service
|
||||
|
||||
$table = $this->tables[$attributes['type']];
|
||||
DB::table($table)->upsert($orderCards, ['sim', 'order_id', 'refunded_at', 'deleted_at']);
|
||||
$fixSimArray = implode(',', $simArray);
|
||||
DB::statement("select fix_timelines('{{$fixSimArray}}'::INT8[]);");
|
||||
} catch (\Exception $e) {
|
||||
DB::rollback();
|
||||
throw $e;
|
||||
@ -617,6 +619,84 @@ class OrderService extends Service
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对续费订单以卡的方式排单
|
||||
*
|
||||
* @param integer $orderId
|
||||
* @param array $simArray
|
||||
* @return void
|
||||
*/
|
||||
public function storeByOrder(int $orderId, array $simArray): Order
|
||||
{
|
||||
if (!$order = $this->orderRepository->find($orderId)) {
|
||||
throw new NotExistException('订单不存在或已删除');
|
||||
}
|
||||
|
||||
if ($order->type == 0) {
|
||||
throw new NotAllowedException("不支持销售订单");
|
||||
}
|
||||
|
||||
$orderShipments = $this->orderCardPartitionRepository->select([
|
||||
'order_id',
|
||||
'sim',
|
||||
'counts',
|
||||
])->withConditions(['order_id' => $orderId])->get();
|
||||
|
||||
$shipments = array_sum(array_pluck($orderShipments, 'counts'));
|
||||
|
||||
if ($order->counts - $shipments != count($simArray)) {
|
||||
throw new NotAllowedException("排单数量不正确");
|
||||
}
|
||||
|
||||
$res = $this->orderCardPartitionRepository->selectRaw('distinct on (sim) *')
|
||||
->withConditions(['sim' => array_unique($simArray)])->orderBy('sim')->orderBy('created_at', 'desc')->get();
|
||||
|
||||
$errors = [];
|
||||
foreach ($res as $card) {
|
||||
if ($card->company_id !== $order['company_id']) {
|
||||
$errors[] = $card->sim;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($errors)) {
|
||||
$message = sprintf('卡(%s)不属于您的企业', implode(',', $errors));
|
||||
throw new InvalidArgumentException($message);
|
||||
}
|
||||
|
||||
$errors = array_diff($simArray, $res->pluck('sim')->toArray());
|
||||
|
||||
if (!empty($errors)) {
|
||||
$message = sprintf('卡(%s)未找到销售订单', implode(',', $errors));
|
||||
throw new InvalidArgumentException($message);
|
||||
}
|
||||
|
||||
$cards = array_count_values($simArray);
|
||||
$orderShipments = $orderShipments->keyBy('sim');
|
||||
|
||||
$orderCards = [];
|
||||
foreach ($res as $card) {
|
||||
$orderCards[] = [
|
||||
'type' => $order['type'],
|
||||
'sim' => $card->sim,
|
||||
'order_id' => $orderId,
|
||||
'company_id' => $order['company_id'],
|
||||
'package_id' => $order['package_id'],
|
||||
'counts' => isset($orderShipments[$card->sim]) ? $orderShipments[$card->sim] + $cards[$card->sim] : $cards[$card->sim],
|
||||
'unit_price' => $order['unit_price'],
|
||||
'created_at' => $order->order_at,
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
};
|
||||
|
||||
$table = $this->tables[$order['type']];
|
||||
DB::table($table)->upsert($orderCards, ['sim', 'order_id', 'refunded_at', 'deleted_at']);
|
||||
$fixSimArray = implode(',', $simArray);
|
||||
DB::statement("select fix_timelines('{{$fixSimArray}}'::INT8[]);");
|
||||
app(OrderCardPartitionRepository::class)->forgetCached();
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* 不在
|
||||
*
|
||||
@ -624,8 +704,7 @@ class OrderService extends Service
|
||||
* @return void
|
||||
*/
|
||||
public function storeWhenNotIn(array $attributes)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
@ -749,7 +828,7 @@ class OrderService extends Service
|
||||
*/
|
||||
public function generateSn()
|
||||
{
|
||||
return date('YmdHis') .sprintf('%04d', explode('.', microtime(true))[1]) . sprintf('%02d', rand(0, 99));
|
||||
return date('YmdHis') . sprintf('%04d', explode('.', microtime(true))[1]) . sprintf('%02d', rand(0, 99));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -769,7 +848,7 @@ class OrderService extends Service
|
||||
case 'wx_pub_scan':
|
||||
case 'wx_wap':
|
||||
case 'wx_lite':
|
||||
$transactionNo = '4200000' . sprintf('%03d', rand(0, 999)) . date('YmdHis') .sprintf('%04d', explode('.', microtime(true))[1]);
|
||||
$transactionNo = '4200000' . sprintf('%03d', rand(0, 999)) . date('YmdHis') . sprintf('%04d', explode('.', microtime(true))[1]);
|
||||
break;
|
||||
case 'alipay':
|
||||
case 'alipay_wap':
|
||||
@ -789,7 +868,7 @@ class OrderService extends Service
|
||||
break;
|
||||
|
||||
default:
|
||||
$transactionNo = date('YmdHis') . sprintf('%04d', explode('.', microtime(true))[1]) . '0' . sprintf('%9d', rand(0, 999999999));
|
||||
$transactionNo = date('YmdHis') . sprintf('%04d', explode('.', microtime(true))[1]) . '0' . sprintf('%9d', rand(0, 999999999));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function index(data) {
|
||||
return service.get('api/virtual/orders/index', {
|
||||
return service.get("api/virtual/orders/index", {
|
||||
params: data
|
||||
});
|
||||
}
|
||||
@ -19,7 +19,7 @@ export function index(data) {
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function exportOrders(data) {
|
||||
return service.get('api/virtual/orders/export', {
|
||||
return service.get("api/virtual/orders/export", {
|
||||
params: data
|
||||
});
|
||||
}
|
||||
@ -39,7 +39,7 @@ export function show(id) {
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function cards(data) {
|
||||
return service.get('api/virtual/orders/cards', {
|
||||
return service.get("api/virtual/orders/cards", {
|
||||
params: data
|
||||
});
|
||||
}
|
||||
@ -50,7 +50,7 @@ export function cards(data) {
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function cardsExport(data) {
|
||||
return service.get('api/virtual/orders/cards-export', {
|
||||
return service.get("api/virtual/orders/cards-export", {
|
||||
params: data
|
||||
});
|
||||
}
|
||||
@ -60,7 +60,7 @@ export function cardsExport(data) {
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function create(data) {
|
||||
return serviceForm.post('api/virtual/orders/create', data);
|
||||
return serviceForm.post("api/virtual/orders/create", data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +79,7 @@ export function update(data, id) {
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function destroy(data) {
|
||||
return service.post('api/virtual/orders/destroy', data);
|
||||
return service.post("api/virtual/orders/destroy", data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,7 +88,7 @@ export function destroy(data) {
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function reset(data) {
|
||||
return service.post('api/virtual/orders/reset', data);
|
||||
return service.post("api/virtual/orders/reset", data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,12 +111,38 @@ export function ship(data) {
|
||||
|
||||
config = {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
};
|
||||
} else {
|
||||
params = data;
|
||||
}
|
||||
|
||||
return service.post('api/virtual/orders/ship', params, config);
|
||||
return service.post("api/virtual/orders/ship", params, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* [shipNotBase 非销售订单排单]
|
||||
* @param {[type]} data [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function shipNotBase(data) {
|
||||
let config = {};
|
||||
let params = null;
|
||||
|
||||
params = new FormData();
|
||||
|
||||
for (const key in data) {
|
||||
if (data.hasOwnProperty(key)) {
|
||||
params.append(key, data[key]);
|
||||
}
|
||||
}
|
||||
|
||||
config = {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
};
|
||||
|
||||
return service.post("api/virtual/orders/ship-not-base", params, config);
|
||||
}
|
||||
|
@ -196,6 +196,12 @@
|
||||
|
||||
<ui-ship :data="shipObj.data" :show.sync="shipObj.show" @update-success="handleOrderSuccess(1)"></ui-ship>
|
||||
|
||||
<ui-ship-not-base
|
||||
:data="shipNotBaseObj.data"
|
||||
:show.sync="shipNotBaseObj.show"
|
||||
@update-success="handleOrderSuccess(1)"
|
||||
></ui-ship-not-base>
|
||||
|
||||
<Modal v-model="orderConfirmShow" width="360">
|
||||
<p slot="header" style="color:#f60;text-align:center">
|
||||
<Icon type="ios-information-circle"></Icon>
|
||||
@ -215,6 +221,22 @@
|
||||
</Row>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
<Modal v-model="orderShipConfirmShow" width="360" title="排单操作">
|
||||
<div style="text-align:center">
|
||||
<p>请选择您要进行的操作</p>
|
||||
</div>
|
||||
<div slot="footer">
|
||||
<Row class="ta-c" :gutter="2">
|
||||
<Col span="12">
|
||||
<Button type="primary" long @click="orderShipNotBase(0)">RD排单</Button>
|
||||
</Col>
|
||||
<Col span="12">
|
||||
<Button type="warning" long @click="orderShipNotBase(1)">导表排单</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -6,7 +6,9 @@ export default {
|
||||
UiEdit: resolve => require(["views/virtual/orders/edit"], resolve),
|
||||
UiDetail: resolve => require(["views/virtual/orders/detail"], resolve),
|
||||
UiCards: resolve => require(["views/virtual/orders/cards"], resolve),
|
||||
UiShip: resolve => require(["views/virtual/orders/ship"], resolve)
|
||||
UiShip: resolve => require(["views/virtual/orders/ship"], resolve),
|
||||
UiShipNotBase: resolve =>
|
||||
require(["views/virtual/orders/ship_not_base"], resolve)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -49,11 +51,16 @@ export default {
|
||||
show: false,
|
||||
data: null
|
||||
},
|
||||
shipNotBaseObj: {
|
||||
show: false,
|
||||
data: null
|
||||
},
|
||||
search: {
|
||||
show: true
|
||||
},
|
||||
row: {}, // 当前行
|
||||
orderConfirmShow: false,
|
||||
orderShipConfirmShow: false,
|
||||
cancel_remark: "",
|
||||
logistics: null,
|
||||
logisticsParams: {
|
||||
@ -701,7 +708,12 @@ export default {
|
||||
class: ["btn"],
|
||||
on: {
|
||||
click: () => {
|
||||
this.openCards(true, 2, row);
|
||||
if (this.type === 0) {
|
||||
this.openCards(true, 2, row);
|
||||
} else {
|
||||
this.row = row;
|
||||
this.orderShipConfirmShow = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -914,7 +926,7 @@ export default {
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
openEdit(bool, source, data = null) {
|
||||
console.log('source', source);
|
||||
console.log("source", source);
|
||||
this.editObj = {
|
||||
show: bool,
|
||||
source,
|
||||
@ -928,7 +940,7 @@ export default {
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
openCards(bool, source, orderObj = {}) {
|
||||
console.log('source', source);
|
||||
console.log("source", source);
|
||||
this.cardsObj = {
|
||||
show: bool,
|
||||
source,
|
||||
@ -1042,11 +1054,29 @@ export default {
|
||||
data: row
|
||||
};
|
||||
},
|
||||
// 非销售订单排单
|
||||
orderShipNotBase(type) {
|
||||
let row = this.row;
|
||||
|
||||
if (type === 0) {
|
||||
this.openCards(true, 2, row);
|
||||
} else {
|
||||
console.log(row);
|
||||
|
||||
this.shipNotBaseObj = {
|
||||
show: true,
|
||||
data: row
|
||||
};
|
||||
}
|
||||
|
||||
this.orderShipConfirmShow = false;
|
||||
},
|
||||
handleOrderSuccess(value) {
|
||||
let page = value ? this.list_data.current_page : 1;
|
||||
this.cardsObj.show = false;
|
||||
this.editObj.show = false;
|
||||
this.shipObj.show = false;
|
||||
this.shipNotBaseObj.show = false;
|
||||
this.orderConfirmShow = false;
|
||||
this.$store.dispatch("initOrder");
|
||||
this.index(page);
|
||||
|
@ -1,633 +0,0 @@
|
||||
import * as API from 'api/virtual/orders';
|
||||
import * as CONFIGS from 'api/virtual/configs';
|
||||
export default {
|
||||
name: 'Orders',
|
||||
components: {
|
||||
UiEdit: resolve => require(['views/virtual/orders/edit'], resolve),
|
||||
UiDetail: resolve => require(['views/virtual/orders/detail'], resolve),
|
||||
UiCards: resolve => require(['views/virtual/orders/cards'], resolve)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
params: {
|
||||
type: 0,
|
||||
sn: '',
|
||||
company_name: '',
|
||||
package_name: '',
|
||||
order_status: '',
|
||||
carrier_operator: '',
|
||||
time: []
|
||||
},
|
||||
type: 0,
|
||||
list_data: null,
|
||||
editObj: {
|
||||
show: false,
|
||||
data: null
|
||||
},
|
||||
detailObj: {
|
||||
show: false,
|
||||
data: null
|
||||
},
|
||||
cardsObj: {
|
||||
show: false
|
||||
},
|
||||
search: {
|
||||
show: false
|
||||
},
|
||||
cancel_remark: '',
|
||||
logistics: null,
|
||||
logisticsParams: {
|
||||
logistics_company: '',
|
||||
logistics_no: ''
|
||||
},
|
||||
refundParams: {
|
||||
channel: '',
|
||||
account: '',
|
||||
remark: ''
|
||||
},
|
||||
table_titles: [
|
||||
{
|
||||
title: '订单编号',
|
||||
key: 'sn',
|
||||
width: 230
|
||||
},
|
||||
{
|
||||
title: '企业名称',
|
||||
key: 'company_name',
|
||||
width: 275
|
||||
},
|
||||
{
|
||||
title: '运营商',
|
||||
key: 'carrier_operator',
|
||||
width: 75
|
||||
},
|
||||
{
|
||||
title: '套餐名称',
|
||||
key: 'package_name',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '套餐单价',
|
||||
key: 'unit_price',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '订单数量',
|
||||
key: '',
|
||||
width: 90,
|
||||
render: (h, {
|
||||
row,
|
||||
column,
|
||||
index
|
||||
}) => {
|
||||
return h('span', Number(row.counts));
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '订单金额',
|
||||
key: 'custom_price',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '订单状态',
|
||||
key: '',
|
||||
width: 100,
|
||||
render: (h, {
|
||||
row,
|
||||
column,
|
||||
index
|
||||
}) => {
|
||||
let status = ['error', 'default', 'warning', 'primary', 'success'];
|
||||
|
||||
return h('Tag', {
|
||||
props: {
|
||||
color: status[row.order_status]
|
||||
}
|
||||
}, row.order_status_name);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '收款状态',
|
||||
key: '',
|
||||
width: 100,
|
||||
render: (h, {
|
||||
row,
|
||||
column,
|
||||
index
|
||||
}) => {
|
||||
let status = ['error', 'success', 'default'];
|
||||
|
||||
return h('Tag', {
|
||||
props: {
|
||||
color: status[row.transaction_status]
|
||||
}
|
||||
}, row.transaction_status_name);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '下单时间',
|
||||
key: 'order_at',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 360,
|
||||
render: (h, {
|
||||
row,
|
||||
column,
|
||||
index
|
||||
}) => {
|
||||
let html = [];
|
||||
|
||||
if (row.deleted_at) {
|
||||
return h('Tag', {
|
||||
props: {
|
||||
color: 'default'
|
||||
}
|
||||
}, '该订单已被删除');
|
||||
}
|
||||
|
||||
if (this.haveJurisdiction('show')) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'dashed',
|
||||
size: 'small',
|
||||
disabled: false,
|
||||
icon: 'md-eye'
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: (event) => {
|
||||
this.show(row);
|
||||
}
|
||||
}
|
||||
}, '查看'));
|
||||
}
|
||||
|
||||
if (this.haveJurisdiction('update')) {
|
||||
// 排单
|
||||
if (row.shipments !== row.counts) {
|
||||
html.push(h('Tooltip', {
|
||||
props: {
|
||||
content: '已排单' + row.shipments + '张'
|
||||
},
|
||||
class: ['umar-r5']
|
||||
}, [h('Button', {
|
||||
props: {
|
||||
type: 'error',
|
||||
size: 'small'
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: () => {
|
||||
this.openCards(true, 2);
|
||||
}
|
||||
}
|
||||
}, '排单')]));
|
||||
}
|
||||
|
||||
// 未收款 -> 已收款
|
||||
if (row.transaction_status === 0) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'success',
|
||||
size: 'small',
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: () => {
|
||||
this.$Modal.confirm({
|
||||
title: '提示',
|
||||
content: '请确认是否已收款?',
|
||||
onOk: () => {
|
||||
API.update({
|
||||
transaction_status: 1
|
||||
}, row.id).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$Message.success('修改成功');
|
||||
this.request();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, '确认收款'));
|
||||
}
|
||||
|
||||
// 已收款 -> 已退款 (要先取消订单)
|
||||
if (row.transaction_status === 1 && row.order_status === 1) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'error',
|
||||
size: 'small',
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: () => {
|
||||
this.$Modal.confirm({
|
||||
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,
|
||||
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.request();
|
||||
}
|
||||
|
||||
this.refundParams.channel = '';
|
||||
this.refundParams.account = '';
|
||||
this.refundParams.remark = '';
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}, '确认退款'));
|
||||
}
|
||||
|
||||
// 已下单 -> 取消订单 | 出库
|
||||
if (row.order_status === 0) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'info',
|
||||
size: 'small',
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: () => {
|
||||
this.$Modal.confirm({
|
||||
render: (h) => {
|
||||
return h('Input', {
|
||||
props: {
|
||||
value: this.cancel_remark,
|
||||
autofocus: true,
|
||||
placeholder: '...'
|
||||
},
|
||||
on: {
|
||||
'input': (val) => {
|
||||
this.cancel_remark = val;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
title: '请输入取消理由',
|
||||
onOk: () => {
|
||||
if (!this.cancel_remark) {
|
||||
this.$Message.error('请输入取消理由');
|
||||
return;
|
||||
}
|
||||
|
||||
API.update({
|
||||
order_status: 1,
|
||||
extends: {
|
||||
cancel_remark: this.cancel_remark
|
||||
}
|
||||
}, row.id).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$Message.success('取消成功');
|
||||
this.request();
|
||||
}
|
||||
|
||||
this.cancel_remark = '';
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, '取消订单'));
|
||||
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'warning',
|
||||
size: 'small',
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: () => {
|
||||
this.$Modal.confirm({
|
||||
title: '提示',
|
||||
content: '请确认订单是否已出库?',
|
||||
onOk: () => {
|
||||
API.update({
|
||||
order_status: 2
|
||||
}, row.id).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$Message.success('修改成功');
|
||||
this.request();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, '确认出库'));
|
||||
}
|
||||
|
||||
// 已出库 -> 已发货
|
||||
if (row.order_status === 2) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'warning',
|
||||
size: 'small',
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: () => {
|
||||
this.getLogistics().then(logistics => {
|
||||
this.$Modal.confirm({
|
||||
title: '请填写发货信息',
|
||||
render: (h) => {
|
||||
let Options = [];
|
||||
for (const key in logistics) {
|
||||
Options.push(h('Option', {
|
||||
props: {
|
||||
key: key,
|
||||
value: key
|
||||
}
|
||||
}, logistics[key]));
|
||||
}
|
||||
|
||||
let Select = h('Select', {
|
||||
props: {
|
||||
value: this.logisticsParams.logistics_company,
|
||||
placeholder: '请选择快递公司...'
|
||||
},
|
||||
class: ['umar-b10'],
|
||||
on: {
|
||||
'on-change': (val) => {
|
||||
this.logisticsParams.logistics_company = val;
|
||||
}
|
||||
}
|
||||
}, Options);
|
||||
|
||||
let Input = h('Input', {
|
||||
props: {
|
||||
value: this.logisticsParams.logistics_no,
|
||||
autofocus: true,
|
||||
placeholder: '请输入快递单号...'
|
||||
},
|
||||
on: {
|
||||
'input': (val) => {
|
||||
this.logisticsParams.logistics_no = val;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return h('div', [Select, Input]);
|
||||
},
|
||||
onOk: () => {
|
||||
API.update({
|
||||
order_status: 3,
|
||||
logistics_company: this.logisticsParams.logistics_company,
|
||||
logistics_no: this.logisticsParams.logistics_no
|
||||
}, row.id).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$Message.success('修改成功');
|
||||
this.request();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}, '订单发货'));
|
||||
}
|
||||
|
||||
// 已发货 -> 已签收
|
||||
if (row.order_status === 3) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'warning',
|
||||
size: 'small',
|
||||
disabled: false,
|
||||
ghost: true
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: () => {
|
||||
this.$Modal.confirm({
|
||||
title: '提示',
|
||||
content: '请确认订单是否确认签收?',
|
||||
onOk: () => {
|
||||
API.update({
|
||||
order_status: 4
|
||||
}, row.id).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$Message.success('修改成功');
|
||||
this.request();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, '确认签收'));
|
||||
}
|
||||
}
|
||||
|
||||
if (html.length) {
|
||||
return h('div', html);
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.index(1);
|
||||
},
|
||||
methods: {
|
||||
// 查看订单明细
|
||||
show(row) {
|
||||
this.isShowLoading(true);
|
||||
API.show(row.id).then(res => {
|
||||
this.isShowLoading(false);
|
||||
if (res.code === 0) {
|
||||
this.detailObj = {
|
||||
show: true,
|
||||
data: res.data
|
||||
};
|
||||
}
|
||||
}).catch(() => {
|
||||
this.isShowLoading(false);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* [index 列表]
|
||||
* @param {Number} page [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
index(page = 1) {
|
||||
this.type = Number(this.$route.params.type);
|
||||
this.params.type = Number(this.$route.params.type);
|
||||
let data = this.searchDataHandle({}, {
|
||||
page
|
||||
}, this.params);
|
||||
this.isShowLoading(true);
|
||||
API.index(data).then(res => {
|
||||
this.isShowLoading(false);
|
||||
if (res.code == 0) {
|
||||
this.list_data = res.data;
|
||||
}
|
||||
}).catch(() => {
|
||||
this.isShowLoading(false);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* [openEdit 打开编辑弹窗]
|
||||
* source 0:从创建订单按钮打开 1:从选卡页面打开
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
openEdit(bool, source, data = null) {
|
||||
this.editObj = {
|
||||
show: bool,
|
||||
source,
|
||||
data
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* [openCards 打开选卡弹窗]
|
||||
* source 0:选创建订单页面打开 1:从选卡按钮打开 2:从排单按钮打开
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
openCards(bool, source) {
|
||||
this.cardsObj = {
|
||||
show: bool,
|
||||
source
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* [request 刷新]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
request() {
|
||||
const result = this.list_data;
|
||||
let page = result.current_page;
|
||||
|
||||
if (result && result.data.length == 1) {
|
||||
page = this.returnPage(result.total, result.current_page, result.per_page);
|
||||
}
|
||||
|
||||
this.index(page);
|
||||
},
|
||||
|
||||
resetSearch() {
|
||||
for (let k in this.params) {
|
||||
if (k === 'time') {
|
||||
this.params[k] = [];
|
||||
} else {
|
||||
this.params[k] = '';
|
||||
}
|
||||
}
|
||||
this.index(1);
|
||||
},
|
||||
getLogistics() {
|
||||
return new Promise(resolve => {
|
||||
if (this.logistics) {
|
||||
resolve(this.logistics);
|
||||
} else {
|
||||
CONFIGS.get('logistics').then(res => {
|
||||
if (res.code === 0) {
|
||||
this.logistics = res.data;
|
||||
}
|
||||
resolve(this.logistics);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
72
frontend/src/views/virtual/orders/js/ship_not_base.js
Normal file
72
frontend/src/views/virtual/orders/js/ship_not_base.js
Normal file
@ -0,0 +1,72 @@
|
||||
import * as API from "api/virtual/orders";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
source: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
my_show: false,
|
||||
loading: false,
|
||||
params: {},
|
||||
file: null
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
show(bool) {
|
||||
this.my_show = bool;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
ok() {
|
||||
let params = {};
|
||||
params.order_id = this.data.id;
|
||||
|
||||
if (this.file === null) {
|
||||
return this.$Message.error("请上传文件");
|
||||
}
|
||||
|
||||
params.file = this.file;
|
||||
|
||||
this.$Modal.confirm({
|
||||
title: "提示",
|
||||
content: "请确认是否提交排单?",
|
||||
onOk: () => {
|
||||
this.loading = true;
|
||||
API.shipNotBase(params).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$Message.success("修改成功");
|
||||
this.$emit("update-success");
|
||||
this.clear();
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
selectFile(file) {
|
||||
this.file = file;
|
||||
return false;
|
||||
},
|
||||
visibleChange(bool) {
|
||||
if (!bool) {
|
||||
this.$emit("update:show", false);
|
||||
}
|
||||
},
|
||||
clear() {
|
||||
this.file = null;
|
||||
this.my_show = false;
|
||||
}
|
||||
}
|
||||
};
|
54
frontend/src/views/virtual/orders/ship_not_base.vue
Normal file
54
frontend/src/views/virtual/orders/ship_not_base.vue
Normal file
@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<Modal
|
||||
:closable="false"
|
||||
:mask-closable="false"
|
||||
:title="'导表排单'"
|
||||
@on-visible-change="visibleChange"
|
||||
v-model="my_show"
|
||||
>
|
||||
<div class="page-edit-wrap uinn-lr20">
|
||||
<ui-loading :show="loading"></ui-loading>
|
||||
|
||||
<ul>
|
||||
<li class="ui-list" v-if="data !== null">
|
||||
<div class="ui-list-title">订单编号:</div>
|
||||
<div class="ui-list-content">
|
||||
<span class="lh-32">{{data.sn}}</span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">文件导入</div>
|
||||
<div class="ui-list-content">
|
||||
<Upload
|
||||
:before-upload="selectFile"
|
||||
action="/"
|
||||
:format="['xls','xlsx','csv']"
|
||||
class="f-l"
|
||||
>
|
||||
<Button icon="ios-cloud-upload-outline">选择文件</Button>
|
||||
</Upload>
|
||||
<a
|
||||
:href="CONFIG.url + 'storage/templates/ship-cards.xls'"
|
||||
download="排单模板.xls"
|
||||
class="fz-12 lh-32 umar-l10"
|
||||
>下载导入模板</a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list" v-if="file !== null">
|
||||
<div class="ui-list-title">已选文件</div>
|
||||
<div class="ui-list-content">
|
||||
<span class="lh-32">{{file.name}}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<footer class="ta-c" slot="footer">
|
||||
<Button @click="clear" class="w-80 umar-r5" ghost type="primary">取消</Button>
|
||||
<Button :loading="loading" @click="ok" class="w-80" type="primary">确定</Button>
|
||||
</footer>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
<script src="./js/ship_not_base.js"></script>
|
2
public/css/chunk-61be388a.e222bb72.css
Normal file
2
public/css/chunk-61be388a.e222bb72.css
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.73952546.js
Normal file
1
public/js/app.73952546.js
Normal file
File diff suppressed because one or more lines are too long
14
public/js/chunk-61be388a.d5313b5f.js
Normal file
14
public/js/chunk-61be388a.d5313b5f.js
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-6ea47298.6166dab5.css rel=prefetch><link href=/css/chunk-8064e07e.03f6c57e.css rel=prefetch><link href=/js/chunk-00ae0766.d130b440.js rel=prefetch><link href=/js/chunk-07a274ec.55e1b3b0.js rel=prefetch><link href=/js/chunk-6ea47298.b6a301d0.js rel=prefetch><link href=/js/chunk-8064e07e.a04adc74.js rel=prefetch><link href=/css/app.be09e36f.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.41b5a797.js rel=preload as=script><link href=/js/chunk-vendors.f1169dcc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.be09e36f.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.f1169dcc.js></script><script src=/js/app.41b5a797.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-61be388a.e222bb72.css rel=prefetch><link href=/css/chunk-6ea47298.6166dab5.css rel=prefetch><link href=/js/chunk-00ae0766.d130b440.js rel=prefetch><link href=/js/chunk-07a274ec.55e1b3b0.js rel=prefetch><link href=/js/chunk-61be388a.d5313b5f.js rel=prefetch><link href=/js/chunk-6ea47298.b6a301d0.js rel=prefetch><link href=/css/app.be09e36f.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.73952546.js rel=preload as=script><link href=/js/chunk-vendors.f1169dcc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.be09e36f.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.f1169dcc.js></script><script src=/js/app.73952546.js></script></body></html>
|
Loading…
x
Reference in New Issue
Block a user