| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442 |
- <template>
- <view class="flex-common-css iPhone-bottom box-border-box bgc-F5F4F9">
- <image class="order-bg" src="@/static/img/order-food/ss-bg.png" mode=""></image>
- <newNav :textType="false" class="mb-20" leftIconColor='#333'></newNav>
- <view class="p-24-24-0 box-border-box mb-32 z-3">
- <view class="" v-if="infoData.order_status == 1">
- <view class="fs-40 fc-3 fw-600 mb-8">
- {{infoData.order_status_str}},剩余{{time.m}}:{{time.s}}
- </view>
- <view class="fs-24 fc-FB3D03">
- 30分钟内未支付,订单将自动取消
- </view>
- </view>
- <view class="" v-else>
- <view class="fs-48 fc-3 fw-600">
- {{infoData.order_status_str || ''}}
- </view>
- </view>
- </view>
- <view class="plr-24 box-border-box" v-if="infoData.number">
- <view class="bgc-f b-rad-20 p-32-24 box-border-box fs-36 fw-600 fc-3">
- 取餐号:{{infoData.number?infoData.number:'无'}}
- </view>
- </view>
- <scroll-view :scroll-y="true" class="scroll-view-css box-border-box p-24-24-136-24"
- @scrolltolower="scrolltolower">
- <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
- <view class="align-items-center mb-24">
- <image class="shop-icon" src="/static/img/order-food/shop-icon.png" mode=""></image>
- <view class="w-420 fc-3 fs-28 text-overflow-ellipsis-one">
- {{infoData.shop.shop_name || ''}}
- </view>
- </view>
- <view class="goods-box" :class="infoData.item.length >= 4 && goodsShow?'goodsShowOne':'goodsShowTwo'">
- <view class="align-items-flex-start mb-28" v-for="(item,index) in infoData.item">
- <image class="goods-img mr-16 flex-shrink0" :src="item.goods_img" mode="aspectFill"></image>
- <view class="flex-1 flex-justify-space min-h-108">
- <view class="w376 flex-direction flex-justify-space">
- <view class="">
- <view class="fs-28 fc-3 fw-600 w-376 text-overflow-ellipsis-one mr-36">
- {{item.goods_name || ''}}
- </view>
- <view class="mb-2 fs-24 fc-9">
- {{item.goods_attr || ''}}
- </view>
- </view>
- <view class="fs-24 fc-9">
- x{{item.goods_number || ''}}
- </view>
- </view>
- <view class="fs-32 fc-3 fw-600">
- ¥{{ (Number(item.goods_money)).toFixed(2) }}
- </view>
- </view>
- </view>
- </view>
- <view class="align-items-center flex-justify-center p-24 b-b-F9F9F9 mb-32" @click="openGoods"
- v-if="infoData.item.length > 4">
- <view class="fs-24 fc-9 mr-4">
- {{goodsShow?'展开':'收起'}}{{infoData.item.length - 4}}件商品
- </view>
- <image v-if="goodsShow" class="icon-right" src="@/static/img/order/top.png" mode=""></image>
- <image v-else class="icon-right" src="@/static/img/order/bottom.png" mode=""></image>
- </view>
- <view class="align-items-center flex-justify-space mb-24" v-if="infoData.order_type === 2">
- <view class="fs-28 fc-3">
- 打包费
- </view>
- <view class="fs-32 fc-3">
- ¥{{infoData.pack_price}}
- </view>
- </view>
- <!-- <view class="align-items-center flex-justify-space pb-36 b-b-F9F9F9 mb-22">
- <view class="align-items-center">
- <image class="mr-6 icon-right" src="@/static/img/order/yhq.png" mode=""></image>
- <view class="fs-28 fc-3">
- 店铺优惠
- </view>
- </view>
- <view class="fs-32 fc-FB3D03">
- -¥{{infoData.coupon_money}}
- </view>
- </view> -->
- <view class="align-items-center flex-justify-end">
- <view class="fs-28 fc-9">
- 共{{infoData.goods_number}}件,
- </view>
- <view class="fs-28 fc-3">
- 实付
- </view>
- <view class="fs-24 fw-600 fc-3">
- ¥
- </view>
- <view class="fs-36 fw-600 fc-3">
- {{infoData.pay_money || ''}}
- </view>
- </view>
- </view>
- <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
- <view class="display-flex flex-justify-space mb-26">
- <view class="fs-28 fc-9">
- 备注
- </view>
- <view class="fs-28 fc-3 w-480 text-align-right">
- {{infoData.note?infoData.note:'无'}}
- </view>
- </view>
- <view class="display-flex flex-justify-space mb-26">
- <view class="fs-28 fc-9">
- 订单编号
- </view>
- <view class="align-items-center flex-justify-end">
- <view class="fs-28 fc-3 w-480 mr-8 text-align-right">
- {{infoData.order_sn}}
- </view>
- <image class="icon-fz" src="@/static/img/order/fz.png" mode="" @click="copy(infoData.order_sn)">
- </image>
- </view>
- </view>
- <view class="display-flex flex-justify-space mb-26">
- <view class="fs-28 fc-9">
- 下单时间
- </view>
- <view class="fs-28 fc-3 w-480 text-align-right">
- {{infoData.created_at}}
- </view>
- </view>
- <view class="display-flex flex-justify-space mb-26">
- <view class="fs-28 fc-9">
- 支付方式
- </view>
- <view class="fs-28 fc-3 w-480 text-align-right">
- {{infoData.pay_type_str}}
- </view>
- </view>
- <view class="display-flex flex-justify-space mb-26" v-if="infoData.is_reserve === 1">
- <view class="fs-28 fc-9">
- 预约时间
- </view>
- <view class="fs-28 fc-3 w-480 text-align-right">
- {{infoData.reserve_time}}
- </view>
- </view>
- <view class="display-flex flex-justify-space mb-26">
- <view class="fs-28 fc-9">
- 桌号
- </view>
- <view class="fs-28 fc-3 w-480 text-align-right">
- {{infoData.table_number}}
- </view>
- </view>
- <view class="display-flex flex-justify-space">
- <view class="fs-28 fc-9">
- 取餐号
- </view>
- <view class="fs-28 fc-3 w-480 text-align-right">
- {{infoData.number?infoData.number:'无'}}
- </view>
- </view>
- </view>
- </scroll-view>
- <view class="bot-box box-border-box align-items-center flex-justify-end bgc-f" v-if="infoData.order_status != 1">
- <view class="item-but fc-f fs-28 text-align-center b-rad-200" @click="goToUrl()">
- 再来一单
- </view>
- </view>
- </view>
- </template>
- <script>
- import cartStore from '@/utils/cartStore';
- import {
- commonRefundReason
- } from "@/api/common.js"
- import {
- orderInfo,
- orderCancel,
- orderPay
- } from "@/api/order.js"
- import tools from "@/service/tools";
- export default {
- components: {},
- data() {
- return {
- goodsShow: true,
- infoData: {
- item: [],
- },
- time: {
- day: '',
- h: "",
- m: '',
- s: '',
- },
- isAJAX: false
- };
- },
- onLoad(data) {
- if (data.orderId) {
- this.orderInfo(data.orderId)
- }
- },
- mounted() {},
- onUnload() {},
- methods: {
- goToUrl(item) {
- // 再来一单
- tools.showLoading()
- const success = cartStore.reorderFromOrderData(
- uni.getStorageSync('shop_id'),
- this.infoData.shopping_cart
- );
- if (success) {
- // 延迟跳转,让用户看到成功提示
- setTimeout(() => {
- // 跳转到店铺页面
- tools.hideLoading()
- uni.redirectTo({
- url: '/pages-takeout/new-shop'
- })
- }, 1500);
- } else {
- tools.error('再来一单失败');
- }
- },
- lookFinishImage(img) {
- tools.lookBigImg(1, img)
- },
- contactShop(phone) {
- uni.makePhoneCall({
- phoneNumber: phone, // 电话号码
- success: function() {
- console.log('拨打电话成功');
- },
- fail: function() {
- console.log('拨打电话失败');
- }
- });
- },
- copy(value) {
- uni.setClipboardData({
- data: value,
- success() {
- tools.success('复制成功')
- },
- fail() {
- tools.error("复制失败")
- }
- })
- },
- setAddress() {
- this.$refs.selectAddress.getList();
- },
- pay() {
- this.orderPay(this.infoData.id)
- },
- orderPay(id) {
- // 外卖支付
- uni.redirectTo({
- url: `/pages-takeout/pay-page?orderId=${id}`
- });
- },
- openGoods() {
- this.goodsShow = !this.goodsShow
- },
- scrolltolower() {
- // console.log('触底');
- },
- orderInfo(id) {
- tools.showLoading()
- orderInfo({
- order_id: id
- }).then((res) => {
- if (res.code == 1) {
- this.infoData = res.data
- if (this.infoData.order_status == 1) {
- tools.hideLoading()
- // 替换“-”为“/”,转换为 iOS 支持的格式
- let compatibleDateString = (res.data.created_at).replace(/-/g, '/');
- let createDate = new Date(compatibleDateString); //格式化订单创建时候的时间
- createDate.setMinutes(createDate.getMinutes() + 30)
- this.setCountDown(createDate)
- }
- }
- })
- },
- setCountDown(sTime) {
- let end = new Date(sTime).getTime();
- let now = new Date().getTime();
- let msec = end - now;
- this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
- let h = parseInt(msec / 1000 / 60 / 60 % 24);
- let m = parseInt(msec / 1000 / 60 % 60);
- let s = parseInt(msec / 1000 % 60);
- this.time.h = h > 9 ? h : '0' + h;
- this.time.m = m > 9 ? m : '0' + m;
- this.time.s = s > 9 ? s : '0' + s;
- msec -= 1000;
- if (this.time.day >= 1) {
- this.showTime = true;
- } else {
- this.showTime = false;
- };
- if (msec >= 0) {
- setTimeout(() => {
- this.setCountDown(sTime);
- }, 1000);
- } else {
- this.time.h = '--';
- this.time.m = '--';
- this.time.s = '--';
- };
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .w376 {
- width: 376rpx;
- }
- .min-h-108 {
- min-height: 108rpx;
- }
- .shop-icon {
- width: 48rpx;
- height: 48rpx;
- }
- .p-24-24-136-24 {
- padding: 24rpx 24rpx 136rpx;
- }
- .item-but {
- width: 200rpx;
- height: 80rpx;
- line-height: 80rpx;
- background: linear-gradient(270deg, #FF3333 0%, #FE6122 100%);
- }
- .z-3 {
- position: relative;
- z-index: 3;
- }
- .order-bg {
- width: 100%;
- height: 14vh;
- position: fixed;
- left: 0;
- top: 0;
- }
- .bg-img {
- position: fixed;
- left: 0;
- top: 0;
- z-index: -1;
- width: 100%;
- height: 320rpx;
- }
- .w-33 {
- width: 33%;
- position: relative;
- }
- button::after {
- border: none !important;
- }
- .p-24-24-0 {
- padding: 24rpx 24rpx 0;
- }
- .icon {
- width: 48rpx;
- height: 48rpx;
- }
- .w-420 {
- width: 420rpx;
- }
- .goods-img {
- width: 108rpx;
- height: 108rpx;
- border-radius: 8rpx;
- }
- .w-376 {
- width: 376rpx;
- }
- .icon-right {
- width: 32rpx;
- height: 32rpx;
- }
- .w-480 {
- width: 480rpx;
- }
- .icon-fz {
- width: 24rpx;
- height: 24rpx;
- }
- .goods-box {
- overflow: hidden;
- }
- .goodsShowOne {
- max-height: 508rpx;
- transition: all .5s linear;
- }
- .goodsShowTwo {
- height: auto;
- transition: all .5s linear;
- }
- .popup-reason-box {
- width: 100%;
- height: 45vh;
- overflow: auto;
- border-radius: 20rpx 20rpx 0 0;
- background: #fff;
- padding: 24rpx 0 0;
- box-sizing: border-box;
- }
- .bot-box {
- width: 100%;
- position: fixed;
- padding: 16rpx 32rpx calc(env(safe-area-inset-bottom) + 16rpx);
- bottom: 0;
- left: 0;
- }
- </style>
|