feat:订单接口替换

This commit is contained in:
dzc committed 2025-01-07 16:08:39 +08:00
1 parent bfbb15502e
commit 2af8d5fd0b
9 files changed
+315 -206

No files matched your search

+8 -3
View File
@@ -88,7 +88,13 @@ const doCard = (v: any) => {
<text>数量</text>
<text class="m-l-10rpx">{{ v.count }}</text>
</view>
<view class="flex items-center">
<view class="color-red">
<text>已使用</text>
<text class="m-l-10rpx">{{ v.useCount }}</text>
</view>
</view>
<view class="flex items-center m-t-20rpx second-text-26">
<view class="h-1px m-y-20rpx bg-#999 bg-opacity-5" />
<text>有效期</text>
<text class="m-l-10rpx">
{{ hooks.useTime(v.applyStartTime, " {y}-{m}-{d}") }}
@@ -96,8 +102,7 @@ const doCard = (v: any) => {
{{ hooks.useTime(v.applyEndTime, "{y}-{m}-{d}") }}
</text>
</view>
</view>
<view v-if="v.processStatus != 1">
<view v-if="v.processStatus != 1 && false">
<view class="h-1px m-y-20rpx bg-#999 bg-opacity-5" />
<view class="flex items-center justify-between second-text-26">
<view class="flex items-center">
+3 -3
View File
@@ -43,12 +43,12 @@ onShow(() => {
v-for="(v, i) in pageHook.list" :key="i" @tap="hooks.usePreviewImage(v.code)">
<view class="flex-row items-center">
<view class="flex-row items-center">
<tm-tag v-if="v.status == 1" size="m" color="info">未使用</tm-tag>
<tm-tag v-if="v.status == 2" size="m" color="success">已使用</tm-tag>
<tm-tag v-if="v.status == 0" size="m" color="info">未使用</tm-tag>
<tm-tag v-if="v.status == 1" size="m" color="success">已使用</tm-tag>
</view>
<view class="flex-row items-center sub-text-26">
<text class="m-l-30rpx">{{ v.username }}</text>
<text class="m-l-30rpx">{{ v.userMobile }}</text>
<text class="m-l-10rpx second-text-26">{{ v.userMobile }}</text>
</view>
</view>
<view class="iconfont icon-erweima font-size-40rpx! color-blue" />
+5 -1
View File
@@ -88,8 +88,12 @@ const doCard = (v: any) => {
<text>数量</text>
<text class="m-l-10rpx">{{ v.count }}</text>
</view>
<view class="color-red">
<text>已使用</text>
<text class="m-l-10rpx">{{ v.useCount }}</text>
</view>
</view>
<view v-if="v.processStatus != 1">
<view v-if="v.processStatus != 1 && false">
<view class="h-1px m-y-20rpx bg-#999 bg-opacity-5" />
<view class="flex items-center justify-between second-text-26">
<view class="flex items-center">
+74 -53
View File
@@ -2,71 +2,92 @@
import { ref, reactive } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { hooks, router } from "@@/index"
import { merchantApi } from "@@/api"
import { hooks, router } from "@@/index";
import { merchantApi } from "@@/api";
import { filePath } from "@@/utils/file"
import { filePath } from "@@/utils/file";
const state = reactive<any>({
pa: {
pagesize: 10,
type: '1'
}
})
onLoad(() => {
pa: {
pagesize: 10,
type: "1",
},
});
onLoad(() => {});
onShow(() => {
if (pageRef.value) {
pageRef.value.reload(false)
}
})
if (pageRef.value) {
pageRef.value.reload(false);
}
});
const pageRef = ref<any>(null)
const pageHook = hooks.usePage(pageRef, merchantApi.page, null, 'data.records')
const pageRef = ref<any>(null);
const pageHook = hooks.usePage(pageRef, merchantApi.page, null, "data.records");
const query = (page: number, pagesize: number) => {
pageHook.startPage(page, pagesize, false, state.pa);
}
pageHook.startPage(page, pagesize, false, state.pa);
};
const toDetail = async (v: any) => {
const isLogin = await hooks.useCheckLogin();
if (isLogin) {
router.jump("/pages/merchant/detail", { id: v.id });
}
};
</script>
<template>
<crud-layout bg="/static/page/blue-bg.png">
<z-paging ref="pageRef" height="100%" :fixed="false" v-model="pageHook.list" :default-page-size="10"
safe-area-inset-bottom :loading-more-enabled="true" :show-scrollbar="false" @query="query"
:auto-clean-list-when-reload="false" :auto-scroll-to-top-when-reload="false" @scroll="pageHook.scroll">
<template #top>
</template>
<view class="flex-row card p-20rpx m-b-20rpx" v-for="(v, i) in pageHook.list" :key="i"
@tap="router.jump('/pages/merchant/detail', { id: v.id })">
<image class="w-160rpx h-160rpx rounded-12rpx" :src="filePath(v.logoPic)" mode="aspectFill" />
<view class="flex-1 flex-col m-l-20rpx">
<view class="flex-row items-center justify-between">
<view class="flex-row-center sub-text-34">
<text> {{ v.name }}</text>
</view>
<view>
<tm-tag size="s">{{ v.deptName }}</tm-tag>
</view>
</view>
<view class="m-t-10rpx second-text-28">
<text>营业时间</text>
<text class="m-l-10rpx">
{{ v.jobStartTime }}
~
{{ v.jobEndTime }}
</text>
</view>
<view v-if="v.addressDes" class="m-t-10rpx second-text-28">
<text>食堂地址</text>
<text class="m-l-10rpx">{{ v.addressDes }}</text>
</view>
</view>
<crud-layout bg="/static/page/blue-bg.png">
<z-paging
ref="pageRef"
height="100%"
:fixed="false"
v-model="pageHook.list"
:default-page-size="10"
safe-area-inset-bottom
:loading-more-enabled="true"
:show-scrollbar="false"
@query="query"
:auto-clean-list-when-reload="false"
:auto-scroll-to-top-when-reload="false"
@scroll="pageHook.scroll"
>
<template #top> </template>
<view
class="flex-row card p-20rpx m-b-20rpx"
v-for="(v, i) in pageHook.list"
:key="i"
@tap="toDetail(v)"
>
<image
class="w-160rpx h-160rpx rounded-12rpx"
:src="filePath(v.logoPic)"
mode="aspectFill"
/>
<view class="flex-1 flex-col m-l-20rpx">
<view class="flex-row items-center justify-between">
<view class="flex-row-center sub-text-34">
<text> {{ v.name }}</text>
</view>
</z-paging>
</crud-layout>
<view>
<tm-tag size="s">{{ v.deptName }}</tm-tag>
</view>
</view>
<view class="m-t-10rpx second-text-28">
<text>营业时间</text>
<text class="m-l-10rpx">
{{ v.jobStartTime }}
~
{{ v.jobEndTime }}
</text>
</view>
<view v-if="v.addressDes" class="m-t-10rpx second-text-28">
<text>食堂地址</text>
<text class="m-l-10rpx">{{ v.addressDes }}</text>
</view>
</view>
</view>
</z-paging>
</crud-layout>
</template>
<style lang="scss" scoped></style>
+16 -5
View File
@@ -55,6 +55,8 @@ const getUserInfo = () => {
const userStorage = uni.getStorageSync(userInfoKey);
if (!isEmpty(userStorage)) {
state.userInfo = userStorage;
console.log(state.userInfo,"state.userInfo");
}
};
@@ -97,7 +99,16 @@ const doLogin = async (loginType, token, accountId, sessionId) => {
}
};
const toService = async (v:any)=>{
const isLogin = await hooks.useCheckLogin();
if(isLogin){
router.jump(v.router)
}
}
const doLogout = async () => {
const isLogin = await hooks.useCheckLogin();
if(!isLogin) return
uni.showLoading({
title: "退出登录中...",
mask: true,
@@ -115,15 +126,15 @@ const doLogout = async () => {
<template>
<crud-layout title="我的" bg="/static/page/blue-bg.png">
<view class="flex-row items-center">
<image class="w-100rpx h-100rpx rounded-full" v-if="state.userInfo.avatar" :src="state.userInfo.avatar"
<image class="w-100rpx h-100rpx rounded-full" v-if="state.userInfo?.sysUser?.avatar" :src="state.userInfo.sysUser.avatar"
mode="aspectFill" />
<image class="w-100rpx h-100rpx rounded-full" v-else src="/static/icon/default-avatar.png" mode="aspectFill" />
<view class="m-l-30rpx" v-if="state.userInfo.id">
<view class="m-l-30rpx" v-if="state.userInfo?.sysUser?.userId">
<view class="flex-row items-center">
<text class="sub-text-30">{{ state.userInfo.nickname }}</text>
<text class="sub-text-30">{{ state.userInfo?.sysUser?.name }}</text>
<text class="iconfont icon-youjiantou color-#666666 m-l-20rpx"></text>
</view>
<text class="sub-text-26">ID {{ state.userInfo.id }}</text>
<text class="sub-text-26">ID {{ state.userInfo?.sysUser?.userId }}</text>
</view>
<view v-else class="flex-row items-center m-l-30rpx" @tap="doLogin">
<text class="sub-text-32">请先登录</text>
@@ -133,7 +144,7 @@ const doLogout = async () => {
<view class="m-t-40rpx rounded-20rpx shadow-main p-30rpx p-b-40rpx bg-white!">
<view class="service_item flex-row items-center justify-between" v-for="(v, i) in data.serviceList" :key="i"
@tap="router.jump(v.router)">
@tap="toService(v)">
<view class="flex-row-center">
<image class="w-40rpx h-40rpx" :src="v.icon" mode="aspectFill" />
<text class="sub-text-28 m-l-20rpx">{{ v.text }}</text>
+174 -138
View File
@@ -2,159 +2,195 @@
import { ref, reactive } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { hooks, router } from "@@/index"
import { orderApi, payApi } from "@@/api"
import { hooks, router } from "@@/index";
import { orderApi, payApi } from "@@/api";
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
import zTabs from "@@/components/other/z-tabs/z-tabs.vue";
const data = {
tabs: [
{ id: null, name: '全部', disabled: false },
{ id: 1, name: '未支付', disabled: false },
{ id: 5, name: '待核销', disabled: false },
{ id: 10, name: '售后中', disabled: false },
{ id: 15, name: '已核销', disabled: false },
]
}
tabs: [
{ id: null, name: "全部", disabled: false },
{ id: 1, name: "未支付", disabled: false },
{ id: 5, name: "待核销", disabled: false },
{ id: 10, name: "售后中", disabled: false },
{ id: 15, name: "已核销", disabled: false },
],
};
const state = reactive<any>({
pa: {
orderStatus: data.tabs[0].id,
},
})
onLoad(() => {
pa: {
orderStatus: data.tabs[0].id,
},
});
onShow(() => {
if (pageRef.value) {
pageRef.value.reload(false)
}
})
const doTab = (e: any) => {
const target = data.tabs[e];
state.pa.orderStatus = target.id
pageRef.value.reload(true)
}
const pageRef = ref<any>(null)
const pageHook = hooks.usePage(pageRef, orderApi.page, null, 'data.list')
onLoad(() => {});
onShow(async () => {
const isLogin = await hooks.useCheckLogin();
if (!isLogin) return;
if (pageRef.value) {
pageRef.value.reload(false);
}
});
const doTab = (e: any) => {
const target = data.tabs[e];
state.pa.orderStatus = target.id;
pageRef.value.reload(true);
};
const pageRef = ref<any>(null);
const pageHook = hooks.usePage(pageRef, orderApi.page, null, "data.list");
const query = (page: number, pagesize: number) => {
pageHook.startPage(page, pagesize, false, state.pa);
}
const isLogin = hooks.useStaticCheckLogin();
console.log(isLogin,"isLogin");
if (!isLogin) return;
pageHook.startPage(page, pagesize, false, state.pa);
};
const doToDetail = (v: any) => {
router.jump("/pages/order/detail", { id: v.id })
}
router.jump("/pages/order/detail", { id: v.id });
};
const doAppraise = () => {
}
const doAppraise = () => {};
const doRefund = (v: any) => {
router.jump("/pages/refund/apply", { id: v.id })
return
uni.showModal({
title: '提示',
content: '是否确定退款',
confirmColor: '#0094ff',
success: async (res) => {
if (!res.confirm) return
try {
uni.showLoading({ title: '退款中...', mask: true });
const _pa = { id: v.id }
const { data, code }: any = await payApi.refundHardwareOrder(_pa)
if (code != 0) throw new Error()
pageRef.value.reload(true)
uni.hideLoading()
uni.showToast({ title: '退款成功', icon: "none" });
} catch (error) {
console.error(error);
uni.hideLoading()
}
}
})
}
router.jump("/pages/refund/apply", { id: v.id });
};
</script>
<template>
<crud-layout title="订单" bg="/static/page/blue-bg.png">
<z-paging ref="pageRef" height="100%" :fixed="false" v-model="pageHook.list" :default-page-size="5"
safe-area-inset-bottom :loading-more-enabled="true" :show-scrollbar="false" @query="query"
:auto-clean-list-when-reload="false" :auto-scroll-to-top-when-reload="false" @scroll="pageHook.scroll">
<template #top>
<view class="h-30rpx" />
<view class="bg-white rounded-16rpx px-20rpx">
<z-tabs :list="data.tabs" @change="doTab" />
</view>
</template>
<view class="h-20rpx" />
<view class="flex-col justify-center card p-x-15rpx p-y-25rpx m-b-20rpx" v-for="(v, i) in pageHook.list"
:key="i" @tap="doToDetail(v)">
<view class="flex-row items-center">
<image class="w-80rpx h-80rpx rounded-8rpx" :src="v.merchantLogo" mode="aspectFill" />
<view class="flex-1 flex-col m-l-20rpx">
<view class="flex-row items-center justify-between">
<view class="flex-row items-center">
<view class="main-text-28">{{ v.merchantStr }}</view>
<view class="m-l-15rpx color-#999 font-size-26rpx! iconfont icon-youjiantou" />
</view>
<tm-tag v-if="v.orderStatus == 1" color="info" size="xs">未支付</tm-tag>
<tm-tag v-if="v.orderStatus == 5" color="success" size="xs">待核销</tm-tag>
<tm-tag v-if="v.orderStatus == 10" color="error" size="xs">售后中</tm-tag>
<tm-tag v-if="v.orderStatus == 15" size="xs">已核销</tm-tag>
</view>
<view class="flex-row items-center justify-between m-t-5rpx">
<view class="second-text-26">
<text>下单时间</text>
<text class="m-l-10rpx">
{{ hooks.useTime(v.createTime, "{y}-{m}-{d} {h}:{i}:{s}") }}
</text>
</view>
<view class="second-text-22">
{{ hooks.useEnum('hardwareRefundStatusEnum', v.refundStatus) }}
</view>
</view>
</view>
</view>
<view class="relative h-180rpx m-t-20rpx">
<view class="absolute top-0 right-0 bottom-0 left-0 h-180rpx">
<scroll-view scroll-x class="flex-row-center whitespace-nowrap">
<view class="flex-row items-center">
<view class="inline-flex! flex-col justify-center h-180rpx m-r-20rpx"
v-for="(pV, pI) in v.shopCarList" :key="pI"
@tap.stop="router.jump('/pages/merchant/product-detail', { id: pV.productId })">
<image class="w-160rpx h-120rpx rounded-8rpx" :src="pV.productPic"
mode="aspectFill" />
<view class="w-160rpx m-t-10rpx sub-text-28 show-line">
{{ pV.productName }}
</view>
</view>
<view class="inline-flex! h-180rpx">
<view class="w-160rpx h-full" />
</view>
</view>
</scroll-view>
</view>
<view
class="absolute top-0 right-0 bottom-0 z-10 flex-col items-end w-160rpx p-x-20rpx bg-white bg-opacity-95">
<view class="main-text-30">¥ {{ hooks.useMoney(v.totalPrice) }}</view>
<view class="m-t-10rpx second-text-26">共 {{ v.shopCarList.length }} 件</view>
</view>
</view>
<view v-if="[5, 10].includes(v.orderStatus)" class="flex-row items-center justify-end p-t-20rpx">
<view v-if="v.orderStatus == 10" class="botder_btn" @tap.stop="doAppraise">评价</view>
<view v-if="v.orderStatus == 5 && v.orderType == 2" class="botder_btn" @tap.stop="doRefund(v)">退款
</view>
<view v-if="v.orderStatus == 5 && v.orderType == 2" class="m-l-20rpx botder_btn"
@tap.stop="hooks.usePreviewImage(v.orderTypeExtendReserve.qrCode)">
核销码
</view>
</view>
<crud-layout title="订单" bg="/static/page/blue-bg.png">
<z-paging
ref="pageRef"
height="100%"
:fixed="false"
v-model="pageHook.list"
:default-page-size="5"
safe-area-inset-bottom
:loading-more-enabled="true"
:show-scrollbar="false"
@query="query"
:auto-clean-list-when-reload="false"
:auto-scroll-to-top-when-reload="false"
@scroll="pageHook.scroll"
>
<template #top>
<view class="h-30rpx" />
<view class="bg-white rounded-16rpx px-20rpx">
<z-tabs :list="data.tabs" @change="doTab" />
</view>
</template>
<view class="h-20rpx" />
<view
class="flex-col justify-center card p-x-15rpx p-y-25rpx m-b-20rpx"
v-for="(v, i) in pageHook.list"
:key="i"
@tap="doToDetail(v)"
>
<view class="flex-row items-center">
<image
class="w-80rpx h-80rpx rounded-8rpx"
:src="v.merchantLogo"
mode="aspectFill"
/>
<view class="flex-1 flex-col m-l-20rpx">
<view class="flex-row items-center justify-between">
<view class="flex-row items-center">
<view class="main-text-28">{{ v.merchantStr }}</view>
<view
class="m-l-15rpx color-#999 font-size-26rpx! iconfont icon-youjiantou"
/>
</view>
<tm-tag v-if="v.orderStatus == 1" color="info" size="xs"
>未支付</tm-tag
>
<tm-tag v-if="v.orderStatus == 5" color="success" size="xs"
>待核销</tm-tag
>
<tm-tag v-if="v.orderStatus == 10" color="error" size="xs"
>售后中</tm-tag
>
<tm-tag v-if="v.orderStatus == 15" size="xs">已核销</tm-tag>
</view>
</z-paging>
</crud-layout>
<view class="flex-row items-center justify-between m-t-5rpx">
<view class="second-text-26">
<text>下单时间</text>
<text class="m-l-10rpx">
{{ hooks.useTime(v.createTime, "{y}-{m}-{d} {h}:{i}:{s}") }}
</text>
</view>
<view class="second-text-22">
{{ hooks.useEnum("hardwareRefundStatusEnum", v.refundStatus) }}
</view>
</view>
</view>
</view>
<view class="relative h-180rpx m-t-20rpx">
<view class="absolute top-0 right-0 bottom-0 left-0 h-180rpx">
<scroll-view scroll-x class="flex-row-center whitespace-nowrap">
<view class="flex-row items-center">
<view
class="inline-flex! flex-col justify-center h-180rpx m-r-20rpx"
v-for="(pV, pI) in v.shopCarList"
:key="pI"
@tap.stop="
router.jump('/pages/merchant/product-detail', {
id: pV.productId,
})
"
>
<image
class="w-160rpx h-120rpx rounded-8rpx"
:src="pV.productPic"
mode="aspectFill"
/>
<view class="w-160rpx m-t-10rpx sub-text-28 show-line">
{{ pV.productName }}
</view>
</view>
<view class="inline-flex! h-180rpx">
<view class="w-160rpx h-full" />
</view>
</view>
</scroll-view>
</view>
<view
class="absolute top-0 right-0 bottom-0 z-10 flex-col items-end w-160rpx p-x-20rpx bg-white bg-opacity-95"
>
<view class="main-text-30"
>¥ {{ hooks.useMoney(v.totalPrice) }}</view
>
<view class="m-t-10rpx second-text-26"
>共 {{ v.shopCarList.length }} 件</view
>
</view>
</view>
<view
v-if="[5, 10].includes(v.orderStatus)"
class="flex-row items-center justify-end p-t-20rpx"
>
<view
v-if="v.orderStatus == 10"
class="botder_btn"
@tap.stop="doAppraise"
>评价</view
>
<view
v-if="v.orderStatus == 5 && v.orderType == 2"
class="botder_btn"
@tap.stop="doRefund(v)"
>退款
</view>
<view
v-if="v.orderStatus == 5 && v.orderType == 2"
class="m-l-20rpx botder_btn"
@tap.stop="hooks.usePreviewImage(v.orderTypeExtendReserve.qrCode)"
>
核销码
</view>
</view>
</view>
</z-paging>
</crud-layout>
</template>
<style lang="scss" scoped></style>
<style lang="scss" scoped></style>
+2 -2
View File
@@ -30,7 +30,7 @@ export default {
}),
getShopCar: (params: any) =>
request({
url: `/hardware/car/get`,
url: `/hard/hard-car/app/mch-detail`,
method: "GET",
params,
custom: {
@@ -39,7 +39,7 @@ export default {
}),
updateShopCar: (data: any) =>
request({
url: `/hardware/car/save-or-upload`,
url: `/hard/car/save-or-upload`,
method: "POST",
data,
custom: {
+1 -1
View File
@@ -7,7 +7,7 @@ const basicAuth =
export default {
userInfo: () =>
request({
url: "/sys/user/get",
url: "/admin/user/info",
method: "GET",
custom: {
showLoading: false,
+32
View File
@@ -1,4 +1,5 @@
import storageConstant from "../constant/storage-constant";
import { jump } from "../router/index";
export const useToken = () => {
const tokenKey = storageConstant.TOKEN;
@@ -15,3 +16,34 @@ export const useDefaultHeader = () => {
Authorization: token,
};
};
export const useStaticCheckLogin = () => {
const tokenKey = storageConstant.TOKEN;
const tokenStorage = uni.getStorageSync(tokenKey);
if (tokenStorage) return true;
return false;
};
export const useCheckLogin = async (): Promise<boolean> => {
const tokenKey = storageConstant.TOKEN;
const tokenStorage = uni.getStorageSync(tokenKey);
if (tokenStorage) return true;
uni.showModal({
title: "提示",
content: "您还未登录,请先登录",
confirmColor: "#0094ff",
cancelText: "取消",
confirmText: "去登录",
success: async (res) => {
if (res.confirm) {
jump("/pages/test/login", {}, 3);
return;
}
if (!res.confirm) {
return;
}
return;
},
});
return false;
};