|
@@ -1,19 +1,19 @@
|
|
<template>
|
|
<template>
|
|
- <view class="order">
|
|
|
|
|
|
+ <view id="order" class="order">
|
|
<view class="header">
|
|
<view class="header">
|
|
<view class="title">
|
|
<view class="title">
|
|
订单明细
|
|
订单明细
|
|
</view>
|
|
</view>
|
|
<view class="tabs">
|
|
<view class="tabs">
|
|
<view class="tab-item" :class="{'active':orderStatus===undefined}"
|
|
<view class="tab-item" :class="{'active':orderStatus===undefined}"
|
|
- @tap="orderStatus=undefined,orders=[],getOrdersData()">全部</view>
|
|
|
|
|
|
+ @tap="orderStatus=undefined,orders=[],page=1,getOrdersData()">全部</view>
|
|
<view class="tab-item" :class="{'active':orderStatus==='wait_deliver'}"
|
|
<view class="tab-item" :class="{'active':orderStatus==='wait_deliver'}"
|
|
- @tap="orderStatus='wait_deliver',orders=[],getOrdersData()">已付款</view>
|
|
|
|
|
|
+ @tap="orderStatus='wait_deliver',orders=[],page=1,getOrdersData()">已付款</view>
|
|
<view class="tab-item" :class="{'active':orderStatus==='complete'}"
|
|
<view class="tab-item" :class="{'active':orderStatus==='complete'}"
|
|
- @tap="orderStatus='complete',orders=[],getOrdersData()">已完成</view>
|
|
|
|
|
|
+ @tap="orderStatus='complete',orders=[],page=1,getOrdersData()">已完成</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <view v-if="orders.length===0" style="margin: 20upx auto;text-align: center; font-size: 28upx;color: #999999;">
|
|
|
|
|
|
+ <view v-if="orders.length===0" style="margin: 20upx auto;text-align: center; font-size: 28upx;color: #999999;">
|
|
暂无任何订单
|
|
暂无任何订单
|
|
</view>
|
|
</view>
|
|
<view class="order-list">
|
|
<view class="order-list">
|
|
@@ -22,19 +22,20 @@
|
|
<view class="factory-name">{{order.seller.nickname?order.seller.nickname:'省心直供(该厂家暂未设置昵称)'}}</view>
|
|
<view class="factory-name">{{order.seller.nickname?order.seller.nickname:'省心直供(该厂家暂未设置昵称)'}}</view>
|
|
<view v-if="order.status === 'wait_pay'" class="order-status">待付款</view>
|
|
<view v-if="order.status === 'wait_pay'" class="order-status">待付款</view>
|
|
<view v-if="order.status === 'wait_deliver'" class="order-status">待发货</view>
|
|
<view v-if="order.status === 'wait_deliver'" class="order-status">待发货</view>
|
|
- <view v-if="order.status === 'wait_sign'" class="order-status">待签收</view>
|
|
|
|
|
|
+ <view v-if="order.status === 'delivered'" class="order-status">已发货</view>
|
|
|
|
+ <view v-if="order.status === 'wait_sign'" class="order-status">待取件</view>
|
|
<view v-if="order.status === 'complete'" class="order-status">已完成</view>
|
|
<view v-if="order.status === 'complete'" class="order-status">已完成</view>
|
|
<view v-if="order.status === 'invalid'" class="order-status">已失效</view>
|
|
<view v-if="order.status === 'invalid'" class="order-status">已失效</view>
|
|
</view>
|
|
</view>
|
|
<view class="order-info" @tap="openDetails(order.id)">
|
|
<view class="order-info" @tap="openDetails(order.id)">
|
|
<view class="product-item" v-for="product in order.products_json">
|
|
<view class="product-item" v-for="product in order.products_json">
|
|
<view class="product-image">
|
|
<view class="product-image">
|
|
- <image class="image" :src="product.spec_image" mode="scaleToFill"></image>
|
|
|
|
|
|
+ <image class="image" :src="product.spec_image|imagesFilter" mode="scaleToFill"></image>
|
|
</view>
|
|
</view>
|
|
<view class="product-info">
|
|
<view class="product-info">
|
|
<view class="row">
|
|
<view class="row">
|
|
<view class="name">{{product.name}}</view>
|
|
<view class="name">{{product.name}}</view>
|
|
- <view class="price">¥{{product.spec_price}}</view>
|
|
|
|
|
|
+ <view class="price">¥{{product.spec_price|priceFilter}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="row">
|
|
<view class="row">
|
|
<view class="spec">{{product.spec_name}}</view>
|
|
<view class="spec">{{product.spec_name}}</view>
|
|
@@ -46,8 +47,8 @@
|
|
<view class="total-price">
|
|
<view class="total-price">
|
|
总价 <text class="warning">¥{{order.total_amount}}</text>
|
|
总价 <text class="warning">¥{{order.total_amount}}</text>
|
|
</view>
|
|
</view>
|
|
- <view class="option">
|
|
|
|
- <button v-if="order.status === 'wait_pay'" class="pay-btn" type="default">立即支付</button>
|
|
|
|
|
|
+ <view v-if="$store.state.user.group_id===3" class="option">
|
|
|
|
+ <button v-if="order.status === 'wait_pay'" class="pay-btn" type="default" @tap="goToCashier(order.order_no)">立即支付</button>
|
|
<button v-if="order.status === 'wait_sign'" class="confirm-btn" type="default">确认收货</button>
|
|
<button v-if="order.status === 'wait_sign'" class="confirm-btn" type="default">确认收货</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -71,7 +72,8 @@
|
|
onPageScroll(e) {
|
|
onPageScroll(e) {
|
|
const query = uni.createSelectorQuery();
|
|
const query = uni.createSelectorQuery();
|
|
query.select("#order").boundingClientRect(data => {
|
|
query.select("#order").boundingClientRect(data => {
|
|
- if (e.scrollTop > data.height - uni.getSystemInfoSync().windowHeight * 2) {
|
|
|
|
|
|
+ if (e.scrollTop > data.height - uni.getSystemInfoSync().windowHeight * 2 &&
|
|
|
|
+ (this.page - 1) * 10 < this.orders.length) {
|
|
this.getOrdersData();
|
|
this.getOrdersData();
|
|
}
|
|
}
|
|
}).exec();
|
|
}).exec();
|
|
@@ -80,26 +82,36 @@
|
|
methods: {
|
|
methods: {
|
|
openDetails(id) {
|
|
openDetails(id) {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
- url: "order-details?id="+id
|
|
|
|
-
|
|
|
|
|
|
+ url: "order-details?id=" + id
|
|
|
|
+
|
|
})
|
|
})
|
|
},
|
|
},
|
|
getOrdersData() {
|
|
getOrdersData() {
|
|
- this.$http.get({
|
|
|
|
- url: "/order/lists",
|
|
|
|
- data: {
|
|
|
|
- status: this.orderStatus,
|
|
|
|
- limit: 10,
|
|
|
|
- page: this.page
|
|
|
|
- },
|
|
|
|
- success: (res) => {
|
|
|
|
- this.orders = [...this.orders, ...res.data.data.rows.map((item) => {
|
|
|
|
- item.products_json = JSON.parse(item.products_snapshot)
|
|
|
|
- return item;
|
|
|
|
- })]
|
|
|
|
- this.page++;
|
|
|
|
- this.pageLoading = false;
|
|
|
|
- }
|
|
|
|
|
|
+ if (!this.pageLoading) {
|
|
|
|
+ console.log("加载下一页");
|
|
|
|
+ this.pageLoading = true;
|
|
|
|
+ this.$http.get({
|
|
|
|
+ url: "/order/lists",
|
|
|
|
+ data: {
|
|
|
|
+ status: this.orderStatus,
|
|
|
|
+ limit: 10,
|
|
|
|
+ page: this.page
|
|
|
|
+ },
|
|
|
|
+ success: (res) => {
|
|
|
|
+ this.orders = [...this.orders, ...res.data.data.rows.map((item) => {
|
|
|
|
+ item.products_json = JSON.parse(item.products_snapshot)
|
|
|
|
+ return item;
|
|
|
|
+ })]
|
|
|
|
+ this.page++;
|
|
|
|
+ this.pageLoading = false;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ goToCashier(order_no){
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url:"/pages/order/cashier?order_no="+order_no
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|