run-errands-info.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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>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">
  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>
  161. <view class="display-flex flex-justify-space pb-20 mb-26">
  162. <view class="fs-28 fc-9">
  163. 骑手信息
  164. </view>
  165. <view class="fs-28 fc-3 w-480 text-align-right">
  166. {{infoData.rider.rider_name?infoData.rider.rider_name:'无'}}{{infoData.rider.phone || ''}}
  167. </view>
  168. </view>
  169. <view class="display-flex flex-justify-space mb-26">
  170. <view class="fs-28 fc-9">
  171. 订单编号
  172. </view>
  173. <view class="align-items-center flex-justify-end">
  174. <view class="fs-28 fc-3 w-480 mr-8 text-align-right">
  175. {{infoData.order_sn}}
  176. </view>
  177. <image class="icon-fz" src="@/static/img/order/fz.png" mode="" @click="copy(infoData.order_sn)">
  178. </image>
  179. </view>
  180. </view>
  181. <view class="display-flex flex-justify-space mb-26">
  182. <view class="fs-28 fc-9">
  183. 下单时间
  184. </view>
  185. <view class="fs-28 fc-3 w-480 text-align-right">
  186. {{infoData.created_at}}
  187. </view>
  188. </view>
  189. <view class="display-flex flex-justify-space mb-26">
  190. <view class="fs-28 fc-9">
  191. 支付方式
  192. </view>
  193. <view class="fs-28 fc-3 w-480 text-align-right">
  194. {{infoData.pay_type_str}}
  195. </view>
  196. </view>
  197. <view class="display-flex flex-justify-space mb-26" v-if="infoData.order_status == 4">
  198. <view class="fs-28 fc-9">
  199. 送达图片
  200. </view>
  201. <view class="fs-28 fc-3 w-480 text-align-right fc-41ABF5"
  202. @click="lookFinishImage(2,infoData.finish_image)">
  203. 点击查看
  204. </view>
  205. </view>
  206. <view class="display-flex flex-justify-space mb-26" v-if="infoData.order_status == 4">
  207. <view class="fs-28 fc-9">
  208. 完成时间
  209. </view>
  210. <view class="fs-28 fc-3 w-480 text-align-right">
  211. {{infoData.finish_time}}
  212. </view>
  213. </view>
  214. </view>
  215. </scroll-view>
  216. <uni-popup ref="popupReason" type="bottom" :is-mask-click="false" background-color="#fff"
  217. border-radius="10px 10px 0 0">
  218. <view class="popup-reason-box flex-direction">
  219. <view class="text-align-center fs-38 fw-600 fc-3 mb-18">
  220. 选择取消原因
  221. </view>
  222. <picker-view @change="bindChange" class="picker-view flex-1" :immediate-change='true'>
  223. <picker-view-column>
  224. <view class="picker-view-item" v-for="(item,index) in refundReason" :key="index">
  225. {{item.refund_msg}}
  226. </view>
  227. </picker-view-column>
  228. </picker-view>
  229. <view class="align-items-center flex-justify-space plr-24 box-border-box">
  230. <view class="flex-1 mr-20 pop-b text-align-center fs-36 b-r-ccc" @click="popCancel">
  231. 取消
  232. </view>
  233. <view class="flex-1 pop-b text-align-center bgc-41ABF5 fc-f fs-36" @click="popSure">
  234. 确定
  235. </view>
  236. </view>
  237. </view>
  238. </uni-popup>
  239. </view>
  240. </template>
  241. <script>
  242. import {
  243. commonRefundReason
  244. } from "@/api/common.js"
  245. import {
  246. errandsOrderInfo,
  247. errandsOrderCancel
  248. } from "@/api/errandsOrder.js"
  249. import tools from "@/service/tools";
  250. export default {
  251. components: {},
  252. data() {
  253. return {
  254. goodsData: [{
  255. name: '1'
  256. }, {
  257. name: '2'
  258. }],
  259. goodsShow: true,
  260. infoData: {},
  261. time: {
  262. day: '',
  263. h: "",
  264. m: '',
  265. s: '',
  266. },
  267. isAJAX: false,
  268. address_id: '',
  269. refund_msg: '', // 退款理由
  270. refundReason: [] //退款原因
  271. };
  272. },
  273. onLoad(data) {
  274. if (data) {
  275. // console.log(data);
  276. this.errandsOrderInfo(data.orderId)
  277. }
  278. },
  279. mounted() {},
  280. onUnload() {
  281. const takeOutData = {}
  282. errandsOrderInfo({
  283. order_id: this.infoData.id
  284. }).then((res) => {
  285. if (res.code == 1) {
  286. takeOutData.id = this.infoData.id
  287. takeOutData.order_status = res.data.order_status
  288. takeOutData.order_status_str = res.data.order_status_str
  289. uni.$emit('takeOutData', takeOutData)
  290. }
  291. })
  292. },
  293. methods: {
  294. popCancel() {
  295. // 退款取消
  296. this.$refs.popupReason.close()
  297. },
  298. popSure() {
  299. // 退款确认
  300. if (this.isAJAX) {
  301. return
  302. }
  303. this.isAJAX = true;
  304. errandsOrderCancel({
  305. order_id: this.infoData.id,
  306. refund_msg: this.refund_msg
  307. }).then((res) => {
  308. if (res.code == 1) {
  309. tools.success(res.msg)
  310. this.$refs.popupReason.close()
  311. setTimeout(() => {
  312. this.errandsOrderInfo(this.infoData.id)
  313. }, 1500)
  314. this.isAJAX = false;
  315. } else {
  316. tools.error(res.msg)
  317. this.isAJAX = false;
  318. }
  319. })
  320. },
  321. bindChange(e) {
  322. let num = e.detail.value[0]
  323. this.refund_msg = this.refundReason[num].refund_msg
  324. },
  325. lookFinishImage(type, img, index) {
  326. if (type === 1) {
  327. tools.lookBigImg(index, img)
  328. } else {
  329. tools.lookBigImg(1, img)
  330. }
  331. },
  332. copy(value) {
  333. uni.setClipboardData({
  334. data: value,
  335. success() {
  336. tools.success('复制成功')
  337. },
  338. fail() {
  339. tools.error("复制失败")
  340. }
  341. })
  342. },
  343. goToUrl() {
  344. // 再来一单
  345. uni.redirectTo({
  346. url: '/pages-takeout/run-errands'
  347. })
  348. },
  349. setAddress() {
  350. this.$refs.selectAddress.getList();
  351. },
  352. giveAddress(e) {
  353. this.address_id = e;
  354. this.expressOrderAddress()
  355. },
  356. expressOrderAddress() {
  357. expressOrderAddress({
  358. order_id: this.infoData.id,
  359. address_id: this.address_id
  360. }).then((res) => {
  361. if (res.code == 1) {
  362. tools.success(res.msg)
  363. this.errandsOrderInfo(this.infoData.id)
  364. } else {
  365. tools.error(res.msg)
  366. }
  367. })
  368. },
  369. pay() {
  370. uni.redirectTo({
  371. url: `/pages-takeout/run-errands-mod/pay-page?orderId=${this.infoData.id}`
  372. });
  373. },
  374. cancelOrder() {
  375. // 跑腿取消订单
  376. commonRefundReason().then((res) => {
  377. if (res.code === 1) {
  378. this.refundReason = res.data
  379. this.refund_msg = res.data[0].refund_msg
  380. }
  381. })
  382. this.$refs.popupReason.open()
  383. },
  384. openGoods() {
  385. this.goodsShow = !this.goodsShow
  386. },
  387. scrolltolower() {
  388. // console.log('触底');
  389. },
  390. errandsOrderInfo(id) {
  391. errandsOrderInfo({
  392. order_id: id
  393. }).then((res) => {
  394. if (res.code == 1) {
  395. this.infoData = res.data
  396. if (this.infoData.order_status == 1) {
  397. let createDate = new Date(res.data.created_at); //格式化订单创建时候的时间
  398. createDate.setMinutes(createDate.getMinutes() + 10)
  399. this.setCountDown(createDate)
  400. }
  401. }
  402. })
  403. },
  404. setCountDown(sTime) {
  405. let end = new Date(sTime).getTime();
  406. let now = new Date().getTime();
  407. let msec = end - now;
  408. this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
  409. let h = parseInt(msec / 1000 / 60 / 60 % 24);
  410. let m = parseInt(msec / 1000 / 60 % 60);
  411. let s = parseInt(msec / 1000 % 60);
  412. this.time.h = h > 9 ? h : '0' + h;
  413. this.time.m = m > 9 ? m : '0' + m;
  414. this.time.s = s > 9 ? s : '0' + s;
  415. msec -= 1000;
  416. if (this.time.day >= 1) {
  417. this.showTime = true;
  418. } else {
  419. this.showTime = false;
  420. };
  421. if (msec >= 0) {
  422. setTimeout(() => {
  423. this.setCountDown(sTime);
  424. }, 1000);
  425. } else {
  426. this.isTimeEnd = true;
  427. this.bText = '活动结束';
  428. this.time.h = '--';
  429. this.time.m = '--';
  430. this.time.s = '--';
  431. };
  432. }
  433. },
  434. }
  435. </script>
  436. <style lang="scss" scoped>
  437. .images-box {
  438. max-width: 60%;
  439. }
  440. .images-img {
  441. width: 50rpx;
  442. height: 50rpx;
  443. margin: 0 10rpx 10rpx 0;
  444. }
  445. .w-64 {
  446. width: 64rpx;
  447. }
  448. .popup-reason-box {
  449. width: 100%;
  450. height: 45vh;
  451. overflow: auto;
  452. border-radius: 20rpx 20rpx 0 0;
  453. background: #fff;
  454. padding: 24rpx 0 0;
  455. box-sizing: border-box;
  456. }
  457. .picker-view {
  458. width: 100%;
  459. // height: 70%;
  460. }
  461. .picker-view-item {
  462. // height: 90rpx;
  463. line-height: 68rpx;
  464. text-align: center;
  465. background: #F5F5F5;
  466. }
  467. .pop-b {
  468. height: 80rpx;
  469. line-height: 80rpx;
  470. border-radius: 20rpx;
  471. }
  472. .shops-img {
  473. width: 48rpx;
  474. height: 48rpx;
  475. margin: 0 8rpx 0 0;
  476. border-radius: 50%;
  477. }
  478. .bg-img {
  479. position: fixed;
  480. left: 0;
  481. top: 0;
  482. z-index: -1;
  483. width: 100%;
  484. height: 320rpx;
  485. }
  486. .w-33 {
  487. width: 33%;
  488. position: relative;
  489. }
  490. .item-box-button {
  491. position: absolute;
  492. width: 100%;
  493. height: 88rpx;
  494. top: 0;
  495. left: 0;
  496. z-index: 100;
  497. background-color: transparent;
  498. border: none !important;
  499. }
  500. button::after {
  501. border: none !important;
  502. }
  503. .p-24-24-0 {
  504. padding: 24rpx 24rpx 0;
  505. }
  506. .icon {
  507. width: 48rpx;
  508. height: 48rpx;
  509. }
  510. .w-420 {
  511. width: 420rpx;
  512. }
  513. .goods-img {
  514. width: 108rpx;
  515. height: 108rpx;
  516. border-radius: 8rpx;
  517. }
  518. .w-376 {
  519. width: 376rpx;
  520. }
  521. .icon-right {
  522. width: 32rpx;
  523. height: 32rpx;
  524. }
  525. .w-480 {
  526. width: 480rpx;
  527. }
  528. .icon-fz {
  529. width: 24rpx;
  530. height: 24rpx;
  531. }
  532. .goods-box {
  533. overflow: hidden;
  534. }
  535. .goodsShowOne {
  536. max-height: 508rpx;
  537. transition: all .5s linear;
  538. }
  539. .goodsShowTwo {
  540. height: auto;
  541. transition: all .5s linear;
  542. }
  543. </style>