Commit ff3c0131 by 前端

需求功能代码提交

1 parent 47ab436e
...@@ -89,24 +89,33 @@ export function settingYqMerchantSceneAPI(data) { ...@@ -89,24 +89,33 @@ export function settingYqMerchantSceneAPI(data) {
// 获取服务商数据 // 获取服务商数据
export function getServiceListAPI(data) { export function getServiceListAPI(data) {
data.method = 'dj.api.smarcarlife.yqMerchantConfig.partnerMerchantDetail' data.method = "dj.api.smarcarlife.yqMerchantConfig.partnerMerchantDetail"
return request(data, "post") return request(data, "post")
} }
// 获取服务商配置 // 获取服务商配置
export function getProviderProcurementInfo(data) { export function getProviderProcurementInfo(data) {
data.method = 'dj.smartcarlife.api.yqPartnerMerchant.selectProviderProcurementInfo' data.method =
"dj.smartcarlife.api.yqPartnerMerchant.selectProviderProcurementInfo"
return request(data, "post") return request(data, "post")
} }
// 配置服务商 // 配置服务商
export function updateProviderProcurementInfo(data) { export function updateProviderProcurementInfo(data) {
data.method = 'dj.smartcarlife.api.yqPartnerMerchant.updateProviderProcurementInfo' data.method =
"dj.smartcarlife.api.yqPartnerMerchant.updateProviderProcurementInfo"
return request(data, "post") return request(data, "post")
} }
// 获取发货主体 // 获取发货主体
export function getShippingEntityInfoAll(data) { export function getShippingEntityInfoAll(data) {
data.method = 'dj.smartcarlife.api.yqPartnerMerchant.selectShippingEntityInfoAll' data.method =
"dj.smartcarlife.api.yqPartnerMerchant.selectShippingEntityInfoAll"
return request(data, "post")
}
// 获取下级商户
export function searchServiceMerchant(data) {
data.method = "dj.api.serviceMerchant.page.search"
return request(data, "post") return request(data, "post")
} }
<template> <template>
<d2-container class="edit_service"> <d2-container class="edit_service">
<div class="d2-container-content form_class"> <div class="d2-container-content form_class">
<el-form label-width="120px" :model="detailInfo" ref="editServiceForm" :rules="rules"> <el-form label-width="120px"
<el-form-item label="采购模式:" prop="procurementType"> :model="detailInfo"
<el-radio-group size="mini" v-model="detailInfo.procurementType"> ref="editServiceForm"
<el-radio v-for="(subItem, subIdx) in procureModeList" :key="subIdx" :label="subItem.confId">{{ :rules="rules">
<el-form-item label="采购模式:"
prop="procurementType">
<el-radio-group size="mini"
v-model="detailInfo.procurementType">
<el-radio v-for="(subItem, subIdx) in procureModeList"
:key="subIdx"
:label="subItem.confId">{{
subItem.confName }}</el-radio> subItem.confName }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="发货主体:" prop="shippingEntityId"> <el-form-item label="发货主体:"
<el-select v-model="detailInfo.shippingEntityId" class="select_class" placeholder="请选择发货主体"> prop="shippingEntityId">
<el-option v-for="(subItem, subIndex) in shippingEntityList" :key="subIndex" :label="subItem.shippingEntity" <el-select v-model="detailInfo.shippingEntityId"
class="select_class"
placeholder="请选择发货主体">
<el-option v-for="(subItem, subIndex) in shippingEntityList"
:key="subIndex"
:label="subItem.shippingEntity"
:value="subItem.shippingEntityId" /> :value="subItem.shippingEntityId" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="下级商户:">
<div v-for="(item, index) in detailInfo.subMerchantList"
:key="index">
<div class="inputCol">
<el-form-item>
<el-select v-model="item.merchantId"
filterable
remote
reserve-keyword
placeholder="请输入关键字"
style="width: 432px"
:remote-method="remoteMethod"
@change="changeOpt"
:loading="loading">
<el-option v-for="(opt, optIndex) in options"
:key="optIndex"
:label="opt.merchantName"
:value="opt.merchantId"
:disabled="setDisabled(opt.merchantId)">
</el-option>
</el-select>
<el-button type="text"
style="color: red;paddingLeft:10px"
@click="handleDelMerchant(index)">删除</el-button>
</el-form-item>
</div>
</div>
<div>
<el-button type="primary"
size="small"
plain
@click="handleAddMerchant">添加一行</el-button>
</div>
</el-form-item>
</el-form> </el-form>
</div> </div>
<div style="margin-top: 40px;text-align: center;"> <div style="margin-top: 40px;text-align: center;">
<el-button class="width_100 cancel-btn" @click="handleClose">取消</el-button> <el-button class="width_100 cancel-btn"
<el-button type="primary" @click="handleUp" :disabled="$store.state.d2admin.loading.value" @click="handleClose">取消</el-button>
<el-button type="primary"
@click="handleUp"
:disabled="$store.state.d2admin.loading.value"
class="width_100">提交</el-button> class="width_100">提交</el-button>
</div> </div>
</d2-container> </d2-container>
</template> </template>
<script> <script>
import { deepClone } from '@/common/util'
import { procureModeList } from "@/common/constants" import { procureModeList } from "@/common/constants"
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { getProviderProcurementInfo, updateProviderProcurementInfo, getShippingEntityInfoAll } from "@api/serviceManage" import { getProviderProcurementInfo, updateProviderProcurementInfo, getShippingEntityInfoAll, searchServiceMerchant } from "@api/serviceManage"
export default { export default {
name: "EditService", name: "EditService",
data() { data() {
...@@ -38,10 +88,13 @@ export default { ...@@ -38,10 +88,13 @@ export default {
}, },
detailInfo: { detailInfo: {
procurementType: '', procurementType: '',
shippingEntityId: '' shippingEntityId: '',
subMerchantList: []
}, },
shippingEntityList: [], shippingEntityList: [],
serviceMerchantId: '' serviceMerchantId: '',
loading: false,
options: [],
} }
}, },
mounted() { mounted() {
...@@ -60,7 +113,18 @@ export default { ...@@ -60,7 +113,18 @@ export default {
}), }),
getInfo() { getInfo() {
getProviderProcurementInfo({ merchantId: this.serviceMerchantId }).then(res => { getProviderProcurementInfo({ merchantId: this.serviceMerchantId }).then(res => {
this.detailInfo = res || {} this.detailInfo = deepClone(res) || {}
if (this.detailInfo.subMerchantList && this.detailInfo.subMerchantList.length > 0) {
this.detailInfo.subMerchantList = this.detailInfo.subMerchantList.map(item => {
const item_new = {
id: item.id,
merchantName: item.subMerchantName,
merchantId: item.subMerchantId
}
this.options.push(item_new)
return item_new
})
}
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.editServiceForm.clearValidate() this.$refs.editServiceForm.clearValidate()
}) })
...@@ -95,6 +159,21 @@ export default { ...@@ -95,6 +159,21 @@ export default {
shippingEntity: this.shippingEntityList.filter(val => val.shippingEntityId == this.detailInfo.shippingEntityId)[0]?.shippingEntity || '', shippingEntity: this.shippingEntityList.filter(val => val.shippingEntityId == this.detailInfo.shippingEntityId)[0]?.shippingEntity || '',
shippingEntityId: this.detailInfo.shippingEntityId shippingEntityId: this.detailInfo.shippingEntityId
} }
if (this.detailInfo.subMerchantList && this.detailInfo.subMerchantList.length > 0) {
let _subMerchantList = deepClone(this.detailInfo.subMerchantList)
const list = []
let info
_subMerchantList.forEach(item => {
info = {}
info.subMerchantId = item.merchantId
info.subMerchantName = item.merchantName
list.push(info)
})
console.log(list);
params.subMerchantList = list
}
updateProviderProcurementInfo(params).then(res => { updateProviderProcurementInfo(params).then(res => {
this.notice.okTips() this.notice.okTips()
this.handleClose(true) this.handleClose(true)
...@@ -103,14 +182,63 @@ export default { ...@@ -103,14 +182,63 @@ export default {
return true return true
} }
}) })
},
handleAddMerchant() {
this.options = []
this.detailInfo.subMerchantList.push({
// merchantName: '',
merchantId: ''
})
},
handleDelMerchant(index) {
this.detailInfo.subMerchantList.splice(index, 1)
},
remoteMethod(queryString) {
if (queryString) {
this.loading = true
setTimeout(() => {
this.loading = false
var params = { currentPage: 1, pageSize: 1000, merchantName: queryString, merchantType: [7] }
searchServiceMerchant(params).then(res => {
this.options = res.list || []
})
}, 200)
} else {
this.options = []
}
},
changeOpt(val) {
const info = this.options.find(item => item.merchantId == val)
this.detailInfo.subMerchantList = this.detailInfo.subMerchantList.map(item => {
if (item.merchantId == info.merchantId) {
const id = deepClone(item.id)
delete info.id
item = deepClone(info)
if (id) {
item.id = id
// return item = Object.assign(info, { id: item.id })
}
}
return item
})
},
setDisabled(val) {
const info = this.detailInfo.subMerchantList.find(item => item.merchantId == val)
if (info) {
return true
} else {
return false
} }
},
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.edit_service { .edit_service {
.form_class { .form_class {
height: calc(100vh - 300px); // height: calc(100vh - 300px);
} }
.select_class { .select_class {
...@@ -120,5 +248,13 @@ export default { ...@@ -120,5 +248,13 @@ export default {
.width_100 { .width_100 {
width: 100px; width: 100px;
} }
.inputCol {
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
padding: 0 0 20px;
}
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!