自动填写字段
This commit is contained in:
parent
37a1d4337e
commit
cd75300bc5
@ -94,7 +94,8 @@
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">支付流水号:</div>
|
||||
<div class="ui-list-content">
|
||||
<Input :maxlength="32" v-model.trim="params.transaction_no"></Input>
|
||||
<AutoComplete v-model="params.transaction_no" :data="transaction_nos"></AutoComplete>
|
||||
<!-- <Input :maxlength="32" v-model.trim="params.transaction_no"></Input> -->
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">未填写将自动生成</li>
|
||||
|
@ -1,12 +1,10 @@
|
||||
import * as API from 'api/virtual/orders';
|
||||
import { mapGetters } from 'vuex';
|
||||
import {
|
||||
isPhone
|
||||
} from 'validate';
|
||||
import * as API from "api/virtual/orders";
|
||||
import { mapGetters } from "vuex";
|
||||
import { isPhone } from "validate";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MDrawer: resolve => require(['components/drawer'], resolve)
|
||||
MDrawer: resolve => require(["components/drawer"], resolve)
|
||||
},
|
||||
props: {
|
||||
show: {
|
||||
@ -33,27 +31,35 @@ export default {
|
||||
loading: false,
|
||||
companies: [],
|
||||
completePackagesFilter: [],
|
||||
transaction_nos: [],
|
||||
params: {
|
||||
company_id: '',
|
||||
carrier_operator: '',
|
||||
package_id: '',
|
||||
company_id: "",
|
||||
carrier_operator: "",
|
||||
package_id: "",
|
||||
unit_price: 0,
|
||||
pay_channel: '',
|
||||
transaction_no: '',
|
||||
pay_channel: "",
|
||||
transaction_no: "",
|
||||
counts: 0,
|
||||
order_at: '',
|
||||
remark: '',
|
||||
order_at: "",
|
||||
remark: "",
|
||||
area: [],
|
||||
address: '',
|
||||
contacts: '',
|
||||
mobile: ''
|
||||
address: "",
|
||||
contacts: "",
|
||||
mobile: ""
|
||||
},
|
||||
groupIndex: '',
|
||||
groupIndex: "",
|
||||
group: {}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['selected', 'selectedMapped', 'counts', 'orders', 'order_group', 'relations'])
|
||||
...mapGetters([
|
||||
"selected",
|
||||
"selectedMapped",
|
||||
"counts",
|
||||
"orders",
|
||||
"order_group",
|
||||
"relations"
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
show(bool) {
|
||||
@ -75,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);
|
||||
}
|
||||
|
||||
@ -87,7 +96,10 @@ export default {
|
||||
},
|
||||
counts(value) {
|
||||
if (value) {
|
||||
if (this.selectedMapped.length && !Object.keys(this.order_group).length) {
|
||||
if (
|
||||
this.selectedMapped.length &&
|
||||
!Object.keys(this.order_group).length
|
||||
) {
|
||||
this.setParamsByReal(this.selected);
|
||||
}
|
||||
|
||||
@ -100,59 +112,59 @@ export default {
|
||||
this.params.type = this.type;
|
||||
|
||||
if (!this.params.company_id) {
|
||||
return this.$Message.info('请选择企业');
|
||||
return this.$Message.info("请选择企业");
|
||||
}
|
||||
|
||||
if (!this.params.package_id) {
|
||||
return this.$Message.info('请选择套餐');
|
||||
return this.$Message.info("请选择套餐");
|
||||
}
|
||||
|
||||
if (!this.params.pay_channel) {
|
||||
return this.$Message.info('请选择支付方式');
|
||||
return this.$Message.info("请选择支付方式");
|
||||
}
|
||||
|
||||
if (!this.params.counts) {
|
||||
return this.$Message.info('请输入订单量');
|
||||
return this.$Message.info("请输入订单量");
|
||||
}
|
||||
|
||||
if (!this.params.order_at) {
|
||||
return this.$Message.info('请选择订单时间');
|
||||
return this.$Message.info("请选择订单时间");
|
||||
}
|
||||
|
||||
if (this.params.contacts && !(/[\s\S]{2,32}/.test(this.params.contacts))) {
|
||||
return this.$Message.info('联系人长度在2-32之间');
|
||||
if (this.params.contacts && !/[\s\S]{2,32}/.test(this.params.contacts)) {
|
||||
return this.$Message.info("联系人长度在2-32之间");
|
||||
}
|
||||
|
||||
if (this.params.mobile && !isPhone(this.params.mobile)) {
|
||||
return this.$Message.info('手机号填写不正确');
|
||||
return this.$Message.info("手机号填写不正确");
|
||||
}
|
||||
|
||||
if (Object.keys(this.order_group).length) {
|
||||
if (!this.group.length) {
|
||||
return this.$Message.error('请选择一个订单组');
|
||||
return this.$Message.error("请选择一个订单组");
|
||||
}
|
||||
|
||||
this.params.selected = this.group.map(el => {
|
||||
return { order_id: el.order_id, counts: el.counts, sim: el.sim };
|
||||
});
|
||||
|
||||
if (this.groupIndex === '0_0') {
|
||||
if (this.groupIndex === "0_0") {
|
||||
if (this.type !== 1) {
|
||||
return this.$Message.error('暂不支持续费包及加油包转销售');
|
||||
return this.$Message.error("暂不支持续费包及加油包转销售");
|
||||
}
|
||||
// 卡不在VD上转销售
|
||||
this.params.sign = 1;
|
||||
this.post();
|
||||
} else if (this.params.company_id !== this.group[0].company_id) {
|
||||
if (this.type !== 1) {
|
||||
return this.$Message.error('暂不支持续费包及加油包改企业');
|
||||
return this.$Message.error("暂不支持续费包及加油包改企业");
|
||||
}
|
||||
|
||||
// 改企业的
|
||||
this.params.sign = 2;
|
||||
this.$Modal.confirm({
|
||||
title: '提示',
|
||||
content: '是否确认修改所选卡的企业?',
|
||||
title: "提示",
|
||||
content: "是否确认修改所选卡的企业?",
|
||||
onOk: () => {
|
||||
this.post();
|
||||
}
|
||||
@ -174,43 +186,48 @@ export default {
|
||||
|
||||
if (this.data) {
|
||||
// 编辑
|
||||
API.update(this.params, this.data.id).then(res => {
|
||||
this.loading = false;
|
||||
if (res.code == 0) {
|
||||
this.handelSuccess();
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false;
|
||||
});
|
||||
API.update(this.params, this.data.id)
|
||||
.then(res => {
|
||||
this.loading = false;
|
||||
if (res.code == 0) {
|
||||
this.handelSuccess();
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
// 添加
|
||||
API.create(this.params).then(res => {
|
||||
this.loading = false;
|
||||
if (res.code == 0) {
|
||||
this.handelSuccess();
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false;
|
||||
});
|
||||
API.create(this.params)
|
||||
.then(res => {
|
||||
this.loading = false;
|
||||
if (res.code == 0) {
|
||||
this.handelSuccess();
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
visibleChange(bool) {
|
||||
if (!bool) {
|
||||
this.$emit('update:show', false);
|
||||
this.$emit("update:show", false);
|
||||
}
|
||||
},
|
||||
|
||||
clear() {
|
||||
for (let k in this.params) {
|
||||
this.params[k] = '';
|
||||
this.params[k] = "";
|
||||
}
|
||||
|
||||
this.params.unit_price = 0;
|
||||
this.params.counts = 0;
|
||||
this.params.area = [];
|
||||
this.transaction_nos = [];
|
||||
this.my_show = false;
|
||||
this.groupIndex = '';
|
||||
this.groupIndex = "";
|
||||
},
|
||||
handleChange(type) {
|
||||
this.initCompletePackages().then(packages => {
|
||||
@ -232,38 +249,39 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof this.params.carrier_operator === 'number') {
|
||||
if (typeof this.params.carrier_operator === "number") {
|
||||
packages = packages.filter(item => {
|
||||
return item.carrier_operator === this.params.carrier_operator;
|
||||
});
|
||||
}
|
||||
|
||||
this.completePackagesFilter = packages.filter(item => {
|
||||
return item.type === 0;
|
||||
});
|
||||
this.completePackagesFilter = packages;
|
||||
});
|
||||
},
|
||||
cards() {
|
||||
if (this.params.company_id) {
|
||||
this.$store.commit('SET_RELATION_OBJ', {
|
||||
this.$store.commit("SET_RELATION_OBJ", {
|
||||
virtual_company_id: this.params.company_id,
|
||||
virtual_package_id: this.params.package_id
|
||||
});
|
||||
|
||||
this.$store.dispatch('getRelations').then(() => {
|
||||
this.$emit('select-cards');
|
||||
this.$store.dispatch("getRelations").then(() => {
|
||||
this.$emit("select-cards");
|
||||
});
|
||||
} else {
|
||||
this.$store.commit('SET_RELATION_OBJ', {});
|
||||
this.$emit('select-cards');
|
||||
this.$store.commit("SET_RELATION_OBJ", {});
|
||||
this.$emit("select-cards");
|
||||
}
|
||||
},
|
||||
selectGroup(item, index) {
|
||||
this.transaction_nos = [];
|
||||
this.groupIndex = index;
|
||||
this.group = item;
|
||||
|
||||
this.params.company_id = item[0].company_id;
|
||||
this.params.counts = item.reduce((acc, cur) => { return acc + cur.counts; }, 0);
|
||||
this.params.counts = item.reduce((acc, cur) => {
|
||||
return acc + cur.counts;
|
||||
}, 0);
|
||||
|
||||
if ([0, 1].indexOf(this.type)) {
|
||||
this.params.package_id = item[0].package_id;
|
||||
@ -273,7 +291,9 @@ export default {
|
||||
this.setParamsByReal(item);
|
||||
},
|
||||
setParamsByReal(array) {
|
||||
let tmp = array.map(el => { return el.company_id + '_' + el.package_id; }).filter((v, i, a) => {
|
||||
let tmp = array.map(el => {
|
||||
return el.company_id + "_" + el.package_id;
|
||||
}).filter((v, i, a) => {
|
||||
return a.indexOf(v) === i;
|
||||
});
|
||||
|
||||
@ -281,42 +301,88 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
let order = this.orders.find(el => { return el.id === array[0].order_id; });
|
||||
let order_ids = array.map(el => {
|
||||
return el.order_id;
|
||||
}).filter((v, i, a) => {
|
||||
return a.indexOf(v) === i;
|
||||
});
|
||||
|
||||
if (order) {
|
||||
switch (order.pay_channel_name) {
|
||||
case '银行转账':
|
||||
this.params.pay_channel = 'bank';
|
||||
let orders = this.orders.filter(el => {
|
||||
return order_ids.indexOf(el.id) !== -1;
|
||||
});
|
||||
|
||||
let pay_channel_name = orders
|
||||
.map(el => {
|
||||
return el.pay_channel_name;
|
||||
})
|
||||
.filter((v, i, a) => {
|
||||
return a.indexOf(v) === i;
|
||||
});
|
||||
|
||||
if (pay_channel_name.length === 1) {
|
||||
switch (pay_channel_name[0]) {
|
||||
case "银行转账":
|
||||
this.params.pay_channel = "bank";
|
||||
break;
|
||||
case '微信支付':
|
||||
this.params.pay_channel = 'wx';
|
||||
case "微信支付":
|
||||
this.params.pay_channel = "wx";
|
||||
break;
|
||||
case '支付宝':
|
||||
this.params.pay_channel = 'alipay';
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
this.params.carrier_operator = order.carrier_operator;
|
||||
this.params.unit_price = Number(order.unit_price);
|
||||
let needParams = [
|
||||
"transaction_no",
|
||||
"carrier_operator",
|
||||
"unit_price",
|
||||
"order_at",
|
||||
"contacts",
|
||||
"mobile",
|
||||
"remark",
|
||||
"address"
|
||||
];
|
||||
|
||||
this.params.order_at = order.order_at;
|
||||
this.params.transaction_no = order.transaction_no;
|
||||
this.params.contacts = order.contacts;
|
||||
this.params.mobile = order.mobile;
|
||||
this.params.remark = order.remark;
|
||||
this.params.address = order.address;
|
||||
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;
|
||||
});
|
||||
|
||||
if (node.length > 1 && element === 'transaction_no') {
|
||||
this.transaction_nos = node;
|
||||
}
|
||||
|
||||
if (node.length === 1) {
|
||||
if (element === 'unit_price') {
|
||||
this.params[element] = Number(orders[0][element]);
|
||||
} else {
|
||||
this.params[element] = orders[0][element];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let relations = this.relations.filter(el => {
|
||||
return array.findIndex(e => { return e.company_id === el.real_company_id && e.package_id === el.real_package_id; }) !== -1;
|
||||
return (
|
||||
array.findIndex(e => {
|
||||
return (
|
||||
e.company_id === el.real_company_id &&
|
||||
e.package_id === el.real_package_id
|
||||
);
|
||||
}) !== -1
|
||||
);
|
||||
});
|
||||
|
||||
if (relations.length) {
|
||||
@ -326,7 +392,9 @@ export default {
|
||||
|
||||
mappedCompany = mappedCompany.map(el => {
|
||||
el.display = 0;
|
||||
let relation = relations.find(e => { return e.virtual_company_id === el.id; });
|
||||
let relation = relations.find(e => {
|
||||
return e.virtual_company_id === el.id;
|
||||
});
|
||||
|
||||
if (relation) {
|
||||
el.display = relation.updated_at;
|
||||
@ -334,7 +402,7 @@ export default {
|
||||
});
|
||||
|
||||
mappedCompany.sort((a, b) => {
|
||||
return a.display > b.display ? 1 : (a.display < b.display ? -1 : 0);
|
||||
return a.display > b.display ? 1 : a.display < b.display ? -1 : 0;
|
||||
});
|
||||
|
||||
this.companies = mappedCompany.map(el => {
|
||||
@ -349,7 +417,9 @@ export default {
|
||||
|
||||
mappedPackage = mappedPackage.map(el => {
|
||||
el.display = 0;
|
||||
let relation = relations.find(e => { return e.virtual_package_id === el.id; });
|
||||
let relation = relations.find(e => {
|
||||
return e.virtual_package_id === el.id;
|
||||
});
|
||||
|
||||
if (relation) {
|
||||
el.display = relation.updated_at;
|
||||
@ -357,7 +427,7 @@ export default {
|
||||
});
|
||||
|
||||
mappedPackage.sort((a, b) => {
|
||||
return a.display > b.display ? 1 : (a.display < b.display ? -1 : 0);
|
||||
return a.display > b.display ? 1 : a.display < b.display ? -1 : 0;
|
||||
});
|
||||
|
||||
this.completePackagesFilter = mappedPackage.map(el => {
|
||||
@ -370,19 +440,19 @@ export default {
|
||||
handelSuccess() {
|
||||
if (Object.keys(this.order_group).length >= 1) {
|
||||
let mapped = JSON.parse(JSON.stringify(this.order_group));
|
||||
this.$store.dispatch('removeSelected', mapped[this.groupIndex]);
|
||||
this.$store.dispatch("removeSelected", mapped[this.groupIndex]);
|
||||
delete mapped[this.groupIndex];
|
||||
this.$store.commit('SET_ORDER_GROUP', mapped);
|
||||
this.$store.commit("SET_ORDER_GROUP", mapped);
|
||||
}
|
||||
|
||||
this.$Message.success('操作成功');
|
||||
this.$Message.success("操作成功");
|
||||
|
||||
if (!this.order_group || Object.keys(this.order_group).length < 1) {
|
||||
this.clear();
|
||||
if (this.data) {
|
||||
this.$emit('update-success');
|
||||
this.$emit("update-success");
|
||||
} else {
|
||||
this.$emit('add-success');
|
||||
this.$emit("add-success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
public/css/chunk-6d96644c.e151cd00.css
Normal file
2
public/css/chunk-6d96644c.e151cd00.css
Normal file
File diff suppressed because one or more lines are too long
2
public/js/app.456c05b7.js
Normal file
2
public/js/app.456c05b7.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.456c05b7.js.map
Normal file
1
public/js/app.456c05b7.js.map
Normal file
File diff suppressed because one or more lines are too long
15
public/js/chunk-6d96644c.347f439e.js
Normal file
15
public/js/chunk-6d96644c.347f439e.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/chunk-6d96644c.347f439e.js.map
Normal file
1
public/js/chunk-6d96644c.347f439e.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-996b1e80.5cadf3d0.css rel=prefetch><link href=/css/chunk-f284e446.60854bc0.css rel=prefetch><link href=/js/chunk-00ae0766.3874cd10.js rel=prefetch><link href=/js/chunk-07a274ec.c3ad5dec.js rel=prefetch><link href=/js/chunk-996b1e80.d3b45e46.js rel=prefetch><link href=/js/chunk-f284e446.b48a4ef4.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.91b2332a.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.91b2332a.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-6d96644c.e151cd00.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.c3ad5dec.js rel=prefetch><link href=/js/chunk-6d96644c.347f439e.js rel=prefetch><link href=/js/chunk-996b1e80.d3b45e46.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.456c05b7.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.456c05b7.js></script></body></html>
|
Loading…
x
Reference in New Issue
Block a user