add.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. <template>
  2. <div class="propertyEditor">
  3. <ul class="detailUl">
  4. <li class="detailLi">
  5. <span class="liName"> 定金编号 </span>
  6. <div class="inputBox">
  7. <input
  8. placeholder="请输入"
  9. class="myIpt"
  10. v-model="form.serialNumber"
  11. />
  12. </div>
  13. </li>
  14. <li class="detailLi">
  15. <span class="liName"> 批次号-选房号 </span>
  16. <div class="inputBox">
  17. <div class="myIpt">
  18. {{ form.batchNumber + "-" + form.roomSelectionNumber }}
  19. </div>
  20. </div>
  21. </li>
  22. <li class="detailLi">
  23. <span class="liName"> 买受人 </span>
  24. <div class="inputBox">
  25. <input placeholder="请输入" class="myIpt" v-model="form.buyerName" />
  26. </div>
  27. </li>
  28. <li class="detailLi">
  29. <span class="liName"> 选房日期 </span>
  30. <div class="inputBox">
  31. <input
  32. placeholder="请输入"
  33. class="myIpt"
  34. v-model="form.roomSelectionDate"
  35. />
  36. </div>
  37. </li>
  38. <li class="detailLi">
  39. <span class="liName"> 应收定金(元) </span>
  40. <div class="inputBox">
  41. <input
  42. placeholder="请输入"
  43. class="myIpt"
  44. v-model="form.receivableMoney"
  45. />
  46. </div>
  47. </li>
  48. </ul>
  49. <ul class="detailUl">
  50. <li class="detailLi">
  51. <span class="liName">
  52. <span style="color: red">*</span>
  53. 实收金额(元)
  54. </span>
  55. <div class="inputBox">
  56. <input
  57. placeholder="请输入"
  58. class="myIpt"
  59. v-model="form.receivedAmount"
  60. />
  61. </div>
  62. </li>
  63. <li class="detailLi">
  64. <span class="liName"> <span style="color: red">*</span> 收款方式 </span>
  65. <div class="inputBox">
  66. <picker
  67. range-key="label"
  68. @change="getPaymentMethod"
  69. :range="COLLECTION_METHODS"
  70. >
  71. <view class="uni-input">{{
  72. form.paymentMethod
  73. ? COLLECTION_METHODS[form.paymentMethod - 1].label
  74. : "请选择"
  75. }}</view>
  76. </picker>
  77. </div>
  78. </li>
  79. <li class="detailLi">
  80. <span class="liName"> <span style="color: red">*</span>收款时间 </span>
  81. <div class="inputBox">
  82. <picker
  83. mode="date"
  84. :value="form.collectionTime"
  85. :start="startDate"
  86. :end="endDate"
  87. @change="bindDateChange"
  88. >
  89. <div class="myIpt">
  90. {{ form.collectionTime ? form.collectionTime : "请选择" }}
  91. </div>
  92. </picker>
  93. </div>
  94. </li>
  95. <li class="detailLi2">
  96. <div class="titleBox">
  97. <span class="liName">备注</span>
  98. </div>
  99. <van-field
  100. :value="form.remark"
  101. @change="changeRemark"
  102. autosize
  103. type="textarea"
  104. placeholder="请输入"
  105. class="myField"
  106. maxlength="1000"
  107. show-word-limit
  108. />
  109. </li>
  110. <li class="detailLi2">
  111. <div class="titleBox" style="margin-bottom: 24rpx">
  112. <span class="liName">
  113. 照片上传
  114. <span style="color: #b3b3b3; font-size: 28rpx"
  115. >(只能上传jpg/png格式,限制上传9张)</span
  116. >
  117. </span>
  118. </div>
  119. <van-uploader
  120. :max-count="9"
  121. @delete="deleteRYXXZP"
  122. :file-list="fileList"
  123. @after-read="uploadRYXXZP"
  124. :show-upload="true"
  125. />
  126. </li>
  127. <li class="detailLi">
  128. <span class="liName"> 经办人 </span>
  129. <div class="inputBox">
  130. <input
  131. placeholder="请输入"
  132. class="myIpt"
  133. disabled
  134. v-model="form.truename"
  135. />
  136. </div>
  137. </li>
  138. <li class="detailLi" style="border-bottom: none">
  139. <span class="liName"> 经办日期 </span>
  140. <div class="inputBox">
  141. <input
  142. placeholder="请输入"
  143. class="myIpt"
  144. v-model="form.collectionTime"
  145. />
  146. </div>
  147. </li>
  148. </ul>
  149. <button class="commitBtn" @tap="submitData">保存</button>
  150. </div>
  151. </template>
  152. <script>
  153. import {
  154. getCustomerInfoById,
  155. ParkFloorDiscControllerGetById,
  156. getDjNumber,
  157. getByCustomerManagementId,
  158. getByCodes,
  159. getUserLocalStorageInfo,
  160. editDj,
  161. getDjById,
  162. addDj,
  163. } from "@/js_sdk/http";
  164. export default {
  165. name: "propertyEditor",
  166. data() {
  167. return {
  168. statuts: "",
  169. COLLECTION_METHODS: [],
  170. fileList: [],
  171. fileList2: [],
  172. buildFa: "",
  173. show: false,
  174. showTree: false,
  175. cascaderValue: null,
  176. fieldNames: {
  177. text: "label",
  178. value: "value",
  179. children: "children",
  180. },
  181. options: [],
  182. areaList: [],
  183. floorList: [],
  184. usegeList: [],
  185. natureList: [],
  186. enableList: [],
  187. cxList: [],
  188. situationList: [],
  189. statusList: [],
  190. popType: "",
  191. form: {},
  192. postData: {
  193. groupName: "",
  194. floorDiscName: "",
  195. buildName: "",
  196. roomNo: "",
  197. region: "",
  198. size: "",
  199. imgNo: "",
  200. floor: "",
  201. roomUse: "",
  202. roomUseLabel: "",
  203. propertyNature: "",
  204. direction: "",
  205. decorationSituation: "",
  206. floorHeight: "",
  207. bearing: "",
  208. electricity: "",
  209. guidePrice: "",
  210. remark: "",
  211. environmentPicture: "",
  212. planPicture: "",
  213. address: "",
  214. },
  215. dic_key: ["COLLECTION_METHODS"],
  216. };
  217. },
  218. onLoad(options) {
  219. this.status = options.status;
  220. this.form.houseId = options.houseId;
  221. this.form.id = options.rowId;
  222. this.form.customerManagementId = options.customerManagementId;
  223. this.form.userId = getUserLocalStorageInfo().id;
  224. this.form.truename = getUserLocalStorageInfo().truename;
  225. this.form.receivableMoney = options.receivableMoney;
  226. const now = new Date();
  227. const year = now.getFullYear();
  228. const month = now.getMonth() + 1; // 月份从 0 开始,因此需要加 1
  229. const day = now.getDate();
  230. this.form.collectionTime = `${year}-${month}-${day}`;
  231. this.options = options;
  232. this.getCustomerInfoById();
  233. this.getByCodes();
  234. },
  235. computed: {
  236. startDate() {
  237. return this.getDate("start");
  238. },
  239. endDate() {
  240. return this.getDate("end");
  241. },
  242. },
  243. methods: {
  244. submitData() {
  245. console.log(this.status);
  246. // return;
  247. if (!this.form.receivedAmount) {
  248. this.$showToast("请填写实收金额");
  249. return;
  250. }
  251. if (!this.form.paymentMethod) {
  252. this.$showToast("请选择收款方式");
  253. return;
  254. }
  255. if (!this.form.collectionTime) {
  256. this.$showToast("请选择收款时间");
  257. return;
  258. }
  259. if (this.status == 2) {
  260. this.editDj();
  261. } else {
  262. this.addDj();
  263. }
  264. },
  265. async addDj() {
  266. let fileList = JSON.parse(JSON.stringify(this.fileList));
  267. let fileListStr = fileList.map((e) => {
  268. return {
  269. url: e.imgUrl,
  270. id: e.id,
  271. data: e.id,
  272. type: "image",
  273. isImage: true,
  274. };
  275. });
  276. let data = await addDj({
  277. ...this.form,
  278. fileList: JSON.stringify(fileListStr),
  279. });
  280. if (data.code == 200) {
  281. this.$showToast("登记成功");
  282. uni.navigateBack();
  283. }
  284. },
  285. async editDj() {
  286. let fileList = JSON.parse(JSON.stringify(this.fileList));
  287. let fileListStr = fileList.map((e) => {
  288. return {
  289. url: e.imgUrl,
  290. id: e.id,
  291. data: e.id,
  292. type: "image",
  293. isImage: true,
  294. };
  295. });
  296. let data = await editDj({
  297. ...this.form,
  298. status: 2,
  299. fileList: JSON.stringify(fileListStr),
  300. });
  301. if (data.code == 200) {
  302. this.$showToast("登记成功");
  303. uni.navigateBack();
  304. }
  305. },
  306. getPaymentMethod(e) {
  307. this.form.paymentMethod = this.COLLECTION_METHODS[e.detail.value].value;
  308. console.log(e.detail.value);
  309. let form = { ...this.form };
  310. this.form = {};
  311. this.form = form;
  312. },
  313. async getByCodes() {
  314. let data = await getByCodes(JSON.stringify(this.dic_key));
  315. let dic_SelectList = this.$common.handleDicList(data);
  316. this.COLLECTION_METHODS = dic_SelectList.COLLECTION_METHODS;
  317. console.log(this.COLLECTION_METHODS);
  318. },
  319. bindDateChange(e) {
  320. this.form.collectionTime = e.detail.value;
  321. console.log(e.detail.value);
  322. },
  323. getDate(type) {
  324. const date = new Date();
  325. let year = date.getFullYear();
  326. let month = date.getMonth() + 1;
  327. let day = date.getDate();
  328. if (type === "start") {
  329. year = year - 60;
  330. } else if (type === "end") {
  331. year = year + 2;
  332. }
  333. month = month > 9 ? month : "0" + month;
  334. day = day > 9 ? day : "0" + day;
  335. return `${year}-${month}-${day}`;
  336. },
  337. async getDjNumber() {
  338. let data = await getDjNumber({
  339. houseId: this.options.houseId,
  340. });
  341. this.form.serialNumber = data;
  342. console.log(data);
  343. let form = { ...this.form };
  344. this.form = {};
  345. this.form = form;
  346. this.ParkFloorDiscControllerGetById();
  347. },
  348. async getCustomerInfoById() {
  349. let data = await getCustomerInfoById({
  350. id: this.options.customerManagementId,
  351. });
  352. console.log(data);
  353. this.form.roomSelectionDate = data.roomSelectionDate;
  354. this.form.batchNumber = data.batchNumber;
  355. this.form.roomSelectionNumber = data.roomSelectionNumber;
  356. this.form.buyerName = data.buyerName;
  357. this.form.intentionalDepositStatus = data.intentionalDepositStatus;
  358. // this.form.receivedAmount = data.receivedAmount;
  359. console.log(this.form.buyerName);
  360. this.form.discId = data.discId;
  361. this.getDjNumber();
  362. if (this.status == 2) {
  363. this.getDjById();
  364. }
  365. },
  366. async getDjById() {
  367. let data = await getDjById({ id: this.options.rowId });
  368. this.form.receivedAmount = data.receivedAmount;
  369. this.form.paymentMethod = data.paymentMethod;
  370. this.form.collectionTime = data.collectionTime;
  371. this.form.remark = data.remark;
  372. console.log(JSON.parse(data.fileList));
  373. this.fileList = JSON.parse(data.fileList).map((e) => {
  374. return {
  375. imgUrl: "/FileController/download/" + e.data,
  376. url: this.$constant.BASE_URI + e.url,
  377. isImage: true,
  378. id: e.id,
  379. };
  380. });
  381. },
  382. changeRemark(e) {
  383. this.form.remark = e.detail;
  384. console.log(e.detail);
  385. },
  386. async ParkFloorDiscControllerGetById() {
  387. let data = await ParkFloorDiscControllerGetById({
  388. id: this.form.discId,
  389. });
  390. this.form.subscriptionFunds = data.subscriptionFunds;
  391. let form = { ...this.form };
  392. this.form = {};
  393. this.form = form;
  394. },
  395. async getByCustomerManagementId() {
  396. let data = await getByCustomerManagementId({
  397. customerManagementId: this.options.id,
  398. });
  399. this.form.receivedAmount = data.receivedAmount ? data.receivedAmount : "";
  400. console.log("paymentMethod", data.paymentMethod);
  401. this.form.paymentMethod = data.paymentMethod + "";
  402. this.form.remark = data.remark;
  403. let fileList = JSON.parse(data.fileList);
  404. this.fileList = fileList;
  405. console.log(fileList);
  406. let form = { ...this.form };
  407. this.form = {};
  408. this.form = form;
  409. },
  410. deleteRYXXZP(event) {
  411. this.fileList.splice(event.detail.index, 1);
  412. this.$forceUpdate();
  413. },
  414. uploadRYXXZP(event) {
  415. // console.log(event)
  416. let that = this;
  417. const { file } = event.detail;
  418. console.log(event.detail);
  419. uni.uploadFile({
  420. url: that.$constant.BASE_URI + "/wx/FileController/upload",
  421. filePath: file.url,
  422. name: "file",
  423. formData: { user: "test" },
  424. success(res) {
  425. // 上传完成需要更新 fileList'
  426. console.log(JSON.parse(res.data));
  427. let data = JSON.parse(res.data);
  428. if (event.detail.file.type === "image") {
  429. that.fileList.push({
  430. imgUrl: "/FileController/download/" + data.data,
  431. id: data.data,
  432. url:
  433. that.$constant.BASE_URI +
  434. "/FileController/download/" +
  435. data.data,
  436. type: event.detail.file.type,
  437. isImage: true,
  438. });
  439. } else {
  440. that.fileList.push({
  441. imgUrl: "/FileController/download/" + data.data,
  442. id: data.data,
  443. url:
  444. that.$constant.BASE_URI +
  445. "/FileController/download/" +
  446. data.data,
  447. type: event.detail.file.type,
  448. isVideo: true,
  449. });
  450. }
  451. },
  452. fail(res) {},
  453. });
  454. },
  455. },
  456. };
  457. </script>
  458. <style lang="scss">
  459. .propertyEditor {
  460. padding-bottom: 150rpx;
  461. .detailUl {
  462. margin-top: 20rpx;
  463. background: white;
  464. padding: 0 32rpx;
  465. .liName {
  466. font-size: 32rpx;
  467. color: rgba(51, 51, 51, 1);
  468. white-space: nowrap;
  469. .callNumber {
  470. color: rgba(24, 23, 42, 1);
  471. font-size: 36rpx;
  472. font-weight: 600;
  473. }
  474. .callName {
  475. color: rgba(102, 102, 102, 1);
  476. font-size: 28rpx;
  477. }
  478. }
  479. .phoneIcon {
  480. width: 64rpx;
  481. height: 64rpx;
  482. }
  483. .detailLi {
  484. display: flex;
  485. justify-content: space-between;
  486. align-items: center;
  487. padding: 32rpx 0;
  488. border-bottom: 2rpx solid #e6e6e6;
  489. .liInfo {
  490. display: inline-block;
  491. text-align: right;
  492. max-width: 428rpx;
  493. color: rgba(102, 102, 102, 1);
  494. font-size: 32rpx;
  495. line-height: 38rpx;
  496. overflow: hidden;
  497. word-wrap: break-word;
  498. }
  499. .inputBox {
  500. display: flex;
  501. align-items: center;
  502. }
  503. .myIpt {
  504. text-align: right;
  505. margin-right: 20rpx;
  506. color: rgba(102, 102, 102, 1);
  507. }
  508. }
  509. .detailLi2 {
  510. display: flex;
  511. flex-direction: column;
  512. padding: 32rpx 0;
  513. border-bottom: 2rpx solid #e6e6e6;
  514. .detailLi2BoxTop {
  515. display: flex;
  516. flex-wrap: wrap;
  517. justify-content: space-between;
  518. margin: 12rpx 0;
  519. .checkItem {
  520. width: 128rpx;
  521. height: 64rpx;
  522. font-size: 28rpx;
  523. color: #666666;
  524. display: flex;
  525. align-items: center;
  526. justify-content: center;
  527. background: #f5f7fa;
  528. border-radius: 8rpx;
  529. margin: 12rpx 0;
  530. }
  531. .checked {
  532. background: #0365f9;
  533. color: white;
  534. }
  535. }
  536. .locationBox {
  537. position: absolute;
  538. right: 24rpx;
  539. top: 100rpx;
  540. }
  541. .van-cell {
  542. background: #f5f7fa !important;
  543. border-radius: 8rpx;
  544. font-size: 28rpx;
  545. margin-top: 16rpx;
  546. }
  547. }
  548. }
  549. .commitBtn {
  550. width: 654rpx;
  551. height: 96rpx;
  552. background: rgba(3, 101, 249, 1);
  553. margin: 64rpx 48rpx;
  554. display: flex;
  555. align-items: center;
  556. justify-content: center;
  557. font-size: 36rpx;
  558. color: white;
  559. }
  560. }
  561. </style>