InvoiceAndPayment.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. <script setup>
  2. import '../style/contractRegistration.scss'
  3. import {ElMessage} from 'element-plus'
  4. import {registerInvoice,registerPayment} from '@/api/financialMana'
  5. import {intervalDataRequest} from '@/utils/common-methods'
  6. import {moneyFormatter} from '@/utils/common-methods'
  7. const props=defineProps({
  8. // 权限类型
  9. operationtype:{
  10. type:String,
  11. default:'compliance'
  12. },
  13. // 货币数据
  14. currencyList:{
  15. type:Array,
  16. default:()=>[]
  17. },
  18. // 类型 '开票' '到款 '
  19. type:{
  20. type:String,
  21. default:'开票'
  22. },
  23. // 销售数据
  24. sellerData:{
  25. type:Object,
  26. default:()=>{}
  27. },
  28. // 详情数据
  29. IPDetailInfo:{
  30. type:Object,
  31. default:()=>{}
  32. }
  33. })
  34. const emits=defineEmits(['submitSuccess'])
  35. // 开票/到款记录表单
  36. const iandPFormRef=ref(null)
  37. // 货币单位
  38. const IandP=reactive({
  39. currencyUnit:'',
  40. moneyData:{
  41. // 金额
  42. haveMoney:0,
  43. waitMoney:0,
  44. // FICC金额
  45. haveMoneyFICC:0,
  46. waitMoneyFICC:0,
  47. allMoneyFICC:0,
  48. // 权益金额
  49. haveMoneyQY:0,
  50. waitMoneyQY:0,
  51. allMoneyQY:0,
  52. }
  53. })
  54. // ---------------开票/到款金额信息
  55. const amountForm=reactive({
  56. amountData:[
  57. // {
  58. // service_product_id:'',
  59. // origin_amount:'',
  60. // amount:'',
  61. // invoice_date:'',
  62. // remark:'',
  63. // // dom的类型
  64. // amountDomType:'text',
  65. // remarkDomType:'text',
  66. // seller_id:'',
  67. // seller_name:'',
  68. // hasRelativeSeller // 是否有对应 开票/到款 的记录销售
  69. // }
  70. ],
  71. // 已经登记的开票/到款 开票登记的时候是到款,到款登记的时候是开票
  72. submittedAmountData:[]
  73. })
  74. // 销售离职验证
  75. // const sellerValidator=(row,callback)=>{
  76. // // console.log(row);
  77. // console.log(row);
  78. // if(row.seller_name.indexOf('已离职')!=-1){
  79. // ElMessage.error(row.seller_name)
  80. // return
  81. // }else{
  82. // callback()
  83. // }
  84. // }
  85. //开票-到款展开和收起
  86. const isIandPExpand=reactive({
  87. haveInvoice:false,
  88. waitInvoice:false
  89. })
  90. // 货币汇率
  91. const rmbRate=ref(1)
  92. const sellerListType=ref(3)
  93. // 选择销售的联级选择器的ref,主要为了获取ID的同时获取名字
  94. const sellerCascaderRefs=ref([])
  95. // ------------------计算
  96. // 只有权益销售的数据
  97. const onlyQYSellerData=computed(()=>{
  98. return props.sellerData.all_list.filter(item => item.seller_id==5)[0].child
  99. })
  100. // -----------------------------监听
  101. // 金额-FICC
  102. watch(()=> IandP.moneyData.haveMoneyFICC ,(newValue)=>{
  103. IandP.moneyData.waitMoneyFICC = IandP.moneyData.allMoneyFICC-newValue
  104. IandP.moneyData.waitMoneyFICC=Math.round(IandP.moneyData.waitMoneyFICC*100)/100
  105. IandP.moneyData.waitMoney =
  106. Math.round((IandP.moneyData.waitMoneyFICC+IandP.moneyData.waitMoneyQY)*100)/100
  107. IandP.moneyData.haveMoney =
  108. Math.round((IandP.moneyData.haveMoneyFICC+IandP.moneyData.haveMoneyQY)*100)/100
  109. })
  110. // 金额-QY
  111. watch(()=> IandP.moneyData.haveMoneyQY ,(newValue)=>{
  112. IandP.moneyData.waitMoneyQY = IandP.moneyData.allMoneyQY-newValue
  113. IandP.moneyData.waitMoneyQY=Math.round(IandP.moneyData.waitMoneyQY*100)/100
  114. IandP.moneyData.waitMoney =
  115. Math.round((IandP.moneyData.waitMoneyFICC+IandP.moneyData.waitMoneyQY)*100)/100
  116. IandP.moneyData.haveMoney =
  117. Math.round((IandP.moneyData.haveMoneyFICC+IandP.moneyData.haveMoneyQY)*100)/100
  118. })
  119. // ------------------------------------------方法
  120. // 切换套餐类型
  121. const productIdChange=(value,row)=>{
  122. // 清空销售
  123. if(props.type=='开票'){
  124. row.seller_id=''
  125. row.seller_name=''
  126. }
  127. if(!row.origin_amount) return
  128. // 开票
  129. if(value==1){
  130. //切换成FICC套餐类型
  131. IandP.moneyData.haveMoneyFICC += row.origin_amount
  132. IandP.moneyData.haveMoneyQY -= row.origin_amount
  133. }else{
  134. //切换成QY套餐类型
  135. IandP.moneyData.haveMoneyFICC -= row.origin_amount
  136. IandP.moneyData.haveMoneyQY += row.origin_amount
  137. }
  138. IandP.moneyData.haveMoneyFICC = Math.round(IandP.moneyData.haveMoneyFICC*100)/100
  139. IandP.moneyData.haveMoneyQY = Math.round(IandP.moneyData.haveMoneyQY*100)/100
  140. }
  141. // 销售更改
  142. const sellerChange=(row,index)=>{
  143. // if(row.service_product_id==1){
  144. // row.seller_name = [...props.sellerData.ficc_list,...props.sellerData.rai_list].find(seller => seller.seller_id==value)?.seller_name
  145. // }else{
  146. // row.seller_name = props.sellerData.rai_list.find(seller => seller.seller_id==value)?.seller_name
  147. // }
  148. row.seller_name=sellerCascaderRefs.value[index]?.inputValue
  149. }
  150. // 判断表格当前行的信息是否填写完整
  151. const canAddorEdit=(type,row)=>{
  152. if(!(row.amount && row.invoice_date && row.service_product_id)){
  153. return '请填写完整信息'
  154. }
  155. if(type=='开票' && !row.seller_id){
  156. return '请填写完整信息'
  157. }
  158. return 1
  159. }
  160. const setRowData=()=>{
  161. /**
  162. * 添加数据 根据 开票/到款记录的套餐类型和序号对应
  163. * 对应的上,套餐类型和销售 跟对应的开票/到款记录一样,没有为空
  164. * 主要是 需要添加的数据 是对应的哪一条记录
  165. */
  166. let serviceProductId=sellerListType.value == 3?'':sellerListType.value
  167. let sellerId,sellerName='';
  168. // 已经找到对应记录的 次数 FICC,权益
  169. let hasFindCount=[0,0]
  170. // 存在的记录条数 FICC,权益
  171. let allCount=[amountForm.amountData.filter(item => item.service_product_id==1).length,
  172. amountForm.amountData.filter(item => item.service_product_id==2).length]
  173. // 可编辑情况下
  174. if(props.operationtype=='invoice'&&props.type=='开票' || props.operationtype=='placement'&&props.type=='到款'){
  175. for (let i = 0; i < amountForm.submittedAmountData.length; i++) {
  176. const element = amountForm.submittedAmountData[i];
  177. // 符合条件,继续找
  178. if(amountForm.amountData.some(it => it.service_product_id == element.service_product_id) &&
  179. hasFindCount[element.service_product_id-1]<allCount[element.service_product_id-1]){
  180. hasFindCount[element.service_product_id-1]++
  181. continue
  182. }
  183. // 不符合条件,那需要添加的数据就 对应这一条
  184. serviceProductId=element.service_product_id
  185. sellerId=element.seller_id || ''
  186. sellerName=element.seller_name || ''
  187. // 找到第一条就break掉
  188. break
  189. }
  190. }
  191. // 判断销售是否离职
  192. // if(sellerId){
  193. // if(serviceProductId==1){
  194. // // FICC销售和权益销售都要判断,并且页面呈现为级联选择器
  195. // if([...props.sellerData.ficc_list,...props.sellerData.rai_list]
  196. // .findIndex(seller => seller.seller_id==sellerId)==-1){
  197. // props.sellerData.all_list.push({
  198. // seller_id:sellerId,
  199. // seller_name:sellerName+'-已离职',
  200. // disabled:true,
  201. // child:null
  202. // })
  203. // sellerName=sellerName+'-已离职'
  204. // }
  205. // // console.log(sellerId);
  206. // }else{
  207. // if(props.sellerData.rai_list.findIndex(seller => seller.seller_id==sellerId)==-1){
  208. // sellerId = sellerName+'-已离职'
  209. // sellerName=sellerName+'-已离职'
  210. // }
  211. // }
  212. // }
  213. amountForm.amountData.push({
  214. service_product_id:serviceProductId,
  215. origin_amount:'',
  216. amount:'',
  217. is_pre_pay:0,
  218. invoice_date:'',
  219. remark:'',
  220. seller_id:sellerId,
  221. seller_name:sellerName,
  222. // 到款有对应的销售需要禁用
  223. hasRelativeSeller:!!sellerId,
  224. amountDomType:'text',
  225. remarkDomType:'text'
  226. })
  227. }
  228. // 表格添加行
  229. const addRow=(row,index)=>{
  230. const flag = canAddorEdit(props.type,row)
  231. if(flag==1){
  232. setRowData()
  233. // amountForm.amountData.push({service_product_id:sellerListType.value == 3?'':sellerListType.value,origin_amount:'',
  234. // amount:'',invoice_date:'',remark:'',seller_id:'',seller_name:'',amountDomType:'text',remarkDomType:'text'})
  235. }else{
  236. ElMessage.error(flag)
  237. }
  238. }
  239. // 表格编辑行
  240. const editRow=(row)=>{
  241. if(!row.isEdit){
  242. // 编辑 -> 确定
  243. row.isEdit=true
  244. if(row.service_product_id==0){
  245. row.service_product_id=''
  246. }
  247. return
  248. }
  249. const flag = canAddorEdit(props.type,row)
  250. if(flag==1){
  251. // 确定 -> 编辑
  252. row.isEdit=false
  253. }else{
  254. ElMessage.error(flag)
  255. }
  256. }
  257. // 表格删除行
  258. const deleteRow=(row,index)=>{
  259. let haveSalesman=false
  260. if(props.type=='开票'){
  261. if(amountForm.amountData[index].seller_id) haveSalesman=true
  262. }else{
  263. if(row.is_pre_pay==1){
  264. // 预到款登记
  265. ElMessage.error('该笔到款是预到款,不允许删除!')
  266. return
  267. }
  268. }
  269. if(amountForm.amountData[index].origin_amount=='' && amountForm.amountData[index].amount==''
  270. && (amountForm.amountData[index].service_product_id=='' || sellerListType.value != 3)
  271. && amountForm.amountData[index].invoice_date=='' && !haveSalesman){
  272. // 没有内容 直接删除
  273. amountForm.amountData.splice(index,1)
  274. }else{
  275. ElMessageBox.confirm(`是否删除该条${props.type}记录?`,
  276. '提示',
  277. {
  278. confirmButtonText: '确定',
  279. cancelButtonText: '取消',
  280. type: 'warning',
  281. }).then(res=>{
  282. // 有金额才进行删除后的运算
  283. if(amountForm.amountData[index].origin_amount!=''){
  284. amountForm.amountData.splice(index,1)
  285. let money=0
  286. amountForm.amountData.map(item =>{
  287. if(item.service_product_id == row.service_product_id){
  288. money+=parseFloat(item.origin_amount) || 0
  289. }
  290. // console.log(money);
  291. })
  292. // 保留两位小数、防止计算时精度丢失
  293. money=Math.round(money*100)/100
  294. if(row.service_product_id==1){
  295. IandP.moneyData.haveMoneyFICC=money
  296. }else{
  297. IandP.moneyData.haveMoneyQY=money
  298. }
  299. }else{
  300. amountForm.amountData.splice(index,1)
  301. }
  302. }).catch(()=>{})
  303. }
  304. }
  305. // 金额改变
  306. const moneyChange=(value,index,row)=>{
  307. // console.log(value);
  308. let numerValue=parseFloat(value)
  309. if(!numerValue&&numerValue!=0&&value){
  310. amountForm.amountData[index].origin_amount=''
  311. ElMessage.error('请输入数字')
  312. return
  313. }
  314. // 如果输入不是 以.结尾&&只有一个. 或者 不是零结尾的话,就赋值为转为成数字后的值
  315. // 考虑到类似12.02的情况
  316. if(!((value.endsWith('.') && value.indexOf('.')==(value.length-1)) ||
  317. (value.endsWith('0') && value.indexOf('.')==(value.length-2)))&&numerValue){
  318. amountForm.amountData[index].origin_amount=numerValue
  319. }
  320. amountForm.amountData[index].amount=amountForm.amountData[index].origin_amount/rmbRate.value
  321. let money=0
  322. amountForm.amountData.map(item =>{
  323. if(item.service_product_id == row.service_product_id){
  324. money+=Math.round(item.origin_amount*100)/100 || 0
  325. }
  326. })
  327. // 保留两位小数、防止计算时精度丢失
  328. money=Math.round(money*100)/100
  329. if(row.service_product_id==1){
  330. IandP.moneyData.haveMoneyFICC=money
  331. }else{
  332. IandP.moneyData.haveMoneyQY=money
  333. }
  334. }
  335. // 点击输入框后 文本切换成输入框
  336. const iandPInput=(row,prop)=>{
  337. row[prop]='input'
  338. }
  339. // 金额输入框失去焦点
  340. const iandPAmountBlur=(row)=>{
  341. if(row.origin_amount){
  342. row.origin_amount= Math.round(parseFloat(row.origin_amount)*100)/100
  343. }
  344. row.amountDomType ='text'
  345. }
  346. let elMessageDom=null
  347. const selectVisible=(value)=>{
  348. if(value){
  349. if(!elMessageDom){
  350. elMessageDom=ElMessage.warning('请选择套餐类型')
  351. setTimeout(()=>{
  352. elMessageDom=null
  353. },1000)
  354. }
  355. }
  356. }
  357. // 开票/到款登记保存
  358. const iandPSubmit=()=>{
  359. iandPFormRef.value.validate(valid=>{
  360. if(valid){
  361. // 转化
  362. amountForm.amountData.forEach(element => {
  363. element.origin_amount = parseFloat(element.origin_amount)
  364. element.amount = parseFloat(element.amount.toFixed(2))
  365. element.seller_id = element.seller_id || 0
  366. element.service_product_id = element.service_product_id || 0
  367. });
  368. let invoice_type = props.type=='开票'?1:2
  369. let registerprop = props.type=='开票'?registerInvoice:registerPayment
  370. let param={
  371. contract_register_id:props.IPDetailInfo.contract_register_id,
  372. invoice_type,
  373. amount_list:amountForm.amountData,
  374. }
  375. registerprop(param).then(res=>{
  376. let messageHint=ElMessage.success(props.type+'登记成功')
  377. setTimeout(()=>{
  378. messageHint.close()
  379. emits('submitSuccess')
  380. },1000)
  381. })
  382. }
  383. })
  384. }
  385. const setIandPDetail=()=>{
  386. sellerListType.value = props.IPDetailInfo.sellerListType
  387. rmbRate.value=props.IPDetailInfo.rmb_rate
  388. // amountForm.amountData[0].service_product_id = sellerListType.value == 3?'':sellerListType.value
  389. // FICC套餐总金额 = FICC套餐剩余开篇金额
  390. IandP.moneyData.waitMoneyFICC= IandP.moneyData.allMoneyFICC =
  391. props.IPDetailInfo.service_amount_list.find(item => item.product_id==1)?props.IPDetailInfo.service_amount_list.find(item => item.product_id==1).service_amount:0
  392. // 权益套餐总金额 = 权益套餐剩余开篇金额
  393. IandP.moneyData.waitMoneyQY= IandP.moneyData.allMoneyQY =
  394. props.IPDetailInfo.service_amount_list.find(item => item.product_id==2)?props.IPDetailInfo.service_amount_list.find(item => item.product_id==2).service_amount:0
  395. let amoutList = []
  396. // 分理处已登记的开票/到款
  397. if(props.type=='开票'){
  398. amoutList=props.IPDetailInfo.invoice_list
  399. amountForm.submittedAmountData = props.IPDetailInfo.payment_list
  400. }else{
  401. amountForm.submittedAmountData = props.IPDetailInfo.invoice_list
  402. amoutList= props.IPDetailInfo.payment_list
  403. }
  404. // if(amoutList.length>0){
  405. amountForm.amountData=[]
  406. amoutList.map(item=>{
  407. if(item.service_product_id==1){
  408. // FICC
  409. IandP.moneyData.haveMoneyFICC+=item.origin_amount
  410. }else{
  411. // 权益
  412. IandP.moneyData.haveMoneyQY+=item.origin_amount
  413. }
  414. amountForm.amountData.push({
  415. invoice_id:item.contract_invoice_id,
  416. service_product_id:item.service_product_id,
  417. origin_amount:item.origin_amount,
  418. amount:item.amount,
  419. is_pre_pay:item.is_pre_pay,
  420. invoice_date:item.invoice_time,
  421. remark:item.remark,
  422. seller_id:item.seller_id,
  423. seller_name:item.seller_name,
  424. amountDomType:'text',
  425. remarkDomType:'text',
  426. isEdit:false
  427. })
  428. })
  429. setRowData()
  430. // }
  431. IandP.moneyData.haveMoney=
  432. IandP.moneyData.haveMoneyFICC+IandP.moneyData.haveMoneyQY
  433. IandP.moneyData.waitMoney = IandP.moneyData.waitMoneyFICC+IandP.moneyData.waitMoneyQY
  434. IandP.moneyData.allInvoiceMoney = IandP.moneyData.allPlacementMoney=
  435. IandP.moneyData.allMoneyFICC+IandP.moneyData.allMoneyQY
  436. // 拿取货币单位
  437. const intervalCallback=()=>{
  438. IandP.currencyUnit=props.currencyList.find(item => item.code==props.IPDetailInfo.currency_unit)?.unit_name
  439. }
  440. intervalDataRequest(()=> props.currencyList.length>0 ,intervalCallback,1)
  441. }
  442. watch(()=>props.IPDetailInfo.contract_register_id,(value)=>{
  443. if(value){
  444. setIandPDetail()
  445. }
  446. },{ immediate: true })
  447. defineExpose({hasRegisteFinish:()=>IandP.moneyData.waitMoney==0,iandPSubmit})
  448. </script>
  449. <template>
  450. <div id="contractProgress-InvoiceAndPayment">
  451. <div class="info-row" >
  452. <div class="info-row-title">{{ type }}信息</div>
  453. <div class="info-row-invoice-payment">
  454. <div class="invoice-payment-title">
  455. <div v-if="sellerListType==3" style="margin-right: 30px;margin-bottom: 20px;">
  456. <div class="invoice-payment-money-multiple" :style="{height:isIandPExpand.haveInvoice?'135px':'59px'}">
  457. <div class="invoice-payment-money-multiple-head" @click="isIandPExpand.haveInvoice=!isIandPExpand.haveInvoice">
  458. <span style="margin-right: 20px;">已{{ type }}金额</span>
  459. <span>
  460. <span class="invoice-payment-money">{{moneyFormatter(IandP.moneyData.haveMoney)}}</span>
  461. ({{ IandP.currencyUnit }})
  462. </span>
  463. <el-icon size="16px">
  464. <svg-Icon name="svgIcon-common-arrow_right" style="transition: all 0.1s ease;"
  465. :style="{transform:isIandPExpand.haveInvoice?'rotate(90deg)':''}"></svg-Icon>
  466. </el-icon>
  467. </div>
  468. <div class="invoice-payment-money-multiple-body">
  469. <div style="margin-bottom: 16px;">
  470. <span style="margin-right: 20px;">FICC套餐</span>
  471. <span class="invoice-payment-money">{{ moneyFormatter(IandP.moneyData?.haveMoneyFICC) }}</span>({{ IandP.currencyUnit }})
  472. </div>
  473. <div>
  474. <span style="margin-right: 20px;">权益套餐</span>
  475. <span class="invoice-payment-money">{{ moneyFormatter(IandP.moneyData?.haveMoneyQY) }}</span>({{ IandP.currencyUnit }})
  476. </div>
  477. </div>
  478. </div>
  479. </div>
  480. <div style="margin-right: 30px;display: flex;align-items: center;" v-else>已{{ type }}金额:
  481. <span class="invoice-payment-money">{{moneyFormatter(IandP.moneyData?.haveMoney)}}</span>
  482. ({{ IandP.currencyUnit }})
  483. </div>
  484. <div v-if="sellerListType==3" style="margin-bottom: 20px;">
  485. <div class="invoice-payment-money-multiple" :style="{height:isIandPExpand.waitInvoice?'135px':'59px'}">
  486. <div class="invoice-payment-money-multiple-head" @click="isIandPExpand.waitInvoice=!isIandPExpand.waitInvoice">
  487. <span style="margin-right: 20px;">剩余{{ type }}金额</span>
  488. <span>
  489. <span class="invoice-payment-money">{{moneyFormatter(IandP.moneyData?.waitMoney)}}</span>
  490. ({{ IandP.currencyUnit }})
  491. </span>
  492. <el-icon size="16px">
  493. <svg-Icon name="svgIcon-common-arrow_right" style="transition: all 0.1s ease;"
  494. :style="{transform:isIandPExpand.waitInvoice?'rotate(90deg)':''}"></svg-Icon>
  495. </el-icon>
  496. </div>
  497. <div class="invoice-payment-money-multiple-body">
  498. <div style="margin-bottom: 16px;">
  499. <span style="margin-right: 20px;">FICC套餐</span>
  500. <span class="invoice-payment-money">{{ moneyFormatter(IandP.moneyData?.waitMoneyFICC) }}</span>({{ IandP.currencyUnit }})
  501. </div>
  502. <div>
  503. <span style="margin-right: 20px;">权益套餐</span>
  504. <span class="invoice-payment-money">{{ moneyFormatter(IandP.moneyData?.waitMoneyQY) }}</span>({{ IandP.currencyUnit }})
  505. </div>
  506. </div>
  507. </div>
  508. </div>
  509. <div v-else style="display: flex;align-items: center;">剩余{{ type }}金额:
  510. <span class="invoice-payment-money">{{moneyFormatter(IandP.moneyData?.waitMoney)}}</span>
  511. ({{ IandP.currencyUnit }})
  512. </div>
  513. <el-button type="primary" style="margin: 0 0 0 20px;" @click="setRowData"
  514. v-if="amountForm.amountData.length==0">添加{{ type }}信息</el-button>
  515. </div>
  516. <el-form ref="iandPFormRef" :model="amountForm"
  517. :disabled="operationtype!='invoice'&&type=='开票' || operationtype!='placement'&&type=='到款'">
  518. <el-table :data="amountForm.amountData" border v-if="amountForm.amountData.length>0" style="width: 100%;">
  519. <el-table-column label="序号" width="80" align="center">
  520. <template #default="{row,$index}">
  521. {{$index+1}}
  522. </template>
  523. </el-table-column>
  524. <el-table-column label="套餐类型" width="160" align="center" prop="service_product_id" v-if="sellerListType==3">
  525. <template #header>
  526. <span style="color: var(--dangerColor);">*</span>套餐类型
  527. </template>
  528. <template #default="{row,$index}">
  529. <el-form-item :prop="`amountData.${$index}.service_product_id`" :show-message="false" v-show="!row.invoice_id || row.isEdit"
  530. :rules="{required:true,message:()=>{ ElMessage.error('套餐类型不能为空')},trigger:'change'}">
  531. <el-select v-model="row.service_product_id" style="width: 124px;" @change="value=> productIdChange(value,row)"
  532. placeholder="请选择套餐" filterable>
  533. <el-option label="FICC套餐" :value="1"></el-option>
  534. <el-option label="权益套餐" :value="2"></el-option>
  535. </el-select>
  536. </el-form-item>
  537. <span v-show="row.invoice_id && !row.isEdit">{{ row.service_product_id?row.service_product_id==1?'FICC套餐':'权益套餐' : '--' }}</span>
  538. </template>
  539. </el-table-column>
  540. <el-table-column :label="type+'金额'" width="160" show-overflow-tooltip align="center" prop="origin_amount">
  541. <template #header>
  542. <span style="color: var(--dangerColor);">*</span>{{ type }}金额
  543. </template>
  544. <template #default="{row,$index}">
  545. <el-form-item :prop="`amountData.${$index}.origin_amount`" :show-message="false" v-show="!row.invoice_id || row.isEdit"
  546. :rules="{required:true,message:()=>{ ElMessage.error(type+'金额不能为空')},trigger:'blur'}">
  547. <label :for="(type=='开票'?'invoice':'payment')+$index+'origin_amount'" style="cursor: pointer;"
  548. :style="{color:row.origin_amount?'var(--secondaryTextColor)':'var(--hitTextColorOne)'}"
  549. v-show="row.amountDomType=='text'" @click="iandPInput(row,'amountDomType')">
  550. {{ row.origin_amount ? parseFloat(row.origin_amount).toFixed(2): '单击此处输入金额'}}
  551. </label>
  552. <el-input v-model.trim="row.origin_amount" :id="(type=='开票'?'invoice':'payment')+$index+'origin_amount'" style="width: 124px;"
  553. v-show="row.amountDomType=='input'" @blur="iandPAmountBlur(row)"
  554. placeholder="请输入金额" @input="(e)=>moneyChange(e,$index,row)"></el-input>
  555. </el-form-item>
  556. <span v-show="row.invoice_id && !row.isEdit">
  557. {{ row.origin_amount?parseFloat(row.origin_amount).toFixed(2):'--' }}
  558. </span>
  559. </template>
  560. </el-table-column>
  561. <el-table-column label="换算金额(元)" show-overflow-tooltip width="160" align="center" prop="amount">
  562. <template #default="{row,$index}">
  563. <span v-if="row.amount">{{ row.amount.toFixed(2)}}</span>
  564. <span v-else style="color: var(--hitTextColorOne);">{{type}}金额为空</span>
  565. </template>
  566. </el-table-column>
  567. <el-table-column :label="type+'日'" width="140" align="center" prop="invoice_date">
  568. <template #header>
  569. <span style="color: var(--dangerColor);">*</span>{{type}}日
  570. </template>
  571. <template #default="{row,$index}" >
  572. <el-form-item :prop="`amountData.${$index}.invoice_date`" :show-message="false" v-show="!row.invoice_id || row.isEdit"
  573. :rules="{required:true,message:()=>{ ElMessage.error(`请选择${type}日`)},trigger:'change'}">
  574. <el-date-picker v-model="row.invoice_date" style="width: 120px;"
  575. placeholder="请选择日期" value-format="YYYY-MM-DD" :clearable="false" ></el-date-picker>
  576. </el-form-item>
  577. <span v-show="row.invoice_id && !row.isEdit">{{ row.invoice_date || '--' }}</span>
  578. </template>
  579. </el-table-column >
  580. <el-table-column label="销售" width="160" align="center" prop="seller_id">
  581. <template #header>
  582. <span style="color: var(--dangerColor);">*</span>销售
  583. </template>
  584. <template #default="{row,$index}">
  585. <el-form-item :prop="`amountData.${$index}.seller_id`"
  586. :show-message="false" v-show="!row.invoice_id || row.isEdit"
  587. :rules="[{required:true,message:()=>{ ElMessage.error('销售不能为空')},trigger:'change'}]">
  588. <!-- <el-select v-model="row.seller_id" :disabled="type=='到款'&& row.hasRelativeSeller"
  589. style="width: 143px;"
  590. filterable >
  591. <el-option :label="item.seller_name" :value="item.seller_id"
  592. v-for="item in sellerData.ficc_list" :key="item.seller_id">
  593. </el-option>
  594. </el-select> -->
  595. <el-cascader v-if="row.service_product_id"
  596. :options="row.service_product_id==1?sellerData.all_list:onlyQYSellerData" v-model="row.seller_id"
  597. :ref="el => sellerCascaderRefs[$index]=el" placeholder="请选择销售" @change="()=> sellerChange(row,$index)"
  598. :props="{label:'seller_name',value:'seller_id',children:'child',emitPath:false}"
  599. :show-all-levels="false" filterable class="seller-cascader" :disabled="type=='到款'&& row.hasRelativeSeller"></el-cascader>
  600. <!-- <el-select v-model="row.seller_id" style="width: 143px;"
  601. :ref='`amountData-service_product_id${$index}`' :disabled="type=='到款'&& row.hasRelativeSeller"
  602. placeholder="请选择权益销售" filterable v-else-if="row.service_product_id==2" @change="(value)=> sellerChange(row,value)">
  603. <el-option :label="item.seller_name" :value="item.seller_id"
  604. v-for="item in sellerData.rai_list" :key="item.seller_id">
  605. </el-option>
  606. </el-select> -->
  607. <el-select v-model="row.seller_id" style="width: 143px;" :ref='`amountData-service_product_id${$index}`'
  608. placeholder="请选择销售" v-else
  609. @visible-change="selectVisible">
  610. </el-select>
  611. </el-form-item>
  612. <span v-show="row.invoice_id && !row.isEdit">{{ row.seller_name || '--' }}</span>
  613. </template>
  614. </el-table-column>
  615. <el-table-column label="备注" width="160" align="center" prop="remark" show-overflow-tooltip >
  616. <template #default="{row,$index}">
  617. <el-form-item v-show="!row.invoice_id || row.isEdit">
  618. <label :for="(type=='开票'?'invoice':'payment')+$index+'remark'" style="cursor: pointer;" v-show="row.remarkDomType=='text'"
  619. :style="{color:row.remark?'var(--secondaryTextColor)':'var(--hitTextColorOne)'}"
  620. @click="iandPInput(row,'remarkDomType')">{{ row.remark || '单击此处输入备注'}}</label>
  621. <el-input v-model="row.remark" :id="(type=='开票'?'invoice':'payment')+$index+'remark'" style="width: 124px;" placeholder="请输入备注"
  622. v-show="row.remarkDomType=='input'" @blur="row.remarkDomType='text'"/>
  623. </el-form-item>
  624. <span v-show="row.invoice_id && !row.isEdit">{{row.remark || '--'}}</span>
  625. </template>
  626. </el-table-column>
  627. <el-table-column label="操作" width="120" align="center"
  628. v-if="operationtype=='invoice'&&type=='开票' || operationtype=='placement'&&type=='到款'">
  629. <template #default="{row,$index}">
  630. <span class="table-operation-button" v-show="$index==amountForm.amountData.length-1"
  631. @click="addRow(row,$index)" style="margin-right: 10px;">添加</span>
  632. <!-- <span class="table-operation-button" style="margin-right: 6px;" v-show="row.invoice_id"
  633. @click="editRow(row)">{{ row.isEdit?'确定':'编辑' }}</span> -->
  634. <span class="table-operation-button" style="color: var(--dangerColor);"
  635. @click="deleteRow(row,$index)">删除</span>
  636. </template>
  637. </el-table-column>
  638. </el-table>
  639. </el-form>
  640. </div>
  641. </div>
  642. </div>
  643. </template>
  644. <style lang="scss" scoped>
  645. </style>
  646. <style lang="scss">
  647. #contractProgress-InvoiceAndPayment{
  648. .el-table{
  649. .cell{
  650. padding: 0 10px;
  651. }
  652. }
  653. .el-input__wrapper{
  654. width: 120px;
  655. }
  656. .seller-cascader{
  657. .el-input__wrapper{
  658. width: 140px;
  659. }
  660. }
  661. .el-form-item{
  662. margin-bottom: 0;
  663. .el-form-item__content{
  664. justify-content: center;
  665. }
  666. }
  667. }
  668. </style>