Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

select-car.vue 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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
  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. let id = item.id
  124. searchVehicleInfoQuery(item.vehicleId).then((item : any) => {
  125. console.log("====", item.vehicles[0])
  126. state.customerId = item.vehicles[0]['customerId']
  127. state.vehiclePlate = item.vehicles[0]['vehiclePlate']
  128. state.vehiclePlateColor = item.vehicles[0]['vehiclePlateColor']
  129. isWorkOrder().then((item : any) => {
  130. console.log("查询是否有工单", item)
  131. if (item.data) {
  132. if (item.data[0]['status'] == '0') {
  133. navTo(`/subpackage/after-sale/equipment-upgrade/upgrade-confirm?id=${id}&workId=${item.data[0]['id']}`)
  134. }
  135. } else {
  136. msg('暂无工单')
  137. }
  138. })
  139. })
  140. }
  141. const isWorkOrder = () => {
  142. var data = {
  143. vehiclePlate: state.vehiclePlate,
  144. vehiclePlateColor: state.vehiclePlateColor,
  145. customerId: state.customerId,
  146. };
  147. const options = {
  148. type: 2,
  149. data: data,
  150. method: "POST",
  151. showLoading: true,
  152. };
  153. return new Promise(async (resolve, reject) => {
  154. const res = await request(workOrderList, options);
  155. const data = stringToJson(res.bizContent);
  156. resolve(data);
  157. }).catch((error) => {
  158. reject(error);
  159. });
  160. }
  161. </script>
  162. <style>
  163. page {
  164. width: 100%;
  165. height: 100%;
  166. background-color: #EEF7F7;
  167. }
  168. </style>
  169. <style lang="scss" scoped>
  170. .flex {
  171. display: flex;
  172. justify-content: center;
  173. }
  174. .selectCar-box {
  175. // width: 100%;
  176. height: 100%;
  177. padding: 30rpx;
  178. .item {
  179. padding: 20rpx;
  180. display: flex;
  181. justify-content: space-between;
  182. align-items: center;
  183. // height: 130rpx;
  184. background: #FFFFFF;
  185. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  186. border-radius: 20rpx;
  187. margin-bottom: 30rpx;
  188. .iten-left {
  189. display: flex;
  190. align-items: center;
  191. image {
  192. width: 150rpx;
  193. height: 90rpx;
  194. }
  195. text {
  196. margin-left: 20rpx;
  197. font-size: 32rpx;
  198. font-family: Noto Sans S Chinese;
  199. font-weight: 400;
  200. color: #333333;
  201. }
  202. }
  203. .choose-item {
  204. width: 44rpx;
  205. height: 44rpx;
  206. background: #FFFFFF;
  207. border: 2rpx solid #00B38B;
  208. border-radius: 50%;
  209. margin-right: 20rpx;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. box-sizing: content-box;
  214. }
  215. .active {
  216. width: 34rpx;
  217. height: 34rpx;
  218. background: #00B38B;
  219. border-radius: 50%;
  220. }
  221. }
  222. }
  223. .message{
  224. font-size: 26rpx;
  225. margin-left: 6rpx;
  226. }
  227. </style>