123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- <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==8?'active':''" @click="setStatus(8)"> 已完成 </view>
- </view> -->
- <view class="to_bottom" v-if="!orderList.length"> -----还没有记录啦-----</view>
- <view class="order_list">
- <view class="order_item" v-for="(item,index) in orderList" :key="index">
- <view class="box_left">
- <image class="product_image" :src="item.product_thumb" mode=""></image>
- </view>
- <view class="box_right">
- <view class="product_title">
- <view class="product_name">{{item.product_name}}</view>
- <view class="order_status">
- {{item.state}}
- </view>
- </view>
- <view class="spec_number">
- <view class="product_spec">{{item.product_spec}}</view>
- <view class="buy_num">共{{item.buy_num}}件</view>
- </view>
- <view class="pay_info">
- <!-- 赠品信息 -->
- <view class="coupon_info" v-if="item.is_rebate">赠品</view>
- <view class="pay_total">{{item.score_total}} 积分</view>
- </view>
- </view>
- </view>
- </view>
- <view class="to_bottom" v-if="isLast"> -----到底啦-----</view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- // 产品列表
- orderList:[],
- // 请求参数
- requestParam:{
- page:1,
- status:0,
- },
- // 是否最后一页
- isLast:false,
- // 是否请求中
- isReqing:false,
- };
- },
- onLoad() {
- // 初始化页码为1
- this.requestParam.page = 1;
- // 是否是最后一页
- this.isLast = false;
- // 设置请求中
- this.isReqing = true;
- // 登录提示
- if( !this.$checkAccess.alterLogin() ) return ;
- // 请求列表
- this.$http.request('api/score_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/score_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/score_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/score_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/score_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;
- }
- });
- }
- }
- }
- </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{
- display: block;
- overflow: hidden;
- margin: 10rpx auto;
- .order_item{
- height: 200rpx;
- display: block;
- background: #FFFFFF;
- margin: 10rpx auto;
- .box_left{
- float: left;
- width: 160rpx;
- height: 200rpx;
- margin-left: 35rpx;
- .product_image{
- width: 160rpx;
- height: 160rpx;
- margin: 20rpx 0rpx;
- border-radius: 5rpx;
- }
- }
- .box_right{
- float: left;
- width: 485rpx;
- margin-left: 35rpx;
- padding-top: 20rpx;
- .product_title{
- width: 485rpx;
- max-height: 80rpx;
- font-size: 30rpx;
- overflow: hidden;
- line-height: 40rpx;
- padding: 0rpx 0rpx;
- .product_name{
- float: left;
- height: 40rpx;
- width: 380rpx;
- }
- .order_status{
- width: 85rpx;
- float: right;
- color: #999999;
- font-size: 24rpx;
- }
- }
- .spec_number{
- color: #999999;
- height: 60rpx;
- font-size: 24rpx;
- overflow: hidden;
- margin: 10rpx auto;
- line-height: 60rpx;
- .product_spec{
- float: left;
- color: #999999;
- }
- .buy_num{
- float: right;
- height: 40rpx;
- color: #333333;
- font-size: 20rpx;
- text-align: right;
- }
- }
- .pay_info{
- width: 485rpx;
- max-height: 80rpx;
- font-size: 30rpx;
- overflow: hidden;
- line-height: 40rpx;
- padding: 0rpx 0rpx;
- .coupon_info{
- color: gold;
- float: left;
- font-size: 20rpx;
- }
- .pay_total{
- color: red;
- width: 200rpx;
- float: right;
- text-align: right;
- font-size: 30rpx;
- }
- }
- }
- }
- }
- </style>
|