| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <view class="order-page">
- <!-- 标签页 -->
- <view class="tabs-wrapper">
- <u-tabs :list="tabList" :current="currentTab" @change="handleTabChange" :is-scroll="false"
- active-color="#38C148" bar-width="60"></u-tabs>
- </view>
- <!-- 订单列表 -->
- <page-scroll :page-size="12" @updateList="handleUpdateList" ref="pageRef" slotEmpty
- url="/token/order/getMyOrderList" :params="params" :immediate="false">
- <view v-if="orderList.length > 0" class="pad-20">
- <order-item v-for="order in orderList" :key="order.orderNo" :order="order" @action="handleAction"
- @success="handleSuccess"></order-item>
- </view>
- </page-scroll>
- <u-action-sheet v-model="showReportSheet" :list="actionList" @close="showReportSheet = false"
- @click="handleReportSelect" cancelText="取消" :mask-close-able="false" :safe-area-inset-bottom="true" />
- <common-dialog ref="reviewDialog" title="温馨提示" @confirm="confirmReview">
- <text>对审核结果有疑问,申请复审?</text>
- </common-dialog>
- <common-dialog ref="processDialog" title="温馨提示" @confirm="handleSuccess">
- <text>{{ reviewMsg }}</text>
- </common-dialog>
- <common-dialog ref="errorDialog" title="温馨提示" :showCancel="false">
- <text>{{ errorMsg }}</text>
- </common-dialog>
- </view>
- </template>
- <script>
- import OrderItem from '../components/order-item.vue'
- import pageScroll from '@/components/pageScroll/index.vue'
- import CommonDialog from '@/components/common-dialog.vue'
- import mixin from '../mixin/btnAction.js'
- export default {
- mixins: [mixin],
- components: {
- OrderItem,
- pageScroll,
- CommonDialog,
- },
- data() {
- return {
- tabList: [{
- name: '全部',
- status: "-1"
- },
- {
- name: '待初审',
- status: "2"
- },
- {
- name: '待取件',
- status: "3"
- },
- {
- name: '待审核',
- status: "8"
- },
- {
- name: '待到款',
- status: "10"
- }
- ],
- currentTab: 0,
- orderList: [],
- isRefreshing: false,
- page: 1,
- pageSize: 10,
- hasMore: true,
- params: {},
- reviewMsg: "",
- errorMsg: ""
- }
- },
- onLoad(options) {
- console.log(options, 'options')
- // 如果有传入状态,切换到对应tab
- if (options.status) {
- this.currentTab = this.tabList.findIndex(item => item.status == options.status)
- this.params.status = options.status
- } else {
- this.currentTab = 0
- }
- this.loadOrders(true, this.params)
- uni.$on('btnActionSuccess', () => {
- this.loadOrders(true, this.params)
- })
- },
- onUnload() {
- uni.$off('btnActionSuccess')
- },
- methods: {
- loadOrders(bool = false, params = {}) {
- console.log(this.$refs.pageRef, 'params')
- this.$nextTick(() => {
- this.$refs.pageRef?.loadData(bool, params);
- })
- },
- confirmReview() {
- uni.$u.http.post('/token/order/applyReview?orderId=' + this.order.orderId).then(res => {
- if (res.code == 200) {
- this.reviewMsg = res.data || '申请复审成功'
- this.$refs.processDialog.openPopup()
- } else if (res.code == 1001 || res.code == 1002) {
- this.$refs.errorDialog.openPopup()
- this.errorMsg = res.msg || '您的订单已下架或出库,无法为您提供复审服务,给您带来的不便深感抱歉'
- } else {
- this.errorMsg = res.data || '申请复审失败'
- }
- })
- },
- handleSuccess() {
- this.loadOrders(true, this.params)
- },
- handleTabChange(index) {
- this.currentTab = index
- this.params.status = this.tabList[index].status
- this.loadOrders(true, this.params)
- },
- handleUpdateList(list) {
- this.orderList = list
- },
- // 订单操作方法
- handleCancel(order) {
- uni.showModal({
- title: '提示',
- content: '确定要取消该订单吗?',
- success: (res) => {
- if (res.confirm) {
- // 调用取消订单接口
- }
- }
- })
- },
- handleReport(order) {
- uni.navigateTo({
- url: `/pages/order/report?orderNo=${order.orderNo}`
- })
- },
- handleEditAddress(order) {
- uni.navigateTo({
- url: `/pages/order/address?orderNo=${order.orderNo}`
- })
- },
- handleRemind(order) {
- uni.showToast({
- title: '已提醒审核',
- icon: 'none'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .order-page {
- min-height: 100vh;
- background-color: #F5F5F5;
- .tabs-wrapper {
- position: sticky;
- top: 0;
- z-index: 99;
- background: #FFFFFF;
- }
- }
- </style>
|