123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355 |
- <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==4?'active':''" @click="setStatus(4)"> 已取消 </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="order_title">
- <view class="business_name">{{item.business_name}}</view>
- <view class="order_status">{{item.state}}</view>
- </view>
- <view class="product_list" :class="item.contents_class?'active':''">
- <view class="product_item" v-for="(product_info,k) in item.product_list" :key="k" >
- <image class="product_img" :src="product_info.product_thumb" mode="" @click="navToProduct(product_info.product_id)"></image>
- <view class="product_info">
- <view @click="navToProduct(product_info.product_id)" class="product_name">
- <text v-if="product_info.is_rebate">【赠】</text> {{product_info.product_name}}
- </view>
- <view @click="navToProduct(product_info.product_id)" class="product_spec">
- {{product_info.product_spec}}
- </view>
- </view>
- <view class="buy_num">
- x{{product_info.buy_num}}
- </view>
- </view>
- </view>
- <view class="show_more" v-if="item.product_list.length > 1" @click.stop="changeHeight(index)">
- <uni-icons :type="item.contents_class?'up':'down'" ></uni-icons>
- </view>
- <view class="order_price">
- <view class="pay_total">¥{{item.pay_total}}</view>
- </view>
- <view class="order_btn"v-if="item.status == 1">
- <button class="order_cancel" @click="cancelOrder(index)">取消订单</button>
- <button class="order_share" @click="toReceipt(item)">我已收货</button>
- </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() {
-
- },
- onShow() {
- // 登录提示
- if( !this.$checkAccess.alterLogin() ) return ;
- // 没有数据的话,或者请求中,不允许刷新
- if( this.isReqing ) return ;
- // 初始化页码为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;
- }
- });
- },
- 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;
- }
- });
- },
- changeHeight(index){
- this.orderList[index].contents_class = this.orderList[index].contents_class ? 0:1;
- },
- // 取消订单
- cancelOrder(index){
- uni.showModal({
- title:"确认取消该订单?",
- success:res=>{
- if (res.confirm) {
- // 请求列表
- this.$http.request('api/orders/cancel',{id:this.orderList[index].id}).then(re=>{
- this.orderList[index].state = '已取消';
- this.orderList[index].status = 4;
- });
- }
- }
- })
- },
- navToProduct(id){
- if( id ){
- uni.navigateTo({
- url:"/pages/product/index?product_id="+id
- })
- }
- },
- toReceipt(item){
- uni.navigateTo({
- url:"/pages/orders/receipt?order_id="+item.id
- })
- }
- }
- }
- </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: 0rpx auto;
- .order_item{
- display: block;
- background: #FFFFFF;
- margin: 0rpx auto;
- padding: 0rpx 35rpx;
- margin-bottom: 10rpx;
- .order_title{
- width: 100%;
- height: 60rpx;
- display: block;
- overflow: hidden;
- line-height: 60rpx;
- .business_name{
- float: left;
- font-size: 32rpx;
- }
- .order_status{
- float: right;
- color: #999999;
- font-size: 24rpx;
- }
- }
- .product_list{
- display: block;
- height: 100rpx;
- overflow: hidden;
- margin: 15rpx auto;
- .product_item{
- display: block;
- height: 100rpx;
- overflow: hidden;
- .product_img{
- float: left;
- width: 80rpx;
- height: 80rpx;
- display: block;
- margin-top: 10rpx;
- margin-right: 30rpx;
- }
- .product_info{
- float: left;
- width: 480rpx;
- height: 100rpx;
- display: block;
- overflow: hidden;
- .product_name{
- display: block;
- height: 60rpx;
- display: block;
- font-size: 28rpx;
- line-height: 60rpx;
- overflow: hidden;
- }
- .product_spec{
- color: #999999;
- height: 40rpx;
- display: block;
- font-size: 24rpx;
- line-height: 40rpx;
- overflow: hidden;
- }
- }
- .buy_num{
- float: right;
- height: 100rpx;
- color: #999999;
- font-size: 26rpx;
- text-align: right;
- position: relative;
- line-height: 100rpx;
- }
- }
- }
- .product_list.active{
- height: auto !important;
- }
- .order_price{
- display: block;
- height: 60rpx;
- overflow: hidden;
- line-height: 60rpx;
- .pay_total{
- float: right;
- height: 60rpx;
- color: #E03519;
- font-size: 28rpx;
- line-height: 60rpx;
- }
- }
- .show_more{
- width: 100%;
- height: 30rpx;
- display: block;
- font-size: 20rpx !important;
- margin-top: -30rpx;
- text-align: center;
- position: relative;
- background-color: rgba(0, 0, 0, 0.05);
- }
- .order_btn{
- display: block;
- height: 60rpx;
- overflow: hidden;
- .order_cancel{
- float: left;
- height: 50rpx;
- color: #999999;
- font-size: 24rpx;
- padding: 0rpx 10rpx;
- line-height: 50rpx;
- margin-left: 10rpx;
- border-radius: 25rpx;
- border: 2rpx solid #999999;
- background-color: transparent;
- }
- .order_cancel::after{
- border: none;
- }
- .order_share{
- float: right;
- height: 50rpx;
- color: #E03519;
- font-size: 24rpx;
- padding: 0rpx 10rpx;
- line-height: 50rpx;
- margin-left: 10rpx;
- border-radius: 25rpx;
- border: 2rpx solid #E03519;
- background-color: transparent;
- }
- .order_share::after{
- border: none;
- }
- }
- }
- }
- </style>
|