set.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="check">
  3. <uni-forms ref="form" :model="datainfo" :rules="rules">
  4. <view class="cbox">
  5. <view class="chmain">
  6. <uni-forms-item label="房屋类型" required name="houseType">
  7. <picker range-key='dictLabel' :disabled="isdisabled" :value="fwlxidx" :range="fwlxList" @change='bindDateChangee'>
  8. <view class="flexc mh35">
  9. <view class="flex1 txr f13 co27" v-if="datainfo.houseType&&!fwlx">{{statusFormats(datainfo.houseType,fwlxList,'fwlx')}}</view>
  10. <view class="flex1 txr f13" v-else :class="fwlx?'co27':'coa'">{{fwlx||"请选择房屋类型"}}</view>
  11. <view class="rimg"><image :src="rimg"></image></view>
  12. </view>
  13. </picker>
  14. </uni-forms-item>
  15. <uni-forms-item label="物业费用" name="tenementExpense">
  16. <view class="flexc">
  17. <view class="tip">¥</view>
  18. <uni-easyinput :disabled="isdisabled" v-model="datainfo.tenementExpense" :inputBorder='false' placeholder="请输入金额" />
  19. </view>
  20. </uni-forms-item>
  21. <!-- <uni-forms-item label="车位费用" name="parkingExpense">
  22. <view class="flexc">
  23. <view class="tip">¥</view>
  24. <uni-easyinput :disabled="isdisabled" v-model="datainfo.parkingExpense" :inputBorder='false' placeholder="请输入金额" />
  25. </view>
  26. </uni-forms-item> -->
  27. <uni-forms-item label="能耗费用" name="energyExpense">
  28. <view class="flexc">
  29. <view class="tip">¥</view>
  30. <uni-easyinput :disabled="isdisabled" v-model="datainfo.energyExpense" :inputBorder='false' placeholder="请输入金额" />
  31. </view>
  32. </uni-forms-item>
  33. </view>
  34. </view>
  35. </uni-forms>
  36. <view class="pdlr12 mt55">
  37. <view class="rhbtn" @click="getEditFn" v-if="isdisabled">修改</view>
  38. <view class="rhbtn" @click="getSubmit" v-else>确定</view>
  39. </view>
  40. <loading></loading>
  41. </view>
  42. </template>
  43. <script>
  44. import config from '@/config'
  45. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  46. import {feesetAdd,feesetPut,feesetDet} from "@/api/work/manage.js"
  47. import {getDictionaryFn} from "@/api/system/user.js"
  48. import {selectValueKey} from "@/utils/common.js"
  49. export default {
  50. components: {},
  51. data() {
  52. return {
  53. rimg: require('@/people/static/people/rimg.png'),
  54. baseUrl: config.baseUrl,
  55. datainfo: {
  56. "tenementExpense":"",//应缴物业费用
  57. // "parkingExpense":"",//应缴车位费用
  58. "energyExpense":"",//应缴能耗费用
  59. "houseType":null,//房屋类型 1:普通住宅,2:洋房
  60. },
  61. rules: {
  62. houseType: {rules: [{required: true,errorMessage: '请选择房屋类型' }]},
  63. tenementExpense: {rules: [{required: true,errorMessage: '请输入物业费' }]},
  64. },
  65. id:'',
  66. ptype:'add',
  67. isdisabled:false,
  68. fwlxList:[],
  69. fwlxidx:'',
  70. fwlx:'',
  71. }
  72. },
  73. onLoad: function(e) {
  74. if(e.id){
  75. this.id=e.id;
  76. this.ptype='edit';
  77. // this.isdisabled=true;
  78. this.getDetailFn()
  79. }
  80. this.init()
  81. },
  82. methods: {
  83. checkPermi,
  84. checkRole,
  85. init(){
  86. // 房屋类型
  87. getDictionaryFn('house_type').then(res=>{
  88. if(res.code==200){
  89. this.fwlxList = res.data.map(v => {
  90. return {
  91. dictLabel: v.dictLabel,
  92. dictValue: v.dictValue
  93. }
  94. })
  95. if(res.data&&res.data.length){
  96. this.datainfo.houseType=res.data[0].dictValue
  97. }
  98. }
  99. })
  100. },
  101. statusFormats(data, list,type) {
  102. var aite=selectValueKey(list, data);
  103. if(type=='fwlx'){
  104. this.fwlxidx=aite.key;
  105. }
  106. return aite.actions;
  107. },
  108. bindDateChangee(e){
  109. var val=e.detail.value;
  110. this.datainfo.houseType=this.fwlxList[val].dictValue;
  111. this.fwlx=this.fwlxList[val].dictLabel;
  112. },
  113. getEditFn(){
  114. this.isdisabled=false;
  115. },
  116. getSubmit(){
  117. var that=this;
  118. this.$refs.form.validate().then(res => {
  119. var params=JSON.parse(JSON.stringify(this.datainfo))
  120. if(this.ptype=='add'){
  121. feesetAdd(params).then(res=>{
  122. if(res.code==200){
  123. this.$toast("新增成功")
  124. setTimeout(function(){
  125. uni.$emit("refsetList")
  126. uni.navigateBack({
  127. delta:1
  128. })
  129. },1500)
  130. }
  131. })
  132. }else{
  133. feesetPut(params).then(res=>{
  134. if(res.code==200){
  135. this.$toast("修改成功")
  136. setTimeout(function(){
  137. uni.$emit("refsetList")
  138. uni.navigateBack({
  139. delta:1
  140. })
  141. },1500)
  142. }
  143. })
  144. }
  145. })
  146. },
  147. getDetailFn(){
  148. feesetDet(this.id).then(res=>{
  149. if(res.code==200){
  150. this.datainfo=res.data;
  151. }
  152. })
  153. },
  154. }
  155. }
  156. </script>
  157. <style>
  158. page{background: #F3F3F0;}
  159. </style>
  160. <style lang="scss" scoped>
  161. .check /deep/ .uni-forms-item__error{left:auto;right: 0;margin-top: 10rpx;z-index: 1;}
  162. .check /deep/ .uni-forms-item{min-height: 106rpx;box-sizing: border-box;display: flex;align-items: center;margin-bottom: 0;border-bottom: 2rpx solid #E6E6E6;padding:10rpx 0;}
  163. .check .cbox /deep/ .uni-forms-item:last-child{border: none;}
  164. .check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
  165. .check /deep/ .uni-easyinput{flex: 1;text-align: left;font-size: 26rpx;color: #222327;}
  166. .check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
  167. .check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
  168. .check /deep/ .uni-input-input{font-size: 26rpx;}
  169. .check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
  170. .check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
  171. .check /deep/ .uni-data-checklist .checklist-group .checklist-box{margin:10rpx 8rpx 10rpx 16rpx;}
  172. .check /deep/ .uni-data-checklist{flex: 0 0 auto;}
  173. .check{min-height: 100vh;padding: 20rpx 18rpx 24rpx;box-sizing: border-box;}
  174. .cbox{background: #FFFFFF;border-radius: 20rpx;flex: 1;margin-bottom: 24rpx;
  175. .chmain{
  176. padding: 0 32rpx;
  177. .tip{font-weight: bold;font-size: 36rpx;color: #161616;flex: 1;text-align: right;}
  178. .rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
  179. image{width: 100%;height: 100%;}
  180. }
  181. }
  182. }
  183. </style>