CostControl.vue 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509
  1. <template>
  2. <div style="width: 100%; padding: 0px 15px">
  3. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom">
  4. <template #commodity>
  5. <div style="width: 100%">
  6. <el-button type="primary" @click="clickAdd()" plain :disabled="getBtnDisabled()" style="margin-bottom: 16px"
  7. v-if="!judgeStatus()">添加</el-button>
  8. <el-table :data="formData.data.costControlDetailList" style="width: 100%; ">
  9. <el-table-column prop="remark" label="收付款说明" min-width="250" v-if="isShowAtt('remark','detailObj')" fixed="left">
  10. <template #default="{ row, $index }">
  11. <el-form-item :prop="'costControlDetailList.' + $index + '.remark'" :rules="rules.remark" :inline-message="true" class="margin-b-0">
  12. <el-input v-model="row.remark" placeholder="请输入" type="textarea" disabled />
  13. </el-form-item>
  14. </template>
  15. </el-table-column>
  16. <el-table-column prop="applyRemark" label="申请事由" min-width="250" v-if="isShowAtt('applyRemark','detailObj')">
  17. <template #default="{ row, $index }">
  18. <el-form-item :prop="'costControlDetailList.' + $index + '.applyRemark'" :rules="rules.applyRemark" :inline-message="true"
  19. class="margin-b-0">
  20. <el-input v-model="row.applyRemark" placeholder="请输入" type="textarea" @change="handleGetRemark($index)" />
  21. </el-form-item>
  22. </template>
  23. </el-table-column>
  24. <!-- v-if="['20'].includes(formData.data.selectType)" -->
  25. <el-table-column prop="deductionMonth" label="抵扣工资月份" width="150" v-if="isShowAtt('deductionMonth','detailObj')">
  26. <template #default="{ row, $index }">
  27. <el-form-item :prop="'costControlDetailList.' + $index + '.deductionMonth'" :rules="rules.deductionMonth" :inline-message="true"
  28. class="margin-b-0">
  29. <el-date-picker v-model="row.deductionMonth" type="month" placeholder="请选择" style="width: 100%" value-format="YYYY-MM" />
  30. </el-form-item>
  31. </template>
  32. </el-table-column>
  33. <el-table-column prop="logisticsCompanyId" label="快递公司" width="150" v-if="isShowAtt('logisticsCompanyId','detailObj')">
  34. <template #default="{ row, $index }">
  35. <el-form-item :prop="'costControlDetailList.' + $index + '.logisticsCompanyId'" :rules="rules.logisticsCompanyId"
  36. :inline-message="true" class="margin-b-0">
  37. <el-select v-model="row.logisticsCompanyId" placeholder="请选择" style="width: 100%" filterable
  38. @change="(val)=>changeSelectData(val,$index,'1')">
  39. <el-option v-for="item in logisticsCompanyData" :key="item.value" :label="item.label" :value="item.value" />
  40. </el-select>
  41. </el-form-item>
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="supplierId" label="供应商" width="150" v-if="isShowAtt('supplierId','detailObj')">
  45. <template #default="{ row, $index }">
  46. <el-form-item :prop="'costControlDetailList.' + $index + '.supplierId'" :rules="rules.supplierId" :inline-message="true"
  47. class="margin-b-0">
  48. <el-select v-model="row.supplierId" placeholder="请选择" style="width: 100%" filterable
  49. @change="(val)=>changeSelectData(val,$index,'3')">
  50. <el-option v-for="item in supplierList" :key="item.value" :label="item.label" :value="item.value" />
  51. </el-select>
  52. </el-form-item>
  53. </template>
  54. </el-table-column>
  55. <el-table-column prop="payeeAccountId" label="收款单位" width="150" v-if="isShowAtt('payeeAccountId','detailObj')">
  56. <template #default="{ row, $index }">
  57. <el-form-item :prop="'costControlDetailList.' + $index + '.payeeAccountId'" :rules="rules.payeeAccountId" :inline-message="true"
  58. class="margin-b-0">
  59. <el-select v-model="row.payeeAccountId" placeholder="请选择" style="width: 100%" filterable
  60. @change="(val)=>changeSelectData(val,$index,'4')">
  61. <el-option v-for="item in payeeData" :key="item.value" :label="item.label" :value="item.value" />
  62. </el-select>
  63. </el-form-item>
  64. </template>
  65. </el-table-column>
  66. <el-table-column prop="invoiceTaxPoint" label="开票税点" width="100" v-if="isShowAtt('invoiceTaxPoint','detailObj')">
  67. <template #default="{ row, $index }">
  68. <el-form-item :prop="'costControlDetailList.' + $index + '.invoiceTaxPoint'" :rules="rules.invoiceTaxPoint" :inline-message="true"
  69. class="margin-b-0">
  70. <el-input-number onmousewheel="return false;" v-model="row.invoiceTaxPoint" placeholder="请输入" style="width: 100%" :precision="2"
  71. :controls="false" :min="0" :max="100" disabled />
  72. </el-form-item>
  73. </template>
  74. </el-table-column>
  75. <el-table-column prop="balancePrepaidTax" label="结存预付款(含税)" width="140" v-if="isShowAtt('balancePrepaidTax','detailObj')">
  76. <template #default="{ row, $index }">
  77. <el-form-item :prop="'costControlDetailList.' + $index + '.balancePrepaidTax'" :rules="rules.balancePrepaidTax" :inline-message="true"
  78. class="margin-b-0">
  79. <el-input-number onmousewheel="return false;" v-model="row.balancePrepaidTax" placeholder="请输入" style="width: 100%" :precision="2"
  80. :controls="false" :min="0" disabled />
  81. </el-form-item>
  82. </template>
  83. </el-table-column>
  84. <el-table-column prop="balancePrepaid" label="结存预付款(不含税)" width="150" v-if="isShowAtt('balancePrepaid','detailObj')">
  85. <template #default="{ row, $index }">
  86. <el-form-item :prop="'costControlDetailList.' + $index + '.balancePrepaid'" :rules="rules.balancePrepaid" :inline-message="true"
  87. class="margin-b-0">
  88. <el-input-number onmousewheel="return false;" v-model="row.balancePrepaid" placeholder="请输入" style="width: 100%" :precision="2"
  89. :controls="false" :min="0" disabled />
  90. </el-form-item>
  91. </template>
  92. </el-table-column>
  93. <el-table-column prop="currentPrepaidTax" label="本期预付款(含税)" width="140" v-if="isShowAtt('currentPrepaidTax','detailObj')">
  94. <template #default="{ row, $index }">
  95. <el-form-item :prop="'costControlDetailList.' + $index + '.currentPrepaidTax'" :rules="rules.currentPrepaidTax" :inline-message="true"
  96. class="margin-b-0">
  97. <el-input-number onmousewheel="return false;" v-model="row.currentPrepaidTax" placeholder="请输入" style="width: 100%" :precision="2"
  98. :controls="false" :min="0" @change="(val)=>handleChangeMoney(val,$index,'currentPrepaidTax')" />
  99. </el-form-item>
  100. </template>
  101. </el-table-column>
  102. <el-table-column prop="currentPrepaid" label="本期预付款(不含税)" width="150" v-if="isShowAtt('currentPrepaid','detailObj')">
  103. <template #default="{ row, $index }">
  104. <el-form-item :prop="'costControlDetailList.' + $index + '.currentPrepaid'" :rules="rules.currentPrepaid" :inline-message="true"
  105. class="margin-b-0">
  106. <el-input-number onmousewheel="return false;" v-model="row.currentPrepaid" placeholder="请输入" style="width: 100%" :precision="2"
  107. :controls="false" :min="0" @change="(val)=>handleChangeMoney(val,$index,'currentPrepaid')" />
  108. </el-form-item>
  109. </template>
  110. </el-table-column>
  111. <el-table-column prop="accountPeriod" label="账期" width="150" v-if="isShowAtt('accountPeriod','detailObj')">
  112. <template #default="{ row, $index }">
  113. <el-form-item :prop="'costControlDetailList.' + $index + '.accountPeriod'" :rules="rules.accountPeriod" :inline-message="true"
  114. class="margin-b-0">
  115. <el-date-picker v-model="row.accountPeriod" type="month" placeholder="请选择" style="width: 100%" value-format="YYYY-MM"
  116. :disabled-date="disabledFn" />
  117. </el-form-item>
  118. </template>
  119. </el-table-column>
  120. <el-table-column prop="accountPeriodAmountTax" label="本账期金额(含税)" width="140" v-if="isShowAtt('accountPeriodAmountTax','detailObj')">
  121. <template #default="{ row, $index }">
  122. <el-form-item :prop="'costControlDetailList.' + $index + '.accountPeriodAmountTax'" :rules="rules.accountPeriodAmountTax"
  123. :inline-message="true" class="margin-b-0">
  124. <el-input-number onmousewheel="return false;" v-model="row.accountPeriodAmountTax" placeholder="请输入" style="width: 100%"
  125. :precision="2" :controls="false" :min="0" disabled />
  126. </el-form-item>
  127. </template>
  128. </el-table-column>
  129. <el-table-column prop="accountPeriodAmount" label="本账期金额(不含税)" width="150" v-if="isShowAtt('accountPeriodAmount','detailObj')">
  130. <template #default="{ row, $index }">
  131. <el-form-item :prop="'costControlDetailList.' + $index + '.accountPeriodAmount'" :rules="rules.accountPeriodAmount"
  132. :inline-message="true" class="margin-b-0">
  133. <el-input-number onmousewheel="return false;" v-model="row.accountPeriodAmount" placeholder="请输入" style="width: 100%" :precision="2"
  134. :controls="false" :min="0" disabled />
  135. </el-form-item>
  136. </template>
  137. </el-table-column>
  138. <el-table-column prop="accountPeriodAdjustAmount" label="本账期调整金额" width="140" v-if="isShowAtt('accountPeriodAdjustAmount','detailObj')">
  139. <template #default="{ row, $index }">
  140. <el-form-item :prop="'costControlDetailList.' + $index + '.accountPeriodAdjustAmount'" :rules="rules.accountPeriodAdjustAmount"
  141. :inline-message="true" class="margin-b-0">
  142. <el-input-number onmousewheel="return false;" v-model="row.accountPeriodAdjustAmount" placeholder="请输入" style="width: 100%"
  143. :precision="2" :controls="false" :min="0" disabled />
  144. </el-form-item>
  145. </template>
  146. </el-table-column>
  147. <el-table-column prop="deductionPrepaidTax" label="抵扣预付款(含税)" width="140" v-if="isShowAtt('deductionPrepaidTax','detailObj')">
  148. <template #default="{ row, $index }">
  149. <el-form-item :prop="'costControlDetailList.' + $index + '.deductionPrepaidTax'" :rules="rules.deductionPrepaidTax"
  150. :inline-message="true" class="margin-b-0">
  151. <el-input-number onmousewheel="return false;" v-model="row.deductionPrepaidTax" placeholder="请输入" style="width: 100%" :precision="2"
  152. :controls="false" :min="0" />
  153. </el-form-item>
  154. </template>
  155. </el-table-column>
  156. <el-table-column prop="deductionPrepaid" label="抵扣预付款(不含税)" width="150" v-if="isShowAtt('deductionPrepaid','detailObj')">
  157. <template #default="{ row, $index }">
  158. <el-form-item :prop="'costControlDetailList.' + $index + '.deductionPrepaid'" :rules="rules.deductionPrepaid" :inline-message="true"
  159. class="margin-b-0">
  160. <el-input-number onmousewheel="return false;" v-model="row.deductionPrepaid" placeholder="请输入" style="width: 100%" :precision="2"
  161. :controls="false" :min="0" />
  162. </el-form-item>
  163. </template>
  164. </el-table-column>
  165. <el-table-column prop="taxation" label="税费" width="140" v-if="isShowAtt('taxation','detailObj')">
  166. <template #default="{ row, $index }">
  167. <el-form-item :prop="'costControlDetailList.' + $index + '.taxation'" :rules="rules.taxation" :inline-message="true"
  168. class="margin-b-0">
  169. <el-input-number onmousewheel="return false;" v-model="row.taxation" placeholder="请输入" style="width: 100%" :precision="2"
  170. :controls="false" :min="0" />
  171. </el-form-item>
  172. </template>
  173. </el-table-column>
  174. <el-table-column prop="invoiceFileList" label="发票附件" width="200" v-if="isShowAtt('invoiceFileList','detailObj')">
  175. <template #default="{ row, $index }">
  176. <el-form-item :prop="'costControlDetailList.' + $index + '.invoiceFileList'" :rules="rules.invoiceFileList" :inline-message="true"
  177. class="margin-b-0">
  178. <el-upload :file-list="row.invoiceFileList" :action="uploadUrl" :data="row.uploadData" :limit="5" :list-type="'text'"
  179. :before-upload="(file)=>handleBeforeUploadOne(file,$index,'invoiceFileList')"
  180. :on-success="()=>handleSuccessOne($index,'invoiceFileList')"
  181. :on-remove="(file)=>handleRemoveFile(file,$index,'invoiceFileList')" :on-preview="onPreviewFile"
  182. :on-exceed="()=>msgTip(`上传文件数量不可大于5`, 2)">
  183. <el-button text type="primary">上传</el-button>
  184. </el-upload>
  185. </el-form-item>
  186. </template>
  187. </el-table-column>
  188. <el-table-column prop="fileList" label="非发票附件" width="200" v-if="isShowAtt('fileList','detailObj')">
  189. <template #default="{ row, $index }">
  190. <el-form-item :prop="'costControlDetailList.' + $index + '.fileList'" :rules="rules.fileList" :inline-message="true"
  191. class="margin-b-0">
  192. <el-upload :file-list="row.fileList" :action="uploadUrl" :data="row.uploadData" :limit="5" :list-type="'text'"
  193. :before-upload="(file)=>handleBeforeUploadOne(file,$index,'fileList')"
  194. :on-success="()=>handleSuccessOne($index,'fileList')" :on-remove="(file)=>handleRemoveFile(file,$index,'fileList')"
  195. :on-preview="onPreviewFile" :on-exceed="()=>msgTip(`上传文件数量不可大于5`, 2)">
  196. <el-button text type="primary">上传</el-button>
  197. </el-upload>
  198. </el-form-item>
  199. </template>
  200. </el-table-column>
  201. <!-- <el-table-column prop="invoiceFileList" label="归还转账截图" width="140" v-if="isShowAtt('invoiceFileList','detailObj')">
  202. <template #default="{ row, $index }">
  203. <el-form-item :prop="'costControlDetailList.' + $index + '.invoiceFileList'" :rules="rules.invoiceFileList" :inline-message="true"
  204. class="margin-b-0">
  205. <el-upload :file-list="row.invoiceFileList" :action="uploadUrl" :data="row.uploadData" :limit="5" :list-type="'text'"
  206. :before-upload="(file)=>handleBeforeUploadOne(file,$index,'invoiceFileList')"
  207. :on-success="()=>handleSuccessOne($index,'invoiceFileList')"
  208. :on-remove="(file)=>handleRemoveFile(file,$index,'invoiceFileList')" :on-preview="onPreviewFile"
  209. :on-exceed="()=>msgTip(`上传文件数量不可大于5`, 2)">
  210. <el-button text type="primary">上传</el-button>
  211. </el-upload>
  212. </el-form-item>
  213. </template>
  214. </el-table-column> -->
  215. <el-table-column prop="shopId" label="店铺名称" width="150" v-if="isShowAtt('shopId','detailObj')">
  216. <template #default="{ row, $index }">
  217. <el-form-item :prop="'costControlDetailList.' + $index + '.shopId'" :rules="rules.shopId" :inline-message="true" class="margin-b-0">
  218. <el-select v-model="row.shopId" placeholder="请选择" style="width: 100%" filterable @change="(val)=>changeSelectData(val,$index,'2')">
  219. <el-option v-for="item in shopList" :key="item.value" :label="item.label" :value="item.value" />
  220. </el-select>
  221. </el-form-item>
  222. </template>
  223. </el-table-column>
  224. <el-table-column prop="costType" label="费用类型" width="150" v-if="isShowAtt('costType','detailObj')">
  225. <template #default="{ row, $index }">
  226. <el-form-item :prop="'costControlDetailList.' + $index + '.costType'" :rules="rules.costType" :inline-message="true"
  227. class="margin-b-0">
  228. <el-select v-model="row.costType" placeholder="请选择" style="width: 100%" filterable>
  229. <el-option v-for="item in expenseType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  230. </el-select>
  231. </el-form-item>
  232. </template>
  233. </el-table-column>
  234. <el-table-column label="刷单时间/推广费类别" width="160" v-if="isShowAtt('brushingTime','detailObj') || isShowAtt('promotionFeeType','detailObj')">
  235. <template #default="{ row, $index }">
  236. <el-form-item :prop="'costControlDetailList.' + $index + '.brushingTime'" :rules="rules.brushingTime" :inline-message="true"
  237. class="margin-b-0" v-if="row.costType=='1'">
  238. <el-date-picker v-model="row.brushingTime" type="date" placeholder="请选择" style="width: 100%" value-format="YYYY-MM-DD" />
  239. </el-form-item>
  240. <el-form-item :prop="'costControlDetailList.' + $index + '.promotionFeeType'" :rules="rules.promotionFeeType" :inline-message="true"
  241. class="margin-b-0" v-else-if="row.costType=='2'">
  242. <el-select v-model="row.promotionFeeType" placeholder="请选择" style="width: 100%" filterable>
  243. <el-option v-for="item in promotionFeeType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  244. </el-select>
  245. </el-form-item>
  246. <div v-else>-</div>
  247. </template>
  248. </el-table-column>
  249. <!-- <el-table-column prop="brushingTime" label="刷单时间" width="150" v-if="isShowAtt('brushingTime','detailObj')">
  250. <template #default="{ row, $index }">
  251. <el-form-item :prop="'costControlDetailList.' + $index + '.brushingTime'" :rules="rules.brushingTime" :inline-message="true"
  252. class="margin-b-0">
  253. <el-date-picker v-model="row.brushingTime" type="date" placeholder="请选择" style="width: 100%" value-format="YYYY-MM-DD" />
  254. </el-form-item>
  255. </template>
  256. </el-table-column> -->
  257. <!-- <el-table-column prop="promotionFeeType" label="推广费类别" width="150" v-if="isShowAtt('promotionFeeType','detailObj')">
  258. <template #default="{ row, $index }">
  259. <el-form-item :prop="'costControlDetailList.' + $index + '.promotionFeeType'" :rules="rules.promotionFeeType" :inline-message="true"
  260. class="margin-b-0">
  261. <el-select v-model="row.promotionFeeType" placeholder="请选择" style="width: 100%" filterable>
  262. <el-option v-for="item in promotionFeeType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  263. </el-select>
  264. </el-form-item>
  265. </template>
  266. </el-table-column> -->
  267. <!-- <el-table-column prop="currentPayable" label="本期应付(抵扣)" width="140" v-if="isShowAtt('currentPayable','detailObj')">
  268. <template #default="{ row, $index }">
  269. <el-form-item :prop="'costControlDetailList.' + $index + '.currentPayable'" :rules="rules.currentPayable" :inline-message="true"
  270. class="margin-b-0">
  271. <el-input-number onmousewheel="return false;" v-model="row.currentPayable" placeholder="请输入" style="width: 100%" :precision="2"
  272. :controls="false" :min="0" />
  273. </el-form-item>
  274. </template>
  275. </el-table-column>
  276. <el-table-column prop="currentPayable" label="本期应付(抵扣前)" width="140" v-if="isShowAtt('currentPayable','detailObj')">
  277. <template #default="{ row, $index }">
  278. <el-form-item :prop="'costControlDetailList.' + $index + '.currentPayable'" :rules="rules.currentPayable" :inline-message="true"
  279. class="margin-b-0">
  280. <el-input-number onmousewheel="return false;" v-model="row.currentPayable" placeholder="请输入" style="width: 100%" :precision="2"
  281. :controls="false" :min="0" />
  282. </el-form-item>
  283. </template>
  284. </el-table-column> -->
  285. <el-table-column prop="currentPayableDeduction" label="本期应付(抵扣后)" width="140" v-if="isShowAtt('currentPayableDeduction','detailObj')">
  286. <template #default="{ row, $index }">
  287. <el-form-item :prop="'costControlDetailList.' + $index + '.currentPayableDeduction'" :rules="rules.currentPayableDeduction"
  288. :inline-message="true" class="margin-b-0">
  289. <el-input-number onmousewheel="return false;" v-model="row.currentPayableDeduction" placeholder="请输入" style="width: 100%"
  290. :precision="2" :controls="false" :min="0" />
  291. </el-form-item>
  292. </template>
  293. </el-table-column>
  294. <el-table-column prop="currentPayable" label="本期应付" width="140" v-if="isShowAtt('currentPayable','detailObj')">
  295. <template #default="{ row, $index }">
  296. <el-form-item :prop="'costControlDetailList.' + $index + '.currentPayable'" :rules="rules.currentPayable" :inline-message="true"
  297. class="margin-b-0">
  298. <el-input-number onmousewheel="return false;" v-model="row.currentPayable" placeholder="请输入" style="width: 100%" :precision="2"
  299. :controls="false" :min="0" @change="handleGetRemark($index)" />
  300. </el-form-item>
  301. </template>
  302. </el-table-column>
  303. <el-table-column prop="returnAmount" label="归还金额" width="140" v-if="isShowAtt('returnAmount','detailObj')">
  304. <template #default="{ row, $index }">
  305. <el-form-item :prop="'costControlDetailList.' + $index + '.returnAmount'" :rules="rules.returnAmount" :inline-message="true"
  306. class="margin-b-0">
  307. <el-input-number onmousewheel="return false;" v-model="row.returnAmount" placeholder="请输入" style="width: 100%" :precision="2"
  308. :controls="false" :min="0" @change="handleGetRemark($index)" />
  309. </el-form-item>
  310. </template>
  311. </el-table-column>
  312. <el-table-column prop="accountSubjectsId" label="记账科目" width="200" v-if="isShowAtt('accountSubjectsId','detailObj')">
  313. <template #default="{ row, $index }">
  314. <div style="width: 100%">
  315. <el-form-item :prop="'costControlDetailList.' + $index + '.accountSubjectsId'" :rules="rules.accountSubjectsId"
  316. :inline-message="true" class="margin-b-0">
  317. <el-tree-select v-model="row.accountSubjectsId" :data="accountSubjectsData" check-strictly :render-after-expand="false"
  318. node-key="id" :props="defaultProps" style="width:100%" disabled />
  319. </el-form-item>
  320. </div>
  321. </template>
  322. </el-table-column>
  323. <el-table-column label="核算项目名称" width="110" prop="accountSubjectsName" v-if="isShowAtt('accountSubjectsId','detailObj')" />
  324. <el-table-column label="核算项目" width="100" prop="accountSubjectsName" v-if="isShowAtt('accountSubjectsId','detailObj')" />
  325. <el-table-column label="记账金额" width="100" prop="money" v-if="isShowAtt('money','detailObj')" />
  326. <el-table-column label="操作" width="60" align="center" fixed="right" v-if="!judgeStatus()">
  327. <template #default="{ $index }">
  328. <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
  329. </template>
  330. </el-table-column>
  331. </el-table>
  332. </div>
  333. </template>
  334. </byForm>
  335. </div>
  336. </template>
  337. <script setup>
  338. import byForm from "@/components/byForm/index";
  339. import moment from "moment";
  340. const route = useRoute();
  341. // 接收父组件的传值
  342. const props = defineProps({
  343. queryData: Object,
  344. });
  345. const { proxy } = getCurrentInstance();
  346. const checkBoxMap = ref({});
  347. const currentCostTypeData = ref({});
  348. const uploadData = ref({});
  349. const promotionFeeType = computed(
  350. () => proxy.useUserStore().allDict["promotion_fee_type"]
  351. );
  352. const expenseType = computed(
  353. () => proxy.useUserStore().allDict["expense_type"]
  354. );
  355. const paymentMethod = computed(
  356. () => proxy.useUserStore().allDict["payment_method"]
  357. );
  358. const logisticsCompanyData = ref([]);
  359. const payeeData = ref([]);
  360. const accountSubjectsData = ref([]);
  361. const accountSubjectsList = ref([]);
  362. const defaultProps = {
  363. children: "children",
  364. label: "subjectsName",
  365. };
  366. const paymentTypeData = ref([]);
  367. const treeData = ref([]);
  368. const deptData = ref([]);
  369. const userList = ref([]);
  370. const accountList = ref([]);
  371. const shopList = ref([]);
  372. const supplierList = ref([]);
  373. const isAfterSubmit = ref([
  374. {
  375. label: "是",
  376. value: "1",
  377. },
  378. {
  379. label: "否",
  380. value: "0",
  381. },
  382. ]);
  383. const isAfterSubmitOne = ref([
  384. {
  385. label: "店铺充值",
  386. value: 1,
  387. },
  388. {
  389. label: "转账",
  390. value: 0,
  391. },
  392. ]);
  393. const formData = reactive({
  394. data: {
  395. applyTime: moment().format("yyyy-MM-DD"),
  396. companyId: proxy.useUserStore().user.companyId,
  397. companyIdSet: [],
  398. deptId: proxy.useUserStore().user.dept.deptId,
  399. applyUserId: proxy.useUserStore().user.userId,
  400. costControlDetailList: [
  401. {
  402. remark: "",
  403. supplierId: "",
  404. payeeAccountId: "",
  405. applyRemark: "",
  406. deductionMonth: "",
  407. accountSubjectsId: "",
  408. logisticsCompanyId: "",
  409. invoiceTaxPoint: "",
  410. currentPayable: null,
  411. currentPayableDeduction: null,
  412. money: null,
  413. balancePrepaidTax: null,
  414. balancePrepaid: null,
  415. accountPeriod: null,
  416. accountPeriodAmount: null,
  417. accountPeriodAmountTax: null,
  418. accountPeriodAdjustAmount: null,
  419. currentPrepaidTax: null,
  420. currentPrepaid: null,
  421. deductionPrepaidTax: null,
  422. deductionPrepaid: null,
  423. shopId: "",
  424. costType: "",
  425. brushingTime: "",
  426. promotionFeeType: "",
  427. taxation: null,
  428. },
  429. ],
  430. fileList: [],
  431. invoiceFileList: [],
  432. },
  433. });
  434. const formDom = ref(null);
  435. const judgeStatus = () => {
  436. if (route.query.processType == 20 || route.query.processType == 10) {
  437. return true;
  438. }
  439. if (props.queryData.recordList && props.queryData.recordList.length > 0) {
  440. let data = props.queryData.recordList.filter(
  441. (item) => item.status === 2 && item.nodeType !== 1
  442. );
  443. if (data && data.length > 0) {
  444. return true;
  445. }
  446. }
  447. return false;
  448. };
  449. const formOption = reactive({
  450. inline: true,
  451. labelWidth: 110,
  452. itemWidth: 100,
  453. disabled: false,
  454. });
  455. const formConfig = computed(() => {
  456. return [
  457. {
  458. type: "title",
  459. title: "基本信息",
  460. haveLine: false,
  461. },
  462. {
  463. type: "select",
  464. label: "收付款类型",
  465. prop: "costType",
  466. itemWidth: 25,
  467. data: paymentTypeData.value,
  468. // clearable: true,
  469. fn: (val) => {
  470. changeCostType(val);
  471. },
  472. },
  473. {
  474. type: "input",
  475. prop: "voucherNo",
  476. label: "记账凭证号",
  477. itemType: "text",
  478. disabled: false,
  479. itemWidth: 25,
  480. isShow: isShowAtt("voucherNo", "mainObj"),
  481. },
  482. {
  483. type: "select",
  484. label: "是否预付",
  485. prop: "isAdvance",
  486. itemWidth: 25,
  487. data: isAfterSubmit.value,
  488. isShow: isShowAtt("isAdvance", "mainObj"),
  489. disabled: true,
  490. },
  491. {
  492. type: "date",
  493. itemType: "date",
  494. prop: "applyTime",
  495. label: "申请日期",
  496. disabled: false,
  497. itemWidth: 25,
  498. isShow: isShowAtt("applyTime", "mainObj"),
  499. disabled: true,
  500. },
  501. {
  502. type: "input",
  503. prop: "code",
  504. label: "流水号",
  505. itemType: "text",
  506. disabled: true,
  507. itemWidth: 25,
  508. isShow: isShowAtt("code", "mainObj"),
  509. },
  510. {
  511. type: "select",
  512. label: "快递公司",
  513. prop: "logisticsCompanyId",
  514. itemWidth: 25,
  515. data: logisticsCompanyData.value,
  516. isShow: isShowAtt("logisticsCompanyId", "mainObj"),
  517. },
  518. {
  519. type: "input",
  520. prop: "invoiceTaxPoint",
  521. label: "开票税点",
  522. itemType: "text",
  523. disabled: false,
  524. itemWidth: 25,
  525. isShow: isShowAtt("invoiceTaxPoint", "mainObj"),
  526. },
  527. {
  528. type: "select",
  529. label: "是否后提交凭证",
  530. prop: "isVoucher",
  531. itemWidth: 25,
  532. data: isAfterSubmit.value,
  533. isShow: isShowAtt("isVoucher", "mainObj"),
  534. },
  535. {
  536. type: "treeSelect",
  537. prop: "companyId",
  538. label: "业务公司",
  539. data: treeData.value,
  540. propsTreeLabel: "deptName",
  541. propsTreeValue: "deptId",
  542. itemWidth: 25,
  543. fn: (val) => {
  544. getDeptData(val);
  545. },
  546. disabled: true,
  547. isShow:
  548. isShowAtt("companyId", "mainObj") &&
  549. currentCostTypeData.value.name != "采购货款",
  550. },
  551. {
  552. type: "treeSelect",
  553. prop: "companyIdSet",
  554. label: "业务公司",
  555. data: treeData.value,
  556. propsTreeLabel: "deptName",
  557. propsTreeValue: "deptId",
  558. itemWidth: 25,
  559. // fn: (val) => {
  560. // getDeptData(val);
  561. // },
  562. multiple: true,
  563. isShow:
  564. isShowAtt("companyId", "mainObj") &&
  565. currentCostTypeData.value.name == "采购货款",
  566. },
  567. {
  568. type: "treeSelect",
  569. prop: "deptId",
  570. label: "业务部门",
  571. data: deptData.value,
  572. propsTreeLabel: "deptName",
  573. propsTreeValue: "deptId",
  574. itemWidth: 25,
  575. disabled: true,
  576. isShow: isShowAtt("deptId", "mainObj"),
  577. },
  578. {
  579. type: "select",
  580. prop: "applyUserId",
  581. label: "申请人",
  582. required: true,
  583. filterable: true,
  584. data: userList.value,
  585. itemWidth: 25,
  586. fn: (val) => {
  587. changApplyUserId(val);
  588. },
  589. // disabled: true,
  590. isShow: isShowAtt("applyUserId", "mainObj"),
  591. },
  592. {
  593. type: "title",
  594. title: "收付款明细",
  595. haveLine: true,
  596. },
  597. {
  598. type: "slot",
  599. slotName: "commodity",
  600. label: "",
  601. },
  602. {
  603. type: "title",
  604. title: "付款信息",
  605. haveLine: true,
  606. isShow:
  607. isShowAtt("isPublicTransfer", "mainObj") ||
  608. isShowAtt("paymentMethod", "mainObj"),
  609. },
  610. {
  611. type: "select",
  612. label: "是否公户转出",
  613. prop: "isPublicTransfer",
  614. itemWidth: 25,
  615. data: isAfterSubmit.value,
  616. fn: (val) => {
  617. formData.data.paymentAccountId = "";
  618. formData.data.paymentAccountName = "";
  619. formData.data.paymentAccountBank = "";
  620. formData.data.paymentAccountNumber = "";
  621. proxy
  622. .post("/accountManagement/page", {
  623. pageNum: 1,
  624. pageSize: 999,
  625. type: val == 1 ? "10" : "20",
  626. })
  627. .then((res) => {
  628. accountList.value = res.rows.map((item) => {
  629. return {
  630. ...item,
  631. label: item.alias,
  632. value: item.id,
  633. };
  634. });
  635. });
  636. if (
  637. currentCostTypeData.value &&
  638. currentCostTypeData.value.name.indexOf("快递") != -1
  639. ) {
  640. for (let i = 0; i < formData.data.costControlDetailList.length; i++) {
  641. const row = formData.data.costControlDetailList[i];
  642. row.currentPayable =
  643. val == "1" ? row.currentPrepaidTax : row.currentPrepaid;
  644. handleGetRemark(i);
  645. }
  646. }
  647. },
  648. isShow: isShowAtt("isPublicTransfer", "mainObj"),
  649. },
  650. {
  651. type: "select",
  652. label: "付款方式",
  653. prop: "paymentMethod",
  654. itemWidth: 25,
  655. data: paymentMethod.value,
  656. isShow: isShowAtt("paymentMethod", "mainObj"),
  657. fn: (val) => {
  658. if (
  659. val == 1 &&
  660. formData.data.costControlDetailList &&
  661. formData.data.costControlDetailList.length > 0
  662. ) {
  663. formData.data.shopName =
  664. formData.data.costControlDetailList[0].labelName;
  665. }
  666. },
  667. },
  668. {
  669. type: "input",
  670. prop: "shopName",
  671. label: "充值店铺名称",
  672. itemWidth: 25,
  673. disabled: true,
  674. isShow:
  675. isShowAtt("paymentMethod", "mainObj") &&
  676. formData.data.paymentMethod == "1",
  677. },
  678. {
  679. type: "select",
  680. prop: "paymentAccountId",
  681. label: "公司账户",
  682. data: accountList.value,
  683. itemWidth: 25,
  684. fn: (val) => {
  685. changeShroffAccount(val);
  686. },
  687. isShow: isShowAtt("paymentAccountId", "mainObj"),
  688. },
  689. {
  690. type: "input",
  691. prop: "paymentAccountBank",
  692. label: "开户行",
  693. placeholder: "请输入开户行",
  694. itemWidth: 25,
  695. isShow: isShowAtt("paymentAccountId", "mainObj"),
  696. },
  697. {
  698. type: "input",
  699. prop: "paymentAccountName",
  700. label: "开户名",
  701. placeholder: "请输入开户名",
  702. itemWidth: 25,
  703. isShow: isShowAtt("paymentAccountId", "mainObj"),
  704. },
  705. {
  706. type: "input",
  707. prop: "paymentAccountNumber",
  708. label: "账号",
  709. placeholder: "请输入账号",
  710. itemWidth: 25,
  711. isShow: isShowAtt("paymentAccountId", "mainObj"),
  712. },
  713. {
  714. type: "title",
  715. title: "收款信息",
  716. haveLine: true,
  717. isShow: getIsShowData("accountBank"),
  718. },
  719. {
  720. type: "input",
  721. prop: "accountBank",
  722. label: "开户行",
  723. placeholder: "请输入开户行",
  724. itemWidth: 25,
  725. // isShow: isShowAtt("accountBank", "mainObj"),
  726. isShow: getIsShowData("accountBank"),
  727. },
  728. {
  729. type: "input",
  730. prop: "accountName",
  731. label: "开户名",
  732. placeholder: "请输入开户名",
  733. itemWidth: 25,
  734. // isShow: isShowAtt("accountName", "mainObj"),
  735. isShow: getIsShowData("accountName"),
  736. },
  737. {
  738. type: "input",
  739. prop: "accountNumber",
  740. label: "账号",
  741. placeholder: "请输入账号",
  742. itemWidth: 25,
  743. // isShow: isShowAtt("accountNumber", "mainObj"),
  744. isShow: getIsShowData("accountNumber"),
  745. },
  746. ];
  747. });
  748. const rules = ref({
  749. costType: [
  750. { required: true, message: "请选择收付款类型", trigger: "change" },
  751. ],
  752. // voucherNo: [{ required: true, message: "请输入记账凭证号", trigger: "blur" }],
  753. isAdvance: [{ required: true, message: "请选择是否预付", trigger: "change" }],
  754. applyTime: [{ required: true, message: "请选择申请日期", trigger: "change" }],
  755. // code: [{ required: true, message: "请输入流水号", trigger: "blur" }],
  756. logisticsCompanyId: [
  757. { required: true, message: "请选择快递公司", trigger: "change" },
  758. ],
  759. applyUserId: [{ required: true, message: "请选择申请人", trigger: "change" }],
  760. isVoucher: [
  761. { required: true, message: "请选择是否后提交凭证", trigger: "change" },
  762. ],
  763. companyIdSet: [
  764. { required: true, message: "请选择业务公司", trigger: "change" },
  765. ],
  766. companyId: [{ required: true, message: "请选择业务公司", trigger: "change" }],
  767. deptId: [{ required: true, message: "请选择业务部门", trigger: "change" }],
  768. invoiceTaxPoint: [
  769. { required: true, message: "请输入开票税点", trigger: "blur" },
  770. ],
  771. isPublicTransfer: [
  772. { required: true, message: "请选择是否公出转出", trigger: "change" },
  773. ],
  774. paymentMethod: [
  775. { required: true, message: "请选择付款方式", trigger: "change" },
  776. ],
  777. accountBank: [{ required: true, message: "请输入开户行", trigger: "blur" }],
  778. accountName: [{ required: true, message: "请输入开户名", trigger: "blur" }],
  779. accountNumber: [{ required: true, message: "请输入账号", trigger: "blur" }],
  780. paymentAccountBank: [
  781. { required: true, message: "请输入开户行", trigger: "blur" },
  782. ],
  783. paymentAccountName: [
  784. { required: true, message: "请输入开户名", trigger: "blur" },
  785. ],
  786. paymentAccountNumber: [
  787. { required: true, message: "请输入账号", trigger: "blur" },
  788. ],
  789. // 明细
  790. remark: [{ required: true, message: "请输入收付款说明", trigger: "blur" }],
  791. applyRemark: [{ required: true, message: "请输入申请事由", trigger: "blur" }],
  792. deductionMonth: [
  793. { required: true, message: "请选择抵扣工资月份", trigger: "change" },
  794. ],
  795. // balancePrepaidTax: [
  796. // { required: true, message: "请输入结存预付款(含税)", trigger: "blur" },
  797. // ],
  798. // balancePrepaid: [
  799. // { required: true, message: "请输入结存预付款(不含税)", trigger: "blur" },
  800. // ],
  801. currentPrepaidTax: [
  802. { required: true, message: "请输入本期预付款(含税)", trigger: "blur" },
  803. ],
  804. currentPrepaid: [
  805. { required: true, message: "请输入本期预付款(不含税)", trigger: "blur" },
  806. ],
  807. accountPeriod: [{ required: true, message: "请输入账期", trigger: "blur" }],
  808. accountPeriodAmountTax: [
  809. { required: true, message: "请输入本账期金额(含税)", trigger: "blur" },
  810. ],
  811. accountPeriodAmount: [
  812. { required: true, message: "请输入本账期金额(不含税)", trigger: "blur" },
  813. ],
  814. accountPeriodAdjustAmount: [
  815. { required: true, message: "请输入本账期调整金额", trigger: "blur" },
  816. ],
  817. deductionPrepaidTax: [
  818. { required: true, message: "请输入抵扣预付款(含税)", trigger: "blur" },
  819. ],
  820. deductionPrepaid: [
  821. { required: true, message: "请输入抵扣预付款(不含税)", trigger: "blur" },
  822. ],
  823. invoiceTaxPoint: [
  824. { required: true, message: "请输入开票税点", trigger: "blur" },
  825. ],
  826. taxation: [{ required: true, message: "请输入税费", trigger: "blur" }],
  827. // invoiceFileList: [
  828. // { required: true, message: "请上传发票附件", trigger: "change" },
  829. // ],
  830. // fileList: [
  831. // { required: true, message: "请上传非发票附件", trigger: "change" },
  832. // ],
  833. payeeAccountId: [
  834. { required: true, message: "请输入收款单位", trigger: "blur" },
  835. ],
  836. shopId: [{ required: true, message: "请选择店铺名称", trigger: "change" }],
  837. supplierId: [{ required: true, message: "请选择供应商", trigger: "change" }],
  838. costType: [{ required: true, message: "请选择费用类型", trigger: "change" }],
  839. brushingTime: [
  840. { required: true, message: "请选择刷单时间", trigger: "change" },
  841. ],
  842. promotionFeeType: [
  843. { required: true, message: "请选择推广费类别", trigger: "change" },
  844. ],
  845. // currentPayable: [
  846. // { required: true, message: "请输入本期应付(抵扣)", trigger: "blur" },
  847. // ],
  848. currentPayable: [
  849. { required: true, message: "请输入本期应付", trigger: "blur" },
  850. ],
  851. currentPayableDeduction: [
  852. { required: true, message: "请输入本期应付(抵扣后)", trigger: "blur" },
  853. ],
  854. returnAmount: [
  855. { required: true, message: "请输入归还金额", trigger: "blur" },
  856. ],
  857. accountSubjectsId: [
  858. { required: true, message: "请选择记账科目", trigger: "change" },
  859. ],
  860. money: [{ required: true, message: "请输入记账金额", trigger: "blur" }],
  861. });
  862. const isShowAtt = (formAtt, att = "mainObj") => {
  863. if (checkBoxMap.value[att]) {
  864. return checkBoxMap.value[att][formAtt] != undefined;
  865. } else {
  866. return true;
  867. }
  868. };
  869. const getIsShowData = (formAtt, att = "mainObj") => {
  870. if (
  871. currentCostTypeData.value &&
  872. currentCostTypeData.value.name &&
  873. currentCostTypeData.value.name.indexOf("店铺") != -1
  874. ) {
  875. if (
  876. formData.data &&
  877. formData.data.paymentMethod &&
  878. formData.data.paymentMethod == "2"
  879. ) {
  880. return true;
  881. }
  882. return false;
  883. } else {
  884. return isShowAtt(formAtt, att);
  885. }
  886. };
  887. const changeShroffAccount = (val) => {
  888. if (val) {
  889. let data = accountList.value.find((item) => item.value == val);
  890. if (data) {
  891. formData.data.paymentAccountName = data.name;
  892. formData.data.paymentAccountBank = data.openingBank;
  893. formData.data.paymentAccountNumber = data.accountOpening;
  894. }
  895. }
  896. };
  897. const changApplyUserId = (val) => {
  898. if (
  899. !(
  900. currentCostTypeData.value.name.indexOf("备用金") != -1 ||
  901. currentCostTypeData.value.name.indexOf("借款") != -1 ||
  902. currentCostTypeData.value.name.indexOf("采购") != -1
  903. )
  904. ) {
  905. return;
  906. }
  907. const current = userList.value.find((x) => x.value == val);
  908. if (current) {
  909. formData.data.accountBank = current.accountBank;
  910. formData.data.accountName = current.accountName;
  911. formData.data.accountNumber = current.accountNumber;
  912. }
  913. };
  914. const getDeptData = (val) => {
  915. proxy
  916. .get("/tenantUser/list", {
  917. pageNum: 1,
  918. pageSize: 10000,
  919. tenantId: proxy.useUserStore().user.tenantId,
  920. companyId: val,
  921. })
  922. .then((res) => {
  923. userList.value = res.rows.map((item) => {
  924. return {
  925. ...item,
  926. label: item.nickName,
  927. value: item.userId,
  928. };
  929. });
  930. });
  931. proxy
  932. .get("/tenantDept/list", {
  933. pageNum: 1,
  934. pageSize: 9999,
  935. keyword: "",
  936. ancestors: val,
  937. tenantId: proxy.useUserStore().user.tenantId,
  938. // type: 2,
  939. })
  940. .then((res) => {
  941. deptData.value = proxy.handleTree(res.data, "deptId");
  942. });
  943. };
  944. const changeCostType = (val) => {
  945. currentCostTypeData.value = paymentTypeData.value.find((x) => x.value == val);
  946. formData.data.tradeType = currentCostTypeData.value.tradeType;
  947. if (formData.data && formData.data.applyUserId) {
  948. changApplyUserId(formData.data.applyUserId);
  949. }
  950. formData.data.applyTime = moment().format("yyyy-MM-DD");
  951. formData.data.companyId = proxy.useUserStore().user.companyId;
  952. formData.data.deptId = proxy.useUserStore().user.dept.deptId;
  953. formData.data.apapplyUserIdplyTime = proxy.useUserStore().user.userId;
  954. formData.data.isAdvance = "0";
  955. formData.data.costControlDetailList = [];
  956. formData.data.fileList = [];
  957. formData.data.invoiceFileList = [];
  958. // formData.data = {
  959. // applyTime: moment().format("yyyy-MM-DD"),
  960. // companyId: proxy.useUserStore().user.companyId,
  961. // deptId: proxy.useUserStore().user.dept.deptId,
  962. // applyUserId: proxy.useUserStore().user.userId,
  963. // isAdvance: "0",
  964. // costControlDetailList: [],
  965. // fileList: [],
  966. // invoiceFileList: [],
  967. // };
  968. getCheckBoxMap(val);
  969. if (
  970. currentCostTypeData.value &&
  971. currentCostTypeData.value.name.indexOf("预付") != -1
  972. ) {
  973. formData.data.isAdvance = "1";
  974. } else {
  975. formData.data.isAdvance = "0";
  976. }
  977. };
  978. const handleChangeMoney = (val, index, att) => {
  979. let row = formData.data.costControlDetailList[index];
  980. if (formData.data.isPublicTransfer) {
  981. if (formData.data.isPublicTransfer == "1") {
  982. row.currentPayable = row.currentPrepaidTax;
  983. } else if (formData.data.isPublicTransfer == "0") {
  984. row.currentPayable = row.currentPrepaid;
  985. }
  986. handleGetRemark(index);
  987. }
  988. };
  989. const changeSelectData = (val, index, type) => {
  990. // type 1:快递公司 2:店铺 3:供应商 4:收款单位
  991. let current = null;
  992. switch (type) {
  993. case "1":
  994. current = logisticsCompanyData.value.find((x) => x.value == val);
  995. if (current) {
  996. formData.data.costControlDetailList[index].invoiceTaxPoint =
  997. current.taxPoints;
  998. formData.data.costControlDetailList[index].balancePrepaid =
  999. current.balancePrepaid;
  1000. formData.data.costControlDetailList[index].balancePrepaidTax =
  1001. current.balancePrepaidTax;
  1002. formData.data.costControlDetailList[index].labelName = current.label;
  1003. }
  1004. break;
  1005. case "2":
  1006. current = shopList.value.find((x) => x.value == val);
  1007. if (current) {
  1008. formData.data.costControlDetailList[index].labelName = current.label;
  1009. }
  1010. break;
  1011. case "3":
  1012. current = supplierList.value.find((x) => x.value == val);
  1013. if (current) {
  1014. formData.data.costControlDetailList[index].invoiceTaxPoint =
  1015. current.privTaxPoints;
  1016. formData.data.costControlDetailList[index].balancePrepaid =
  1017. current.balancePrepaid;
  1018. formData.data.costControlDetailList[index].balancePrepaidTax =
  1019. current.balancePrepaidTax;
  1020. formData.data.costControlDetailList[index].labelName = current.label;
  1021. }
  1022. break;
  1023. case "4":
  1024. current = payeeData.value.find((x) => x.value == val);
  1025. if (current) {
  1026. formData.data.costControlDetailList[index].invoiceTaxPoint =
  1027. current.taxPoints;
  1028. formData.data.costControlDetailList[index].labelName = current.label;
  1029. }
  1030. break;
  1031. default:
  1032. break;
  1033. }
  1034. if (current && ["1", "2", "4"].includes(type)) {
  1035. formData.data.accountBank = current.accountBank;
  1036. formData.data.accountName = current.accountName;
  1037. formData.data.accountNumber = current.accountNumber;
  1038. }
  1039. handleGetRemark(index);
  1040. };
  1041. const getDict = () => {
  1042. proxy
  1043. .post("/accountSubjects/list", { pageNum: 1, pageSize: 999 })
  1044. .then((res) => {
  1045. accountSubjectsList.value = res;
  1046. accountSubjectsData.value = proxy.handleTree(res, "id");
  1047. });
  1048. proxy.post("/payeeInfo/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  1049. payeeData.value = res.rows.map((item) => {
  1050. return {
  1051. ...item,
  1052. label: item.name,
  1053. value: item.id,
  1054. };
  1055. });
  1056. });
  1057. proxy
  1058. .post("/logisticsCompanyInfo/list", { pageNum: 1, pageSize: 999 })
  1059. .then((res) => {
  1060. logisticsCompanyData.value = res.map((item) => {
  1061. return {
  1062. ...item,
  1063. label: item.name,
  1064. value: item.id,
  1065. };
  1066. });
  1067. });
  1068. proxy.post("/paymentType/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  1069. paymentTypeData.value = res.rows.map((item) => {
  1070. return {
  1071. ...item,
  1072. name: item.name,
  1073. label: item.name,
  1074. value: item.id,
  1075. };
  1076. });
  1077. if (res.rows && res.rows.length > 0 && !route.query.businessId) {
  1078. formData.data.costType = res.rows[0].id;
  1079. changeCostType(formData.data.costType);
  1080. }
  1081. });
  1082. // proxy
  1083. // .post("/accountManagement/page", { pageNum: 1, pageSize: 999 })
  1084. // .then((res) => {
  1085. // accountList.value = res.rows.map((item) => {
  1086. // return {
  1087. // ...item,
  1088. // label: item.alias,
  1089. // value: item.id,
  1090. // };
  1091. // });
  1092. // });
  1093. proxy.post("/shopInfo/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
  1094. shopList.value = res.rows.map((item) => {
  1095. return {
  1096. ...item,
  1097. label: item.name,
  1098. value: item.id,
  1099. };
  1100. });
  1101. });
  1102. proxy
  1103. .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
  1104. .then((res) => {
  1105. supplierList.value = res.rows.map((item) => {
  1106. return {
  1107. ...item,
  1108. label: item.name,
  1109. value: item.id,
  1110. };
  1111. });
  1112. });
  1113. proxy
  1114. .get("/tenantDept/list", {
  1115. pageNum: 1,
  1116. pageSize: 9999,
  1117. keyword: "",
  1118. tenantId: proxy.useUserStore().user.tenantId,
  1119. type: 0,
  1120. })
  1121. .then((res) => {
  1122. treeData.value = proxy.handleTree(res.data, "deptId");
  1123. });
  1124. };
  1125. getDict();
  1126. const getBtnDisabled = () => {
  1127. if (
  1128. formData.data.costControlDetailList &&
  1129. formData.data.costControlDetailList.length < 1
  1130. ) {
  1131. return false;
  1132. } else {
  1133. if (
  1134. currentCostTypeData.value &&
  1135. currentCostTypeData.value.name &&
  1136. currentCostTypeData.value.name.indexOf("快递") != -1
  1137. ) {
  1138. return true;
  1139. } else {
  1140. return false;
  1141. }
  1142. }
  1143. };
  1144. const handleGetRemark = (index) => {
  1145. let row = formData.data.costControlDetailList[index];
  1146. let money = 0;
  1147. money = parseFloat(Number(row.currentPayable)).toFixed(2);
  1148. // formData.data.costControlDetailList[
  1149. // index
  1150. // ].remark = `支付${row.applyRemark}${currentCostTypeData.value.name}${money}`;
  1151. formData.data.costControlDetailList[index].money = money;
  1152. if (currentCostTypeData.value.name.indexOf("归还") != -1) {
  1153. formData.data.costControlDetailList[index].money = parseFloat(
  1154. Number(row.returnAmount)
  1155. ).toFixed(2);
  1156. formData.data.costControlDetailList[
  1157. index
  1158. ].remark = `归还备用金${formData.data.costControlDetailList[index].money}`;
  1159. } else if (currentCostTypeData.value.name.indexOf("备用金") != -1) {
  1160. formData.data.costControlDetailList[
  1161. index
  1162. ].remark = `支付${row.applyRemark}备用金${money}`;
  1163. } else if (currentCostTypeData.value.name.indexOf("借款") != -1) {
  1164. formData.data.costControlDetailList[
  1165. index
  1166. ].remark = `支付${row.applyRemark}借款${money}`;
  1167. } else if (currentCostTypeData.value.name.indexOf("快递") != -1) {
  1168. formData.data.costControlDetailList[
  1169. index
  1170. ].remark = `支付${row.labelName}${currentCostTypeData.value.name}${money}`;
  1171. } else if (currentCostTypeData.value.name.indexOf("店铺") != -1) {
  1172. formData.data.costControlDetailList[
  1173. index
  1174. ].remark = `支付${row.labelName}${currentCostTypeData.value.name}${money}`;
  1175. } else if (currentCostTypeData.value.name.indexOf("采购") != -1) {
  1176. formData.data.costControlDetailList[
  1177. index
  1178. ].remark = `支付${row.labelName}供应商${currentCostTypeData.value.name}${money}`;
  1179. }
  1180. };
  1181. const clickAdd = () => {
  1182. let accountSubjectsId = "";
  1183. let accountSubjectsName = "";
  1184. if (
  1185. currentCostTypeData.value &&
  1186. currentCostTypeData.value.accountSubjectsId
  1187. ) {
  1188. accountSubjectsId = currentCostTypeData.value.accountSubjectsId;
  1189. let currentAccountSubjects = accountSubjectsList.value.find(
  1190. (x) => x.id == accountSubjectsId
  1191. );
  1192. if (currentAccountSubjects) {
  1193. accountSubjectsName = currentAccountSubjects.calculateItemName;
  1194. }
  1195. }
  1196. if (
  1197. formData.data.costControlDetailList &&
  1198. formData.data.costControlDetailList.length > 0
  1199. ) {
  1200. formData.data.costControlDetailList.push({
  1201. remark: "",
  1202. supplierId: "",
  1203. payeeAccountId: "",
  1204. applyRemark: "",
  1205. deductionMonth: "",
  1206. accountSubjectsId: accountSubjectsId,
  1207. accountSubjectsName: accountSubjectsName,
  1208. logisticsCompanyId: "",
  1209. invoiceTaxPoint: "",
  1210. currentPayable: null,
  1211. currentPayableDeduction: null,
  1212. money: null,
  1213. balancePrepaidTax: null,
  1214. balancePrepaid: null,
  1215. accountPeriod: null,
  1216. accountPeriodAmount: null,
  1217. accountPeriodAmountTax: null,
  1218. accountPeriodAdjustAmount: null,
  1219. currentPrepaidTax: null,
  1220. currentPrepaid: null,
  1221. deductionPrepaidTax: null,
  1222. deductionPrepaid: null,
  1223. shopId: "",
  1224. costType: "",
  1225. brushingTime: "",
  1226. promotionFeeType: "",
  1227. taxation: null,
  1228. fileList: [],
  1229. invoiceFileList: [],
  1230. });
  1231. } else {
  1232. formData.data.costControlDetailList = [
  1233. {
  1234. remark: "",
  1235. supplierId: "",
  1236. payeeAccountId: "",
  1237. applyRemark: "",
  1238. deductionMonth: "",
  1239. accountSubjectsId: accountSubjectsId,
  1240. accountSubjectsName: accountSubjectsName,
  1241. logisticsCompanyId: "",
  1242. invoiceTaxPoint: "",
  1243. currentPayable: null,
  1244. currentPayableDeduction: null,
  1245. money: null,
  1246. balancePrepaidTax: null,
  1247. balancePrepaid: null,
  1248. accountPeriod: null,
  1249. accountPeriodAmount: null,
  1250. accountPeriodAmountTax: null,
  1251. accountPeriodAdjustAmount: null,
  1252. currentPrepaidTax: null,
  1253. currentPrepaid: null,
  1254. deductionPrepaidTax: null,
  1255. deductionPrepaid: null,
  1256. shopId: "",
  1257. costType: "",
  1258. brushingTime: "",
  1259. promotionFeeType: "",
  1260. taxation: null,
  1261. fileList: [],
  1262. invoiceFileList: [],
  1263. },
  1264. ];
  1265. }
  1266. };
  1267. const handleDelete = (index) => {
  1268. formData.data.costControlDetailList.splice(index, 1);
  1269. };
  1270. const handleBeforeUploadOne = async (file, index) => {
  1271. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1272. file.id = res.id;
  1273. file.fileUrl = res.fileUrl;
  1274. formData.data.costControlDetailList[index].uploadData = res.uploadBody;
  1275. formData.data.costControlDetailList[index].fileData = res;
  1276. return true;
  1277. };
  1278. const handleSuccessOne = (index, att) => {
  1279. if (
  1280. formData.data.costControlDetailList[index].fileData &&
  1281. formData.data.costControlDetailList[index].fileData.fileUrl
  1282. ) {
  1283. let file = formData.data.costControlDetailList[index].fileData;
  1284. formData.data.costControlDetailList[index][att].push({
  1285. id: file.id,
  1286. fileName: file.fileName,
  1287. name: file.fileName,
  1288. url: file.fileUrl,
  1289. fileUrl: file.fileUrl,
  1290. });
  1291. formData.data.costControlDetailList[index].fileData = {};
  1292. }
  1293. };
  1294. const handleRemoveFile = (file, index, att) => {
  1295. let sonIndex = formData.data.costControlDetailList[index][att].findIndex(
  1296. (x) => x.id == file.id || x.id == file.raw.id
  1297. );
  1298. if (sonIndex > -1) {
  1299. formData.data.costControlDetailList[index][att].splice(sonIndex, 1);
  1300. }
  1301. };
  1302. const onPreviewFile = (file) => {
  1303. if (file && file.fileUrl) {
  1304. window.open(file.fileUrl, "_blank");
  1305. } else {
  1306. window.open(file.raw.fileUrl, "_blank");
  1307. }
  1308. };
  1309. const disabledFn = (date) => {
  1310. // 当前日期
  1311. let current = moment(date).format("YYYY-MM");
  1312. // 禁用已选日期和比当前日期小的
  1313. // return moment(current).add(1, "month").isBefore(moment());
  1314. return moment(current).isAfter(moment());
  1315. };
  1316. const handleSubmit = async (isStag = false) => {
  1317. if (isStag) {
  1318. return true;
  1319. }
  1320. let flag = await formDom.value.handleSubmit(() => {});
  1321. if (flag) {
  1322. if (
  1323. formData.data.costControlDetailList &&
  1324. formData.data.costControlDetailList.length > 0
  1325. ) {
  1326. return true;
  1327. } else {
  1328. proxy.msgTip("请添加收付款明细");
  1329. return false;
  1330. }
  1331. } else {
  1332. setTimeout(() => {
  1333. const errorDiv = document.getElementsByClassName("is-error");
  1334. errorDiv[0].scrollIntoView();
  1335. }, 0);
  1336. }
  1337. return flag;
  1338. };
  1339. const getFormData = () => {
  1340. return proxy.deepClone(formData.data);
  1341. };
  1342. // 向父组件暴露
  1343. defineExpose({
  1344. getFormData,
  1345. handleSubmit,
  1346. });
  1347. const getCheckBoxMap = (val) => {
  1348. if (!val) return;
  1349. proxy.post("/paymentType/detail", { id: val }).then((res) => {
  1350. if (res && res.dynamicFieldJson) {
  1351. let obj = JSON.parse(res.dynamicFieldJson);
  1352. obj.mainObj = {};
  1353. obj.detailObj = {};
  1354. if (obj.mainCheckList) {
  1355. obj.mainCheckList.map((x) => (obj.mainObj[x] = true));
  1356. }
  1357. if (obj.detailCheckList) {
  1358. obj.detailCheckList.map((x) => (obj.detailObj[x] = true));
  1359. }
  1360. checkBoxMap.value = obj;
  1361. }
  1362. });
  1363. };
  1364. const getAllData = (businessId) => {
  1365. proxy.post("/costControl/detail", { id: businessId }).then(async (res) => {
  1366. if (res && res.costControlDetailList && res.costControlDetailList.length) {
  1367. res.costControlDetailList.map((x) => {
  1368. x.fileList = [];
  1369. x.invoiceFileList = [];
  1370. });
  1371. }
  1372. for (const key in res) {
  1373. formData.data[key] = res[key];
  1374. }
  1375. getDeptData(formData.data.companyId);
  1376. getCheckBoxMap(formData.data.costType);
  1377. if (
  1378. formData.data.costControlDetailList &&
  1379. formData.data.costControlDetailList.length > 0
  1380. ) {
  1381. let ids = formData.data.costControlDetailList.map((x) => x.id);
  1382. const productAllFile = await proxy.getFileData({
  1383. businessIdList: ids,
  1384. getAll: true,
  1385. });
  1386. for (let i = 0; i < formData.data.costControlDetailList.length; i++) {
  1387. const ele = formData.data.costControlDetailList[i];
  1388. for (const key in productAllFile) {
  1389. if (
  1390. ele.id == key &&
  1391. productAllFile[ele.id] &&
  1392. productAllFile[ele.id].length > 0
  1393. ) {
  1394. ele.fileList = productAllFile[ele.id]
  1395. .filter((item) => item.businessType == "0")
  1396. .map((item) => {
  1397. return {
  1398. ...item,
  1399. name: item.fileName,
  1400. url: item.fileUrl,
  1401. };
  1402. });
  1403. ele.invoiceFileList = productAllFile[ele.id]
  1404. .filter((item) => item.businessType == "10")
  1405. .map((item) => {
  1406. return {
  1407. ...item,
  1408. name: item.fileName,
  1409. url: item.fileUrl,
  1410. };
  1411. });
  1412. break;
  1413. } else {
  1414. ele.fileList = [];
  1415. ele.invoiceFileList = [];
  1416. }
  1417. }
  1418. }
  1419. }
  1420. });
  1421. };
  1422. onMounted(() => {
  1423. formData.data.companyIdSet.push(proxy.useUserStore().user.companyId);
  1424. getDeptData(formData.data.companyId);
  1425. formOption.disabled = judgeStatus();
  1426. if (route.query && route.query.businessId && route.query.processType) {
  1427. let businessId = route.query.businessId;
  1428. getAllData(businessId);
  1429. } else if (
  1430. route.query &&
  1431. route.query.businessId &&
  1432. !route.query.processType
  1433. ) {
  1434. let businessId = route.query.businessId;
  1435. getAllData(businessId);
  1436. }
  1437. });
  1438. </script>
  1439. <style lang="scss" scoped>
  1440. .table {
  1441. border-collapse: collapse;
  1442. border-spacing: 0;
  1443. td {
  1444. text-align: center;
  1445. padding: 2px 4px;
  1446. // padding: 5px 10px;
  1447. }
  1448. }
  1449. .small-title {
  1450. padding-left: 15px;
  1451. margin-bottom: 10px;
  1452. color: #3366ff;
  1453. font-size: 14px;
  1454. }
  1455. :deep(.el-checkbox) {
  1456. margin-right: 0px;
  1457. }
  1458. // :deep(.el-collapse-item) {
  1459. // margin-bottom: 10px;
  1460. // }
  1461. :deep(.el-collapse-item__header) {
  1462. background-color: #eee;
  1463. }
  1464. </style>