run-errands-info.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. <template>
  2. <view class="flex-common-css iPhone-bottom box-border-box">
  3. <Nav title=" " leftIconColor="#333" titleColor="#333" bgckgroundBox='transparent'></Nav>
  4. <image class="bg-img" src="@/static/img/order/bg.png" mode=""></image>
  5. <view class="p-24-24-0 box-border-box">
  6. <view class="mb-24" v-if="infoData.order_status == 1">
  7. <view class="fs-40 fc-3 mb-8">
  8. {{infoData.order_status_str}},剩余{{time.m}}:{{time.s}}
  9. </view>
  10. <view class="fs-24 fc-FB3D03">
  11. 10分钟内未支付,订单将自动取消
  12. </view>
  13. </view>
  14. <view class="mb-24" v-else>
  15. <view class="fs-48 fc-3 fw-600">
  16. {{infoData.order_status_str}}
  17. </view>
  18. </view>
  19. <view class="bgc-f b-rad-20 p-24 box-border-box">
  20. <view class="p-b-20 mb-24 b-b-F9F9F9 fs-32 fc-3" v-show="infoData.order_status == 1">
  21. 请尽快支付
  22. </view>
  23. <view class="p-b-20 mb-24 b-b-F9F9F9 fs-32 fc-3"
  24. v-if="infoData.order_status == 4 || infoData.order_status == 5 || infoData.order_status == 6">
  25. 感谢你对君子校园的信任,期待你再次光临
  26. </view>
  27. <view class="align-items-center flex-wrap-wrap">
  28. <view class="w-33 flex-direction align-items-center" @click="pay"
  29. v-show="infoData.order_status == 1">
  30. <image class="mb-4 icon" src="@/static/img/order/qzf.png" mode=""></image>
  31. <view class="fs-24 fc-41ABF5">
  32. 去支付
  33. </view>
  34. </view>
  35. <view @click="goToUrl" class="w-33 flex-direction align-items-center"
  36. v-show="infoData.order_status == 4 || infoData.order_status == 5 || infoData.order_status == 6">
  37. <image class="mb-4 icon" src="@/static/img/order/zlyd.png" mode=""></image>
  38. <view class="fs-24 fc-41ABF5">
  39. 再来一单
  40. </view>
  41. </view>
  42. <view class="w-33 flex-direction align-items-center">
  43. <button class="item-box-button" open-type="contact" :bindcontact="handleContact"></button>
  44. <image class="mb-4 icon" src="@/static/img/order/lxkf.png" mode=""></image>
  45. <view class="fs-24 fc-3">
  46. 联系客服
  47. </view>
  48. </view>
  49. <view class="w-33 flex-direction align-items-center" v-show="infoData.order_status == 2"
  50. @click="cancelOrder">
  51. <image class="mb-4 icon" src="@/static/img/order/qxdd.png" mode=""></image>
  52. <view class="fs-24 fc-3">
  53. 取消订单
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <scroll-view :scroll-y="true" class="scroll-view-css p-24 box-border-box" @scrolltolower="scrolltolower">
  60. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  61. <view class="align-items-center mb-24">
  62. <image class="shops-img" :src="infoData.errands.img" mode="aspectFit"></image>
  63. <view class="w-420 fc-3 fs-32 fw-600 text-overflow-ellipsis-one">
  64. {{infoData.errands.name}}
  65. </view>
  66. </view>
  67. <view class="mb-24">
  68. <view class="content-b b-rad-20 fs-28 fc-0 bgc-F6F6F6 p-24 box-border-box">
  69. {{infoData.serve_desc}}
  70. </view>
  71. </view>
  72. <view class="align-items-center mb-24">
  73. <view class="fs-32 fw-600 fc-3 mr-12 flex-shrink0 w-64">
  74. 服务地址
  75. </view>
  76. <view class="fs-28 fc-3">
  77. {{infoData.serve_address}}
  78. </view>
  79. </view>
  80. <view class="align-items-center mb-24 p-b-20 b-b-999">
  81. <view class="fs-32 fw-600 fc-3 mr-12 flex-shrink0 w-64">
  82. 送达地址
  83. </view>
  84. <view class="fs-28 fc-3">
  85. {{infoData.address_id>0?infoData.school_name + infoData.dorm_name + infoData.address:'无'}}
  86. </view>
  87. </view>
  88. <view class="align-items-center flex-justify-space mb-24">
  89. <view class="fs-28 fc-3">
  90. 基础服务费
  91. </view>
  92. <view class="fs-32 fc-3">
  93. ¥ {{infoData.serve_money}}
  94. </view>
  95. </view>
  96. <view class="align-items-center flex-justify-space mb-24" v-if="infoData.item">
  97. <view class="fs-28 fc-3">
  98. {{infoData.item.goods_name}}({{infoData.item.goods_attr}})
  99. </view>
  100. <view class="fs-32 fc-3">
  101. ¥ {{infoData.item.goods_price}}
  102. </view>
  103. </view>
  104. <view class="align-items-center flex-justify-space mb-24" v-if="infoData.is_up === 1">
  105. <view class="fs-28 fc-3">
  106. 上楼加价
  107. </view>
  108. <view class="fs-32 fc-3">
  109. ¥ {{infoData.up_money}}
  110. </view>
  111. </view>
  112. <view class="align-items-center flex-justify-space mb-24">
  113. <view class="fs-28 fc-3">
  114. 打赏金额
  115. </view>
  116. <view class="fs-32 fc-3">
  117. ¥ {{infoData.reward_money?(Number(infoData.reward_money)).toFixed(2):'0.00'}}
  118. </view>
  119. </view>
  120. <!-- <view class="align-items-center flex-justify-space pb-36 b-b-F9F9F9 mb-22">
  121. <view class="align-items-center">
  122. <image class="mr-6 icon-right" src="@/static/img/order/yhq.png" mode=""></image>
  123. <view class="fs-28 fc-3">
  124. 优惠券
  125. </view>
  126. </view>
  127. <view class="fs-32 fc-FB3D03">
  128. -¥{{infoData.coupon_money}}
  129. </view>
  130. </view> -->
  131. <view class="align-items-center flex-justify-end">
  132. <view class="fs-28 fc-3">
  133. 金额
  134. </view>
  135. <view class="fs-24 fw-600 fc-3">
  136. ¥
  137. </view>
  138. <view class="fs-36 fw-600 fc-3">
  139. {{infoData.pay_money}}
  140. </view>
  141. </view>
  142. </view>
  143. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  144. <view class="display-flex flex-justify-space mb-26">
  145. <view class="fs-28 fc-9">
  146. 期望时间
  147. </view>
  148. <view class="fs-28 fc-3 w-480 text-align-right">
  149. {{infoData.serve_time}}
  150. </view>
  151. </view>
  152. <view class="display-flex flex-justify-space mb-26">
  153. <view class="fs-28 fc-9 flex-shrink0">
  154. 图片介绍
  155. </view>
  156. <view class="align-items-center images-box flex-wrap-wrap" v-if="infoData.images.length>0">
  157. <image class="images-img" v-for="(item,index) in infoData.images" :src="item" mode="aspectFit"
  158. @click="lookFinishImage(1,infoData.images,index)"></image>
  159. </view>
  160. <view v-else class="">
  161. 无
  162. </view>
  163. </view>
  164. <view class="display-flex flex-justify-space pb-20 mb-26">
  165. <view class="fs-28 fc-9">
  166. 骑手信息
  167. </view>
  168. <view class="fs-28 fc-3 w-480 text-align-right">
  169. {{infoData.rider.rider_name?infoData.rider.rider_name:'无'}}{{infoData.rider.phone || ''}}
  170. </view>
  171. </view>
  172. <view class="display-flex flex-justify-space mb-26">
  173. <view class="fs-28 fc-9">
  174. 订单编号
  175. </view>
  176. <view class="align-items-center flex-justify-end">
  177. <view class="fs-28 fc-3 w-480 mr-8 text-align-right">
  178. {{infoData.order_sn}}
  179. </view>
  180. <image class="icon-fz" src="@/static/img/order/fz.png" mode="" @click="copy(infoData.order_sn)">
  181. </image>
  182. </view>
  183. </view>
  184. <view class="display-flex flex-justify-space mb-26">
  185. <view class="fs-28 fc-9">
  186. 下单时间
  187. </view>
  188. <view class="fs-28 fc-3 w-480 text-align-right">
  189. {{infoData.created_at}}
  190. </view>
  191. </view>
  192. <view class="display-flex flex-justify-space mb-26">
  193. <view class="fs-28 fc-9">
  194. 支付方式
  195. </view>
  196. <view class="fs-28 fc-3 w-480 text-align-right">
  197. {{infoData.pay_type_str}}
  198. </view>
  199. </view>
  200. <view class="display-flex flex-justify-space mb-26" v-if="infoData.order_status == 4">
  201. <view class="fs-28 fc-9">
  202. 送达图片
  203. </view>
  204. <view class="align-items-center images-box flex-wrap-wrap" v-if="infoData.finish_image.length>0">
  205. <image class="images-img" v-for="(item,index) in infoData.finish_image" :src="item" mode="aspectFit"
  206. @click="lookFinishImage(2,infoData.finish_image,index)"></image>
  207. </view>
  208. <view v-else class="">
  209. 无
  210. </view>
  211. <!-- <view class="fs-28 fc-3 w-480 text-align-right fc-41ABF5"
  212. @click="lookFinishImage(2,infoData.finish_image)">
  213. 点击查看
  214. </view> -->
  215. </view>
  216. <view class="display-flex flex-justify-space mb-26" v-if="infoData.order_status == 4">
  217. <view class="fs-28 fc-9">
  218. 完成时间
  219. </view>
  220. <view class="fs-28 fc-3 w-480 text-align-right">
  221. {{infoData.finish_time}}
  222. </view>
  223. </view>
  224. </view>
  225. </scroll-view>
  226. <uni-popup ref="popupReason" type="bottom" :is-mask-click="false" background-color="#fff"
  227. border-radius="10px 10px 0 0">
  228. <view class="popup-reason-box flex-direction">
  229. <view class="text-align-center fs-38 fw-600 fc-3 mb-18">
  230. 选择取消原因
  231. </view>
  232. <picker-view @change="bindChange" class="picker-view flex-1" :immediate-change='true'>
  233. <picker-view-column>
  234. <view class="picker-view-item" v-for="(item,index) in refundReason" :key="index">
  235. {{item.refund_msg}}
  236. </view>
  237. </picker-view-column>
  238. </picker-view>
  239. <view class="align-items-center flex-justify-space plr-24 box-border-box">
  240. <view class="flex-1 mr-20 pop-b text-align-center fs-36 b-r-ccc" @click="popCancel">
  241. 取消
  242. </view>
  243. <view class="flex-1 pop-b text-align-center bgc-41ABF5 fc-f fs-36" @click="popSure">
  244. 确定
  245. </view>
  246. </view>
  247. </view>
  248. </uni-popup>
  249. </view>
  250. </template>
  251. <script>
  252. import {
  253. commonRefundReason
  254. } from "@/api/common.js"
  255. import {
  256. errandsOrderInfo,
  257. errandsOrderCancel
  258. } from "@/api/errandsOrder.js"
  259. import tools from "@/service/tools";
  260. export default {
  261. components: {},
  262. data() {
  263. return {
  264. goodsData: [{
  265. name: '1'
  266. }, {
  267. name: '2'
  268. }],
  269. goodsShow: true,
  270. infoData: {},
  271. time: {
  272. day: '',
  273. h: "",
  274. m: '',
  275. s: '',
  276. },
  277. isAJAX: false,
  278. address_id: '',
  279. refund_msg: '', // 退款理由
  280. refundReason: [] //退款原因
  281. };
  282. },
  283. onLoad(data) {
  284. if (data) {
  285. // console.log(data);
  286. this.errandsOrderInfo(data.orderId)
  287. }
  288. },
  289. mounted() {},
  290. onUnload() {
  291. const takeOutData = {}
  292. errandsOrderInfo({
  293. order_id: this.infoData.id
  294. }).then((res) => {
  295. if (res.code == 1) {
  296. takeOutData.id = this.infoData.id
  297. takeOutData.order_status = res.data.order_status
  298. takeOutData.order_status_str = res.data.order_status_str
  299. uni.$emit('takeOutData', takeOutData)
  300. }
  301. })
  302. },
  303. methods: {
  304. popCancel() {
  305. // 退款取消
  306. this.$refs.popupReason.close()
  307. },
  308. popSure() {
  309. // 退款确认
  310. if (this.isAJAX) {
  311. return
  312. }
  313. this.isAJAX = true;
  314. errandsOrderCancel({
  315. order_id: this.infoData.id,
  316. refund_msg: this.refund_msg
  317. }).then((res) => {
  318. if (res.code == 1) {
  319. tools.success(res.msg)
  320. this.$refs.popupReason.close()
  321. setTimeout(() => {
  322. this.errandsOrderInfo(this.infoData.id)
  323. }, 1500)
  324. this.isAJAX = false;
  325. } else {
  326. tools.error(res.msg)
  327. this.isAJAX = false;
  328. }
  329. })
  330. },
  331. bindChange(e) {
  332. let num = e.detail.value[0]
  333. this.refund_msg = this.refundReason[num].refund_msg
  334. },
  335. lookFinishImage(type, img, index) {
  336. if (type === 1) {
  337. tools.lookBigImg(index, img)
  338. } else {
  339. tools.lookBigImg(1, img)
  340. }
  341. },
  342. copy(value) {
  343. uni.setClipboardData({
  344. data: value,
  345. success() {
  346. tools.success('复制成功')
  347. },
  348. fail() {
  349. tools.error("复制失败")
  350. }
  351. })
  352. },
  353. goToUrl() {
  354. // 再来一单
  355. uni.redirectTo({
  356. url: '/pages-takeout/run-errands'
  357. })
  358. },
  359. setAddress() {
  360. this.$refs.selectAddress.getList();
  361. },
  362. giveAddress(e) {
  363. this.address_id = e;
  364. this.expressOrderAddress()
  365. },
  366. expressOrderAddress() {
  367. expressOrderAddress({
  368. order_id: this.infoData.id,
  369. address_id: this.address_id
  370. }).then((res) => {
  371. if (res.code == 1) {
  372. tools.success(res.msg)
  373. this.errandsOrderInfo(this.infoData.id)
  374. } else {
  375. tools.error(res.msg)
  376. }
  377. })
  378. },
  379. pay() {
  380. uni.redirectTo({
  381. url: `/pages-takeout/run-errands-mod/pay-page?orderId=${this.infoData.id}`
  382. });
  383. },
  384. cancelOrder() {
  385. // 跑腿取消订单
  386. commonRefundReason().then((res) => {
  387. if (res.code === 1) {
  388. this.refundReason = res.data
  389. this.refund_msg = res.data[0].refund_msg
  390. }
  391. })
  392. this.$refs.popupReason.open()
  393. },
  394. openGoods() {
  395. this.goodsShow = !this.goodsShow
  396. },
  397. scrolltolower() {
  398. // console.log('触底');
  399. },
  400. errandsOrderInfo(id) {
  401. errandsOrderInfo({
  402. order_id: id
  403. }).then((res) => {
  404. if (res.code == 1) {
  405. this.infoData = res.data
  406. if (this.infoData.order_status == 1) {
  407. let createDate = new Date(res.data.created_at); //格式化订单创建时候的时间
  408. createDate.setMinutes(createDate.getMinutes() + 10)
  409. this.setCountDown(createDate)
  410. }
  411. }
  412. })
  413. },
  414. setCountDown(sTime) {
  415. let end = new Date(sTime).getTime();
  416. let now = new Date().getTime();
  417. let msec = end - now;
  418. this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
  419. let h = parseInt(msec / 1000 / 60 / 60 % 24);
  420. let m = parseInt(msec / 1000 / 60 % 60);
  421. let s = parseInt(msec / 1000 % 60);
  422. this.time.h = h > 9 ? h : '0' + h;
  423. this.time.m = m > 9 ? m : '0' + m;
  424. this.time.s = s > 9 ? s : '0' + s;
  425. msec -= 1000;
  426. if (this.time.day >= 1) {
  427. this.showTime = true;
  428. } else {
  429. this.showTime = false;
  430. };
  431. if (msec >= 0) {
  432. setTimeout(() => {
  433. this.setCountDown(sTime);
  434. }, 1000);
  435. } else {
  436. this.isTimeEnd = true;
  437. this.bText = '活动结束';
  438. this.time.h = '--';
  439. this.time.m = '--';
  440. this.time.s = '--';
  441. };
  442. }
  443. },
  444. }
  445. </script>
  446. <style lang="scss" scoped>
  447. .images-box {
  448. max-width: 60%;
  449. }
  450. .images-img {
  451. width: 50rpx;
  452. height: 50rpx;
  453. margin: 0 10rpx 10rpx 0;
  454. }
  455. .w-64 {
  456. width: 64rpx;
  457. }
  458. .popup-reason-box {
  459. width: 100%;
  460. height: 45vh;
  461. overflow: auto;
  462. border-radius: 20rpx 20rpx 0 0;
  463. background: #fff;
  464. padding: 24rpx 0 0;
  465. box-sizing: border-box;
  466. }
  467. .picker-view {
  468. width: 100%;
  469. // height: 70%;
  470. }
  471. .picker-view-item {
  472. // height: 90rpx;
  473. line-height: 68rpx;
  474. text-align: center;
  475. background: #F5F5F5;
  476. }
  477. .pop-b {
  478. height: 80rpx;
  479. line-height: 80rpx;
  480. border-radius: 20rpx;
  481. }
  482. .shops-img {
  483. width: 48rpx;
  484. height: 48rpx;
  485. margin: 0 8rpx 0 0;
  486. border-radius: 50%;
  487. }
  488. .bg-img {
  489. position: fixed;
  490. left: 0;
  491. top: 0;
  492. z-index: -1;
  493. width: 100%;
  494. height: 320rpx;
  495. }
  496. .w-33 {
  497. width: 33%;
  498. position: relative;
  499. }
  500. .item-box-button {
  501. position: absolute;
  502. width: 100%;
  503. height: 88rpx;
  504. top: 0;
  505. left: 0;
  506. z-index: 100;
  507. background-color: transparent;
  508. border: none !important;
  509. }
  510. button::after {
  511. border: none !important;
  512. }
  513. .p-24-24-0 {
  514. padding: 24rpx 24rpx 0;
  515. }
  516. .icon {
  517. width: 48rpx;
  518. height: 48rpx;
  519. }
  520. .w-420 {
  521. width: 420rpx;
  522. }
  523. .goods-img {
  524. width: 108rpx;
  525. height: 108rpx;
  526. border-radius: 8rpx;
  527. }
  528. .w-376 {
  529. width: 376rpx;
  530. }
  531. .icon-right {
  532. width: 32rpx;
  533. height: 32rpx;
  534. }
  535. .w-480 {
  536. width: 480rpx;
  537. }
  538. .icon-fz {
  539. width: 24rpx;
  540. height: 24rpx;
  541. }
  542. .goods-box {
  543. overflow: hidden;
  544. }
  545. .goodsShowOne {
  546. max-height: 508rpx;
  547. transition: all .5s linear;
  548. }
  549. .goodsShowTwo {
  550. height: auto;
  551. transition: all .5s linear;
  552. }
  553. </style>