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.

order-details-new.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. <!-- 新办订单-订单详情 -->
  2. <template>
  3. <navBar title="订单详情" navbgClass="nav-bgXin" fontColor='#fff' :scrollTop="scrollTop"></navBar>
  4. <view class="bg-img">
  5. <image :src="`${$imgUrl}order/bg-order.png`" mode="scaleToFill" class="icon"></image>
  6. </view>
  7. <view class="content">
  8. <view class="status">
  9. <text v-if="state.orderInfo.orderStep == 12 && state.reshipment=='1'">补货中</text>
  10. <text
  11. v-if="state.orderInfo.orderStatus == OrderStatus.已取消 && state.orderInfo.remoteStatus=='7'">审核不通过</text>
  12. <text v-else-if="state.orderInfo.orderStep == 35">下单</text>
  13. <text
  14. v-else>{{state.orderInfo.orderStatus == OrderStatus.已取消 ? '已取消' : $util.getOrderStatusName(state.orderInfo.orderStep)}}</text>
  15. </view>
  16. <view>
  17. <text>创建时间:</text>
  18. <text>{{getOrderTime(state.orderInfo.insertTime)}}</text>
  19. </view>
  20. <view class="order">
  21. <view class="num">
  22. <text>订单号:</text>
  23. <text>{{state.orderInfo.orderNo}}</text>
  24. </view>
  25. <view class="name" v-if="$util.getOrderStatusName(state.orderInfo.orderStep)=='已完成'">
  26. <text>付款时间:</text>
  27. <text>{{getOrderTime(state.orderInfo.orderInfoExt?state.orderInfo.orderInfoExt.payTime:"")}}</text>
  28. </view>
  29. <view class="name" v-else>
  30. <text>产品名称:</text>
  31. <text>{{state.orderInfo.productName ?state.orderInfo.productName: ''}}</text>
  32. </view>
  33. </view>
  34. <view class="message" v-if="state.orderInfo.orderInfoExt">
  35. <view class="message-top1">
  36. <view class="msg">
  37. <view class="vehiclePlate">
  38. <text>快递单号:</text>
  39. <text>{{state.orderInfo.orderInfoExt?state.orderInfo.orderInfoExt: ''}}</text>
  40. <image style="width: 36rpx;height: 36rpx;position: relative;top: -4rpx;"
  41. :src="`${$imgUrl}order/copy-template.png`" @click="copy(state.orderInfo.orderInfoExt)">
  42. </image>
  43. </view>
  44. <view>
  45. <text>物流公司:</text>
  46. <text>{{state.orderInfo.orderInfoExt?getCodeName('快递物流公司',state.orderInfo.orderInfoExt.courierCompany): ''}}</text>
  47. </view>
  48. <view>
  49. <text>发货时间:</text>
  50. <text>{{getOrderTime(state.orderInfo.orderInfoExt?state.orderInfo.orderInfoExt.deliveryTime:"")}}</text>
  51. </view>
  52. <view>
  53. <text>收货时间:</text>
  54. <text>{{getOrderTime(state.orderInfo.orderInfoExt?state.orderInfo.orderInfoExt.receivingTime:"")}}</text>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="message" v-if="state.orderInfo.cardId">
  60. <view class="message-top1">
  61. <image :src="`${$imgUrl}order/obu.png`" mode=""></image>
  62. <view class="msg">
  63. <view class="vehiclePlate">
  64. <text>卡号:</text>
  65. <text>{{state.orderInfo.cardId ?state.orderInfo.cardId: ''}}</text>
  66. </view>
  67. <view>
  68. <text>卡状态:</text>
  69. <text class="cardStatus">{{getETCStatusName(state.orderInfo.cardStatus)}}</text>
  70. </view>
  71. <view>
  72. <text>签号:</text>
  73. <text>{{state.orderInfo.obuId ?state.orderInfo.obuId: ''}}</text>
  74. </view>
  75. <view>
  76. <text>签状态:</text>
  77. <text class="cardStatus">{{getOBUStatusName(state.orderInfo.obuStatus)}}</text>
  78. </view>
  79. <view>
  80. <text>激活时间:</text>
  81. <text>{{getOrderTime(state.orderInfo.cardEnableTime)}}</text>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="message">
  87. <view class="message-top">
  88. <image :src="`${$imgUrl}order/car.png`" mode=""></image>
  89. <view class="msg">
  90. <view class="vehiclePlate">
  91. <text>订单车牌:</text>
  92. <text>{{state.orderInfo.vehiclePlate}}</text>
  93. </view>
  94. <view>
  95. <text>所属类型:</text>
  96. <text>{{state.orderInfo.userType === 'UNIT_USER' ? '单位' : '个人'}}</text>
  97. </view>
  98. <view>
  99. <text>车辆类型:</text>
  100. <text>{{getCarTypeName(state.orderInfo.vanType)}}</text>
  101. </view>
  102. <view>
  103. <text>订单金额:</text>
  104. <text
  105. class="amount">¥{{state.orderInfo.amount / 100 ?state.orderInfo.amount / 100: '0.00'}}</text>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="btn-view">
  110. <view class="btn-view"
  111. v-if="state.orderInfo.orderStatus != OrderStatus.已取消 && state.orderInfo['orderSource'] !='SERVICE_HALL'">
  112. <!-- 信息填写未完成 -->
  113. <view class="btn-status"
  114. v-if="state.orderInfo.orderStep == OrderStatus['完成个人/单位信息上传'] || state.orderInfo.orderStep == OrderStatus.完成填写基本信息 || state.orderInfo.orderStep == OrderStatus.待支付3">
  115. <view class="btn space" @click="gotoCancelOrder(state.orderInfo)">取消订单</view>
  116. <view class="btn-green" @click="gotoEditUserOrUnitInfo(state.orderInfo)">继续申请</view>
  117. </view>
  118. <!-- 审核中/审核不通过 -->
  119. <view
  120. v-if="state.orderInfo.orderStep == OrderStatus.审核不通过 || state.orderInfo.orderStep == OrderStatus.待审核"
  121. class="btn-status">
  122. <view class="btn space" @click="gotoCancelOrder(state.orderInfo)">取消订单</view>
  123. <view class="btn space" @click="gotoEditUserOrUnitInfo(state.orderInfo)"
  124. v-if="state.orderInfo.orderStep == OrderStatus.审核不通过">修改资料</view>
  125. <!-- <view class="btn space" v-if="state.orderInfo.orderStep == OrderStatus.审核不通过"
  126. @click="gotoEditUserOrUnitInfo(state.orderInfo)">修改资料</view> -->
  127. <view class="btn-green" @click="gotoEditAddress(state.orderInfo)">修改地址</view>
  128. </view>
  129. <!-- 待支付 -->
  130. <view
  131. v-if="state.orderInfo.orderStep == OrderStatus['完成车辆信息上传/待支付'] || state.orderInfo.orderStep == OrderStatus.待支付2 "
  132. class="btn-status">
  133. <view class="btn space" @click="gotoCancelOrder(state.orderInfo)">取消订单</view>
  134. <view class="btn-green width-num-1" @click="gotoOrderDetailsPay(state.orderInfo)">支付</view>
  135. </view>
  136. <!-- 待签约-->
  137. <view v-if="state.orderInfo.orderStep == OrderStatus['已支付/待签约']" class="btn-status">
  138. <view class="btn space" @click="gotoCancelOrder(state.orderInfo)">取消订单</view>
  139. <view class="btn-green" @click="gotoOrderSign(state.orderInfo)">去签约</view>
  140. </view>
  141. <!-- 待发货 -->
  142. <view v-if="state.orderInfo.orderStep == OrderStatus.待发货" class="btn-status">
  143. <view class="btn space" @click="gotoCancelOrder(state.orderInfo)">取消订单</view>
  144. <view class="btn-green" @click="gotoEditAddress(state.orderInfo)">修改地址</view>
  145. </view>
  146. <!-- 待收货 -->
  147. <view v-if="state.orderInfo.orderStep == OrderStatus.待收货" class="btn-status">
  148. <!-- <view class="btn space" @click="gotoOrderDetails(state.orderInfo)">查看物流</view> -->
  149. <view class="btn space" @click.stop="gotoReplenishmentOrder(state.orderInfo)"
  150. v-if="state.orderInfo.deviceType == deviceType">申请补货</view>
  151. <view class="btn space" @click="gotoReturnOrder(state.orderInfo)" v-else>申请退货</view>
  152. <view class="btn-green space" @click="gotoConfirmReceipt(state.orderInfo)">确认收货</view>
  153. <view class="btn-green" @click.stop="closeOrder(state.orderInfo)"
  154. v-if="state.orderInfo.finishOrder">结束订单</view>
  155. </view>
  156. <!-- 待激活 -->
  157. <!-- 确认收货之后可以退换补 异地 -->
  158. <view v-if="state.orderInfo.orderStep == OrderStatus.待激活" class="btn-status">
  159. <view class="btn space" @click="gotoReturnOrder(state.orderInfo)"
  160. v-if="state.orderInfo.applyReturn || state.orderInfo.deviceType == deviceType">申请退货</view>
  161. <view class="btn space" @click="gotoExchangeOrder(state.orderInfo)">申请换货</view>
  162. <view class="btn space" @click.stop="gotoReplenishmentOrder(state.orderInfo)"
  163. v-if="state.orderInfo.deviceType == deviceType">申请补货</view>
  164. <view class="btn-green space" @click="gotoActiveOrder(state.orderInfo)">去激活</view>
  165. <view class="btn-green" @click.stop="closeOrder(state.orderInfo)"
  166. v-if="state.orderInfo.finishOrder">结束订单</view>
  167. </view>
  168. <!-- 订单已结束 -->
  169. <view v-if="state.orderInfo.orderStep == OrderStatus.已结束 && state.orderInfo.isUseAgain"
  170. class="btn-status">
  171. <view class="btn-green" @click.stop="gotoAgainUseOrder(state.orderInfo)">再次使用订单</view>
  172. </view>
  173. <!-- 异地-邮寄地址填写 -->
  174. <view
  175. v-if="state.orderInfo.orderStep == OrderStatus.邮寄地址填写 && state.orderInfo.deviceType==deviceType"
  176. class="btn-status">
  177. <view class="btn-green" @click.stop="gotoAddressOrder(state.orderInfo)">邮寄地址填写</view>
  178. </view>
  179. <!-- 异地开始 -->
  180. <view v-if="state.orderInfo.orderStep == 31" class="btn-status">
  181. <view class="btn btn-green" @click="gotoReturnOrder(state.orderInfo)">退货</view>
  182. </view>
  183. <view v-if="state.orderInfo.orderStep == 33" class="btn-status">
  184. <view class="btn btn-green" @click="gotoExchangeOrder(state.orderInfo)"
  185. v-if="state.orderInfo.orderType!='REPLENISHMENT'">换货</view>
  186. </view>
  187. <view v-if="state.orderInfo.orderStep == 35" class="btn-status">
  188. <view class="btn btn-green" @click="placeAnOrder(state.orderInfo)">下单</view>
  189. </view>
  190. <!-- 异地结束-->
  191. <!-- 订单完成 -->
  192. <view v-if="state.isWeiXin==1">
  193. <view
  194. v-if="state.orderInfo.orderStep == OrderStatus.已完成 && (state.orderInfo.orderType =='ISSUE' || state.orderInfo.orderType =='VALUE_TO_ACCOUNT')"
  195. class="btn-status">
  196. <view class="btn space"
  197. v-if="( state.orderInfo.isProduct==1 && state.orderInfo.isService==1) ">
  198. 已评价</view>
  199. <view class="btn-green" v-else @click.stop="gotoEvaluateProduct(state.orderInfo)">去评价产品
  200. </view>
  201. </view>
  202. </view>
  203. <view v-if="state.isWeiXin==2">
  204. <view class="btn-status" v-if="state.orderInfo.orderStep == OrderStatus.已完成">
  205. <view class="btn space" v-if="state.orderInfo.isStaff==1 && state.orderInfo.isProduct==1">
  206. 已评价
  207. </view>
  208. <view class='evaluation' v-else>
  209. <view class="btn-green" @click.stop="gotoEvaluateSalesman(state.orderInfo)">去评价
  210. </view>
  211. </view>
  212. </view>
  213. </view>
  214. </view>
  215. <view v-else>
  216. <!-- 待激活 -->
  217. <view class="btn-status" style="display: flex;justify-content: flex-end;"
  218. v-if="state.orderInfo.orderStep == OrderStatus.待激活 && state.orderInfo.cardId && state.orderInfo.obuId">
  219. <view class="btn btn-green" @click.stop="gotoActiveOrder(state.orderInfo)"
  220. style="border: 1px solid #00B38B;">去激活</view>
  221. </view>
  222. </view>
  223. </view>
  224. </view>
  225. </view>
  226. <!-- 弹窗 -->
  227. <u-popup v-model="state.showActiveOrder" mode="center">
  228. <popup-active-order content="确认是否重新激活订单" @cancel="state.showActiveOrder = false"
  229. @confirm="toActiveOrder"></popup-active-order>
  230. </u-popup>
  231. </template>
  232. <script setup lang="ts">
  233. import popupActiveOrder from "@/pages/order/components/popup-active-order.vue";
  234. import { reactive, ref } from "vue";
  235. import { onLoad, onUnload, onShow, onPageScroll } from "@dcloudio/uni-app";
  236. import { requestNew } from "@/utils/network/request";
  237. import { updateShippingAddress, orderDetailQuery } from "@/utils/network/api";
  238. import useOrderSkip from "@/composables/order/useOrderSkip";
  239. import { getETCStatusName, getOBUStatusName, msg, getOrderTypeName, getCarTypeName, getOrderTime, isBlank, timesDiff } from "@/utils/utils";
  240. import { OrderStatus } from "@/datas/enum";
  241. import { deviceType } from "@/utils/network/difference";
  242. import navBar from "@/components/nav-bar/nav-bar2.vue";
  243. import {
  244. getCodeName
  245. } from "@/datas/queryKey.js";
  246. import {
  247. setItem,
  248. getItem,
  249. } from "@/utils/storage";
  250. const state = reactive({
  251. orderInfo: {
  252. orderInfoExt: {}
  253. } as any, //订单信息
  254. showActiveOrder: false, //激活弹窗
  255. isWeiXin: 1, //1 微信 2 app
  256. appraise: "",
  257. id: "",
  258. reshipment: "",//异地补货
  259. });
  260. const scrollTop = ref(0); //滚动距离
  261. //监听页面滚动
  262. onPageScroll((e) => {
  263. scrollTop.value = e.scrollTop;
  264. });
  265. //按钮跳转业务逻辑
  266. const { gotoEditAddress, gotoCancelOrder, gotoEditUserOrUnitInfo,
  267. gotoConfirmReceipt, gotoCheckLogistics, gotoEvaluateProduct,
  268. gotoActiveOrder, gotoReturnOrder, gotoExchangeOrder, gotoOrderSign, gotoOrderDetailsPay, gotoEvaluateSalesman, closeOrder, gotoAgainUseOrder, gotoAddressOrder, placeAnOrder, gotoReplenishmentOrder, gotoOrderDetails } = useOrderSkip();
  269. //获取订单详情
  270. const getOrderDetails = (id, appraise) => {
  271. const options = {
  272. type: 2,
  273. data: { "id": id },
  274. method: 'POST',
  275. showLoading: true,
  276. }
  277. requestNew(orderDetailQuery, options).then((res) => {
  278. state.orderInfo = res.data;
  279. console.log("state.orderInfo", state.orderInfo)
  280. // 订单发货后未激活 30天 以后 结束订单功能 insertTime >30 算出来距离今天是负数 updateTime<30(结束订单)
  281. for (var i in state.orderInfo) {
  282. if (state.orderInfo['insertTime']) {
  283. if (timesDiff(state.orderInfo['insertTime'].replace("T", " ")).days > 30) {
  284. state.orderInfo['finishOrder'] = true //可以结束
  285. } else {
  286. state.orderInfo['finishOrder'] = false //不可以结束
  287. }
  288. }
  289. if (state.orderInfo['updateTime']) {
  290. if (timesDiff(state.orderInfo['updateTime'].replace("T", " ")).days <= 30) {
  291. state.orderInfo['isUseAgain'] = true //可以结束
  292. } else {
  293. state.orderInfo['isUseAgain'] = false //不可以结束
  294. }
  295. }
  296. // 收货日期超过7个自然日不允许申请退货
  297. if (state.orderInfo.orderInfoExt['receivingTime']) {
  298. if (timesDiff(state.orderInfo.orderInfoExt['receivingTime'].replace("T", " ")).days > 7) {
  299. state.orderInfo['applyReturn'] = false //不展示申请退货
  300. } else {
  301. state.orderInfo['applyReturn'] = true //展示申请退货
  302. }
  303. }
  304. }
  305. console.log("获取订单详情", state.orderInfo, state.orderInfo['applyReturn'])
  306. })
  307. }
  308. //修改订单收货地址
  309. const requestEditOrderAddr = (addr) => {
  310. console.log("addr", addr)
  311. const options = {
  312. type: 2, data: {
  313. "id": state.orderInfo.id,
  314. 'consignee': addr.consignee,
  315. 'consigneeTel': addr.consigneeTel,
  316. 'region': addr.region,
  317. 'address': addr.address,
  318. 'postalCode': addr.postalCode,
  319. 'orderId': state.orderInfo.orderNo,
  320. },
  321. method: 'POST',
  322. showLoading: true,
  323. }
  324. requestNew(updateShippingAddress, options).then((res) => {
  325. state.orderInfo.orderInfoExt.id = addr.id,
  326. state.orderInfo.orderInfoExt.consignee = addr.consignee;
  327. state.orderInfo.orderInfoExt.consigneeTel = addr.consigneeTel;
  328. state.orderInfo.orderInfoExt.region = addr.region;
  329. state.orderInfo.orderInfoExt.address = addr.address;
  330. state.orderInfo.orderInfoExt.postalCode = addr.postalCode;
  331. setTimeout(() => {
  332. msg('收货地址修改成功');
  333. }, 1000)
  334. })
  335. }
  336. //激活订单
  337. const toActiveOrder = () => {
  338. gotoActiveOrder(state.orderInfo);
  339. state.showActiveOrder = false;
  340. }
  341. //是否有售后信息
  342. const isHaveAfterSaleInfo = () => {
  343. if (isBlank(state.orderInfo.orderInfoExt ? state.orderInfo.orderInfoExt.returnMode : null) && isBlank(state.orderInfo.orderInfoExt ? state.orderInfo.orderInfoExt.exchangeMode : null)) {
  344. return false;
  345. }
  346. return true;
  347. }
  348. onLoad((options) => {
  349. state.isWeiXin = options.isWeiXin
  350. state.reshipment = options.reshipment
  351. console.log("options.reshipment", options.reshipment)
  352. // state.orderInfo = JSON.parse(options.passData);
  353. state.orderInfo = getItem("orderListData");
  354. //刷新订单信息
  355. uni.$on('refreshOrder', (data) => {
  356. getOrderDetails(options.id, state.orderInfo.appraise);
  357. });
  358. //修改收货地址
  359. uni.$on('selectAddressSuccess', (addr) => {
  360. requestEditOrderAddr(addr);
  361. });
  362. console.log("optionssdsfd", options)
  363. state.id = options.id
  364. state.appraise = options.appraise
  365. })
  366. onShow(() => {
  367. // getOrderDetails(state.id, state.appraise);
  368. })
  369. onUnload(() => {
  370. uni.$off('refreshOrder');
  371. uni.$off('selectAddressSuccess');
  372. console.log("已评价")
  373. })
  374. const copy = (value) => {
  375. uni.setClipboardData({
  376. data: value,
  377. success(res) {
  378. }
  379. })
  380. }
  381. </script>
  382. <style>
  383. page {
  384. background: #E9EDF0;
  385. padding-bottom: 30rpx;
  386. font-size: 28rpx;
  387. }
  388. </style>
  389. <style lang="scss" scoped>
  390. .bg-img {
  391. width: 100%;
  392. position: absolute;
  393. z-index: 0;
  394. .icon {
  395. width: 100%;
  396. height: 534rpx;
  397. }
  398. }
  399. .content {
  400. position: relative;
  401. color: white;
  402. padding: 0 30rpx;
  403. padding-top: 200rpx;
  404. }
  405. .status>text {
  406. font-weight: bold;
  407. font-size: 40rpx;
  408. line-height: 82rpx;
  409. }
  410. .order {
  411. height: 136rpx;
  412. background: linear-gradient(to bottom, rgb(188, 195, 205), #ffffff);
  413. ;
  414. border-radius: 12rpx 12rpx 12rpx 12rpx;
  415. border: 1rpx solid #FFFFFF;
  416. color: black;
  417. font-weight: 400;
  418. font-size: 30rpx;
  419. margin-top: 80rpx;
  420. padding: 20rpx;
  421. box-sizing: border-box;
  422. }
  423. .order>.num {
  424. color: #111111;
  425. }
  426. .order>.name {
  427. color: #666666;
  428. margin-top: 10rpx;
  429. }
  430. .message {
  431. background: white;
  432. border-radius: 12rpx 12rpx 12rpx 12rpx;
  433. border: 1rpx solid #FFFFFF;
  434. color: #666666;
  435. margin-top: 30rpx;
  436. padding: 20rpx 20rpx 0 20rpx;
  437. }
  438. .message image {
  439. width: 200rpx;
  440. height: 200rpx;
  441. margin-right: 20rpx;
  442. }
  443. .message-top1 {
  444. display: flex;
  445. padding-bottom: 20rpx;
  446. align-items: center;
  447. }
  448. .message-top1>.msg>view {
  449. line-height: 50rpx;
  450. }
  451. .message-top {
  452. display: flex;
  453. border-bottom: 2rpx solid #E6E9EB;
  454. padding-bottom: 20rpx;
  455. }
  456. .vehiclePlate {
  457. font-weight: 400;
  458. font-size: 30rpx;
  459. color: #111111;
  460. }
  461. .amount {
  462. color: #E8C66A;
  463. }
  464. .msg {
  465. display: flex;
  466. flex-direction: column;
  467. justify-content: space-between;
  468. }
  469. .btn-view {
  470. .btn-status {
  471. display: flex;
  472. justify-content: flex-end;
  473. padding: 20rpx 0;
  474. border-top: 1rpx solid #DCDCDC;
  475. }
  476. .space {
  477. margin-right: 19rpx
  478. }
  479. .btn {
  480. border: 1px solid #133850;
  481. color: #133850;
  482. border-radius: 30rpx;
  483. font-size: 24rpx;
  484. height: 52rpx;
  485. width: 130rpx;
  486. display: flex;
  487. justify-content: center;
  488. align-items: center;
  489. }
  490. .btn-green {
  491. color: white;
  492. background-color: #133850;
  493. border-radius: 30rpx;
  494. height: 52rpx;
  495. padding: 2rpx 22rpx;
  496. display: flex;
  497. justify-content: center;
  498. align-items: center;
  499. font-size: 24rpx;
  500. }
  501. .width-num-1 {
  502. width: 115rpx;
  503. }
  504. .width-num-2 {
  505. width: 221rpx;
  506. }
  507. .width-num-3 {
  508. width: 201rpx;
  509. }
  510. }
  511. .cardStatus {
  512. color: #3CCA7C;
  513. }
  514. </style>