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) {
|
||||
return request({
|
||||
url: `/api/goods`,
|
||||
// url: `/api/goods`,
|
||||
url: `/api/goods/create/list`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
@ -138,3 +139,12 @@ export function postPermissionIdsGoods(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) {
|
||||
return request({
|
||||
url: `/api/order/quicklyGenerateOrder`,
|
||||
// url: `/api/order/quicklyGenerateOrder`,
|
||||
url: `/api/distribute/createQuickly`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
|
@ -137,7 +137,7 @@ export default {
|
||||
// 默认个人地图绘制可以滚轮放大缩小 其他地图显示不允许此操作
|
||||
const path = window.location.href;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -218,13 +218,13 @@ export default {
|
||||
const newModal = Object.assign({}, station);
|
||||
newModal.controlled = false;
|
||||
newModal.concentrateStationCode = '';
|
||||
this.setStationStand(station,'');
|
||||
this.setStationStand(station, '');
|
||||
data.forEach(each=>{
|
||||
switch (each) {
|
||||
case station.code: {
|
||||
newModal.controlled = true;
|
||||
newModal.concentrateStationCode = this.editModel.code;
|
||||
this.setStationStand(station,this.editModel.code);
|
||||
this.setStationStand(station, this.editModel.code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -244,7 +244,7 @@ export default {
|
||||
this.edit();
|
||||
this.modifyChargeStation();
|
||||
this.setStationStand(this.editModel, '');
|
||||
}else {
|
||||
} else {
|
||||
this.setStationStand(this.editModel, this.editModel.code);
|
||||
}
|
||||
},
|
||||
|
@ -27,7 +27,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</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-option
|
||||
v-for="item in stationList"
|
||||
@ -36,7 +36,7 @@
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item :label="$t('map.stationstandDirection')" prop="doorLocationType">
|
||||
<el-select v-model="addModel.doorLocationType" filterable :placeholder="$t('map.pleaseSelect')">
|
||||
<el-option
|
||||
@ -202,7 +202,7 @@ export default {
|
||||
],
|
||||
doorLocationType: [
|
||||
{ required: true, message: this.$t('rules.doorLocationType'), trigger: 'change' }
|
||||
],
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
@ -228,14 +228,13 @@ export default {
|
||||
updateView() {
|
||||
this.edit();
|
||||
},
|
||||
changeStation(data){
|
||||
let station=this.stationList.find(elem => {return elem.code==data});
|
||||
if(station){
|
||||
if(station.centralized){
|
||||
this.addModel.deviceStationCode=station.code;
|
||||
}
|
||||
else{
|
||||
this.addModel.deviceStationCode=station.concentrateStationCode;
|
||||
changeStation(data) {
|
||||
const station = this.stationList.find(elem => { return elem.code == data;});
|
||||
if (station) {
|
||||
if (station.centralized) {
|
||||
this.addModel.deviceStationCode = station.code;
|
||||
} else {
|
||||
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;
|
||||
},
|
||||
// 万能权限,走订单路线
|
||||
permissionNextOrder(permission, good) {
|
||||
permissionNextOrder(good) {
|
||||
this.goodsList = [{
|
||||
isPackage: true,
|
||||
id: good.id,
|
||||
@ -66,7 +66,6 @@ export default {
|
||||
price: good.price,
|
||||
list: good.list
|
||||
}];
|
||||
this.$refs.orderForm.setOrderName(permission, good);
|
||||
this.display = 1;
|
||||
},
|
||||
orderNext(data) {
|
||||
|
@ -1,12 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="forms pack-rule">
|
||||
<el-table
|
||||
v-if="goodsList.length"
|
||||
:data="goodsList"
|
||||
border
|
||||
style="width: 100%; margin-bottom: 10px;"
|
||||
>
|
||||
<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="描述" />
|
||||
@ -33,7 +28,6 @@ import { addOrganization, getOrganizationList } from '@/api/management/organizat
|
||||
import { getSellerList } from '@/api/management/user';
|
||||
import { createPermission } from '@/api/management/order';
|
||||
import PremissionList from './list';
|
||||
// import { deepAssign } from '@/utils/index';
|
||||
|
||||
export default {
|
||||
name: 'OrderForm',
|
||||
@ -64,7 +58,6 @@ export default {
|
||||
foreverInitData: false,
|
||||
canDistribute: true,
|
||||
urlInfo: {},
|
||||
goodsVo: {},
|
||||
orderList: [],
|
||||
formModel: {
|
||||
organizationId: '',
|
||||
@ -138,7 +131,7 @@ export default {
|
||||
return this.foreverInitData;
|
||||
},
|
||||
form() {
|
||||
const form = {
|
||||
return {
|
||||
labelWidth: this.$i18n.locale == 'en' ? '200px' : '145px',
|
||||
items: [
|
||||
{ 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 }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const _this = this;
|
||||
@ -329,18 +321,6 @@ export default {
|
||||
showPermission(index, row) {
|
||||
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() {
|
||||
// 如果新增的条目不存在字典当中,则需要在临时字典中取对应的值
|
||||
let orgzId = this.formModel.organizationId;
|
||||
@ -377,27 +357,24 @@ export default {
|
||||
packForm() {
|
||||
if (this.orderList && this.orderList.length) {
|
||||
const arr = this.goodsList.map(nor => {
|
||||
return nor.permissionId;
|
||||
return nor.goodItem.id;
|
||||
});
|
||||
const param = {
|
||||
isPackage: false,
|
||||
// 订单数据 formModel
|
||||
organizationId: this.formModel.organizationId,
|
||||
packageNum: this.formModel.amount,
|
||||
amount: this.formModel.amount,
|
||||
monthAmount: this.formModel.monthAmount,
|
||||
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,
|
||||
// 基础权限 list
|
||||
relPermissions: arr,
|
||||
orderDetailList: this.orderList
|
||||
canDistribute: this.formModel.canDistribute == '01',
|
||||
orderCreateVO: {
|
||||
amount: this.formModel.amount,
|
||||
contractNo: this.formModel.contractNo,
|
||||
forever: this.formModel.forever,
|
||||
goodsIds: arr,
|
||||
monthAmount: this.formModel.monthAmount,
|
||||
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 => {
|
||||
this.urlInfo = {
|
||||
@ -416,43 +393,25 @@ export default {
|
||||
createPermission() {
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
this.formModel.organizationId = this.buildModel();
|
||||
const arr = this.goodsList.map(nor => {
|
||||
return nor.id;
|
||||
});
|
||||
const param = {
|
||||
// createVO: {
|
||||
// isPackage: true,
|
||||
// relPermissions: this.permissionVo.relPermissions,
|
||||
// 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,
|
||||
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
|
||||
canDistribute: this.formModel.canDistribute == '01',
|
||||
orderCreateVO: {
|
||||
amount: this.formModel.amount,
|
||||
contractNo: this.formModel.contractNo,
|
||||
forever: this.formModel.forever,
|
||||
goodsIds: arr,
|
||||
monthAmount: this.formModel.monthAmount,
|
||||
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 => {
|
||||
this.urlInfo = {
|
||||
|
@ -4,12 +4,7 @@
|
||||
<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-option v-for="item in mapList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="table_box">
|
||||
@ -32,6 +27,7 @@
|
||||
<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="addModel.type == '01'" type="text" size="small" @click="editForm(scope.$index, scope.row)">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -68,7 +64,7 @@
|
||||
<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'" :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 v-for="option in $ConstSelect.Whether" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
@ -86,7 +82,7 @@
|
||||
<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" />
|
||||
<span style="padding-left: 20px; font-size: 12px; color: #a9a9a9;">{{ TimeStyleDict[addModel.tryUseTimeUnit] }}</span>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<choose-permission
|
||||
ref="choosePermission"
|
||||
@ -103,19 +99,22 @@
|
||||
<el-button type="primary" @click="permissionNext">{{ $t('orderAuthor.next') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<edit ref="edit" @reloadTable="reloadTable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ChoosePermission from '../../author/draft/choosePermission';
|
||||
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 Edit from './edit';
|
||||
|
||||
export default {
|
||||
name: 'PermissionForm',
|
||||
components: {
|
||||
ChoosePermission
|
||||
ChoosePermission,
|
||||
Edit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -145,6 +144,7 @@ export default {
|
||||
tryUseTimeUnit: '05',
|
||||
tryUseTime: 0
|
||||
},
|
||||
editIndex: 0,
|
||||
rules: {
|
||||
name: [
|
||||
{ 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() {
|
||||
// 时间类型
|
||||
this.TimeStyleDict = {};
|
||||
@ -258,6 +212,62 @@ export default {
|
||||
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) {
|
||||
let name = '';
|
||||
list.forEach(elem => {
|
||||
@ -387,41 +397,44 @@ export default {
|
||||
allPermissionNext(arr) { // 万能权限下一步
|
||||
this.$refs.formData.validate((valid) => {
|
||||
if (valid) { // 判断是否有重复万能权限 有的话使用有的权限
|
||||
// postFindPermission(arr).then(res => {
|
||||
this.addModel['relPermissions'] = arr; // 权限包ids
|
||||
// if (res.data) {
|
||||
this.addModel['id'] = this.permissionPackageId;
|
||||
// }
|
||||
// if (this.isGoods) { // 有商品传值
|
||||
const good = {
|
||||
id: this.permissionGoddsId,
|
||||
permissionId: this.permissionPackageId,
|
||||
name: this.addModel.name,
|
||||
price: this.addModel.price,
|
||||
remarks: this.addModel.remarks,
|
||||
tryUse: this.addModel.forever,
|
||||
tryUseTime: this.addModel.tryUseTime,
|
||||
tryUseTimeUnit: this.addModel.tryUseTimeUnit,
|
||||
list: this.ruleList
|
||||
};
|
||||
this.$emit('permissionNextOrder', this.addModel, good);
|
||||
// }
|
||||
// else {
|
||||
// // 创建万能权限商品 接口
|
||||
// const good = {
|
||||
// id: '',
|
||||
// permissionId: '',
|
||||
// name: this.addModel.name,
|
||||
// price: this.addModel.price,
|
||||
// remarks: this.addModel.remarks,
|
||||
// tryUse: this.addModel.forever,
|
||||
// tryUseTime: this.addModel.tryUseTime,
|
||||
// tryUseTimeUnit: this.addModel.tryUseTimeUnit,
|
||||
// list: this.ruleList
|
||||
// };
|
||||
// this.$emit('permissionNextOrder', this.addModel, good);
|
||||
// }
|
||||
// }).catch((error) => { console.log(error); });
|
||||
if (this.isGoods) { // 有商品 走更新 无商品 创建
|
||||
const param = {
|
||||
id: this.permissionGoddsId,
|
||||
name: this.addModel.name,
|
||||
price: this.addModel.price,
|
||||
remarks: this.addModel.remarks
|
||||
};
|
||||
updataCommodityList(param).then(res => {
|
||||
const good = {
|
||||
id: this.permissionGoddsId,
|
||||
permissionId: this.permissionPackageId,
|
||||
name: this.addModel.name,
|
||||
price: this.addModel.price,
|
||||
remarks: this.addModel.remarks,
|
||||
list: this.ruleList
|
||||
};
|
||||
this.$emit('permissionNextOrder', good);
|
||||
});
|
||||
} else {
|
||||
// 创建万能权限商品
|
||||
const param = {
|
||||
name: this.addModel.name,
|
||||
price: this.addModel.price,
|
||||
relPermissionIds: arr,
|
||||
remarks: this.addModel.remarks,
|
||||
tryUse: this.addModel.forever,
|
||||
tryUseTime: this.addModel.tryUseTime,
|
||||
tryUseTimeUnit: this.addModel.tryUseTimeUnit
|
||||
};
|
||||
postCreatePackage(param).then(res => {
|
||||
const good = Object.assign(res.data, { list: this.ruleList });
|
||||
this.isGoods = true;
|
||||
this.permissionGoddsId = res.data.id;
|
||||
this.$emit('permissionNextOrder', good);
|
||||
}).catch(() => {
|
||||
this.$message('创建万能权限商品失败');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user