express-info.vue 16 KB

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