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

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