Compare commits

..

No commits in common. "ab3df41fe5a1d89734ba28d81197125d7a903af4" and "5e1fa05c64d28d9e9d53312b5c2ccf70b94aafca" have entirely different histories.

9 changed files with 5 additions and 133 deletions

View File

@ -74,17 +74,12 @@
<el-table-column align="center" fixed width="200" label="操作">
<template slot-scope="scope">
<el-button-group>
<el-button :type="scope.row.backs&&scope.row.backs.status==0? types[7] : types[4]" size="small" icon="el-icon-refresh" @click="onCirculation(scope.row)">
{{ scope.row.backs&&scope.row.backs.status==0?'流转中':'流转出' }}
</el-button>
<el-button :type="types[scope.row.order_status]" size="small" icon="el-icon-edit" @click="onInfo(scope.row)">
跟进
</el-button>
<el-button size="small" icon="el-icon-thumb" @click="onOneClickRepair(scope.row)">
同步
</el-button>
</el-button-group>
</template>
</el-table-column>
@ -602,22 +597,6 @@ export default {
}
}).catch(() => {
})
},
onOneClickRepair(item) {
this.$axios.post('/admin/order/oneClickRepair', { id: item.id}).then(res => {
this.dialogVisible = false
this.$notify({
title: '成功',
message: '同步完成',
type: 'success'
});
this.getList()
}).catch(err => {
this.$notify.error({
title: "错误",
message: err
})
})
}
}
}

View File

@ -7,7 +7,6 @@ use app\model\Backs;
use app\model\Follows;
use app\model\Orders;
use app\model\Logs;
use app\server\Orders as ServerOrders;
use stdClass;
use support\Log;
use support\Redis;
@ -505,35 +504,4 @@ class OrderController extends base
}
}
/**
* 一键修复订单问题
* @param Request $request
* @return \support\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function oneClickRepair(Request $request)
{
$id = $request->post('id', 0);
$order = Orders::where('id', $id)->find();
if(empty($order)) {
return $this->error(2004, '记录没有找到.');
}
try {
$flow = [];
// 订单是待使用状态,先同步第三方状态
if (ServerOrders::isDaishiyong($order)) {
ServerOrders::syncFromThird($order);
$flow[] = "订单为待使用状态,已请求第三方进行同步。";
}
return $this->success(implode("\n", $flow));
}catch(\Exception $e) {
return $this->error(2006, '出错了:' . $e->getMessage());
}
}
}

View File

@ -4,21 +4,11 @@ namespace app\server;
use app\common\Error;
use app\model\Admins as AdminsModel;
use app\model\Finances as FinancesModel;
use app\model\Orders as OrdersModel;
use support\Log;
use support\Redis;
class Orders {
public static function isDaishiyong(OrdersModel $order): bool
{
// 根据 OrdersModel::AllOssStatusSql[1] 进行判断
// ((os=1 and order_status=3) or (os=2 and order_status=4) or (os=3 and order_status=1))
return $order->os == 1 && $order->order_status == 3
|| $order->os == 2 && $order->order_status == 4
|| $order->os == 3 && $order->order_status == 1;
}
/**
* @params []OrdersModel $order
* @return array
@ -78,69 +68,4 @@ class Orders {
return count($orders) > 1 ? $result : reset($result);
}
public static function syncFromThird(OrdersModel $order)
{
$got = null;
switch ($order->os) {
case 1:
$mt = new Meituan();
$it = $mt->get(1, null, null, $order->sn);
if ($it) {
$got = $it[0];
}
break;
case 3:
$dy = new Douyin();
$it = $dy->get(1, null, null, $order->sn);
if ($it) {
$got = $it[0];
}
break;
}
if (is_null($got)) {
Log::info(__METHOD__ . ": get from os is null", [$order]);
return;
}
$back = $order->save($got);
if ($back) {
self::finance(0, $order->id, $order->asset_price);
}
return 0;
}
public static function finance($type = 1, $order_id = 0, $price = 0)
{
//总的关于这个订单的金额
$total = FinancesModel::where('order_id', $order_id)->sum('total');
//如果总金额大于提交上来的核销金额,那就是退费的
//如果提交上来的金额小于总金额,那就是核销的
if ($total > $price) {
$type = 2;
$fee = -($total - $price);
} elseif ($total < $price) {
$type = 1;
$fee = $price - $total;
} else {
return;
}
FinancesModel::create([
'order_id' => $order_id,
'type' => $type,
'total' => $fee,
'status' => 1
]);
return;
}
}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
.pagination-container[data-v-28fdfbeb]{padding:32px 16px;position:fixed;bottom:0;left:0;width:100%;background:#fff;padding:40px 280px;-webkit-box-shadow:0 -2px 10px rgba(0,0,0,.1);box-shadow:0 -2px 10px rgba(0,0,0,.1);z-index:100}.pagination-container.hidden[data-v-28fdfbeb]{display:none}.app-container[data-v-a256f162]{position:relative;padding-bottom:60px}.el-table[data-v-a256f162],.filter-container[data-v-a256f162]{padding-bottom:52px}
.pagination-container[data-v-28fdfbeb]{padding:32px 16px;position:fixed;bottom:0;left:0;width:100%;background:#fff;padding:40px 280px;-webkit-box-shadow:0 -2px 10px rgba(0,0,0,.1);box-shadow:0 -2px 10px rgba(0,0,0,.1);z-index:100}.pagination-container.hidden[data-v-28fdfbeb]{display:none}.app-container[data-v-4983868b]{position:relative;padding-bottom:60px}.el-table[data-v-4983868b],.filter-container[data-v-4983868b]{padding-bottom:52px}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long