Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

select-car.vue 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view class="selectCar-box">
  3. <view v-if="state.list.length>0" @click="choose(i,item)" class="item" v-for="(item,i) in state.list" :key="i">
  4. <view class="iten-left">
  5. <image :src="`${$imgUrl}che.png`" mode="aspectFill"></image>
  6. <view class="message">
  7. <view>车牌号:{{ item.vehiclePlate }}</view>
  8. <view>车牌颜色:{{ getVehiclePlateColor(item.vehiclePlateColor) }}</view>
  9. <view v-if="item.cardId">卡号:{{ item.cardId }}</view>
  10. <view v-if="item.cardStatus">卡状态:{{getCodeName('CARD_STATE_TYPE',item.cardStatus)}}</view>
  11. <view v-if="item.obuId">签号:{{ item.obuId }}</view>
  12. <view v-if="item.obuStatus">签状态:{{ getCodeName('OBU_STATE_TYPE',item.obuStatus) }}</view>
  13. </view>
  14. </view>
  15. <view class="choose-item">
  16. <view class="active" v-if="flag==i">
  17. </view>
  18. </view>
  19. </view>
  20. <view v-else class="flex">
  21. 暂无车辆订单信息
  22. </view>
  23. </view>
  24. </template>
  25. <script lang="ts" setup>
  26. import {
  27. reactive,
  28. ref
  29. } from "vue"
  30. import {
  31. navTo, msg,interceptND
  32. } from "@/utils/utils"
  33. import {
  34. onLoad,
  35. onShow
  36. } from "@dcloudio/uni-app";
  37. import {
  38. orderList,
  39. workOrderList,
  40. searchVehicleInfo
  41. } from "@/utils/network/api.js";
  42. import {
  43. request
  44. } from "@/utils/network/request.js";
  45. import {
  46. getItem,
  47. StorageKeys,
  48. setItem
  49. } from "@/utils/storage";
  50. import {
  51. stringToJson
  52. } from "@/utils/network/encryption";
  53. import {
  54. getCodeName
  55. } from "@/datas/queryKey.js";
  56. import {
  57. getVehiclePlateColor
  58. } from "@/datas/vehiclePlateColor";
  59. const state = reactive({
  60. list: [],
  61. businessType: "",
  62. customerId: "",
  63. vehiclePlate: "",
  64. vehiclePlateColor: ""
  65. });
  66. onLoad(() => {
  67. state.businessType = getItem('key')['DASP_PUSH_TYPE'][0]['code']
  68. quanCheckActionTrue().then((item : any) => {
  69. state.list = item.data
  70. console.log(item)
  71. })
  72. });
  73. const searchVehicleInfoQuery = (vehicleId) => {
  74. const options = {
  75. type: 2,
  76. data: {
  77. vehicleId: vehicleId
  78. },
  79. method: "POST",
  80. showLoading: true,
  81. };
  82. return new Promise(async (resolve, reject) => {
  83. const res = await request(searchVehicleInfo, options);
  84. const data = stringToJson(res.bizContent);
  85. resolve(data);
  86. }).catch((error) => {
  87. reject(error);
  88. });
  89. }
  90. const quanCheckActionTrue = () => {
  91. let source = ""
  92. // #ifdef MP-ALIPAY
  93. source = "ALI"
  94. // #endif
  95. // #ifdef MP-WEIXIN
  96. source = "WECHAT"
  97. // #endif
  98. var data = {
  99. opId: getItem(StorageKeys.OpenId),
  100. source: source,
  101. tabIndex: '0',
  102. orderStep: '11',
  103. isValueCard: '',
  104. orderStatus: "1",
  105. isAfter: true,
  106. };
  107. const options = {
  108. type: 2,
  109. data: data,
  110. method: "POST",
  111. showLoading: true,
  112. };
  113. return new Promise(async (resolve, reject) => {
  114. const res = await request(orderList, options);
  115. const data = stringToJson(res.bizContent);
  116. resolve(data);
  117. }).catch((error) => {
  118. reject(error);
  119. });
  120. }
  121. const flag = ref('0')
  122. const choose = (i, item) => {
  123. interceptND(item.vehicleId).then(()=>{
  124. let id = item.id
  125. searchVehicleInfoQuery(item.vehicleId).then((item : any) => {
  126. console.log("====", item.vehicles[0])
  127. state.customerId = item.vehicles[0]['customerId']
  128. state.vehiclePlate = item.vehicles[0]['vehiclePlate']
  129. state.vehiclePlateColor = item.vehicles[0]['vehiclePlateColor']
  130. isWorkOrder().then((item : any) => {
  131. console.log("查询是否有工单", item)
  132. if (item.data) {
  133. if (item.data[0]['status'] == '0') {
  134. navTo(`/subpackage/after-sale/equipment-upgrade/upgrade-confirm?id=${id}&workId=${item.data[0]['id']}`)
  135. }
  136. } else {
  137. msg('暂无工单')
  138. }
  139. })
  140. })
  141. })
  142. }
  143. const isWorkOrder = () => {
  144. var data = {
  145. vehiclePlate: state.vehiclePlate,
  146. vehiclePlateColor: state.vehiclePlateColor,
  147. customerId: state.customerId,
  148. };
  149. const options = {
  150. type: 2,
  151. data: data,
  152. method: "POST",
  153. showLoading: true,
  154. };
  155. return new Promise(async (resolve, reject) => {
  156. const res = await request(workOrderList, options);
  157. const data = stringToJson(res.bizContent);
  158. resolve(data);
  159. }).catch((error) => {
  160. reject(error);
  161. });
  162. }
  163. </script>
  164. <style>
  165. page {
  166. width: 100%;
  167. height: 100%;
  168. background-color: #EEF7F7;
  169. }
  170. </style>
  171. <style lang="scss" scoped>
  172. .flex {
  173. display: flex;
  174. justify-content: center;
  175. }
  176. .selectCar-box {
  177. // width: 100%;
  178. height: 100%;
  179. padding: 30rpx;
  180. .item {
  181. padding: 20rpx;
  182. display: flex;
  183. justify-content: space-between;
  184. align-items: center;
  185. // height: 130rpx;
  186. background: #FFFFFF;
  187. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  188. border-radius: 20rpx;
  189. margin-bottom: 30rpx;
  190. .iten-left {
  191. display: flex;
  192. align-items: center;
  193. image {
  194. width: 150rpx;
  195. height: 90rpx;
  196. }
  197. text {
  198. margin-left: 20rpx;
  199. font-size: 32rpx;
  200. font-family: Noto Sans S Chinese;
  201. font-weight: 400;
  202. color: #333333;
  203. }
  204. }
  205. .choose-item {
  206. width: 44rpx;
  207. height: 44rpx;
  208. background: #FFFFFF;
  209. border: 2rpx solid #00B38B;
  210. border-radius: 50%;
  211. margin-right: 20rpx;
  212. display: flex;
  213. justify-content: center;
  214. align-items: center;
  215. box-sizing: content-box;
  216. }
  217. .active {
  218. width: 34rpx;
  219. height: 34rpx;
  220. background: #00B38B;
  221. border-radius: 50%;
  222. }
  223. }
  224. }
  225. .message{
  226. font-size: 26rpx;
  227. margin-left: 6rpx;
  228. }
  229. </style>