123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409 |
- <template>
- <view class="container">
- <topNavBar title="全部订单" />
- <!-- 订单状态区 -->
- <view class="state-area dflex navbar-area bg-main">
- <view class="nav-item dflex-c pos-r fs h-full" :class="{ active: tabCurrentIndex === index }"
- v-for="(item, index) in navList" :key="index" @click="tabClick(index)">
- {{ item.state }}
- </view>
- </view>
- <!-- </scroll-view> -->
- <!-- 订单轮播区 -->
- <swiper class="swiper-area w-full" :duration="0" :current="tabCurrentIndex" @change="changeTab">
- <!-- 轮播项对应订单状态 -->
- <swiper-item class="tab-content wh-full" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
- <!-- 滚动区 -->
- <scroll-view class="h-full" scroll-y @scrolltolower="loadData">
- <!-- 空白页 -->
- <view v-if="!tabItem.loaded && (!tabItem.orderList || tabItem.orderList.length === 0)"
- class="emptys">
- <u-empty text="订单是空的~"
- v-if="!tabItem.loaded && (!tabItem.orderList || tabItem.orderList.length === 0)"
- mode="order">
- </u-empty>
- </view>
- <!-- 订单列表区 -->
- <view class="margin-bottom-sm" :class="index === 0 ? 'padding-top-sm' : ''"
- v-for="(item, index) in tabItem.orderList" :key="index">
- <!-- 订单项 -->
- <view class="order-item padding bg-main border-radius">
- <view @click="todetail(item)">
- <view class="dflex-b padding-bottom-sm">
- <view class="fs-xs fwb dflex">
- <u-tag :text="item.pickupInfo.pickupType ? '堂食' : '打包'" size="mini"
- bgColor="#FFF4E4" color="#F5821F" shape="circle"
- borderColor="#FFF4E4"></u-tag>
- 订单编号:{{ item.orderId }}
- </view>
- <text class="fs-xs active">
- <text v-if="item.orderState == '1'">待付款</text>
- <text v-else-if="item.orderState == '6'">已完成</text>
- </text>
- </view>
- <!-- 订单商品明细 -->
- <view class="goods-area dflex-b">
- <view class="pic-list dflex">
- <view v-for="(i, gindex) in item.orderItemVoList" :key="gindex"
- class="margin-right-sm">
- <image v-if="i.picUrl" mode="aspectFit" class="wh-full" :src="i.picUrl">
- </image>
- <view v-else class="pic"></view>
- </view>
- </view>
- <view class="next-detail">
- <text v-if="item.orderItemVoList">共{{item.orderItemVoList.length}}件</text>
- <u-icon name="arrow-right" size="20"></u-icon>
- </view>
- </view>
- <!-- 实付款 -->
- <view class="dflex-e padding-top-sm">
- <text class="fs-xs margin-right-xs"
- v-if="item.orderItemVoList">共{{item.orderItemVoList.length}}份商品</text>
- <text class="fs-xs margin-right-xs">实付</text>
- <text class="price ft-main">{{ item.payAmount}}</text>
- </view>
- </view>
- <!-- 订单操作区 -->
- <view class="dflex-b margin-top-sm">
- <view>
- <text class="ft-dark">更多</text>
- </view>
- <view class="dflex-e">
- <view class="dflex">
- <button class="action-btn border-radius-big bg-main"
- @click="toDelete()">取消订单</button>
- <button class="action-btn border-radius-big bg-main"
- @click="todetail(item)">订单详情</button>
- <button class="action-btn border-radius-big bg-main main-btn"
- @click="todetail(item)">去支付</button>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 上拉加载更多 -->
- <use-loadmore v-if="tabItem.orderList.length > 0 && tabItem.loaded && tabItem.hasmore"
- :type="tabItem.loadingType"></use-loadmore>
- </scroll-view>
- </swiper-item>
- </swiper>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- tabCurrentIndex: 0,
- navData: {},
- navList: [{
- id: 0,
- state: '全部',
- loadingType: 'more',
- orderList: [{
- order_detail: [{
- goods_img: '../../../static/x2.jpg',
- goods_name: '商品1',
- goods_name_pw: '小标题',
- goods_num: 1,
- goods_sku_name: 60,
- goods_price: 10
- }],
- order: {
- order_actural_paid: 10,
- order_refund_state: '处理中',
- state: '待发货'
- }
- },
- {
- order_detail: [{
- goods_img: '../../../static/x2.jpg',
- goods_name: '商品1',
- goods_name_pw: '小标题',
- goods_num: 1,
- goods_sku_name: 60,
- goods_price: 10
- }],
- order: {
- order_actural_paid: 10,
- state: '待发货'
- }
- }
- ]
- },
- {
- id: 1,
- state: '待付款',
- loadingType: 'more',
- orderList: []
- },
- {
- id: 2,
- state: '待核销',
- loadingType: 'more',
- orderList: []
- },
- {
- id: 3,
- state: '已取消',
- loadingType: 'more',
- orderList: []
- },
- {
- id: 4,
- state: '已完成',
- loadingType: 'more',
- orderList: []
- }
- ],
- reqdata: {
- page: 1,
- rows: 10
- },
- scrollLeft: 0,
- title: '全部'
- }
- },
- onLoad(e) {
- this.tabCurrentIndex = parseFloat(e.type);
- this.fatchDate()
- },
- methods: {
- async fatchDate() {
- const e = uni.getStorageSync('carl')
- const params = {
- storeId: e.id
- }
- const result = await this.$request('get', '/order/tradeOrder/queryTradeOrder', params)
- if (result) {
- console.log('result', result.rows)
- this.navList[0].orderList = result.rows
- console.log('orderList', this.navList[0].orderList)
- this.navList[1].orderList = result.rows.filter(item => item.orderState == '1')
- this.navList[2].orderList = result.rows.filter(item => item.orderState == '3')
- this.navList[3].orderList = result.rows.filter(item => item.orderState == '8')
- this.navList[4].orderList = result.rows.filter(item => item.orderState == '6')
- }
- },
- loadData() {},
- // swiper 切换
- changeTab(e) {
- this.tabCurrentIndex = e.target.current;
- },
- //顶部tab点击
- tabClick(index) {
- this.tabCurrentIndex = index;
- },
- // 点击跳转详情页面
- todetail(order) {
- console.log('order', order)
- // uni.navigateTo({
- // url: `/pages/user/order/order-detail?order_id=${order.order_id}`
- // });
- uni.navigateTo({
- url: `/pages/order/orderPaid/orderPaid?data=${encodeURIComponent(JSON.stringify(order))}`
- });
- },
- // 立即支付
- payment(order) {
- },
- toDelete() {
- this.$refs.uToast.show({
- type: 'default',
- title: '默认主题',
- message: "演示阶段暂时不能取消",
- position: 'center'
- })
- },
- // 删除订单
- delOrder(item) {
- let _this = this;
- uni.showModal({
- title: '提示',
- content: '删除订单',
- success: function(res) {
- if (res.confirm) {
- uni.showLoading({
- title: '请稍后'
- });
- } else if (res.cancel) {
- console.log('点击取消');
- }
- },
- complete() {
- uni.hideLoading();
- }
- });
- },
- // 取消订单
- cancelOrder(item) {
- let _this = this;
- uni.showModal({
- title: '提示',
- content: '取消订单',
- success: function(res) {
- if (res.confirm) {
- uni.showLoading({
- title: '请稍后'
- });
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- },
- complete() {
- uni.hideLoading();
- }
- });
- },
- // 申请退款
- torefund(data) {
- },
- // 评价
- toevaluate(item) {
- }
- }
- }
- </script>
- <style lang="scss">
- page,
- .container {
- min-height: 100%;
- background: $page-color-base;
- }
- .emptys {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- height: 100%;
- }
- /* 订单状态区 */
- .navbar-area {
- white-space: nowrap;
- }
- .state-area {
- height: 7vh;
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
- z-index: 10;
- top: 0;
- }
- .nav-item {
- flex: 1;
- &.active {
- &:after {
- content: '';
- position: absolute;
- left: 50%;
- transform: translate(-50%);
- bottom: 0;
- width: 44px;
- height: 0;
- border-bottom: 2px solid $base-color;
- }
- }
- }
- /* 订单轮播区 */
- .swiper-area {
- height: 93vh;
- }
- /* 订单区 */
- .order-area {}
- /* 订单项 */
- .order-item {
- /* 订单商品明细区 */
- .goods-area {
- display: flex;
- image {
- width: 180rpx;
- height: 180rpx;
- }
- .right {
- padding: 0 30upx 0 24upx;
- overflow: hidden;
- .attr-box {
- font-size: $font-sm + 2upx;
- color: $font-color-light;
- padding: 10upx 12upx;
- }
- }
- }
- /* 操作按钮 */
- .action-btn {
- width: 156rpx;
- height: inherit;
- line-height: inherit;
- margin: 0;
- margin-left: 20rpx;
- padding: 12rpx 0;
- font-size: $font-sm + 2upx;
- color: $font-color-dark;
- /* #ifdef MP-QQ || MP-ALIPAY */
- border: 1px solid;
- /* #endif */
- &:after {
- border-radius: 100px;
- }
- &.main-btn {
- background: #fff9f9;
- color: $base-color;
- &:after {
- border-color: #f7bcc8;
- }
- }
- }
- }
- .pic-list {
- width: calc(100% - 130upx);
- .pic {
- margin-right: 20upx;
- height: 160rpx;
- width: 160rpx;
- background-color: #EEE;
- }
- .pic:last-child {
- margin: 0;
- }
- }
- .next-detail {
- width: 130upx;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- }
- </style>
|