desc: 新增创建权限流程
This commit is contained in:
parent
815c2e6db4
commit
1d26a9f1fb
@ -117,3 +117,12 @@ export function getPermissionGoods(id) {
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
// 创建商品
|
||||
export function postsPermissionGoods(data) {
|
||||
return request({
|
||||
url: `/api/goods`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
@ -103,3 +103,23 @@ export function cancalOrder(orderId) {
|
||||
method: 'put'
|
||||
});
|
||||
}
|
||||
|
||||
// 快速创建权限
|
||||
export function createPermission(data) {
|
||||
return request({
|
||||
url: `/api/order/quicklyGenerateOrder`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 校验是否存在所选择权限对应的权限包
|
||||
export function postFindPermission(ids) {
|
||||
return request({
|
||||
url: `/api/permission/findPermission`,
|
||||
method: 'post',
|
||||
data: {
|
||||
relPermissions: ids
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ export default {
|
||||
select: '选择',
|
||||
chooseGoods: '选择商品',
|
||||
permissionName: '权限名称',
|
||||
permissionGoodName: '权限商品名称',
|
||||
receivingPermission: '领取权限',
|
||||
isPackage: '是否权限包',
|
||||
modifyPermissionContent: '修改权限内容',
|
||||
@ -101,5 +102,7 @@ export default {
|
||||
orderSelectionItem: '订单选择商品',
|
||||
orderDetails: '订单详情',
|
||||
statusType: '状态类型',
|
||||
createPackage: '创建权限'
|
||||
createPackage: '创建权限',
|
||||
package: '权限包',
|
||||
basePackage: '基础权限'
|
||||
};
|
||||
|
@ -29,5 +29,12 @@ export default {
|
||||
pleaseSelectTransferPermission: '选择转赠权限',
|
||||
permissionName: '权限名称',
|
||||
private: '专用',
|
||||
public: '公用'
|
||||
public: '公用',
|
||||
selectPermission: '选择权限',
|
||||
createOrder: '创建订单',
|
||||
checkCode: '查看二维码',
|
||||
goodsName: '商品名称',
|
||||
price: '价格',
|
||||
permissionList: '查看权限列表',
|
||||
lastShep: '上一步'
|
||||
};
|
||||
|
@ -49,13 +49,16 @@ export default {
|
||||
type: 'text',
|
||||
label: this.$t('orderAuthor.name')
|
||||
},
|
||||
// productType: {
|
||||
// type: 'select',
|
||||
// label: this.$t('orderAuthor.productType'),
|
||||
// config: {
|
||||
// data: []
|
||||
// }
|
||||
// },
|
||||
isPackage: {
|
||||
type: 'select',
|
||||
label: this.$t('orderAuthor.package'),
|
||||
config: {
|
||||
data: [
|
||||
{ value: true, label: this.$t('orderAuthor.package') },
|
||||
{ value: false, label: this.$t('orderAuthor.basePackage') }
|
||||
]
|
||||
}
|
||||
},
|
||||
mapId: {
|
||||
type: 'select',
|
||||
label: this.$t('orderAuthor.map'),
|
||||
|
@ -1,151 +0,0 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="新增商品"
|
||||
:visible.sync="show"
|
||||
top="20px"
|
||||
width="600px"
|
||||
:before-do-close="close"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="close">取 消</el-button>
|
||||
<el-button type="primary" @click="create">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { saveCommodityList } from '@/api/management/goods';
|
||||
|
||||
export default {
|
||||
name: 'DictionaryDetailEdit',
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
TimeStyleList: [],
|
||||
TimeStyleDict: {},
|
||||
formModel: {
|
||||
name: '',
|
||||
permissionName: '',
|
||||
permissionId: '',
|
||||
forever: false,
|
||||
tryUseTime: 0,
|
||||
tryUseTimeUnit: '05',
|
||||
price: 0,
|
||||
remarks: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
||||
form() {
|
||||
return {
|
||||
labelWidth: '135px',
|
||||
items: [
|
||||
{ prop: 'name', label: this.$t('orderAuthor.commodityName'), type: 'text', required: false },
|
||||
{ prop: 'permissionName', label: this.$t('orderAuthor.permission'), type: 'text', required: false, disabled: true },
|
||||
{ prop: 'forever', label: this.$t('orderAuthor.whetherTrial'), type: 'radio', required: false, options: this.$ConstSelect.Whether, disabled: false },
|
||||
{ prop: 'tryUseTimeUnit', label: this.$t('orderAuthor.unitOfTime'), type: 'select', required: false, disabled: false, show: this.isShowForever, options: this.TimeStyleList },
|
||||
{ prop: 'tryUseTime', label: this.$t('orderAuthor.trialTime'), type: 'number', required: false, disabled: false, show: this.isShowForever, message: `${this.TimeStyleDict[this.formModel.tryUseTimeUnit]}` },
|
||||
{ prop: 'price', label: this.$t('orderAuthor.price'), type: 'number', required: false, min: 0.01, message: this.$t('global.yuan') },
|
||||
{ prop: 'remarks', label: this.$t('orderAuthor.describtion'), type: 'textarea', required: false }
|
||||
]
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
rules() {
|
||||
return {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.goodsNameInput'), trigger: 'blur' }
|
||||
],
|
||||
permissionName: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelectPermission'), trigger: 'change' }
|
||||
],
|
||||
forever: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelect'), trigger: 'change' }
|
||||
],
|
||||
tryUseTime: [
|
||||
{ required: true, message: this.$t('rules.trialTimeInput'), trigger: 'change' }
|
||||
],
|
||||
tryUseTimeUnit: [
|
||||
{ required: true, message: this.$t('rules.unitOfTimeRadio'), trigger: 'change' }
|
||||
],
|
||||
price: [
|
||||
{ required: true, message: this.$t('rules.totalPriceInput'), trigger: 'change' },
|
||||
{
|
||||
validator(rule, value, callback) {
|
||||
if (Number(value) >= 0) {
|
||||
if (String(value).split('.')[1] && String(value).split('.')[1].length > 2) {
|
||||
callback(new Error(this.$t('rules.totalPriceInputError1')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
callback(new Error(this.$t('rules.totalPriceInputError2')));
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
remarks: [
|
||||
{ required: true, message: this.$t('rules.goodsDescribtionInput'), trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initLoadPage();
|
||||
},
|
||||
methods: {
|
||||
doShow() {
|
||||
this.show = true;
|
||||
},
|
||||
initLoadPage() {
|
||||
// 时间类型
|
||||
this.TimeStyleDict = {};
|
||||
this.$Dictionary.timeStyleType().then(list => {
|
||||
this.convertList(list, this.TimeStyleList, elem => {
|
||||
return true;
|
||||
});
|
||||
list.forEach(elem => {
|
||||
this.TimeStyleDict[elem.code] = elem.name;
|
||||
});
|
||||
});
|
||||
},
|
||||
buildModel() {
|
||||
// 构造基础数据
|
||||
const model = {
|
||||
name: this.formModel.name,
|
||||
permissionId: this.formModel.permissionId,
|
||||
tryUse: this.formModel.forever,
|
||||
tryUseTime: this.formModel.tryUseTime,
|
||||
tryUseTimeUnit: this.formModel.tryUseTimeUnit,
|
||||
price: this.formModel.price,
|
||||
remarks: this.formModel.remarks
|
||||
};
|
||||
return model;
|
||||
},
|
||||
create() {
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
saveCommodityList(this.buildModel()).then(response => {
|
||||
this.turnback();
|
||||
this.$message.success(this.$t('tip.creatingSuccessful'));
|
||||
}).catch((error) => {
|
||||
this.$messageBox(this.$t('tip.creatingFailed')+':'+error.message);
|
||||
});
|
||||
});
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
||||
</style>
|
@ -1,172 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||
<el-table :data="tableData" border style="width: 100%" :height="height-640">
|
||||
<el-table-column prop="name" :label="this.$t('orderAuthor.permissionName')" />
|
||||
<el-table-column prop="date" :label="this.$t('orderAuthor.permissionType')" />
|
||||
<el-table-column prop="address" :label="this.$t('global.operate')" />
|
||||
</el-table>
|
||||
<add-goods ref="addGoods" @selectGoods="selectGoods" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addGoods from '../../commodity/addGoods';
|
||||
|
||||
export default {
|
||||
name: 'DictionaryDetailEdit',
|
||||
components: {
|
||||
addGoods
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
TimeStyleList: [],
|
||||
TimeStyleDict: {},
|
||||
formModel: {
|
||||
name: '',
|
||||
permissionName: '',
|
||||
permissionId: '',
|
||||
forever: false,
|
||||
tryUseTime: 0,
|
||||
tryUseTimeUnit: '05',
|
||||
price: 0,
|
||||
remarks: ''
|
||||
},
|
||||
tableData: [{
|
||||
date: '2016-05-02',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1518 弄'
|
||||
}, {
|
||||
date: '2016-05-04',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1517 弄'
|
||||
}, {
|
||||
date: '2016-05-01',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1519 弄'
|
||||
}, {
|
||||
date: '2016-05-03',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1516 弄'
|
||||
}]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isShowForever() {
|
||||
return this.formModel.forever;
|
||||
},
|
||||
|
||||
form() {
|
||||
return {
|
||||
labelWidth: '135px',
|
||||
items: [
|
||||
{ prop: 'name', label: this.$t('orderAuthor.commodityName'), type: 'text', required: false },
|
||||
{ prop: 'permissionName', label: this.$t('orderAuthor.permission'), type: 'text', required: false, disabled: true, rightWidth: true, buttontip: this.$t('orderAuthor.selectPermission'), buttonClick: this.buttonClick },
|
||||
{ prop: 'forever', label: this.$t('orderAuthor.whetherTrial'), type: 'radio', required: false, options: this.$ConstSelect.Whether, disabled: false },
|
||||
{ prop: 'tryUseTimeUnit', label: this.$t('orderAuthor.unitOfTime'), type: 'select', required: false, disabled: false, show: this.isShowForever, options: this.TimeStyleList },
|
||||
{ prop: 'tryUseTime', label: this.$t('orderAuthor.trialTime'), type: 'number', required: false, disabled: false, show: this.isShowForever, message: `${this.TimeStyleDict[this.formModel.tryUseTimeUnit]}` },
|
||||
{ prop: 'price', label: this.$t('orderAuthor.price'), type: 'number', required: false, min: 0.01, message: this.$t('global.yuan') },
|
||||
{ prop: 'remarks', label: this.$t('orderAuthor.describtion'), type: 'textarea', required: false }
|
||||
]
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
rules() {
|
||||
return {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.goodsNameInput'), trigger: 'blur' }
|
||||
],
|
||||
permissionName: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelectPermission'), trigger: 'change' }
|
||||
],
|
||||
forever: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelect'), trigger: 'change' }
|
||||
],
|
||||
tryUseTime: [
|
||||
{ required: true, message: this.$t('rules.trialTimeInput'), trigger: 'change' }
|
||||
],
|
||||
tryUseTimeUnit: [
|
||||
{ required: true, message: this.$t('rules.unitOfTimeRadio'), trigger: 'change' }
|
||||
],
|
||||
price: [
|
||||
{ required: true, message: this.$t('rules.totalPriceInput'), trigger: 'change' },
|
||||
{
|
||||
validator(rule, value, callback) {
|
||||
if (Number(value) >= 0) {
|
||||
if (String(value).split('.')[1] && String(value).split('.')[1].length > 2) {
|
||||
callback(new Error(this.$t('rules.totalPriceInputError1')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
callback(new Error(this.$t('rules.totalPriceInputError2')));
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
remarks: [
|
||||
{ required: true, message: this.$t('rules.goodsDescribtionInput'), trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
},
|
||||
height() {
|
||||
return this.$store.state.app.height;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initLoadPage();
|
||||
},
|
||||
methods: {
|
||||
convertList(FromList, ToList, checktypeFunction) {
|
||||
if (FromList) {
|
||||
ToList.length = 0;
|
||||
FromList.forEach(elem => {
|
||||
if (checktypeFunction(elem)) {
|
||||
ToList.push({ value: elem.code, label: elem.name });
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
async initLoadPage() {
|
||||
// 时间类型
|
||||
this.TimeStyleDict = {};
|
||||
this.$Dictionary.timeStyleType().then(list => {
|
||||
this.convertList(list, this.TimeStyleList, elem => {
|
||||
return true;
|
||||
});
|
||||
list.forEach(elem => {
|
||||
this.TimeStyleDict[elem.code] = elem.name;
|
||||
});
|
||||
});
|
||||
},
|
||||
buttonClick() {
|
||||
this.$refs.addGoods.doShow();
|
||||
},
|
||||
|
||||
selectGoods(data) {
|
||||
this.formModel.permissionId = data.id;
|
||||
this.formModel.permissionName = data.name;
|
||||
},
|
||||
buildModel() {
|
||||
// 构造基础数据
|
||||
const model = {
|
||||
name: this.formModel.name,
|
||||
permissionId: this.formModel.permissionId,
|
||||
tryUse: this.formModel.forever,
|
||||
tryUseTime: this.formModel.tryUseTime,
|
||||
tryUseTimeUnit: this.formModel.tryUseTimeUnit,
|
||||
price: this.formModel.price,
|
||||
remarks: this.formModel.remarks,
|
||||
id: this.formModel.id
|
||||
};
|
||||
return model;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
||||
</style>
|
@ -3,59 +3,44 @@
|
||||
<div class="pack-box" :style="{ height: height +'px' }">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" style="">
|
||||
<el-steps class="steps" :active="display" align-center>
|
||||
<el-step title="选择权限" icon="el-icon-edit" />
|
||||
<el-step title="创建商品" icon="el-icon-edit" />
|
||||
<el-step title="创建订单" icon="el-icon-edit" />
|
||||
<el-step :title="$t('permission.selectPermission')" />
|
||||
<el-step :title="$t('permission.createOrder')" />
|
||||
<el-step :title="$t('permission.checkCode')" />
|
||||
</el-steps>
|
||||
<div v-show="display == 0">
|
||||
<permission-form @permissionNext="permissionNext" />
|
||||
<permission-form @permissionNext="permissionNext" @permissionNextOrder="permissionNextOrder" @changeType="changeType" />
|
||||
</div>
|
||||
<div v-show="display == 1">
|
||||
<el-card class="forms pack-rule">
|
||||
<goods-form />
|
||||
</el-card>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="packForm">下一步</el-button>
|
||||
<el-button type="primary" @click="back">上一步</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<order-form ref="orderForm" :permission-type="permissionType" :goods-list="goodsList" @back="back" @orderNext="orderNext" />
|
||||
</div>
|
||||
<div v-show="display == 2">
|
||||
<el-card class="forms pack-rule">
|
||||
<order-form />
|
||||
</el-card>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="createPackage">创建</el-button>
|
||||
<el-button type="primary" @click="back">上一步</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<q-code ref="qCode" />
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
<qr-code ref="qrCode" />
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QrCode from '@/components/QrCode';
|
||||
import GoodsForm from './goods';
|
||||
import OrderForm from './order';
|
||||
import PermissionForm from './permission';
|
||||
import QCode from './qCode';
|
||||
|
||||
export default {
|
||||
name: 'PackRule',
|
||||
components: {
|
||||
QrCode,
|
||||
GoodsForm,
|
||||
OrderForm,
|
||||
PermissionForm
|
||||
PermissionForm,
|
||||
QCode
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
display: 0,
|
||||
urlInfo: {}
|
||||
permissionType: '01',
|
||||
urlInfo: {},
|
||||
permissionVo: {},
|
||||
goodsList: [],
|
||||
orderList: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -64,31 +49,35 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
loadInitData() {
|
||||
|
||||
},
|
||||
packForm() {
|
||||
this.display++;
|
||||
},
|
||||
back() {
|
||||
this.display--;
|
||||
},
|
||||
permissionNext(code) {
|
||||
changeType(code) {
|
||||
this.permissionType = code; // 判断是基础权限 还是 万能权限
|
||||
},
|
||||
// 基础权限走订单函数操作
|
||||
permissionNext(list) {
|
||||
this.goodsList = list; // 基础权限 商品列表
|
||||
this.display = 1;
|
||||
},
|
||||
turnback() {
|
||||
this.$router.go(-1);
|
||||
// 万能权限,走订单路线
|
||||
permissionNextOrder(permission, good) {
|
||||
this.goodsList = [{
|
||||
isPackage: true,
|
||||
id: good.id,
|
||||
permissionId: good.permissionId,
|
||||
name: good.name,
|
||||
remarks: good.remarks,
|
||||
price: good.price
|
||||
}];
|
||||
this.$refs.orderForm.setOrderName(good, permission);
|
||||
this.display = 1;
|
||||
},
|
||||
createPackage() {
|
||||
|
||||
},
|
||||
qrCodeShow() {
|
||||
if (this.$refs) {
|
||||
this.$refs.qrCode.doShow(this.urlInfo);
|
||||
}
|
||||
orderNext(data) {
|
||||
this.display = 2;
|
||||
this.$refs.qCode.qrCodeShow(data);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
100
src/views/orderauthor/permission/create/list.vue
Normal file
100
src/views/orderauthor/permission/create/list.vue
Normal file
@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<el-dialog :title="this.$t('orderAuthor.packingDetails')" :visible.sync="dialogShow" width="800px" :before-close="close">
|
||||
<div>
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPermissonDetail } from '@/api/management/author';
|
||||
|
||||
export default {
|
||||
name: 'Author',
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
id: '',
|
||||
PermissionTypeList: [],
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '140px',
|
||||
reset: true,
|
||||
show: false,
|
||||
queryObject: {
|
||||
}
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('orderAuthor.permissionName'),
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('orderAuthor.permissionType'),
|
||||
prop: 'type',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); },
|
||||
tagType: (row) => { return ''; }
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
loadInitData() {
|
||||
this.$Dictionary.permissionType().then(list => {
|
||||
this.$convertList(list, this.PermissionTypeList, elem => {
|
||||
return true;
|
||||
});
|
||||
});
|
||||
},
|
||||
doShow(id) {
|
||||
this.id = id;
|
||||
this.dialogShow = true;
|
||||
this.reloadTable();
|
||||
},
|
||||
close() {
|
||||
this.id = '';
|
||||
this.dialogShow = false;
|
||||
},
|
||||
queryFunction() {
|
||||
if (this.id) {
|
||||
return getPermissonDetail(this.id);
|
||||
}
|
||||
},
|
||||
reloadTable() {
|
||||
if (this.queryList && this.queryList.reload) {
|
||||
this.queryList.reload();
|
||||
}
|
||||
},
|
||||
turnback() {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.draft {
|
||||
width: 400px;
|
||||
text-align: center;
|
||||
margin: 20px auto;
|
||||
}
|
||||
</style>
|
@ -1,31 +1,62 @@
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<el-scrollbar
|
||||
wrap-class="scrollbar-wrapper"
|
||||
:style="{height:height -70 + 'px'}"
|
||||
style="padding-top: 40px"
|
||||
>
|
||||
<div class="forms pack-rule">
|
||||
<el-table
|
||||
v-if="goodsList.length"
|
||||
:data="goodsList"
|
||||
border
|
||||
style="width: 100%; margin-bottom: 10px;"
|
||||
>
|
||||
<el-table-column prop="name" :label="$t('permission.goodsName')" />
|
||||
<el-table-column prop="price" :label="$t('permission.price')" width="100" />
|
||||
<el-table-column prop="remarks" label="描述" />
|
||||
<el-table-column v-if="goodsList[0].isPackage" :label="this.$t('global.operate')" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="showPermission(scope.$index, scope.row)">{{ $t('permission.permissionList') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" class="data-box" />
|
||||
<add-goods ref="addGoods" @selectGoods="selectGoods" />
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="back">{{ $t('permission.lastShep') }}</el-button>
|
||||
<el-button type="primary" @click="Package">{{ $t('permission.package') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<qr-code ref="qrCode" />
|
||||
<premission-list ref="permissionList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addOrganization, getOrganizationList } from '@/api/management/organization';
|
||||
import { getGoodsList } from '@/api/management/goods';
|
||||
import { getSellerList } from '@/api/management/user';
|
||||
import addGoods from '../../order/addGoods';
|
||||
import { createPermission } from '@/api/management/order';
|
||||
import QrCode from '@/components/QrCode';
|
||||
import PremissionList from './list';
|
||||
|
||||
export default {
|
||||
name: 'OrderForm',
|
||||
components: {
|
||||
addGoods
|
||||
QrCode,
|
||||
PremissionList
|
||||
},
|
||||
props: {
|
||||
permissionType: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
goodsList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
goodsList: [],
|
||||
OrganizationList: [],
|
||||
OrderTypeList: [],
|
||||
SellerList: [],
|
||||
@ -33,6 +64,10 @@ export default {
|
||||
PayTypeList: [],
|
||||
PayStatusTypeList: [],
|
||||
foreverInitData: false,
|
||||
canDistribute: true,
|
||||
urlInfo: {},
|
||||
goodsVo: {},
|
||||
orderList: [],
|
||||
formModel: {
|
||||
organizationId: '',
|
||||
goodsId: '',
|
||||
@ -48,7 +83,8 @@ export default {
|
||||
payWays: '01',
|
||||
payStatus: '02',
|
||||
startTime: '',
|
||||
sellerId: ''
|
||||
sellerId: '',
|
||||
canDistribute: '01'
|
||||
},
|
||||
DatePicker: {
|
||||
shortcuts: [{
|
||||
@ -71,7 +107,11 @@ export default {
|
||||
picker.$emit('pick', date);
|
||||
}
|
||||
}]
|
||||
}
|
||||
},
|
||||
permissionList: [
|
||||
{ value: '01', label: this.$t('orderAuthor.publicAuthority') },
|
||||
{ value: '02', label: this.$t('orderAuthor.privateAuthority') }
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -103,20 +143,21 @@ export default {
|
||||
const form = {
|
||||
labelWidth: this.$i18n.locale == 'en' ? '200px': '145px',
|
||||
items: [
|
||||
{ prop: 'organizationId', label: this.$t('orderAuthor.organizationOrEnterprise'), type: 'select', required: false, options: this.OrganizationList, allowCreate: true, onChange: this.onChange },
|
||||
{ prop: 'goodsName', label: this.$t('orderAuthor.commodityName'), type: 'text', required: false, disabled: true, rightWidth: true, buttontip: '选择商品', buttonClick: this.buttonClick },
|
||||
{ prop: 'price', label: this.$t('orderAuthor.itemPricing'), type: 'number', required: false, disabled: true, min: 0, message: '元' },
|
||||
{ prop: 'orderType', label: this.$t('orderAuthor.orderType'), type: 'select', required: false, options: this.OrderTypeList },
|
||||
{ prop: 'sellerId', label: this.$t('orderAuthor.salesman'), type: 'select', required: false, show: this.isShowSeller, options: this.SellerList },
|
||||
{ prop: 'contractNo', label: this.$t('orderAuthor.contractNumber'), type: 'text', required: false, show: this.isShowContractNo },
|
||||
{ prop: 'amount', label: this.totalTitle, type: 'number', required: false, show: true, min: 0 },
|
||||
{ prop: 'forever', label: this.$t('orderAuthor.permanenceOrNot'), type: 'radio', required: false, options: this.$ConstSelect.Whether, disabled: this.foreverIsDisabled },
|
||||
{ prop: 'startTime', label: this.$t('orderAuthor.startDate'), type: 'date', required: false, show: this.isShowStartDate, viewFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd', picker: this.DatePicker },
|
||||
{ prop: 'monthAmount', label: this.$t('orderAuthor.choosePurchaseTime'), type: 'number', required: false, show: this.isShowMonths, min: 0, message: '月' },
|
||||
{ prop: 'totalPrice', label: this.$t('orderAuthor.totalPrice'), type: 'number', required: false, show: this.isShowPrice, min: 0, message: '元' },
|
||||
{ prop: 'bizType', label: this.$t('orderAuthor.businessType'), type: 'select', required: false, disabled: true, options: this.BizTypeList },
|
||||
{ prop: 'payWays', label: this.$t('orderAuthor.paymentMethod'), type: 'select', required: false, show: this.isShowPayType, options: this.PayTypeList },
|
||||
{ prop: 'payStatus', label: this.$t('orderAuthor.paymentStatus'), type: 'select', required: false, show: this.isShowPayStatus, options: this.PayStatusTypeList }
|
||||
{ prop: 'organizationId', label: this.$t('orderAuthor.organizationOrEnterprise'), type: 'select', options: this.OrganizationList, allowCreate: true, onChange: this.onChange },
|
||||
// { prop: 'goodsName', label: this.$t('orderAuthor.commodityName'), type: 'text', disabled: true },
|
||||
// { prop: 'price', label: this.$t('orderAuthor.itemPricing'), type: 'number', disabled: true, min: 0, message: '元' },
|
||||
{ prop: 'orderType', label: this.$t('orderAuthor.orderType'), type: 'select', options: this.OrderTypeList },
|
||||
{ prop: 'sellerId', label: this.$t('orderAuthor.salesman'), type: 'select', show: this.isShowSeller, options: this.SellerList },
|
||||
{ prop: 'contractNo', label: this.$t('orderAuthor.contractNumber'), type: 'text', show: this.isShowContractNo },
|
||||
{ prop: 'amount', label: this.$t('orderAuthor.choosePermissionNumber'), type: 'number', show: true, min: 0 },
|
||||
{ prop: 'forever', label: this.$t('orderAuthor.permanenceOrNot'), type: 'radio', options: this.$ConstSelect.Whether, disabled: this.foreverIsDisabled },
|
||||
{ prop: 'startTime', label: this.$t('orderAuthor.startDate'), type: 'date', show: this.isShowStartDate, viewFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd', picker: this.DatePicker },
|
||||
{ prop: 'monthAmount', label: this.$t('orderAuthor.choosePurchaseTime'), type: 'number', show: this.isShowMonths, min: 0, message: '月' },
|
||||
{ prop: 'totalPrice', label: this.$t('orderAuthor.totalPrice'), type: 'number', show: this.isShowPrice, min: 0, message: '元' },
|
||||
{ prop: 'bizType', label: this.$t('orderAuthor.businessType'), type: 'select', disabled: true, options: this.BizTypeList },
|
||||
{ prop: 'payWays', label: this.$t('orderAuthor.paymentMethod'), type: 'select', show: this.isShowPayType, options: this.PayTypeList },
|
||||
{ prop: 'payStatus', label: this.$t('orderAuthor.paymentStatus'), type: 'select', show: this.isShowPayStatus, options: this.PayStatusTypeList },
|
||||
{ prop: 'canDistribute', label: this.$t('orderAuthor.optionPrivilegeTransfer'), type: 'radio', options: this.permissionList }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
@ -127,12 +168,6 @@ export default {
|
||||
organizationId: [
|
||||
{ required: true, message: this.$t('rules.organizationInput'), trigger: 'blur' }
|
||||
],
|
||||
goodsName: [
|
||||
{ required: true, message: this.$t('rules.productSelect'), trigger: 'change' }
|
||||
],
|
||||
price: [
|
||||
{ required: true, message: this.$t('rules.itemPricingInput'), trigger: 'blur' }
|
||||
],
|
||||
orderType: [
|
||||
{ required: true, message: this.$t('rules.orderTypeSelect'), trigger: 'change' }
|
||||
],
|
||||
@ -221,25 +256,10 @@ export default {
|
||||
buttonClick() {
|
||||
this.$refs.addGoods.doShow();
|
||||
},
|
||||
selectGoods(data) {
|
||||
this.formModel.goodsId = data.id;
|
||||
this.formModel.goodsName = data.name;
|
||||
this.formModel.price = data.price;
|
||||
},
|
||||
initLoadPage() {
|
||||
// 加载字典数据
|
||||
// 加载发布课程列表
|
||||
this.loading = false;
|
||||
this.goodsList.length = 0;
|
||||
getGoodsList().then(response => {
|
||||
const data = response.data;
|
||||
if (data && data.length) {
|
||||
data.forEach(elem => {
|
||||
this.goodsList.push({ value: elem.id, label: elem.name, price: elem.price });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 加载组织列表
|
||||
this.OrganizationList.length = 0;
|
||||
getOrganizationList().then(response => {
|
||||
@ -256,12 +276,6 @@ export default {
|
||||
});
|
||||
});
|
||||
|
||||
// this.$Dictionary.permissionType().then(list => {
|
||||
// this.$convertList(list, this.PermissionTypeList, elem => {
|
||||
// return true;
|
||||
// });
|
||||
// });
|
||||
|
||||
this.$Dictionary.orderType().then(list => {
|
||||
this.$convertList(list, this.OrderTypeList, elem => {
|
||||
return elem.code !== '01'; // 过滤个人
|
||||
@ -319,12 +333,106 @@ export default {
|
||||
this.$message.info(this.$t('error.cancelled'));
|
||||
});
|
||||
},
|
||||
turnback() {
|
||||
this.$router.go(-1);
|
||||
showPermission(index, row) {
|
||||
this.$refs.permissionList.doShow(row.permissionId);
|
||||
},
|
||||
// 第一个参数 商品对象、 第二个参数 权限对象
|
||||
setOrderName(data, permission) {
|
||||
if (data) {
|
||||
this.formModel.goodsName = data.name;
|
||||
this.formModel.price = data.price;
|
||||
this.formModel.goodsId = data.id;
|
||||
this.goodsVo = {};
|
||||
this.permissionVo = permission; // 权限对象
|
||||
if (!this.permissionVo.id) {
|
||||
this.goodsVo = data;
|
||||
}
|
||||
}
|
||||
},
|
||||
Package() {
|
||||
if (this.permissionType == '01') {
|
||||
this.createPackage();
|
||||
} else if (this.permissionType == '02') {
|
||||
this.createPermission();
|
||||
}
|
||||
},
|
||||
createPackage() {
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
this.orderList = [];
|
||||
this.goodsList.forEach(item => {
|
||||
this.formModel.goodsId = item.id;
|
||||
this.formModel.goodsName = item.name;
|
||||
this.formModel.price = item.price;
|
||||
this.orderList.push(this.formModel);
|
||||
});
|
||||
this.packForm(); // 打包 生成二维码
|
||||
});
|
||||
},
|
||||
packForm() {
|
||||
if (this.orderList && this.orderList.length) {
|
||||
const arr = this.goodsList.map(nor => {
|
||||
return nor.permissionId;
|
||||
});
|
||||
const param = {
|
||||
createVO: {isPackage: false, relPermissions: arr},
|
||||
orderList: this.orderList,
|
||||
canDistribute: this.formModel.canDistribute == '01'
|
||||
};
|
||||
createPermission(param).then(res => {
|
||||
this.urlInfo = {
|
||||
url: res.data,
|
||||
title: this.$t('orderAuthor.permissionToDistributeQRCode')
|
||||
};
|
||||
this.$emit('orderNext', this.urlInfo);
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
} else {
|
||||
this.$messageBox(this.$t('tip.selectPackagingRecord'));
|
||||
}
|
||||
},
|
||||
// 万能权限生成订单,生成二维码
|
||||
createPermission() {
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
const param = {
|
||||
createVO: {
|
||||
isPackage: true,
|
||||
relPermissions: this.permissionVo.relPermissions,
|
||||
permissionName: this.permissionVo.name,
|
||||
id: this.permissionVo.id,
|
||||
remarks: this.permissionVo.remarks
|
||||
},
|
||||
goodsVO: this.goodsVo,
|
||||
orderList: [this.formModel],
|
||||
canDistribute: this.formModel.canDistribute == '01'
|
||||
};
|
||||
createPermission(param).then(res => {
|
||||
this.urlInfo = {
|
||||
url: res.data,
|
||||
title: this.$t('orderAuthor.permissionToDistributeQRCode')
|
||||
};
|
||||
this.$emit('orderNext', this.urlInfo);
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
back() {
|
||||
this.$emit('back');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
||||
.pack-rule {
|
||||
width: 800px;
|
||||
margin: 0 auto;
|
||||
margin-top: 12px;
|
||||
padding: 40px;
|
||||
}
|
||||
.draft {
|
||||
width: 400px;
|
||||
text-align: center;
|
||||
margin: 20px auto;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,16 +1,51 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card class="forms pack-rule">
|
||||
<div class="forms pack-rule">
|
||||
<div class="title_nav">
|
||||
<div class="map_title">{{ $t('orderAuthor.mapName') }}:</div>
|
||||
<el-select v-model="addModel.mapId" :disabled="ruleList.length ? true : false" size="small">
|
||||
<el-option
|
||||
v-for="item in mapList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="table_box">
|
||||
<el-button class="addList" size="small" @click="dialogSelect">{{ $t('orderAuthor.addPermissions') }}</el-button>
|
||||
<el-table :data="ruleList" border style="width: 100%">
|
||||
<el-table-column prop="name" :label="this.$t('orderAuthor.permissionName')" />
|
||||
<el-table-column prop="type" :label="this.$t('orderAuthor.permissionType')">
|
||||
<template slot-scope="scope">
|
||||
{{ computedName(PermissionTypeList, scope.row.type) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="addModel.type == '01'" prop="price" label="价格">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.price">{{ scope.row.price }}</div>
|
||||
<div v-if="!scope.row.price">
|
||||
<el-input v-model="scope.row.payPrice" placeholder="请输入价格" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="this.$t('global.operate')" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-form ref="formData" label-width="130px" :model="addModel" size="mini" :rules="rules" class="rule_box">
|
||||
<el-form-item label="权限类型" prop="type">
|
||||
<el-form-item label="权限类型:">
|
||||
<el-radio-group v-model="addModel.type">
|
||||
<el-radio v-for="item in permissionType" :key="item.value" :label="item.value">{{ item.label }}</el-radio>
|
||||
<el-radio v-for="item in permissionType" :key="item.value" :label="item.value" @change="changeRadio">{{ item.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="addModel.type == '02'" :label="this.$t('orderAuthor.permissionName') + ':'" prop="name">
|
||||
<el-form-item v-show="addModel.type == '02'" :label="$t('orderAuthor.permissionGoodName') + ':'" prop="name">
|
||||
<el-input v-model="addModel.name" size="small" />
|
||||
</el-form-item>
|
||||
<el-form-item v-show="addModel.type == '02'" :label="this.$t('orderAuthor.describtion') + ':'" prop="remarks">
|
||||
<el-form-item v-show="addModel.type == '02'" :label="$t('orderAuthor.describtion') + ':'">
|
||||
<el-input
|
||||
v-model="addModel.remarks"
|
||||
type="textarea"
|
||||
@ -19,39 +54,30 @@
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('orderAuthor.mapName') + ':'">
|
||||
<el-select v-model="addModel.mapId" :disabled="ruleList.length ? true : false">
|
||||
<el-form-item v-show="addModel.type == '02' && !isGoods" :label="$t('orderAuthor.price') + ':'" prop="price">
|
||||
<el-input-number v-model="addModel.price" :min="0.01" />
|
||||
<span style="padding-left: 20px; font-size: 12px; color: #a9a9a9;">{{ $t('global.yuan') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="addModel.type == '02' && !isGoods" :label="$t('orderAuthor.whetherTrial')" prop="forever">
|
||||
<el-radio-group v-model="addModel.forever">
|
||||
<el-radio v-for="option in $ConstSelect.Whether" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="addModel.type == '02' && addModel.forever && !isGoods" :label="$t('orderAuthor.unitOfTime')" prop="tryUseTimeUnit">
|
||||
<el-select v-model="addModel.tryUseTimeUnit" filterable>
|
||||
<el-option
|
||||
v-for="item in mapList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
v-for="option in TimeStyleList"
|
||||
:key="option.value"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="addModel.type == '02' && addModel.forever && !isGoods" :label="$t('orderAuthor.price') + ':'" prop="tryUseTime">
|
||||
<el-input-number v-model="addModel.tryUseTime" :min="0.01" />
|
||||
<span style="padding-left: 20px; font-size: 12px; color: #a9a9a9;">{{ TimeStyleDict[addModel.tryUseTimeUnit] }}</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div>
|
||||
<el-button class="addList" size="small" @click="dialogSelect">{{ $t('orderAuthor.addPermissions') }}</el-button>
|
||||
<el-table
|
||||
:data="ruleList"
|
||||
border
|
||||
style="width: 100%"
|
||||
:height="addModel.type == '01' ? height-400 : height-500"
|
||||
>
|
||||
<el-table-column prop="name" :label="this.$t('orderAuthor.permissionName')" />
|
||||
<el-table-column prop="type" :label="this.$t('orderAuthor.permissionType')">
|
||||
<template slot-scope="scope">
|
||||
{{ computedName(PermissionTypeList, scope.row.type) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="this.$t('global.operate')" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}</el-button>
|
||||
<el-button v-if="scope.row.flag" type="text" size="small" @click="createGood(scope.$index, scope.row)">创建商品</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<choose-permission
|
||||
ref="choosePermission"
|
||||
:rule-list="ruleList"
|
||||
@ -60,12 +86,11 @@
|
||||
@addRuleForm="addRuleForm"
|
||||
@deleteForm="deleteForm"
|
||||
/>
|
||||
<create-good ref="createGood" />
|
||||
</el-card>
|
||||
</div>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="permissionNext">下一步</el-button>
|
||||
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
|
||||
<el-button type="primary" @click="permissionNext">下一步</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
@ -73,37 +98,45 @@
|
||||
|
||||
<script>
|
||||
import ChoosePermission from '../../author/draft/choosePermission';
|
||||
import CreateGood from './createGood';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import { listPublishMap } from '@/api/jmap/map';
|
||||
import { getPermissionGoods } from '@/api/management/goods';
|
||||
import { getPermissionGoods, postsPermissionGoods } from '@/api/management/goods';
|
||||
import { postFindPermission } from '@/api/management/order';
|
||||
|
||||
export default {
|
||||
name: 'PermissionForm',
|
||||
components: {
|
||||
ChoosePermission,
|
||||
CreateGood
|
||||
ChoosePermission
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ruleList: [],
|
||||
ruleList: [], // 权限列表
|
||||
TimeStyleList: [],
|
||||
EffectiveTypeList: [],
|
||||
PermissionTypeList: [],
|
||||
permissionType: [
|
||||
{value: '01', label: '基础权限'},
|
||||
{value: '02', label: '权限包'}
|
||||
{value: '02', label: '万能权限'}
|
||||
],
|
||||
isGoods: true,
|
||||
mapList: [],
|
||||
goodsList: [],
|
||||
goodsList: [], // 商品列表
|
||||
goodsListNew: [],
|
||||
addModel: {
|
||||
type: '01',
|
||||
name: '',
|
||||
remarks: '',
|
||||
mapId: ''
|
||||
mapId: '',
|
||||
price: '',
|
||||
forever: false,
|
||||
tryUseTimeUnit: '05',
|
||||
tryUseTime: 0
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.enterPermissionName'), trigger: 'blur' }
|
||||
],
|
||||
price: [
|
||||
{ required: true, message: '请输入商品价格', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
@ -113,11 +146,65 @@ export default {
|
||||
return this.$store.state.app.height - 65;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
ruleList(list) {
|
||||
if (this.addModel.type == '02') {
|
||||
const arr = list.map(item => {
|
||||
return item.id;
|
||||
});
|
||||
postFindPermission(arr).then(res => {
|
||||
this.isGoods = true;
|
||||
if (!res.data) {
|
||||
this.isGoods = false;
|
||||
} else {
|
||||
this.addModel.name = res.data.name;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
convertList(FromList, ToList, checktypeFunction) {
|
||||
if (FromList) {
|
||||
ToList.length = 0;
|
||||
FromList.forEach(elem => {
|
||||
if (checktypeFunction(elem)) {
|
||||
ToList.push({ value: elem.code, label: elem.name });
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
changeRadio(data) {
|
||||
this.$emit('changeType', data);
|
||||
if (data == '02') {
|
||||
const arr = this.ruleList.map(item => {
|
||||
return item.id;
|
||||
});
|
||||
postFindPermission(arr).then(res => {
|
||||
this.isGoods = true;
|
||||
if (!res.data) {
|
||||
this.isGoods = false;
|
||||
} else {
|
||||
this.addModel.name = res.data.name;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
async loadInitData() {
|
||||
// 时间类型
|
||||
this.TimeStyleDict = {};
|
||||
this.$Dictionary.timeStyleType().then(list => {
|
||||
this.convertList(list, this.TimeStyleList, elem => {
|
||||
return true;
|
||||
});
|
||||
list.forEach(elem => {
|
||||
this.TimeStyleDict[elem.code] = elem.name;
|
||||
});
|
||||
});
|
||||
|
||||
this.EffectiveTypeList = [];
|
||||
this.$Dictionary.effectiveType().then(list => {
|
||||
this.EffectiveTypeList = list.map(elem => { return { value: elem.code, label: elem.name }; });
|
||||
@ -154,15 +241,18 @@ export default {
|
||||
row['isPut'] = false;
|
||||
this.ruleList.splice(idx, 1);
|
||||
}
|
||||
EventBus.$emit('reloadTable', { index: index, list: row });
|
||||
},
|
||||
createGood(index, row) {
|
||||
this.$refs.createGood.doShow();
|
||||
},
|
||||
addRuleForm(index, row) {
|
||||
row['isPut'] = true;
|
||||
getPermissionGoods(row.id).then(res => {
|
||||
if (res.data.length) {
|
||||
row.price = res.data[0].price;
|
||||
if (this.addModel.type == '01') {
|
||||
row.goods = res.data[0];
|
||||
}
|
||||
}
|
||||
});
|
||||
this.ruleList.push(row);
|
||||
EventBus.$emit('reloadTable', { index: index, list: row });
|
||||
},
|
||||
dialogSelect(row) {
|
||||
if (this.addModel.mapId) {
|
||||
@ -171,32 +261,100 @@ export default {
|
||||
this.$messageBox(this.$t('rules.mapInput'));
|
||||
}
|
||||
},
|
||||
buildModel(data) {
|
||||
// 构造基础数据
|
||||
const model = {
|
||||
name: data.name,
|
||||
permissionId: data.id,
|
||||
tryUse: false,
|
||||
tryUseTime: 0,
|
||||
tryUseTimeUnit: '05',
|
||||
price: data.price,
|
||||
remarks: data.remarks
|
||||
};
|
||||
return model;
|
||||
},
|
||||
async permissionNext() {
|
||||
if (this.ruleList.length) {
|
||||
const arr = this.ruleList.map(item => {
|
||||
return item.id;
|
||||
});
|
||||
const res = await getPermissionGoods(arr.join(','));
|
||||
if (res.code == 200) {
|
||||
this.goodsList = res.data;
|
||||
if (this.goodsList.length == this.ruleList.length) {
|
||||
this.$emit('permissionNext', this.addModel.type);
|
||||
} else {
|
||||
this.goodsList.forEach(nor => {
|
||||
this.ruleList.forEach(ele => {
|
||||
if (nor.permissionId == ele.id) {
|
||||
ele.createGood = true;
|
||||
const arr = this.ruleList.map(item => { return item.id; });
|
||||
if (this.addModel.type == '01') {
|
||||
const list = [];
|
||||
const goodsList = [];
|
||||
this.ruleList.forEach(nor => {
|
||||
if (nor.payPrice) {
|
||||
nor.price = nor.payPrice;
|
||||
goodsList.push(this.buildModel(nor));
|
||||
}
|
||||
if (nor.price) {
|
||||
nor.payPrice = '';
|
||||
list.push(nor);
|
||||
}
|
||||
});
|
||||
if (goodsList.length) {
|
||||
try {
|
||||
const response = await postsPermissionGoods({goodsVOList: goodsList});
|
||||
if (response.code == 200) {
|
||||
this.goodsListNew = response.data;
|
||||
}
|
||||
} catch (error) { this.goodsList = []; }
|
||||
}
|
||||
if (list.length == this.ruleList.length) {
|
||||
this.goodsList = [];
|
||||
this.ruleList.forEach(item => {
|
||||
this.goodsListNew.forEach(ele => {
|
||||
if (item.id == ele.permissionId) {
|
||||
item.goods = ele;
|
||||
}
|
||||
});
|
||||
item.goods && this.goodsList.push(item.goods);
|
||||
});
|
||||
this.ruleList.forEach(item => {
|
||||
item.flag = true;
|
||||
if (item.createGood) {
|
||||
item.flag = false;
|
||||
}
|
||||
});
|
||||
this.$messageBox('基础权限没有对应商品类型, 请创建商品');
|
||||
if (this.goodsList.length == this.ruleList.length) {
|
||||
this.$emit('permissionNext', this.goodsList);
|
||||
}
|
||||
} else {
|
||||
this.$messageBox('基础权限没有对应商品类型, 请填写商品价格会自动创建');
|
||||
}
|
||||
} else if (this.addModel.type == '02') {
|
||||
this.$refs.formData.validate((valid) => {
|
||||
if (valid) { // 判断是否有重复万能权限 有的话使用有的权限
|
||||
postFindPermission(arr).then(res => {
|
||||
this.addModel['relPermissions'] = arr;
|
||||
if (res.data) {
|
||||
this.addModel.name = res.data.name;
|
||||
this.addModel.remarks = res.data.remarks;
|
||||
this.$confirm('选择的权限已存在对应商品,是否创建订单', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.addModel['id'] = res.data.id;
|
||||
const good = {
|
||||
id: res.data.goodsId,
|
||||
permissionId: res.data.id,
|
||||
name: res.data.prdName,
|
||||
price: res.data.prdPrice,
|
||||
remarks: res.data.remarks
|
||||
};
|
||||
this.$emit('permissionNextOrder', this.addModel, good);
|
||||
});
|
||||
} else {
|
||||
this.addModel['id'] = '';
|
||||
// 创建万能权限商品 接口
|
||||
const good = {
|
||||
name: this.addModel.name,
|
||||
permissionId: this.addModel.id,
|
||||
tryUse: this.addModel.forever,
|
||||
tryUseTime: this.addModel.tryUseTime,
|
||||
tryUseTimeUnit: this.addModel.tryUseTimeUnit,
|
||||
price: this.addModel.price,
|
||||
remarks: this.addModel.remarks
|
||||
};
|
||||
this.$emit('permissionNextOrder', this.addModel, good);
|
||||
}
|
||||
// this.$emit('permissionNextOrder', this.addModel, good);
|
||||
}).catch((error) => { console.log(error); });
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.$messageBox('请添加权限');
|
||||
@ -209,6 +367,16 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.map_title{
|
||||
float: left;
|
||||
margin-right: 8px;
|
||||
width: 120px;
|
||||
text-align: right;
|
||||
line-height: 30px;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
font-weight: 700;
|
||||
}
|
||||
.pack-rule {
|
||||
width: 800px;
|
||||
margin: 0 auto;
|
||||
|
63
src/views/orderauthor/permission/create/qCode.vue
Normal file
63
src/views/orderauthor/permission/create/qCode.vue
Normal file
@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="pack-box">
|
||||
<div style="text-align:center; margin:auto; margin-top: 35px;">
|
||||
<qrcode-vue v-loading="loading" :value="url" :size="500" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button @click="turnback">返回</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import QrcodeVue from 'qrcode.vue';
|
||||
|
||||
export default {
|
||||
name: 'QCode',
|
||||
components: {
|
||||
QrcodeVue
|
||||
},
|
||||
props: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
url: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
qrCodeShow(data) { // 生成二维码
|
||||
console.log(data);
|
||||
this.url = data.url;
|
||||
},
|
||||
turnback() {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.pack-rule {
|
||||
width: 800px;
|
||||
margin: 0 auto;
|
||||
margin-top: 12px;
|
||||
padding: 40px;
|
||||
}
|
||||
.draft {
|
||||
width: 400px;
|
||||
text-align: center;
|
||||
margin: 20px auto;
|
||||
}
|
||||
</style>
|
@ -148,7 +148,7 @@ export default {
|
||||
],
|
||||
actions: [
|
||||
{ text: this.$t('orderAuthor.privilegePackaging'), btnCode: 'employee_insert', handler: this.handlePackage },
|
||||
// { text: this.$t('orderAuthor.createPackage'), handler: this.handleCreatePackage },
|
||||
{ text: this.$t('orderAuthor.createPackage'), handler: this.handleCreatePackage },
|
||||
{ text: this.$t('orderAuthor.receivingPermission'), handler: this.handlerPermission, show: process.env.NODE_ENV == 'development' }
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user