takeout-info.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <template>
  2. <view class="flex-common-css iPhone-bottom box-border-box bgc-F5F4F9">
  3. <image class="order-bg" src="@/static/img/order-food/ss-bg.png" mode=""></image>
  4. <newNav :textType="false" class="mb-20" leftIconColor='#333'></newNav>
  5. <view class="p-24-24-0 box-border-box mb-32">
  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="z-3">
  15. <view class="fs-48 fc-3 fw-600">
  16. {{infoData.order_status_str}}
  17. </view>
  18. </view>
  19. </view>
  20. <view class="plr-24 box-border-box">
  21. <view class="bgc-f b-rad-20 p-32-24 box-border-box fs-36 fw-600 fc-3">
  22. 取单号:80
  23. </view>
  24. </view>
  25. <scroll-view :scroll-y="true" class="scroll-view-css box-border-box p-24-24-136-24" @scrolltolower="scrolltolower">
  26. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  27. <view class="w-420 fc-3 fs-32 fw-600 text-overflow-ellipsis-one mb-24">
  28. {{infoData.shop.shop_name}}
  29. </view>
  30. <view class="goods-box" :class="infoData.item.length >= 4 && goodsShow?'goodsShowOne':'goodsShowTwo'">
  31. <view class="align-items-center flex-justify-space mb-20" v-for="(item,index) in infoData.item">
  32. <image class="goods-img mr-16 flex-shrink0" :src="item.goods_img" mode="aspectFit"></image>
  33. <view class="">
  34. <view class="align-items-center flex-justify-space mb-2">
  35. <view class="fs-28 fc-3 w-376 text-overflow-ellipsis-one mr-36">
  36. {{item.goods_name}}
  37. </view>
  38. <view class="fs-32 fc-3 fw-600">
  39. ¥{{ (Number(item.goods_number) * Number(item.goods_price)).toFixed(2) }}
  40. </view>
  41. </view>
  42. <view class="mb-2 fs-24 fc-9">
  43. {{item.goods_attr}}
  44. </view>
  45. <view class="fs-24 fc-9">
  46. x{{item.goods_number}}
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="align-items-center flex-justify-center p-24 b-b-F9F9F9 mb-32" @click="openGoods"
  52. v-if="infoData.item.length > 4">
  53. <view class="fs-24 fc-9 mr-4">
  54. {{goodsShow?'展开':'收起'}}{{infoData.item.length - 4}}件商品
  55. </view>
  56. <image v-if="goodsShow" class="icon-right" src="@/static/img/order/top.png" mode=""></image>
  57. <image v-else class="icon-right" src="@/static/img/order/bottom.png" mode=""></image>
  58. </view>
  59. <view class="align-items-center flex-justify-space mb-24">
  60. <view class="fs-28 fc-3">
  61. 打包费
  62. </view>
  63. <view class="fs-32 fc-3">
  64. ¥{{infoData.pack_price}}
  65. </view>
  66. </view>
  67. <view class="align-items-center flex-justify-space mb-24">
  68. <view class="fs-28 fc-3">
  69. 配送费
  70. </view>
  71. <view class="fs-32 fc-3">
  72. ¥{{infoData.delivery_money}}
  73. </view>
  74. </view>
  75. <view class="align-items-center flex-justify-space pb-36 b-b-F9F9F9 mb-22">
  76. <view class="align-items-center">
  77. <image class="mr-6 icon-right" src="@/static/img/order/yhq.png" mode=""></image>
  78. <view class="fs-28 fc-3">
  79. 店铺优惠
  80. </view>
  81. </view>
  82. <view class="fs-32 fc-FB3D03">
  83. -¥{{infoData.coupon_money}}
  84. </view>
  85. </view>
  86. <view class="align-items-center flex-justify-end">
  87. <view class="fs-28 fc-9">
  88. 共{{infoData.goods_number}}件,
  89. </view>
  90. <view class="fs-28 fc-3">
  91. 实付
  92. </view>
  93. <view class="fs-24 fw-600 fc-3">
  94. ¥
  95. </view>
  96. <view class="fs-36 fw-600 fc-3">
  97. {{infoData.pay_money}}
  98. </view>
  99. </view>
  100. </view>
  101. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  102. <view class="display-flex flex-justify-space mb-26">
  103. <view class="fs-28 fc-9">
  104. 备注
  105. </view>
  106. <view class="fs-28 fc-3 w-480 text-align-right">
  107. {{infoData.note?infoData.note:'无'}}
  108. </view>
  109. </view>
  110. <view class="display-flex flex-justify-space mb-26">
  111. <view class="fs-28 fc-9">
  112. 订单编号
  113. </view>
  114. <view class="align-items-center flex-justify-end">
  115. <view class="fs-28 fc-3 w-480 mr-8 text-align-right">
  116. {{infoData.order_sn}}
  117. </view>
  118. <image class="icon-fz" src="@/static/img/order/fz.png" mode="" @click="copy(infoData.order_sn)">
  119. </image>
  120. </view>
  121. </view>
  122. <view class="display-flex flex-justify-space mb-26">
  123. <view class="fs-28 fc-9">
  124. 下单时间
  125. </view>
  126. <view class="fs-28 fc-3 w-480 text-align-right">
  127. {{infoData.created_at}}
  128. </view>
  129. </view>
  130. <view class="display-flex flex-justify-space mb-26">
  131. <view class="fs-28 fc-9">
  132. 支付方式
  133. </view>
  134. <view class="fs-28 fc-3 w-480 text-align-right">
  135. {{infoData.pay_type_str}}
  136. </view>
  137. </view>
  138. <view class="display-flex flex-justify-space mb-26">
  139. <view class="fs-28 fc-9">
  140. 桌号
  141. </view>
  142. <view class="fs-28 fc-3 w-480 text-align-right">
  143. {{infoData.pay_type_str}}
  144. </view>
  145. </view>
  146. <view class="display-flex flex-justify-space">
  147. <view class="fs-28 fc-9">
  148. 取单号
  149. </view>
  150. <view class="fs-28 fc-3 w-480 text-align-right">
  151. {{infoData.pay_type_str}}
  152. </view>
  153. </view>
  154. </view>
  155. </scroll-view>
  156. <view class="bot-box box-border-box align-items-center flex-justify-end bgc-f">
  157. <view class="item-but fc-f fs-28 text-align-center b-rad-200">
  158. 再来一单
  159. </view>
  160. </view>
  161. </view>
  162. </template>
  163. <script>
  164. import {
  165. commonRefundReason
  166. } from "@/api/common.js"
  167. import {
  168. orderInfo,
  169. orderCancel,
  170. orderPay
  171. } from "@/api/order.js"
  172. import tools from "@/service/tools";
  173. export default {
  174. components: {},
  175. data() {
  176. return {
  177. goodsData: [{
  178. name: '1'
  179. }, {
  180. name: '2'
  181. }],
  182. goodsShow: true,
  183. infoData: {
  184. order_status_str: '商家已接单'
  185. },
  186. time: {
  187. day: '',
  188. h: "",
  189. m: '',
  190. s: '',
  191. },
  192. isAJAX: false,
  193. address_id: '',
  194. refund_msg: '', // 退款理由
  195. refundReason: [] //退款原因
  196. };
  197. },
  198. onLoad(data) {},
  199. mounted() {},
  200. onUnload() {},
  201. methods: {
  202. lookFinishImage(img) {
  203. tools.lookBigImg(1, img)
  204. },
  205. contactShop(phone) {
  206. uni.makePhoneCall({
  207. phoneNumber: phone, // 电话号码
  208. success: function() {
  209. console.log('拨打电话成功');
  210. },
  211. fail: function() {
  212. console.log('拨打电话失败');
  213. }
  214. });
  215. },
  216. copy(value) {
  217. uni.setClipboardData({
  218. data: value,
  219. success() {
  220. tools.success('复制成功')
  221. },
  222. fail() {
  223. tools.error("复制失败")
  224. }
  225. })
  226. },
  227. goToUrl() {
  228. // 再来一单
  229. // uni.navigateTo({
  230. // url: '/pages-takeout/takeout'
  231. // })
  232. uni.redirectTo({
  233. url: '/pages-takeout/shop?shop_id=' + this.infoData.shop_id
  234. })
  235. },
  236. setAddress() {
  237. this.$refs.selectAddress.getList();
  238. },
  239. giveAddress(e) {
  240. this.address_id = e;
  241. this.expressOrderAddress()
  242. },
  243. expressOrderAddress() {
  244. expressOrderAddress({
  245. order_id: this.infoData.id,
  246. address_id: this.address_id
  247. }).then((res) => {
  248. if (res.code == 1) {
  249. tools.success(res.msg)
  250. this.orderInfo(this.infoData.id)
  251. } else {
  252. tools.error(res.msg)
  253. }
  254. })
  255. },
  256. pay() {
  257. this.orderPay(this.infoData.id)
  258. },
  259. orderPay(id) {
  260. // 外卖支付
  261. uni.redirectTo({
  262. url: `/pages-takeout/pay-page?orderId=${id}`
  263. });
  264. },
  265. cancelOrder() {
  266. // 外卖取消订单
  267. commonRefundReason().then((res) => {
  268. if (res.code === 1) {
  269. this.refundReason = res.data
  270. this.refund_msg = res.data[0].refund_msg
  271. }
  272. })
  273. this.$refs.popupReason.open()
  274. },
  275. popCancel() {
  276. // 退款取消
  277. this.$refs.popupReason.close()
  278. },
  279. popSure() {
  280. // 退款确认
  281. if (this.isAJAX) {
  282. return
  283. }
  284. this.isAJAX = true;
  285. orderCancel({
  286. order_id: this.infoData.id,
  287. refund_msg: this.refund_msg
  288. }).then((res) => {
  289. if (res.code == 1) {
  290. tools.success(res.msg)
  291. this.$refs.popupReason.close()
  292. setTimeout(() => {
  293. this.orderInfo(this.infoData.id)
  294. }, 1500)
  295. this.isAJAX = false;
  296. } else {
  297. tools.error(res.msg)
  298. this.isAJAX = false;
  299. }
  300. })
  301. },
  302. openGoods() {
  303. this.goodsShow = !this.goodsShow
  304. },
  305. scrolltolower() {
  306. // console.log('触底');
  307. },
  308. orderInfo(id) {
  309. orderInfo({
  310. order_id: id
  311. }).then((res) => {
  312. if (res.code == 1) {
  313. this.infoData = res.data
  314. if (this.infoData.order_status == 1) {
  315. let createDate = new Date(res.data.created_at); //格式化订单创建时候的时间
  316. createDate.setMinutes(createDate.getMinutes() + 10)
  317. this.setCountDown(createDate)
  318. }
  319. }
  320. })
  321. },
  322. setCountDown(sTime) {
  323. let end = new Date(sTime).getTime();
  324. let now = new Date().getTime();
  325. let msec = end - now;
  326. this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
  327. let h = parseInt(msec / 1000 / 60 / 60 % 24);
  328. let m = parseInt(msec / 1000 / 60 % 60);
  329. let s = parseInt(msec / 1000 % 60);
  330. this.time.h = h > 9 ? h : '0' + h;
  331. this.time.m = m > 9 ? m : '0' + m;
  332. this.time.s = s > 9 ? s : '0' + s;
  333. msec -= 1000;
  334. if (this.time.day >= 1) {
  335. this.showTime = true;
  336. } else {
  337. this.showTime = false;
  338. };
  339. if (msec >= 0) {
  340. setTimeout(() => {
  341. this.setCountDown(sTime);
  342. }, 1000);
  343. } else {
  344. this.isTimeEnd = true;
  345. this.bText = '活动结束';
  346. this.time.h = '--';
  347. this.time.m = '--';
  348. this.time.s = '--';
  349. };
  350. }
  351. },
  352. }
  353. </script>
  354. <style lang="scss" scoped>
  355. .p-24-24-136-24{
  356. padding: 24rpx 24rpx 136rpx;
  357. }
  358. .item-but {
  359. width: 200rpx;
  360. height: 80rpx;
  361. line-height: 80rpx;
  362. background: linear-gradient(270deg, #FF3333 0%, #FE6122 100%);
  363. }
  364. .z-3 {
  365. position: relative;
  366. z-index: 3;
  367. }
  368. .order-bg {
  369. width: 100%;
  370. height: 14vh;
  371. position: fixed;
  372. left: 0;
  373. top: 0;
  374. }
  375. .bg-img {
  376. position: fixed;
  377. left: 0;
  378. top: 0;
  379. z-index: -1;
  380. width: 100%;
  381. height: 320rpx;
  382. }
  383. .w-33 {
  384. width: 33%;
  385. position: relative;
  386. }
  387. button::after {
  388. border: none !important;
  389. }
  390. .p-24-24-0 {
  391. padding: 24rpx 24rpx 0;
  392. }
  393. .icon {
  394. width: 48rpx;
  395. height: 48rpx;
  396. }
  397. .w-420 {
  398. width: 420rpx;
  399. }
  400. .goods-img {
  401. width: 108rpx;
  402. height: 108rpx;
  403. border-radius: 8rpx;
  404. }
  405. .w-376 {
  406. width: 376rpx;
  407. }
  408. .icon-right {
  409. width: 32rpx;
  410. height: 32rpx;
  411. }
  412. .w-480 {
  413. width: 480rpx;
  414. }
  415. .icon-fz {
  416. width: 24rpx;
  417. height: 24rpx;
  418. }
  419. .goods-box {
  420. overflow: hidden;
  421. }
  422. .goodsShowOne {
  423. max-height: 508rpx;
  424. transition: all .5s linear;
  425. }
  426. .goodsShowTwo {
  427. height: auto;
  428. transition: all .5s linear;
  429. }
  430. .popup-reason-box {
  431. width: 100%;
  432. height: 45vh;
  433. overflow: auto;
  434. border-radius: 20rpx 20rpx 0 0;
  435. background: #fff;
  436. padding: 24rpx 0 0;
  437. box-sizing: border-box;
  438. }
  439. .bot-box{
  440. width: 100%;
  441. position: fixed;
  442. padding: 16rpx 32rpx calc(env(safe-area-inset-bottom) + 16rpx);
  443. bottom: 0;
  444. left: 0;
  445. }
  446. </style>