123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411 |
- <template>
- <view>
- <TuanAppShim bg="#fff"></TuanAppShim>
- <view v-if="$store.getters.userInfo.token" class="my-order-container">
- <OrderHeader
- ref="orderHeaderRef" :current-status="currentStatus" :menus="navMenus" :current-mode="currentOrderMode"
- @change-status="handleChangeStatus" @change-mode="handleChangeOrderMode" @search="handleSearchCommunityOrderList"
- >
- </OrderHeader>
- <view class="order-list" :class="{ ani: !isLoading }">
- <SubNavs
- v-show="isShowSubNav && ['comment', 'append'].includes(isShowSubNav)" :active-value="currentSubValue"
- :navs="subNavs" @change-sub="handleChangeSubNavs"
- ></SubNavs>
- <view v-show="currentOrderMode === 'community'">
- </view>
- <!-- 商城 -->
- <view v-show="currentOrderMode === 'shoppingMall'">
- <BusinessOrder
- v-for="(orderItem, orderIndex) in shoppingOrderList" :key="orderIndex" :data="orderItem"
- show-operate @refresh="getOrderList()" @pay-order="(e) => payObj = e"
- ></BusinessOrder>
- <view style="padding-bottom: 45upx;">
- <LoadingMore
- :status="!shoppingIsEmpty && !shoppingOrderList.length
- ? 'loading' : !shoppingIsEmpty && shoppingOrderList.length && (shoppingOrderList.length >= shoppingListTotal) ? 'no-more' : ''"
- >
- </LoadingMore>
- <tui-no-data v-if="shoppingIsEmpty" :fixed="false" style="margin-top: 60upx;">暂无数据</tui-no-data>
- </view>
- </view>
- <!-- 商圈 -->
- <view v-show="currentOrderMode === 'businessDistrict'">
- <BusinessOrder
- v-for="(orderItem, orderIndex) in businessOrderList" :key="orderIndex" :data="orderItem"
- show-operate @refresh="getOrderList()" @pay-order="(e) => payObj = e"
- ></BusinessOrder>
- <view style="padding-bottom: 45upx;">
- <LoadingMore
- :status="!businessIsEmpty && !businessOrderList.length
- ? 'loading' : !businessIsEmpty && businessOrderList.length && (businessOrderList.length >= businessListTotal) ? 'no-more' : ''"
- >
- </LoadingMore>
- <tui-no-data v-if="businessIsEmpty" :fixed="false" style="margin-top: 60upx;">暂无数据</tui-no-data>
- </view>
- </view>
- </view>
- </view>
- <!-- 未登录时 -->
- <TuanUnLoginPage v-else></TuanUnLoginPage>
- <!-- 商圈支付 -->
- <tui-bottom-popup :show="payObj.showPayPopup" @close="payObj.showPayPopup = false">
- <view v-if="payObj.showPayPopup" style="padding: 60upx 0 128upx;">
- <CashierList
- :price-pay="payObj.pricePay" show show-platform-pay :shop-id-pay="payObj.shopId"
- @change="(e) => payObj.payInfo = { ...payObj.payInfo, ...e }"
- />
- <tui-button
- type="warning" width="168upx" height="64upx" margin="30upx auto 0"
- shape="circle"
- @click="handleShopGoPay"
- >
- 确认支付
- </tui-button>
- </view>
- </tui-bottom-popup>
- <!-- toast -->
- <tui-toast ref="toast"></tui-toast>
- </view>
- </template>
- <script>
- import { businessSubNavs, shoppingSubNavs } from './config'
- import { getAllOrderListApi } from '../../api/anotherTFInterface'
- import { T_PAY_ORDER } from '../../constant'
- import TuanUnLoginPage from './components/TuanUnLoginPage.vue'
- import OrderHeader from './components/OrderHeader.vue'
- import BusinessOrder from './components/BusinessOrder.vue'
- import SubNavs from './components/SubNavs.vue'
- import { handleDoPay } from '../../utils/payUtil'
- export default {
- name: 'Order',
- components: {
- TuanUnLoginPage,
- OrderHeader,
- BusinessOrder,
- SubNavs
- },
- data() {
- return {
- currentOrderMode: 'shoppingMall',
- currentStatus: 0,
- currentSubValue: 0,
- communityCommentOrder: [],
- isLoading: false, // 是否加载中
- loadingStatus: 'loading', // 加载状态
- isShowSubNav: null,
- totalCommunityPages: 0,
- communityOrderList: [],
- // 二次追加订单
- awaitPayOrderList: [], // 待支付
- payedOrderList: [], // 已支付
- refusedOrderList: [], // 已拒绝
- // 评论订单
- commentOrder: {
- commentOrderList: [], // 待评论订单
- commentAppendOrderList: [], // 可追加订单
- commentedOrderList: [] // 已评论订单
- },
- currentNavInfo: {
- label: '全部',
- value: -1
- },
- // 商城订单
- shoppingQueryInfo: {
- page: 1,
- pageSize: 10,
- orderType: 1
- },
- shoppingOrderList: [],
- shoppingListTotal: 0,
- shoppingIsEmpty: false,
- // 商圈订单
- businessQueryInfo: {
- page: 1,
- pageSize: 10,
- orderType: 2
- },
- businessOrderList: [],
- businessListTotal: 0,
- businessIsEmpty: false,
- // 支付相关
- payObj: {
- showPayPopup: false,
- pricePay: 0,
- shopId: '',
- payInfo: {}
- }
- }
- },
- computed: {
- navMenus() {
- switch (this.currentOrderMode) {
- case 'community':
- return []
- break
- case 'shoppingMall':
- return shoppingSubNavs
- break
- case 'businessDistrict':
- return businessSubNavs
- break
- default:
- return ''
- break
- }
- },
- subNavs() {
- if (this.isShowSubNav) return this.isShowSubNav === 'append' ? [] : this.isShowSubNav === 'comment' ? this.communityCommentOrder : ''
- return []
- },
- appendOrderList() {
- if (!this.isShowSubNav) return []
- if (this.isShowSubNav === 'append') {
- if (this.currentSubValue === 0) {
- return this.awaitPayOrderList
- } else if (this.currentSubValue === 1) {
- return this.payedOrderList
- } else if (this.currentSubValue === 2) {
- return this.refusedOrderList
- }
- }
- return []
- },
- noDataVisible() {
- if (this.isLoading) return false
- if (this.currentOrderMode === 'community') {
- if (!this.isShowSubNav) {
- return !this.communityOrderList.length
- }
- if (this.isShowSubNav) {
- if (this.isShowSubNav === 'append') {
- return !this.appendOrderList.length
- } else if (this.isShowSubNav === 'comment') {
- if (this.currentSubValue === 0) {
- return !this.commentOrder.commentOrderList.length
- } else if (this.currentSubValue === 1) {
- return !this.commentOrder.commentedOrderList.length
- }
- return !this.commentOrder.commentAppendOrderList.length
- }
- }
- } else {
- return true
- }
- }
- },
- onShow() {
- uni.removeStorageSync(T_PAY_ORDER)
- this.$nextTick(() => {
- this.getOrderList()
- })
- },
- methods: {
- handleChangeOrderMode(mode) {
- if (mode === this.currentOrderMode) return
- this.currentOrderMode = mode
- if (this.currentOrderMode === 'community') {
- } else if (this.currentOrderMode === 'shoppingMall') {
- this.currentStatus = 0
- } else if (this.currentOrderMode === 'businessDistrict') {
- this.currentStatus = 0
- }
- this.isShowSubNav = null
- this.getOrderList()
- },
- // 清空搜索
- clearSearch() {
- this.$refs.orderHeaderRef && this.$refs.orderHeaderRef.clearSearch()
- },
- // 点击搜索
- handleSearchCommunityOrderList(searchValue) {
- if (this.currentOrderMode === 'community') {
- } else {
- this.ttoast({
- type: 'fial',
- title: '只能搜索社区订单'
- })
- }
- },
- // 切换状态
- handleChangeStatus(navInfo) {
- if (!navInfo) return
- this.currentNavInfo = navInfo
- this.currentStatus = navInfo.value
- if (this.currentOrderMode === 'community') {
- this.isShowSubNav = null
- } else if (this.currentOrderMode === 'shoppingMall') {
- } else if (this.currentOrderMode === 'businessDistrict') {
- }
- this.getOrderList()
- },
- // 切换sub
- handleChangeSubNavs(info) {
- this.currentSubValue = info.value
- if (this.isShowSubNav === 'comment') {
- }
- },
- // 发起请求获取列表数据
- async getOrderList(isLoadmore) {
- if (this.currentOrderMode === 'community') {
- } else if (this.currentOrderMode === 'shoppingMall') {
- uni.showLoading()
- getAllOrderListApi({ ...this.shoppingQueryInfo, state: this.currentStatus || '' })
- .then((res) => {
- this.shoppingListTotal = res.data.total
- if (isLoadmore) {
- this.shoppingOrderList.push(...res.data.list)
- } else {
- this.shoppingOrderList = res.data.list
- }
- this.shoppingIsEmpty = this.shoppingOrderList.length === 0
- uni.hideLoading()
- })
- .catch(() => {
- uni.hideLoading()
- })
- } else if (this.currentOrderMode === 'businessDistrict') {
- uni.showLoading()
- getAllOrderListApi({ ...this.businessQueryInfo, state: this.currentStatus || '' })
- .then((res) => {
- this.businessListTotal = res.data.total
- if (isLoadmore) {
- this.businessOrderList.push(...res.data.list)
- } else {
- this.businessOrderList = res.data.list
- }
- this.businessIsEmpty = this.businessOrderList.length === 0
- uni.hideLoading()
- })
- .catch(() => {
- uni.hideLoading()
- })
- }
- },
- // 去评论
- handleComment({ itemData, isAppend }) {
- if (isAppend) {
- uni.navigateTo({
- url:
- '/community-center/comment-order/append-comment?orderNo=' +
- itemData.orderNo +
- '&serveName=' +
- itemData.serverName +
- '&url=' +
- itemData.serverUrl +
- '&commentId=' +
- itemData.id
- })
- } else {
- uni.navigateTo({
- url: '/community-center/comment-order/rate?orderNo=' + itemData.orderNo + '&serveName=' + itemData.serverName + '&url=' + itemData.serverUrl
- })
- }
- },
- // 是否可以下拉加载
- canReachBottomLoad() {
- if (this.currentOrderMode === 'community') {
- return ![-3, -2].includes(this.currentStatus)
- } else if (this.currentOrderMode === 'businessDistrict') {
- return true
- }
- },
- async handleShopGoPay() {
- await handleDoPay(this.payObj.payInfo, 1)
- this.payObj = {
- showPayPopup: false,
- pricePay: 0,
- shopId: '',
- payInfo: {}
- }
- }
- },
- onPullDownRefresh() {
- if (!this.$store.getters.userInfo.token) return uni.stopPullDownRefresh()
- this.awaitPayOrderList = []
- this.payedOrderList = []
- this.refusedOrderList = []
- this.commentOrder.commentOrderList = []
- this.commentOrder.commentAppendOrderList = []
- this.commentOrder.commentedOrderList = []
- this.getOrderList()
- },
- onReachBottom() {
- if (this.canReachBottomLoad()) {
- if (this.currentOrderMode === 'community') {
- } else if (this.currentOrderMode === 'shoppingMall') {
- if (this.shoppingOrderList.length < this.shoppingListTotal) {
- ++this.shoppingQueryInfo.page
- this.getOrderList(true)
- }
- } else if (this.currentOrderMode === 'businessDistrict') {
- if (this.businessOrderList.length < this.businessListTotal) {
- ++this.businessQueryInfo.page
- this.getOrderList(true)
- }
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- /deep/ .tui-lazyload__img {
- width: 140rpx !important;
- height: 140rpx !important;
- background-color: #ccc;
- }
- @keyframes fade {
- 0% {
- opacity: 0.4;
- transform: translateX(-100vw);
- }
- 100% {
- opacity: 1;
- transform: translateX(0);
- }
- }
- .my-order-container {
- width: 100vw;
- background-color: #f5f5f7;
- .order-list {
- min-height: 100vh;
- background-color: #f5f5f7;
- position: relative;
- padding: 220upx 30upx 124upx;
- box-sizing: border-box;
- &.ani {
- animation: fade 350ms ease-in-out;
- }
- }
- }
- </style>
|