index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. <template>
  2. <view class="container">
  3. <view class="no_data" v-if="dataError">
  4. <image src="/static/no_data.png" class="image" mode="widthFix" />
  5. <view>没有找到该订单呢……</view>
  6. </view>
  7. <view class="orderDetail_box" v-else>
  8. <view class="sec-wrap">
  9. <view class="order-status">
  10. <view class="icon-box">
  11. <image v-if="orderInfo.order_status === 0" class="icon" src="@/static/order-details/icon-ddfk.png"></image>
  12. <image v-else-if="orderInfo.order_status == 1" class="icon" src="@/static/order-details/icon-ddfh.png"></image>
  13. <image v-else-if="orderInfo.order_status == 2" class="icon" src="@/static/order-details/icon-ddsh.png"></image>
  14. <image v-else class="icon" src="@/static/order-details/icon-ddgb.png"></image>
  15. </view>
  16. <view class="right-text">
  17. <view class="status">{{ tidyStatus([orderInfo.pay_status, orderInfo.order_status]) }}</view>
  18. </view>
  19. </view>
  20. </view>
  21. <!-- 配送 -->
  22. <view class="address-box">
  23. <view class="show-address">
  24. <view class="name-tel">{{ orderInfo.consignee }} {{ orderInfo.mobile }}</view>
  25. <view class="addr-text">{{ orderInfo.address }}</view>
  26. </view>
  27. </view>
  28. <!-- <view class="logistics_btn" v-if="orderInfo.logistics && orderInfo.logistics.logistics_no && orderInfo.logistics.logistics_business" @tap="goLogistics">
  29. <view class="l_box" v-if="orderInfo.logistics.statusMsg && orderInfo.logistics.statusMsg != ''">{{ orderInfo.logistics.statusMsg }}</view>
  30. <view class="l_box" v-else>已发货:{{ orderInfo.logistics.logistics_business }},快递单号:{{ orderInfo.logistics.logistics_no }}</view>
  31. </view> -->
  32. <view class="goods-list">
  33. <view class="goods-info_box">
  34. <scroll-view class="goods-img-container">
  35. <view class="img-box">
  36. <image :src="orderInfo.goods.original_img" mode="" class="goods-img"></image>
  37. </view>
  38. <view class="goodsDetail_info">
  39. <view class="goods_name">{{ orderInfo.goods.goods_name }}
  40. <view class="goods_num">×{{ orderInfo.goods_num }}</view>
  41. </view>
  42. <view class="goods_price r_color">¥{{ orderInfo.total_amount }}</view>
  43. </view>
  44. </scroll-view>
  45. </view>
  46. </view>
  47. <view class="order_info">
  48. <view class="li_box">订单状态:
  49. <view class="info_data">{{ tidyStatus([orderInfo.pay_status, orderInfo.order_status]) }}</view>
  50. </view>
  51. <view class="li_box" v-if="orderInfo.order_sn">订单编号:
  52. <view class="info_data">{{ orderInfo.order_sn }}</view>
  53. </view>
  54. <view class="li_box" v-if="orderInfo.add_time">订单创建:
  55. <view class="info_data">{{ $day(orderInfo.add_time * 1000).format("YYYY-MM-DD HH:mm:ss") }}</view>
  56. </view>
  57. <view class="li_box" v-if="orderInfo.pay_name">支付方式:
  58. <view class="info_data">{{ orderInfo.pay_name }}</view>
  59. </view>
  60. <view class="li_box" v-if="orderInfo.total_amount">商品合计:
  61. <view class="info_data">{{ orderInfo.total_amount }}</view>
  62. </view>
  63. <!-- <view class="li_box" v-if="orderInfo.orderTypes == 2">批发积分:
  64. <view class="info_data">{{ orderInfo.totalPfInt }}</view>
  65. </view> -->
  66. <!-- <view class="li_box" v-if="orderInfo.orderTypes == 2">茶宝:
  67. <view class="info_data">{{ orderInfo.totalTeaInt }}</view>
  68. </view> -->
  69. </view>
  70. <view class="detail_btn-row-box">
  71. <view class="detail_btn-row">
  72. <view class="btn cancel-btn" @tap="toCancel" v-if="orderInfo.pay_status === 0">取消订单</view>
  73. <view class="btn topay-btn" @tap="toPay" v-if="orderInfo.pay_status === 0">立即支付</view>
  74. <view class="btn topay-btn" @tap="toTake" v-if="[0, 1].includes(orderInfo.order_status)">确认收货</view>
  75. <view class="btn cancel-btn" @tap="goBack">返回</view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. // var toPayOpre = new ToPayOpre();
  83. var utils = require("@/utils/utils.js");
  84. import { get, post } from "@/request/api.js";
  85. var app = getApp();
  86. var appEv = app.$vm.$options;
  87. export default {
  88. data() {
  89. return {
  90. currentTpye: false,
  91. dataError: false,
  92. orderInfo: {},
  93. isTuanIng: false, // 是否为拼团中订单
  94. isweixin: "",
  95. goodsNum: "",
  96. goodsTotalPrice: "",
  97. pt: "",
  98. order_id: '', //当前订单id
  99. };
  100. },
  101. onLoad: function(e) {
  102. if (!e.id) {
  103. uni.showToast({
  104. title: "参数错误",
  105. image: "/static/static/images/toast_nothing.png",
  106. duration: 1200,
  107. });
  108. setTimeout(() => {
  109. uni.navigateBack({
  110. delta: 1,
  111. });
  112. }, 1200);
  113. return;
  114. }
  115. this.order_id = e.id;
  116. uni.showLoading({
  117. title: "加载中…",
  118. mask: true,
  119. });
  120. this.loadData();
  121. },
  122. methods: {
  123. loadData() {
  124. post("my/orderDetail", {
  125. order_id: this.order_id,
  126. }).then(res => {
  127. uni.hideLoading();
  128. if (res.code === 0) {
  129. this.orderInfo = res.data.data;
  130. }
  131. });
  132. },
  133. // 取消订单
  134. toCancel() {
  135. let that = this;
  136. uni.showModal({
  137. title: "温馨提示",
  138. content: "发起拼单24小时后,若未拼单成功将自动取消订单并退款哦~",
  139. showCancel: false,
  140. confirmText: "知道了",
  141. confirmColor: "#f02f2f",
  142. success(res) {
  143. if (res.confirm) {
  144. post("my/orderCancel",{
  145. order_id: that.order_id
  146. }).then(res => {
  147. if(res.code === 0){
  148. appEv.errTips(res.msg);
  149. that.loadData();
  150. }
  151. })
  152. }
  153. },
  154. });
  155. },
  156. // 立即支付
  157. toPay(e) {
  158. let data = {
  159. orderDetailIds: this.orderId,
  160. types: 1,
  161. price: this.orderInfo.orderDetail.totalWxPrice,
  162. account: this.orderInfo.orderDetail.totalAccount,
  163. teaIntegral: this.orderInfo.orderDetail.totalTeaInt,
  164. pfIntegral: this.orderInfo.orderDetail.totalPfInt,
  165. xfIntegral: this.orderInfo.orderDetail.totalXfInt,
  166. zfType: this.orderInfo.orderDetail.patType,
  167. ojsType: this.orderInfo.orderDetail.ojsType,
  168. };
  169. var info;
  170. info = reqApi.payOrder(data);
  171. var that = this;
  172. if (info) {
  173. info.then((res) => {
  174. if (res.data.status == 200) {
  175. toPayOpre.toPay(res.data.payParam);
  176. } else {
  177. appEv.errTips(res.data.msg || "支付失败");
  178. }
  179. });
  180. }
  181. },
  182. // 确认收货
  183. toTake() {
  184. let that = this;
  185. uni.showModal({
  186. content: "亲,“确定收货”代表着本订单的交付流程已经完成,不再支持任何形式的退换货。",
  187. confirmText: "确认收货",
  188. confirmColor: "#fa2f2e",
  189. cancelText: "取消",
  190. cancelColor: "#bbb",
  191. success(res) {
  192. if (res.confirm) {
  193. post("goods/confirmOrder",{
  194. order_id: that.order_id
  195. }).then(res => {
  196. if(res.code === 0){
  197. appEv.errTips(res.msg);
  198. that.loadData();
  199. }
  200. })
  201. }
  202. },
  203. });
  204. },
  205. //计时
  206. timeChange: function(statusType, finsTime) {
  207. var nowTime = utils.unxiNum();
  208. finsTime = utils.unxiNum(finsTime);
  209. var timeDiffNum = finsTime - nowTime;
  210. var that = this,
  211. text = "";
  212. if (timeDiffNum > 0) {
  213. var timer = setInterval(function() {
  214. --timeDiffNum;
  215. var back_text = utils.changeTimeStamp(timeDiffNum);
  216. if (timeDiffNum <= 0 || !back_text) {
  217. clearInterval(timer);
  218. if (statusType == 0) {
  219. text = "订单未在规定时间内付款已自动关闭";
  220. that.currentTpye = 7;
  221. that.onShow();
  222. }
  223. } else {
  224. if (statusType == 0) {
  225. text = "请于" + back_text + "内付款,超时订单将自动关闭";
  226. }
  227. }
  228. that.timeOver = false; //时间是否已结束
  229. that.changeTimeTexttext;
  230. }, 1000);
  231. } else {
  232. if (statusType == 0) {
  233. text = "订单未在规定时间内付款已自动关闭";
  234. }
  235. that.timeOver = true; //时间是否已结束
  236. that.changeTimeText = text;
  237. }
  238. },
  239. goBack: function() {
  240. uni.navigateBack();
  241. },
  242. // 跳转商品详情
  243. toGoodsDetails(e) {
  244. },
  245. // 跳转物流详情
  246. goLogistics() {
  247. uni.navigateTo({
  248. url: "/pages/logistics/index?id=" +
  249. this.orderInfo.orderDetail.orderDetaillId,
  250. });
  251. },
  252. },
  253. computed: {
  254. tidyStatus() {
  255. return (da) => {
  256. if (da[0] === 0) return "待支付";
  257. if (da[1] === 0) return "待发货";
  258. if (da[1] === 1) return "待收货";
  259. if (da[1] === 2) return "已收货";
  260. if (da[1] === 3) return "申请退货";
  261. if (da[1] === 4) return "已退货";
  262. if (da[1] === 5) return "已作废";
  263. };
  264. },
  265. },
  266. };
  267. </script>
  268. <style lang="scss" scoped>
  269. page {
  270. background-color: #f3f5f7;
  271. }
  272. .r_color {
  273. color: #fa2f2e;
  274. }
  275. .sec-wrap {
  276. background-color: #21c792;
  277. margin: 2rpx 0 20rpx;
  278. }
  279. .bottom-fiexd {
  280. position: fixed;
  281. bottom: 0;
  282. left: 0;
  283. }
  284. .flex_hvcc {
  285. display: flex;
  286. display: -webkit-flex;
  287. align-items: center;
  288. justify-content: center;
  289. }
  290. .address-box {
  291. width: 100%;
  292. margin: -20rpx 0 20rpx;
  293. background: #fff url(http://xcx.soowin.com/images/addr-line.png) no-repeat center top;
  294. background-size: 100% 4rpx;
  295. overflow: hidden;
  296. }
  297. .show-address {
  298. width: 100%;
  299. box-sizing: border-box;
  300. padding: 0 30rpx 0 80rpx;
  301. background: url(http://xcx.soowin.com/images/ico-addr.png) no-repeat 25rpx 30rpx;
  302. background-size: 40rpx auto;
  303. }
  304. .show-address .name-tel {
  305. font-size: 28rpx;
  306. color: #000;
  307. padding: 30rpx 0 20rpx 0;
  308. }
  309. .show-address .name-tel-phone {
  310. padding: 30rpx 0;
  311. }
  312. .show-address .addr-text {
  313. font-size: 24rpx;
  314. color: #888;
  315. padding-bottom: 34rpx;
  316. line-height: 36rpx;
  317. }
  318. .show-address .addr-text_lit {
  319. padding-bottom: 10rpx;
  320. }
  321. .sec-wrap .order-status {
  322. width: 100%;
  323. box-sizing: border-box;
  324. padding: 0 30rpx;
  325. height: 160rpx;
  326. display: flex;
  327. align-items: center;
  328. }
  329. .order-status .icon-box {
  330. width: 80rpx;
  331. height: 80rpx;
  332. overflow: hidden;
  333. margin-right: 26rpx;
  334. }
  335. .order-status .icon-box .icon {
  336. width: 100%;
  337. height: 100%;
  338. }
  339. .order-status .right-text {
  340. width: calc(100% - 116rpx);
  341. overflow: hidden;
  342. }
  343. .order-status .right-text .status {
  344. font-size: 36rpx;
  345. color: #fff;
  346. padding: 2rpx 0 4rpx;
  347. font-weight: 500;
  348. }
  349. .order-status .right-text .red {
  350. color: #fa2f2e;
  351. }
  352. .order-status .right-text .des {
  353. font-size: 24rpx;
  354. color: #fff;
  355. padding: 4rpx 0;
  356. }
  357. .address-sec {
  358. width: 720rpx;
  359. margin-left: 30rpx;
  360. display: flex;
  361. align-items: center;
  362. padding: 30rpx 0;
  363. }
  364. .address-sec .icon-box {
  365. width: 30rpx;
  366. align-self: flex-start;
  367. overflow: hidden;
  368. margin-right: 35rpx;
  369. }
  370. .address-sec .icon-box .icon {
  371. width: 30rpx;
  372. height: 30rpx;
  373. }
  374. .address-sec .right-box {
  375. width: 620rpx;
  376. }
  377. .address-sec .right-box .name-tel {
  378. font-size: 28rpx;
  379. color: #000;
  380. margin-bottom: 20rpx;
  381. }
  382. .address-sec .right-box .text {
  383. font-size: 24rpx;
  384. color: #888;
  385. line-height: 36rpx;
  386. height: 72rpx;
  387. overflow: hidden;
  388. }
  389. .wuliu-box {
  390. width: 720rpx;
  391. margin-left: 30rpx;
  392. border-bottom: 1rpx solid #eee;
  393. display: flex;
  394. align-items: center;
  395. padding: 30rpx 0;
  396. }
  397. .wuliu-box .icon-box {
  398. width: 40rpx;
  399. height: 40rpx;
  400. overflow: hidden;
  401. margin-right: 31rpx;
  402. align-self: flex-start;
  403. }
  404. .wuliu-box .icon-box .icon {
  405. width: 40rpx;
  406. height: 40rpx;
  407. }
  408. .wuliu-box .arrow-right {
  409. width: 15rpx;
  410. height: 24rpx;
  411. }
  412. .wuliu-box .arrow-right .arrow {
  413. width: 15rpx;
  414. height: 24rpx;
  415. }
  416. .wuliu-box .right-text {
  417. width: 575rpx;
  418. margin-right: 30rpx;
  419. }
  420. .wuliu-box .right-text .order-number {
  421. font-size: 28rpx;
  422. color: #000;
  423. margin-bottom: 14rpx;
  424. }
  425. .wuliu-box .right-text .wuliu-text,
  426. .wuliu-box .right-text .wuliu-date {
  427. font-size: 24rpx;
  428. color: #888;
  429. line-height: 36rpx;
  430. }
  431. .goods-list {
  432. width: 100%;
  433. background-color: #fff;
  434. margin-bottom: 24rpx;
  435. }
  436. .goods-list .list-title {
  437. font-size: 28rpx;
  438. color: #000;
  439. padding: 16rpx 24rpx;
  440. }
  441. .avaImgs {
  442. width: 50rpx;
  443. height: 50rpx;
  444. overflow: hidden;
  445. border-radius: 50%;
  446. background-color: #f3f5f7;
  447. margin-right: 20rpx;
  448. }
  449. .goods-info_box {
  450. width: 100%;
  451. overflow: hidden;
  452. border-top: 2rpx solid #eee;
  453. }
  454. .goods-img-container {
  455. overflow: hidden;
  456. padding: 30rpx;
  457. margin-bottom: 2rpx;
  458. box-sizing: border-box;
  459. }
  460. .goods-info .goods-des {
  461. width: 540rpx;
  462. height: 78rpx;
  463. line-height: 39rpx;
  464. font-size: 26rpx;
  465. color: #000;
  466. overflow: hidden;
  467. }
  468. .goods-img-container .img-box {
  469. width: 170rpx;
  470. height: 183.6rpx;
  471. background-color: #f7f7f7;
  472. overflow: hidden;
  473. float: left;
  474. display: -webkit-box;
  475. -webkit-box-align: center;
  476. -webkit-box-pack: center;
  477. }
  478. .goodsDetail_info {
  479. overflow: hidden;
  480. float: right;
  481. width: calc(100% - 194rpx);
  482. line-height: 1.5;
  483. position: relative;
  484. height:190rpx;
  485. }
  486. .goodsDetail_info .goods_name {
  487. padding-right: 66rpx;
  488. position: relative;
  489. font-size: 26rpx;
  490. margin-bottom: 6rpx;
  491. overflow: hidden;
  492. display: -webkit-box;
  493. -webkit-box-orient: vertical;
  494. -webkit-line-clamp: 2;
  495. }
  496. .goodsDetail_info .goods_name .goods_num {
  497. font-size: 24rpx;
  498. color: #666;
  499. position: absolute;
  500. top: 0;
  501. right: 0;
  502. }
  503. .goodsDetail_info .unimport {
  504. font-size: 24rpx;
  505. color: #999;
  506. }
  507. .goodsDetail_info .goods_price {
  508. position: absolute;
  509. left: 0;
  510. bottom: 0;
  511. font-size: 28rpx;
  512. line-height: 1.2;
  513. font-weight: 600;
  514. }
  515. .goods-img-container .img-box .goods-img {
  516. width: 100%;
  517. display: block;
  518. height: 100%;
  519. }
  520. .peisong-way {
  521. width: 100%;
  522. background-color: #fff;
  523. margin-bottom: 20rpx;
  524. }
  525. .peisong-way .row-box {
  526. width: 100%;
  527. display: flex;
  528. justify-content: space-between;
  529. align-items: center;
  530. box-sizing: border-box;
  531. padding: 24rpx 30rpx;
  532. font-size: 26rpx;
  533. line-height: 1.6;
  534. }
  535. .goods-info {
  536. width: 100%;
  537. background-color: #fff;
  538. margin-bottom: 20rpx;
  539. }
  540. .goods-info .row-box {
  541. width: calc(100% - 30rpx);
  542. display: flex;
  543. justify-content: space-between;
  544. /* align-items: center; */
  545. box-sizing: border-box;
  546. padding: 30rpx 30rpx 30rpx 0;
  547. margin-left: 30rpx;
  548. border-bottom: 1px solid #f5f5f5;
  549. font-size: 26rpx;
  550. color: #000;
  551. }
  552. .goods-info .row-box .row-label {
  553. width: calc(100% - 140rpx);
  554. }
  555. .goods-info .row-box .right-text {
  556. text-align: right;
  557. }
  558. .goods-info .row-box .right-text.r_color {
  559. font-weight: 600;
  560. }
  561. .order_info {
  562. width: 100%;
  563. background-color: #fff;
  564. box-sizing: border-box;
  565. padding: 16rpx 30rpx;
  566. margin-bottom: 20rpx;
  567. }
  568. .order_info .li_box {
  569. line-height: 1.6;
  570. padding: 10rpx 0;
  571. font-size: 26rpx;
  572. color: #999;
  573. }
  574. .order_info .li_box .info_data {
  575. display: inline-block;
  576. color: #000;
  577. }
  578. .jiesuan-box {
  579. display: flex;
  580. justify-content: space-between;
  581. width: 100%;
  582. height: 100rpx;
  583. position: fixed;
  584. bottom: 0;
  585. left: 0;
  586. border-top: 1px solid #eee;
  587. background-color: #fff;
  588. }
  589. .jiesuan-box .to-pay-btn {
  590. width: 250rpx;
  591. text-align: center;
  592. height: 100%;
  593. line-height: 100rpx;
  594. background-color: #fa2f2e;
  595. font-size: 32rpx;
  596. color: #fff;
  597. border-radius: 0;
  598. }
  599. .jiesuan-box .left-price {
  600. display: flex;
  601. width: 500rpx;
  602. justify-content: flex-start;
  603. line-height: 100rpx;
  604. padding: 0 30rpx;
  605. font-size: 28rpx;
  606. box-sizing: border-box;
  607. }
  608. .jiesuan-box .total {
  609. text-align: right;
  610. }
  611. .jiesuan-box .total .total_price {
  612. color: #fa2f2e;
  613. font-weight: 600;
  614. display: inline-flex;
  615. }
  616. .logistics_btn {
  617. padding: 24rpx 24rpx 24rpx 30rpx;
  618. width: 100%;
  619. overflow: hidden;
  620. box-sizing: border-box;
  621. font-size: 26rpx;
  622. line-height: 1.6;
  623. background-color: #fff;
  624. margin-bottom: 20rpx;
  625. }
  626. .l_box {
  627. width: 100%;
  628. box-sizing: border-box;
  629. overflow: hidden;
  630. padding: 0 28rpx 0 64rpx;
  631. white-space: nowrap;
  632. text-overflow: ellipsis;
  633. /* background: url(http://xcx.soowin.com/images/logis_icon.png) no-repeat left top, url(http://xcx.soowin.com/images/arrow-right.png) no-repeat right center;
  634. background-size: 46rpx auto, 16rpx auto; */
  635. background: url(http://xcx.soowin.com/images/logis_icon.png) no-repeat left top;
  636. background-size: 46rpx auto;
  637. }
  638. .detail_btn-row-box {
  639. height: 104rpx;
  640. }
  641. .detail_btn-row {
  642. width: 100%;
  643. height: 104rpx;
  644. padding: 18rpx 30rpx;
  645. box-sizing: border-box;
  646. overflow: hidden;
  647. position: fixed;
  648. left: 0;
  649. bottom: 0;
  650. background: #fff;
  651. display: flex;
  652. justify-content: flex-end;
  653. font-size: 26rpx;
  654. align-items: center;
  655. box-shadow: 0rpx -2rpx 16rpx rgba(0, 0, 0, 0.04);
  656. }
  657. .detail_btn-row .btn {
  658. box-sizing: border-box;
  659. text-align: center;
  660. border-radius: 6rpx;
  661. margin-left: 20rpx;
  662. border: 1rpx solid #ccc;
  663. padding: 16rpx 24rpx;
  664. }
  665. .detail_btn-row .topay-btn {
  666. border-color: #e05f0b;
  667. background-color: #e05f0b;
  668. color: #fff;
  669. }
  670. .footerMargin {
  671. margin-bottom: 104rpx;
  672. }
  673. // 备注
  674. .remark {
  675. width: 100%;
  676. overflow: hidden;
  677. background: #fff;
  678. padding: 30rpx;
  679. box-sizing: border-box;
  680. margin-top: 3rpx;
  681. }
  682. // 备注-end
  683. </style>