addInvoice.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <div class="addInvoice">
  3. <el-form ref="form" :model="form" style="width: 100%;padding: 5px" :rules="rules">
  4. <el-row>
  5. <el-col style="padding-bottom: 10px">
  6. <span class="card_title">开票信息</span>
  7. <el-card shadow="always" style="padding-top: 10px">
  8. <el-row v-if="!id">
  9. <el-col :span="4" class="col-txt"><span><span class="red-asterisk">*</span>签约信息</span></el-col>
  10. <el-col :span="20" class="col-input">
  11. <el-form-item>
  12. <el-button type="text" @click="handleContract()">去选择</el-button>
  13. </el-form-item>
  14. </el-col>
  15. </el-row>
  16. <el-row>
  17. <el-col :span="4" class="col-txt"><span>发票抬头</span></el-col>
  18. <el-col :span="20" class="col-input">
  19. <el-form-item>
  20. <el-input v-model="form.invoiceHeaderName" />
  21. </el-form-item>
  22. </el-col>
  23. </el-row>
  24. <el-row>
  25. <el-col :span="4" class="col-txt"><span>税号</span></el-col>
  26. <el-col :span="20" class="col-input">
  27. <el-form-item>
  28. <el-input v-model="form.invoiceHeaderNumber" />
  29. </el-form-item>
  30. </el-col>
  31. </el-row>
  32. <el-row>
  33. <el-col :span="4" class="col-txt"><span>项目名称</span></el-col>
  34. <el-col :span="20" class="col-input">
  35. <el-form-item>
  36. <el-input v-model="form.invoiceGoodsName" />
  37. </el-form-item>
  38. </el-col>
  39. </el-row>
  40. <el-row>
  41. <el-col :span="4" class="col-txt"><span>规格</span></el-col>
  42. <el-col :span="20" class="col-input">
  43. <el-form-item>
  44. <el-input v-model="form.specifications" />
  45. </el-form-item>
  46. </el-col>
  47. </el-row>
  48. <el-row>
  49. <el-col :span="4" class="col-txt"><span>单位</span></el-col>
  50. <el-col :span="20" class="col-input">
  51. <el-form-item>
  52. <span>平方米</span>
  53. </el-form-item>
  54. </el-col>
  55. </el-row>
  56. <el-row>
  57. <el-col :span="4" class="col-txt"><span>数量</span></el-col>
  58. <el-col :span="20" class="col-input">
  59. <el-form-item>
  60. <el-input v-model="form.invoiceCount" />
  61. </el-form-item>
  62. </el-col>
  63. </el-row>
  64. <el-row>
  65. <el-col :span="4" class="col-txt"><span>金额</span></el-col>
  66. <el-col :span="20" class="col-input">
  67. <el-form-item>
  68. <el-input v-model="form.invoiceAmount" oninput="value=value.replace(/[^\d.]/g,'')" />
  69. </el-form-item>
  70. </el-col>
  71. </el-row>
  72. <el-row>
  73. <el-col :span="4" class="col-txt"><span>销方开户行、账号</span></el-col>
  74. <el-col :span="20" class="col-input">
  75. <el-form-item prop="invoiceSellerBank">
  76. <el-select
  77. v-model="form.invoiceSellerBank"
  78. filterable
  79. placeholder="请选择"
  80. >
  81. <el-option
  82. v-for="item in bankOptions"
  83. :key="item.id"
  84. :label="item.bankName + (item.bankBranchName?item.bankBranchName:'') + item.bankNumber"
  85. :title="'适用楼盘:' + (item.suitFloorStr?item.suitFloorStr:'无') + ' 适用费用类型:' + (item.suitCostType?item.suitCostType:'无')"
  86. :value="item.bankName + (item.bankBranchName?item.bankBranchName:'') + item.bankNumber"
  87. >
  88. <div class="my-select">
  89. <span>{{ item.bankName + (item.bankBranchName?item.bankBranchName:'') + item.bankNumber }}</span>
  90. <span style="color: #8492a6; font-size: 13px;padding-left: 10px">
  91. {{ ' 适用楼盘:' + (item.suitFloorStr?item.suitFloorStr:'无') + ' 适用费用类型:' + (item.suitCostType?item.suitCostType:'无') }}
  92. </span>
  93. </div>
  94. </el-option>
  95. </el-select>
  96. </el-form-item>
  97. </el-col>
  98. </el-row>
  99. <el-row>
  100. <el-col :span="4" class="col-txt"><span>税率</span></el-col>
  101. <el-col :span="20" class="col-input">
  102. <el-form-item prop="invoiceTax">
  103. <!-- <el-select-->
  104. <!-- v-model="form.invoiceTax"-->
  105. <!-- filterable-->
  106. <!-- placeholder="请选择"-->
  107. <!-- popper-class="statistic_base"-->
  108. <!-- >-->
  109. <!-- <el-option-->
  110. <!-- v-for="item in dc_data.invoice_tax"-->
  111. <!-- :key="item.value"-->
  112. <!-- :label="item.label"-->
  113. <!-- :value="item.value"-->
  114. <!-- />-->
  115. <!-- </el-select>-->
  116. <el-input v-model="form.invoiceTax" />
  117. </el-form-item>
  118. </el-col>
  119. </el-row>
  120. <el-row>
  121. <el-col :span="4" class="col-txt"><span>备注</span></el-col>
  122. <el-col :span="20" class="col-input">
  123. <el-form-item>
  124. <el-input v-model="form.remark" type="textarea" :autosize="{ minRows: 2, maxRows: 100}" maxlength="2000" show-word-limit />
  125. </el-form-item>
  126. </el-col>
  127. </el-row>
  128. </el-card>
  129. </el-col>
  130. </el-row>
  131. </el-form>
  132. <div style="text-align: right">
  133. <el-button @click="cancel">取 消</el-button>
  134. <el-button v-if="!isView" type="primary" :loading="loadingFlag" @click="confirmSubmit()">确 定</el-button>
  135. </div>
  136. <el-dialog
  137. :visible.sync="dialogVisible"
  138. :title="dialogTitle"
  139. width="90%"
  140. top="20px"
  141. class="statistic_base"
  142. :append-to-body="true"
  143. :modal-append-to-body="true"
  144. custom-class="tagdialog"
  145. @close="getData"
  146. >
  147. <contract-index v-if="dialogVisible" ref="contractIndex" from-address="addInvoice" @getChildrenData="getChildrenData" />
  148. </el-dialog>
  149. </div>
  150. </template>
  151. <script>
  152. import ContractIndex from '@/views/signingManagement/contractManagement/index.vue'
  153. import Base from '@/views/base/base.vue'
  154. import BaseData from '@/views/base/baseData.vue'
  155. export default {
  156. name: 'AddInvoice',
  157. components: { ContractIndex },
  158. mixins: [Base, BaseData],
  159. data() {
  160. return {
  161. dc_key: ['invoice_tax'],
  162. form: {},
  163. rules: {},
  164. dialogVisible: false,
  165. dialogTitle: '',
  166. isView: false,
  167. bankOptions: [],
  168. loadingFlag: false,
  169. id: ''
  170. }
  171. },
  172. mounted() {
  173. this.initDict(this.dc_key).then((res) => {
  174. })
  175. },
  176. methods: {
  177. initData(data) {
  178. this.id = data.id
  179. this.isView = data.isView
  180. this.getBankOptions()
  181. if (data) {
  182. this.getData(data)
  183. }
  184. },
  185. getData(data) {
  186. const postData = {
  187. id: data.id
  188. }
  189. this.baseRequest('getById', postData).then(res => {
  190. if (res.data) {
  191. this.form = res.data
  192. }
  193. }).catch(err => {
  194. this.$message.error(err)
  195. })
  196. },
  197. getBankOptions() {
  198. this.bankRequest('listAll', {}).then(res => {
  199. this.bankOptions = res.data || []
  200. })
  201. },
  202. getBankTaxRateByFloor(data) {
  203. this.baseRequest('getBankTaxRateByFloor_2', data).then(res => {
  204. if (res.data) {
  205. this.form.invoiceSellerBank = res.data.invoiceSellerBank
  206. this.form.invoiceTax = res.data.invoiceTax == null ? '0' : res.data.invoiceTax
  207. }
  208. })
  209. },
  210. handleContract() {
  211. this.dialogVisible = true
  212. this.dialogTitle = ''
  213. },
  214. cancel() {
  215. this.$emit('cancel')
  216. },
  217. confirmSubmit() {
  218. const _this = this
  219. if (!this.form.contractId) {
  220. this.$message.warning('请选择签约信息')
  221. return
  222. }
  223. _this.loadingFlag = true
  224. let soaUrl = 'add'
  225. if (this.id) {
  226. soaUrl = 'sendInvoice'
  227. }
  228. const extraData = {
  229. }
  230. const postData = Object.assign({}, _this.form, extraData)
  231. this.baseRequest(soaUrl, postData).then(res => {
  232. if (res.data.code === 200) {
  233. this.$message.success('保存成功')
  234. this.cancel()
  235. } else {
  236. this.$message.error(res.data.msg)
  237. }
  238. _this.loadingFlag = false
  239. }).catch(err => {
  240. // this.$message.error(err)
  241. _this.loadingFlag = false
  242. })
  243. },
  244. getChildrenData(data) {
  245. console.log('data', data)
  246. this.dialogVisible = false
  247. const postData = {
  248. id: data,
  249. invoiceGoodsName: '*房地产预收款*&'
  250. }
  251. this.baseRequest('getByContractId', postData).then(res => {
  252. if (res.data) {
  253. this.form = res.data
  254. // 带出银行
  255. const postData = {
  256. contractId: data,
  257. paymentType: '房款'
  258. }
  259. this.getBankTaxRateByFloor(postData)
  260. }
  261. })
  262. },
  263. baseRequest(opUrl, postData) {
  264. return this.$channel.globeRequest('InvoiceManageController', opUrl, postData, 'project')
  265. },
  266. bankRequest(opUrl, postData) {
  267. return this.$channel.globeRequest('InvoiceBankController', opUrl, postData, 'project')
  268. }
  269. }
  270. }
  271. </script>
  272. <style lang="scss">
  273. </style>
  274. <style scoped>
  275. .red-asterisk {
  276. color: red;
  277. }
  278. </style>