add.vue 15 KB

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