123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639 |
- <template>
- <view>
- <u-navbar title="订单详情" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
- <view class="detail">
- <view class="detail-state">
- <view class="detail-state-title">
- <text>订单状态:</text>
- <text>{{ status.desc }}</text>
- </view>
- <view class="detail-state-time" v-if="status.value == 2">
- 还剩 {{ autoConfirmTime || "--" }} 自动确认
- </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>
- <view class="detail-info-content-goods__detail__right">
- <view class="ells title">{{ item.title }}</view>
- <view class="sku" v-if="item.properties">规格:{{ item.properties }}</view>
- <view class="num">数量:{{ item.goodsNum }}</view>
- </view>
- </view>
- </view>
- <view class="detail-info-content-money">
- <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="flex freight" v-if="info.memo != ''">
- <text style="margin-right: 30rpx;">留言:</text>
- <text>{{info.memo}}</text>
- </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 class="copy" @click="copyOrderId" v-if="status.value == 2 || status.value == 4">复制</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 || status.value == 4) && deliverList.length > 1">
- <view class="detail-info-title">发货信息</view>
- <view class="detail-info-content border" v-for="(item, index) in deliverList" :key="index">
- <view class="detail-info-content-desc">
- <view>配送方式:</view>
- <view>{{ item.companyName ? "快递发货" : "无需物流" }}</view>
- </view>
- <view class="detail-info-content-desc" v-if="item.companyName">
- <view>快递公司:</view>
- <view>{{ item.companyName || '-' }}</view>
- </view>
- <view class="detail-info-content-desc" v-if="item.deliveryFlowId">
- <view>物流单号:</view>
- <view class="copy" @click="copyDeliveryFlowId(item.deliveryFlowId)">复制</view>
- <view>{{ item.deliveryFlowId || '-' }}</view>
- </view>
- <view class="detail-info-content-desc">
- <view>发货时间:</view>
- <view>{{ $parseTime(item.deliveryTime) }}</view>
- </view>
- <view class="detail-info-content-deliver">
- <view class="flex detail-info-content-deliver__detail" v-for="(items, indexs) in item.items"
- :key="indexs">
- <view class="detail-info-content-deliver__detail__left">
- <view class="img">
- <image class="img" :src="items.picUrl" mode="aspectFill">
- </image>
- </view>
- </view>
- <view class="detail-info-content-deliver__detail__right">
- <view class="title">{{ items.title }}</view>
- <view class="flex num">
- <view class="sku" v-if="!items.properties"></view>
- <view class="sku" v-if="items.properties">规格:{{ items.properties }}</view>
- <view class="">数量:{{ items.goodsNum }}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- -->
- <!-- <view class="detail-info" v-if="(status.value == 2 || status.value == 4) && deliverList.length == 1">
- <view class="detail-info-title">发货信息</view>
- <view class="detail-info-content" v-for="(item, index) in deliverList" :key="index">
- <view class="detail-info-content-desc">
- <view>配送方式:</view>
- <view>{{ item.companyName ? "快递发货" : "无需物流" }}</view>
- </view>
- <view class="detail-info-content-desc" v-if="item.companyName">
- <view>快递公司:</view>
- <view>{{ item.companyName || '-' }}</view>
- </view>
- <view class="detail-info-content-desc" v-if="item.deliveryFlowId">
- <view>物流单号:</view>
- <view class="copy" @click="copyDeliveryFlowId(item.deliveryFlowId)">复制</view>
- <view>{{ item.deliveryFlowId || '-' }}</view>
- </view>
- <view class="detail-info-content-desc">
- <view>发货时间:</view>
- <view>{{ $parseTime(item.deliveryTime) }}</view>
- </view>
- </view>
- </view> -->
- </view>
- <view class="footer-fixed" v-if="status.value == 2 || status.value == 3">
- <view class="flex btn">
- <view class="btn-right">
- <text class="logistics" @click="getLogistics">查看物流</text>
- </view>
- <view class="btn-right">
- <text class="confirm" @click="confirmOne" v-if="status.value == 2">确认收货</text>
- </view>
- </view>
- </view>
- <view class="footer-fixed" v-if="status.value == 0">
- <view class="flex btn">
- <view class="btn-right">
- <text class="logisticsCancel" @click="cancelOrder">取消订单</text>
- </view>
- <view class="btn-right">
- <text class="confirmPay" @click="payOrder">去支付</text>
- </view>
- </view>
- </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: [],
- deliverList: [],
- autoConfirmTime: '',
- };
- },
- onLoad(opthios) {
- this.orderId = opthios.id
- this.getDetail()
- },
- methods: {
- getDetail() {
- uni.showLoading({
- title: '加载中'
- });
- $http.post('/api/v1/mp/user/deliver/order/detail', {
- orderId: this.orderId
- }).then(res => {
- uni.hideLoading();
- this.info = res.data
- this.status = JSON.parse(res.data.status)
- this.autoConfirmTime = res.data.autoConfirmTime
- res.data.items.forEach(item => {
- let picUrlArr = item.picUrl.split(',')
- item.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/170'
- })
- res.data.deliverList && res.data.deliverList.forEach((item) => {
- item.items.forEach((ele) => {
- let picUrlArr = ele.picUrl.split(",");
- ele.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/170';
- });
- });
- this.deliverList = res.data.deliverList;
- this.list = res.data.items
- }).catch(() => {
- uni.hideLoading();
- })
- },
- cancelOrder() {
- let orderId = this.orderId
- uni.showModal({
- title: '提示',
- content: '您确认要取消订单吗?',
- success(res) {
- if (res.confirm) {
- $http.post('/api/v1/mp/user/deliver/order/cancel', {
- orderId
- }).then(res => {
- if (res.code == 0) {
- uni.$u.toast('订单取消成功');
- setTimeout(() => {
- uni.navigateBack({
- delta: 1
- })
- }, 500)
- }
- })
- }
- }
- })
- },
- payOrder() {
- let _this = this
- let payIng = false
- if (payIng) return
- uni.showLoading({
- title: '加载中'
- });
- $http.post('/api/v1/mp/user/deliver/order/pay', {
- orderId: _this.info.orderId,
- payType: 2
- }).then(ele => {
- payIng = true
- uni.hideLoading();
- if (ele.code == 0) {
- uni.requestPayment({
- timeStamp: ele.data.timeStamp,
- nonceStr: ele.data.nonceStr,
- package: ele.data.package,
- signType: ele.data.signType,
- paySign: ele.data.paySign,
- success() {
- uni.showToast({
- title: '支付成功',
- icon: 'success',
- duration: 2000
- })
- setTimeout(() => {
- uni.navigateBack({
- delta: 1
- })
- }, 500)
- },
- fail() {
- payIng = false
- }
- })
- } else {
- payIng = false
- uni.$u.toast('支付失败!');
- }
- }).catch(() => {
- payIng = false
- uni.$u.toast('支付失败!');
- uni.hideLoading();
- })
- },
- copyOrderId() {
- uni.setClipboardData({
- data: this.info.orderId,
- });
- },
- copyDeliveryFlowId(id) {
- uni.setClipboardData({
- data: id,
- });
- },
- // 查看物流
- getLogistics() {
- uni.navigateTo({
- url: `/packageGoods/order/logistics?id=${ this.orderId }`
- // url:`/pages/order/logistics?id=96666733329055749370`
- });
- },
- // 确认收货
- confirmOne() {
- let orderId = this.orderId
- uni.showModal({
- title: '提示',
- content: '确定已经收到货了吗?',
- success(res) {
- if (res.confirm) {
- $http.post('/api/v1/mp/user/deliver/order/confirm', {
- orderId
- }).then(res => {
- if (res.code == 0) {
- uni.$u.toast('确认收货成功');
- setTimeout(() => {
- uni.navigateBack({
- delta: 1
- })
- }, 500)
- }
- })
- }
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .footer-fixed {
- position: fixed;
- bottom: var(--window-bottom);
- left: 0;
- right: 0;
- z-index: 11;
- box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
- background: #fff;
- // 设置ios刘海屏底部横线安全区域
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- .btn {
- justify-content: flex-end;
- padding: 20rpx 40rpx;
- &-right {
- display: flex;
- align-items: center;
- justify-content: right;
- .value {
- color: $uni-text-color;
- }
- @mixin btn {
- width: 160rpx;
- height: 60rpx;
- line-height: 60rpx;
- border-radius: 8rpx;
- text-align: center;
- margin-left: 20rpx;
- }
- .logistics {
- @include btn
- border: 1px solid #bbbbbb;
- color: #414141;
- }
- .logisticsCancel {
- @include btn
- border: 2rpx solid $uni-bg-color;
- }
- .confirm {
- @include btn
- border: 2rpx solid rgba(236, 112, 9, 100);
- color: rgba(236, 112, 9, 100);
- }
- .confirmPay {
- @include btn
- background-color: $uni-bg-color;
- border: 2rpx solid $uni-bg-color;
- color: #FFFFFF;
- }
- }
- }
- }
- </style>
- <style lang="scss" scoped>
- .freight {
- margin-bottom: 20rpx;
- background-color: #fff;
- justify-content: space-between;
- padding: 20rpx 16rpx;
- }
- .detail {
- margin: 10rpx;
- padding-bottom: 160rpx;
- &-state {
- padding: 28rpx;
- margin-bottom: 20rpx;
- background-color: #FFFFFF;
- &-title {
- line-height: 40rpx;
- font-weight: bold;
- display: inline-block;
- }
- &-time {
- line-height: 40rpx;
- color: #b1b1b1;
- float: right;
- }
- }
- &-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: 170rpx;
- height: 170rpx;
- margin-right: 20rpx;
- }
- }
- }
- &__right {
- flex: 1;
- display: flex;
- height: 170rpx;
- flex-direction: column;
- justify-content: space-between;
- align-items: flex-start;
- font-size: 30rpx;
- .title {
- font-weight: bold;
- }
- .sku {
- color: #8C8C8C;
- }
- }
- }
- &__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 {
- position: relative;
- display: flex;
- line-height: 40rpx;
- margin-top: 20rpx;
- margin-bottom: 24rpx;
- view:first-child {
- width: 150rpx;
- }
- view:last-child {
- width: calc(100% - 150rpx)
- }
- .copy {
- position: absolute;
- right: 0;
- top: -6rpx;
- width: 136rpx;
- height: 52rpx;
- line-height: 52rpx;
- text-align: center;
- color: rgba(149, 149, 149, 100);
- border: 1px solid rgba(187, 187, 187, 100);
- border-radius: 10rpx;
- }
- }
- &-desc:last-child {
- margin-bottom: 0;
- }
- &-deliver {
- &__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: 170rpx;
- height: 170rpx;
- margin-right: 20rpx;
- }
- }
- }
- &__right {
- flex: 1;
- display: flex;
- height: 170rpx;
- flex-direction: column;
- justify-content: space-between;
- align-items: flex-end;
- .num {
- width: 100%;
- justify-content: space-between;
- .sku {
- color: #8C8C8C;
- }
- }
- }
- }
- &__detail:last-child {
- border: none;
- }
- }
- }
- .border {
- border-bottom: 1px solid rgba(236, 236, 236, 100);
- }
- .border:last-child {
- border: none;
- }
- }
- }
- .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>
|