123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- <template>
- <view>
- <u-navbar title="订单详情" :border="true" :placeholder="true" :autoBack="true" leftIconColor="#fff"
- bgColor="#E96737" />
- <view class="detail">
- <view class="detail-state">
- <view class="detail-state-title">
- <text>订单状态:</text>
- <text>{{ status.desc }}</text>
- </view>
- </view>
- <view class="detail-info">
- <view class="detail-info-title">商品信息</view>
- <view class="detail-info-content">
- <view class="detail-info-content-goods">
- <view class="flex detail-info-content-goods__detail" v-for="(item, index) in list" :key="index">
- <view class="detail-info-content-goods__detail__left">
- <view class="img">
- <image class="img" :src="item.picUrl" mode="aspectFill">
- </image>
- </view>
- <view class="info">
- <text>{{ item.title }}</text>
- <text>面值:{{ $numberFormat(item.facePrice) }}元</text>
- <text>规格:{{ item.pkgUnit }}张/包 </text>
- </view>
- </view>
- <view class="detail-info-content-goods__detail__right">
- <text>¥{{ $numberFormat(item.pkgSalePrice) }}</text>
- <text>x {{ item.orderNum }}</text>
- </view>
- </view>
- </view>
- <view class="detail-info-content-money">
- <view class="detail-info-content-money__item">
- <text>商品金额</text>
- <text>¥{{ $numberFormat(info.orderAmt) }}</text>
- </view>
- <view class="detail-info-content-money__item">
- <text>运费</text>
- <text>¥{{ $numberFormat(info.freightAmt) }}</text>
- </view>
- </view>
- <view class="detail-info-content-toatl">
- <text v-if="status.value == 0">需付款:</text>
- <text v-else>实付:</text>
- <text>¥{{ $numberFormat(info.payAmt) }}</text>
- </view>
- </view>
- </view>
- <view class="detail-info">
- <view class="detail-info-title">订单信息</view>
- <view class="detail-info-content">
- <view class="detail-info-content-desc">
- <view>收货信息:</view>
- <view>
- {{ info.receiver }},{{ info.tel }},{{ info.province }}{{ info.city }}{{ info.area }}{{ info.address }}
- </view>
- </view>
- <view class="detail-info-content-desc">
- <view>订单编号:</view>
- <view>{{ info.orderId }}</view>
- </view>
- <view class="detail-info-content-desc">
- <view>下单时间:</view>
- <view>{{ $parseTime(info.createdTime) }}</view>
- </view>
- </view>
- </view>
- <view class="detail-info" v-if="status.value == 2">
- <view class="detail-info-title">发货信息</view>
- <view class="detail-info-content">
- <view class="detail-info-content-desc">
- <view>快递公司:</view>
- <view>快递123</view>
- </view>
- <view class="detail-info-content-desc">
- <view>物流单号:</view>
- <view>123456789</view>
- </view>
- <view class="detail-info-content-desc">
- <view>发货时间:</view>
- <view>2345-234-234</view>
- </view>
- </view>
- </view>
- </view>
- <view class="detail-btn" v-if="status.value == 0">
- <text @click="cancelOrder">取消订单</text>
- <text @click="payOrder">去支付</text>
- </view>
- </view>
- </template>
- <script>
- import env from '../../config/env.js'
- import $http from '@/utils/request.js'
- export default {
- data() {
- return {
- orderId: '',
- status: {},
- info: {},
- addr: {},
- list: [],
- };
- },
- onLoad(opthios) {
- console.log(opthios);
- this.orderId = opthios.id
- this.getDetail()
- },
- methods: {
- getDetail() {
- $http.post('/api/v1/mp/channel/mall/order/detail', {
- orderId: this.orderId
- }).then(res => {
- console.log(res);
- this.info = res.data
- this.status = JSON.parse(res.data.status)
- res.data.items.forEach(item => {
- let picUrlArr = item.picUrl.split(',')
- item.picUrl = env.filePublic + picUrlArr[0]
- })
- this.list = res.data.items
- console.log(this.info, this.addr, this.list);
- })
- },
- cancelOrder() {
- $http.post('/api/v1/mp/channel/mall/order/cancel', {
- orderId: this.orderId
- }).then(res => {
- if (res.code == 0) {
- uni.$u.toast('订单取消成功');
- setTimeout(() => {
- uni.navigateBack({
- delta: 1
- })
- }, 1000)
- }
- })
- },
- payOrder() {
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- /deep/ .u-navbar__content__title.u-navbar__content__title {
- color: #FFFFFF;
- }
- </style>
- <style lang="scss" scoped>
- .detail {
- margin: 10rpx;
- padding-bottom: 160rpx;
- &-state {
- padding: 28rpx;
- margin-bottom: 20rpx;
- background-color: #FFFFFF;
- &-title {
- line-height: 40rpx;
- font-weight: bold;
- }
- }
- &-info {
- margin-bottom: 20rpx;
- padding: 20rpx 28rpx;
- background-color: #FFFFFF;
- &-title {
- line-height: 40rpx;
- font-weight: bold;
- }
- &-content {
- &-goods {
- &__detail {
- padding: 20rpx 0;
- justify-content: space-between;
- border-bottom: 1px solid rgba(236, 236, 236, 100);
- &__left {
- display: flex;
- height: 170rpx;
- .img {
- image {
- width: 134rpx;
- height: 170rpx;
- margin-right: 20rpx;
- }
- }
- .info {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- text {
- font-size: 24rpx;
- color: #9D9D9D;
- }
- text:first-child {
- color: rgba(16, 16, 16, 100);
- font-size: 28rpx;
- }
- }
- }
- &__right {
- display: flex;
- height: 170rpx;
- flex-direction: column;
- justify-content: space-between;
- align-items: flex-end;
- text:first-child {
- font-size: 32rpx;
- color: $uni-text-color;
- }
- }
- }
- &__detail:last-child {
- border: none;
- }
- }
- &-money {
- margin-top: 40rpx;
- &__item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- line-height: 40rpx;
- margin-bottom: 24rpx;
- }
- }
- &-toatl {
- padding-top: 24rpx;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- font-weight: bold;
- }
- &-desc {
- display: flex;
- line-height: 40rpx;
- margin-top: 20rpx;
- margin-bottom: 24rpx;
- view:first-child {
- width: 150rpx;
- }
- view:last-child {
- width: calc(100% - 150rpx)
- }
- }
- &-desc:last-child {
- margin-bottom: 0;
- }
- }
- }
- }
- .detail-btn {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- position: fixed;
- bottom: var(--window-bottom);
- left: 0;
- right: 0;
- // min-height: 120rpx;
- z-index: 11;
- box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
- background: #fff;
- // margin-bottom: 40rpx;
- // 设置ios刘海屏底部横线安全区域
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- box-shadow: 0 -5rpx 5rpx #ececec;
- padding: 20rpx 20rpx;
- text {
- display: block;
- box-sizing: border-box;
- margin: 0 0 0 40rpx;
- width: 160rpx;
- height: 60rpx;
- line-height: 60rpx;
- text-align: center;
- font-size: 24rpx;
- border-radius: 8rpx;
- border: none;
- }
- text:first-child {
- background-color: #fff;
- line-height: 56rpx;
- border: 2rpx solid $uni-bg-color;
- }
- text:last-child {
- background-color: $uni-bg-color;
- color: #FFFFFF;
- }
- }
- </style>
|