123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <template>
- <view>
- <view class="order_status_list">
- <view class="order_status_item" :class="requestParam.status==0?'active':''" @click="setStatus(0)"> 全部订单 </view>
- <view class="order_status_item" :class="requestParam.status==1?'active':''" @click="setStatus(1)"> 待支付 </view>
- <view class="order_status_item" :class="requestParam.status==2?'active':''" @click="setStatus(2)"> 待上课 </view>
- <view class="order_status_item" :class="requestParam.status==8?'active':''" @click="setStatus(8)"> 已完成 </view>
- <view class="order_status_item" :class="requestParam.status==9?'active':''" @click="setStatus(9)"> 售后 </view>
- </view>
-
- <view class="order_list">
- <view class="order_item" v-for="(item,index) in orderList" :key="index">
- <view class="product_title_status">
- <view class="title">
- {{item.business_name}}
- </view>
- <view class="status">
- {{item.state}}
- </view>
- </view>
- <view class="product_info" v-for="product_info in item.product_list" :key="product_info.item_id">
- <view class="product_image">
- <image :src="product_info.product_thumb" mode=""></image>
- </view>
- <view class="product_title_price">
- <view class="title">
- {{product_info.product_name}}
- </view>
- <view class="price">
- ¥{{item.price_total}}
- </view>
- <view class="actual_pay">
- 实付{{item.pay_total}}
- </view>
- </view>
- </view>
- <view class="more_title">
- <view class="more">
- 去上课
- </view>
- <view class="more">
- 去评价
- </view>
- <view class="more">
- 更多
- </view>
- </view>
- </view>
- </view>
-
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- // 产品列表
- orderList:[],
- // 请求参数
- requestParam:{
- page:1,
- status:0,
- },
- // 是否最后一页
- isLast:false,
- // 是否请求中
- isReqing:false,
-
- showMoreOptions:false,
- }
- },
- onLoad() {
- // 初始化页码为1
- this.requestParam.page = 1;
- // 是否是最后一页
- this.isLast = false;
- // 设置请求中
- this.isReqing = true;
- // 登录提示
- if( !this.$checkAccess.alterLogin() ) return ;
- // 请求列表
- this.$http.request('api/orders/get_list',this.requestParam).then((re)=>{
- // 设置非请求中
- this.isReqing = false;
- // 成功结果
- if( re.code == 'success' ){
- if(re.data.last_page <= this.requestParam.page ) this.isLast = true;
- this.orderList = re.data.data;
- }
- });
- },
- onShow() {
- // 登录提示
- if( !this.$checkAccess.alterLogin() ) return ;
- // 没有数据的话,或者请求中,不允许刷新
- if( this.orderList.length > 0 || this.isReqing ) return ;
- // 设置请求中
- this.isReqing = true;
- // 请求列表
- this.$http.request('api/orders/get_list',this.requestParam).then((re)=>{
- // 设置非请求中
- this.isReqing = false;
- // 成功结果
- if( re.code == 'success' ){
- if(re.data.last_page <= this.requestParam.page ) this.isLast = true;
- this.orderList = re.data.data;
- }
- });
- },
- onPullDownRefresh() {
- // 登录提示
- if( !this.$checkAccess.alterLogin() ) return ;
- // 如果请求中,不允许请求,
- if( this.isReqing ) return false;
- // 初始化页码为1
- this.requestParam.page = 1;
- // 是否是最后一页
- this.isLast = false;
- // 设置请求中
- this.isReqing = true;
- // 请求列表
- this.$http.request('api/orders/get_list',this.requestParam).then((re)=>{
- // 设置非请求中
- this.isReqing = false;
- // 成功结果
- if( re.code == 'success' ){
- if(re.data.last_page <= this.requestParam.page ) this.isLast = true;
- this.orderList = re.data.data;
- }
- });
- uni.stopPullDownRefresh();
- },
- onReachBottom() {
- // 登录提示
- if( !this.$checkAccess.alterLogin() ) return ;
- // 如果页码是0,避免第一页重复
- if( this.requestParam.page < 1 ) return;
- // 最后一页不请求
- if( this.isLast ) return;
- // 请求中,不再请求
- if( this.isReqing ) return;
- // 增加一页
- this.requestParam.page = this.requestParam.page+1;
- // 设置请求中
- this.isReqing = true;
- // 请求列表
- this.$http.request('api/orders/get_list',this.requestParam).then((re)=>{
- // 设置非请求中
- this.isReqing = false;
- // 成功结果
- if( re.code == 'success' ){
- if(re.data.last_page <= this.requestParam.page ) this.isLast = true;
- // 追加数据
- this.orderList.push(... re.data.data);
- }
- });
- },
- methods: {
- setStatus(status){
- // 登录提示
- if( !this.$checkAccess.alterLogin() ) return ;
- // 请求中,不再请求
- if( this.isReqing ) return;
- // 初始化页码为1
- this.requestParam.page = 1;
- // 是否是最后一页
- this.isLast = false;
- // 状态变更
- this.requestParam.status = status;
- // 设置请求中
- this.isReqing = true;
- // 请求列表
- this.$http.request('api/orders/get_list',this.requestParam).then((re)=>{
- // 设置非请求中
- this.isReqing = false;
- // 成功结果
- if( re.code == 'success' ){
- if(re.data.last_page >= this.requestParam.page ) this.isLast = true;
- this.orderList = re.data.data;
- }
- });
- },
- deleteOrder() {
- // 处理删除订单的逻辑
- this.showMoreOptions = false;
- },
- showOrderDetails() {
- // 处理显示订单详情的逻辑
- this.showMoreOptions = false;
- }
- }
- }
- </script>
- <style lang="less">
- .order_status_list{
- display: block;
- height: 60rpx;
- color: #666666;
- line-height: 60rpx;
- background: #FFFFFF;
- padding: 10rpx 35rpx;
- .order_status_item{
- float: left;
- font-size: 28rpx;
- padding: 0rpx 20rpx;
- }
- .order_status_item.active{
- color: #000000;
- font-weight: bold;
- }
- }
- .order_list{
- width: 750rpx;
- .order_item{
- width: 690rpx;
- margin: 30rpx auto;
- background-color: #FFFFFF;
- padding-top: 1rpx;
- .product_title_status{
- display: flex;
- justify-content: space-between;
- margin: 20rpx 20rpx;
- .title{
- font-size: 30rpx;
- color: #000000;
- }
- .status{
- font-size: 24rpx;
- }
- }
- .product_info{
- margin-left: 20rpx;
- display: flex;
- .product_image{
- width: 180rpx;
- image{
- width: 180rpx;
- height: 160rpx;
- border-radius: 40rpx;
- }
- }
- .product_title_price{
- width: 500rpx;
- margin: 20rpx 20rpx;
- .title{
- font-size: 34rpx;
- }
- .price{
- font-size: 24rpx;
- color: red;
- }
- .actual_pay{
- text-align: right;
- padding-right: 10rpx;
- font-size: 24rpx;
- }
- }
- }
- .more_title{
- width: 690rpx;
- display: flex;
- justify-content: flex-end;
- .more{
- padding: 20rpx;
- position: relative;
- .more-options {
- position: absolute;
- width: 150rpx;
- right: 0;
- top: 70rpx;
- background-color: #333;
- line-height: 1.5;
- border: 1px solid #333;
- }
- }
- }
- }
- }
- </style>
|