您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

my-etc-account.vue 5.7KB

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