Compare commits
7 Commits
4599e5c6ad
...
3608a12291
Author | SHA1 | Date |
---|---|---|
|
3608a12291 | |
|
528009e6d5 | |
|
602c6b6b82 | |
|
32f90300c8 | |
|
7ab5130cff | |
|
9b3b201ead | |
|
244408c523 |
|
@ -13,7 +13,7 @@ export function getCabinetDetailApi(shopId: number) {
|
|||
})
|
||||
}
|
||||
|
||||
/** 获取租用中的智能柜详情接口 */
|
||||
/** 获取出租中的智能柜详情接口 */
|
||||
export function getRentingCabinetDetailApi(shopId: number) {
|
||||
return request<ApiResponseData<RentingCabinetDetailDTO[]>>({
|
||||
url: 'cabinet/detail/renting',
|
||||
|
@ -24,6 +24,18 @@ export function getRentingCabinetDetailApi(shopId: number) {
|
|||
})
|
||||
}
|
||||
|
||||
/** 获取自己租用中的智能柜详情接口 */
|
||||
export function getUserRentedCabinetListApi(corpid:string, ab98UserId: number) {
|
||||
return request<ApiResponseData<RentingCabinetDetailDTO[]>>({
|
||||
url: 'cabinet/detail/user',
|
||||
method: 'get',
|
||||
params: {
|
||||
corpid,
|
||||
ab98UserId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function openCabinet(cabinetId: number, pinNo: number, data: OpenCabinetApiData) {
|
||||
return request<ApiResponseData<void>>({
|
||||
url: `cabinet/openCabinet/${cabinetId}/${pinNo}`,
|
||||
|
|
|
@ -14,7 +14,12 @@ export interface RentingCabinetDetailDTO {
|
|||
/** 锁控编号 */
|
||||
lockControlNo: number
|
||||
/** 柜格列表 */
|
||||
cells: CabinetCellEntity[]
|
||||
cells: RetingCellEntity[]
|
||||
}
|
||||
|
||||
export interface RetingCellEntity extends CabinetCellEntity {
|
||||
orderId: number;
|
||||
orderGoodsId: number;
|
||||
}
|
||||
|
||||
/** 智能柜格口实体类 */
|
||||
|
|
|
@ -48,21 +48,29 @@ export function qyLogin(params: QyLoginRequestParams) {
|
|||
params
|
||||
})
|
||||
}
|
||||
|
||||
/** 根据openid获取用户订单信息 */
|
||||
export function getOrdersByOpenIdApi(corpid: string, openid: string) {
|
||||
return request<ApiResponseData<GetOrdersByOpenIdDTO>>({
|
||||
url: `order/user/${openid}`,
|
||||
export function fakeQyLoginApi(params: {corpid: string, userid: string}) {
|
||||
return request<ApiResponseData<QyLoginDTO>>({
|
||||
url: "payment/login/qy/fake",
|
||||
method: "get",
|
||||
params: { corpid }
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/** 根据openid获取用户订单信息 */
|
||||
export function getOrdersByQyUserIdApi(qyUserId: number) {
|
||||
export function getOrdersByOpenIdApi(corpid: string, openid: string, hasReturn: number) {
|
||||
return request<ApiResponseData<GetOrdersByOpenIdDTO>>({
|
||||
url: `order/user/${openid}`,
|
||||
method: "get",
|
||||
params: { corpid, hasReturn }
|
||||
})
|
||||
}
|
||||
|
||||
/** 根据openid获取用户订单信息 */
|
||||
export function getOrdersByQyUserIdApi(qyUserId: number, hasReturn: number) {
|
||||
return request<ApiResponseData<GetOrdersByOpenIdDTO>>({
|
||||
url: `order/user/qy/${qyUserId}`,
|
||||
method: "get"
|
||||
method: "get",
|
||||
params: { hasReturn }
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -163,6 +163,7 @@ export interface GetBalanceResponse {
|
|||
useBalance: number
|
||||
/** 借呗总额 */
|
||||
balanceLimit: number
|
||||
ab98User: ab98UserDTO;
|
||||
}
|
||||
|
||||
export interface QyLoginDTO {
|
||||
|
@ -199,6 +200,8 @@ export interface ab98UserDTO {
|
|||
address?: string;
|
||||
/** 是否已注册(0未注册 1已注册) */
|
||||
registered?: boolean;
|
||||
/** 借呗余额 单位分 */
|
||||
ab98Balance?: number;
|
||||
}
|
||||
|
||||
export interface OpenCabinetApiData {
|
||||
|
|
|
@ -111,7 +111,7 @@ function createRequest(instance: AxiosInstance) {
|
|||
// 请求体
|
||||
data: {},
|
||||
// 请求超时
|
||||
timeout: 5000,
|
||||
timeout: 10000,
|
||||
// 跨域请求时是否携带 Cookies
|
||||
withCredentials: false
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ const handleOpenCabinet = async () => {
|
|||
} finally {
|
||||
setTimeout(() => {
|
||||
isButtonDisabled.value = false
|
||||
}, 5000)
|
||||
}, 10000)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ const handleOpenCell = async (approvalGoodsCellId: number) => {
|
|||
} finally {
|
||||
setTimeout(() => {
|
||||
isButtonDisabled.value = false;
|
||||
}, 5000);
|
||||
}, 10000);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ const handleSubmit = async () => {
|
|||
const { code, data } = await submitApprovalApi(formData.value)
|
||||
|
||||
if (code === 0) {
|
||||
orderStore.getOrders(wxStore.corpid, wxStore.openid, wxStore.qyUserId);
|
||||
orderStore.getOrders(wxStore.corpid, wxStore.openid, wxStore.qyUserId, 0);
|
||||
|
||||
try {
|
||||
await showConfirmDialog({
|
||||
|
|
|
@ -11,7 +11,7 @@ const route = useRoute();
|
|||
const wxStore = useWxStore();
|
||||
const ab98UserStore = useAb98UserStore();
|
||||
|
||||
const { balance, useBalance, balanceLimit, name: qyName } = storeToRefs(wxStore);
|
||||
const { balance, useBalance, balanceLimit, name: qyName, ab98User } = storeToRefs(wxStore);
|
||||
const { name: userName, sex: userSex, face_img } = storeToRefs(ab98UserStore);
|
||||
|
||||
const name = computed(() => {
|
||||
|
@ -20,6 +20,13 @@ const name = computed(() => {
|
|||
|
||||
const userAvatar = face_img.value ? face_img.value : `${publicPath}img/1.jpg`;
|
||||
|
||||
const ab98BalanceInYuan = computed(() => {
|
||||
if (ab98User.value && ab98User.value.ab98Balance !== undefined) {
|
||||
return (ab98User.value.ab98Balance / 100).toFixed(2);
|
||||
}
|
||||
return '0.00';
|
||||
});
|
||||
|
||||
const handleLogout = () => {
|
||||
showConfirmDialog({
|
||||
title: '退出登录',
|
||||
|
@ -77,6 +84,10 @@ wxStore.refreshBalance();
|
|||
<div class="text-sm text-gray-700">剩余借呗</div>
|
||||
<div class="text-lg font-bold text-primary">{{ balance }}</div>
|
||||
</div>
|
||||
<!-- <div class="flex-1 ml-1">
|
||||
<div class="text-sm text-gray-700">余额</div>
|
||||
<div class="text-lg font-bold text-primary">{{ ab98BalanceInYuan }}</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<!-- 个人中心按钮 -->
|
||||
|
@ -90,6 +101,12 @@ wxStore.refreshBalance();
|
|||
<span>订单列表</span>
|
||||
</div>
|
||||
</van-col>
|
||||
<van-col span="8">
|
||||
<div class="custom-btn" @click="router.push('/rental-list')">
|
||||
<van-icon name="orders-o" size="20px" />
|
||||
<span>我的柜子</span>
|
||||
</div>
|
||||
</van-col>
|
||||
<!-- <van-col span="6">
|
||||
<div v-if="wxStore.isCabinetAdmin" class="custom-btn" @click="router.push('/manage/goods')">
|
||||
<van-icon name="comment-o" size="20px" />
|
||||
|
@ -115,7 +132,6 @@ wxStore.refreshBalance();
|
|||
</div>
|
||||
</van-col>
|
||||
<van-col span="8"></van-col>
|
||||
<van-col span="8"></van-col>
|
||||
</van-row>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -41,7 +41,7 @@ async function handleOpenCabinet(orderId: number, orderGoodsId: number) {
|
|||
} finally {
|
||||
setTimeout((currentId) => {
|
||||
delete isButtonDisabled.value[currentId]
|
||||
}, 5000, orderGoodsId)
|
||||
}, 10000, orderGoodsId)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ function backToHome() {
|
|||
}
|
||||
|
||||
watch(() => orderId.value, async (newVal) => {
|
||||
await orderStore.getOrders(wxStore.corpid, wxStore.openid, wxStore.qyUserId)
|
||||
await orderStore.getOrders(wxStore.corpid, wxStore.openid, wxStore.qyUserId, 0)
|
||||
currentOrder.value = orderStore.orders.find(o => o.orderId === newVal)
|
||||
}, { immediate: true })
|
||||
</script>
|
||||
|
|
|
@ -1,18 +1,28 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted } from 'vue'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useOrderStore } from '@/pinia/stores/order'
|
||||
import { useWxStoreOutside } from '@/pinia/stores/wx'
|
||||
|
||||
const activeTab = ref(0);
|
||||
|
||||
const router = useRouter()
|
||||
const orderStore = useOrderStore()
|
||||
const wxStore = useWxStoreOutside()
|
||||
const wxStore = useWxStoreOutside();
|
||||
|
||||
const hasReturn = ref<number>(0);
|
||||
|
||||
// 处理标签页切换
|
||||
const handleTabChange = (tabIndex: number) => {
|
||||
hasReturn.value = tabIndex;
|
||||
orderStore.getOrders(wxStore.corpid, wxStore.openid, wxStore.qyUserId, hasReturn.value);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
orderStore.getOrders(wxStore.corpid, wxStore.openid, wxStore.qyUserId)
|
||||
orderStore.getOrders(wxStore.corpid, wxStore.openid, wxStore.qyUserId, hasReturn.value)
|
||||
})
|
||||
|
||||
onBeforeRouteUpdate(() => {
|
||||
orderStore.getOrders(wxStore.corpid, wxStore.openid, wxStore.qyUserId)
|
||||
orderStore.getOrders(wxStore.corpid, wxStore.openid, wxStore.qyUserId, hasReturn.value)
|
||||
})
|
||||
|
||||
const statusMap: Record<number, string> = {
|
||||
|
@ -30,7 +40,11 @@ const getStatusText = (status: number) => {
|
|||
|
||||
<template>
|
||||
<div class="order-list">
|
||||
<h2>我的订单</h2>
|
||||
<!-- 状态切换标签页 -->
|
||||
<van-tabs v-model:active="activeTab" @change="handleTabChange" style="margin-bottom: 8px;">
|
||||
<van-tab title="未退还"></van-tab>
|
||||
<van-tab title="已退还"></van-tab>
|
||||
</van-tabs>
|
||||
|
||||
<div v-if="orderStore.orders.length === 0" class="empty">
|
||||
暂无订单
|
||||
|
@ -58,7 +72,7 @@ const getStatusText = (status: number) => {
|
|||
>
|
||||
<template #icon>
|
||||
<van-image
|
||||
:src="goods.goodsInfo.coverImg"
|
||||
:src="goods.goodsInfo?.coverImg"
|
||||
width="80"
|
||||
height="80"
|
||||
class="product-image"
|
||||
|
@ -66,7 +80,7 @@ const getStatusText = (status: number) => {
|
|||
</template>
|
||||
<div class="product-info">
|
||||
<div class="product-name van-ellipsis">
|
||||
{{ goods.goodsInfo.goodsName }}
|
||||
{{ goods.goodsInfo?.goodsName }}
|
||||
</div>
|
||||
<div class="product-meta">
|
||||
<span class="status">状态: {{ getStatusText(order.status) }}</span>
|
||||
|
@ -85,7 +99,7 @@ const getStatusText = (status: number) => {
|
|||
|
||||
<style scoped>
|
||||
.order-list {
|
||||
padding: 20px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
|
@ -95,7 +109,7 @@ const getStatusText = (status: number) => {
|
|||
}
|
||||
|
||||
.order-item {
|
||||
margin-bottom: 20px;
|
||||
margin-bottom: 8px;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
|
@ -104,7 +118,7 @@ const getStatusText = (status: number) => {
|
|||
.order-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 10px 15px;
|
||||
padding: 10px 15px 5px 15px;
|
||||
background-color: #f5f5f5;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
@ -116,7 +130,6 @@ const getStatusText = (status: number) => {
|
|||
.goods-item {
|
||||
display: flex;
|
||||
padding: 10px 0;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
goods-item:last-child {
|
||||
|
|
|
@ -90,15 +90,14 @@ async function handleOpenCabinet(item: OrderGoods) {
|
|||
} finally {
|
||||
setTimeout((currentId) => {
|
||||
delete isButtonDisabled.value[currentId]
|
||||
}, 5000, orderGoodsId)
|
||||
}, 10000, orderGoodsId)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="order-detail" v-if="order">
|
||||
<h2>订单详情</h2>
|
||||
|
||||
|
||||
<div class="order-info">
|
||||
<p>订单号: {{ order.orderId }}</p>
|
||||
<p>状态: {{ getStatusText(order.status) }}</p>
|
||||
|
|
|
@ -79,6 +79,7 @@ onMounted(() => {
|
|||
}
|
||||
// scrollListener.push(scrollContainer.value?.addEventListener("scroll", throttledScroll))
|
||||
// scrollListener.push(scrollContainer.value?.addEventListener("scroll", throttledUpdate))
|
||||
// wxStore.fakeQyLogin();
|
||||
})
|
||||
|
||||
// 组件卸载前清理事件监听
|
||||
|
|
|
@ -121,7 +121,15 @@ async function handleSubmit() {
|
|||
}
|
||||
}
|
||||
|
||||
if (!openid.value) {
|
||||
// 检查是否有可用支付方式
|
||||
if (supportedPayments.value.length === 0) {
|
||||
return showConfirmDialog({
|
||||
title: "提示",
|
||||
message: "没有支持的支付方法,请从微信进入智借还"
|
||||
});
|
||||
}
|
||||
|
||||
if (!openid.value && !wxStore.isFakeQyLogin) {
|
||||
return showConfirmDialog({
|
||||
title: "登录提示",
|
||||
message: "请从微信中打开"
|
||||
|
|
|
@ -0,0 +1,421 @@
|
|||
<template>
|
||||
<div class="cabinet-container van-safe-area-bottom">
|
||||
<div class="left-container">
|
||||
<van-sidebar v-model="activeCabinet" class="cabinet-sidebar" @change="onCabinetChange">
|
||||
<van-sidebar-item v-for="cabinet in cabinetList" :key="cabinet.cabinetId" :title="cabinet.cabinetName" />
|
||||
</van-sidebar>
|
||||
</div>
|
||||
|
||||
<div class="product-list">
|
||||
<van-cell v-for="locker in lockerList" :key="locker.lockerId" class="product-item">
|
||||
<template #icon>
|
||||
<div class="image-container">
|
||||
<van-image width="80" height="80"
|
||||
:src="locker.coverImg ? locker.coverImg : `${publicPath}` + 'img/product-image.svg'"
|
||||
fit="cover" radius="4" class="product-image"
|
||||
:style="{ filter: locker.stock === 0 ? 'grayscale(100%)' : 'none' }">
|
||||
</van-image>
|
||||
</div>
|
||||
</template>
|
||||
<div class="product-info">
|
||||
<div class="goods-info">
|
||||
<div>
|
||||
<div class="info-row">
|
||||
<div class="locker-number">格口 {{ locker.cellNo }}</div>
|
||||
<div class="goods-price">¥{{ (locker.price || 0).toFixed(2) }}</div>
|
||||
</div>
|
||||
<div class="goods-name"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="button-group">
|
||||
<van-button size="small" plain hairline :loading="openingLockerId === locker.lockerId"
|
||||
@click="handleRefund(locker.orderId, locker.orderGoodsId)">
|
||||
退还格口
|
||||
</van-button>
|
||||
<van-button size="small" plain hairline :loading="openingLockerId === locker.lockerId"
|
||||
@click="handleOpenLocker(locker)">
|
||||
开启格口
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</van-cell>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { throttle } from 'lodash-es';
|
||||
import { ref, onMounted, onBeforeUnmount } from 'vue';
|
||||
import { getShopListApi } from '@/common/apis/shop';
|
||||
import { ShopEntity } from '@/common/apis/shop/type';
|
||||
import { getUserRentedCabinetListApi, openCabinet } from '@/common/apis/cabinet';
|
||||
import type { RentingCabinetDetailDTO, CabinetCellEntity } from '@/common/apis/cabinet/type';
|
||||
import { useWxStore } from '@/pinia/stores/wx';
|
||||
import { publicPath } from "@/common/utils/path";
|
||||
import { showDialog, showToast } from 'vant';
|
||||
import { useAb98UserStore } from '@/pinia/stores/ab98-user';
|
||||
|
||||
const router = useRouter();
|
||||
const wxStore = useWxStore();
|
||||
const { userid: userid, qyUserId: qyUserId, name: qyName, corpid, ab98User } = storeToRefs(wxStore);
|
||||
|
||||
const activeCabinet = ref(0)
|
||||
const cabinetList = ref<CabinetItem[]>([])
|
||||
const lockerList = ref<LockerItem[]>([])
|
||||
const openingLockerId = ref<number | null>(null)
|
||||
const showBindGoodsPopup = ref(false)
|
||||
const currentLocker = ref<LockerItem | null>(null)
|
||||
const cabinetData = ref<RentingCabinetDetailDTO[]>([]);
|
||||
let scrollListener: any[] = [];
|
||||
|
||||
interface CabinetItem {
|
||||
cabinetId: number
|
||||
cabinetName: string
|
||||
lockControlNo: number
|
||||
}
|
||||
|
||||
interface LockerItem {
|
||||
lockerId: number
|
||||
cellNo: number
|
||||
lockerNumber: number
|
||||
stock: number
|
||||
status: 0 | 1
|
||||
statusClass: 'available' | 'occupied'
|
||||
goodsName?: string
|
||||
price?: number
|
||||
coverImg?: string
|
||||
orderId: number;
|
||||
orderGoodsId: number;
|
||||
}
|
||||
|
||||
// 获取用户租用的机柜列表
|
||||
const loadUserRentedCabinetDetail = async () => {
|
||||
if (!ab98User.value || !ab98User.value.ab98UserId) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const { data } = await getUserRentedCabinetListApi(corpid.value, ab98User.value.ab98UserId);
|
||||
cabinetData.value = data || [];
|
||||
cabinetList.value = cabinetData.value.map(cabinet => ({
|
||||
cabinetId: cabinet.cabinetId,
|
||||
cabinetName: cabinet.cabinetName,
|
||||
lockControlNo: cabinet.lockControlNo
|
||||
}))
|
||||
|
||||
// 根据当前选中柜机加载格口数据
|
||||
if (cabinetData.value.length > 0) {
|
||||
updateLockerList(cabinetData.value[activeCabinet.value])
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取用户租用的柜机详情失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 更新格口列表数据
|
||||
const updateLockerList = (cabinet: RentingCabinetDetailDTO) => {
|
||||
lockerList.value = cabinet.cells.map(cell => ({
|
||||
lockerId: cell.cellId,
|
||||
cellNo: cell.cellNo,
|
||||
lockerNumber: cell.pinNo,
|
||||
stock: cell.stock,
|
||||
status: cell.isRented ? 1 : 0,
|
||||
statusClass: cell.isRented ? 'occupied' : 'available',
|
||||
// 这里假设商品信息可能在其他字段中,根据实际情况调整
|
||||
goodsName: '',
|
||||
price: cell.cellPrice,
|
||||
coverImg: `${publicPath}img/product-image.svg`,
|
||||
orderId: cell.orderId,
|
||||
orderGoodsId: cell.orderGoodsId,
|
||||
}))
|
||||
}
|
||||
|
||||
// 监听侧边栏切换事件
|
||||
const onCabinetChange = (index: number) => {
|
||||
activeCabinet.value = index
|
||||
if (cabinetList.value.length > index) {
|
||||
updateLockerList(cabinetData.value[index]);
|
||||
}
|
||||
}
|
||||
|
||||
const handleOpenLocker = async (locker: LockerItem) => {
|
||||
openingLockerId.value = locker.lockerId
|
||||
try {
|
||||
// 调用打开柜口接口
|
||||
await openCabinet(cabinetList.value[activeCabinet.value].cabinetId, locker.lockerNumber, {
|
||||
cellId: locker.lockerId,
|
||||
userid: userid.value,
|
||||
isInternal: 2,
|
||||
name: qyName.value,
|
||||
mobile: '',
|
||||
operationType: 2
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('打开柜口失败:', error)
|
||||
} finally {
|
||||
openingLockerId.value = null
|
||||
}
|
||||
}
|
||||
|
||||
const handleRefund = (orderId: number, orderGoodsId: number) => {
|
||||
router.push({
|
||||
path: '/approval/submit',
|
||||
query: {
|
||||
orderGoodsId,
|
||||
orderId,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 初始化方法
|
||||
const init = async () => {
|
||||
await loadUserRentedCabinetDetail();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
init();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
scrollListener.forEach(listener => window.removeEventListener('scroll', listener));
|
||||
scrollListener = [];
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.image-container {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.stock-overlay {
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
bottom: 4px;
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
color: white;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.cabinet-container {
|
||||
display: flex;
|
||||
height: calc(100vh - var(--van-tabbar-height));
|
||||
}
|
||||
|
||||
.left-container {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
/* 机柜选择相关样式 */
|
||||
.shop {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.shop-header {
|
||||
overflow: hidden;
|
||||
transition: height 0.3s ease;
|
||||
}
|
||||
|
||||
.shop-cover {
|
||||
width: 100%;
|
||||
transform: translateY(calc((150px - var(--header-height)) / 2));
|
||||
scale: calc(1 + (150 - var(--header-height)) / 150);
|
||||
}
|
||||
|
||||
.shop-list {
|
||||
.shop-prompt {
|
||||
margin: 8px;
|
||||
height: 44px !important;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.shop-row {
|
||||
margin: 8px 0;
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.shop-col {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
height: auto !important;
|
||||
padding: 0;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||
transition: transform 0.2s;
|
||||
|
||||
.shop-cover-img {
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.shop-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.shop-name {
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
margin: 2px 0 4px 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.showShopListBtn {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.cabinet-sidebar {
|
||||
width: 90px;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.locker-number {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.goods-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
|
||||
.goods-name {
|
||||
white-space: normal;
|
||||
word-wrap: break-word;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
line-height: 1.2;
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.goods-price {
|
||||
font-size: 14px;
|
||||
color: #e95d5d;
|
||||
font-weight: bold;
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.button-group {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-top: 0;
|
||||
|
||||
.detail-btn {
|
||||
flex: 1;
|
||||
background-color: #e95d5d;
|
||||
border: none;
|
||||
}
|
||||
|
||||
:deep(.van-button--default) {
|
||||
color: #e95d5d;
|
||||
border-color: #e95d5d;
|
||||
}
|
||||
}
|
||||
|
||||
.product-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 10px 16px 60px;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.product-item {
|
||||
margin-bottom: 10px;
|
||||
padding: min(2.667vw, 20px) 0;
|
||||
}
|
||||
|
||||
.product-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
padding-left: 3px;
|
||||
}
|
||||
|
||||
.goods-name {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.button-group {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.button-group .van-button {
|
||||
font-size: 12px;
|
||||
height: 24px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
:deep(.van-button) {
|
||||
--van-button-mini-height: 24px;
|
||||
--van-button-mini-padding: 0 8px;
|
||||
}
|
||||
|
||||
.locker-number {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
line-height: 1.4;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.goods-price {
|
||||
font-size: 16px;
|
||||
color: #e95d5d;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.button-group {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.detail-btn {
|
||||
flex: 1;
|
||||
background-color: #e95d5d;
|
||||
border: none;
|
||||
}
|
||||
|
||||
:deep(.van-button--default) {
|
||||
color: #e95d5d;
|
||||
border-color: #e95d5d;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
|
@ -16,11 +16,11 @@ export const useOrderStore = defineStore("order", () => {
|
|||
const orderGoods = ref<ShopOrderGoodsEntity[]>([])
|
||||
const goods = ref<Goods[]>([])
|
||||
|
||||
const getOrders = async (corpid: string, openid: string, qyUserId: number) => {
|
||||
const getOrders = async (corpid: string, openid: string, qyUserId: number, hasReturn: number) => {
|
||||
try {
|
||||
const { data } = qyUserId ?
|
||||
await getOrdersByQyUserIdApi(qyUserId)
|
||||
: await getOrdersByOpenIdApi(corpid, openid);
|
||||
await getOrdersByQyUserIdApi(qyUserId, hasReturn)
|
||||
: await getOrdersByOpenIdApi(corpid, openid, hasReturn);
|
||||
|
||||
// 重组订单结构
|
||||
orders.value = data.orders.map(order => ({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { pinia } from "@/pinia"
|
||||
import { getOpenIdApi, getBalanceApi, qyLogin, getBalanceByQyUserid } from "@/common/apis/shop"
|
||||
import { getOpenIdApi, getBalanceApi, qyLogin, getBalanceByQyUserid, fakeQyLoginApi } from "@/common/apis/shop"
|
||||
import { ab98UserDTO, GetBalanceResponse } from "@/common/apis/shop/type"
|
||||
import { useAb98UserStore } from "./ab98-user"
|
||||
|
||||
|
@ -32,6 +32,8 @@ export const useWxStore = defineStore("wx", () => {
|
|||
// 汇邦云用户信息
|
||||
const ab98User = ref<ab98UserDTO | null>(null);
|
||||
|
||||
const isFakeQyLogin = ref<boolean>(false);
|
||||
|
||||
// 设置 openid
|
||||
const setOpenid = (id: string) => {
|
||||
openid.value = id
|
||||
|
@ -66,6 +68,10 @@ export const useWxStore = defineStore("wx", () => {
|
|||
balance.value = res.data.balance;
|
||||
useBalance.value = res.data.useBalance;
|
||||
balanceLimit.value = res.data.balanceLimit;
|
||||
|
||||
if (res.data.ab98User) {
|
||||
setAb98User(res.data.ab98User);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,6 +124,9 @@ export const useWxStore = defineStore("wx", () => {
|
|||
if (!userid.value) {
|
||||
userid.value = balanceRes.data.userid;
|
||||
}
|
||||
if (!ab98User.value && balanceRes.data.ab98User) {
|
||||
setAb98User(balanceRes.data.ab98User);
|
||||
}
|
||||
/* if (!corpid.value) {
|
||||
corpid.value = balanceRes.data.corpid;
|
||||
} */
|
||||
|
@ -130,9 +139,27 @@ export const useWxStore = defineStore("wx", () => {
|
|||
}
|
||||
}
|
||||
|
||||
const fakeQyLogin = async () => {
|
||||
isFakeQyLogin.value = true;
|
||||
corpid.value = "wpZ1ZrEgAA2QTxIRcB4cMtY7hQbTcPAw";
|
||||
corpidLogin.value = true;
|
||||
userid.value = "woZ1ZrEgAAV9AEdRt1MGQxSg-KDJrDlA";
|
||||
const res = await fakeQyLoginApi({ corpid: corpid.value, userid: userid.value})
|
||||
if (res && res.code == 0) {
|
||||
userid.value = res.data.userid;
|
||||
openid.value = "oMRxw6Eum0DB1IjI_pEX_yrawBHw";
|
||||
isCabinetAdmin.value = res.data.isCabinetAdmin === 1;
|
||||
name.value = res.data.name;
|
||||
qyUserId.value = res.data.qyUserId;
|
||||
setAb98User(res.data.ab98User);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return { code, state, openid, corpid, userid, balance, useBalance,
|
||||
balanceLimit, isCabinetAdmin, corpidLogin, name, ab98User, qyUserId,
|
||||
setOpenid, setBalance, handleWxCallback, setIsCabinetAdmin, refreshBalance, setAb98User }
|
||||
balanceLimit, isCabinetAdmin, corpidLogin, name, ab98User, qyUserId, isFakeQyLogin,
|
||||
setOpenid, setBalance, handleWxCallback, setIsCabinetAdmin, refreshBalance, setAb98User,
|
||||
fakeQyLogin }
|
||||
})
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,6 +58,12 @@ export const routes: RouteRecordRaw[] = [
|
|||
component: () => import('@/pages/order/components/OrderList.vue'),
|
||||
meta: {
|
||||
title: '订单列表',
|
||||
layout: {
|
||||
navBar: {
|
||||
showNavBar: true,
|
||||
showLeftArrow: true
|
||||
}
|
||||
},
|
||||
requiresAuth: true
|
||||
}
|
||||
},
|
||||
|
@ -67,6 +73,27 @@ export const routes: RouteRecordRaw[] = [
|
|||
component: () => import('@/pages/order/index.vue'),
|
||||
meta: {
|
||||
title: '订单详情',
|
||||
layout: {
|
||||
navBar: {
|
||||
showNavBar: true,
|
||||
showLeftArrow: true
|
||||
}
|
||||
},
|
||||
requiresAuth: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/rental-list',
|
||||
name: 'RentalList',
|
||||
component: () => import('@/pages/rental/index.vue'),
|
||||
meta: {
|
||||
title: '我的柜子',
|
||||
layout: {
|
||||
navBar: {
|
||||
showNavBar: true,
|
||||
showLeftArrow: true
|
||||
}
|
||||
},
|
||||
requiresAuth: true
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue