house.vue 8.7 KB

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