import request from '@/utils/request' // 应付价卡配置。预览不入库,保存才写入 pay_ 表。 /** 分页查询已保存的应付产品 */ export function listPay(query) { return request({ url: '/price/pay/list', method: 'get', params: query }) } /** 产品详情,含重量段、附加费和其他配置 */ export function getPay(productId) { return request({ url: '/price/pay/' + productId, method: 'get' }) } /** 按字典匹配工作表,返回预览,不写数据库。progressId 用来轮询解析进度。 */ export function previewPay(file, dictValue, progressId, onUploadProgress) { const data = new FormData() data.append('file', file) if (dictValue) data.append('dictValue', dictValue) if (progressId) data.append('progressId', progressId) return request({ url: '/price/pay/preview', method: 'post', data, // 必须声明 multipart,否则全局 application/json 会把文件流改写成空 JSON headers: { 'Content-Type': 'multipart/form-data', repeatSubmit: false }, timeout: 10 * 60 * 1000, onUploadProgress }) } /** 查询一次价卡解析进度 */ export function payParseProgress(progressId) { return request({ url: '/price/pay/preview/progress', method: 'get', params: { progressId }, headers: { repeatSubmit: false } }) } /** 修改已保存的公共模板 */ export function updatePay(data) { return request({ url: '/price/pay', method: 'put', data, headers: { repeatSubmit: false }, timeout: 120000 }) } /** 已导入模板,供渠道下拉。payType 默认应付 AP */ export function payOptions(payType = 'AP') { return request({ url: '/price/pay/options', method: 'get', params: { payType } }) } export function bindChannelPay(channelId, productId, payType = 'AP') { return request({ url: '/price/pay/channel/' + channelId + '/bind', method: 'put', data: { productId, payType } }) } /** 批量绑定渠道应收/应付产品;至少传一个产品 */ export function batchBindChannelPay(data) { return request({ url: '/price/pay/channel/batchBind', method: 'put', data }) } export function comparePay(leftId, rightId) { return request({ url: '/price/pay/compare', method: 'get', params: { leftId, rightId } }) } export function getChannelPay(channelId, payType = 'AP') { return request({ url: '/price/pay/channel/' + channelId, method: 'get', params: { payType } }) } export function saveChannelPay(channelId, data) { return request({ url: '/price/pay/channel/' + channelId, method: 'post', data }) } export function reimportChannelPay(channelId, file) { const data = new FormData() data.append('file', file) return request({ url: '/price/pay/channel/' + channelId + '/reimport', method: 'post', data, headers: { 'Content-Type': 'multipart/form-data', repeatSubmit: false }, timeout: 10 * 60 * 1000 }) } /** 保存预览里勾选的产品 */ export function savePay(data) { return request({ url: '/price/pay/save', method: 'post', data, timeout: 120000 }) } /** 一个产品的全部价格版本 */ export function listPayTerm(productId) { return request({ url: '/price/pay/term/list', method: 'get', params: { productId } }) } /** 修改某一版的生效起止 */ export function updatePayTerm(data) { return request({ url: '/price/pay/term', method: 'put', data }) } /** 生效或失效 */ export function changePayTermStatus(data) { return request({ url: '/price/pay/term/status', method: 'put', data }) } /** 按订单渠道上的应付产品生成应付账单 */ export function generatePayBill(billId) { return request({ url: '/price/pay/order/' + billId, method: 'post' }) } /** 删除产品及其重量段、附加费、其他配置 */ export function delPay(productIds) { return request({ url: '/price/pay/' + productIds, method: 'delete' }) } /** 产品上的附加费计费条件,不按价格版本拆开 */ export function listPaySurchargeRule(productId) { return request({ url: '/price/pay/surchargeRule', method: 'get', params: { productId } }) } /** 这一版产品上的附加费配置操作记录 */ export function listPaySurchargeRuleLog(productId, termId) { return request({ url: '/price/pay/surchargeRule/log', method: 'get', params: { productId, termId } }) } /** 覆盖绑定产品当前版本的计费条件。同一版本只保留这一份。 */ export function savePaySurchargeRule(data) { return request({ url: '/price/pay/surchargeRule', method: 'post', data }) }