Commit eec36a76 by zhangquan

更换合同

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