123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- <template>
- <view class="aaa">
- <u-navbar title="我的订单" @leftClick="back" :border="true" :placeholder="true" :autoBack="false"
- leftIconColor="#fff" bgColor="#E96737" />
- <view class="order">
- <view class="flex order-state-search">
- <u-tabs @change="changeTab" :scrollable="false" :list="statusArr" lineWidth="30" lineHeight="1"
- lineColor="#E96737" :activeStyle="{
- color: '#E96737',
- transform: 'scale(1)'
- }" :inactiveStyle="{
- color: '#333',
- transform: 'scale(1)'
- }" itemStyle="padding-left: 25px; padding-right: 25px; height: 44px;">
- </u-tabs>
- <view class="test"></view>
- </view>
- <view class="order-list">
- <view class="order-list-data">
- <view class="order-list-data-item" v-for="(item, index) in list" :key="index">
- <view class="order-list-data-item__info">
- <view class="flex order-list-data-item__info__title">
- <view class="number">
- <text>订单编号:</text>
- <text>{{ item.orderId }}</text>
- </view>
- <view class="success" v-if="item.status.value == 1">{{ item.status.desc }}</view>
- <view v-else>{{ item.status.desc }}</view>
- </view>
- <navigator :url="`/pages/order/detail?id=${ item.orderId }`" hover-class="navigator-hover">
- <view class="flex order-list-data-item__info__detail"
- v-for="(items, index) in item.items" :key="index">
- <view class="order-list-data-item__info__detail__left">
- <view class="img">
- <image class="img" :src="items.picUrl" mode="aspectFill">
- </image>
- </view>
- <view class="info">
- <text>{{ items.title }}</text>
- <text>面值:{{ $numberFormat(items.facePrice) }}元</text>
- <text>规格:{{ items.pkgUnit }}张/包 </text>
- </view>
- </view>
- <view class="order-list-data-item__info__detail__right">
- <text>¥{{ $numberFormat(items.pkgSalePrice) }}</text>
- <text>x {{ items.orderNum }}</text>
- </view>
- </view>
- </navigator>
- <view class="order-list-data-item__info__total">
- <view>共{{ item.pkgNum }}个票包</view>
- <view class="money">
- <text>实付:</text>
- <text>¥{{ $numberFormat(item.payAmt) }}</text>
- </view>
- </view>
- <view class="order-list-data-item__info__btn" v-if="item.status.value == 0">
- <text @click="cancelOrder(item.orderId)">取消订单</text>
- <text @click="payOrder">去支付</text>
- </view>
- </view>
- </view>
- </view>
- <view class="flex empty" v-if="!list.length">
- <u-empty text="订单为空" mode="order" />
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import env from '../../config/env.js'
- import $http from '@/utils/request.js'
- export default {
- data() {
- return {
- loading: false,
- days: '1',
- pageNum: 1,
- total: 100,
- list: [],
- status: null,
- top: '',
- statusArr: [{
- name: '全部'
- }, {
- name: '待付款',
- }, {
- name: '待发货'
- }, {
- name: '已发货'
- }, ],
- backNum: ''
- };
- },
- onLoad(opthios) {
- this.backNum = opthios.back
- },
- onShow() {
- this.getList()
- },
- methods: {
- back() {
- if (this.backNum) {
- uni.navigateBack({
- delta: 2
- })
- } else {
- uni.navigateBack({
- delta: 1
- })
- }
- },
- getList(flag) {
- let data = {
- status: this.status
- }
- $http.post(`/api/v1/mp/channel/mall/order/list?pageNum=${ this.pageNum }&pageSize=15`,
- data).then(res => {
- console.log(res);
- if (res.code == 0) {
- res.rows.forEach(item => {
- let items = item.items
- items.forEach(item => {
- let picUrlArr = item.picUrl.split(',')
- item.picUrl = env.filePublic + picUrlArr[0]
- })
- item.status = JSON.parse(item.status)
- })
- this.total = res.total
- this.list = this.list.concat(res.rows)
- console.log(this.list);
- }
- })
- },
- cancelOrder(id) {
- $http.post('/api/v1/mp/channel/mall/order/cancel', {
- orderId: id
- }).then(res => {
- if (res.code == 0) {
- uni.$u.toast('订单取消成功');
- this.pageNum = 1
- this.list = []
- this.getList()
- }
- })
- },
- payOrder() {
- },
- changeTab(e) {
- if (e.index == 0) {
- this.status = null
- } else if (e.index == 1) {
- this.status = 0
- } else if (e.index == 2) {
- this.status = 1
- } else {
- this.status = 2
- }
- this.pageNum = 1
- this.list = []
- this.getList()
- },
- },
- onReachBottom() {
- console.log(111);
- // 判断是否有数据
- console.log(this.total);
- if (this.total >= this.pageNum * 15) {
- setTimeout(() => {
- ++this.pageNum
- this.getList()
- }, 500)
- } else {
- uni.$u.toast('没有更多数据了')
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- /deep/ .u-navbar__content__title.u-navbar__content__title {
- color: #FFFFFF;
- }
- </style>
- <style lang="scss" scoped>
- .order {
- padding-bottom: 40rpx;
- &-state-search {
- position: relative;
- width: 100%;
- position: fixed;
- z-index: 100;
- background-color: #FFFFFF;
- box-shadow: 0 5rpx 5rpx #ececec;
- }
- &-list {
- background-color: #F8F8F8;
- margin: 0rpx 10rpx 0;
- padding-top: 100rpx;
- &-data {
- navigator {
- margin-bottom: 10rpx;
- }
- navigator:last-child {
- margin-bottom: 0;
- }
- &-item {
- margin-bottom: 10rpx;
- padding: 20rpx 30rpx;
- background-color: #FFFFFF;
- justify-content: space-between;
- background-color: #FFFFFF;
- }
- &-item {
- &__info {
- &__title {
- justify-content: space-between;
- .number {
- line-height: 40rpx;
- }
- .success {
- color: $uni-text-color;
- }
- }
- &__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;
- }
- &__total {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- padding: 10rpx 0;
- .money {
- font-weight: bold;
- margin-left: 54rpx;
- }
- }
- &__btn {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- padding-top: 10rpx;
- border-top: 1px solid rgba(236, 236, 236, 100);
- 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;
- }
- }
- }
- }
- }
- }
- .empty {
- height: 60vh;
- }
- }
- </style>
|