edit.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  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.subscriptionFunds"
  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="editIntentional">保存</button>
  150. </div>
  151. </template>
  152. <script>
  153. import {
  154. getCustomerInfoById,
  155. ParkFloorDiscControllerGetById,
  156. getSerialNumber,
  157. getByCustomerManagementId,
  158. getByCodes,
  159. getUserLocalStorageInfo,
  160. editIntentional,
  161. } from "@/js_sdk/http";
  162. export default {
  163. name: "propertyEditor",
  164. data() {
  165. return {
  166. COLLECTION_METHODS: [],
  167. fileList: [],
  168. fileList2: [],
  169. buildFa: "",
  170. show: false,
  171. showTree: false,
  172. cascaderValue: null,
  173. fieldNames: {
  174. text: "label",
  175. value: "value",
  176. children: "children",
  177. },
  178. options: [],
  179. areaList: [],
  180. floorList: [],
  181. usegeList: [],
  182. natureList: [],
  183. enableList: [],
  184. cxList: [],
  185. situationList: [],
  186. statusList: [],
  187. popType: "",
  188. form: {},
  189. postData: {
  190. groupName: "",
  191. floorDiscName: "",
  192. buildName: "",
  193. roomNo: "",
  194. region: "",
  195. size: "",
  196. imgNo: "",
  197. floor: "",
  198. roomUse: "",
  199. roomUseLabel: "",
  200. propertyNature: "",
  201. direction: "",
  202. decorationSituation: "",
  203. floorHeight: "",
  204. bearing: "",
  205. electricity: "",
  206. guidePrice: "",
  207. remark: "",
  208. environmentPicture: "",
  209. planPicture: "",
  210. address: "",
  211. },
  212. dic_key: ["COLLECTION_METHODS"],
  213. };
  214. },
  215. onLoad(options) {
  216. this.form.userId = getUserLocalStorageInfo().id;
  217. this.form.truename = getUserLocalStorageInfo().truename;
  218. const now = new Date();
  219. const year = now.getFullYear();
  220. const month = now.getMonth() + 1; // 月份从 0 开始,因此需要加 1
  221. const day = now.getDate();
  222. this.form.collectionTime = `${year}-${month}-${day}`;
  223. this.options = options;
  224. this.getCustomerInfoById();
  225. this.getByCodes();
  226. },
  227. computed: {
  228. startDate() {
  229. return this.getDate("start");
  230. },
  231. endDate() {
  232. return this.getDate("end");
  233. },
  234. },
  235. methods: {
  236. async editIntentional() {
  237. let fileList = JSON.parse(JSON.stringify(this.fileList));
  238. let fileListStr = fileList.map((e) => {
  239. return {
  240. url: e.imgUrl,
  241. id: e.id,
  242. data: e.id,
  243. type: "image",
  244. isImage: true,
  245. };
  246. });
  247. console.log({
  248. ...this.form,
  249. id: this.options.rowId,
  250. customerManagementId: this.options.id,
  251. fileList: JSON.stringify(fileListStr),
  252. });
  253. let data = await editIntentional({
  254. ...this.form,
  255. id: this.options.rowId,
  256. customerManagementId: this.options.id,
  257. fileList: JSON.stringify(fileListStr),
  258. });
  259. },
  260. getPaymentMethod(e) {
  261. this.form.paymentMethod = this.COLLECTION_METHODS[e.detail.value].value;
  262. console.log(e.detail.value);
  263. let form = { ...this.form };
  264. this.form = {};
  265. this.form = form;
  266. },
  267. async getByCodes() {
  268. let data = await getByCodes(JSON.stringify(this.dic_key));
  269. let dic_SelectList = this.$common.handleDicList(data);
  270. this.COLLECTION_METHODS = dic_SelectList.COLLECTION_METHODS;
  271. console.log(this.COLLECTION_METHODS);
  272. },
  273. bindDateChange(e) {
  274. this.form.collectionTime = e.detail.value;
  275. console.log(e.detail.value);
  276. },
  277. getDate(type) {
  278. const date = new Date();
  279. let year = date.getFullYear();
  280. let month = date.getMonth() + 1;
  281. let day = date.getDate();
  282. if (type === "start") {
  283. year = year - 60;
  284. } else if (type === "end") {
  285. year = year + 2;
  286. }
  287. month = month > 9 ? month : "0" + month;
  288. day = day > 9 ? day : "0" + day;
  289. return `${year}-${month}-${day}`;
  290. },
  291. async getSerialNumber() {
  292. let data = await getSerialNumber({
  293. customerManagementId: this.options.id,
  294. });
  295. this.form.serialNumber = data;
  296. console.log(data);
  297. let form = { ...this.form };
  298. this.form = {};
  299. this.form = form;
  300. this.ParkFloorDiscControllerGetById();
  301. },
  302. async getCustomerInfoById() {
  303. let data = await getCustomerInfoById({ id: this.options.id });
  304. console.log(data);
  305. this.form.roomSelectionDate = data.roomSelectionDate;
  306. this.form.batchNumber = data.batchNumber;
  307. this.form.roomSelectionNumber = data.roomSelectionNumber;
  308. this.form.buyerName = data.buyerName;
  309. this.form.intentionalDepositStatus = data.intentionalDepositStatus;
  310. // this.form.receivedAmount = data.receivedAmount;
  311. console.log(this.form.buyerName);
  312. this.form.discId = data.discId;
  313. this.getSerialNumber();
  314. },
  315. changeRemark(e) {
  316. this.form.remark = e.detail;
  317. console.log(e.detail);
  318. },
  319. async ParkFloorDiscControllerGetById() {
  320. let data = await ParkFloorDiscControllerGetById({
  321. id: this.form.discId,
  322. });
  323. this.form.subscriptionFunds = data.subscriptionFunds;
  324. this.getByCustomerManagementId();
  325. },
  326. async getByCustomerManagementId() {
  327. let data = await getByCustomerManagementId({
  328. customerManagementId: this.options.id,
  329. });
  330. this.form.receivedAmount = data.receivedAmount ? data.receivedAmount : "";
  331. console.log("paymentMethod", data.paymentMethod);
  332. this.form.paymentMethod = data.paymentMethod + "";
  333. this.form.remark = data.remark;
  334. let fileList = JSON.parse(data.fileList);
  335. this.fileList = fileList;
  336. console.log(fileList);
  337. let form = { ...this.form };
  338. this.form = {};
  339. this.form = form;
  340. },
  341. deleteRYXXZP(event) {
  342. this.fileList.splice(event.detail.index, 1);
  343. this.$forceUpdate();
  344. },
  345. uploadRYXXZP(event) {
  346. // console.log(event)
  347. let that = this;
  348. const { file } = event.detail;
  349. console.log(event.detail);
  350. uni.uploadFile({
  351. url: that.$constant.BASE_URI + "/wx/FileController/upload",
  352. filePath: file.url,
  353. name: "file",
  354. formData: { user: "test" },
  355. success(res) {
  356. // 上传完成需要更新 fileList'
  357. console.log(JSON.parse(res.data));
  358. let data = JSON.parse(res.data);
  359. if (event.detail.file.type === "image") {
  360. that.fileList.push({
  361. imgUrl: "/FileController/download/" + data.data,
  362. id: data.data,
  363. url:
  364. that.$constant.BASE_URI +
  365. "/FileController/download/" +
  366. data.data,
  367. type: event.detail.file.type,
  368. isImage: true,
  369. });
  370. } else {
  371. that.fileList.push({
  372. imgUrl: "/FileController/download/" + data.data,
  373. id: data.data,
  374. url:
  375. that.$constant.BASE_URI +
  376. "/FileController/download/" +
  377. data.data,
  378. type: event.detail.file.type,
  379. isVideo: true,
  380. });
  381. }
  382. },
  383. fail(res) {},
  384. });
  385. },
  386. },
  387. };
  388. </script>
  389. <style lang="scss">
  390. .propertyEditor {
  391. padding-bottom: 150rpx;
  392. .detailUl {
  393. margin-top: 20rpx;
  394. background: white;
  395. padding: 0 32rpx;
  396. .liName {
  397. font-size: 32rpx;
  398. color: rgba(51, 51, 51, 1);
  399. white-space: nowrap;
  400. .callNumber {
  401. color: rgba(24, 23, 42, 1);
  402. font-size: 36rpx;
  403. font-weight: 600;
  404. }
  405. .callName {
  406. color: rgba(102, 102, 102, 1);
  407. font-size: 28rpx;
  408. }
  409. }
  410. .phoneIcon {
  411. width: 64rpx;
  412. height: 64rpx;
  413. }
  414. .detailLi {
  415. display: flex;
  416. justify-content: space-between;
  417. align-items: center;
  418. padding: 32rpx 0;
  419. border-bottom: 2rpx solid #e6e6e6;
  420. .liInfo {
  421. display: inline-block;
  422. text-align: right;
  423. max-width: 428rpx;
  424. color: rgba(102, 102, 102, 1);
  425. font-size: 32rpx;
  426. line-height: 38rpx;
  427. overflow: hidden;
  428. word-wrap: break-word;
  429. }
  430. .inputBox {
  431. display: flex;
  432. align-items: center;
  433. }
  434. .myIpt {
  435. text-align: right;
  436. margin-right: 20rpx;
  437. color: rgba(102, 102, 102, 1);
  438. }
  439. }
  440. .detailLi2 {
  441. display: flex;
  442. flex-direction: column;
  443. padding: 32rpx 0;
  444. border-bottom: 2rpx solid #e6e6e6;
  445. .detailLi2BoxTop {
  446. display: flex;
  447. flex-wrap: wrap;
  448. justify-content: space-between;
  449. margin: 12rpx 0;
  450. .checkItem {
  451. width: 128rpx;
  452. height: 64rpx;
  453. font-size: 28rpx;
  454. color: #666666;
  455. display: flex;
  456. align-items: center;
  457. justify-content: center;
  458. background: #f5f7fa;
  459. border-radius: 8rpx;
  460. margin: 12rpx 0;
  461. }
  462. .checked {
  463. background: #0365f9;
  464. color: white;
  465. }
  466. }
  467. .locationBox {
  468. position: absolute;
  469. right: 24rpx;
  470. top: 100rpx;
  471. }
  472. .van-cell {
  473. background: #f5f7fa !important;
  474. border-radius: 8rpx;
  475. font-size: 28rpx;
  476. margin-top: 16rpx;
  477. }
  478. }
  479. }
  480. .commitBtn {
  481. width: 654rpx;
  482. height: 96rpx;
  483. background: rgba(3, 101, 249, 1);
  484. margin: 64rpx 48rpx;
  485. display: flex;
  486. align-items: center;
  487. justify-content: center;
  488. font-size: 36rpx;
  489. color: white;
  490. }
  491. }
  492. </style>