Commit eec36a76 by zhangquan

更换合同

1 parent e469cd81
...@@ -21,6 +21,17 @@ const getContractListApi = params => { ...@@ -21,6 +21,17 @@ const getContractListApi = params => {
}) })
} }
//获取产品模板列表
const getBaseTempListApi = params => {
params.method = `scrm.api.equity.service.contract.base.template.list`
return http({
url: CUR_BASE_URL,
method: 'POST',
data: params,
sign: true
})
}
const saveContractTemplateApi = params => { const saveContractTemplateApi = params => {
params.method = `scrm.api.equity.service.contract.template.update` params.method = `scrm.api.equity.service.contract.template.update`
return http({ return http({
...@@ -148,6 +159,7 @@ const addCategoryApi = params => { ...@@ -148,6 +159,7 @@ const addCategoryApi = params => {
export default { export default {
getContractListApi, getContractListApi,
getBaseTempListApi,
getBaseContractListApi, getBaseContractListApi,
saveContractTemplateApi, saveContractTemplateApi,
getContractDetailApi, getContractDetailApi,
......
...@@ -78,14 +78,14 @@ export default { ...@@ -78,14 +78,14 @@ export default {
name: 'id', name: 'id',
type: 'input', type: 'input',
isClear: true, isClear: true,
isHide: this.changeContractObj.isBase isHide: this.changeContractObj.isBase == 1
}, },
{ {
label: '合同名称', label: '合同名称',
name: 'templateName', name: 'templateName',
type: 'input', type: 'input',
isClear: true, isClear: true,
isHide: !this.changeContractObj.isBase isHide: this.changeContractObj.isBase != 1
} }
], ],
tableParams: { tableParams: {
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
} }
}, },
created() { created() {
if (this.changeContractObj.isBase) { if (this.changeContractObj.isBase == 1) {
this.tableParams.tableColumns = [ this.tableParams.tableColumns = [
...TABLE_HEAD, ...TABLE_HEAD,
{ {
...@@ -124,7 +124,7 @@ export default { ...@@ -124,7 +124,7 @@ export default {
// 预览 // 预览
handlePdf(row) { handlePdf(row) {
if (this.changeContractObj.isBase) { if (this.changeContractObj.isBase == 1) {
this.pdfUrl = row.previewUrl this.pdfUrl = row.previewUrl
this.handlePdfClose() this.handlePdfClose()
return return
...@@ -135,14 +135,17 @@ export default { ...@@ -135,14 +135,17 @@ export default {
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.3)' background: 'rgba(0, 0, 0, 0.3)'
}) })
this.$apis.contractManager.printContractApi({ packageCode: row.packageCode, merchantId: row.merchantId }).then(res => { this.$apis.contractManager.printContractApi({ packageCode: row.packageCode, merchantId: row.merchantId || '', baseFlag: this.changeContractObj.isBase == 2 ? 1 : 0 }).then(res => {
this.pdfUrl = res
this.handlePdfClose()
loading.close() loading.close()
if (res) {
this.pdfUrl = res
this.handlePdfClose()
}
}) })
}, },
beforeSearchFn() { beforeSearchFn() {
this.getListApi = this.changeContractObj.isBase ? this.$apis.contractManager.getBaseContractListApi : this.$apis.contractManager.getContractListApi const _apiStr = this.changeContractObj.isBase == 1 ? 'getBaseContractListApi' : this.changeContractObj.isBase == 2 ? 'getBaseTempListApi' : 'getContractListApi'
this.getListApi = this.$apis.contractManager[_apiStr]
return new Promise(resolve => { return new Promise(resolve => {
resolve() resolve()
}) })
...@@ -154,7 +157,7 @@ export default { ...@@ -154,7 +157,7 @@ export default {
if (!this.curId) return this.$message.error('请选择变更模板的合同') if (!this.curId) return this.$message.error('请选择变更模板的合同')
let params = {} let params = {}
let API = 'babchCopyTemplateApi' //默认为商品合同批量更换接口 let API = 'babchCopyTemplateApi' //默认为商品合同批量更换接口
if (this.changeContractObj.isBase) { if (this.changeContractObj.isBase == 1) {
//产品合同 //产品合同
API = 'copyBaseTemplateApi' API = 'copyBaseTemplateApi'
params = { params = {
...@@ -164,13 +167,15 @@ export default { ...@@ -164,13 +167,15 @@ export default {
} }
} else { } else {
params = { params = {
sourceId: this.curId sourceId: this.curId,
baseFlag: this.changeContractObj.isBase == 2 ? 1 : 0
} }
if (this.changeContractObj.id) { if (this.changeContractObj.id) {
//单个商品合同更换 //单个商品合同更换
params.targetId = this.changeContractObj.id params.targetId = this.changeContractObj.id
API = 'copyTemplateApi' API = 'copyTemplateApi'
} else { } else {
//商品合同批量
params.targetIds = this.changeContractObj.ids params.targetIds = this.changeContractObj.ids
} }
} }
......
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
<span slot="auth-button" slot-scope="row" :data="scope.scope"> <span slot="auth-button" slot-scope="row" :data="scope.scope">
<el-button type="text" v-if="scope.scope.packageType == 1" @click="handlePdf(row.scope)">打印</el-button> <el-button type="text" v-if="scope.scope.packageType == 1" @click="handlePdf(row.scope)">打印</el-button>
<el-button type="text" v-if="scope.scope.packageType == 1" @click="editContract(row.scope)">编辑</el-button> <el-button type="text" v-if="scope.scope.packageType == 1" @click="editContract(row.scope)">编辑</el-button>
<el-button type="text" v-if="scope.scope.packageType == 1" @click="changeTmpl(row.scope)">更换模板</el-button> <el-button type="text" v-if="scope.scope.packageType == 1" @click="changeTmpl(row.scope, 1)">更换模板</el-button>
<el-button type="text" v-if="scope.scope.packageType == 1" @click="initTmpl(row.scope)">初始化模板</el-button> <el-button type="text" v-if="scope.scope.packageType == 1" @click="initTmpl(row.scope)">初始化模板</el-button>
<el-button type="text" v-if="scope.scope.packageType == 1" @click="changeTmpl(row.scope, 2)">更换合同</el-button>
<el-button type="text" @click="editCategoryFn(row.scope, 1)">编辑分类</el-button> <el-button type="text" @click="editCategoryFn(row.scope, 1)">编辑分类</el-button>
</span> </span>
</GLTable> </GLTable>
...@@ -328,7 +329,8 @@ export default { ...@@ -328,7 +329,8 @@ export default {
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
changeContractObj: { changeContractObj: {
visible: false, visible: false,
isBase: true, isBase: 1,
id: '',
skuId: '', skuId: '',
skuPackageCode: '', skuPackageCode: '',
baseTemplateId: '' baseTemplateId: ''
...@@ -426,11 +428,12 @@ export default { ...@@ -426,11 +428,12 @@ export default {
this.drawer = true this.drawer = true
}, },
// 更换模板 // 更换模板
changeTmpl({ skuPackageCode, skuId }) { changeTmpl({ skuPackageCode, skuId, contractId }, baseType) {
this.changeContractObj = { this.changeContractObj = {
visible: true, visible: true,
isBase: true, // true产品模板 isBase: baseType, // true产品模板
skuId, skuId,
id: contractId,
skuPackageCode, skuPackageCode,
baseTemplateId: '' baseTemplateId: ''
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!