integralOrderDetails.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <template>
  2. <view>
  3. <view class="cont">
  4. <view class="bg"></view>
  5. <view class="inner">
  6. <!-- 订单状态 -->
  7. <view class="order-status">
  8. <!-- 待付款 -->
  9. <view v-if="order.status == 4" class="inner">
  10. <view class="img-box">
  11. <image src="https://hdtobs.obs.cn-north-4.myhuaweicloud.com/hdt/order_success.png" mode=""></image>
  12. </view>
  13. <view class="status-box">
  14. <text class="status">待付款</text>
  15. <text class="desc">请尽快完成支付</text>
  16. </view>
  17. </view>
  18. <!-- 待发货 -->
  19. <view v-if="order.status == 1" class="inner">
  20. <view class="img-box">
  21. <image src="https://hdtobs.obs.cn-north-4.myhuaweicloud.com/hdt/order_dfh.png" mode=""></image>
  22. </view>
  23. <view class="status-box">
  24. <text class="status">待发货</text>
  25. <text class="desc">等待后台发货</text>
  26. </view>
  27. </view>
  28. <!-- 已发货、待收货 -->
  29. <view v-if="order.status == 2" class="inner">
  30. <view class="img-box">
  31. <image src="https://hdtobs.obs.cn-north-4.myhuaweicloud.com/hdt/order_dfh.png" mode=""></image>
  32. </view>
  33. <view class="status-box">
  34. <text class="status">待收货</text>
  35. <text class="desc">运输中</text>
  36. </view>
  37. </view>
  38. <!-- 已完成 -->
  39. <view v-if="order.status == 3" class="inner">
  40. <view class="img-box">
  41. <image src="https://hdtobs.obs.cn-north-4.myhuaweicloud.com/hdt/order_ywc.png" mode=""></image>
  42. </view>
  43. <view class="status-box">
  44. <text class="status">已完成</text>
  45. <text class="desc">订单已确认收货,交易完成</text>
  46. </view>
  47. </view>
  48. <!--交易取消 -->
  49. <view v-if="order.status == 5" class="inner">
  50. <view class="img-box">
  51. <image src="https://hdtobs.obs.cn-north-4.myhuaweicloud.com/hdt/order_close.png" mode=""></image>
  52. </view>
  53. <view class="status-box">
  54. <text class="status">交易关闭</text>
  55. <text class="desc">订单已取消</text>
  56. </view>
  57. </view>
  58. </view>
  59. <!-- 下单人信息 -->
  60. <view class="order-placer" v-if="order.userName!=null">
  61. <view class="inner">
  62. <image class="location" src="https://hdtobs.obs.cn-north-4.myhuaweicloud.com/miniapp/location.png" mode=""></image>
  63. <view class="info">
  64. <view class="name-phone">
  65. <text class="text">{{order.userName}}</text>
  66. <text class="text" v-if="order.userPhone!=null">{{order.userPhone}}</text>
  67. </view>
  68. <view class="address ellipsis2">
  69. {{order.userAddress}}
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="content">
  75. <view class="goods-list">
  76. <view class="item" v-for="(item,index) in list" :key="index" >
  77. <view class="img-box">
  78. <image :src="item.imgUrl==''?'https://hdtobs.obs.cn-north-4.myhuaweicloud.com/miniapp/drug.svg':item.imgUrl" mode="aspectFill"></image>
  79. </view>
  80. <view class="info-box">
  81. <view>
  82. <view class="name-box ellipsis2">
  83. {{item.goodsName}}
  84. </view>
  85. </view>
  86. <view class="price-num">
  87. <view class="price">
  88. <text class="num">{{item.integral}}</text>
  89. <text class="unit">积分</text>
  90. <text class="num" v-show="item.cash>0">+{{item.cash.toFixed(2)}}</text>
  91. <text class="unit" v-show="item.cash>0">元</text>
  92. </view>
  93. <view class="num" >x{{item.num}}</view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <!-- 订单信息 -->
  99. <view class="order-info">
  100. <view class="title">订单信息</view>
  101. <view class="item">
  102. <text class="label">订单编号</text>
  103. <view class="sn-box">
  104. <text class="text">{{order.orderCode}}</text>
  105. <view class="copy-btn" @click="copyOrderSn(order.orderCode)">复制</view>
  106. </view>
  107. </view>
  108. <view class="item">
  109. <text class="label">下单时间</text>
  110. <text class="text">{{order.createTime}}</text>
  111. </view>
  112. <view class="item">
  113. <text class="label">使用积分</text>
  114. <text class="text" >{{order.integral}}</text>
  115. </view>
  116. <view class="item" v-if="order.deliveryName!=null">
  117. <text class="label">物流公司</text>
  118. <text class="text" >{{order.deliveryName}}</text>
  119. </view>
  120. <view class="item" v-if="order.deliverySn!=null">
  121. <text class="label">物流单号</text>
  122. <text class="text" >{{order.deliverySn}}</text>
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. <!-- 按钮 -->
  129. <view class="btn-box">
  130. <view class="btn pay" v-if="order.status==4" @click.stop="pay()">去支付</view>
  131. <view class="btn cancel" v-if="order.status==4" @click.stop="cancelPay(item)">取消订单</view>
  132. <view class="btn cancel">
  133. 联系客服
  134. <button class='contact-btn' open-type="contact">
  135. </button>
  136. </view>
  137. </view>
  138. </view>
  139. </template>
  140. <script>
  141. import {getIntegralOrderById,cannelOrder} from '@/api/integral.js'
  142. export default {
  143. data() {
  144. return {
  145. orderId:null,
  146. order:{},
  147. list:[],
  148. };
  149. },
  150. onLoad(option) {
  151. this.orderId = option.orderId
  152. },
  153. onShow() {
  154. this.getIntegralOrderById()
  155. },
  156. methods: {
  157. getIntegralOrderById(){
  158. var data={orderId:this.orderId};
  159. getIntegralOrderById(data).then(res => {
  160. if(res.code==200){
  161. this.order=res.data;
  162. this.list = [].concat(JSON.parse(this.order.itemJson ?? '[]')).filter(Boolean);
  163. }else{
  164. uni.showToast({
  165. icon:'none',
  166. title: "请求失败",
  167. });
  168. }
  169. });
  170. },
  171. // 复制订单编号
  172. copyOrderSn(text) {
  173. // 复制方法
  174. uni.setClipboardData({
  175. data:text,
  176. success:()=>{
  177. uni.showToast({
  178. title:'内容已成功复制到剪切板',
  179. icon:'none'
  180. })
  181. }
  182. });
  183. },
  184. pay() {
  185. uni.navigateTo({
  186. url: '/pages_user/integralPayment?orderId='+this.order.orderId
  187. })
  188. },
  189. cancelPay() {
  190. cannelOrder({orderId:this.order.orderId}).then(res=>{
  191. if(res.code ==200) {
  192. uni.showToast({
  193. title: '取消成功',
  194. icon: 'none'
  195. })
  196. this.getIntegralOrderById()
  197. } else {
  198. uni.showToast({
  199. title: res.msg,
  200. icon: 'none'
  201. })
  202. }
  203. })
  204. }
  205. }
  206. }
  207. </script>
  208. <style lang="scss">
  209. .cont{
  210. width: 100%;
  211. position: relative;
  212. .bg{
  213. width: 100%;
  214. height: 350upx;
  215. position: absolute;
  216. top: 0;
  217. left: 0;
  218. z-index: 1;
  219. background-color: #DA251C;
  220. background: linear-gradient(#DA251C, #E2C99E);
  221. border-radius: 0rpx 0rpx 100rpx 100rpx;
  222. }
  223. .inner{
  224. position: relative;
  225. padding: 30upx 0rpx;
  226. width: 100%;
  227. height: 100%;
  228. z-index: 999;
  229. .order-status{
  230. display: flex;
  231. align-items: center;
  232. justify-content: space-between;
  233. padding: 0 30upx;
  234. .inner{
  235. display: flex;
  236. align-items: center;
  237. .img-box{
  238. width: 96upx;
  239. height: 96upx;
  240. margin-right: 30upx;
  241. image{
  242. width: 100%;
  243. height: 100%;
  244. }
  245. }
  246. .status-box{
  247. height: 96upx;
  248. display: flex;
  249. flex-direction: column;
  250. justify-content: center;
  251. .status{
  252. font-size: 40upx;
  253. font-family: PingFang SC;
  254. font-weight: bold;
  255. color: #FFFFFF;
  256. line-height: 1;
  257. }
  258. .desc{
  259. font-size: 26upx;
  260. font-family: PingFang SC;
  261. font-weight: 500;
  262. color: #FFFFFF;
  263. line-height: 1;
  264. margin-top: 30upx;
  265. }
  266. }
  267. }
  268. }
  269. .order-placer{
  270. margin-top: 30upx;
  271. padding: 0 20upx;
  272. .inner{
  273. box-sizing: border-box;
  274. border-radius: 16upx;
  275. height: 150upx;
  276. padding: 40upx 30upx;
  277. display: flex;
  278. align-items: center;
  279. background: #FFFFFF;
  280. .location{
  281. width: 24upx;
  282. height: 27upx;
  283. margin-right: 18upx;
  284. flex-shrink: 0;
  285. }
  286. .info{
  287. .name-phone{
  288. display: flex;
  289. align-items: center;
  290. .text{
  291. font-size: 28upx;
  292. font-family: PingFang SC;
  293. font-weight: bold;
  294. color: #333333;
  295. line-height: 1;
  296. margin-right: 20upx;
  297. &:last-child{
  298. margin-right: 0;
  299. }
  300. }
  301. }
  302. .address{
  303. font-size: 26upx;
  304. font-family: PingFang SC;
  305. font-weight: 500;
  306. color: #999999;
  307. line-height: 1.3;
  308. margin-top: 10upx;
  309. }
  310. }
  311. }
  312. }
  313. }
  314. }
  315. .content{
  316. margin: 20rpx 0rpx;
  317. padding: 0 20upx 140rpx 20upx;
  318. .goods-list{
  319. padding: 0 30upx;
  320. background-color: #FFFFFF;
  321. border-radius: 16upx;
  322. .item{
  323. padding: 30upx 0;
  324. border-bottom: 1px solid #EDEEEF;
  325. display: flex;
  326. align-items: center;
  327. .img-box{
  328. width: 160upx;
  329. height: 160upx;
  330. margin-right: 30upx;
  331. image{
  332. width: 100%;
  333. height: 100%;
  334. }
  335. }
  336. .info-box{
  337. width: calc(100% - 190upx);
  338. height: 160upx;
  339. display: flex;
  340. flex-direction: column;
  341. justify-content: space-between;
  342. .name-box{
  343. font-size: 28upx;
  344. font-family: PingFang SC;
  345. font-weight: 500;
  346. color: #111111;
  347. line-height: 40upx;
  348. .tag{
  349. display: inline-block;
  350. padding: 0 6upx;
  351. height: 30upx;
  352. background: linear-gradient(90deg, #DA251C 0%, #E2C99E 100%);
  353. border-radius: 4upx;
  354. margin-right: 10upx;
  355. font-size: 22upx;
  356. font-family: PingFang SC;
  357. font-weight: bold;
  358. color: #FFFFFF;
  359. line-height: 30upx;
  360. float: left;
  361. margin-top: 7upx;
  362. }
  363. }
  364. .spec{
  365. margin-top: 18upx;
  366. font-size: 24upx;
  367. font-family: PingFang SC;
  368. font-weight: 500;
  369. color: #999999;
  370. line-height: 1;
  371. }
  372. .price-num{
  373. display: flex;
  374. align-items: center;
  375. justify-content: space-between;
  376. .price{
  377. display: flex;
  378. align-items: flex-end;
  379. .unit{
  380. font-size: 24upx;
  381. font-family: PingFang SC;
  382. font-weight: 500;
  383. color: #111111;
  384. line-height: 1.2;
  385. margin-right: 4upx;
  386. }
  387. .num{
  388. font-size: 32upx;
  389. font-family: PingFang SC;
  390. font-weight: 500;
  391. color: #111111;
  392. line-height: 1;
  393. }
  394. }
  395. .num{
  396. font-size: 24upx;
  397. font-family: PingFang SC;
  398. font-weight: 500;
  399. color: #999999;
  400. line-height: 1;
  401. }
  402. }
  403. }
  404. }
  405. .sub-total{
  406. height: 88upx;
  407. display: flex;
  408. align-items: center;
  409. justify-content: flex-end;
  410. .discount{
  411. font-size: 24upx;
  412. font-family: PingFang SC;
  413. font-weight: 500;
  414. color: #999999;
  415. line-height: 1;
  416. margin-right: 30upx;
  417. }
  418. .label{
  419. font-size: 24upx;
  420. font-family: PingFang SC;
  421. font-weight: 500;
  422. color: #999999;
  423. }
  424. .price{
  425. display: flex;
  426. align-items: flex-end;
  427. .unit{
  428. font-size: 24upx;
  429. font-family: PingFang SC;
  430. font-weight: 500;
  431. color: #FF6633;
  432. line-height: 1.2;
  433. margin-right: 4upx;
  434. }
  435. .num{
  436. font-size: 32upx;
  437. font-family: PingFang SC;
  438. font-weight: bold;
  439. color: #FF6633;
  440. line-height: 1;
  441. }
  442. }
  443. }
  444. }
  445. .order-info{
  446. margin-top: 20upx;
  447. background: #FFFFFF;
  448. border-radius: 16upx;
  449. padding: 40upx 30upx;
  450. .title{
  451. font-size: 30upx;
  452. font-family: PingFang SC;
  453. font-weight: bold;
  454. color: #222222;
  455. line-height: 1;
  456. }
  457. .item{
  458. margin-top: 40upx;
  459. display: flex;
  460. align-items: center;
  461. justify-content: space-between;
  462. .label{
  463. font-size: 26upx;
  464. font-family: PingFang SC;
  465. font-weight: 500;
  466. color: #666666;
  467. line-height: 1;
  468. }
  469. .text{
  470. font-size: 26upx;
  471. font-family: PingFang SC;
  472. font-weight: 500;
  473. color: #222222;
  474. line-height: 32upx;
  475. }
  476. .cont-text{
  477. font-size: 26upx;
  478. font-family: PingFang SC;
  479. font-weight: 500;
  480. color: #666666;
  481. .bold{
  482. color: #111111;
  483. }
  484. }
  485. .sn-box{
  486. display: flex;
  487. align-items: center;
  488. .copy-btn{
  489. width: 58upx;
  490. height: 32upx;
  491. line-height: 32upx;
  492. text-align: center;
  493. font-size: 22upx;
  494. font-family: PingFang SC;
  495. font-weight: 500;
  496. color: #222222;
  497. background: #F5F5F5;
  498. border-radius: 4upx;
  499. margin-left: 24upx;
  500. }
  501. }
  502. .check-box{
  503. display: flex;
  504. align-items: center;
  505. image{
  506. width: 14upx;
  507. height: 24upx;
  508. margin-left: 10upx;
  509. }
  510. }
  511. }
  512. .line{
  513. width: 100%;
  514. height: 1px;
  515. background: #F0F0F0;
  516. margin-top: 30upx;
  517. }
  518. }
  519. }
  520. .btn-box{
  521. z-index: 999;
  522. bottom: 0;
  523. width: 100%;
  524. position: fixed;
  525. height: 120upx;
  526. box-sizing: border-box;
  527. background: #FFFFFF;
  528. padding: 0 30upx;
  529. display: flex;
  530. align-items: center;
  531. justify-content: flex-end;
  532. .btn{
  533. position: relative;
  534. width: 155upx;
  535. height: 64upx;
  536. line-height: 64upx;
  537. font-size: 26upx;
  538. font-family: PingFang SC;
  539. font-weight: 500;
  540. text-align: center;
  541. border-radius: 32upx;
  542. margin-left: 15upx;
  543. &.cancel{
  544. border: 1px solid #DDDDDD;
  545. color: #666666;
  546. }
  547. &.pay{
  548. background: #DA251C;
  549. color: #FFFFFF;
  550. }
  551. .contact-btn {
  552. top: 0;
  553. position: absolute;
  554. width:100%;
  555. height:100%;
  556. opacity: 0;
  557. }
  558. }
  559. }
  560. </style>