Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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