123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445 |
- <template>
- <view class="pages" :style="{'min-height':h+'px','padding-top':(mt)+'px'}">
- <c-nav-bar title="我的订单"></c-nav-bar>
- <view class="tb">
- <view class="tabs">
- <view v-for="(item,index) in tabList" :key="index" @tap="changeTab1(index)">
- <text :class="index==current?'active':''">{{item.name}}</text>
- </view>
- </view>
- </view>
- <view class="mainContain">
- <view v-if="dataList.length>0" class="card" v-for="item,index in dataList" :key="index">
- <view class="header">
- <span style="font-weight: 700;">下单时间:{{item.orderTime}}</span>
- <text v-if='item.state==0' class="orange">待支付</text>
- <text v-else-if='item.state==1' class="red">已支付</text>
- <text v-else-if='item.state==-1' class="red">已取消</text>
- <text v-else-if='item.state==-2' class="green">退款中</text>
- <text v-else-if='item.state==3' class="green">已完成</text>
- <text v-else-if='item.state==-3' class="green">已退款</text>
- <text v-else-if='item.state==4' class="red">待使用</text>
- <text v-else-if='item.state==5' class="green">已预约</text>
- <text v-else :class="statusClass[item.state]">{{status[item.state]}}</text>
- </view>
- <view class="mainContent" @click="navTo(item)">
- <image class="image" :src="item.picList[0]" mode="aspectFill"></image>
- <view class="middle">
- <view class="title" style="display: flex; justify-content: space-between;">
- <span> {{item.thingName}}</span>
- <span> ¥{{item.totalPrice}}</span>
- </view>
- <span class='info' style="display: flex; justify-content: space-between;">
- <span>
- <span style="margin-right: 15rpx;">{{item.userName}}</span>
- <span>{{item.phone}}</span>
- </span>
- <span>x{{item.num}}</span>
- </span>
- </view>
- </view>
- <view class="bottom" @click="handleDetail(item)" v-if="item.state==4||item.state==5">
- <view class="detail del">
- 核销订单
- </view>
- </view>
- <view class="bottom" @click="Detail(item)" v-else>
- <view class="detail">
- 删除订单
- </view>
- </view>
- </view>
- <view class="nodata" v-if='dataList.length==0'>
- <NoData></NoData>
- </view>
- </view>
- </view>
- </template>
- <script>
- import TopTabs from '@/components/TopTabs/topTabs.vue';
- // import NoData from '../../components/NoData/index.vue';
- export default {
- components: {
- TopTabs,
- // NoData
- },
- data() {
- return {
- h: uni.getSystemInfoSync().windowHeight,
- mt: uni.getSystemInfoSync().statusBarHeight + 44,
- current: 0,
- mysearch: '',
- dataList: [],
- limit: 10,
- page: 1,
- state: '',
- fishermanId: uni.getStorageSync('merchantId'),
- statusClass: [
- '',
- 'green',
- 'blue',
- 'grey',
- 'grey',
- ],
- status: [
- '',
- '已预订',
- '已入住',
- '已退房',
- '已取消',
- ],
- // mt: uni.getSystemInfoSync().statusBarHeight + 44,
- tabList: [{
- name: '全部订单'
- },
- {
- name: '待支付'
- },
- {
- name: '待使用'
- },
- {
- name: '已完成'
- },
- {
- name: '退款/售后'
- },
- ],
- }
- },
- onLoad(option) {
- console.log(option.type);
- if (option.type) {
- console.log('1111');
- const type = parseInt(option.type)
- if (type == 0) {
- this.changeTab1(1)
- } else if (type == 4) {
- this.changeTab1(2)
- } else if (type == 3) {
- this.changeTab1(3)
- } else if (type == -3) {
- this.changeTab1(4)
- }
- } else {
- console.log('2222');
- this.getOrderList()
- }
- },
- methods: {
- // 去详情
- navTo(item) {
- uni.setStorageSync('list', item);
- uni.navigateTo({
- url: '/pagesHouse/Mine/ordersList/details/details'
- })
- },
- // 核销
- handleDetail() {
- // let dto = {
- // writeOffCode: item.orderCode
- // }
- // this.$api.post('/merchant/merchantFisherman/home/writeOffOrder?dto=', dto).then(res => {
- // })
- uni.navigateTo({
- url: '/pagesHouse/Verification/index'
- })
- },
- // 删除
- Detail(item) {
- console.log(this.current);
- this.$api.del('/merchant/merchantFisherman/home', [
- item.id
- ]).then(res => {
- if (res.data.code == 0) {
- this.$showToast('删除成功');
- // this.getOrderList()
- setTimeout(() => {
- this.changeTab1(this.current)
- }, 1000)
- } else {
- this.$showToast('删除失败');
- setTimeout(() => {
- this.changeTab1(this.current)
- }, 1000)
- // this.getOrderList()
- }
- })
- },
- changeTab1(index) {
- this.current = index;
- if (index === 0) this.state = '';
- else if (index === 1) this.state = '0'
- else if (index === 2) this.state = '4';
- else if (index === 3) this.state = '3';
- else if (index === 4) this.state = '-3';
- // else this.FormData.status = '0,1,-1,2,-2,-3,3,4,5,6,7,8,9,10,11';
- this.changeTab(index)
- },
- getOrderList(state) {
- this.$api.get('/merchant/merchantFisherman/home/queryMyOrderPage', {
- fishermanId: this.fishermanId,
- limit: this.limit,
- page: this.page,
- state: state ? state : ''
- }).then((res => {
- if (res.data.code == 0) {
- this.dataList = res.data.data.list
- } else {
- uni.showToast({
- title: res.data.msg,
- icon: 'none'
- })
- }
- }))
- },
- getOrderByStatusList(state) {
- this.$api.get('/merchant/merchantFisherman/home/queryMyOrderPage', {
- fishermanId: this.fishermanId,
- limit: this.limit,
- page: this.page,
- state: state
- }).then((res => {
- if (res.data.code == 0) {
- this.dataList = res.data.data.list
- } else {
- uni.showToast({
- title: res.data.msg,
- icon: 'none'
- })
- }
- }))
- },
- changeTab(index) {
- this.tabIdx = index;
- switch (index) {
- case 0:
- this.getOrderList()
- break
- case 1:
- // this.getOrderList(0)
- this.getOrderByStatusList(0)
- break
- case 2:
- this.getOrderList(4)
- break
- case 3:
- this.getOrderList(3)
- break
- case 4:
- this.getOrderList(-3)
- break
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .pages {
- background: #F9FAFC;
- box-sizing: border-box;
- .tb {
- width: 100%;
- top: 0;
- left: 0;
- z-index: 999;
- .searchBoxParent {
- width: 100%;
- background: #fff;
- padding: 20rpx 24rpx 6rpx;
- box-sizing: border-box;
- .searchBox {
- width: 100%;
- background-color: #fff;
- }
- }
- .tabs {
- background: #fff;
- padding: 26rpx 0;
- display: flex;
- align-items: center;
- width: 100%;
- &>view {
- width: 25%;
- font-size: 28rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: black;
- line-height: 40rpx;
- position: relative;
- text-align: center;
- }
- .active {
- font-size: 32rpx;
- font-family: PingFang-SC-Bold, PingFang-SC;
- font-weight: bold;
- color: black;
- line-height: 45rpx;
- }
- .active::after {
- position: absolute;
- content: '';
- width: 50rpx;
- height: 8rpx;
- background: #007A69;
- bottom: -26rpx;
- left: 60%;
- margin-left: -42rpx;
- }
- }
- }
- .green {}
- .mainContain {
- display: flex;
- flex-direction: column;
- padding: 0 20rpx;
- .nodata {
- background: white;
- }
- .card {
- background: #fff;
- border-radius: 16rpx;
- margin: 20rpx 0;
- padding: 20rpx;
- .header {
- display: flex;
- justify-content: space-between;
- border-bottom: 1px #f3f3f3 solid;
- padding: 20rpx;
- .red {
- color: indianred;
- }
- .green {
- color: #999999;
- }
- .blue {
- color: #1372FF;
- }
- .grey {
- color: #4C5F76;
- }
- .orange {
- color: #FF9100;
- }
- }
- .mainContent {
- // border-bottom: 1px #f3f3f3 solid;
- display: flex;
- padding: 20rpx 0;
- // justify-content: space-evenly;
- .image {
- background-repeat: no-repeat;
- background-size: cover;
- width: 198rpx;
- height: 180rpx;
- border-radius: 16rpx;
- }
- .middle {
- padding-top: 16rpx;
- color: #777777;
- // display: flex;
- // flex-direction: column;
- // justify-content: space-between;
- margin-left: 25rpx;
- width: 100%;
- .title {
- font-weight: 700;
- font-size: 32rpx;
- color: black;
- }
- .info {
- padding-top: 30rpx;
- color: #777777;
- // display: flex;
- // flex-direction: column;
- &>span {
- margin-top: 10rpx;
- }
- }
- }
- .price {
- color: red;
- text-align: center;
- height: 100%;
- align-items: center;
- align-self: center;
- font-size: 29rpx;
- font-weight: 700;
- }
- }
- .bottom {
- // padding: 30rpx 20rpx;
- display: flex;
- justify-content: flex-end;
- .detail {
- // border: 1rpx solid darkgrey;
- border-radius: 16rpx;
- color: darkgrey;
- padding: 13rpx 34rpx;
- background-color: #F6F6F6;
- font-size: 26rpx;
- color: #333333;
- font-weight: Regular;
- }
- .del {
- border-radius: 16rpx;
- color: darkgrey;
- padding: 13rpx 34rpx;
- background-color: #007A69;
- font-size: 26rpx;
- color: #fff;
- font-weight: Regular;
- }
- }
- }
- }
- }
- </style>
|