C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2437 lines
83 KiB

  1. <template>
  2. <div>
  3. <!-- 合同信息 -->
  4. <div class="layout-content">
  5. <div class="step">
  6. <!-- step -->
  7. <el-steps
  8. v-if="isstepshow"
  9. :active="active"
  10. finish-status="success"
  11. :align-center="true"
  12. class="fx_step"
  13. >
  14. <el-step title="合同基本信息" class="first_title"></el-step>
  15. <el-step title="租金款项信息" class="second_title"></el-step>
  16. <el-step title="合同租金账单" class="third_title"></el-step>
  17. <el-step title="物业款项信息" class="fourth_title"></el-step>
  18. <el-step title="物业账单" class="fourth_title"></el-step>
  19. </el-steps>
  20. <el-form v-show="active==0" ref="form" :model="form" :rules="rules" label-width="130px">
  21. <!-- 商户信息 -->
  22. <div class="public_part">
  23. <div class="public_part_title">商户信息</div>
  24. <div class="public_part_Box">
  25. <el-form-item label="商户名称" prop="merchantName" class="fx_title">
  26. <!-- <el-input
  27. v-if="!showContractTable"
  28. v-model="form.merchantName "
  29. placeholder="请输入商户名称"
  30. maxlength="50"
  31. clearable
  32. ></el-input> -->
  33. <el-select @change="changeMerchantName" v-model="form.merchantName" clearable filterable placeholder="请输入或者选择商户名">
  34. <el-option
  35. v-for="(item,index) in merchantList"
  36. :key="index"
  37. :label="item.name"
  38. :value="item.id">
  39. </el-option>
  40. </el-select>
  41. <el-select @change="changeContract" v-model="curContractIndex" clearable filterable placeholder="请选择商户合同">
  42. <el-option
  43. v-for="(item,index) in curContractList"
  44. :key="index"
  45. :label="item.wxRentContract.shopName"
  46. :value="index">
  47. </el-option>
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item label="合同主体名称" prop class="fx_title">
  51. <el-input
  52. v-model="form.subjectName "
  53. placeholder="合同中乙方主体名称"
  54. maxlength="50"
  55. clearable
  56. ></el-input>
  57. </el-form-item>
  58. <el-form-item label="经营品牌" prop="brand" class="fx_send">
  59. <el-select v-model="form.brand" placeholder="请先选择品牌" class="select-method" :disabled="!isEditOk">
  60. <el-option
  61. v-for="(item,index) in brands"
  62. :key="index"
  63. :value="item.id"
  64. :label="item.value"
  65. ></el-option>
  66. </el-select>
  67. </el-form-item>
  68. <el-form-item label="经营业态" prop="businessId" class="fx_send">
  69. <el-select v-model="form.businessId" placeholder="请先选择经营业态" :disabled="!isEditOk">
  70. <el-option
  71. v-for="(item,index) in businessIds"
  72. :key="index"
  73. :value="item.id"
  74. :label="item.title"
  75. ></el-option>
  76. </el-select>
  77. </el-form-item>
  78. <el-form-item label="店面类型" prop="shopType" class="fx_send">
  79. <el-select v-model="form.shopType " placeholder="请先选择店铺类型">
  80. <el-option
  81. v-for="index in shopTypes"
  82. :key="index.value"
  83. :value="index.value"
  84. :label="index.label"
  85. ></el-option>
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item label="联系人" prop="linkPerson" class="fx_title">
  89. <el-input v-model="form.linkPerson" placeholder="请输入联系人" maxlength="8" clearable :disabled="!isEditOk"></el-input>
  90. </el-form-item>
  91. <el-form-item label="联系电话" prop="linkPhone" class="fx_title numberInputBox">
  92. <el-input
  93. :disabled="!isEditOk"
  94. type="number"
  95. v-model="form.linkPhone"
  96. placeholder="请输入手机号或座机号"
  97. clearable
  98. maxlength="20"
  99. ></el-input>
  100. </el-form-item>
  101. </div>
  102. </div>
  103. <!-- 商铺关联的合同列表 表格 wkx -->
  104. <contract-shop-table v-if="showContractTable" :contractType="1" :ref="contractTable" :merchantId="merchantIdFromSearch"></contract-shop-table>
  105. <!-- 选择信息 -->
  106. <rent-shop :ref="rentshop"></rent-shop>
  107. <!-- 合同信息 -->
  108. <div class="public_part">
  109. <div class="public_part_title">合同信息</div>
  110. <div class="public_part_Box">
  111. <el-form-item label="合同状态" prop="status" class="fx_send">
  112. <el-select :disabled="showContractTable" v-model="form.status" placeholder="请选择">
  113. <el-option
  114. v-for="item in options"
  115. :key="item.value"
  116. :value="item.value"
  117. :label="item.label"
  118. ></el-option>
  119. </el-select>
  120. </el-form-item>
  121. <el-form-item label="合同编号" prop="contractNumber" class="fx_title">
  122. <el-input
  123. :disabled="showContractTable"
  124. v-model="form.contractNumber"
  125. placeholder="请输入合同编号"
  126. maxlength="50"
  127. clearable
  128. ></el-input>
  129. </el-form-item>
  130. <el-form-item label="合同签约日" prop="signDate">
  131. <el-date-picker type="date" placeholder="选择日期" v-model="form.signDate"></el-date-picker>
  132. </el-form-item>
  133. </div>
  134. </div>
  135. <!-- 租赁信息 -->
  136. <div class="public_part">
  137. <div class="public_part_title">租赁信息</div>
  138. <div class="public_part_Box">
  139. <el-form-item label="租赁开始日期" prop="rentalStartDate">
  140. <el-date-picker
  141. type="date"
  142. placeholder="选择日期"
  143. v-model="form.rentalStartDate"
  144. :picker-options="pickerOptions0"
  145. @change="(value) => changeDates(value, 'rentalStartDate')"
  146. ></el-date-picker>
  147. </el-form-item>
  148. <el-form-item label="租赁截止日期" prop="rentalEndDate">
  149. <el-date-picker
  150. type="date"
  151. placeholder="选择日期"
  152. v-model="form.rentalEndDate"
  153. :picker-options="pickerOptions1"
  154. @change="(value) => changeDates(value, 'rentalEndDate')"
  155. ></el-date-picker>
  156. </el-form-item>
  157. <el-form-item label="总租期" class="width">
  158. <span>{{form.totalPeriodMonth}}</span>个月
  159. <span>{{form.totalPeriodDay}}</span>天
  160. </el-form-item>
  161. <el-form-item label="装修日期" prop="fixDate">
  162. <el-date-picker
  163. v-model="form.fixDate"
  164. type="daterange"
  165. style="width:400px!important;"
  166. range-separator="至"
  167. start-placeholder="开始日期"
  168. end-placeholder="结束日期"
  169. ></el-date-picker>
  170. </el-form-item>
  171. <el-form-item label="计租开始日期" prop="startDate">
  172. <el-date-picker
  173. type="date"
  174. placeholder="选择日期"
  175. v-model="form.startDate"
  176. @change="comperData"
  177. ></el-date-picker>
  178. </el-form-item>
  179. <el-form-item label="账单生成方式" prop="adjustPeriod">
  180. <el-radio-group
  181. v-model="form.adjustPeriod"
  182. @change="setAdjustPeriod"
  183. size="small"
  184. style="margin-left:20px;"
  185. >
  186. <el-radio-button label="2" value="2">按计租日期</el-radio-button>
  187. <el-radio-button label="3" value="3">按自然月</el-radio-button>
  188. </el-radio-group>
  189. </el-form-item>
  190. </div>
  191. </div>
  192. <div class="group-btn">
  193. <el-button class="quxiaoBtn" @click="cancel">取消</el-button>
  194. <el-button class="baocunBtn" :loading="loading" @click="submit('form')">保存并下一步</el-button>
  195. </div>
  196. </el-form>
  197. </div>
  198. </div>
  199. <!-- 款项信息 -->
  200. <div class="layout-content" v-if="active==1">
  201. <el-form ref="moneyform" :model="form" :rules="rules" label-width="130px">
  202. <div class="public_part">
  203. <div class="public_part_title">租金信息</div>
  204. <div class="public_part_Box">
  205. <contract-money :formDataList="form" ref="contractMoney"></contract-money>
  206. </div>
  207. <div class="public_part">
  208. <div class="public_part_title">账户信息</div>
  209. <div class="public_part_Box">
  210. <el-form-item label="甲方接收账户" prop="payAccount" class="fx_title">
  211. <el-input v-model="form.payAccount " placeholder="请输入接收账户" maxlength="20" clearable></el-input>
  212. </el-form-item>
  213. <el-form-item label="开户行" prop="bankName" class="fx_title">
  214. <el-input v-model="form.bankName " placeholder="请输入开户行" maxlength="20" clearable></el-input>
  215. </el-form-item>
  216. </div>
  217. </div>
  218. </div>
  219. <div class="group-btn">
  220. <el-button class="quxiaoBtn" @click="moneycancel">返回上一步</el-button>
  221. <el-button class="baocunBtn" :loading="loading" @click="moneysubmit('moneyform')">保存并下一步</el-button>
  222. </div>
  223. </el-form>
  224. </div>
  225. <!-- 附件 -->
  226. <div class="layout-content" v-show="active==2">
  227. <el-form ref="fileform" :model="form" :rules="rules" label-width="130px">
  228. <div class="public_part">
  229. <div class="public_part_title">合同租金明细</div>
  230. <div class="public_part_Box">
  231. <el-radio-group
  232. v-model="form.rentStartType"
  233. @change="submitMoney(1)"
  234. style="margin-bottom:20px;"
  235. >
  236. <el-radio :label="1" border>按租赁开始日生成</el-radio>
  237. <el-radio :label="2" border>按计租日生成</el-radio>
  238. </el-radio-group>
  239. <rent-bill :data="billData" :id="form.id" :type='1' :ref="billTk"></rent-bill>
  240. </div>
  241. </div>
  242. <div class="group-btn">
  243. <el-button class="quxiaoBtn" @click="filecancel">返回上一步</el-button>
  244. <el-button class="baocunBtn" :loading="loading" @click="filesubmit('fileform')">保存并下一步</el-button>
  245. </div>
  246. <!-- 跳转商户弹框 -->
  247. <el-dialog
  248. title
  249. :visible.sync="centerDialogVisible"
  250. width="30%"
  251. center
  252. :modal-append-to-body="false"
  253. >
  254. <span>合同信息已保存。为开启相关权限,请完善商户信息</span>
  255. <span slot="footer" class="dialog-footer">
  256. <el-button @click="cancleMerchant">取 消</el-button>
  257. <el-button type="primary" @click="sureMerchant">去商户完善信息</el-button>
  258. </span>
  259. </el-dialog>
  260. </el-form>
  261. </div>
  262. <!-- 款项信息 -->
  263. <div class="layout-content" v-show="active==3">
  264. <el-form ref="moneyform02" :model="moneyform" :rules="rules" label-width="130px">
  265. <div class="public_part">
  266. <div class="public_part_title">款项信息</div>
  267. <div class="public_part_Box" style="margin-left:50px;">
  268. <el-form-item
  269. label="计租面积"
  270. prop="price"
  271. class="fx_title"
  272. >{{getTotleArea+'㎡'+' ('+getAreaList+')'}}</el-form-item>
  273. <el-form-item label="物业单价" prop="rentPrice" class="fx_title">
  274. <el-input
  275. :value="moneyform.rentPrice"
  276. @input="changeArea('rentPrice', $event)"
  277. placeholder="请输入物业单价"
  278. maxlength="10"
  279. clearable
  280. ></el-input>
  281. <span class="per">元/㎡</span>
  282. <el-radio-group
  283. :value="moneyform.priceUnit"
  284. @input="changeFormData('priceUnit', $event)"
  285. size="small"
  286. >
  287. <el-radio-button
  288. v-for="(item,index) in priceUnitOption"
  289. :key="index"
  290. :label="item.value"
  291. >{{item.name}}</el-radio-button>
  292. </el-radio-group>
  293. </el-form-item>
  294. <el-form-item label="物业费" prop="price" class="fx_title">
  295. <el-input v-model="moneyform.price " placeholder="请输入" maxlength="10" clearable></el-input>
  296. <span class="per">元/{{changeUnitType}}</span>
  297. </el-form-item>
  298. <el-form-item label="物业押金" prop="deposit" class="fx_title">
  299. <el-input v-model="moneyform.deposit " placeholder="请输入" maxlength="10" clearable></el-input>
  300. <span class="per">元</span>
  301. </el-form-item>
  302. <el-form-item
  303. v-if="months.length>0"
  304. label="年物业费调整"
  305. class="fx_title"
  306. style="display:inline-block;"
  307. >
  308. <el-radio-group
  309. :value="moneyform.adjustRatioWay"
  310. @input="changeFormData('adjustRatioWay', $event)"
  311. size="small"
  312. style="margin-left:20px;"
  313. >
  314. <el-radio-button label="1" value="1">比例上调</el-radio-button>
  315. <el-radio-button label="2" value="2">固定上调</el-radio-button>
  316. <el-radio-button label="3" value="3">自定义</el-radio-button>
  317. </el-radio-group>
  318. <!-- <help title content="年物业费调整为固定上调,请在输入框中输入需要上调的比例或金额"></help> -->
  319. </el-form-item>
  320. <div v-if="moneyform.adjustRatioWay==1" class="per-list">
  321. <el-form-item
  322. v-for="index in months"
  323. :key="index"
  324. label
  325. :value="index"
  326. :prop="`adjustRatio[${index}]`"
  327. :rules="formvail.adjustRatio"
  328. class="fx_title"
  329. style="display:inline-block;width:400px;"
  330. >
  331. <el-input v-model="moneyform.adjustRatio[index]" placeholder="调整比例" clearable>
  332. <template slot="prepend">第{{index+2}}年</template>
  333. </el-input>
  334. <span class="per">%</span>
  335. </el-form-item>
  336. </div>
  337. <div v-else class="per-list">
  338. <el-form-item
  339. v-for="index in months"
  340. :key="index"
  341. label
  342. :value="index"
  343. :prop="`adjustRatio[${index}]`"
  344. :rules="formvail.adjustRatio1"
  345. class="fx_title"
  346. style="display:inline-block;width:400px;"
  347. >
  348. <el-input v-model="moneyform.adjustRatio[index]" placeholder="调整金额" clearable>
  349. <template slot="prepend">第{{index+2}}年</template>
  350. </el-input>
  351. <span class="per">元/{{changeUnitType}}</span>
  352. </el-form-item>
  353. </div>
  354. <el-form-item label="付款周期" prop="receivePeriod" class="paydata">
  355. <el-select
  356. v-model="moneyform.receivePeriod"
  357. filterable
  358. class="select-method innerinput"
  359. style="width:150px"
  360. >
  361. <el-option
  362. v-for="index in cycles"
  363. :key="index.value"
  364. :value="index.value"
  365. :label="index.label"
  366. ></el-option>
  367. </el-select>
  368. <!-- <el-input-number
  369. v-if="moneyform.priceUnit==1"
  370. :value="moneyform.receivePeriod"
  371. @input="changeFormData('receivePeriod', $event)"
  372. controls-position="right"
  373. :min="1"
  374. :max="365"
  375. ></el-input-number>-->
  376. <span class="per">月</span>
  377. </el-form-item>
  378. <el-row>
  379. <el-col :span="8">
  380. <el-form-item
  381. label="滞纳金费率"
  382. prop='latePayRatio'
  383. >
  384. <el-input
  385. style="width:160px"
  386. v-model="moneyform.latePayRatio"
  387. placeholder="请输入"
  388. maxlength="10"
  389. clearable
  390. ></el-input>
  391. %
  392. </el-form-item>
  393. </el-col>
  394. <el-col :span="14">
  395. <el-form-item
  396. label="欠缴后"
  397. prop='latePayDay'
  398. >
  399. <el-input
  400. style="width:160px"
  401. v-model="moneyform.latePayDay"
  402. placeholder="请输入"
  403. maxlength="10"
  404. clearable
  405. ></el-input>
  406. 日开始计费
  407. <help title content="例如:“0”为欠缴当天开始计滞纳金"></help>
  408. </el-form-item>
  409. </el-col>
  410. </el-row>
  411. <el-form-item label="账单生成方式" prop="lease">
  412. <el-radio-group
  413. v-model="moneyform.adjustPeriod"
  414. size="small"
  415. style="margin-left:20px;"
  416. >
  417. <el-radio-button label="2" value="2">按计租日期</el-radio-button>
  418. <el-radio-button label="3" value="3">按自然月</el-radio-button>
  419. </el-radio-group>
  420. </el-form-item>
  421. <el-form-item label="甲方接收账户" prop="payAccount" class="fx_title">
  422. <el-input
  423. v-model="moneyform.payAccount "
  424. placeholder="请输入"
  425. class="edit-item-input"
  426. maxlength="20"
  427. clearable
  428. ></el-input>
  429. </el-form-item>
  430. </div>
  431. </div>
  432. <div class="group-btn">
  433. <el-button class="quxiaoBtn" @click="propertyMoneycancel">返回上一步</el-button>
  434. <el-button
  435. class="baocunBtn"
  436. :loading="loading"
  437. @click="moneysubmit02('moneyform02')"
  438. >保存并下一步</el-button>
  439. </div>
  440. </el-form>
  441. </div>
  442. <!-- 附件 -->
  443. <div class="layout-content" v-show="active==4">
  444. <!-- 合同上传 -->
  445. <el-form ref="fileform02" :model="form" :rules="rules" label-width="130px">
  446. <div class="public_part">
  447. <div class="public_part_title">物业租金明细</div>
  448. <div class="public_part_Box">
  449. <el-radio-group
  450. v-model="moneyform.rentStartType"
  451. @change="submitMoney(2)"
  452. style="margin-bottom:20px;"
  453. >
  454. <el-radio :label="1" border>按租赁开始日生成</el-radio>
  455. <el-radio :label="2" border>按计租日生成</el-radio>
  456. </el-radio-group>
  457. <rent-bill :data="billData" :id="moneyform.id" :type='2' :ref="billTk02"></rent-bill>
  458. </div>
  459. </div>
  460. <div class="public_part">
  461. <div class="public_part_title">附件</div>
  462. <div class="public_part_Box" style="width:500px;margin-left:50px;">
  463. <el-form-item label="合同文件:">
  464. <el-upload
  465. class="upload-demo fx_upload"
  466. drag
  467. action="/api/upload/awsFileUpload"
  468. :on-error="importError"
  469. :on-success="importSuccess"
  470. :on-remove="handleRemove"
  471. :on-preview="downloadPr"
  472. :file-list="fileNames"
  473. :beforeUpload="beforeUpload"
  474. >
  475. <i class="el-icon-upload"></i>
  476. <div class="el-upload__text">
  477. 将文件拖到此处,或
  478. <em>点击上传</em>
  479. </div>
  480. </el-upload>
  481. </el-form-item>
  482. </div>
  483. </div>
  484. <div class="public_part_title" v-if="processData.length>0&&form.status==1">合同审批</div>
  485. <div
  486. class="public_part_Box"
  487. style="background:#fff;"
  488. v-if="processData.length>0&&form.status==1"
  489. >
  490. <div style="width:800px;">
  491. <el-form-item label="审批流程">
  492. <process-template :processData="processData"></process-template>
  493. </el-form-item>
  494. <el-form-item label="备注" prop="remark">
  495. <el-input
  496. type="textarea"
  497. maxlength="150"
  498. v-model="form.remark"
  499. placeholder="请填写备注!"
  500. class="edit-item-input"
  501. ></el-input>
  502. </el-form-item>
  503. </div>
  504. </div>
  505. <div class="group-btn">
  506. <el-button class="quxiaoBtn" @click="filecancel">返回上一步</el-button>
  507. <el-button class="baocunBtn" :loading="loading" @click="filesubmit02('fileform02')">完成</el-button>
  508. </div>
  509. </el-form>
  510. </div>
  511. </div>
  512. </template>
  513. <script>
  514. import help from "../../help.vue";
  515. import commonUtil from "../../../core/tool/commonUtil";
  516. import moment, { months } from "moment";
  517. import { mapState, mapActions } from "vuex";
  518. import { deepcopy } from "../../../utils/validate";
  519. import rentBill from "../contractutil/rentbill.vue";
  520. import Vue from "vue";
  521. import rentShop from "../contractutil/rentshop.vue";
  522. import contractMoney from "../contractComp/contractMoney.vue";
  523. import { ContractUrl } from "../businessComp/UrlEnum.js";
  524. import { ContractData } from "../../../service/contract/data.js";
  525. import { promissionUrl } from "../../../urlconfig/promission/url.js";
  526. import processTemplate from "../contractutil/processTemplate.vue";
  527. import contractShopTable from "../contractutil/contractShopTable.vue";
  528. export default {
  529. components: {
  530. rentBill,
  531. rentShop,
  532. contractMoney,
  533. processTemplate,
  534. contractShopTable,
  535. help
  536. },
  537. name: "rentLeaseEdit",
  538. data() {
  539. return {
  540. //wkx
  541. showContractTable: false,//来自续签才展示合同列表表格
  542. merchantIdFromSearch: '',//根据搜索查到的商户id
  543. merchantList: [],
  544. curRentInfo: [],
  545. contractTable:'contractTable',
  546. loading: false,
  547. ...mapActions(["setRentInfo", "setNavData", "setFormData"]),
  548. billTk: "rentbill",
  549. billTk02: "rentbill02",
  550. billData: null,
  551. pickerAfterdata: {
  552. disabledDate(time) {
  553. return time.getTime() < Date.now() - 8.64e7; //限制只能选今天以后的日期
  554. }
  555. },
  556. priceUnitOption: ContractData.priceUnitOption,
  557. processData: [],
  558. rentshop: "rentshop",
  559. centerDialogVisible: false, //商户弹框
  560. isEditOk: true,//用于招商页面携带,不可编辑
  561. months: [],
  562. brands: [],
  563. active: 0,
  564. cycles: ContractData.cycles,
  565. isstepshow: true, //新建商户是否显示
  566. shopshow: true,
  567. isShow: true,
  568. businessIds: [], //经营业态列表
  569. newshopTableData: {},
  570. moneyform: {
  571. adjustRatioWay: "1", //年物业费调整方式1、比例上调2、按固定上调
  572. rentStartType: 1,
  573. rentContractId: "",
  574. id: "",
  575. priceUnit: 2, //物业费单价
  576. rentPrice: "", //物业费单价
  577. rentShopType: 1,
  578. signDate: "", //合同签约日
  579. rentalStartDate: "", //租赁开始日期
  580. lease: "",
  581. brand: "", //商铺经营品牌
  582. merchantName: "", //商户名称
  583. merchantId: "", //商户id
  584. contractNumber: "", //合同编号
  585. status: "", //合同状态
  586. linkPerson: "", //联系人
  587. linkPhone: "", //联系人电话
  588. rentArea: "", //计租面积
  589. shopType: "", //店铺类型
  590. zuqi: "", //计租日期
  591. price: "", //租金
  592. deposit: "", //押金
  593. receivePeriod: "", //付款周期
  594. payAccount: "", //支付账号
  595. shopId: "", //商铺id
  596. filepath: "", //文件路径
  597. filename: "", //文件名称
  598. merchantId: "", //商户id
  599. businessId: "", //经营业态
  600. adjustRatio: [], //上浮比例
  601. adjustPeriod: "2",
  602. id: "",
  603. latePayRatio:"",
  604. latePayDay:""
  605. },
  606. form: {
  607. adjustRatioWay: "1", //年物业费调整方式1、比例上调2、按固定上调
  608. operationType: 2,
  609. rentStartType: 1,
  610. fixDate: [],
  611. rentShopType: 1,
  612. signDate: "", //合同签约日
  613. startDate: "",
  614. rentalStartDate: "", //租赁开始日期
  615. rentalEndDate: "", //租賃截止日期
  616. totalPeriodMonth: 0, //总租期(月)
  617. totalPeriodDay: 0, //总租期(天)
  618. shopTableData: [],
  619. brand: "", //商铺经营品牌
  620. merchantName: "", //商铺名称
  621. subjectName: "", //合同主体名称
  622. contractNumber: "", //合同编号
  623. status: "", //合同状态
  624. linkPerson: "", //联系人
  625. linkPhone: "", //联系人电话
  626. rentArea: "", //计租面积
  627. shopType: "", //店铺类型
  628. zuqi: "", //计租日期
  629. price: "", //租金
  630. deposit: "", //押金
  631. receivePeriod: "", //付款周期
  632. payAccount: "", //支付账号
  633. shopId: "", //商铺id
  634. filename: "", //文件名
  635. merchantId: "", //商户id
  636. businessId: "", //经营业态
  637. id: "",
  638. lease: 0, //老数据总周期
  639. type: null, //计算方式
  640. revenue: "", //营业额
  641. payRatio: "", //支付比例
  642. adjustRatio: [], //上浮比例
  643. adjustPeriod: "2", //周期浮动比例
  644. accountType: "", //支付账号类型
  645. priceUnit: "", //租赁单价计算时间单位
  646. bankName: "", //开户行
  647. latePayRatio:"",
  648. latePayDay:""
  649. },
  650. curContractId: '',
  651. curContractIndex: '',
  652. curContractList: '',
  653. centerDialogVisible: false, //商户弹框
  654. brands: [],
  655. fileNames: [],
  656. //合同状态
  657. options: [
  658. {
  659. value: 0,
  660. label: "意向"
  661. },
  662. {
  663. value: 1,
  664. label: "待签约"
  665. }
  666. ],
  667. // 店铺类型
  668. shopTypes: ContractData.shopTypes,
  669. //计租计算方式
  670. computedTypes: ContractData.computedTypes,
  671. formvail: {
  672. adjustRatio: [
  673. {
  674. required: true,
  675. message: "抱歉,不能识别您输入的浮动比例",
  676. trigger: "blur"
  677. },
  678. {
  679. validator(rule, value, callback, source, options) {
  680. var errors = [];
  681. const reg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
  682. if (!reg.test(value)) {
  683. callback("抱歉,浮动比例限制为数字");
  684. } else if (value > 50) {
  685. callback("抱歉,浮动比例不能大于50%");
  686. }
  687. callback(errors);
  688. }
  689. }
  690. ],
  691. adjustRatio1:[
  692. {
  693. required: true,
  694. message: "抱歉,此项为必填项!",
  695. trigger: "blur"
  696. },
  697. {
  698. validator(rule, value, callback, source, options) {
  699. var errors = [];
  700. const reg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
  701. console.log(value)
  702. if (!reg.test(value)||Number(value)>=10000000) {
  703. callback("抱歉,金额限制为大于0且小于9999999.99的最多保留两位小数的数字!");
  704. }
  705. callback(errors);
  706. }
  707. }
  708. ]
  709. },
  710. rules: {
  711. latePayRatio: [
  712. {
  713. required: false,
  714. trigger: "blur"
  715. },
  716. {
  717. validator(rule, value, callback, source, options) {
  718. var errors = [];
  719. const reg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
  720. if (!reg.test(value)&&value!='') {
  721. callback("抱歉,滞纳金费率限制为大于0且最多保留两位小数的数字");
  722. } else {
  723. if (typeof value == "string") {
  724. if (Number(value)>100) {
  725. callback("滞纳金费率最大值为100%");
  726. }
  727. }
  728. }
  729. callback(errors);
  730. }
  731. }
  732. ],
  733. latePayDay: [
  734. {
  735. required: false,
  736. trigger: "blur"
  737. },
  738. {
  739. validator(rule, value, callback, source, options) {
  740. var errors = [];
  741. const reg = /^[0-9]+$/;
  742. if (!reg.test(value)&&value!='') {
  743. callback("抱歉,限制为0~1000的整数!");
  744. } else {
  745. if (typeof value == "string") {
  746. if (Number(value)>1000) {
  747. callback("抱歉,限制为0~1000的整数!");
  748. }
  749. }
  750. }
  751. callback(errors);
  752. }
  753. }
  754. ],
  755. adjustPeriod: [
  756. {
  757. required: true,
  758. trigger: "change",
  759. message: "抱歉,请选择账单生成方式"
  760. }
  761. ],
  762. rentalStartDate: [
  763. {
  764. required: true,
  765. trigger: "change",
  766. message: "抱歉,不能识别您选择的租赁开始日期"
  767. }
  768. ],
  769. rentalEndDate: [
  770. {
  771. required: true,
  772. trigger: "change",
  773. message: "抱歉,不能识别您选择的租赁结束日期"
  774. }
  775. ],
  776. startDate: [
  777. {
  778. required: true,
  779. trigger: "change",
  780. message: "抱歉,不能识别您选择的计租开始日期"
  781. }
  782. ],
  783. signDate: [
  784. {
  785. required: true,
  786. trigger: "change",
  787. message: "抱歉,不能识别您选择的合同签约日"
  788. }
  789. ],
  790. revenue: [
  791. {
  792. required: true,
  793. pattern: /.+/,
  794. message: "抱歉,不能识别您输入的营业额",
  795. trigger: "blur"
  796. },
  797. {
  798. validator(rule, value, callback, source, options) {
  799. var errors = [];
  800. // const reg = /^[0-9]\d*$/;
  801. const reg = /(^[0-9]\d*(\.\d{1,2})?$)|(^1(\.\d{1,2})?$)/;
  802. if (!reg.test(value)) {
  803. callback("抱歉,营业额限制为数字");
  804. } else {
  805. if (typeof value == "string") {
  806. if (value.split(".")[0].length > 7) {
  807. callback("最大金额为9999999.99");
  808. }
  809. }
  810. }
  811. callback(errors);
  812. }
  813. }
  814. ],
  815. status: [
  816. {
  817. required: true,
  818. trigger: "change",
  819. message: "抱歉,不能识别您选择的合同状态"
  820. }
  821. ],
  822. businessId: [
  823. {
  824. required: true,
  825. trigger: "change",
  826. message: "抱歉,不能识别您选择的经营业态"
  827. }
  828. ],
  829. contractNumber: [
  830. {
  831. required: true,
  832. trigger: "blur",
  833. message: "抱歉,不能识别您输入的合同编号"
  834. }
  835. ],
  836. merchantName: [
  837. {
  838. required: true,
  839. trigger: "blur",
  840. message: "抱歉,不能识别您输入的商铺名称"
  841. }
  842. ],
  843. zuqi: [
  844. {
  845. required: true,
  846. trigger: "blur",
  847. message: "抱歉,不能识别您输入的总租期"
  848. }
  849. ],
  850. // brand: [{
  851. // required: true,
  852. // trigger: "blur",
  853. // message: "抱歉,不能识别您输入的经营品牌"
  854. // }],
  855. // shopType: [
  856. // {
  857. // required: true,
  858. // trigger: "change",
  859. // message: "抱歉,不能识别您选择的店铺类型"
  860. // }
  861. // ],
  862. receivePeriod: [
  863. {
  864. required: true,
  865. trigger: "change",
  866. message: "抱歉,不能识别您输入的付款周期"
  867. },
  868. {
  869. validator(rule, value, callback, source, options) {
  870. var errors = [];
  871. if (value < 1) {
  872. callback("抱歉,付款周期不能小于1个月");
  873. }
  874. callback(errors);
  875. }
  876. }
  877. ],
  878. rentdata: [
  879. {
  880. required: true,
  881. trigger: "blur",
  882. message: "抱歉,不能识别您输入的交租日"
  883. }
  884. ],
  885. firstrentdata: [
  886. {
  887. required: true,
  888. trigger: "blur",
  889. message: "抱歉,不能识别您输入的首期款缴日期"
  890. }
  891. ],
  892. linkPhone: [
  893. {
  894. required: true,
  895. message: "抱歉,不能识别您输入的手机号哦!",
  896. trigger: "blur"
  897. },
  898. {
  899. validator(rule, value, callback, source, options) {
  900. var errors = [];
  901. var mobile = /^1[0|1|2|3|4|5|6|7|8|9]\d{9}$/,
  902. phone = /^0\d{2,3}-?\d{7,8}$/;
  903. if (value && !mobile.test(value) && !phone.test(value)) {
  904. callback("抱歉,请输入正确的手机号和座机号");
  905. }
  906. if (value && !mobile.test(value) && !phone.test(value)) {
  907. callback("抱歉,请输入正确的手机号和座机号");
  908. }
  909. callback(errors);
  910. }
  911. }
  912. ],
  913. // addr: [{
  914. // required: true,
  915. // message: '地址不能不能为空...',
  916. // trigger: 'blur'
  917. // }],
  918. linkPerson: [
  919. {
  920. required: true,
  921. message: "抱歉,不能识别您输入的联系人",
  922. trigger: "blur"
  923. },
  924. {
  925. validator(rule, value, callback, source, options) {
  926. var errors = [];
  927. if (value.length > 19) {
  928. callback("抱歉,商铺号限制为20字符以内");
  929. }
  930. callback(errors);
  931. }
  932. }
  933. ],
  934. buildArea: [
  935. {
  936. required: true,
  937. pattern: /.+/,
  938. message: "抱歉,不能识别您输入的建筑面积",
  939. trigger: "blur"
  940. },
  941. {
  942. validator(rule, value, callback, source, options) {
  943. var errors = [];
  944. const reg = /(^[1-9]\d*(\.\d{1,2})?$)|(^1(\.\d{1,2})?$)/;
  945. if (!reg.test(value)) {
  946. callback("抱歉,建筑面积限制为大于0的数字");
  947. }
  948. callback(errors);
  949. }
  950. }
  951. ],
  952. rentArea: [
  953. {
  954. required: true,
  955. pattern: /.+/,
  956. message: "抱歉,不能识别您输入的经营面积",
  957. trigger: "blur"
  958. }
  959. ]
  960. }
  961. };
  962. },
  963. computed: {
  964. ...mapState({
  965. rentInfo: state => state.setRentInfo.rentInfo,
  966. formData: state => state.setRentInfo.formData
  967. }),
  968. changeUnitType() {
  969. return this.priceUnitOption.filter(
  970. e => e.value == this.moneyform.priceUnit
  971. )[0].name;
  972. },
  973. getTotleArea() {
  974. let Str = 0;
  975. this.rentInfo.map((item, index) => {
  976. Str += Number(item.rentArea);
  977. });
  978. return Str.toFixed(2);
  979. },
  980. getAreaList() {
  981. let Str = "";
  982. this.rentInfo.map((item, index) => {
  983. Str =
  984. Str != ""
  985. ? Str + "," + item.shopNumber + "号铺:" + item.rentArea + "㎡"
  986. : item.shopNumber + "号铺:" + item.rentArea + "㎡";
  987. });
  988. return Str;
  989. },
  990. pickerOptions0: function() {
  991. return {
  992. disabledDate: time => {
  993. let endDate = moment(this.form.rentalEndDate);
  994. if (endDate) {
  995. return moment(time) > endDate;
  996. }
  997. }
  998. };
  999. },
  1000. pickerOptions1: function() {
  1001. return {
  1002. disabledDate: time => {
  1003. let beginDateVal = moment(this.form.rentalStartDate);
  1004. if (beginDateVal) {
  1005. return moment(time) < beginDateVal;
  1006. }
  1007. }
  1008. };
  1009. }
  1010. },
  1011. watch: {},
  1012. methods: {
  1013. /**
  1014. * 修改租赁面积及单价改变租金
  1015. */
  1016. changeArea(type, val) {
  1017. this.moneyform[type] = val;
  1018. let Str = 0;
  1019. this.rentInfo.map((item, index) => {
  1020. Str += Number(item.rentArea);
  1021. });
  1022. this.moneyform.price = (
  1023. (Number(this.moneyform["rentPrice"] * 100) * Number(Str * 100)) /
  1024. 10000
  1025. ).toFixed(2);
  1026. },
  1027. propertyMoneycancel() {
  1028. this.active--;
  1029. },
  1030. changeFormData(type, val) {
  1031. this.moneyform[type] = val;
  1032. },
  1033. //
  1034. setAdjustPeriod(e) {
  1035. this.formData.adjustPeriod = e;
  1036. // this.formData.adjustRatio = [];
  1037. this.setFormData(this.formData);
  1038. },
  1039. //修改租赁开始时间及租赁结束日期
  1040. changeDates(e, type) {
  1041. this.form[type] = moment(e).format("YYYY-MM-DD");
  1042. this.getDateDiff(this.form.rentalStartDate, this.form.rentalEndDate);
  1043. },
  1044. getDateDiff(rentalStartDate, rentalEndDate) {
  1045. if (rentalStartDate && rentalEndDate) {
  1046. this.getFetch(
  1047. `${ContractUrl.getDateDiff}?startDate=${moment(
  1048. this.form.rentalStartDate
  1049. ).format("YYYY-MM-DD")}&endDate=${moment(this.form.rentalEndDate)
  1050. .add(1, "days")
  1051. .format("YYYY-MM-DD")}`
  1052. ).then(res => {
  1053. this.form.totalPeriodMonth = res.data.month;
  1054. this.form.totalPeriodDay = res.data.day;
  1055. this.form.lease =
  1056. Number(res.data.month) + (Number(res.data.day) > 0 ? 1 : 0);
  1057. this.lease();
  1058. });
  1059. }
  1060. },
  1061. //保存第一步
  1062. saveFirst(param) {
  1063. console.log(this.rentInfo)
  1064. if (this.$route.query.from!=undefined) {
  1065. this.form.shopId = this.rentInfo[0].shopId;
  1066. param.shopId = this.rentInfo[0].shopId;
  1067. }
  1068. this.loading = true;
  1069. let url = this.form.id
  1070. ? "/api/wxRentContract/update"
  1071. : "/api/wxRentContract/add";
  1072. if (this.showContractTable) {
  1073. // url = '/api/wxRentContractExtension/extension';
  1074. url = "/api/wxRentContract/add";
  1075. param.fromId = this.curContractId;
  1076. param.operationType = 2;
  1077. }
  1078. //wkx
  1079. /* if (this.showContractTable) {
  1080. url = '/api/wxRentContractExtension/extension';
  1081. param.status = 9;
  1082. } */
  1083. this.postFetch(url, param)
  1084. .then(d => {
  1085. this.loading = false;
  1086. if (this.form.id == "" && this.active == 0) {
  1087. this.form.id = d.data.id;
  1088. }
  1089. this.$refs[this.billTk].setData(d.data.previewBillRentList,this.formData.receivePeriod);
  1090. if (this.active++ > 4) this.active = 0;
  1091. this.$message.success("提交成功");
  1092. this.form.id = d.data.id;
  1093. //
  1094. if (d.data.busDiscountRatio == undefined || d.data.busDiscountTime == undefined) {
  1095. d.data.busDiscountRatio = '';
  1096. d.data.busDiscountTime = 1;
  1097. }
  1098. let myObj = Object.assign({},this.formData);
  1099. myObj.busDiscountRatio = d.data.busDiscountRatio;
  1100. myObj.busDiscountTime = d.data.busDiscountTime;
  1101. this.setFormData(myObj);
  1102. })
  1103. .catch(err => {
  1104. this.$message.error(err.data);
  1105. this.loading = false;
  1106. });
  1107. },
  1108. checkcontractNum(param) {
  1109. this.$confirm("抱歉,此合同编号已存在, 是否继续?", "提示", {
  1110. confirmButtonText: "确定",
  1111. cancelButtonText: "取消",
  1112. type: "warning"
  1113. })
  1114. .then(() => {
  1115. this.saveFirst(param);
  1116. })
  1117. .catch(() => {
  1118. this.$message({
  1119. type: "info",
  1120. message: "已取消"
  1121. });
  1122. });
  1123. },
  1124. //合同基本信息提交
  1125. submit(formName) {
  1126. if (this.$route.query.from!=undefined) {
  1127. this.form.shopId = this.rentInfo[0].shopId;
  1128. }
  1129. let param = deepcopy(this.form);
  1130. param = Object.assign(param, this.formData);
  1131. this.$refs[formName].validate(valid => {
  1132. if (valid) {
  1133. if (this.form.startDate && this.form.rentalStartDate) {
  1134. //计租开始日期
  1135. let startDate = moment(this.form.startDate).format("YYYY-MM-DD");
  1136. //租赁开始日期
  1137. let rentalStartDate = moment(this.form.rentalStartDate).format(
  1138. "YYYY-MM-DD"
  1139. );
  1140. if (moment(startDate).isBefore(rentalStartDate)) {
  1141. this.$message.error("计租开始日期不能早于租赁开始日期");
  1142. return;
  1143. }
  1144. }
  1145. if(moment(this.form.startDate).valueOf()>moment(this.form.rentalEndDate).valueOf()){
  1146. this.$message.error("计租开始日期不能大于租赁结束日期");
  1147. return;
  1148. }
  1149. if (this.form.lease > 600) {
  1150. this.$message.error("抱歉,总租期最大限制为600个月");
  1151. return;
  1152. }
  1153. param.fileNames = JSON.stringify(this.fileNames);
  1154. if (this.formData.rentInputWay == 1) {
  1155. param.depositStr = this.formData.deposit;
  1156. param.priceStr = this.formData.price;
  1157. } else {
  1158. param.depositStr = 0;
  1159. param.priceStr = 0;
  1160. this.rentInfo.map((item, index) => {
  1161. param.depositStr += Number(item.deposit);
  1162. param.priceStr += Number(item.price);
  1163. });
  1164. }
  1165. param.price = Number(Number(param.price * 100).toFixed(2));
  1166. param.deposit = Number(Number(param.deposit * 100).toFixed(2));
  1167. param.rentArea = this.getTotleRentArea();
  1168. param.revenue = Number(
  1169. Number(this.formData.revenue * 100).toFixed(2)
  1170. );
  1171. param.payRatio = Number(
  1172. Number(this.formData.payRatio * 100).toFixed(2)
  1173. );
  1174. param.type = this.formData.type ? this.formData.type : 1;
  1175. param.rentalStartDate =
  1176. commonUtil.date.date(this.form.rentalStartDate) + " 00:00:00";
  1177. param.rentalEndDate =
  1178. commonUtil.date.date(this.form.rentalEndDate) + " 23:59:59";
  1179. param.startDate =
  1180. commonUtil.date.date(this.form.startDate) + " 00:00:00";
  1181. param.signDate =
  1182. commonUtil.date.date(this.form.signDate) + " 00:00:00";
  1183. let adjustRatios01 = this.formData.adjustRatio.filter(
  1184. (item, index) =>
  1185. (param.totalPeriodMonth + (param.totalPeriodDay > 0 ? 1 : 0)) /
  1186. 12 -
  1187. 1 >
  1188. index
  1189. );
  1190. let adjustRatios02 = adjustRatios01.map(item =>
  1191. Number(Number(item * 100).toFixed(2))
  1192. );
  1193. param.adjustRatio = JSON.stringify(adjustRatios02);
  1194. let errorIf = false;
  1195. //账单生成方式未自然月时付款周期处理
  1196. this.formData.receivePeriod =
  1197. this.form.adjustPeriod == 3
  1198. ? this.cycles.filter(e => e.value == this.formData.receivePeriod)
  1199. .length > 0
  1200. ? this.formData.receivePeriod
  1201. : 1
  1202. : this.formData.receivePeriod;
  1203. this.setFormData(this.formData);
  1204. param.receivePeriod = this.formData.receivePeriod;
  1205. const reg = /(^[0-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
  1206. this.rentInfo.map((item, index) => {
  1207. if (!reg.test(item.rentArea)) {
  1208. errorIf = true;
  1209. }
  1210. });
  1211. /* if (errorIf) {
  1212. this.$message.error("抱歉,计租面积限制为最多保留两位小数的正数!");
  1213. return;
  1214. } */
  1215. param.rentInfo = JSON.stringify(this.rentInfo);
  1216. if (this.form.fixDate && this.form.fixDate[0] != undefined) {
  1217. param.fixStartDate =
  1218. moment(this.form.fixDate[0]).format("YYYY-MM-DD") + " 00:00:00";
  1219. param.fixEndDate =
  1220. moment(this.form.fixDate[1]).format("YYYY-MM-DD") + " 23:59:59";
  1221. } else {
  1222. param.fixStartDate = "";
  1223. param.fixEndDate = "";
  1224. }
  1225. param.previewBillRentList = [];
  1226. this.getFetch(
  1227. `/api/wxRentContract/hasContractNumber?contractNumber=${
  1228. this.form.contractNumber
  1229. }&id=${this.form.id}`
  1230. )
  1231. .then(d => {
  1232. //如果合同编号重复
  1233. if (d.data) {
  1234. this.checkcontractNum(param);
  1235. } else {
  1236. this.saveFirst(param);
  1237. }
  1238. })
  1239. .catch(err => {
  1240. this.$message.error(err.data);
  1241. });
  1242. } else {
  1243. return false;
  1244. }
  1245. });
  1246. },
  1247. cancel() {
  1248. this.$router.back(-1);
  1249. },
  1250. moneycancel() {
  1251. if (this.$refs["contractMoney"].checkFormRule(1)) {
  1252. return;
  1253. }
  1254. if (this.active-- > 4) this.active = 0;
  1255. },
  1256. filecancel() {
  1257. if (this.active-- > 4) this.active = 0;
  1258. },
  1259. getTotleRentArea() {
  1260. this.rentArea = 0;
  1261. this.rentInfo.map((item, index) => {
  1262. this.rentArea += Number(item.rentArea);
  1263. });
  1264. this.rentArea = this.rentArea ? this.rentArea.toFixed("2") : "0";
  1265. this.form.rentArea = this.rentArea;
  1266. return this.rentArea;
  1267. },
  1268. submitMoney(type) {
  1269. let param = {
  1270. id: type == 1 ? this.form.id : this.moneyform.id,
  1271. rentStartType:
  1272. type == 1 ? this.form.rentStartType : this.moneyform.rentStartType,
  1273. rentalStartDate:
  1274. moment(this.form.rentalStartDate).format("YYYY-MM-DD") + " 00:00:00"
  1275. };
  1276. let _this = this;
  1277. _this
  1278. .postFetch(type == 1? "/api/wxRentContract/updateRentStartTime": "/api/wxPropertyContract/updateRentStartTime",param)
  1279. .then(d => {
  1280. _this.$message.success("预账单生成成功!");
  1281. _this.$refs[type == 1 ? _this.billTk : _this.billTk02].setData(
  1282. d.data.previewBillRentList,type == 1?this.formData.receivePeriod:this.moneyform.receivePeriod
  1283. );
  1284. })
  1285. .catch(err => {
  1286. if (type == 1) {
  1287. _this.form.rentStartType = _this.form.rentStartType == 1 ? 2 : 1;
  1288. } else {
  1289. _this.moneyform.rentStartType =
  1290. _this.moneyform.rentStartType == 1 ? 2 : 1;
  1291. }
  1292. _this.$message.error(err.data);
  1293. });
  1294. },
  1295. moneysubmit(formName, type) {
  1296. let param = deepcopy(this.form);
  1297. param.fileNames = JSON.stringify(this.fileNames);
  1298. console.log(this.formData,55555555555)
  1299. param = Object.assign(param, this.formData);
  1300. this.$refs[formName].validate(valid => {
  1301. if (valid) {
  1302. if (this.formData.rentInputWay == 1) {
  1303. param.depositStr = this.formData.deposit;
  1304. param.priceStr = this.formData.price;
  1305. } else {
  1306. param.depositStr = 0;
  1307. param.priceStr = 0;
  1308. this.rentInfo.map((item, index) => {
  1309. param.depositStr += Number(item.deposit);
  1310. param.priceStr += Number(item.price);
  1311. });
  1312. }
  1313. param.price = Number(Number(param.price * 100).toFixed(2));
  1314. param.deposit = Number(Number(param.deposit * 100).toFixed(2));
  1315. param.revenue = Number(
  1316. Number(this.formData.revenue * 100).toFixed(2)
  1317. );
  1318. param.payRatio = Number(
  1319. Number(this.formData.payRatio * 100).toFixed(2)
  1320. );
  1321. param.type = this.formData.type || 1;
  1322. param.rentArea = this.getTotleRentArea();
  1323. param.rentalStartDate =
  1324. commonUtil.date.date(this.form.rentalStartDate) + " 00:00:00";
  1325. param.rentalEndDate =
  1326. commonUtil.date.date(this.form.rentalEndDate) + " 23:59:59";
  1327. param.startDate =
  1328. commonUtil.date.date(this.form.startDate) + " 00:00:00";
  1329. param.signDate =
  1330. commonUtil.date.date(this.form.signDate) + " 00:00:00";
  1331. console.log(this.formData.adjustRatio)
  1332. let adjustRatios01 = this.formData.adjustRatio.filter(
  1333. (item, index) =>
  1334. (param.totalPeriodMonth + (param.totalPeriodDay > 0 ? 1 : 0)) /
  1335. 12 -
  1336. 1 >
  1337. index
  1338. );
  1339. let adjustRatios02 = adjustRatios01.map(item =>
  1340. Number(Number(item * 100).toFixed(2))
  1341. );
  1342. param.adjustRatio = JSON.stringify(adjustRatios02);
  1343. // this.$refs['contractMoney'].checkFormRule()
  1344. if (this.$refs["contractMoney"].checkFormRule()) {
  1345. return;
  1346. }
  1347. param.rentInfo = JSON.stringify(this.rentInfo);
  1348. param.previewBillRentList = [];
  1349. this.loading = true;
  1350. if (this.$route.query.Renew) {
  1351. param.status = 9;
  1352. }
  1353. this.postFetch("/api/wxRentContract/updateMoney", param)
  1354. .then(d => {
  1355. this.loading = false;
  1356. if (!type) {
  1357. if (this.active++ > 4) this.active = 0;
  1358. this.$message.success("提交成功");
  1359. } else {
  1360. this.$message.success("预账单生成成功!");
  1361. }
  1362. this.$refs[this.billTk].setData(d.data.previewBillRentList,this.formData.receivePeriod);
  1363. })
  1364. .catch(err => {
  1365. this.$message.error(err.data);
  1366. this.loading = false;
  1367. });
  1368. } else {
  1369. return false;
  1370. }
  1371. });
  1372. },
  1373. moneysubmit02(formName) {
  1374. let _this = this;
  1375. this.$refs[formName].validate(valid => {
  1376. if (valid) {
  1377. this.form.rentalStartDate =
  1378. commonUtil.date.date(this.form.rentalStartDate) + " 00:00:00";
  1379. this.form.rentalEndDate =
  1380. commonUtil.date.date(this.form.rentalEndDate) + " 23:59:59";
  1381. this.form.startDate =
  1382. commonUtil.date.date(this.form.startDate) + " 00:00:00";
  1383. this.form.signDate =
  1384. commonUtil.date.date(this.form.signDate) + " 00:00:00";
  1385. let postData = deepcopy(this.form);
  1386. postData.operationType = 2;
  1387. postData.businessId = this.form.businessId;
  1388. postData.rentContractId = this.form.id;
  1389. postData.id = this.moneyform.id;
  1390. postData.shopType = this.form.shopType;
  1391. postData.price = this.moneyform.price;
  1392. postData.deposit = this.moneyform.deposit;
  1393. postData.receivePeriod = this.moneyform.receivePeriod;
  1394. postData.payAccount = this.moneyform.payAccount;
  1395. postData.brand = this.moneyform.brand;
  1396. postData.adjustPeriod = this.moneyform.adjustPeriod;
  1397. postData.priceUnit = this.moneyform.priceUnit;
  1398. postData.rentPrice = Number(
  1399. Number(this.moneyform.rentPrice * 100).toFixed(2)
  1400. );
  1401. postData.rentStartType = this.moneyform.rentStartType;
  1402. postData.adjustRatio = this.moneyform.adjustRatio;
  1403. postData.latePayRatio = this.moneyform.latePayRatio;
  1404. postData.latePayDay = this.moneyform.latePayDay;
  1405. let param = postData;
  1406. param.deposit = Number(Number(postData.deposit * 100).toFixed(2));
  1407. param.price = Number(Number(postData.price * 100).toFixed(2));
  1408. param.fileNames = JSON.stringify(this.fileNames);
  1409. param.rentInfo = JSON.stringify(this.rentInfo);
  1410. let adjustRatios01 = postData.adjustRatio.filter(
  1411. (item, index) => postData.lease / 12 - 1 > index
  1412. );
  1413. let adjustRatios02 = adjustRatios01.map(item =>
  1414. Number(Number(item * 100).toFixed(2))
  1415. );
  1416. param.adjustRatio = JSON.stringify(adjustRatios02);
  1417. this.loading = true;
  1418. param.status = 0;
  1419. param.adjustRatioWay = this.moneyform.adjustRatioWay;
  1420. if (this.$route.query.Renew) {
  1421. param.status = 9;
  1422. }
  1423. this.postFetch(`/api/wxPropertyContract/add`, param)
  1424. .then(d => {
  1425. this.loading = false;
  1426. this.$message.success("预账单成功");
  1427. this.moneyform.id = d.data.id;
  1428. if (this.active++ > 4) this.active = 0;
  1429. this.$refs[this.billTk02].setData(d.data.previewBillRentList,this.moneyform.receivePeriod);
  1430. })
  1431. .catch(err => {
  1432. this.$message.error(err.data);
  1433. this.loading = false;
  1434. });
  1435. }
  1436. });
  1437. },
  1438. filesubmit(formName) {
  1439. let _this = this;
  1440. let param = deepcopy(this.form);
  1441. param = Object.assign(param, this.formData);
  1442. this.$refs[formName].validate(valid => {
  1443. if (valid) {
  1444. if (this.formData.rentInputWay == 1) {
  1445. param.depositStr = this.formData.deposit;
  1446. param.priceStr = this.formData.price;
  1447. } else {
  1448. param.depositStr = 0;
  1449. param.priceStr = 0;
  1450. this.rentInfo.map((item, index) => {
  1451. param.depositStr += Number(item.deposit);
  1452. param.priceStr += Number(item.price);
  1453. });
  1454. }
  1455. param.price = Number(Number(param.price * 100).toFixed(2));
  1456. param.deposit = Number(Number(param.deposit * 100).toFixed(2));
  1457. param.rentArea = this.getTotleRentArea();
  1458. param.revenue = Number(
  1459. Number(this.formData.revenue * 100).toFixed(2)
  1460. );
  1461. param.payRatio = Number(
  1462. Number(this.formData.payRatio * 100).toFixed(2)
  1463. );
  1464. param.rentalStartDate =
  1465. commonUtil.date.date(this.form.rentalStartDate) + " 00:00:00";
  1466. param.rentalEndDate =
  1467. commonUtil.date.date(this.form.rentalEndDate) + " 23:59:59";
  1468. param.type = this.formData.type;
  1469. param.fileNames = JSON.stringify(this.fileNames);
  1470. let adjustRatios01 = this.formData.adjustRatio.filter(
  1471. (item, index) =>
  1472. (param.totalPeriodMonth + (param.totalPeriodDay > 0 ? 1 : 0)) /
  1473. 12 -
  1474. 1 >
  1475. index
  1476. );
  1477. param.signDate =
  1478. commonUtil.date.date(this.form.signDate) + " 00:00:00";
  1479. let adjustRatios02 = adjustRatios01.map(item =>
  1480. Number(Number(item * 100).toFixed(2))
  1481. );
  1482. param.adjustRatio = JSON.stringify(adjustRatios02);
  1483. param.rentInfo = JSON.stringify(this.rentInfo);
  1484. let previewBillRentList = [];
  1485. if (
  1486. this.$refs[this.billTk].getData() != false &&
  1487. this.$refs[this.billTk].getData().length > 0
  1488. ) {
  1489. let haveCommentsError = false;
  1490. let message = "";
  1491. this.$refs[this.billTk].getData().map((item, index) => {
  1492. let a = {};
  1493. a.id = item.id;
  1494. a.receivePay = item.receivePay;
  1495. a.needPay = item.needPay;
  1496. a.receiveDate = item.receiveDate;
  1497. a.starttime = moment(item.starttime).format('YYYY-MM-DD')+' 00:00:00';
  1498. a.endtime = moment(item.endtime).format('YYYY-MM-DD')+' 23:59:59';
  1499. a.comments = item.comments;
  1500. previewBillRentList.push(a);
  1501. if (
  1502. item.receivePay != item.needPay &&
  1503. !item.comments
  1504. ) {
  1505. haveCommentsError = true;
  1506. message = "建议账单金额调整后,补充金额调整原因!";
  1507. }
  1508. });
  1509. param.previewBillRentList = previewBillRentList;
  1510. if (haveCommentsError) {
  1511. this.$confirm(message, "有金额变更原因未填写", {
  1512. confirmButtonText: "去补充",
  1513. cancelButtonText: "继续提交",
  1514. type: "warning"
  1515. })
  1516. .then(() => {
  1517. return false;
  1518. })
  1519. .catch(() => {
  1520. _this.continueSubmit(param);
  1521. });
  1522. } else {
  1523. _this.continueSubmit(param);
  1524. }
  1525. }
  1526. }
  1527. });
  1528. },
  1529. continueSubmit(param) {
  1530. /**
  1531. * businessType操作类型:
  1532. * 1合同审批,
  1533. * 2账单审批,
  1534. * 3终止合同审批,
  1535. * 4商铺合同签约,
  1536. * 5多径点位合同签约,
  1537. * 6商铺合同终止,
  1538. * 7多经点位合同终止,
  1539. * 8账单应收金额变更,
  1540. * 9有价券上架
  1541. * 其中1,2,3是为了兼容老数据
  1542. */
  1543. if (this.form.status == 1) {
  1544. param.status = 1;
  1545. } else {
  1546. param.status = 0;
  1547. }
  1548. this.loading = true;
  1549. if (this.$route.query.Renew) {
  1550. param.status = 9;
  1551. }
  1552. this.postFetch("/api/wxRentContract/updateFile", param)
  1553. .then(d => {
  1554. this.loading = false;
  1555. this.$message.success("提交成功");
  1556. this.active++;
  1557. })
  1558. .catch(err => {
  1559. this.$message.error(err.data);
  1560. this.loading = false;
  1561. });
  1562. },
  1563. filesubmit02(formName) {
  1564. let _this = this;
  1565. this.$refs[formName].validate(valid => {
  1566. if (valid) {
  1567. this.form.rentalStartDate =
  1568. commonUtil.date.date(this.form.rentalStartDate) + " 00:00:00";
  1569. this.form.rentalEndDate =
  1570. commonUtil.date.date(this.form.rentalEndDate) + " 23:59:59";
  1571. this.form.startDate =
  1572. commonUtil.date.date(this.form.startDate) + " 00:00:00";
  1573. this.form.startDate =
  1574. commonUtil.date.date(this.form.startDate) + " 00:00:00";
  1575. this.form.signDate =
  1576. commonUtil.date.date(this.form.signDate) + " 00:00:00";
  1577. let postData = deepcopy(this.form);
  1578. postData.shopType = this.moneyform.shopType;
  1579. postData.businessId = this.moneyform.businessId;
  1580. postData.rentContractId = this.form.id;
  1581. postData.id = this.moneyform.id;
  1582. postData.price = this.moneyform.price;
  1583. postData.deposit = this.moneyform.deposit;
  1584. postData.receivePeriod = this.moneyform.receivePeriod;
  1585. postData.payAccount = this.moneyform.payAccount;
  1586. postData.brand = this.moneyform.brand;
  1587. postData.rentStartType = this.moneyform.rentStartType;
  1588. postData.priceUnit = this.moneyform.priceUnit;
  1589. postData.latePayRatio = this.moneyform.latePayRatio;
  1590. postData.latePayDay = this.moneyform.latePayDay;
  1591. postData.rentPrice = Number(
  1592. Number(this.moneyform.rentPrice * 100).toFixed(2)
  1593. );
  1594. let param = postData;
  1595. param.deposit = Number(Number(postData.deposit * 100).toFixed(2));
  1596. param.price = Number(Number(postData.price * 100).toFixed(2));
  1597. param.fileNames = JSON.stringify(this.fileNames);
  1598. param.rentInfo = JSON.stringify(this.rentInfo);
  1599. param.adjustRatioWay = this.moneyform.adjustRatioWay;
  1600. if (this.processData.length > 0 && this.form.status == 1) {
  1601. param.flowParams = {
  1602. variables: [
  1603. {
  1604. key: "contractType",
  1605. value: "5"
  1606. },
  1607. {
  1608. key: "contractNumber",
  1609. value: this.form.contractNumber
  1610. }
  1611. ],
  1612. businessType: 17,
  1613. remark: this.form.remark
  1614. };
  1615. }
  1616. let adjustRatios01 = this.moneyform.adjustRatio.filter(
  1617. (item, index) => postData.lease / 12 - 1 > index
  1618. );
  1619. let adjustRatios02 = adjustRatios01.map(item =>
  1620. Number(Number(item * 100).toFixed(2))
  1621. );
  1622. param.adjustRatio = JSON.stringify(adjustRatios02);
  1623. let previewBillRentList = [];
  1624. if (
  1625. this.$refs[this.billTk02].getData() != false &&
  1626. this.$refs[this.billTk02].getData().length > 0
  1627. ) {
  1628. let haveCommentsError = false;
  1629. let message = "";
  1630. this.$refs[this.billTk02].getData().map((item, index) => {
  1631. let a = {};
  1632. a.id = item.id;
  1633. a.receivePay = item.receivePay;
  1634. a.needPay = item.needPay;
  1635. a.receiveDate = item.receiveDate;
  1636. a.starttime = moment(item.starttime).format('YYYY-MM-DD')+' 00:00:00';
  1637. a.endtime = moment(item.endtime).format('YYYY-MM-DD')+' 23:59:59';
  1638. a.comments = item.comments;
  1639. previewBillRentList.push(a);
  1640. if (
  1641. item.receivePay != item.needPay &&
  1642. !item.comments
  1643. ) {
  1644. haveCommentsError = true;
  1645. message = "建议账单金额调整后,补充金额调整原因!";
  1646. }
  1647. });
  1648. param.previewBillRentList = previewBillRentList;
  1649. if (haveCommentsError) {
  1650. this.$confirm(message, "有金额变更原因未填写", {
  1651. confirmButtonText: "去补充",
  1652. cancelButtonText: "继续提交",
  1653. type: "warning"
  1654. })
  1655. .then(() => {
  1656. return false;
  1657. })
  1658. .catch(() => {
  1659. if (this.form.status == 1 && _this.processData.length == 0) {
  1660. _this.makeSure(param);
  1661. } else {
  1662. _this.continueSubmit02(param);
  1663. }
  1664. });
  1665. } else {
  1666. if (this.form.status == 1 && _this.processData.length == 0) {
  1667. _this.makeSure(param);
  1668. } else {
  1669. _this.continueSubmit02(param);
  1670. }
  1671. }
  1672. } else {
  1673. return;
  1674. }
  1675. } else {
  1676. return false;
  1677. }
  1678. });
  1679. },
  1680. makeSure(param) {
  1681. this.$confirm("为确保合同有效生成,请联系管理员添加审批流程!", "提示", {
  1682. confirmButtonText: "坚持提交",
  1683. cancelButtonText: "取消",
  1684. type: "warning"
  1685. })
  1686. .then(() => {
  1687. this.continueSubmit02(param);
  1688. })
  1689. .catch(() => {
  1690. this.loading = false;
  1691. this.$message({
  1692. type: "info",
  1693. message: "已取消"
  1694. });
  1695. });
  1696. },
  1697. continueSubmit02(param) {
  1698. this.loading = true;
  1699. let url = "/api/wxPropertyContract/update";
  1700. if (this.$route.query.Renew) {
  1701. param.status = 9;
  1702. }
  1703. this.postFetch(url, param)
  1704. .then(d => {
  1705. this.$message.success("提交成功");
  1706. this.$router.back(-1);
  1707. this.loading = false;
  1708. })
  1709. .catch(err => {
  1710. this.$message.error(err.data);
  1711. this.loading = false;
  1712. });
  1713. },
  1714. //文件上传
  1715. beforeUpload: function(file) {
  1716. let type = file.name.split(".")[1];
  1717. const extension =
  1718. type === "doc" ||
  1719. type === "docx" ||
  1720. type === "pdf" ||
  1721. type === "png" ||
  1722. type === "jpg" ||
  1723. type === "jpeg";
  1724. const isLt2M = file.size / 1024 / 1024 < 20;
  1725. if (!extension) {
  1726. this.$message.warning(
  1727. "抱歉,上传文件只能是doc、docx、pdf、png、jpg、jpeg格式"
  1728. );
  1729. }
  1730. if (!isLt2M) {
  1731. this.$message.warning("抱歉,上传文件大小不能超过 20MB");
  1732. }
  1733. return extension && isLt2M;
  1734. },
  1735. importSuccess: function(response, file, fileList) {
  1736. this.$message.success("上传成功");
  1737. let a = {
  1738. name: file.name,
  1739. url: response.data.url
  1740. };
  1741. this.fileNames.push(a);
  1742. },
  1743. importError: function(response, file, fileList) {
  1744. this.$message.error("抱歉,上传失败");
  1745. console.log("error:" + response + "--" + file + "---" + fileList);
  1746. },
  1747. downloadPr(file) {
  1748. window.open(file.url);
  1749. },
  1750. handleRemove: function(file, filelist) {
  1751. this.fileNames.map((item, index) => {
  1752. if (item.url == file.url) {
  1753. this.fileNames.splice(index, 1);
  1754. }
  1755. });
  1756. },
  1757. //商户跳转取消
  1758. cancleMerchant() {
  1759. this.$router.push({
  1760. path: "/rentlist"
  1761. });
  1762. },
  1763. //商户跳转确定
  1764. sureMerchant() {
  1765. this.$router.push({
  1766. path: "/merchant/merchantAdd",
  1767. query: {
  1768. arr: JSON.stringify(this.form)
  1769. }
  1770. });
  1771. },
  1772. lease() {
  1773. this.months = [];
  1774. if (
  1775. this.form.totalPeriodMonth + (this.form.totalPeriodDay > 0 ? 1 : 0) >
  1776. 12
  1777. ) {
  1778. let j =
  1779. (this.form.totalPeriodMonth +
  1780. (this.form.totalPeriodDay > 0 ? 1 : 0)) /
  1781. 12;
  1782. if (j % 1 === 0) {
  1783. //判断是不是整数
  1784. j = j - 1;
  1785. } else {
  1786. j = Math.floor(j);
  1787. }
  1788. for (var i = 0; i < j; i++) {
  1789. this.months.push(i);
  1790. }
  1791. let rentInfo = JSON.parse(JSON.stringify(this.rentInfo));
  1792. rentInfo.map((item, index) => {
  1793. item.adjustRatio.length = this.months.length;
  1794. for (var q = 0; q < item.adjustRatio.length; q++) {
  1795. if (item.adjustRatio[q] == undefined) {
  1796. item.adjustRatio[q] = 0;
  1797. }
  1798. }
  1799. });
  1800. this.formData.adjustRatio = this.formData.adjustRatio
  1801. ? this.formData.adjustRatio
  1802. : [];
  1803. this.formData.adjustRatio.length = this.months.length;
  1804. for (var q = 0; q < this.formData.adjustRatio.length; q++) {
  1805. if (this.formData.adjustRatio[q] == undefined) {
  1806. this.formData.adjustRatio[q] = 0;
  1807. }
  1808. }
  1809. //年物业费调整设默认值0
  1810. this.moneyform.adjustRatio.length = this.months.length;
  1811. for (var q = 0; q < this.moneyform.adjustRatio.length; q++) {
  1812. if (this.moneyform.adjustRatio[q] == undefined) {
  1813. this.moneyform.adjustRatio[q] = 0;
  1814. }
  1815. }
  1816. let formData = JSON.parse(JSON.stringify(this.formData));
  1817. formData.months = this.months;
  1818. this.setFormData(formData);
  1819. this.setRentInfo(rentInfo);
  1820. } else {
  1821. let rentInfo = JSON.parse(JSON.stringify(this.rentInfo));
  1822. rentInfo.map((item, index) => {
  1823. item.adjustRatio = [];
  1824. });
  1825. let formData = JSON.parse(JSON.stringify(this.formData));
  1826. formData.months = this.months;
  1827. this.setFormData(formData);
  1828. this.setRentInfo(rentInfo);
  1829. this.months = [];
  1830. }
  1831. },
  1832. comperData() {
  1833. if (this.form.startDate && this.form.rentalStartDate) {
  1834. let startDate = this.form.startDate;
  1835. let rentalStartDate = this.form.rentalStartDate;
  1836. //计租开始问题
  1837. startDate = moment(startDate).format("YYYY-MM-DD");
  1838. //租赁开始日期
  1839. rentalStartDate = moment(rentalStartDate).format("YYYY-MM-DD");
  1840. if (moment(startDate).isBefore(rentalStartDate)) {
  1841. this.$message.error("计租开始日期不能早于租赁开始日期");
  1842. return;
  1843. } else {
  1844. this.form.startDate = moment(this.form.startDate).valueOf();
  1845. this.form.rentalStartDate = moment(
  1846. this.form.rentalStartDate
  1847. ).valueOf();
  1848. }
  1849. }
  1850. },
  1851. //初始化物业费调整比例
  1852. getadjustRatioInit(lease, adjustRatio) {
  1853. let datalength = Math.ceil(lease / 12) - 1;
  1854. this.moneyform.adjustRatio = adjustRatio ? adjustRatio : [];
  1855. this.months = [];
  1856. for (let i = 0; i < datalength; i++) {
  1857. if (!adjustRatio) {
  1858. this.moneyform.adjustRatio.push(0);
  1859. }
  1860. this.months.push(i);
  1861. }
  1862. },
  1863. /* getTenementContract(id) {
  1864. this.getFetch("/api/wxPropertyContract/getMerchantList?shopType=1")
  1865. .then(d => {
  1866. d.data.map(item => {
  1867. if (item.merchantId == id) {
  1868. console.log(item)
  1869. }
  1870. })
  1871. })
  1872. .catch(err => {
  1873. this.$message.error(err.data);
  1874. });
  1875. }, */
  1876. changeContract(index) {
  1877. console.log(index);
  1878. let d = {};
  1879. d.data = {};
  1880. d.data.rent = this.curContractList[index];
  1881. d.data.rent.wxRentContract.adjustRatio = JSON.parse(d.data.rent.wxRentContract.adjustRatio);
  1882. this.form = Object.assign(this.form, d.data.rent.wxRentContract);
  1883. if (this.showContractTable) {
  1884. //租赁开始日期和计租开始日期:上次合同结束日期+1
  1885. this.form.rentalStartDate = this.form.rentalEndDate+24*3600*1000;
  1886. this.form.rentalEndDate = '';
  1887. this.form.startDate = this.form.rentalStartDate;
  1888. this.form.signDate = '';
  1889. this.curRentInfo = JSON.parse(d.data.wxRentContract.rentInfo);
  1890. this.form.contractNumber = moment(new Date()).format("YYYYMMDDhhmmss");
  1891. }
  1892. this.form.price = Number(d.data.rent.wxRentContract.price) / 100;
  1893. let adjustRatio = [];
  1894. d.data.rent.wxRentContract.adjustRatio.forEach(
  1895. (item, index) => {
  1896. let a = item / 100;
  1897. adjustRatio.push(a);
  1898. }
  1899. );
  1900. let formData = {
  1901. adjustRatio,
  1902. type: d.data.rent.wxRentContract.type,
  1903. revenue: Number(d.data.rent.wxRentContract.revenue) / 100,
  1904. payRatio: Number(d.data.rent.wxRentContract.payRatio) / 100,
  1905. receivePeriod: d.data.rent.wxRentContract.receivePeriod,
  1906. adjustPeriod: d.data.rent.wxRentContract.adjustPeriod,
  1907. priceUnit: d.data.rent.wxRentContract.priceUnit,
  1908. deposit: Number(d.data.rent.wxRentContract.deposit) / 100,
  1909. price: Number(d.data.rent.wxRentContract.price) / 100,
  1910. rentPrice: Number(d.data.rent.wxRentContract.rentPrice),
  1911. adjustRatioWay: Number(d.data.rent.wxRentContract.adjustRatioWay),
  1912. rentInputWay: Number(d.data.rent.wxRentContract.rentInputWay),
  1913. latePayRatio: Number(d.data.rent.wxRentContract.latePayRatio),
  1914. latePayDay: Number(d.data.rent.wxRentContract.latePayDay),
  1915. busDiscountRatio:d.data.rent.wxRentContract.busDiscountRatio,
  1916. busDiscountTime:Number(d.data.rent.wxRentContract.busDiscountTime),
  1917. };
  1918. this.setFormData(formData);
  1919. console.log(formData)
  1920. let rentInfo = JSON.parse(d.data.rent.wxRentContract.rentInfo);
  1921. this.setRentInfo(rentInfo);
  1922. this.form.deposit = Number(d.data.rent.wxRentContract.deposit) / 100;
  1923. this.form.revenue = Number(d.data.rent.wxRentContract.revenue) / 100;
  1924. this.form.rentalStartDate = moment(this.form.rentalStartDate).format(
  1925. "YYYY-MM-DD"
  1926. );
  1927. if (!this.showContractTable) {
  1928. this.form.rentalEndDate = moment(this.form.rentalEndDate).format(
  1929. "YYYY-MM-DD"
  1930. );
  1931. this.getDateDiff(this.form.rentalStartDate, this.form.rentalEndDate);
  1932. }
  1933. Vue.set(this.form, "fixDate", [
  1934. d.data.rent.wxRentContract.fixStartDate,
  1935. d.data.rent.wxRentContract.fixEndDate
  1936. ]);
  1937. if (d.data.rent.wxRentContract.payRatio == undefined) {
  1938. this.form.payRatio = 0;
  1939. } else {
  1940. this.form.payRatio =
  1941. Number(d.data.rent.wxRentContract.payRatio) / 100;
  1942. }
  1943. this.fileNames = JSON.parse(d.data.rent.wxRentContract.fileNames);
  1944. //根据总租期限时调整比例
  1945. if (this.form.totalPeriodMonth > 12) {
  1946. let j = this.form.totalPeriodMonth / 12;
  1947. if (j % 1 === 0) {
  1948. //判断是不是整数
  1949. j = j - 1;
  1950. } else {
  1951. j = Math.floor(j);
  1952. }
  1953. for (var i = 0; i < j; i++) {
  1954. this.months.push(i);
  1955. }
  1956. formData.months = this.months;
  1957. this.setFormData(formData);
  1958. } else {
  1959. this.months = [];
  1960. formData.months = this.months;
  1961. this.setFormData(formData);
  1962. }
  1963. //如果没有设置物业信息不走下面的语句
  1964. if (!d.data.property) {
  1965. return;
  1966. }
  1967. this.moneyform = Object.assign(this.moneyform, d.data.property);
  1968. d.data.property.adjustRatio = JSON.parse(d.data.property.adjustRatio);
  1969. let adjustRatio02 = d.data.property.adjustRatio.map(
  1970. item => item / 100
  1971. );
  1972. this.moneyform.adjustRatio = adjustRatio02;
  1973. this.getadjustRatioInit(d.data.property.lease, adjustRatio02);
  1974. this.moneyform.price = d.data.property.price / 100;
  1975. this.moneyform.deposit = d.data.property.deposit / 100;
  1976. this.moneyform.rentPrice = d.data.property.rentPrice / 100;
  1977. this.moneyform.receivePeriod = d.data.property.receivePeriod;
  1978. this.moneyform.payAccount = d.data.property.payAccount;
  1979. this.moneyform.brand = d.data.property.brand;
  1980. this.moneyform.adjustPeriod = d.data.property.adjustPeriod;
  1981. this.moneyform.adjustRatioWay = d.data.property.adjustRatioWay;
  1982. },
  1983. getDetailData(id) {
  1984. let url = ContractUrl.rentPropertyContractFindById + "?id=" + this.$route.query.id;
  1985. if (this.showContractTable) {
  1986. url = `${ContractUrl.getContractInfo}?merchantId=${id}`;
  1987. //wkx
  1988. // this.getTenementContract(id);
  1989. }
  1990. this.getFetch(url)
  1991. .then(d => {
  1992. //续租处理
  1993. console.log(d)
  1994. /* if (this.showContractTable) {
  1995. d.data.rent = {};
  1996. d.data.rent.wxRentContract = d.data.wxRentContract;
  1997. } */
  1998. this.curContractList = d.data;
  1999. })
  2000. .catch(err => {
  2001. this.$message.error(err.data);
  2002. });
  2003. },
  2004. /**
  2005. * 获取默认收银信息
  2006. */
  2007. getPayAccountInfo() {
  2008. this.getFetch(ContractUrl.getPayAccountInfo)
  2009. .then(d => {
  2010. this.form.payAccount = d.data.bankCardId;
  2011. this.form.bankName = d.data.bankAccountName;
  2012. this.moneyform.payAccount = d.data.bankCardId;
  2013. })
  2014. .catch(err => {
  2015. this.$message.error(err.data);
  2016. });
  2017. },
  2018. /**
  2019. * 根据业务查询模板
  2020. */
  2021. getModelBybusiness() {
  2022. this.getFetch(`${promissionUrl.getModelBybusiness}?flowType=17`)
  2023. .then(d => {
  2024. if (d.data.length > 0) {
  2025. this.processData = JSON.parse(d.data[0].flow).lists;
  2026. }
  2027. })
  2028. .catch(err => {
  2029. this.$message.error(err.data);
  2030. });
  2031. },
  2032. changeMerchantName(id) {
  2033. console.log(id)
  2034. this.merchantIdFromSearch = id;
  2035. // this.getContractInfo(id)
  2036. if (this.showContractTable) {
  2037. console.log(id)
  2038. this.getDetailData(id);
  2039. } else {
  2040. this.getMerchantDetail(id);
  2041. }
  2042. },
  2043. getMerchantDetail(curMerchantId) {
  2044. this.getFetch('/api/wxMerchant/findById?id='+curMerchantId)
  2045. .then(res=>{
  2046. this.curContractId = d.data.wxRentContract.id;
  2047. let rentInfo = res.data.shoplist//gaidong
  2048. this.setRentInfo(rentInfo);
  2049. // 回显商户数据
  2050. this.form.brand = res.data.brand?res.data.brand:'';
  2051. this.form.businessId = res.data.businessId;
  2052. this.form.shopType = res.data.shopType;
  2053. this.form.linkPerson = res.data.linkPerson;
  2054. this.form.linkPhone = res.data.linkPhone;
  2055. this.form.businessId = res.data.businessId;
  2056. this.form.merchantId = curMerchantId;
  2057. this.getMerchantShops(curMerchantId);
  2058. })
  2059. .catch(err=>{
  2060. this.$message.error(err.data);
  2061. })
  2062. },
  2063. //wkx
  2064. getMerchantShops(merchantId,contractId='') {
  2065. let url = `${ContractUrl.getMerchantShops}?merchantId=${merchantId}&contractId=${contractId}`;
  2066. this.getFetch(url)
  2067. .then(d => {
  2068. this.curRentInfo = d.data;
  2069. let obj = deepcopy(d.data);
  2070. this.setRentInfo(obj);
  2071. })
  2072. },
  2073. /**
  2074. * 获取模糊搜索的商户id list
  2075. */
  2076. getMerchantIdList() {
  2077. this.getFetch(`${ContractUrl.getMerchantIdFromName}?merchantName=&shopType=1`)
  2078. .then(res=>{
  2079. this.merchantList = res.data;
  2080. })
  2081. .catch(err=>{
  2082. this.$message.error(err.data);
  2083. })
  2084. },
  2085. },
  2086. mounted() {
  2087. /* setInterval(()=>{
  2088. console.log(this.formData)
  2089. },2000) */
  2090. let datastr = moment(new Date()).format("YYYYMMDDhhmmss");
  2091. this.form.contractNumber = datastr;
  2092. this.setNavData(["合同管理", "店铺", "租金+物业合同", "新建"]);
  2093. this.formData.type = 1;
  2094. //aaa receivePeriod 初步创建的时候是0
  2095. this.formData.receivePeriod = '';
  2096. this.formData.adjustPeriod = 2;
  2097. this.formData.priceUnit = 2;
  2098. this.formData.adjustRatio = [];
  2099. this.formData.latePayRatio = '';
  2100. this.formData.latePayDay = '';
  2101. this.setFormData(this.formData);
  2102. if (this.$route.query.id) {
  2103. this.getDetailData();
  2104. this.setNavData(["合同管理", "店铺", "租金+物业合同", "编辑"]);
  2105. } else {
  2106. this.getPayAccountInfo();
  2107. }
  2108. //wkx
  2109. if (this.$route.query.Renew) {
  2110. this.setNavData(["合同管理", "店铺", "租金+物业合同", "续签"]);
  2111. this.showContractTable = true;
  2112. this.options = [
  2113. {
  2114. value: 3,
  2115. label: "续签合同"
  2116. }
  2117. ]
  2118. }
  2119. this.getMerchantIdList();
  2120. this.getModelBybusiness();
  2121. this.getFetch(ContractUrl.businessList)
  2122. .then(d => {
  2123. this.businessIds = d.data;
  2124. })
  2125. .catch(err => {
  2126. this.$message.error(err.data);
  2127. });
  2128. //获取品牌列表
  2129. this.getFetch("/api/wxBrand/queryBrand")
  2130. .then(d => {
  2131. this.brands = d.data;
  2132. })
  2133. .catch(err => {
  2134. this.$message.error(err.data);
  2135. });
  2136. },
  2137. created(){
  2138. if (this.$route.query.from != undefined) {
  2139. this.formData.rentInputWay = 1;
  2140. this.setFormData(this.formData)
  2141. this.merchentEditIf = true;
  2142. this.showShopStatus = true;
  2143. if (this.$route.query.from == 'investManage') {
  2144. this.setNavData(["招商管理", "招商任务", "租金+物业合同", "新建"]);
  2145. } else if (this.$route.query.from == 'addCustomer') {
  2146. this.setNavData(["招商管理", "编辑客户", "租金+物业合同", "新建"]);
  2147. console.log(this.rentInfo)
  2148. this.form.brand = this.rentInfo[0].brandIdStr;
  2149. this.form.businessId = this.rentInfo[0].businessIdStr;
  2150. this.form.linkPerson = this.rentInfo[0].linkPersonStr;
  2151. this.form.linkPhone = this.rentInfo[0].linkPhoneStr;
  2152. this.isEditOk = false;
  2153. }
  2154. }
  2155. },
  2156. beforeDestroy: function() {
  2157. this.setRentInfo([]);
  2158. this.setFormData({});
  2159. }
  2160. };
  2161. </script>
  2162. <style>
  2163. input[type="file"] {
  2164. display: none;
  2165. }
  2166. .el-table th > .cell {
  2167. text-align: center !important;
  2168. }
  2169. .up > .el-form-item__error {
  2170. margin-left: -130px !important;
  2171. }
  2172. .price-input .el-input__inner {
  2173. border: 0 !important;
  2174. }
  2175. .per-list .el-form-item__content{
  2176. margin-left: 0 !important;
  2177. width: auto !important;
  2178. }
  2179. .per-list .el-form-item{
  2180. width: auto !important;
  2181. margin-right: 50px;
  2182. margin-bottom: 40px;
  2183. }
  2184. .per-list{
  2185. margin-left: 150px;
  2186. }
  2187. </style>
  2188. <style scoped>
  2189. .price-list {
  2190. width: 100%;
  2191. height: auto;
  2192. overflow: hidden;
  2193. padding-left: 130px;
  2194. margin-bottom: 22px;
  2195. }
  2196. .p-list {
  2197. width: auto;
  2198. float: left;
  2199. overflow: hidden;
  2200. margin: 0 10px;
  2201. }
  2202. .price-items {
  2203. float: left;
  2204. height: 40px;
  2205. overflow: hidden;
  2206. border: 1px solid #dcdfe6;
  2207. border-radius: 4px;
  2208. margin: 10px;
  2209. }
  2210. .price-title {
  2211. width: auto;
  2212. padding: 0 10px;
  2213. line-height: 40px;
  2214. float: left;
  2215. background: #f5f7fa;
  2216. color: #909399;
  2217. border-right: 1px solid #dcdfe6;
  2218. }
  2219. .price-unit {
  2220. width: auto;
  2221. /* padding: 0 10px; */
  2222. line-height: 60px;
  2223. float: left;
  2224. color: #909399;
  2225. }
  2226. .price-input {
  2227. float: left;
  2228. width: 100px;
  2229. }
  2230. .el-step__title.is-success {
  2231. color: #5976bf !important;
  2232. }
  2233. .fx_step .el-step.is-center .el-step__line {
  2234. left: 0;
  2235. right: -100%;
  2236. }
  2237. .layout-content {
  2238. width: 100%;
  2239. background: #141e29;
  2240. height: auto;
  2241. /* min-height: 300px; */
  2242. padding: 0 20px;
  2243. overflow: hidden;
  2244. text-align: left;
  2245. }
  2246. form {
  2247. text-align: left;
  2248. width: 100%;
  2249. }
  2250. .shopBox {
  2251. width: 100%;
  2252. background: #3fc496;
  2253. height: 40px;
  2254. overflow: hidden;
  2255. border-bottom-left-radius: 2px;
  2256. border-top-left-radius: 2px;
  2257. }
  2258. .shopBox .shopBtn {
  2259. width: 110px;
  2260. height: 40px;
  2261. float: left;
  2262. text-align: center;
  2263. line-height: 40px;
  2264. color: #fefefe;
  2265. font-size: 14px;
  2266. cursor: pointer;
  2267. background: RGBA(63, 196, 150, 1);
  2268. }
  2269. .shopBox .shopBtn:hover {
  2270. background: RGBA(63, 196, 150, 0.88);
  2271. }
  2272. .shopBox .shopContent {
  2273. width: calc(100% - 110px);
  2274. background: #ffffff;
  2275. position: relative;
  2276. float: right;
  2277. height: 40px;
  2278. border-top: 5px solid #3fc496;
  2279. border-bottom: 5px solid #3fc496;
  2280. border-right: 5px solid #3fc496;
  2281. padding-right: 10px;
  2282. }
  2283. .shoplist div {
  2284. width: 18%;
  2285. float: left;
  2286. text-align: center;
  2287. line-height: 30px;
  2288. color: #555;
  2289. font-size: 14px;
  2290. }
  2291. .iconBox {
  2292. font-size: 18px !important;
  2293. color: #3fc496 !important;
  2294. margin-right: 6px !important;
  2295. }
  2296. .jiaojiao {
  2297. width: 27px;
  2298. position: absolute;
  2299. right: 5px;
  2300. }
  2301. .public_part {
  2302. background: #fff;
  2303. margin-top: 20px;
  2304. }
  2305. .public_part_title {
  2306. height: 40px;
  2307. padding: 11px 0 11px 21px;
  2308. background: #5976bf;
  2309. font-size: 14px;
  2310. color: #fff;
  2311. }
  2312. .public_part_Box {
  2313. padding: 30px;
  2314. }
  2315. .baocun {
  2316. background: #5976bf;
  2317. border: 0;
  2318. }
  2319. .baocun:hover {
  2320. background: #7a6ce1;
  2321. }
  2322. .download-file {
  2323. position: relative;
  2324. overflow: hidden;
  2325. text-align: center;
  2326. display: inline-block;
  2327. width: 120px;
  2328. border: 1px #dcdfe6 solid;
  2329. background-color: #409eff;
  2330. border-radius: 4px;
  2331. padding: 7px 10px;
  2332. font-size: 12px;
  2333. font-weight: normal;
  2334. line-height: 24px;
  2335. color: #fff;
  2336. text-decoration: none;
  2337. }
  2338. .el-form-item .el-form-item__content,
  2339. .el-form-item .el-form-item__content .el-date-editor,
  2340. .el-form-item .el-form-item__content .el-date-editor .el-input__inner {
  2341. width: 211px;
  2342. }
  2343. .fx_send .el-form-item__content .el-select {
  2344. width: 211px !important;
  2345. }
  2346. .fx_title .el-input {
  2347. width: 211px;
  2348. }
  2349. /* 按钮处理 */
  2350. .group-btn {
  2351. margin: 20px 0;
  2352. text-align: center;
  2353. }
  2354. .group-btn .quxiaoBtn,
  2355. .group-btn .baocunBtn,
  2356. .group-btn .nextBtn {
  2357. height: 40px;
  2358. font-size: 14px;
  2359. border-radius: 3px;
  2360. border: 0;
  2361. }
  2362. .group-btn .quxiaoBtn {
  2363. /* width:83px; */
  2364. color: #555;
  2365. margin-right: 9px;
  2366. background: RGBA(255, 255, 255, 1);
  2367. }
  2368. .group-btn .baocunBtn {
  2369. /* width:130px; */
  2370. color: #ffffff;
  2371. margin-left: 9px;
  2372. background: RGBA(89, 118, 191, 1);
  2373. }
  2374. .group-btn .nextBtn {
  2375. width: 84px;
  2376. color: #ffffff;
  2377. margin-left: 9px;
  2378. background: RGBA(89, 118, 191, 1);
  2379. }
  2380. .group-btn .quxiaoBtn:hover {
  2381. background: rgba(255, 255, 255, 0.88);
  2382. }
  2383. .group-btn .baocunBtn:hover,
  2384. .group-btn .nextBtn:hover {
  2385. background: RGBA(89, 118, 191, 0.88);
  2386. }
  2387. .innerinput {
  2388. width: 120px;
  2389. }
  2390. </style>