bug修复
This commit is contained in:
parent
0be6d486cf
commit
24a0b4ffe9
@ -88,11 +88,12 @@ class AddedOrderSync extends Command
|
||||
$starttime = $this->datetime->copy()->startOfMonth()->startOfDay();
|
||||
$endtime = $this->datetime->copy()->endOfMonth()->endOfDay();
|
||||
|
||||
$orders = DB::table($virtualTable)->selectRaw('sim, MAX(order_id)')
|
||||
$orders = DB::table($virtualTable)->selectRaw('sim, order_id')
|
||||
->where('created_at', '>=', $starttime->format('Y-m-d H:i:s'))
|
||||
->where('created_at', '<=', $endtime->format('Y-m-d H:i:s'))
|
||||
->whereIn('sim', array_pluck($data, 'sim'))
|
||||
->groupBy('sim')->get()->pluck('order_id', 'sim');
|
||||
->whereNull('deleted_at')
|
||||
->get()->groupBy('sim');
|
||||
|
||||
foreach ($data as &$value) {
|
||||
$value['virtual_order_id'] = $orders[$value['sim']] ?? 0;
|
||||
|
@ -65,7 +65,7 @@ class SoldActivatedController extends Controller
|
||||
|
||||
$list = $query->get();
|
||||
|
||||
if (!empty($list)) {
|
||||
if (!$list->isEmpty()) {
|
||||
$maxMonth = max($list->pluck('activated_month')->toArray());
|
||||
$maxMonth = Carbon::parse($maxMonth);
|
||||
}
|
||||
|
@ -128,16 +128,9 @@ class FlowPoolService extends Service
|
||||
|
||||
$table = app(FlowPoolMonth::class)->getTable() . '_' . $month->format('Ym');
|
||||
|
||||
$select = [
|
||||
"$table.sim",
|
||||
'package_id',
|
||||
'pool_id',
|
||||
'kilobyte',
|
||||
'cards.virtual_activated_at'
|
||||
];
|
||||
|
||||
if (Schema::hasTable($table)) {
|
||||
$flows = app(FlowPoolMonth::class)->setTable($table)->leftJoin('cards', 'cards.sim', '=', "{$table}.sim")->select($select)
|
||||
$flows = app(FlowPoolMonth::class)->setTable($table)
|
||||
->select(['sim', 'package_id', 'pool_id', 'kilobyte'])
|
||||
->whereIn('pool_id', $flowPools->pluck('id')->toArray())->get()->groupBy('pool_id');
|
||||
} else {
|
||||
$flows = [];
|
||||
@ -145,7 +138,6 @@ class FlowPoolService extends Service
|
||||
|
||||
// 流量统计
|
||||
$flowPools->map(function ($flowPool) use ($month, $flows) {
|
||||
$monthInt = $month->format('Ym');
|
||||
$flowArry = $flows[$flowPool->id];
|
||||
|
||||
// 无使用流量
|
||||
@ -173,8 +165,7 @@ class FlowPoolService extends Service
|
||||
}
|
||||
|
||||
$gradient = $setting['gradient'] * pow(1024, $setting['gradient_unit']);
|
||||
$first_month_price = $setting['first_month_price'] / pow(1024, $setting['gradient_unit'] + 1);
|
||||
$other_month_price = $setting['other_month_price'] / pow(1024, $setting['gradient_unit'] + 1);
|
||||
$gradient_price = $setting['gradient_price'] / pow(1024, $setting['gradient_unit'] + 1);
|
||||
|
||||
$minimum_settings = array_keyBy($setting['minimum_settings'], 'package_id');
|
||||
|
||||
@ -197,8 +188,7 @@ class FlowPoolService extends Service
|
||||
|
||||
$excess_flow = $item->kilobyte < $itemMinimumFlows ? 0 : $item->kilobyte - $itemMinimumFlows;
|
||||
$excess_flows += ceil($excess_flow / $gradient) * $gradient;
|
||||
$price = (date('Ym', strtotime($item->virtual_activated_at)) == $monthInt) ? $first_month_price : $other_month_price;
|
||||
$excess_price += $excess_flow * $price;
|
||||
$excess_price += $excess_flow * $gradient_price;
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,8 +284,7 @@ class FlowPoolService extends Service
|
||||
{
|
||||
$attributes['start_at'] = Carbon::parse($attributes['start_at'])->startOfMonth()->format('Y-m-d H:i:s');
|
||||
$attributes['end_at'] = Carbon::parse($attributes['end_at'])->endOfMonth()->format('Y-m-d H:i:s');
|
||||
$attributes['first_month_price'] = intval($attributes['first_month_price'] * 100);
|
||||
$attributes['other_month_price'] = intval($attributes['other_month_price'] * 100);
|
||||
$attributes['gradient_price'] = intval($attributes['gradient_price'] * 100);
|
||||
$attributes['gradient'] = intval($attributes['gradient'] * 1024);
|
||||
|
||||
if (!is_array($attributes['minimum_settings'])) {
|
||||
@ -318,16 +307,14 @@ class FlowPoolService extends Service
|
||||
|
||||
$rule = [
|
||||
'pool_id' => ['required', Rule::exists($this->flowPoolRepository->getTable(), 'id')],
|
||||
'first_month_price' => ['required', 'integer'],
|
||||
'other_month_price' => ['required', 'integer'],
|
||||
'gradient_price' => ['required', 'integer'],
|
||||
'gradient' => ['required', 'integer'],
|
||||
'gradient_unit' => ['required', 'in:0,1'],
|
||||
];
|
||||
|
||||
$message = [
|
||||
'pool_id.required' => '请输入流量池ID',
|
||||
'first_month_price.required' => '请输入首月单价',
|
||||
'other_month_price.required' => '请输入次月单价',
|
||||
'gradient_price.required' => '请输入次月单价',
|
||||
'gradient.required' => '请输入梯度',
|
||||
'gradient_unit.required' => '请选择梯度单位',
|
||||
];
|
||||
@ -712,8 +699,7 @@ class FlowPoolService extends Service
|
||||
$settings = $item->settings;
|
||||
|
||||
foreach ($settings as &$setting) {
|
||||
$setting['first_month_price'] = sprintf('%.02f', $setting['first_month_price']/100);
|
||||
$setting['other_month_price'] = sprintf('%.02f', $setting['other_month_price']/100);
|
||||
$setting['gradient_price'] = sprintf('%.02f', $setting['gradient_price']/100);
|
||||
$setting['gradient'] = sprintf('%.02f', $setting['gradient']/1024);
|
||||
$minimum_settings = $setting['minimum_settings'] ?? [];
|
||||
|
||||
|
@ -22,6 +22,8 @@ use App\Domains\Virtual\Repositories\OrderCardPartitionRepository;
|
||||
use App\Domains\Real\Repositories\OrderRepository as RealOrderRepository;
|
||||
use App\Domains\Real\Repositories\OrderCardPartitionRepository as RealOrderCardPartitionRepository;
|
||||
use App\Exceptions\ExistedException;
|
||||
use App\Models\Virtual\OrderCardPartition;
|
||||
use App\Models\Virtual\OrderCard;
|
||||
|
||||
class OrderService extends Service
|
||||
{
|
||||
@ -238,6 +240,20 @@ class OrderService extends Service
|
||||
}
|
||||
}
|
||||
|
||||
// 改企业
|
||||
if ($attributes['company_id'] != $node->company_id) {
|
||||
if ($attributes['type'] !== 0) {
|
||||
throw new NotAllowedException('只允许修改销售订单');
|
||||
}
|
||||
|
||||
$subQuery = OrderCard::select('sim')->where('order_id', $node->id);
|
||||
$count = OrderCardPartition::where('type', '<>', 0)->whereIn('sim', $subQuery)->count();
|
||||
|
||||
if ($count) {
|
||||
throw new NotAllowedException('已存在其他类型订单,不能修改企业');
|
||||
}
|
||||
}
|
||||
|
||||
$this->orderRepository->setModel($node)->update($attributes);
|
||||
|
||||
if (isset($attributes['unit_price'])) {
|
||||
|
@ -11,8 +11,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property int $id 自增ID
|
||||
* @property int $pool_id 流量池ID
|
||||
* @property array|null $minimum_settings 套餐保底配置
|
||||
* @property int $first_month_price 首月单价
|
||||
* @property int $other_month_price 次月单价
|
||||
* @property int $gradient_price 首月单价
|
||||
* @property int $gradient 梯度
|
||||
* @property int $gradient_unit 梯度单位 0:M 1:G
|
||||
* @property string|null $start_at 开始时间
|
||||
|
@ -60,8 +60,7 @@ class CreateFlowPoolTables extends Migration
|
||||
$table->increments('id')->comment('自增ID');
|
||||
$table->integer('pool_id')->unsigned()->default(0)->comment('流量池ID');
|
||||
$table->text('minimum_settings')->nullable()->comment('套餐保底配置');
|
||||
$table->integer('first_month_price')->unsigned()->default(0)->comment('首月单价');
|
||||
$table->integer('other_month_price')->unsigned()->default(0)->comment('次月单价');
|
||||
$table->integer('gradient_price')->unsigned()->default(0)->comment('梯度单价');
|
||||
$table->integer('gradient')->unsigned()->default(0)->comment('梯度');
|
||||
$table->tinyInteger('gradient_unit')->unsigned()->default(0)->comment('梯度单位 0:M 1:G');
|
||||
$table->timestamp('start_at')->nullable()->comment('开始时间');
|
||||
|
@ -107,6 +107,10 @@ table {
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.lh-35 {
|
||||
line-height: 35px;
|
||||
}
|
||||
|
||||
.lh-us {
|
||||
line-height: unset;
|
||||
}
|
||||
|
@ -83,8 +83,7 @@ export default {
|
||||
});
|
||||
|
||||
this.flowPool.settings.map(setting => {
|
||||
setting.first_month_price = Number(setting.first_month_price);
|
||||
setting.other_month_price = Number(setting.other_month_price);
|
||||
setting.gradient_price = Number(setting.gradient_price);
|
||||
setting.gradient = Number(setting.gradient);
|
||||
setting.minimum_settings.map(item => {
|
||||
item.price = Number(item.price);
|
||||
|
@ -157,16 +157,14 @@ export default {
|
||||
pool_id: this.data.id,
|
||||
start_at: this.data.settings.length ? this.moment().subtract('1', 'months').format('YYYY-MM') : this.start_at,
|
||||
end_at: this.data.settings.length ? this.moment().subtract('1', 'months').format('YYYY-MM') : this.end_at,
|
||||
first_month_price: 0,
|
||||
other_month_price: 0,
|
||||
gradient_price: 0,
|
||||
gradient: 0,
|
||||
gradient_unit: 0,
|
||||
minimum_settings: minimum_settings
|
||||
};
|
||||
}
|
||||
|
||||
this.params.first_month_price = Number(this.params.first_month_price);
|
||||
this.params.other_month_price = Number(this.params.other_month_price);
|
||||
this.params.gradient_price = Number(this.params.gradient_price);
|
||||
this.params.gradient = Number(this.params.gradient);
|
||||
this.params.minimum_settings.map(item => {
|
||||
item.price = Number(item.price);
|
||||
|
@ -64,24 +64,17 @@
|
||||
</FormItem>
|
||||
<FormItem label="超出流量:" :label-width="100" required>
|
||||
<Col span="12">
|
||||
<FormItem prop="first_month_price" label="首月单价" :label-width="80">
|
||||
<FormItem prop="gradient_price" label="梯度单价" :label-width="80">
|
||||
<InputNumber
|
||||
:max="99999"
|
||||
:min="0"
|
||||
v-model="params.first_month_price"
|
||||
v-model="params.gradient_price"
|
||||
:style="'width:110px'"
|
||||
></InputNumber>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="12">
|
||||
<FormItem prop="other_month_price" label="次月单价" :label-width="80">
|
||||
<InputNumber
|
||||
:max="99999"
|
||||
:min="0"
|
||||
v-model="params.other_month_price"
|
||||
:style="'width:110px'"
|
||||
></InputNumber>
|
||||
</FormItem>
|
||||
<span class="lh-35">元 (每1M/G的单价)</span>
|
||||
</Col>
|
||||
<Col span="12">
|
||||
<FormItem prop="gradient" label="梯度" :label-width="80">
|
||||
@ -113,12 +106,20 @@
|
||||
<Col span="8">{{item.package_name}}</Col>
|
||||
<Col span="8">
|
||||
<FormItem>
|
||||
<InputNumber :max="99999" :min="0" v-model="params.minimum_settings[index]['flows']"></InputNumber>
|
||||
<InputNumber
|
||||
:max="99999"
|
||||
:min="0"
|
||||
v-model="params.minimum_settings[index]['flows']"
|
||||
></InputNumber>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="8">
|
||||
<FormItem>
|
||||
<InputNumber :max="99999" :min="0" v-model="params.minimum_settings[index]['price']"></InputNumber>
|
||||
<InputNumber
|
||||
:max="99999"
|
||||
:min="0"
|
||||
v-model="params.minimum_settings[index]['price']"
|
||||
></InputNumber>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
|
@ -115,8 +115,8 @@
|
||||
v-if="orderObj"
|
||||
@on-change="index(1)"
|
||||
>
|
||||
<Tooltip content="仅筛选含有相同VD企业套餐卡的订单">
|
||||
<span class="fz-12">过滤VD企业套餐</span>
|
||||
<Tooltip content="仅筛选含有相同VD企业卡的订单">
|
||||
<span class="fz-12">过滤VD企业</span>
|
||||
</Tooltip>
|
||||
</Checkbox>
|
||||
</li>
|
||||
|
@ -44,7 +44,12 @@
|
||||
<span class="title-require">*</span>企业名称:
|
||||
</div>
|
||||
<div class="ui-list-content">
|
||||
<Select filterable placeholder="企业名称" v-model.trim="params.company_id">
|
||||
<Select
|
||||
filterable
|
||||
placeholder="企业名称"
|
||||
v-model.trim="params.company_id"
|
||||
:disabled="data && type !== 0 ? true : false"
|
||||
>
|
||||
<Option :value="item.id" :key="item.id" v-for="item in companies">{{ item.name }}</Option>
|
||||
</Select>
|
||||
</div>
|
||||
@ -106,7 +111,7 @@
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">套餐定价</div>
|
||||
<div class="ui-list-content">
|
||||
<InputNumber :max="100000" :min="0" :precision="2" v-model.trim="params.unit_price"></InputNumber>
|
||||
<InputNumber :max="100000" :min="0" v-model="params.unit_price"></InputNumber>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
@ -341,7 +341,7 @@ export default {
|
||||
context.row.virtual_order_id || context.row.refunded_at
|
||||
);
|
||||
|
||||
if (this.isDiffComPac(context.row)) {
|
||||
if (this.isDiffCompany(context.row)) {
|
||||
disabled = true;
|
||||
}
|
||||
|
||||
@ -383,7 +383,7 @@ export default {
|
||||
status_name = "已退货";
|
||||
}
|
||||
|
||||
if (this.isDiffComPac(row)) {
|
||||
if (this.isDiffCompany(row)) {
|
||||
color = "error";
|
||||
status_name = "不可用";
|
||||
}
|
||||
@ -445,7 +445,6 @@ export default {
|
||||
|
||||
if (this.orderObj && this.vdChecked) {
|
||||
params.virtual_company_id = this.orderObj.company_id;
|
||||
params.virtual_package_id = this.orderObj.package_id;
|
||||
}
|
||||
|
||||
if (force) {
|
||||
@ -457,7 +456,7 @@ export default {
|
||||
|
||||
if (this.params.sim !== "") {
|
||||
params.sim = this.params.sim;
|
||||
let cardParams = { sim: this.params.sim };
|
||||
let cardParams = { type: this.type, sim: this.params.sim };
|
||||
this.params.time = [];
|
||||
this.cardLoading = true;
|
||||
this.$store
|
||||
@ -599,10 +598,34 @@ export default {
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.clearParams();
|
||||
this.my_show = false;
|
||||
this.$store.commit("SET_RELATION_OBJ", {});
|
||||
},
|
||||
clearParams() {
|
||||
this.params = {
|
||||
sn: "",
|
||||
company_name: "",
|
||||
package_name: "",
|
||||
carrier_operator: "",
|
||||
transaction_no: "",
|
||||
pay_channel_name: "",
|
||||
time: [
|
||||
this.moment()
|
||||
.subtract("1", "months")
|
||||
.startOf("month")
|
||||
.format("YYYY-MM-DD"),
|
||||
this.moment()
|
||||
.subtract("1", "months")
|
||||
.endOf("month")
|
||||
.format("YYYY-MM-DD")
|
||||
],
|
||||
used: "",
|
||||
sim: ""
|
||||
};
|
||||
},
|
||||
clear() {
|
||||
this.clearParams();
|
||||
this.showCards = [];
|
||||
this.$store.dispatch("initOrder");
|
||||
},
|
||||
@ -780,6 +803,7 @@ export default {
|
||||
}
|
||||
|
||||
this.$emit("create-order");
|
||||
this.clearParams();
|
||||
},
|
||||
store() {
|
||||
if (!this.orderObj) {
|
||||
@ -924,12 +948,11 @@ export default {
|
||||
|
||||
this.handleSelectOrder(order_id, true);
|
||||
},
|
||||
isDiffComPac(obj) {
|
||||
isDiffCompany(obj) {
|
||||
if (
|
||||
this.orderObj &&
|
||||
this.vdChecked &&
|
||||
(obj.company_id !== this.orderObj.company_id ||
|
||||
obj.package_id !== this.orderObj.package_id)
|
||||
obj.company_id !== this.orderObj.company_id
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
@ -937,7 +960,7 @@ export default {
|
||||
return false;
|
||||
},
|
||||
getFilterDiffComPacCards(cards) {
|
||||
return cards.filter(item => !this.isDiffComPac(item));
|
||||
return cards.filter(item => !this.isDiffCompany(item));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -239,7 +239,8 @@ export default {
|
||||
}
|
||||
},
|
||||
handleChange(type) {
|
||||
this.initCompletePackages().then(packages => {
|
||||
let packageType = this.type === 1 ? 0 : this.type;
|
||||
this.initCompletePackages(packageType).then(packages => {
|
||||
packages = packages.filter(item => {
|
||||
return item.status === 0;
|
||||
});
|
||||
|
@ -64,7 +64,7 @@ export default {
|
||||
},
|
||||
{
|
||||
title: '运营商',
|
||||
key: 'carrier_operator',
|
||||
key: 'carrier_operator_name',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
@ -225,6 +225,10 @@ export default {
|
||||
params.trashed = 'without';
|
||||
}
|
||||
|
||||
if (params.type == 3) {
|
||||
params.type = [3, 4, 5];
|
||||
}
|
||||
|
||||
API.index(params).then(res => {
|
||||
this.isShowLoading(false);
|
||||
if (res.code == 0) {
|
||||
|
3
public/css/app.8e379248.css
Normal file
3
public/css/app.8e379248.css
Normal file
File diff suppressed because one or more lines are too long
2
public/css/chunk-77b548cf.c0895d74.css
Normal file
2
public/css/chunk-77b548cf.c0895d74.css
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.64dce303.js
Normal file
1
public/js/app.64dce303.js
Normal file
File diff suppressed because one or more lines are too long
14
public/js/chunk-77b548cf.b425bfed.js
Normal file
14
public/js/chunk-77b548cf.b425bfed.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-2e485eb2.a2a6cb9f.css rel=prefetch><link href=/css/chunk-996b1e80.5cadf3d0.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-2e485eb2.2b5045ef.js rel=prefetch><link href=/js/chunk-996b1e80.92847c4e.js rel=prefetch><link href=/css/app.3b594715.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.ae6938cc.js rel=preload as=script><link href=/js/chunk-vendors.ed6443e8.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.3b594715.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ed6443e8.js></script><script src=/js/app.ae6938cc.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-77b548cf.c0895d74.css rel=prefetch><link href=/css/chunk-996b1e80.5cadf3d0.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-77b548cf.b425bfed.js rel=prefetch><link href=/js/chunk-996b1e80.92847c4e.js rel=prefetch><link href=/css/app.8e379248.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.64dce303.js rel=preload as=script><link href=/js/chunk-vendors.ed6443e8.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.8e379248.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ed6443e8.js></script><script src=/js/app.64dce303.js></script></body></html>
|
Loading…
x
Reference in New Issue
Block a user