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.

install-activation-order.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <!-- 安装激活-选择订单 -->
  2. <template>
  3. <empty-view :mode="config.emptyHint.mode" :content="config.emptyHint.hint" v-if="params.ordersList.length === 0" />
  4. <view class="list" v-else>
  5. <view class="item" v-for="(item,index) in params.ordersList" :key="index" :item="item">
  6. <view class="head">
  7. <view class="name">
  8. <image :src="`${$imgUrl}order/icon-star-green.png`" class="icon"></image>
  9. <text class="title">{{item.productName ?item.productName: ''}}</text>
  10. </view>
  11. <view class="status text-orange">{{getOrderStatusName(item.orderStep)}}</view>
  12. </view>
  13. <view class="detail">
  14. <view class="orders">
  15. <view class="order-text" v-if="item.cardId">
  16. <text class="type">卡号:</text>
  17. <text class="value">{{item.cardId}}</text>
  18. </view>
  19. <view class="order-text" v-if="item.obuId">
  20. <text class="type">签号:</text>
  21. <text class="value">{{item.obuId}}</text>
  22. </view>
  23. <!-- <view class="order-text odd">
  24. <text class="type">业务类型:</text>
  25. <text class="value">{{getOrderTypeName(item.orderType)}}</text>
  26. </view> -->
  27. <view class="order-text odd">
  28. <text class="type">订单车牌号:</text>
  29. <text class="value">{{item.vehiclePlate}}</text>
  30. </view>
  31. <view class="order-text ">
  32. <text class="type">订单车牌颜色:</text>
  33. <text class="value">{{getVehiclePlateColor(item.vehiclePlateColor)}}</text>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="btns">
  38. <view class="btn btn-primary as-gravity-center" @click="gotoConfirmReceipt(item)"
  39. v-if="item.status==2">确认收货</view>
  40. <view class="btn btn-primary as-gravity-center" @click="gotoActiveOrder(item)"
  41. v-if="item.status==1">去激活</view>
  42. <view class="btn btn-primary as-gravity-center" @click="gotoOnceActivate(item)"
  43. v-if="item.status==3">OBU重新激活</view>
  44. </view>
  45. </view>
  46. <uni-load-more :status="params.status" iconType="snow" :icon-size="16" :content-text="config.contentTxt"
  47. v-if="params.ordersList.length > 0" />
  48. </view>
  49. </template>
  50. <script setup lang="ts">
  51. import { reactive, ref, watch } from "vue";
  52. import { request, requestNew } from "@/utils/network/request.js";
  53. import { stringToJson } from "@/utils/network/encryption";
  54. import { onLoad, onUnload, onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app";
  55. import { getItem, StorageKeys,setItem } from "@/utils/storage";
  56. import { hasLogin, msg, getOrderStatusName, getOrderTypeName, navTo,interceptND } from "@/utils/utils";
  57. import { queryActiveInfo,ndActivateVerification,silentLoginApi} from "@/utils/network/api";
  58. import useOrderSkip from "@/composables/order/useOrderSkip";
  59. import { deviceType } from "@/utils/network/difference";
  60. import { jump } from "@/datas/9901Jump.js";
  61. import {
  62. getVehiclePlateColor
  63. } from "@/datas/vehiclePlateColor";
  64. //跳转
  65. const { gotoActiveOrder, gotoConfirmReceipt } = useOrderSkip();
  66. const gotoOnceActivate = (item) => {
  67. if (item.deviceType == deviceType) {
  68. const params = encodeURIComponent(JSON.stringify(item))
  69. jump("1", params)
  70. } else {
  71. let vehicleId=item.vehiclePlate+"_"+item.vehiclePlateColor
  72. // #ifdef MP-WEIXIN
  73. navTo(
  74. `/subpackage/after-sale/activation-once-again/activation-once-again?vehicleId=${item.vehicleId}`
  75. );
  76. // #endif
  77. // #ifdef MP-ALIPAY
  78. navTo(
  79. `/subpackage/after-sale/activation-once-again/activation-once-again-ali?vehicleId=${item.vehicleId}`
  80. );
  81. // #endif
  82. }
  83. }
  84. const config = {
  85. emptyHint: {
  86. hint: '~ 暂无待激活订单 ~',
  87. icon: '',
  88. mode: 'order'
  89. },
  90. contentTxt: {
  91. contentdown: '~上拉加载更多~',
  92. contentrefresh: '努力加载中...',
  93. contentnomore: '-- 我是有底线的 --'
  94. }
  95. }
  96. //请求参数
  97. const params = reactive({
  98. pageNo: 1,
  99. pageSize: 10,
  100. total: 0,
  101. status: 'more',
  102. reload: false,
  103. ordersList: [],
  104. vehicleId:"",
  105. tel:"",
  106. qdOrderNo:""
  107. })
  108. /* 刷新列表 */
  109. const refreshList = () => {
  110. params.pageNo = 1;
  111. params.total = 0;
  112. params.ordersList = [];
  113. params.status = 'more';
  114. params.reload = false;
  115. getList();
  116. }
  117. /* 加载更多 */
  118. const loadMore = () => {
  119. if (params.ordersList.length<params.pageNo*10) {
  120. params.status = 'noMore';
  121. } else {
  122. params.status = 'loading';
  123. params.pageNo++;
  124. getList();
  125. }
  126. }
  127. /* 获取列表数据 */
  128. const getList = async () => {
  129. if (!hasLogin()) {
  130. uni.stopPullDownRefresh();
  131. return;
  132. }
  133. let source = ""
  134. // #ifdef MP-ALIPAY
  135. source = "ALI"
  136. // #endif
  137. // #ifdef MP-WEIXIN
  138. source = "WECHAT"
  139. // #endif
  140. let res : any = null;
  141. const options = {
  142. type: 2,
  143. data: {
  144. "opId": getItem(StorageKeys.OpenId),
  145. // "pageNo": params.pageNo,
  146. // "pageSize": params.pageSize,
  147. },
  148. method: 'POST',
  149. showLoading: params.pageNo === 1 ? true : false,
  150. }
  151. try {
  152. res = await requestNew(queryActiveInfo, options);
  153. const data =res;
  154. console.log("data===",data)
  155. params.total = data.data;
  156. console.log("res====", params.total)
  157. if (data.activeList.length > 0 || data.receiveList.length > 0 || data.secondActiveList.length > 0) {
  158. // status 1 首次激活车辆信息列表 2确认收货车辆信息列表 3二次激活车辆信息列表
  159. var activeList=data.activeList
  160. var receiveList=data.receiveList
  161. var secondActiveList=data.secondActiveList
  162. if (data.activeList.length > 0){
  163. for(var i=0;i<activeList.length;i++){
  164. activeList[i]['status']=1
  165. }
  166. }
  167. if (data.receiveList.length > 0){
  168. for(var i=0;i<receiveList.length;i++){
  169. receiveList[i]['status']=2
  170. }
  171. }
  172. if (data.secondActiveList.length > 0){
  173. for(var i=0;i<secondActiveList.length;i++){
  174. secondActiveList[i]['status']=3
  175. }
  176. }
  177. const curList = [...activeList,...receiveList,...secondActiveList] || [];
  178. params.ordersList = params.reload ? curList : params.ordersList.concat(curList);
  179. params.reload = false;
  180. }
  181. if (params.total === params.ordersList.length) {
  182. params.reload = false;
  183. params.status = 'noMore';
  184. }
  185. if (params.pageNo === 1) {
  186. uni.stopPullDownRefresh();
  187. }
  188. console.log("params.ordersList", params.ordersList)
  189. } catch (e) {
  190. console.log('输出内容', e)
  191. uni.stopPullDownRefresh();
  192. }
  193. }
  194. onLoad((option) => {
  195. console.log("诺德激活",option)
  196. // 诺德数据过来 验证+无感登录
  197. if(option.qdOrderNo){
  198. params.qdOrderNo=option.qdOrderNo
  199. params.tel=option.tel
  200. params.vehicleId=option.vehicleId
  201. ndActivateVerificationQuery().then((data) => {
  202. if(data.pass=='on'){
  203. console.log("验证")
  204. silentLogin(data).then(() => {
  205. //监听订单刷新信息
  206. uni.$on('refreshOrder', (data) => {
  207. refreshList();
  208. });
  209. console.log("guoliale")
  210. refreshList();
  211. })
  212. }else{
  213. msg("不属于该渠道")
  214. }
  215. })
  216. }else{
  217. //监听订单刷新信息
  218. uni.$on('refreshOrder', (data) => {
  219. refreshList();
  220. });
  221. console.log("guoliale")
  222. refreshList();
  223. }
  224. });
  225. // 诺德激活验证接口
  226. const ndActivateVerificationQuery = () => {
  227. const options = {
  228. type: 2,
  229. data: {
  230. "code": "1", //诺德
  231. "qdOrderNo": params.qdOrderNo, //渠道订单号
  232. "tel": params.tel,
  233. "vehicleId": params.vehicleId,
  234. },
  235. method: "POST",
  236. showLoading: true,
  237. };
  238. return new Promise(async (resolve, reject) => {
  239. const res = await request(ndActivateVerification, options);
  240. const data = stringToJson(res.bizContent);
  241. console.log("data==", data)
  242. resolve(data);
  243. }).catch((error) => {
  244. reject(error);
  245. });
  246. }
  247. const silentLogin = (data) => {
  248. if (data.userType == "1") {
  249. var datas = {
  250. userType: data.userType,
  251. account: data.mobile,
  252. loginSource: getItem("loginSource"),
  253. };
  254. } else {
  255. var datas = {
  256. userType: data.userType,
  257. account: data.idNum,
  258. loginSource: getItem("loginSource"),
  259. };
  260. }
  261. console.log("datas",datas)
  262. const options = {
  263. type: 2,
  264. data: datas,
  265. method: "POST",
  266. showLoading: true,
  267. };
  268. return new Promise(async (resolve, reject) => {
  269. const res = await request(silentLoginApi, options);
  270. const data = stringToJson(res.bizContent);
  271. console.log("data===",data)
  272. setItem("openId", data.openId);
  273. setItem("token", data.accessToken);
  274. resolve(data);
  275. }).catch((error) => {
  276. reject(error);
  277. });
  278. }
  279. onUnload(() => {
  280. uni.$off('refreshOrder');
  281. });
  282. onPullDownRefresh(() => {
  283. refreshList();
  284. });
  285. // onReachBottom(() => {
  286. // loadMore();
  287. // });
  288. </script>
  289. <style>
  290. page {
  291. background-color: #EEF7F7;
  292. }
  293. </style>
  294. <style lang="scss" scoped>
  295. .list {
  296. padding: 30rpx 30rpx 0rpx;
  297. display: flex;
  298. flex-direction: column;
  299. }
  300. .list .item {
  301. background: #ffffff;
  302. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  303. border-radius: 20rpx;
  304. box-sizing: border-box;
  305. display: flex;
  306. flex-direction: column;
  307. margin-bottom: 30rpx;
  308. }
  309. .list .item .head {
  310. display: flex;
  311. justify-content: space-between;
  312. align-items: center;
  313. padding: 20rpx 28rpx;
  314. border-bottom: 1px solid #dcdcdc;
  315. }
  316. .list .item .head .icon {
  317. width: 48rpx;
  318. height: 48rpx;
  319. }
  320. .list .item .head .name {
  321. display: flex;
  322. align-items: center;
  323. }
  324. .list .text-green {
  325. font-size: 26rpx;
  326. color: #00b38b;
  327. }
  328. .list .text-orange {
  329. font-size: 26rpx;
  330. color: #ff8000;
  331. }
  332. .list .title {
  333. font-size: 30rpx;
  334. color: #333;
  335. }
  336. .list .detail {
  337. display: flex;
  338. justify-content: space-between;
  339. align-items: center;
  340. padding: 30rpx 32rpx;
  341. }
  342. .list .detail .type {
  343. font-size: 26rpx;
  344. color: #999;
  345. }
  346. .list .detail .value {
  347. font-size: 26rpx;
  348. color: #333;
  349. }
  350. .list .finished .detail .value {
  351. color: #999;
  352. }
  353. .list .detail .odd {
  354. margin: 20rpx 0;
  355. }
  356. .list .cny {
  357. font-size: 26rpx;
  358. color: #333;
  359. }
  360. .list .finished .cny {
  361. color: #999;
  362. }
  363. .list .amount {
  364. font-size: 40rpx;
  365. font-weight: bold;
  366. }
  367. .list .finished .amount {
  368. color: #999;
  369. }
  370. .list .btns {
  371. display: flex;
  372. align-items: center;
  373. justify-content: flex-end;
  374. border-top: 1px solid #dcdcdc;
  375. margin: 0 30rpx;
  376. padding: 20rpx 0;
  377. }
  378. .list .btn {
  379. height: 60rpx;
  380. // line-height: 60rpx;
  381. border-radius: 30rpx;
  382. padding: 0 24rpx;
  383. font-size: 26rpx;
  384. box-sizing: border-box;
  385. margin-right: 20rpx;
  386. }
  387. .list .btns .btn:last-child {
  388. margin: 0;
  389. }
  390. .list .btn-primary {
  391. border: 1px solid #00b38b;
  392. color: #00b38b;
  393. }
  394. .list .btn-normal {
  395. border: 1px solid #dcdcdc;
  396. color: #333;
  397. }
  398. </style>