You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

my-etc-account.vue 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view class="content">
  3. <view class="title" v-if="state.personArr.length>0">您名下个人ETC账户</view>
  4. <radio-group class="uni-list" @change="radioChange">
  5. <label class="item" v-for="(item,index) in state.personArr" :key="item.customerId">
  6. <image class="img" :src="`${$imgUrl}myImage/personimg.png`" mode=""></image>
  7. <view class="details">
  8. <view class="top">
  9. <text class="name">{{item.userName}}</text>
  10. <text class="acount" v-if="item.customerIdChoice">当前绑定账户</text>
  11. </view>
  12. <view class="car">{{item.vehicleCount?item.vehicleCount:'无'}}辆车</view>
  13. </view>
  14. <radio :id="item.customerId" :value="item.customerId" :checked="item.customerId==state.customerId" style="scale: 0.8;"></radio>
  15. </label>
  16. </radio-group>
  17. <view class="title" v-if="state.uniArr.length>0">您名下单位ETC账户</view>
  18. <radio-group class="uni-list" @change="radioChange">
  19. <label class="item_father" v-for="(item,index) in state.uniArr" :key="item.customerId">
  20. <view class="danwei">
  21. <view class="item1">
  22. <image class="img" :src="`${$imgUrl}myImage/unit.png`" mode=""></image>
  23. <view class="details">
  24. <view class="top">
  25. <text class="name">{{item.userName}}</text>
  26. </view>
  27. <view>
  28. <text class="car">{{item.vehicleCount?item.vehicleCount:'无'}}车辆</text>
  29. <text class="acount" v-if="item.customerIdChoice">当前绑定账户</text>
  30. </view>
  31. </view>
  32. <radio :id="item.customerId" :value="item.customerId" :checked="item.customerId==state.customerId" style="scale: 0.8;"></radio>
  33. </view>
  34. <view class="unit-list">
  35. <text>证件类型</text>
  36. <text>{{getCredentialType(item.idType)}}</text>
  37. </view>
  38. <view class="unit-list">
  39. <text>证件号码</text>
  40. <text>{{item.idNumStr}}</text>
  41. </view>
  42. <view class="unit-list">
  43. <text>分支机构</text>
  44. <text>{{item.department}}</text>
  45. </view>
  46. </view>
  47. </label>
  48. </radio-group>
  49. </view>
  50. </template>
  51. <script setup lang="ts">
  52. import { reactive,ref } from "vue";
  53. import { onLoad } from "@dcloudio/uni-app";
  54. import { requestNew } from "@/utils/network/request.js";
  55. import { customerQuery } from "@/utils/network/api.js";
  56. import { setItem,getItem } from "../../utils/storage";
  57. import {
  58. getCredentialType
  59. } from "@/datas/credentialType.js";
  60. const state = reactive({
  61. personArr:ref([]),
  62. uniArr:ref([]),
  63. allData:[],
  64. userType:"",
  65. customerId:""
  66. })
  67. onLoad(() => {
  68. customerQueryInfo()
  69. });
  70. const customerQueryInfo = () => {
  71. const options = {
  72. type: 2,
  73. data: {},
  74. method: "POST",
  75. showLoading: true,
  76. };
  77. //调用方式
  78. requestNew(customerQuery, options)
  79. .then((res) => {
  80. console.log('用户信息', res)
  81. state.allData=res
  82. const customerId=getItem('customerObj')?getItem('customerObj')['customerId']:""
  83. for(var i=0;i<res.length;i++){
  84. // 当前关联某个账户
  85. if(res[i]['customerId']==customerId){
  86. res[i]['customerIdChoice']=true
  87. }else{
  88. res[i]['customerIdChoice']=false
  89. }
  90. res[i]['idNumStr']=res[i]['idNum'].replace(/^.{14}/,'**************')
  91. if(res[i]['userType']==1){
  92. state.personArr.push(res[i])
  93. }else{
  94. state.uniArr.push(res[i])
  95. }
  96. }
  97. })
  98. .catch((err) => {
  99. console.log(err);
  100. });
  101. }
  102. const radioChange = (e) => {
  103. console.log("e", e.detail.value)
  104. state.customerId=e.detail.value
  105. let value=e.detail.value
  106. const choiceData = state.allData.filter(item => item.customerId == value);
  107. // 清空对方数组选择
  108. console.log("state.userType",state.userType,choiceData)
  109. console.log("state.personArr",state.personArr,state.uniArr)
  110. uni.showModal({
  111. title: '提示',
  112. content: '确定绑定账户',
  113. success: function (res) {
  114. if (res.confirm) {
  115. setItem('customerObj',choiceData[0])
  116. uni.navigateBack()
  117. } else if (res.cancel) {
  118. console.log('用户点击取消');
  119. }
  120. }
  121. });
  122. console.log("choiceData",choiceData)
  123. }
  124. </script>
  125. <style scoped lang="scss">
  126. .content {
  127. padding: 0 30rpx;
  128. .title {
  129. font-size: 28rpx;
  130. color: #666666;
  131. margin: 30rpx 0 20rpx 20rpx;
  132. }
  133. .uni-list {
  134. .item1 {
  135. background: white;
  136. margin-bottom: 20rpx;
  137. display: flex;
  138. border-radius: 20rpx;
  139. padding: 20rpx 0;
  140. display: flex;
  141. align-items: center;
  142. .details {
  143. width: 76%;
  144. margin-left: 26rpx;
  145. .top {
  146. margin-bottom: 6rpx;
  147. .name {
  148. font-size: 30rpx;
  149. color: #01243A;
  150. }
  151. }
  152. }
  153. .img {
  154. width: 80rpx;
  155. height: 80rpx;
  156. }
  157. }
  158. .item {
  159. background: white;
  160. margin-bottom: 20rpx;
  161. display: flex;
  162. border-radius: 20rpx;
  163. padding: 20rpx;
  164. display: flex;
  165. align-items: center;
  166. .details {
  167. width: 76%;
  168. margin-left: 26rpx;
  169. .top {
  170. margin-bottom: 6rpx;
  171. .name {
  172. font-size: 30rpx;
  173. color: #01243A;
  174. }
  175. }
  176. }
  177. .img {
  178. width: 80rpx;
  179. height: 80rpx;
  180. }
  181. }
  182. }
  183. }
  184. .item_father {
  185. background: white !important;
  186. }
  187. .unit-list {
  188. display: flex;
  189. justify-content: space-between;
  190. margin-bottom: 10rpx;
  191. }
  192. .unit-list>text:first-child {
  193. font-size: 24rpx;
  194. color: #888888;
  195. }
  196. .unit-list>text:last-child {
  197. font-size: 26rpx;
  198. color: #444444;
  199. }
  200. .acount {
  201. background: #F9F5EB;
  202. border-radius: 6rpx;
  203. border: 1px solid #CCB375;
  204. font-size: 22rpx;
  205. color: #CCB375;
  206. margin-left: 10rpx;
  207. }
  208. .car {
  209. font-size: 24rpx;
  210. color: #01243A;
  211. }
  212. .danwei {
  213. background: white;
  214. border-radius: 20rpx;
  215. padding: 20rpx;
  216. margin-bottom: 20rpx;
  217. }
  218. </style>