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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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' }
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -229,12 +229,11 @@ export default {
|
|||||||
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,
|
|
||||||
packageNum: this.formModel.amount,
|
|
||||||
amount: this.formModel.amount,
|
amount: this.formModel.amount,
|
||||||
monthAmount: this.formModel.monthAmount,
|
contractNo: this.formModel.contractNo,
|
||||||
packageName: this.goodsVo.name,
|
|
||||||
totalPrice: this.formModel.totalPrice,
|
|
||||||
orderType: this.formModel.orderType,
|
|
||||||
distributeType: this.formModel.canDistribute == '01',
|
|
||||||
startTime: this.formModel.startTime,
|
|
||||||
payStatus: this.formModel.payStatus,
|
|
||||||
bizType: this.formModel.bizType,
|
|
||||||
payWays: this.formModel.payWays,
|
|
||||||
forever: this.formModel.forever,
|
forever: this.formModel.forever,
|
||||||
// 基础权限 list
|
goodsIds: arr,
|
||||||
relPermissions: arr,
|
monthAmount: this.formModel.monthAmount,
|
||||||
orderDetailList: this.orderList
|
orderType: this.formModel.orderType,
|
||||||
|
organizationId: this.formModel.organizationId,
|
||||||
|
payStatus: this.formModel.payStatus,
|
||||||
|
payWays: this.formModel.payWays,
|
||||||
|
price: this.formModel.price,
|
||||||
|
sellerId: this.formModel.sellerId,
|
||||||
|
startTime: this.formModel.startTime
|
||||||
|
}
|
||||||
};
|
};
|
||||||
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,
|
|
||||||
// id: this.permissionVo.id,
|
|
||||||
// remarks: this.permissionVo.remarks
|
|
||||||
// },
|
|
||||||
// goodsVO: this.goodsVo,
|
|
||||||
// orderList: [this.formModel],
|
|
||||||
// canDistribute: this.formModel.canDistribute == '01'
|
|
||||||
isPackage: true,
|
|
||||||
// 订单数据 formModel
|
|
||||||
organizationId: this.formModel.organizationId,
|
|
||||||
packageNum: this.formModel.amount,
|
|
||||||
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,
|
contractNo: this.formModel.contractNo,
|
||||||
|
forever: this.formModel.forever,
|
||||||
|
goodsIds: arr,
|
||||||
|
monthAmount: this.formModel.monthAmount,
|
||||||
orderType: this.formModel.orderType,
|
orderType: this.formModel.orderType,
|
||||||
// 商品数据 goodsVo
|
organizationId: this.formModel.organizationId,
|
||||||
packageName: this.goodsVo.name,
|
payStatus: this.formModel.payStatus,
|
||||||
remarks: this.goodsVo.remarks,
|
payWays: this.formModel.payWays,
|
||||||
price: this.goodsVo.price,
|
price: this.formModel.price,
|
||||||
tryUse: this.goodsVo.tryUse,
|
sellerId: this.formModel.sellerId,
|
||||||
tryUseTime: this.goodsVo.tryUseTime,
|
startTime: this.formModel.startTime
|
||||||
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
|
||||||
|
};
|
||||||
|
updataCommodityList(param).then(res => {
|
||||||
const good = {
|
const good = {
|
||||||
id: this.permissionGoddsId,
|
id: this.permissionGoddsId,
|
||||||
permissionId: this.permissionPackageId,
|
permissionId: this.permissionPackageId,
|
||||||
name: this.addModel.name,
|
name: this.addModel.name,
|
||||||
price: this.addModel.price,
|
price: this.addModel.price,
|
||||||
remarks: this.addModel.remarks,
|
remarks: this.addModel.remarks,
|
||||||
tryUse: this.addModel.forever,
|
|
||||||
tryUseTime: this.addModel.tryUseTime,
|
|
||||||
tryUseTimeUnit: this.addModel.tryUseTimeUnit,
|
|
||||||
list: this.ruleList
|
list: this.ruleList
|
||||||
};
|
};
|
||||||
this.$emit('permissionNextOrder', this.addModel, good);
|
this.$emit('permissionNextOrder', good);
|
||||||
// }
|
});
|
||||||
// else {
|
} else {
|
||||||
// // 创建万能权限商品 接口
|
// 创建万能权限商品
|
||||||
// const good = {
|
const param = {
|
||||||
// id: '',
|
name: this.addModel.name,
|
||||||
// permissionId: '',
|
price: this.addModel.price,
|
||||||
// name: this.addModel.name,
|
relPermissionIds: arr,
|
||||||
// price: this.addModel.price,
|
remarks: this.addModel.remarks,
|
||||||
// remarks: this.addModel.remarks,
|
tryUse: this.addModel.forever,
|
||||||
// tryUse: this.addModel.forever,
|
tryUseTime: this.addModel.tryUseTime,
|
||||||
// tryUseTime: this.addModel.tryUseTime,
|
tryUseTimeUnit: this.addModel.tryUseTimeUnit
|
||||||
// tryUseTimeUnit: this.addModel.tryUseTimeUnit,
|
};
|
||||||
// list: this.ruleList
|
postCreatePackage(param).then(res => {
|
||||||
// };
|
const good = Object.assign(res.data, { list: this.ruleList });
|
||||||
// this.$emit('permissionNextOrder', this.addModel, good);
|
this.isGoods = true;
|
||||||
// }
|
this.permissionGoddsId = res.data.id;
|
||||||
// }).catch((error) => { console.log(error); });
|
this.$emit('permissionNextOrder', good);
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message('创建万能权限商品失败');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user