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

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