This commit is contained in:
邓皓元 2019-04-10 12:03:13 +08:00
parent 7b44fad071
commit ab4b591acd
29 changed files with 312 additions and 56 deletions

View File

@ -66,7 +66,7 @@ class PackageRepository extends Repository
}
if (!empty($conditions['sn'])) {
$this->model = $this->model->where('sn', "%{$conditions['sn']}%");
$this->model = $this->model->where('sn', 'like', "%{$conditions['sn']}%");
}
if (!empty($conditions['name'])) {

View File

@ -177,11 +177,6 @@ class OrderService extends Service
throw new InvalidArgumentException('请选择卡');
}
if (isset($attributes['selected'])) {
$attributes['order_status'] = 5;
$attributes['transaction_status'] = 1;
}
DB::beginTransaction();
try {
@ -229,6 +224,9 @@ class OrderService extends Service
$attributes['extends'] = array_merge($node->extends ?: [], $attributes['extends']);
}
$attributes['order_status'] = (isset($attributes['selected']) && count($attributes['selected']) === $node->counts) ? 5 : 0;
$attributes['transaction_status'] = isset($attributes['selected']) ? 1 : 0;
$this->orderRepository->setModel($node)->update($attributes);
if (isset($attributes['unit_price'])) {
@ -244,6 +242,10 @@ class OrderService extends Service
throw new NotAllowedException('非法操作');
}
$attributes['order_status'] = (isset($attributes['selected']) && count($attributes['selected']) === $attributes['counts']) ? 5 : 0;
$attributes['transaction_status'] = isset($attributes['selected']) ? 1 : 0;
$attributes['unit_price'] = $product->price;
$attributes['total_price'] = $attributes['unit_price'] * $attributes['counts'];
$attributes['custom_price'] = $attributes['unit_price'] * $attributes['counts'];
@ -561,6 +563,10 @@ class OrderService extends Service
SELECT DISTINCT SIM FROM virtual_order_cards_partition WHERE type=0 AND order_id = ?
)';
DB::statement($sql, [$id]);
$node->order_status = 0;
$node->save();
$this->orderRepository->forgetCached();
}
}
@ -645,7 +651,7 @@ class OrderService extends Service
break;
}
return intval($transactionNo);
return strval($transactionNo);
}
/**
@ -758,7 +764,7 @@ class OrderService extends Service
}
foreach (array_chunk($data, 1000) as $value) {
if ($table === 'virtual_order_cards' && DB::table($table)->whereIn('sim', array_pluck($value, 'sim'))->whereNotNull('deleted_at')->count()) {
if ($table === 'virtual_order_cards' && DB::table($table)->whereIn('sim', array_pluck($value, 'sim'))->whereNull('deleted_at')->count()) {
throw new ExistedException('出现重复销售卡');
}

View File

@ -122,7 +122,11 @@ class ProductService extends Service
// 上一次定价
$newest = $this->productRepository->where('company_id', $attributes['company_id'])->where('package_id', $attributes['package_id'])->first();
if ($newest && (isset($attributes['price']) && $newest->price !== $attributes['price']) || (isset($attributes['renew_price']) && $newest->renew_price !== $attributes['renew_price'])) {
if ($newest && (
(isset($attributes['price']) && $newest->price !== $attributes['price'])
||
(isset($attributes['renew_price']) && $newest->renew_price !== $attributes['renew_price'])
)) {
unset($attributes['id']);
$newest->delete();

View File

@ -10,6 +10,13 @@ export default {
};
</script>
<style>
.ivu-auto-complete.ivu-select-dropdown {
max-height: 200px;
}
</style>
<style lang="less">
.size {
width: 100%;

View File

@ -0,0 +1,167 @@
<template>
<i-select
ref="select"
class="ivu-auto-complete"
:label="label"
:disabled="disabled"
:clearable="clearable"
:placeholder="placeholder"
:size="size"
:placement="placement"
:value="currentValue"
filterable
remote
auto-complete
:remote-method="remoteMethod"
@on-change="handleChange"
:transfer="transfer">
<slot name="input">
<i-input
:element-id="elementId"
ref="input"
slot="input"
v-model="currentValue"
:name="name"
:placeholder="placeholder"
:disabled="disabled"
:size="size"
:icon="inputIcon"
@on-click="handleClear"
@on-focus="handleFocus"
@on-blur="handleBlur"></i-input>
</slot>
<slot>
<i-option v-for="item in filteredData" :value="item" :key="item">{{ item }}</i-option>
</slot>
</i-select>
</template>
<script>
import { oneOf } from 'utils/assist';
import Emitter from 'mixins/emitter';
export default {
name: 'AutoComplete',
mixins: [ Emitter ],
props: {
value: {
type: [String, Number],
default: ''
},
label: {
type: [String, Number],
default: ''
},
data: {
type: Array,
default: () => []
},
disabled: {
type: Boolean,
default: false
},
clearable: {
type: Boolean,
default: false
},
placeholder: {
type: String
},
size: {
validator (value) {
return oneOf(value, ['small', 'large', 'default']);
},
default () {
return !this.$IVIEW || this.$IVIEW.size === '' ? 'default' : this.$IVIEW.size;
}
},
icon: {
type: String
},
filterMethod: {
type: [Function, Boolean],
default: false
},
placement: {
validator (value) {
return oneOf(value, ['top', 'bottom']);
},
default: 'bottom'
},
transfer: {
type: Boolean,
default () {
return this.$IVIEW.transfer === '' ? false : this.$IVIEW.transfer;
}
},
name: {
type: String
},
elementId: {
type: String
}
},
data () {
return {
currentValue: this.value,
disableEmitChange: false // for Form reset
};
},
computed: {
inputIcon () {
let icon = '';
if (this.clearable && this.currentValue) {
icon = 'ios-close';
} else if (this.icon) {
icon = this.icon;
}
return icon;
},
filteredData () {
if (this.filterMethod) {
return this.data.filter(item => this.filterMethod(this.currentValue, item));
} else {
return this.data;
}
}
},
watch: {
value (val) {
if(this.currentValue !== val){
this.disableEmitChange = true;
}
this.currentValue = val;
},
currentValue (val) {
this.$refs.select.query = val;
this.$emit('input', val);
if (this.disableEmitChange) {
this.disableEmitChange = false;
return;
}
this.$emit('on-change', val);
this.dispatch('FormItem', 'on-form-change', val);
}
},
methods: {
remoteMethod (query) {
this.$emit('on-search', query);
},
handleChange (val) {
this.currentValue = val;
this.$refs.input.blur();
this.$emit('on-select', val);
},
handleFocus (event) {
this.$emit('on-focus', event);
},
handleBlur (event) {
this.$emit('on-blur', event);
},
handleClear () {
if (!this.clearable) return;
this.currentValue = '';
this.$refs.select.reset();
}
}
};
</script>

View File

@ -0,0 +1,2 @@
import AutoComplete from './auto-complete.vue';
export default AutoComplete;

View File

@ -34,7 +34,6 @@ Vue.mixin(mixins);
Vue.mixin(complete);
Vue.use(base);
Vue.component("Treeselect", Treeselect);
const vm = new Vue({
el: "#app",
router,

View File

@ -33,7 +33,7 @@
</li>
<li class="handle-item w-250">
<AutoComplete @on-search="handleCompletePackages(options.type)" icon="ios-search" placeholder="套餐名称" v-model.trim="options.package_name">
<AutoComplete @on-search="handleCompletePackages(options.type, $event)" icon="ios-search" placeholder="套餐名称" v-model.trim="options.package_name">
<Option :key="item.id" :value="item.name" v-for="item in completeHandledPackages">{{ item.name }}</Option>
</AutoComplete>
</li>

View File

@ -43,7 +43,7 @@
<li class="handle-item w-250">
<AutoComplete
@on-search="handleCompletePackages(type)"
@on-search="handleCompletePackages(type, $event)"
icon="ios-search"
placeholder="套餐名称"
v-model.trim="options.package_name"

View File

@ -50,7 +50,7 @@
<li class="handle-item w-250">
<AutoComplete
@on-search="handleCompletePackages"
@on-search="handleCompletePackages(0, $event)"
icon="ios-search"
placeholder="套餐名称"
v-model.trim="params.package_name"

View File

@ -180,7 +180,7 @@
:type="type"
@add-success="handleOrderSuccess(0)"
@update-success="handleOrderSuccess(1)"
@select-cards="openCards(true)"
@select-cards="openCards(true, 0, $event)"
></ui-edit>
<ui-detail :data="detailObj.data" :show.sync="detailObj.show"></ui-detail>

View File

@ -341,8 +341,8 @@ export default {
if (bool) {
this.params.type = this.type;
if (this.orderObj) {
this.params.company_name = this.orderObj.company_name;
this.params.package_name = this.orderObj.package_name;
this.params.carrier_operator = this.orderObj.carrier_operator;
// this.params.package_name = this.orderObj.package_name;
}
this.index();
}
@ -457,6 +457,7 @@ export default {
this.page.total = filterOrders.length;
this.filterOrders = filterOrders;
this.showOrders = filterOrders.slice((page - 1) * this.page.limit, page * this.page.limit);
},
handleOrderRowDblclick(row) {

View File

@ -81,7 +81,10 @@ export default {
}
}
if (this.selectedMapped.length && !Object.keys(this.order_group).length) {
if (
this.selectedMapped.length &&
!Object.keys(this.order_group).length
) {
this.setParamsByReal(this.selected);
}
@ -90,6 +93,11 @@ export default {
this.selectGroup(this.order_group[key], key);
}
}
},
counts(val) {
if (val) {
this.params.counts = val;
}
}
},
methods: {
@ -116,6 +124,10 @@ export default {
return this.$Message.info("请选择订单时间");
}
this.params.order_at = this.moment(this.params.order_at).format(
"YYYY-MM-DD hh:mm:ss"
);
if (this.params.contacts && !/[\s\S]{2,32}/.test(this.params.contacts)) {
return this.$Message.info("联系人长度在2-32之间");
}
@ -221,7 +233,7 @@ export default {
});
if (type === 1) {
this.params.package_id = '';
this.params.package_id = "";
}
if (type === 2) {
@ -251,11 +263,15 @@ export default {
});
this.$store.dispatch("getRelations").then(() => {
this.$emit("select-cards");
this.$emit("select-cards", {
carrier_operator: this.params.carrier_operator
});
});
} else {
this.$store.commit("SET_RELATION_OBJ", {});
this.$emit("select-cards");
this.$emit("select-cards", {
carrier_operator: this.params.carrier_operator
});
}
},
selectGroup(item, index) {
@ -278,21 +294,25 @@ export default {
setParamsByReal(array) {
this.params.counts = this.counts;
let tmp = array.map(el => {
return el.company_id + "_" + el.package_id;
}).filter((v, i, a) => {
return a.indexOf(v) === i;
});
let tmp = array
.map(el => {
return el.company_id + "_" + el.package_id;
})
.filter((v, i, a) => {
return a.indexOf(v) === i;
});
if (tmp.length > 1) {
return;
}
let order_ids = array.map(el => {
return el.order_id;
}).filter((v, i, a) => {
return a.indexOf(v) === i;
});
let order_ids = array
.map(el => {
return el.order_id;
})
.filter((v, i, a) => {
return a.indexOf(v) === i;
});
let orders = this.orders.filter(el => {
return order_ids.indexOf(el.id) !== -1;
@ -317,12 +337,12 @@ export default {
case "支付宝":
this.params.pay_channel = "alipay";
break;
// case '余额支付':
// this.params.pay_channel = 'account';
// break;
// case '天猫续费':
// this.params.pay_channel = 'tmall';
// break;
// case '余额支付':
// this.params.pay_channel = 'account';
// break;
// case '天猫续费':
// this.params.pay_channel = 'tmall';
// break;
default:
break;
}
@ -342,18 +362,20 @@ export default {
for (let index = 0; index < needParams.length; index++) {
const element = needParams[index];
let node = orders.map(el => {
return el[element];
}).filter((v, i, a) => {
return a.indexOf(v) === i;
});
let node = orders
.map(el => {
return el[element];
})
.filter((v, i, a) => {
return a.indexOf(v) === i;
});
if (node.length > 1 && element === 'transaction_no') {
if (node.length > 1 && element === "transaction_no") {
this.transaction_nos = node;
}
if (node.length === 1) {
if (element === 'unit_price') {
if (element === "unit_price") {
this.params[element] = Number(orders[0][element]);
} else {
this.params[element] = orders[0][element];
@ -363,9 +385,14 @@ export default {
this.$store.dispatch("getRelations").then(res => {
let relations = res.filter(el => {
return orders.findIndex(e => {
return (e.company_id === el.real_company_id && e.package_id === el.real_package_id);
}) !== -1;
return (
orders.findIndex(e => {
return (
e.company_id === el.real_company_id &&
e.package_id === el.real_package_id
);
}) !== -1
);
});
if (relations.length) {
@ -374,7 +401,7 @@ export default {
});
mappedCompany.map(el => {
el.display = '0';
el.display = "0";
let relation = relations.find(e => {
return e.virtual_company_id === el.company_id;
});
@ -403,7 +430,7 @@ export default {
});
mappedPackage = mappedPackage.map(el => {
el.display = '0';
el.display = "0";
let relation = relations.find(e => {
return e.virtual_package_id === el.package_id;
});

View File

@ -40,7 +40,7 @@
<li class="handle-item w-200">
<AutoComplete
@on-search="handleCompletePackages(type)"
@on-search="handleCompletePackages(type, $event)"
icon="ios-search"
placeholder="套餐名称"
v-model.trim="params.name"

View File

@ -29,13 +29,13 @@ export default {
carrier_operator: 255,
cost_price: 0,
guide_price: 0,
flows: 1,
flows: 0,
voices: 0,
messages: 0,
has_messages: 0,
has_lbs: 0,
reset_months: 1,
service_months: 1,
reset_months: 0,
service_months: 0,
effect_months: 0,
description: '',
status: 0,

View File

@ -209,7 +209,7 @@ export default {
* @return {[type]} [description]
*/
index(page = 1) {
let params = Object.assign(this.params, { 'type': this.type, 'orderBy': 'id', 'sortedBy': 'asc' });
let params = Object.assign(this.params, { 'type': this.type, 'orderBy': 'id', 'sortedBy': 'desc' });
if (params.status === 2) {
params.status = undefined;

View File

@ -48,7 +48,7 @@
</div>
</li>
<li class="ui-list">
<li class="ui-list" v-if="type === 0">
<div class="ui-list-title">续费价格</div>
<div class="ui-list-content">
<InputNumber

View File

@ -60,7 +60,7 @@
<li class="handle-item w-250">
<AutoComplete
@on-search="handleCompletePackages(type)"
@on-search="handleCompletePackages(type, $event)"
icon="ios-search"
placeholder="套餐名称"
v-model.trim="params.package_name"

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

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

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

File diff suppressed because one or more lines are too long

View File

@ -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-70e42009.92a7aa54.css rel=prefetch><link href=/css/chunk-996b1e80.5cadf3d0.css rel=prefetch><link href=/js/chunk-00ae0766.3874cd10.js rel=prefetch><link href=/js/chunk-07a274ec.20f6d59e.js rel=prefetch><link href=/js/chunk-70e42009.bf8f6cbc.js rel=prefetch><link href=/js/chunk-996b1e80.1e853bf4.js rel=prefetch><link href=/css/app.d71a8195.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.ec0a31e8.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.d71a8195.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.ec0a31e8.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-8b87cca2.960e50e2.css rel=prefetch><link href=/css/chunk-996b1e80.5cadf3d0.css rel=prefetch><link href=/js/chunk-00ae0766.3874cd10.js rel=prefetch><link href=/js/chunk-07a274ec.20f6d59e.js rel=prefetch><link href=/js/chunk-8b87cca2.44f37ab5.js rel=prefetch><link href=/js/chunk-996b1e80.1e853bf4.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.66a3142e.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.66a3142e.js></script></body></html>