contractAdd.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <template>
  2. <div class="contractAdd">
  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. <el-card shadow="always" style="padding: 15px 5px 5px 15px">
  7. <el-row>
  8. <el-col :span="5" class="col-txt"><span>网签备案号</span></el-col>
  9. <el-col :span="18" class="col-input">
  10. <el-form-item>
  11. <el-input v-model="form.recordNumber" />
  12. </el-form-item>
  13. </el-col>
  14. </el-row>
  15. <el-row>
  16. <el-col :span="5" class="col-txt"><span>合同编号</span></el-col>
  17. <el-col :span="18" class="col-input">
  18. <el-form-item>
  19. <el-input v-model="form.contractNumber" />
  20. </el-form-item>
  21. </el-col>
  22. </el-row>
  23. <el-row>
  24. <el-col :span="5" class="col-txt"><span>出卖人</span></el-col>
  25. <el-col :span="18" class="col-input">
  26. <el-form-item>
  27. <el-input value="无锡市安居投资发展有限公司" readonly />
  28. </el-form-item>
  29. </el-col>
  30. </el-row>
  31. <el-row v-for="(item, index) in form.dynamicItem" :key="index">
  32. <el-col :span="5 " class="col-txt"><span>购房人{{ index + 1 }}</span></el-col>
  33. <el-col :span="4" class="col-input">
  34. <el-form-item :prop="'dynamicItem.' + index + '.name'">
  35. <el-input
  36. v-model="item.name"
  37. placeholder="请填写姓名"
  38. disabled
  39. />
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="4" class="col-input">
  43. <el-form-item :prop="'dynamicItem.' + index + '.identityCard'">
  44. <el-input
  45. v-model="item.identityCard"
  46. placeholder="请填写身份证号"
  47. disabled
  48. />
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="4" class="col-input">
  52. <el-form-item :prop="'dynamicItem.' + index + '.phone'">
  53. <el-input
  54. v-model="item.phone"
  55. placeholder="请填写手机号"
  56. disabled
  57. />
  58. </el-form-item>
  59. </el-col>
  60. <el-col v-if="index !== 0" :span="6" class="col-input">
  61. <el-form-item :prop="'dynamicItem.' + index + '.relationship'">
  62. <el-select
  63. v-model="item.relationship"
  64. placeholder="与1的关系"
  65. filterable
  66. disabled
  67. >
  68. <el-option
  69. v-for="relationship in dc_data.RELATIONSHIP"
  70. :key="relationship.value"
  71. :label="relationship.label"
  72. :value="relationship.value"
  73. />
  74. </el-select>
  75. </el-form-item>
  76. </el-col>
  77. </el-row>
  78. <el-row>
  79. <el-col :span="5" class="col-txt"><span>房屋</span></el-col>
  80. <el-col :span="18" class="col-input">
  81. <el-form-item>
  82. <el-cascader
  83. v-model="form.houseId"
  84. :append-to-body="false"
  85. style="width: 100%;"
  86. :options="TreeData"
  87. disabled
  88. @change="houseChange"
  89. />
  90. </el-form-item>
  91. </el-col>
  92. </el-row>
  93. <el-row>
  94. <el-col :span="5" class="col-txt"><span><span class="red-asterisk">*</span>实测建筑面积(㎡)</span></el-col>
  95. <el-col :span="18" class="col-input">
  96. <el-form-item prop="actualBuildArea">
  97. <el-input v-model="form.actualBuildArea" readonly />
  98. </el-form-item>
  99. </el-col>
  100. </el-row>
  101. <el-row>
  102. <el-col :span="5" class="col-txt"><span>套内建筑面积(㎡)</span></el-col>
  103. <el-col :span="18" class="col-input">
  104. <el-form-item>
  105. <el-input v-model="form.actualInternalArea" readonly />
  106. </el-form-item>
  107. </el-col>
  108. </el-row>
  109. <el-row>
  110. <el-col :span="5" class="col-txt"><span>分摊共有建筑(㎡)</span></el-col>
  111. <el-col :span="18" class="col-input">
  112. <el-form-item>
  113. <el-input v-model="form.actualShareArea" readonly />
  114. </el-form-item>
  115. </el-col>
  116. </el-row>
  117. <el-row>
  118. <el-col :span="5" class="col-txt"><span>房产测绘机构</span></el-col>
  119. <el-col :span="18" class="col-input">
  120. <el-form-item>
  121. <el-select
  122. v-model="form.institution"
  123. placeholder=""
  124. filterable
  125. :disabled="isView"
  126. >
  127. <el-option
  128. v-for="item in dc_data.MAPPING_INSTITUTION"
  129. :key="item.value"
  130. :label="item.label"
  131. :value="item.value"
  132. />
  133. </el-select>
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. <el-row>
  138. <el-col :span="5" class="col-txt"><span>签约日期</span></el-col>
  139. <el-col :span="18" class="col-input">
  140. <el-form-item>
  141. <el-date-picker
  142. v-model="form.signingDate"
  143. type="date"
  144. placeholder="年月日"
  145. value-format="yyyy-MM-dd"
  146. />
  147. </el-form-item>
  148. </el-col>
  149. </el-row>
  150. <el-row>
  151. <el-col :span="5" class="col-txt"><span>备注说明</span></el-col>
  152. <el-col :span="18" class="col-input">
  153. <el-input v-model="form.remark" type="textarea" :autosize="{ minRows: 2, maxRows: 100}" maxlength="2000" show-word-limit />
  154. </el-col>
  155. </el-row>
  156. <el-row>
  157. <el-divider />
  158. </el-row>
  159. <el-row>
  160. <el-col :span="5" class="col-txt"><span style="font-weight: bold;font-size: large">房价款</span></el-col>
  161. </el-row>
  162. <el-row>
  163. <el-col :span="5" class="col-txt"><span>房屋买卖单价(元/㎡)</span></el-col>
  164. <el-col :span="18" class="col-input">
  165. <el-form-item>
  166. <el-input v-model="form.housePrice" readonly placeholder="请先录入总价款,系统会自动计算出房屋买卖单价" />
  167. </el-form-item>
  168. </el-col>
  169. </el-row>
  170. <el-row>
  171. <el-col :span="5" class="col-txt"><span><span class="red-asterisk">*</span>总价款(元)</span></el-col>
  172. <el-col :span="18" class="col-input">
  173. <el-form-item prop="totalPrice">
  174. <el-input v-model="form.totalPrice" @input="totalPriceChange" />
  175. </el-form-item>
  176. </el-col>
  177. </el-row>
  178. <el-row>
  179. <el-col :span="5" class="col-txt"><span>买受人产权份额占比为(%)</span></el-col>
  180. <el-col :span="18" class="col-input">
  181. <el-form-item>
  182. <el-input v-model="form.buyerProportion" type="number" @input="proportionChange" />
  183. </el-form-item>
  184. </el-col>
  185. </el-row>
  186. <el-row>
  187. <el-col :span="5" class="col-txt"><span>买受人出资金额(元)</span></el-col>
  188. <el-col :span="18" class="col-input">
  189. <el-form-item>
  190. <el-input v-model="form.buyerMoney" />
  191. </el-form-item>
  192. </el-col>
  193. </el-row>
  194. <el-row>
  195. <el-col :span="5" class="col-txt"><span>付款方式</span></el-col>
  196. <el-col :span="18" class="col-input">
  197. <el-form-item>
  198. <el-select
  199. v-model="form.paymentMethod"
  200. placeholder="请选择"
  201. :disabled="isView"
  202. >
  203. <el-option
  204. v-for="item in dc_data.PAYMENT_METHODS"
  205. :key="item.value"
  206. :label="item.label"
  207. :value="item.value"
  208. />
  209. </el-select>
  210. </el-form-item>
  211. </el-col>
  212. </el-row>
  213. <el-row v-if="form.paymentMethod == '2'">
  214. <el-col :span="5" class="col-txt"><span>首付比例</span></el-col>
  215. <el-col :span="18" class="col-input">
  216. <el-form-item>
  217. <el-select
  218. v-model="form.downPaymentsProportion"
  219. placeholder="请选择"
  220. size="small"
  221. :disabled="isView"
  222. >
  223. <el-option
  224. v-for="item in dc_data.DOWN_PAYMENT_PROPORTION"
  225. :key="item.value"
  226. :label="item.label"
  227. :value="item.value"
  228. />
  229. </el-select>
  230. </el-form-item>
  231. </el-col>
  232. </el-row>
  233. <!-- <el-row>-->
  234. <!-- <el-col :span="5" class="col-txt"><span>付款截止日</span></el-col>-->
  235. <!-- <el-col :span="18" class="col-input">-->
  236. <!-- <el-form-item>-->
  237. <!-- <el-date-picker-->
  238. <!-- v-model="form.deadline"-->
  239. <!-- -->
  240. <!-- type="date"-->
  241. <!-- placeholder="年月日"-->
  242. <!-- value-format="yyyy-MM-dd"-->
  243. <!-- />-->
  244. <!-- </el-form-item>-->
  245. <!-- </el-col>-->
  246. <!-- </el-row>-->
  247. <el-row>
  248. <el-col :span="5" class="col-txt"><span>房款存入账号开户行</span></el-col>
  249. <el-col :span="18" class="col-input">
  250. <el-form-item>
  251. <el-autocomplete
  252. v-model="form.bankName"
  253. class="inline-input"
  254. :fetch-suggestions="querySearch"
  255. placeholder="请输入银行账号"
  256. style="width: 100%"
  257. @select="handleSelect"
  258. />
  259. </el-form-item>
  260. </el-col>
  261. </el-row>
  262. <el-row>
  263. <el-col :span="5" class="col-txt"><span>房款存入账号</span></el-col>
  264. <el-col :span="18" class="col-input">
  265. <el-form-item>
  266. <el-input v-model="form.bankNumber" />
  267. </el-form-item>
  268. </el-col>
  269. </el-row>
  270. <el-row>
  271. <el-divider />
  272. </el-row>
  273. <el-row>
  274. <el-col :span="5" class="col-txt"><span style="font-weight: bold;font-size: large">专项维修资金</span></el-col>
  275. </el-row>
  276. <el-row>
  277. <el-col :span="5" class="col-txt"><span>住宅专项维修资金(元/㎡)</span></el-col>
  278. <el-col :span="18" class="col-input">
  279. <el-form-item>
  280. <el-input v-model="form.maintenanceFunds" @input="maintenanceFundsChange" />
  281. </el-form-item>
  282. </el-col>
  283. </el-row>
  284. <el-row>
  285. <el-col :span="5" class="col-txt"><span>总价款(元)</span></el-col>
  286. <el-col :span="18" class="col-input">
  287. <el-form-item>
  288. <el-input v-model="form.maintenanceTotalPrice" />
  289. </el-form-item>
  290. </el-col>
  291. </el-row>
  292. <el-row>
  293. <el-col :span="5" class="col-txt"><span>合同原件</span></el-col>
  294. <el-col :span="5" class="col-input">
  295. <el-form-item>
  296. <el-upload
  297. class="upload-demo"
  298. action="/server/wx/fileController/uploadImage"
  299. :http-request="uploadPhoto"
  300. :before-remove="beforeRemove"
  301. multiple
  302. :file-list="contractOriginalList"
  303. :limit="6"
  304. :before-upload="$common.beforeUploadJustWordExcel"
  305. >
  306. <el-button v-if="!isView" size="small" type="primary">点击上传</el-button>
  307. <div slot="file" slot-scope="{file}">
  308. <a :href="file.url">{{ file.name }}</a>
  309. <span v-show="!isView" class="el-upload-list__item-actions">
  310. <i class="el-icon-delete" @click="handlePictureRemove(file,contractOriginalList)" />
  311. </span>
  312. </div>
  313. </el-upload>
  314. </el-form-item>
  315. </el-col>
  316. <el-col :span="5" class="col-txt"><span>其他附件</span></el-col>
  317. <el-col :span="5" class="col-input">
  318. <el-form-item>
  319. <el-upload
  320. class="upload-demo"
  321. action="/server/wx/fileController/uploadImage"
  322. :http-request="uploadContractOther"
  323. :before-remove="beforeRemove"
  324. multiple
  325. :file-list="contractOtherList"
  326. :limit="6"
  327. :before-upload="$common.beforeUploadJustWordExcel"
  328. >
  329. <el-button v-if="!isView" size="small" type="primary">点击上传</el-button>
  330. <div slot="file" slot-scope="{file}">
  331. <a :href="file.url">{{ file.name }}</a>
  332. <span v-show="!isView" class="el-upload-list__item-actions">
  333. <i class="el-icon-delete" @click="handlePictureRemove(file,contractOtherList)" />
  334. </span>
  335. </div>
  336. </el-upload>
  337. </el-form-item>
  338. </el-col>
  339. </el-row>
  340. </el-card>
  341. </el-col>
  342. </el-row>
  343. </el-form>
  344. <div slot="footer" style="text-align: right">
  345. <el-button @click="cancel()">关 闭</el-button>
  346. <el-button v-if="!isView" type="primary" @click="confirmSubmit()">暂 存</el-button>
  347. <el-button v-if="!isView" type="primary" @click="confirmSubmit('signing')">签 约</el-button>
  348. </div>
  349. </div>
  350. </template>
  351. <script>
  352. import Base from '@/views/base/base'
  353. import BaseData from '@/views/base/baseData'
  354. import { upload } from '@/static/utils/channel'
  355. export default {
  356. name: 'ContractManage',
  357. components: {
  358. },
  359. mixins: [Base, BaseData],
  360. props: {
  361. // 确认从哪个页面跳转过来的,这样可以做相应的操作
  362. fromAddress: {
  363. type: String,
  364. default: ''
  365. },
  366. signYear: {
  367. type: String,
  368. default: ''
  369. }
  370. },
  371. data() {
  372. return {
  373. dc_key: ['CONTRACT_STATUS', 'MAPPING_INSTITUTION', 'PAYMENT_METHODS', 'DOWN_PAYMENT_PROPORTION', 'RELATIONSHIP'],
  374. // 弹框相关
  375. dialogVisible: false,
  376. dialogTitle: '新增',
  377. form: {
  378. downPaymentsProportion: '',
  379. paymentMethod: '',
  380. institution: '',
  381. dynamicItem: [
  382. {
  383. id: '',
  384. customerManagementId: '',
  385. name: '',
  386. identityCard: '',
  387. phone: '',
  388. relationship: ''
  389. }
  390. ]
  391. },
  392. rules: {
  393. // contractNumber: [{ required: true, trigger: 'blur', message: '请输入合同编号' }],
  394. actualBuildArea: [{ required: true, trigger: 'blur', message: '实测建筑面积' }],
  395. totalPrice: [{ required: true, trigger: 'blur', message: '请输入总价款' }]
  396. },
  397. contractOriginalList: [],
  398. contractOtherList: [],
  399. signingMaterialsList: [],
  400. contractId: '',
  401. TreeData: [],
  402. isView: false, // 查看按钮权限,
  403. searchTreeData: [],
  404. restaurants: []
  405. }
  406. },
  407. watch: {
  408. },
  409. mounted() {
  410. this.findRoomTree()
  411. this.initDict(this.dc_key).then((res) => {
  412. })
  413. },
  414. methods: {
  415. initData(val) {
  416. const _this = this
  417. // 查看或编辑
  418. if (val.id) {
  419. _this.isView = val.isView
  420. const postData = {
  421. id: val.id
  422. }
  423. this.baseRequest('getById', postData).then((res) => {
  424. if (res.data) {
  425. const data = res.data
  426. _this.form = Object.assign({}, _this.form, res.data)
  427. // 合同原件
  428. _this.contractOriginalList = data.contractOriginal ? JSON.parse(data.contractOriginal) : []
  429. // 其他附件
  430. _this.contractOtherList = data.contractOther ? JSON.parse(data.contractOther) : []
  431. if (data.institution) {
  432. _this.form.institution = data.institution + ''
  433. }
  434. if (data.paymentMethod) {
  435. _this.form.paymentMethod = data.paymentMethod + ''
  436. }
  437. if (data.downPaymentsProportion) {
  438. _this.form.downPaymentsProportion = data.downPaymentsProportion + ''
  439. }
  440. // 初始化专项维修资金总价款
  441. const price = _this.form.maintenanceFunds
  442. const area = _this.form.actualBuildArea
  443. if (price && area) {
  444. _this.form.maintenanceTotalPrice = price * area
  445. }
  446. // 初始化 买受人产权份额占比为
  447. this.form.buyerProportion = 50
  448. }
  449. }).catch(() => {
  450. })
  451. this.baseBuyerRequest('listAll', { customerManagementId: val.customerManagementId }).then(res => {
  452. const data = res.data
  453. _this.form.dynamicItem = data
  454. this.$forceUpdate()
  455. })
  456. this.loadAll(val.id)
  457. }
  458. },
  459. findRoomTree: function() {
  460. const _this = this
  461. this.pubRequest('getTreeData1', '').then((res) => {
  462. _this.TreeData = res.data.data
  463. }).catch(() => {
  464. })
  465. },
  466. uploadPhoto: function(param) {
  467. upload(param, true).then((res) => {
  468. this.contractOriginalList.push(res)
  469. })
  470. },
  471. uploadContractOther: function(param) {
  472. upload(param, true).then((res) => {
  473. this.contractOtherList.push(res)
  474. })
  475. },
  476. confirmSubmit: function(type) {
  477. const _this = this
  478. if (!_this.form.recordNumber && !_this.form.contractNumber) {
  479. _this.$message.warning('网签备案号/合同编号,必须至少填写其一')
  480. return
  481. }
  482. const p1 = new Promise((resolve, reject) => {
  483. this.$refs['form'].validate((valid) => {
  484. if (valid) resolve()
  485. })
  486. })
  487. const p2 = {}
  488. Promise.all([p1, p2])
  489. .then(() => {
  490. const soaUrl = 'edit'
  491. const extraData = {
  492. // 合同原件
  493. contractOriginal: JSON.stringify(this.contractOriginalList),
  494. // 其他附件
  495. contractOther: JSON.stringify(this.contractOtherList)
  496. }
  497. if (type === 'signing') {
  498. // 合同状态
  499. extraData.contractStatus = 2
  500. }
  501. const postData = Object.assign({}, _this.form, extraData)
  502. this.baseRequest(soaUrl, postData).then(res => {
  503. if (res.data.code === 200) {
  504. this.$message.success('保存成功')
  505. this.cancel()
  506. } else {
  507. this.$message.error(res.data.msg)
  508. }
  509. }).catch(err => {
  510. this.$message.error(err)
  511. })
  512. })
  513. },
  514. cancel() {
  515. this.$emit('cancel')
  516. },
  517. houseChange() {
  518. },
  519. totalPriceChange() {
  520. const _this = this
  521. const total = _this.form.totalPrice
  522. const area = _this.form.actualBuildArea
  523. if (total && area) {
  524. _this.form.housePrice = (total / area).toFixed(2)
  525. }
  526. // 触发买受人产权占比
  527. _this.proportionChange()
  528. },
  529. proportionChange() {
  530. const _this = this
  531. const total = _this.form.totalPrice
  532. const proportion = _this.form.buyerProportion / 100
  533. if (total && proportion) {
  534. _this.form.buyerMoney = (total * proportion).toFixed(2)
  535. }
  536. },
  537. maintenanceFundsChange() {
  538. const _this = this
  539. const price = _this.form.maintenanceFunds
  540. const area = _this.form.actualBuildArea
  541. if (price && area) {
  542. _this.form.maintenanceTotalPrice = (price * area).toFixed(2)
  543. }
  544. },
  545. querySearch(queryString, cb) {
  546. var restaurants = this.restaurants
  547. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  548. // 调用 callback 返回建议列表的数据
  549. cb(results)
  550. },
  551. createFilter(queryString) {
  552. return (restaurant) => {
  553. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  554. }
  555. },
  556. loadAll(data) {
  557. this.restaurants = []
  558. const postData = {
  559. contractId: data
  560. }
  561. this.baseRequest('getBankList', postData).then((res) => {
  562. const bankList = res.data
  563. bankList.forEach(item => {
  564. const obj = {
  565. value: item.bankBranchName + item.bankName,
  566. label: item.bankNumber,
  567. id: item.id
  568. }
  569. this.restaurants.push(obj)
  570. })
  571. }).catch(() => {
  572. })
  573. },
  574. handleSelect(item) {
  575. this.form.bankNumber = item.label
  576. },
  577. baseRequest(opUrl, postData) {
  578. return this.$channel.globeRequest('ContractManageController', opUrl, postData, 'project')
  579. },
  580. pubRequest(opUrl, postData) {
  581. return this.$channel.globeRequest('ParkInfoController', opUrl, postData, 'project')
  582. },
  583. baseRoomRequest(opUrl, postData) {
  584. return this.$channel.globeRequest('ParkRoomController', opUrl, postData, 'project')
  585. },
  586. baseBuyerRequest(opUrl, postData) {
  587. return this.$channel.globeRequest('BuyerController', opUrl, postData, 'project')
  588. }
  589. }
  590. }
  591. </script>
  592. <style lang="scss">
  593. .contractAdd{
  594. .ch-input .el-input__inner {
  595. border-color: #32323A;
  596. }
  597. .el-textarea__inner{
  598. padding-right: 75px !important;
  599. }
  600. }
  601. </style>
  602. <style scoped>
  603. .red-asterisk {
  604. color: red;
  605. }
  606. </style>