dataDetail.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <el-row class="el-row-container">
  3. <el-card style="margin:16px;min-height: calc(100% - 32px); overflow-y: auto">
  4. <el-row style="margin-bottom: 10px">
  5. <el-col :span="12" class="header-label">
  6. 基础信息
  7. </el-col>
  8. <el-col :span="12" style="text-align:right">
  9. <el-button type="primary" @click="backPage">返回</el-button>
  10. </el-col>
  11. </el-row>
  12. <el-row>
  13. <el-col :span="5">
  14. <span class="label"><span>IC卡卡号:</span>{{baseForm.cardNo}}</span>
  15. </el-col>
  16. <el-col :span="5">
  17. <span class="label"><span>农户姓名:</span>{{baseForm.farmerName}}</span></el-col>
  18. <el-col :span="5">
  19. <span class="label"><span>卡状态:</span>{{baseForm.cardStatusContent}}</span></el-col>
  20. <el-col :span="4">
  21. <span class="label"><span>办卡时间:</span>{{baseForm.cardCreateddate}}</span></el-col>
  22. <el-col :span="5">
  23. <span class="label"><span>所属区域:</span>{{baseForm.areaFullName}}</span></el-col>
  24. </el-row>
  25. <el-row style="margin: 20px 0">
  26. <el-col :span="5">
  27. <span class="label"><span>总用水量:</span>{{baseForm.waterNumTotal || 0}} m³</span>
  28. </el-col>
  29. <el-col :span="5">
  30. <span class="label"><span>总用电量:</span>{{baseForm.electricNumTotal || 0}} 度</span></el-col>
  31. </el-row>
  32. <div class="dateType">
  33. <el-date-picker
  34. v-model="dateValue"
  35. clearable
  36. value-format="yyyy-MM-dd HH:mm:ss"
  37. :default-time="['00:00:00', '23:59:59']"
  38. type="daterange"
  39. range-separator="至"
  40. start-placeholder="开始日期"
  41. end-placeholder="结束日期">
  42. </el-date-picker>
  43. <el-button type="primary" style="margin-left:10px;" @click="handleSearch">查询</el-button>
  44. </div>
  45. <el-tabs v-model="activeName">
  46. <el-tab-pane
  47. label="灌溉记录"
  48. name="irrigation"
  49. >
  50. <b-table
  51. ref="tableRef"
  52. :args="{ 'highlight-current-row': true }"
  53. :data="cardusercdList"
  54. :columns="columns1"
  55. isShowIndex
  56. >
  57. <template #cardusercdBillingtype="scope">
  58. {{ scope.row.cardusercdBillingtype === '0' ? '综合计价' : '阶梯计价' }}
  59. </template>
  60. </b-table>
  61. </el-tab-pane>
  62. <el-tab-pane
  63. label="充值记录"
  64. name="recharge"
  65. >
  66. <b-table
  67. ref="tableRechargercd"
  68. :args="{ 'highlight-current-row': true }"
  69. :data="rechargercdList"
  70. :columns="columns2"
  71. isShowIndex
  72. >
  73. <template #ICCard="scope">
  74. {{ scope }}
  75. <b-table
  76. :args="{ 'highlight-current-row': true }"
  77. :data="loadData"
  78. :columns="scope.columns"
  79. isShowIndex
  80. >
  81. </b-table>
  82. </template>
  83. <template #rechargercdRechargeamount="scope">
  84. <el-link
  85. type="primary"
  86. :underline="false"
  87. >+{{ Number(scope.row.rechargercdRechargeamount).toFixed(2) }}</el-link
  88. >
  89. </template>
  90. <template #cardAmount="scope">
  91. {{ Number(scope.row.cardAmount).toFixed(2) }}
  92. </template>
  93. </b-table>
  94. </el-tab-pane>
  95. </el-tabs>
  96. </el-card>
  97. </el-row>
  98. </template>
  99. <script>
  100. import { getCardDetail,getRechargercdList, getCardusercdList } from '@/api/card/index.js'
  101. import BTable from '@/components/Table/index.vue';
  102. export default {
  103. name: 'dataDetail',
  104. props: {
  105. detailCardId:{
  106. type:String,
  107. }
  108. },
  109. components:{
  110. BTable
  111. },
  112. data() {
  113. return {
  114. activeName: 'irrigation',
  115. baseForm: {},
  116. dateValue: '',
  117. columns1: [
  118. {
  119. label: '水源编号',
  120. prop: 'waterNum',
  121. customRender: '',
  122. align: 'center',
  123. },
  124. {
  125. label: '水源名称',
  126. prop: 'waterName',
  127. customRender: '',
  128. align: 'center'
  129. },
  130. {
  131. label: '本次耗水量(m³)',
  132. prop: 'cardusercdWaternum',
  133. customRender: '',
  134. align: 'center'
  135. },
  136. {
  137. label: '本次用电量(度)',
  138. prop: 'cardusercdElectricnum',
  139. customRender: '',
  140. align: 'center'
  141. },
  142. {
  143. label: '开始时间',
  144. prop: 'cardusercdStarttime',
  145. customRender: '',
  146. align: 'center'
  147. },
  148. {
  149. label: '结束时间',
  150. prop: 'cardusercdEndtime',
  151. customRender: '',
  152. align: 'center'
  153. },
  154. // {
  155. // label: '使用时长',
  156. // prop: 'cardusercdDuration',
  157. // customRender: '',
  158. // align: 'center'
  159. // },
  160. {
  161. label: '计费方式',
  162. prop: 'cardusercdBillingtype',
  163. customRender: 'cardusercdBillingtype',
  164. align: 'center'
  165. },
  166. // {
  167. // label: '计费标准',
  168. // prop: 'cardusercdPriceinfo',
  169. // customRender: '',
  170. // align: 'center'
  171. // },
  172. {
  173. label: '扣除金额',
  174. prop: 'cardusercdUsemoney',
  175. customRender: '',
  176. align: 'center'
  177. }
  178. ],
  179. columns2: [
  180. {
  181. label: 'IC卡号',
  182. prop: 'cardNo',
  183. customRender: '',
  184. align: 'center',
  185. },
  186. {
  187. label: '充值金额(元)',
  188. prop: 'rechargercdRechargeamount',
  189. customRender: 'rechargercdRechargeamount',
  190. align: 'center'
  191. },
  192. {
  193. label: '充值后金额(元)',
  194. prop: 'cardAmount',
  195. customRender: 'cardAmount',
  196. align: 'center'
  197. },
  198. {
  199. label: '充值时间',
  200. prop: 'rechargercdRechargetime',
  201. customRender: '',
  202. align: 'center'
  203. }
  204. ]
  205. };
  206. },
  207. methods: {
  208. async rechargercdList() {
  209. const res = await getCardDetail({
  210. cardId:this.detailCardId
  211. })
  212. this.baseForm = res.data
  213. return this.getRechargercdData(res.data);
  214. },
  215. async cardusercdList() {
  216. const res = await getCardDetail({
  217. cardId: this.detailCardId
  218. })
  219. this.baseForm = res.data
  220. return this.getCardusercdListHandler(res.data)
  221. },
  222. getCardusercdListHandler(payload) {
  223. const { cardId } = payload
  224. const [startTime, endTime] = this.dateValue || []
  225. return getCardusercdList({
  226. cardId,
  227. startTime,
  228. endTime
  229. })
  230. },
  231. getRechargercdData(payload) {
  232. const {farmerId,cardNo,cardId} = payload
  233. const [startTime, endTime] = this.dateValue || []
  234. return getRechargercdList({
  235. farmerId,
  236. cardNo,
  237. cardId,
  238. startTime,
  239. endTime
  240. })
  241. },
  242. backPage() {
  243. this.$emit("backPage")
  244. },
  245. resetForm(formName) {
  246. this.$refs[formName].resetFields();
  247. this.resetFormData();
  248. this.dialogVisible = false;
  249. },
  250. resetFormData() {
  251. this.baseForm = {};
  252. },
  253. handleSearch() {
  254. this.activeName === 'recharge' ? this.$refs.tableRechargercd.refresh(true) : this.$refs.tableRef.refresh(true)
  255. },
  256. submitForm(formName) {
  257. this.$refs[formName].validate((valid) => {
  258. console.log(valid)
  259. })
  260. },
  261. handleClose() {
  262. this.$emit('update:visible', false);
  263. this.resetForm('baseForm');
  264. },
  265. }
  266. };
  267. </script>
  268. <style lang="scss" scoped>
  269. .el-row-container{
  270. height: calc(100% - 32px);
  271. .header-label{
  272. color: #333333;
  273. font-size: 16px;
  274. font-weight: 700;
  275. font-family: "Source Han Sans CN VF";
  276. text-align: left;
  277. }
  278. }
  279. ::v-deep .el-card__body{
  280. position: relative;
  281. }
  282. .dateType{
  283. position: absolute;
  284. right: 20px;
  285. margin-top: -5px;
  286. width: 500px;
  287. text-align: right;
  288. z-index:1000;
  289. }
  290. ::v-deep.el-dialog__title{
  291. color: #333333;
  292. font-size: 16px;
  293. font-weight: 700;
  294. }
  295. .input-number {
  296. width: 100%;
  297. }
  298. .base-form {
  299. max-height: 70vh;
  300. overflow-y: auto;
  301. overflow-x: hidden;
  302. padding: 0 20px;
  303. }
  304. .label{
  305. color: #333;
  306. span{
  307. color: #999;
  308. font-size: 14px;
  309. font-style: normal;
  310. }
  311. }
  312. </style>
  313. <style lang="css" scoped>
  314. ::v-deep .el-dialog__header {
  315. border-bottom: 1px solid #ebeef5;
  316. }
  317. </style>