|
|
|
@ -1,112 +1,103 @@ |
|
|
|
|
<template> |
|
|
|
|
<view class="order" :style="appThemeStyle"> |
|
|
|
|
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ native: true }" |
|
|
|
|
@down="downCallback" :up="upOption" @up="upCallback"> |
|
|
|
|
<view class="search"> |
|
|
|
|
<view class="box"> |
|
|
|
|
<u-icon name="search" size="30" color="#8D8D8D"></u-icon> |
|
|
|
|
<input type="search" @confirm="confirm" v-model='keyWords' placeholder="搜索订单" /> |
|
|
|
|
</view> |
|
|
|
|
<view class="search"> |
|
|
|
|
<view class="box"> |
|
|
|
|
<u-icon name="search" size="30" color="#8D8D8D"></u-icon> |
|
|
|
|
<input type="search" @confirm="confirm" v-model='keyWords' placeholder="搜索订单" /> |
|
|
|
|
</view> |
|
|
|
|
<!-- tab栏 --> |
|
|
|
|
<u-tabs :list="tabs" bg-color="#fafafa" :is-scroll="true" height="120" font-size="32" :current="curTab" |
|
|
|
|
bar-width="56" bar-height="6" active-color="#3B3B3B" :show-bar='true' :duration="0.2" |
|
|
|
|
@change="onChangeTab" /> |
|
|
|
|
<!-- 订单列表 --> |
|
|
|
|
<view class="order-list"> |
|
|
|
|
<view class="item" v-for="(item,index) in list" v-if="list.length>0"> |
|
|
|
|
<view class="hd"> |
|
|
|
|
<view class="a"> |
|
|
|
|
<image class="icon" :src="item.storeInfo.image_url"></image> |
|
|
|
|
{{item.storeInfo.store_name}} |
|
|
|
|
</view> |
|
|
|
|
<view class="b" |
|
|
|
|
:style="{'color': (item.order_status == OrderStatusEnum.COMPLETED.value)?'#3E801D':'#F21A1C'}"> |
|
|
|
|
{{item.state_text}} |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<!-- tab栏 --> |
|
|
|
|
<u-tabs :list="tabs" bg-color="#fafafa" :is-scroll="true" height="120" font-size="32" :current="curTab" |
|
|
|
|
bar-width="56" bar-height="6" active-color="#3B3B3B" :show-bar='true' :duration="0.2" |
|
|
|
|
@change="onChangeTab" /> |
|
|
|
|
<!-- 订单列表 --> |
|
|
|
|
<view class="order-list"> |
|
|
|
|
<view class="item" v-for="(item,index) in list" v-if="list.length>0"> |
|
|
|
|
<view class="hd"> |
|
|
|
|
<view class="a"> |
|
|
|
|
<image class="icon" :src="item.storeInfo.image_url"></image> |
|
|
|
|
{{item.storeInfo.store_name}} |
|
|
|
|
</view> |
|
|
|
|
<view class="bd" @click="goOrderDetail(item.order_id)" v-for="(goods, idx) in item.goods" |
|
|
|
|
:key="idx"> |
|
|
|
|
<view class="pic"> |
|
|
|
|
<image :src="goods.goods_image"></image> |
|
|
|
|
</view> |
|
|
|
|
<view class="info"> |
|
|
|
|
<view class="a">{{ goods.goods_name }}</view> |
|
|
|
|
<view class="b"> |
|
|
|
|
¥<text>{{ goods.is_user_grade ? goods.grade_goods_price : goods.goods_price }}</text> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="num"> |
|
|
|
|
x{{ goods.total_num }} |
|
|
|
|
</view> |
|
|
|
|
<view class="b" |
|
|
|
|
:style="{'color': (item.order_status == OrderStatusEnum.COMPLETED.value)?'#3E801D':'#F21A1C'}"> |
|
|
|
|
{{item.state_text}} |
|
|
|
|
</view> |
|
|
|
|
<view class="fd"> |
|
|
|
|
共{{ item.total_num }}件商品,实付款¥<text>{{ item.pay_price }}</text> |
|
|
|
|
</view> |
|
|
|
|
<view class="bd" @click="goOrderDetail(item.order_id)" v-for="(goods, idx) in item.goods" :key="idx"> |
|
|
|
|
<view class="pic"> |
|
|
|
|
<image :src="goods.goods_image"></image> |
|
|
|
|
</view> |
|
|
|
|
<!-- <view class="receive"> |
|
|
|
|
<view class=""> |
|
|
|
|
收件人姓名 188989988900 |
|
|
|
|
<view class="info"> |
|
|
|
|
<view class="a">{{ goods.goods_name }}</view> |
|
|
|
|
<view class="b"> |
|
|
|
|
¥<text>{{ goods.is_user_grade ? goods.grade_goods_price : goods.goods_price }}</text> |
|
|
|
|
</view> |
|
|
|
|
<view style="color: #939393;margin-top: 12rpx;"> |
|
|
|
|
这里是备注 |
|
|
|
|
</view> |
|
|
|
|
<view class="num"> |
|
|
|
|
x{{ goods.total_num }} |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="fd"> |
|
|
|
|
共{{ item.total_num }}件商品,实付款¥<text>{{ item.pay_price }}</text> |
|
|
|
|
</view> |
|
|
|
|
<view v-if="item.menushow" class="menuarea"> |
|
|
|
|
<view class="mask" @click="changeMenu(index)"> |
|
|
|
|
</view> |
|
|
|
|
<view class="menulist"> |
|
|
|
|
<view class="" v-if="item.order_status == OrderStatusEnum.COMPLETED.value" |
|
|
|
|
@click="onInvoicing(item.order_id,item)"> |
|
|
|
|
申请开票 |
|
|
|
|
</view> |
|
|
|
|
</view> --> |
|
|
|
|
<view v-if="item.menushow" class="menuarea"> |
|
|
|
|
<view class="mask" @click="changeMenu(index)"> |
|
|
|
|
<view class="" @click="onDelete(item.order_id)" |
|
|
|
|
v-if="item.order_status == OrderStatusEnum.COMPLETED.value"> |
|
|
|
|
删除订单 |
|
|
|
|
</view> |
|
|
|
|
<view class="menulist"> |
|
|
|
|
<view class="" v-if="item.order_status == OrderStatusEnum.COMPLETED.value" |
|
|
|
|
@click="onInvoicing(item.order_id,item)"> |
|
|
|
|
申请开票 |
|
|
|
|
</view> |
|
|
|
|
<view class="" @click="onDelete(item.order_id)" |
|
|
|
|
v-if="item.order_status == OrderStatusEnum.COMPLETED.value"> |
|
|
|
|
删除订单 |
|
|
|
|
</view> |
|
|
|
|
<view class="" v-if="item.pay_status == PayStatusEnum.PENDING.value" |
|
|
|
|
@click="onCancel(item.order_id)"> |
|
|
|
|
取消订单 |
|
|
|
|
</view> |
|
|
|
|
<view class="" v-if="item.pay_status == PayStatusEnum.PENDING.value" |
|
|
|
|
@click="onCancel(item.order_id)"> |
|
|
|
|
取消订单 |
|
|
|
|
</view> |
|
|
|
|
<view class="trangle"></view> |
|
|
|
|
</view> |
|
|
|
|
<view class="btn"> |
|
|
|
|
<view class="a" @click="changeMenu(index)" |
|
|
|
|
v-if="item.order_status == OrderStatusEnum.COMPLETED.value || item.pay_status == PayStatusEnum.PENDING.value"> |
|
|
|
|
更多</view> |
|
|
|
|
<view class="b"> |
|
|
|
|
<view class="n" v-if="item.pay_status == PayStatusEnum.SUCCESS.value && item.delivery_type == DeliveryTypeEnum.EXTRACT.value |
|
|
|
|
<view class="trangle"></view> |
|
|
|
|
</view> |
|
|
|
|
<view class="btn"> |
|
|
|
|
<view class="a" @click="changeMenu(index)" |
|
|
|
|
v-if="item.order_status == OrderStatusEnum.COMPLETED.value || (item.pay_status == PayStatusEnum.PENDING.value&&item.order_status == OrderStatusEnum.NORMAL.value)"> |
|
|
|
|
更多</view> |
|
|
|
|
<view class="b"> |
|
|
|
|
<view class="n" v-if="item.pay_status == PayStatusEnum.SUCCESS.value && item.delivery_type == DeliveryTypeEnum.EXTRACT.value |
|
|
|
|
&& item.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value" |
|
|
|
|
@click="onExtractQRCode(item.order_id)">核销码 |
|
|
|
|
</view> |
|
|
|
|
<view class="n" v-if="item.pay_status == PayStatusEnum.PENDING.value" |
|
|
|
|
@click="onPay(item.order_id)">去支付</view> |
|
|
|
|
<view class="n" v-if="item.delivery_status == DeliveryStatusEnum.DELIVERED.value" |
|
|
|
|
@click="onLogistics(item.order_id)">查看物流 |
|
|
|
|
</view> |
|
|
|
|
<view class="n n-1" |
|
|
|
|
v-if="item.delivery_status == DeliveryStatusEnum.DELIVERED.value && item.receipt_status == ReceiptStatusEnum.NOT_RECEIVED.value" |
|
|
|
|
@click="onReceipt(item.order_id)">确认收货</view> |
|
|
|
|
<view class="n" |
|
|
|
|
v-if="item.pay_status == PayStatusEnum.SUCCESS.value && item.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value" |
|
|
|
|
@click="onCdDia(item.goods_id)">催发货</view> |
|
|
|
|
@click="onExtractQRCode(item.order_id)">核销码 |
|
|
|
|
</view> |
|
|
|
|
<view class="n" v-if="item.pay_status == PayStatusEnum.PENDING.value && item.order_status == OrderStatusEnum.NORMAL.value" |
|
|
|
|
@click="onPay(item.order_id)">继续付款</view> |
|
|
|
|
<view class="n" v-if="item.delivery_status == DeliveryStatusEnum.DELIVERED.value" |
|
|
|
|
@click="onLogistics(item.order_id)">查看物流 |
|
|
|
|
</view> |
|
|
|
|
<view class="n n-1" |
|
|
|
|
v-if="item.delivery_status == DeliveryStatusEnum.DELIVERED.value && item.receipt_status == ReceiptStatusEnum.NOT_RECEIVED.value" |
|
|
|
|
@click="onReceipt(item.order_id)">确认收货</view> |
|
|
|
|
<view class="n" |
|
|
|
|
v-if="item.pay_status == PayStatusEnum.SUCCESS.value && item.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value" |
|
|
|
|
@click="onCancel(item.order_id)"> |
|
|
|
|
取消订单 |
|
|
|
|
</view> |
|
|
|
|
<!-- <view class="n" |
|
|
|
|
v-if="(item.pay_status == PayStatusEnum.SUCCESS.value && item.delivery_status == ReceiptStatusEnum.NOT_RECEIVED.value)||item.order_status == OrderStatusEnum.CANCELLED.value" |
|
|
|
|
@click="handleTargetGoods(item.goods[0].goods_id)">再次购买</view> |
|
|
|
|
<view class="n" |
|
|
|
|
v-if="item.pay_status == PayStatusEnum.SUCCESS.value && item.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value" |
|
|
|
|
@click="onCdDia(item.goods_id)">催发货</view> |
|
|
|
|
<view class="n" |
|
|
|
|
v-if="item.pay_status == PayStatusEnum.SUCCESS.value && item.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value" |
|
|
|
|
@click="onCancel(item.order_id)"> |
|
|
|
|
取消订单 |
|
|
|
|
</view> |
|
|
|
|
<!-- <view class="n" |
|
|
|
|
v-if="item.pay_status == PayStatusEnum.SUCCESS.value && item.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value" |
|
|
|
|
@click="onAdress(order.goods_id)">修改地址</view> --> |
|
|
|
|
<!-- <view class="n n-1" |
|
|
|
|
<!-- <view class="n n-1" |
|
|
|
|
v-if="item.order_status == OrderStatusEnum.COMPLETED.value && item.is_comment == 0" |
|
|
|
|
@click="handleTargetComment(item.order_id)">评价</view> --> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<u-empty text="暂无数据显示哦~" v-else mode="list"></u-empty> |
|
|
|
|
</view> |
|
|
|
|
</mescroll-body> |
|
|
|
|
<u-empty text="暂无数据显示哦~" v-else mode="list"></u-empty> |
|
|
|
|
</view> |
|
|
|
|
<u-modal v-model="deleteShow" :show-cancel-button="true" :closable='false' @on-cancel="handleCancel" |
|
|
|
|
@on-ok="handleOk" title="确认删除订单?" confirm-color="#F55349"> |
|
|
|
|
<view class="slot-content order-modal"> |
|
|
|
@ -212,23 +203,9 @@ |
|
|
|
|
// 订单列表数据 |
|
|
|
|
list: [], |
|
|
|
|
keyWords: '', |
|
|
|
|
// 上拉加载配置 |
|
|
|
|
upOption: { |
|
|
|
|
// 首次自动执行 |
|
|
|
|
auto: true, |
|
|
|
|
// 每页数据的数量; 默认10 |
|
|
|
|
page: { |
|
|
|
|
size: pageSize |
|
|
|
|
}, |
|
|
|
|
// 数量要大于4条才显示无更多数据 |
|
|
|
|
noMoreSize: 4, |
|
|
|
|
// 空布局 |
|
|
|
|
empty: { |
|
|
|
|
tip: '亲,暂无订单记录' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
total: 1, |
|
|
|
|
pageNum: 1, |
|
|
|
|
// 控制onShow事件是否刷新订单列表 |
|
|
|
|
canReset: false, |
|
|
|
|
// 核销二维码弹窗 |
|
|
|
|
showQRCodePopup: false, |
|
|
|
|
// 核销二维码图片url (通过后端获取) |
|
|
|
@ -242,6 +219,7 @@ |
|
|
|
|
onLoad(options) { |
|
|
|
|
// 初始化当前选中的标签 |
|
|
|
|
this.initCurTab(options) |
|
|
|
|
this.getOrderList(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -250,9 +228,8 @@ |
|
|
|
|
onShow() { |
|
|
|
|
// 注册全局事件订阅: 是否刷新订单列表 |
|
|
|
|
uni.$on('syncRefresh', canReset => { |
|
|
|
|
this.onRefreshList() |
|
|
|
|
this.getOrderList() |
|
|
|
|
}) |
|
|
|
|
this.canReset = false |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -262,11 +239,16 @@ |
|
|
|
|
// 卸载全局事件订阅 |
|
|
|
|
uni.$off('syncRefresh') |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
onReachBottom() { |
|
|
|
|
if (this.list.length <= this.total) { |
|
|
|
|
this.pageNum++; |
|
|
|
|
this.getOrderList(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
confirm() { |
|
|
|
|
// 刷新订单列表 |
|
|
|
|
app.onRefreshList() |
|
|
|
|
app.getOrderList() |
|
|
|
|
}, |
|
|
|
|
changeMenu(index) { |
|
|
|
|
this.list[index].menushow = !this.list[index].menushow |
|
|
|
@ -283,53 +265,27 @@ |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 上拉加载的回调 (页面初始化时也会执行一次) |
|
|
|
|
* 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 |
|
|
|
|
* @param {Object} page |
|
|
|
|
/** |
|
|
|
|
* 获取列表 |
|
|
|
|
*/ |
|
|
|
|
upCallback(page) { |
|
|
|
|
const app = this |
|
|
|
|
// 设置列表数据 |
|
|
|
|
app.getOrderList(page.num) |
|
|
|
|
.then(list => { |
|
|
|
|
const curPageLen = list.data.length |
|
|
|
|
const totalSize = list.data.total |
|
|
|
|
app.mescroll.endBySize(curPageLen, totalSize) |
|
|
|
|
}) |
|
|
|
|
.catch(() => app.mescroll.endErr()) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 获取订单列表 |
|
|
|
|
getOrderList(pageNo = 1) { |
|
|
|
|
const app = this |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
OrderApi.list({ |
|
|
|
|
dataType: app.getTabValue(), |
|
|
|
|
page: pageNo, |
|
|
|
|
keyword: app.keyWords |
|
|
|
|
}, { |
|
|
|
|
load: false |
|
|
|
|
}) |
|
|
|
|
.then(result => { |
|
|
|
|
// 合并新数据 |
|
|
|
|
const newList = app.initList(result.data.list) |
|
|
|
|
app.list = getMoreListData(newList, app.list, pageNo) |
|
|
|
|
resolve(newList) |
|
|
|
|
}) |
|
|
|
|
async getOrderList() { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: "加载中" |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 初始化订单列表数据 |
|
|
|
|
initList(newList) { |
|
|
|
|
newList.data.forEach(item => { |
|
|
|
|
item.menushow = false; |
|
|
|
|
item.total_num = 0 |
|
|
|
|
item.goods.forEach(goods => { |
|
|
|
|
item.total_num += goods.total_num |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
return newList |
|
|
|
|
let { |
|
|
|
|
status, |
|
|
|
|
message, |
|
|
|
|
data |
|
|
|
|
} = await OrderApi.list({ |
|
|
|
|
dataType: this.getTabValue(), |
|
|
|
|
page: this.pageNum, |
|
|
|
|
keyword: this.keyword |
|
|
|
|
}); |
|
|
|
|
if (status == 200) { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
this.list = this.list.concat(data.list.data) |
|
|
|
|
this.total = data.list.total |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 获取当前标签项的值 |
|
|
|
@ -340,6 +296,7 @@ |
|
|
|
|
// 切换标签项 |
|
|
|
|
onChangeTab(index) { |
|
|
|
|
const app = this |
|
|
|
|
app.list=[] |
|
|
|
|
// 设置当前选中的标签 |
|
|
|
|
app.curTab = index |
|
|
|
|
if (index == 6) { |
|
|
|
@ -352,14 +309,6 @@ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 刷新订单列表 |
|
|
|
|
onRefreshList() { |
|
|
|
|
this.list = getEmptyPaginateObj() |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.mescroll.resetUpScroll() |
|
|
|
|
}, 120) |
|
|
|
|
}, |
|
|
|
|
// 取消订单 |
|
|
|
|
onCancel(orderId) { |
|
|
|
|
const app = this |
|
|
|
@ -492,6 +441,12 @@ |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
// 跳转到商品详情页面 |
|
|
|
|
handleTargetGoods(goodsId) { |
|
|
|
|
this.$navTo('pages/goods/detail', { |
|
|
|
|
goodsId |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 跳转到订单评价页 |
|
|
|
|
handleTargetComment(orderId) { |
|
|
|
|
this.$navTo('pages/order/comment/index', { |
|
|
|
|