index.vue 20 KB

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