house.vue 8.9 KB

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