Merge branch 'dev' of https://git.code.tencent.com/lian-cbtc/jl-client into dev
This commit is contained in:
commit
e6893b8cb7
@ -124,7 +124,8 @@ export function getGoodsByPermissionId(id) {
|
|||||||
// 创建商品
|
// 创建商品
|
||||||
export function postsPermissionGoods(data) {
|
export function postsPermissionGoods(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/api/goods`,
|
// url: `/api/goods`,
|
||||||
|
url: `/api/goods/create/list`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
@ -138,3 +139,12 @@ export function postPermissionIdsGoods(data) {
|
|||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 创建万能权限商品
|
||||||
|
export function postCreatePackage(data) {
|
||||||
|
return request({
|
||||||
|
url: `/api/goods/create/package`,
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -107,7 +107,8 @@ export function cancalOrder(orderId) {
|
|||||||
// 快速创建权限
|
// 快速创建权限
|
||||||
export function createPermission(data) {
|
export function createPermission(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/api/order/quicklyGenerateOrder`,
|
// url: `/api/order/quicklyGenerateOrder`,
|
||||||
|
url: `/api/distribute/createQuickly`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
|
@ -137,7 +137,7 @@ export default {
|
|||||||
// 默认个人地图绘制可以滚轮放大缩小 其他地图显示不允许此操作
|
// 默认个人地图绘制可以滚轮放大缩小 其他地图显示不允许此操作
|
||||||
const path = window.location.href;
|
const path = window.location.href;
|
||||||
let mouseWheelFlag = false;
|
let mouseWheelFlag = false;
|
||||||
if (path.includes('design/userlist/map/draw')) {
|
if (path.includes('design/userlist/map/draw') || path.includes('design/usermap/map/draw')) {
|
||||||
mouseWheelFlag = true;
|
mouseWheelFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,13 +218,13 @@ export default {
|
|||||||
const newModal = Object.assign({}, station);
|
const newModal = Object.assign({}, station);
|
||||||
newModal.controlled = false;
|
newModal.controlled = false;
|
||||||
newModal.concentrateStationCode = '';
|
newModal.concentrateStationCode = '';
|
||||||
this.setStationStand(station,'');
|
this.setStationStand(station, '');
|
||||||
data.forEach(each=>{
|
data.forEach(each=>{
|
||||||
switch (each) {
|
switch (each) {
|
||||||
case station.code: {
|
case station.code: {
|
||||||
newModal.controlled = true;
|
newModal.controlled = true;
|
||||||
newModal.concentrateStationCode = this.editModel.code;
|
newModal.concentrateStationCode = this.editModel.code;
|
||||||
this.setStationStand(station,this.editModel.code);
|
this.setStationStand(station, this.editModel.code);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ export default {
|
|||||||
this.edit();
|
this.edit();
|
||||||
this.modifyChargeStation();
|
this.modifyChargeStation();
|
||||||
this.setStationStand(this.editModel, '');
|
this.setStationStand(this.editModel, '');
|
||||||
}else {
|
} else {
|
||||||
this.setStationStand(this.editModel, this.editModel.code);
|
this.setStationStand(this.editModel, this.editModel.code);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('map.equipmentStation')" prop="deviceStationCode">
|
<!-- <el-form-item :label="$t('map.equipmentStation')" prop="deviceStationCode">
|
||||||
<el-select v-model="addModel.deviceStationCode" filterable disabled>
|
<el-select v-model="addModel.deviceStationCode" filterable disabled>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in stationList"
|
v-for="item in stationList"
|
||||||
@ -36,7 +36,7 @@
|
|||||||
:value="item.code"
|
:value="item.code"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item :label="$t('map.stationstandDirection')" prop="doorLocationType">
|
<el-form-item :label="$t('map.stationstandDirection')" prop="doorLocationType">
|
||||||
<el-select v-model="addModel.doorLocationType" filterable :placeholder="$t('map.pleaseSelect')">
|
<el-select v-model="addModel.doorLocationType" filterable :placeholder="$t('map.pleaseSelect')">
|
||||||
<el-option
|
<el-option
|
||||||
@ -202,7 +202,7 @@ export default {
|
|||||||
],
|
],
|
||||||
doorLocationType: [
|
doorLocationType: [
|
||||||
{ required: true, message: this.$t('rules.doorLocationType'), trigger: 'change' }
|
{ required: true, message: this.$t('rules.doorLocationType'), trigger: 'change' }
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -228,14 +228,13 @@ export default {
|
|||||||
updateView() {
|
updateView() {
|
||||||
this.edit();
|
this.edit();
|
||||||
},
|
},
|
||||||
changeStation(data){
|
changeStation(data) {
|
||||||
let station=this.stationList.find(elem => {return elem.code==data});
|
const station = this.stationList.find(elem => { return elem.code == data;});
|
||||||
if(station){
|
if (station) {
|
||||||
if(station.centralized){
|
if (station.centralized) {
|
||||||
this.addModel.deviceStationCode=station.code;
|
this.addModel.deviceStationCode = station.code;
|
||||||
}
|
} else {
|
||||||
else{
|
this.addModel.deviceStationCode = station.concentrateStationCode;
|
||||||
this.addModel.deviceStationCode=station.concentrateStationCode;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
114
src/views/orderauthor/permission/create/edit.vue
Normal file
114
src/views/orderauthor/permission/create/edit.vue
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog v-dialogDrag :title="this.$t('orderAuthor.oneClickGenerationPermission')" :visible.sync="dialogShow" width="500px" :before-close="handleClose">
|
||||||
|
<div>
|
||||||
|
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||||
|
</div>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
|
||||||
|
<el-button type="primary" :loading="loading" @click="saveAs">{{ $t('map.confirm') }}</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { updataCommodityList } from '@/api/management/goods';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Edit',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogShow: false,
|
||||||
|
loading: false,
|
||||||
|
formModel: {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
price: 0
|
||||||
|
// remarks: ''
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
form() {
|
||||||
|
return {
|
||||||
|
labelWidth: '110px',
|
||||||
|
items: [
|
||||||
|
{ prop: 'name', label: this.$t('orderAuthor.commodityName') + ':', type: 'text', required: false },
|
||||||
|
{ 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' }
|
||||||
|
],
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
doShow(data) {
|
||||||
|
this.dialogShow = true;
|
||||||
|
console.log(data);
|
||||||
|
this.formModel = {
|
||||||
|
id: data.goods.id,
|
||||||
|
name: data.name,
|
||||||
|
price: data.price
|
||||||
|
// remarks: data.remarks
|
||||||
|
};
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.formModel = {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
price: 0
|
||||||
|
// remarks: ''
|
||||||
|
};
|
||||||
|
this.dialogShow = false;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
buildModel() { // 构造基础数据
|
||||||
|
return {
|
||||||
|
id: this.formModel.id,
|
||||||
|
name: this.formModel.name,
|
||||||
|
price: this.formModel.price
|
||||||
|
// remarks: this.formModel.remarks
|
||||||
|
};
|
||||||
|
},
|
||||||
|
saveAs() {
|
||||||
|
this.$refs.dataform.validateForm(() => {
|
||||||
|
this.loading = true;
|
||||||
|
updataCommodityList(this.buildModel()).then(response => {
|
||||||
|
this.$message.success(this.$t('tip.updateSuccessfully'));
|
||||||
|
this.$emit('reloadTable', this.buildModel());
|
||||||
|
this.handleClose();
|
||||||
|
}).catch(() => {
|
||||||
|
this.$messageBox(this.$t('tip.updateFailed'));
|
||||||
|
this.handleClose();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -56,7 +56,7 @@ export default {
|
|||||||
this.display = 1;
|
this.display = 1;
|
||||||
},
|
},
|
||||||
// 万能权限,走订单路线
|
// 万能权限,走订单路线
|
||||||
permissionNextOrder(permission, good) {
|
permissionNextOrder(good) {
|
||||||
this.goodsList = [{
|
this.goodsList = [{
|
||||||
isPackage: true,
|
isPackage: true,
|
||||||
id: good.id,
|
id: good.id,
|
||||||
@ -66,7 +66,6 @@ export default {
|
|||||||
price: good.price,
|
price: good.price,
|
||||||
list: good.list
|
list: good.list
|
||||||
}];
|
}];
|
||||||
this.$refs.orderForm.setOrderName(permission, good);
|
|
||||||
this.display = 1;
|
this.display = 1;
|
||||||
},
|
},
|
||||||
orderNext(data) {
|
orderNext(data) {
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="forms pack-rule">
|
<div class="forms pack-rule">
|
||||||
<el-table
|
<el-table v-if="goodsList.length" :data="goodsList" border style="width: 100%; margin-bottom: 10px;">
|
||||||
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="name" :label="$t('permission.goodsName')" />
|
||||||
<el-table-column prop="price" :label="$t('permission.price')" width="100" />
|
<el-table-column prop="price" :label="$t('permission.price')" width="100" />
|
||||||
<el-table-column prop="remarks" label="描述" />
|
<el-table-column prop="remarks" label="描述" />
|
||||||
@ -33,7 +28,6 @@ import { addOrganization, getOrganizationList } from '@/api/management/organizat
|
|||||||
import { getSellerList } from '@/api/management/user';
|
import { getSellerList } from '@/api/management/user';
|
||||||
import { createPermission } from '@/api/management/order';
|
import { createPermission } from '@/api/management/order';
|
||||||
import PremissionList from './list';
|
import PremissionList from './list';
|
||||||
// import { deepAssign } from '@/utils/index';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OrderForm',
|
name: 'OrderForm',
|
||||||
@ -64,7 +58,6 @@ export default {
|
|||||||
foreverInitData: false,
|
foreverInitData: false,
|
||||||
canDistribute: true,
|
canDistribute: true,
|
||||||
urlInfo: {},
|
urlInfo: {},
|
||||||
goodsVo: {},
|
|
||||||
orderList: [],
|
orderList: [],
|
||||||
formModel: {
|
formModel: {
|
||||||
organizationId: '',
|
organizationId: '',
|
||||||
@ -138,7 +131,7 @@ export default {
|
|||||||
return this.foreverInitData;
|
return this.foreverInitData;
|
||||||
},
|
},
|
||||||
form() {
|
form() {
|
||||||
const form = {
|
return {
|
||||||
labelWidth: this.$i18n.locale == 'en' ? '200px' : '145px',
|
labelWidth: this.$i18n.locale == 'en' ? '200px' : '145px',
|
||||||
items: [
|
items: [
|
||||||
{ prop: 'organizationId', label: this.$t('orderAuthor.organizationOrEnterprise'), type: 'select', options: this.OrganizationList, allowCreate: true, onChange: this.onChange },
|
{ prop: 'organizationId', label: this.$t('orderAuthor.organizationOrEnterprise'), type: 'select', options: this.OrganizationList, allowCreate: true, onChange: this.onChange },
|
||||||
@ -156,7 +149,6 @@ export default {
|
|||||||
{ prop: 'canDistribute', label: this.$t('orderAuthor.optionPrivilegeTransfer'), type: 'radio', options: this.permissionList }
|
{ prop: 'canDistribute', label: this.$t('orderAuthor.optionPrivilegeTransfer'), type: 'radio', options: this.permissionList }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
return form;
|
|
||||||
},
|
},
|
||||||
rules() {
|
rules() {
|
||||||
const _this = this;
|
const _this = this;
|
||||||
@ -329,18 +321,6 @@ export default {
|
|||||||
showPermission(index, row) {
|
showPermission(index, row) {
|
||||||
this.$refs.permissionList.doShow(row.list);
|
this.$refs.permissionList.doShow(row.list);
|
||||||
},
|
},
|
||||||
// 第一个参数 商品对象、 第二个参数 权限对象
|
|
||||||
setOrderName(permission, good) {
|
|
||||||
if (good) {
|
|
||||||
this.formModel = { // 订单数据
|
|
||||||
goodsName: good.name,
|
|
||||||
price: good.price,
|
|
||||||
goodsId: good.id
|
|
||||||
};
|
|
||||||
this.permissionVo = permission; // 权限对象
|
|
||||||
this.goodsVo = good; // 商品对象
|
|
||||||
}
|
|
||||||
},
|
|
||||||
buildModel() {
|
buildModel() {
|
||||||
// 如果新增的条目不存在字典当中,则需要在临时字典中取对应的值
|
// 如果新增的条目不存在字典当中,则需要在临时字典中取对应的值
|
||||||
let orgzId = this.formModel.organizationId;
|
let orgzId = this.formModel.organizationId;
|
||||||
@ -377,27 +357,24 @@ export default {
|
|||||||
packForm() {
|
packForm() {
|
||||||
if (this.orderList && this.orderList.length) {
|
if (this.orderList && this.orderList.length) {
|
||||||
const arr = this.goodsList.map(nor => {
|
const arr = this.goodsList.map(nor => {
|
||||||
return nor.permissionId;
|
return nor.goodItem.id;
|
||||||
});
|
});
|
||||||
const param = {
|
const param = {
|
||||||
isPackage: false,
|
canDistribute: this.formModel.canDistribute == '01',
|
||||||
// 订单数据 formModel
|
orderCreateVO: {
|
||||||
organizationId: this.formModel.organizationId,
|
amount: this.formModel.amount,
|
||||||
packageNum: this.formModel.amount,
|
contractNo: this.formModel.contractNo,
|
||||||
amount: this.formModel.amount,
|
forever: this.formModel.forever,
|
||||||
monthAmount: this.formModel.monthAmount,
|
goodsIds: arr,
|
||||||
packageName: this.goodsVo.name,
|
monthAmount: this.formModel.monthAmount,
|
||||||
totalPrice: this.formModel.totalPrice,
|
orderType: this.formModel.orderType,
|
||||||
orderType: this.formModel.orderType,
|
organizationId: this.formModel.organizationId,
|
||||||
distributeType: this.formModel.canDistribute == '01',
|
payStatus: this.formModel.payStatus,
|
||||||
startTime: this.formModel.startTime,
|
payWays: this.formModel.payWays,
|
||||||
payStatus: this.formModel.payStatus,
|
price: this.formModel.price,
|
||||||
bizType: this.formModel.bizType,
|
sellerId: this.formModel.sellerId,
|
||||||
payWays: this.formModel.payWays,
|
startTime: this.formModel.startTime
|
||||||
forever: this.formModel.forever,
|
}
|
||||||
// 基础权限 list
|
|
||||||
relPermissions: arr,
|
|
||||||
orderDetailList: this.orderList
|
|
||||||
};
|
};
|
||||||
createPermission(param).then(res => {
|
createPermission(param).then(res => {
|
||||||
this.urlInfo = {
|
this.urlInfo = {
|
||||||
@ -416,43 +393,25 @@ export default {
|
|||||||
createPermission() {
|
createPermission() {
|
||||||
this.$refs.dataform.validateForm(() => {
|
this.$refs.dataform.validateForm(() => {
|
||||||
this.formModel.organizationId = this.buildModel();
|
this.formModel.organizationId = this.buildModel();
|
||||||
|
const arr = this.goodsList.map(nor => {
|
||||||
|
return nor.id;
|
||||||
|
});
|
||||||
const param = {
|
const param = {
|
||||||
// createVO: {
|
canDistribute: this.formModel.canDistribute == '01',
|
||||||
// isPackage: true,
|
orderCreateVO: {
|
||||||
// relPermissions: this.permissionVo.relPermissions,
|
amount: this.formModel.amount,
|
||||||
// name: this.permissionVo.name,
|
contractNo: this.formModel.contractNo,
|
||||||
// id: this.permissionVo.id,
|
forever: this.formModel.forever,
|
||||||
// remarks: this.permissionVo.remarks
|
goodsIds: arr,
|
||||||
// },
|
monthAmount: this.formModel.monthAmount,
|
||||||
// goodsVO: this.goodsVo,
|
orderType: this.formModel.orderType,
|
||||||
// orderList: [this.formModel],
|
organizationId: this.formModel.organizationId,
|
||||||
// canDistribute: this.formModel.canDistribute == '01'
|
payStatus: this.formModel.payStatus,
|
||||||
isPackage: true,
|
payWays: this.formModel.payWays,
|
||||||
// 订单数据 formModel
|
price: this.formModel.price,
|
||||||
organizationId: this.formModel.organizationId,
|
sellerId: this.formModel.sellerId,
|
||||||
packageNum: this.formModel.amount,
|
startTime: this.formModel.startTime
|
||||||
startTime: this.formModel.startTime,
|
}
|
||||||
monthAmount: this.formModel.monthAmount,
|
|
||||||
distributeType: this.formModel.canDistribute == '01',
|
|
||||||
bizType: this.formModel.bizType,
|
|
||||||
payWays: this.formModel.payWays,
|
|
||||||
forever: this.formModel.forever,
|
|
||||||
payStatus: this.formModel.payStatus,
|
|
||||||
totalPrice: this.formModel.totalPrice,
|
|
||||||
contractNo: this.formModel.contractNo,
|
|
||||||
orderType: this.formModel.orderType,
|
|
||||||
// 商品数据 goodsVo
|
|
||||||
packageName: this.goodsVo.name,
|
|
||||||
remarks: this.goodsVo.remarks,
|
|
||||||
price: this.goodsVo.price,
|
|
||||||
tryUse: this.goodsVo.tryUse,
|
|
||||||
tryUseTime: this.goodsVo.tryUseTime,
|
|
||||||
tryUseTimeUnit: this.goodsVo.tryUseTimeUnit,
|
|
||||||
// 权限包ids 默认名称是 商品名称
|
|
||||||
relPermissions: this.permissionVo.relPermissions
|
|
||||||
|
|
||||||
// mapId: this.permissionVo.mapId
|
|
||||||
// prdCode: this.permissionVo.prdCode
|
|
||||||
};
|
};
|
||||||
createPermission(param).then(res => {
|
createPermission(param).then(res => {
|
||||||
this.urlInfo = {
|
this.urlInfo = {
|
||||||
|
@ -4,12 +4,7 @@
|
|||||||
<div class="title_nav">
|
<div class="title_nav">
|
||||||
<div class="map_title">{{ $t('orderAuthor.mapName') }}:</div>
|
<div class="map_title">{{ $t('orderAuthor.mapName') }}:</div>
|
||||||
<el-select v-model="addModel.mapId" :disabled="ruleList.length ? true : false" size="small">
|
<el-select v-model="addModel.mapId" :disabled="ruleList.length ? true : false" size="small">
|
||||||
<el-option
|
<el-option v-for="item in mapList" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
v-for="item in mapList"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div class="table_box">
|
<div class="table_box">
|
||||||
@ -32,6 +27,7 @@
|
|||||||
<el-table-column :label="this.$t('global.operate')" width="180">
|
<el-table-column :label="this.$t('global.operate')" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}</el-button>
|
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}</el-button>
|
||||||
|
<el-button v-if="addModel.type == '01'" type="text" size="small" @click="editForm(scope.$index, scope.row)">编辑</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -68,7 +64,7 @@
|
|||||||
<el-input-number v-model="addModel.price" :min="0.01" />
|
<el-input-number v-model="addModel.price" :min="0.01" />
|
||||||
<span style="padding-left: 20px; font-size: 12px; color: #a9a9a9;">{{ $t('global.yuan') }}</span>
|
<span style="padding-left: 20px; font-size: 12px; color: #a9a9a9;">{{ $t('global.yuan') }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-show="addModel.type == '02'" :label="$t('orderAuthor.whetherTrial')" prop="forever">
|
<!-- <el-form-item v-show="addModel.type == '02'" :label="$t('orderAuthor.whetherTrial')" prop="forever">
|
||||||
<el-radio-group v-model="addModel.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 v-for="option in $ConstSelect.Whether" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
@ -86,7 +82,7 @@
|
|||||||
<el-form-item v-if="addModel.type == '02' && addModel.forever" :label="$t('global.duration') + ':'" prop="tryUseTime">
|
<el-form-item v-if="addModel.type == '02' && addModel.forever" :label="$t('global.duration') + ':'" prop="tryUseTime">
|
||||||
<el-input-number v-model="addModel.tryUseTime" :min="1" />
|
<el-input-number v-model="addModel.tryUseTime" :min="1" />
|
||||||
<span style="padding-left: 20px; font-size: 12px; color: #a9a9a9;">{{ TimeStyleDict[addModel.tryUseTimeUnit] }}</span>
|
<span style="padding-left: 20px; font-size: 12px; color: #a9a9a9;">{{ TimeStyleDict[addModel.tryUseTimeUnit] }}</span>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
</el-form>
|
</el-form>
|
||||||
<choose-permission
|
<choose-permission
|
||||||
ref="choosePermission"
|
ref="choosePermission"
|
||||||
@ -103,19 +99,22 @@
|
|||||||
<el-button type="primary" @click="permissionNext">{{ $t('orderAuthor.next') }}</el-button>
|
<el-button type="primary" @click="permissionNext">{{ $t('orderAuthor.next') }}</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</div>
|
</div>
|
||||||
|
<edit ref="edit" @reloadTable="reloadTable" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ChoosePermission from '../../author/draft/choosePermission';
|
import ChoosePermission from '../../author/draft/choosePermission';
|
||||||
import { getPublishMapListOnline } from '@/api/jmap/map';
|
import { getPublishMapListOnline } from '@/api/jmap/map';
|
||||||
import { getGoodsByPermissionId, postsPermissionGoods } from '@/api/management/goods';
|
import { getGoodsByPermissionId, postsPermissionGoods, updataCommodityList, postCreatePackage} from '@/api/management/goods';
|
||||||
import { postFindPermission } from '@/api/management/order';
|
import { postFindPermission } from '@/api/management/order';
|
||||||
|
import Edit from './edit';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PermissionForm',
|
name: 'PermissionForm',
|
||||||
components: {
|
components: {
|
||||||
ChoosePermission
|
ChoosePermission,
|
||||||
|
Edit
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -145,6 +144,7 @@ export default {
|
|||||||
tryUseTimeUnit: '05',
|
tryUseTimeUnit: '05',
|
||||||
tryUseTime: 0
|
tryUseTime: 0
|
||||||
},
|
},
|
||||||
|
editIndex: 0,
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
{ required: true, message: this.$t('rules.enterPermissionName'), trigger: 'blur' }
|
{ required: true, message: this.$t('rules.enterPermissionName'), trigger: 'blur' }
|
||||||
@ -179,52 +179,6 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeBlur(data) { // 失去焦点设置最低价格
|
|
||||||
if (data.payPrice < 0.01) {
|
|
||||||
data.payPrice = 0.01;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
postFindPermission(arr) { // 判断万能权限ids 是否拥有商品
|
|
||||||
postFindPermission(arr).then(res => {
|
|
||||||
this.isGoods = false;
|
|
||||||
this.permissionPackageId = '';
|
|
||||||
this.permissionGoddsId = '';
|
|
||||||
if (res.data && res.data.id) {
|
|
||||||
this.isGoods = true;
|
|
||||||
this.idPackage = true;
|
|
||||||
this.permissionPackageId = res.data.id;
|
|
||||||
this.permissionGoddsId = res.data.goodsId;
|
|
||||||
this.addModel.name = res.data.name;
|
|
||||||
this.addModel.price = res.data.prdPrice || 0.01;
|
|
||||||
this.addModel.remarks = res.data.remarks;
|
|
||||||
this.addModel.tryUse = res.data.tryUse;
|
|
||||||
this.addModel.tryUseTime = res.data.tryUseTime;
|
|
||||||
this.addModel.tryUseTimeUnit = res.data.tryUseTimeUnit;
|
|
||||||
} else {
|
|
||||||
this.idPackage = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
changeRadio(data) {
|
|
||||||
this.$emit('changeType', data);
|
|
||||||
if (data == '02' && this.ruleList.length) {
|
|
||||||
const arr = this.ruleList.map(item => {
|
|
||||||
return item.id;
|
|
||||||
});
|
|
||||||
this.postFindPermission(arr);
|
|
||||||
} else if (data == '01' && this.ruleList.length) {
|
|
||||||
this.ruleList.map(item => {
|
|
||||||
if (!item.price) {
|
|
||||||
getGoodsByPermissionId(item.id).then(res => {
|
|
||||||
if (res.data && (res.data instanceof Object)) {
|
|
||||||
item.price = res.data.price;
|
|
||||||
item.goods = res.data;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async loadInitData() {
|
async loadInitData() {
|
||||||
// 时间类型
|
// 时间类型
|
||||||
this.TimeStyleDict = {};
|
this.TimeStyleDict = {};
|
||||||
@ -258,6 +212,62 @@ export default {
|
|||||||
console.error(error, this.$t('tip.publishMap'));
|
console.error(error, this.$t('tip.publishMap'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
changeBlur(data) { // 失去焦点设置最低价格
|
||||||
|
if (data.payPrice < 0.01) {
|
||||||
|
data.payPrice = 0.01;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
postFindPermission(arr) { // 判断万能权限ids 是否拥有商品
|
||||||
|
postFindPermission(arr).then(res => {
|
||||||
|
this.isGoods = false;
|
||||||
|
this.permissionPackageId = '';
|
||||||
|
this.permissionGoddsId = '';
|
||||||
|
if (res.data && res.data.id) {
|
||||||
|
this.isGoods = true;
|
||||||
|
this.idPackage = true;
|
||||||
|
this.permissionPackageId = res.data.permissionId;
|
||||||
|
this.permissionGoddsId = res.data.id;
|
||||||
|
this.addModel.name = res.data.name;
|
||||||
|
this.addModel.price = res.data.price || 0.01;
|
||||||
|
this.addModel.remarks = res.data.remarks;
|
||||||
|
this.addModel.tryUse = res.data.tryUse;
|
||||||
|
this.addModel.tryUseTime = res.data.tryUseTime;
|
||||||
|
this.addModel.tryUseTimeUnit = res.data.tryUseTimeUnit;
|
||||||
|
} else {
|
||||||
|
this.idPackage = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
changeRadio(data) {
|
||||||
|
this.$emit('changeType', data);
|
||||||
|
if (data == '02' && this.ruleList.length) {
|
||||||
|
const arr = this.ruleList.map(item => {
|
||||||
|
return item.id;
|
||||||
|
});
|
||||||
|
this.postFindPermission(arr);
|
||||||
|
} else if (data == '01' && this.ruleList.length) {
|
||||||
|
this.ruleList.map(item => {
|
||||||
|
if (!item.price) {
|
||||||
|
getGoodsByPermissionId(item.id).then(res => {
|
||||||
|
if (res.data && (res.data instanceof Object)) {
|
||||||
|
item.price = res.data.price;
|
||||||
|
item.goods = res.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
editForm(index, row) {
|
||||||
|
this.$refs.edit.doShow(row);
|
||||||
|
this.editIndex = index;
|
||||||
|
},
|
||||||
|
reloadTable(data) {
|
||||||
|
this.ruleList[this.editIndex].price = data.price;
|
||||||
|
this.ruleList[this.editIndex].name = data.name;
|
||||||
|
this.ruleList[this.editIndex].goods.price = data.price;
|
||||||
|
this.ruleList[this.editIndex].goods.name = data.name;
|
||||||
|
},
|
||||||
computedName(list, code) {
|
computedName(list, code) {
|
||||||
let name = '';
|
let name = '';
|
||||||
list.forEach(elem => {
|
list.forEach(elem => {
|
||||||
@ -387,41 +397,44 @@ export default {
|
|||||||
allPermissionNext(arr) { // 万能权限下一步
|
allPermissionNext(arr) { // 万能权限下一步
|
||||||
this.$refs.formData.validate((valid) => {
|
this.$refs.formData.validate((valid) => {
|
||||||
if (valid) { // 判断是否有重复万能权限 有的话使用有的权限
|
if (valid) { // 判断是否有重复万能权限 有的话使用有的权限
|
||||||
// postFindPermission(arr).then(res => {
|
if (this.isGoods) { // 有商品 走更新 无商品 创建
|
||||||
this.addModel['relPermissions'] = arr; // 权限包ids
|
const param = {
|
||||||
// if (res.data) {
|
id: this.permissionGoddsId,
|
||||||
this.addModel['id'] = this.permissionPackageId;
|
name: this.addModel.name,
|
||||||
// }
|
price: this.addModel.price,
|
||||||
// if (this.isGoods) { // 有商品传值
|
remarks: this.addModel.remarks
|
||||||
const good = {
|
};
|
||||||
id: this.permissionGoddsId,
|
updataCommodityList(param).then(res => {
|
||||||
permissionId: this.permissionPackageId,
|
const good = {
|
||||||
name: this.addModel.name,
|
id: this.permissionGoddsId,
|
||||||
price: this.addModel.price,
|
permissionId: this.permissionPackageId,
|
||||||
remarks: this.addModel.remarks,
|
name: this.addModel.name,
|
||||||
tryUse: this.addModel.forever,
|
price: this.addModel.price,
|
||||||
tryUseTime: this.addModel.tryUseTime,
|
remarks: this.addModel.remarks,
|
||||||
tryUseTimeUnit: this.addModel.tryUseTimeUnit,
|
list: this.ruleList
|
||||||
list: this.ruleList
|
};
|
||||||
};
|
this.$emit('permissionNextOrder', good);
|
||||||
this.$emit('permissionNextOrder', this.addModel, good);
|
});
|
||||||
// }
|
} else {
|
||||||
// else {
|
// 创建万能权限商品
|
||||||
// // 创建万能权限商品 接口
|
const param = {
|
||||||
// const good = {
|
name: this.addModel.name,
|
||||||
// id: '',
|
price: this.addModel.price,
|
||||||
// permissionId: '',
|
relPermissionIds: arr,
|
||||||
// name: this.addModel.name,
|
remarks: this.addModel.remarks,
|
||||||
// price: this.addModel.price,
|
tryUse: this.addModel.forever,
|
||||||
// remarks: this.addModel.remarks,
|
tryUseTime: this.addModel.tryUseTime,
|
||||||
// tryUse: this.addModel.forever,
|
tryUseTimeUnit: this.addModel.tryUseTimeUnit
|
||||||
// tryUseTime: this.addModel.tryUseTime,
|
};
|
||||||
// tryUseTimeUnit: this.addModel.tryUseTimeUnit,
|
postCreatePackage(param).then(res => {
|
||||||
// list: this.ruleList
|
const good = Object.assign(res.data, { list: this.ruleList });
|
||||||
// };
|
this.isGoods = true;
|
||||||
// this.$emit('permissionNextOrder', this.addModel, good);
|
this.permissionGoddsId = res.data.id;
|
||||||
// }
|
this.$emit('permissionNextOrder', good);
|
||||||
// }).catch((error) => { console.log(error); });
|
}).catch(() => {
|
||||||
|
this.$message('创建万能权限商品失败');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user