takeout-info.vue 9.5 KB

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