house.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view class="">
  3. <view class="data-from" v-for="(item,index) in houseList">
  4. <view class="p-t30" v-if="editIndex!==index">
  5. <view class="sys-from-background-color p-20 r-20">
  6. <view class="row-justify-sb center">
  7. <text class="size-28 sys-weight-600">房产信息({{index+1}})</text>
  8. <view class="row-c sys-background-fff r-100 p-lr40 p-tb10">
  9. <image class="wh-30"
  10. src="/page_task/static/img/information/edit.png"
  11. mode="aspectFill" @click="onEditInfo(index)"></image>
  12. <view class="title-line m-lr20"></view>
  13. <image class="wh-30"
  14. src="/page_task/static/img/information/delete.png"
  15. mode="aspectFill" @click="onDeleteInfo(index)">
  16. </image>
  17. </view>
  18. </view>
  19. <view class="row p-t30">
  20. <view class="text-color-666"><text></text>产权人:</view>
  21. <text class="flex">{{item.data.property_owner}}</text>
  22. </view>
  23. <view class="row p-t30">
  24. <view class="text-color-666"><text></text>房产证号:</view>
  25. <text class="flex">{{item.data.deed_num}}</text>
  26. </view>
  27. <view class="row p-t30">
  28. <view class="text-color-666"><text></text>房产地址:</view>
  29. <text class="flex">{{item.data.house_city}}{{item.data.house_address}}</text>
  30. </view>
  31. <view class="row p-t30">
  32. <view class="text-color-666"><text></text>房屋用途:</view>
  33. <text class="flex">{{item.data.house_city}}</text>
  34. </view>
  35. <view class="row p-t30">
  36. <view class="text-color-666"><text></text>建成年份:</view>
  37. <text class="flex">{{item.data.covered_area}}</text>
  38. </view>
  39. <view class="row p-t30">
  40. <view class="text-color-666"><text></text>建筑面积:</view>
  41. <text class="flex">{{item.data.covered_area}}</text>
  42. </view>
  43. <view class="row p-t30">
  44. <view class="text-color-666"><text></text>房产证件:</view>
  45. <EnImage :img="item.data.certificate_img"></EnImage>
  46. </view>
  47. <view class="row p-t30">
  48. <view class="text-color-666"><text></text>备注:</view>
  49. <text class="flex">{{item.data.remark}}</text>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="p-t30" v-else>
  54. <view class="row-justify-sb center p-b10">
  55. <text class="size-28 sys-weight-600">房产信息({{index+1}})</text>
  56. <view class="row-c sys-background-fff r-100">
  57. <image class="wh-30"
  58. src="/page_task/static/img/information/delete.png"
  59. mode="aspectFill" @click="onDeleteInfo(index)">
  60. </image>
  61. </view>
  62. </view>
  63. <en-input label="产权人" type="text" placeholder="请输入产权人" v-model="item.data.property_owner"
  64. v-if="verifyKey('property_owner')"></en-input>
  65. <en-input label="房产证号" v-model="item.data.deed_num" v-if="verifyKey('deed_num')" type="text"
  66. placeholder="请输入房产证号"></en-input>
  67. <en-city label="房产城市" v-model="item.data.house_city" v-if="verifyKey('house_city')"
  68. placeholder="请选择省、市、区"></en-city>
  69. <en-input label="房产地址" v-model="item.data.house_address" v-if="verifyKey('house_address')" type="text"
  70. placeholder="请输入房产详细地址"></en-input>
  71. <en-select label="房屋用途" v-model="item.data.house_use" v-if="verifyKey('house_use')"
  72. placeholder="请选择房屋用途" :local-data="houseTypeData"></en-select>
  73. <en-date label="建成年份" v-model="item.data.build_date" v-if="verifyKey('build_date')"
  74. placeholder="选择房屋建成年份"></en-date>
  75. <en-radio label="材料费" v-model="item.data.is_pay" v-if="verifyKey('is_pay')"
  76. :radio-data="payData"></en-radio>
  77. <en-input label="建筑面积" v-model="item.data.covered_area" v-if="verifyKey('covered_area')" type="digit"
  78. placeholder="请输入建筑面积" rightText="㎡"></en-input>
  79. <en-upload label="上传房产证件" v-model="item.data.certificate_img" v-if="verifyKey('certificate_img')"
  80. :imageWidth="180"></en-upload>
  81. <en-upload label="上传房产关联图片" v-model="item.data.property" v-if="verifyKey('property')"
  82. :imageWidth="180"></en-upload>
  83. <en-input label="备注" v-model="item.data.remark" v-if="verifyKey('remark')" type="text"
  84. placeholder="请输入备注信息" :noBox="true"></en-input>
  85. </view>
  86. </view>
  87. <en-blank message="暂无房产信息,快来添加吧!" v-if="houseList.length<=0"></en-blank>
  88. <button class="size-26 r-10 button-color house-button m-t30" hover-class="is-hover"
  89. @click="addHouse">+添加房产</button>
  90. </view>
  91. </template>
  92. <script>
  93. import {
  94. getTaskOptions
  95. } from "@/api/task";
  96. import {
  97. getSn
  98. } from "@/api/common";
  99. import md5 from "js-md5";
  100. import tools from "@/service/tools";
  101. import enInput from "@/components/en-from/en-input/en-input.vue"
  102. import EnCity from "@/components/en-from/en-city/en-city.vue";
  103. import EnUpload from "@/components/en-from/en-upload/en-upload.vue";
  104. import EnSelect from "@/components/en-from/en-select/en-select.vue";
  105. import EnDate from "@/components/en-from/en-date/en-date.vue";
  106. import EnBlank from "@/components/en-utils/en-blank/en-blank.vue";
  107. import EnImage from "@/components/en-utils/en-image/en-image.vue";
  108. export default {
  109. name: 'property-house',
  110. components: {
  111. EnBlank,
  112. EnDate,
  113. EnSelect,
  114. EnUpload,
  115. EnCity,
  116. enInput,
  117. EnImage
  118. },
  119. props: {
  120. 'showKeys': {
  121. default: []
  122. },
  123. 'value': {
  124. default: {
  125. }
  126. },
  127. 'itemKey': {
  128. default: 0
  129. }
  130. },
  131. data() {
  132. return {
  133. editIndex: 0,
  134. payData: [{
  135. 'id': 1,
  136. 'name': '已支付'
  137. }, {
  138. 'id': 2,
  139. 'name': '未支付'
  140. }],
  141. houseTypeData: [],
  142. houseItem: {
  143. 'property_owner': '',
  144. 'deed_num': '',
  145. 'house_city': '',
  146. 'house_address': '',
  147. 'house_use': '',
  148. 'build_date': '',
  149. 'is_pay': '',
  150. 'covered_area': '',
  151. 'certificate_img': [],
  152. 'property': [],
  153. 'remark': '',
  154. },
  155. houseList: []
  156. }
  157. },
  158. watch: {
  159. 'houseList': {
  160. handler() {
  161. this.$emit("input", this.houseList);
  162. },
  163. deep: true
  164. },
  165. 'value': {
  166. handler() {
  167. if (this.value) {
  168. this.setValue()
  169. }
  170. },
  171. deep: true
  172. },
  173. },
  174. mounted() {
  175. this.getTaskOptions()
  176. this.setValue()
  177. },
  178. methods: {
  179. onDeleteInfo(itemKey) {
  180. uni.showModal({
  181. title: '是否删除当前资产信息',
  182. content: '确定删除?',
  183. success: (res) => {
  184. if (res.confirm) {
  185. this.houseList.splice(itemKey, 1)
  186. }
  187. }
  188. })
  189. },
  190. onEditInfo(index){
  191. this.editIndex = index
  192. },
  193. addHouse() {
  194. tools.showLoading()
  195. getSn().then((res) => {
  196. if (res.code === 1) {
  197. this.houseList.push({
  198. 'property_type': 1,
  199. 'property_sn': res.data,
  200. 'data': JSON.parse(JSON.stringify(this.houseItem))
  201. })
  202. this.editIndex=this.houseList.length-1
  203. this.$emit('onResize')
  204. } else {
  205. tools.error('编号生成失败')
  206. }
  207. tools.hideLoading()
  208. })
  209. },
  210. setSendMd5() {
  211. let str = JSON.stringify(this.value)
  212. this.sendMd5 = md5(JSON.stringify(this.houseList))
  213. return md5(str)
  214. },
  215. setValue() {
  216. if (this.value) {
  217. let sendMd5 = this.setSendMd5()
  218. if (sendMd5 !== this.sendMd5) {
  219. this.houseList = this.value
  220. }
  221. }
  222. },
  223. verifyKey(field) {
  224. return this.showKeys.indexOf(field) >= 0
  225. },
  226. async getTaskOptions() {
  227. const res = await getTaskOptions({
  228. 'type': 3
  229. })
  230. if (res.code === 1) {
  231. res.data.houseTypeArr.forEach((val) => {
  232. this.houseTypeData.push({
  233. 'text': val.name,
  234. 'value': val.value
  235. })
  236. })
  237. }
  238. },
  239. delItem() {
  240. uni.showModal({
  241. title: '警告',
  242. content: '是否删除当前资产信息!',
  243. success: (res) => {
  244. if (res.confirm) {
  245. this.$emit('delItem', this.itemKey)
  246. }
  247. }
  248. });
  249. }
  250. }
  251. }
  252. </script>
  253. <style>
  254. .house-button {
  255. height: 70rpx;
  256. line-height: 70rpx;
  257. background: #FFFFFF;
  258. border: 1rpx solid #0FB160;
  259. }
  260. </style>