Compare commits

..

No commits in common. "c4562333c02110222b867243f95b7a65014bab8b" and "5c89ba97c4e35862b7f0c4df744460b64285b363" have entirely different histories.

10 changed files with 22 additions and 107 deletions

View File

@ -1,6 +1,5 @@
import { request } from '@/http/axios' import { request } from '@/http/axios'
import type { CabinetDetailResponse } from './type' import type { CabinetDetailResponse } from './type'
import { OpenCabinetApiData } from '../shop/type'
/** 获取智能柜详情接口 */ /** 获取智能柜详情接口 */
export function getCabinetDetailApi() { export function getCabinetDetailApi() {
@ -10,10 +9,9 @@ export function getCabinetDetailApi() {
}) })
} }
export function openCabinet(lockControlNo: number, pinNo: number, data: OpenCabinetApiData) { export function openCabinet(lockControlNo: number, pinNo: number) {
return request<ApiResponseData<void>>({ return request<ApiResponseData<void>>({
url: `cabinet/openCabinet/${lockControlNo}/${pinNo}`, url: `cabinet/openCabinet/${lockControlNo}/${pinNo}`,
method: 'post', method: 'post'
data
}) })
} }

View File

@ -1,5 +1,5 @@
import { request } from "@/http/axios" import { request } from "@/http/axios"
import { GetBalanceResponse, GetOrdersByOpenIdDTO, OpenCabinetApiData, QyLoginDTO, QyLoginRequestParams, ShopGoodsResponseData, SubmitOrderRequestData, SubmitOrderResponseData } from './type' import { GetBalanceResponse, GetOrdersByOpenIdDTO, QyLoginDTO, QyLoginRequestParams, ShopGoodsResponseData, SubmitOrderRequestData, SubmitOrderResponseData } from './type'
import { GetOpenIdRequestParams } from './type' import { GetOpenIdRequestParams } from './type'
@ -47,11 +47,10 @@ export function getOrdersByOpenIdApi(openid: string) {
} }
/** 打开储物柜接口 */ /** 打开储物柜接口 */
export function openCabinetApi(orderId: number, orderGoodsId: number, data: OpenCabinetApiData) { export function openCabinetApi(orderId: number, orderGoodsId: number) {
return request<ApiResponseData<void>>({ return request<ApiResponseData<void>>({
url: `order/openCabinet/${orderId}/${orderGoodsId}`, url: `order/openCabinet/${orderId}/${orderGoodsId}`,
method: "post", method: "post"
data
}) })
} }

View File

@ -107,20 +107,4 @@ export interface QyLoginDTO {
userid: string userid: string
openid: string openid: string
isCabinetAdmin: number isCabinetAdmin: number
name: string
}
export interface OpenCabinetApiData {
// 格口ID
cellId?: number
// 用户ID
userid: string
// 是否内部用户0否 1汇邦云用户 2企业微信用户
isInternal: number
// 姓名
name: string
// 联系电话
mobile: string
// 操作类型1用户 2管理员
operationType: number
} }

View File

@ -9,16 +9,12 @@ import { useRoute, useRouter } from 'vue-router'
import { useApprovalStore } from '@/pinia/stores/approval' import { useApprovalStore } from '@/pinia/stores/approval'
import { useWxStore } from '@/pinia/stores/wx'; import { useWxStore } from '@/pinia/stores/wx';
import Compressor from 'compressorjs'; import Compressor from 'compressorjs';
import { useAb98UserStore } from '@/pinia/stores/ab98-user'
const { VITE_APP_BASE_API } = import.meta.env; const { VITE_APP_BASE_API } = import.meta.env;
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const approvalStore = useApprovalStore(); const approvalStore = useApprovalStore();
const wxStore = useWxStore(); const wxStore = useWxStore();
const { openid, balance, corpidLogin, userid: qyUserid, name: qyName } = storeToRefs(wxStore);
const ab98UserStore = useAb98UserStore();
const { tel, userid: ab98Userid, name } = storeToRefs(ab98UserStore);
const formData = ref<HandleApprovalRequestData>({ const formData = ref<HandleApprovalRequestData>({
approvalId: approvalStore.currentApproval?.approvalId || 0, approvalId: approvalStore.currentApproval?.approvalId || 0,
@ -192,16 +188,9 @@ const handleOpenCabinet = async () => {
isButtonDisabled.value = true isButtonDisabled.value = true
try { try {
const isInternal = corpidLogin.value ? 2 : ab98Userid.value ? 1 : 0;
const result = await openCabinetApi( const result = await openCabinetApi(
approvalStore.currentApproval.orderId, approvalStore.currentApproval.orderId,
approvalStore.currentApproval.orderGoodsId, { approvalStore.currentApproval.orderGoodsId
userid: isInternal === 2 ? qyUserid.value : ab98Userid.value,
isInternal: isInternal,
name: isInternal === 2 ? qyName.value : name.value,
mobile: tel.value,
operationType: 2
}
) )
if (result.code !== 0) { if (result.code !== 0) {
showFailToast(result.msg || '开启失败') showFailToast(result.msg || '开启失败')

View File

@ -56,11 +56,10 @@
import { ref } from 'vue' import { ref } from 'vue'
import { getCabinetDetailApi, openCabinet } from '@/common/apis/cabinet' import { getCabinetDetailApi, openCabinet } from '@/common/apis/cabinet'
import type { CabinetDetailDTO } from '@/common/apis/cabinet/type' import type { CabinetDetailDTO } from '@/common/apis/cabinet/type'
import { useWxStore, useWxStoreOutside } from '@/pinia/stores/wx' import { useWxStoreOutside } from '@/pinia/stores/wx'
import { publicPath } from "@/common/utils/path" import { publicPath } from "@/common/utils/path"
const wxStore = useWxStore(); const wxStore = useWxStoreOutside()
const { userid: qyUserid, name: qyName } = storeToRefs(wxStore);
const activeCabinet = ref(0) const activeCabinet = ref(0)
const cabinetList = ref<CabinetItem[]>([]) const cabinetList = ref<CabinetItem[]>([])
@ -133,14 +132,7 @@ const handleOpenLocker = async (locker: LockerItem) => {
openingLockerId.value = locker.lockerId openingLockerId.value = locker.lockerId
try { try {
// //
await openCabinet(cabinetList.value[activeCabinet.value].lockControlNo, locker.lockerNumber, { await openCabinet(cabinetList.value[activeCabinet.value].lockControlNo, locker.lockerNumber)
cellId: locker.lockerId,
userid: qyUserid.value,
isInternal: 2,
name: qyName.value,
mobile: '',
operationType: 2
})
} catch (error) { } catch (error) {
console.error('打开柜口失败:', error) console.error('打开柜口失败:', error)
} finally { } finally {

View File

@ -4,32 +4,15 @@ import { useWxStore } from '@/pinia/stores/wx'
import { useAb98UserStore } from '@/pinia/stores/ab98-user' import { useAb98UserStore } from '@/pinia/stores/ab98-user'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { publicPath } from "@/common/utils/path" import { publicPath } from "@/common/utils/path"
import { showConfirmDialog } from 'vant';
const router = useRouter() const router = useRouter()
const wxStore = useWxStore() const wxStore = useWxStore()
const ab98UserStore = useAb98UserStore() const ab98UserStore = useAb98UserStore()
const { balance, name: qyName } = storeToRefs(wxStore); const { balance } = storeToRefs(wxStore)
const { name: userName, sex: userSex, face_img } = storeToRefs(ab98UserStore); const { name: userName, sex: userSex, face_img } = storeToRefs(ab98UserStore)
const name = computed(() => { const userAvatar = face_img.value ? face_img.value : `${publicPath}img/1.jpg`
return userName.value || qyName.value || '未知用户'
})
const userAvatar = face_img.value ? face_img.value : `${publicPath}img/1.jpg`;
const handleLogout = () => {
showConfirmDialog({
title: '退出登录',
message: '确定要退出当前账号吗?',
}).then(() => {
ab98UserStore.clearUserInfo();
router.push('/ab98');
}).catch(() => {
//
});
}
</script> </script>
<template> <template>
@ -44,10 +27,9 @@ const handleLogout = () => {
height="80" height="80"
:src="userAvatar" :src="userAvatar"
class="mr-4" class="mr-4"
@click="handleLogout"
/> />
<div> <div>
<div class="text-lg font-bold mb-2">{{ name }}</div> <div class="text-lg font-bold mb-2">{{ userName }}</div>
<van-tag type="primary" class="mr-2">{{ userSex }}</van-tag> <van-tag type="primary" class="mr-2">{{ userSex }}</van-tag>
</div> </div>
</div> </div>

View File

@ -2,35 +2,23 @@
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { Order, useOrderStore } from '@/pinia/stores/order' import { Order, useOrderStore } from '@/pinia/stores/order'
import { useWxStore, useWxStoreOutside } from '@/pinia/stores/wx' import { useWxStoreOutside } from '@/pinia/stores/wx'
import { openCabinetApi } from '@/common/apis/shop' import { openCabinetApi } from '@/common/apis/shop'
import { showSuccessToast, showFailToast } from 'vant' import { showSuccessToast, showFailToast } from 'vant'
import { ref } from 'vue' import { ref } from 'vue'
import { useAb98UserStore } from '@/pinia/stores/ab98-user'
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const orderStore = useOrderStore() const orderStore = useOrderStore()
const wxStore = useWxStoreOutside()
const orderId = ref(Number(route.query.orderId)) const orderId = ref(Number(route.query.orderId))
const currentOrder = ref<Order>() const currentOrder = ref<Order>()
const isButtonDisabled = ref<Record<number, boolean>>({}) const isButtonDisabled = ref<Record<number, boolean>>({})
const wxStore = useWxStore();
const { openid, balance, corpidLogin, userid: qyUserid, name: qyName } = storeToRefs(wxStore);
const ab98UserStore = useAb98UserStore();
const { tel, userid: ab98Userid, name } = storeToRefs(ab98UserStore);
async function handleOpenCabinet(orderId: number, orderGoodsId: number) { async function handleOpenCabinet(orderId: number, orderGoodsId: number) {
isButtonDisabled.value[orderGoodsId] = true isButtonDisabled.value[orderGoodsId] = true
try { try {
const isInternal = corpidLogin.value ? 2 : ab98Userid.value ? 1 : 0; const result = await openCabinetApi(orderId, orderGoodsId)
const result = await openCabinetApi(orderId, orderGoodsId, {
userid: isInternal === 2 ? qyUserid.value : ab98Userid.value,
isInternal: isInternal,
name: isInternal === 2 ? qyName.value : name.value,
mobile: tel.value,
operationType: 1
});
if (result.code !== 0) { if (result.code !== 0) {
showFailToast(result.msg || '开启失败,请稍后重试') showFailToast(result.msg || '开启失败,请稍后重试')
return return

View File

@ -5,18 +5,11 @@ import { useRoute, useRouter } from 'vue-router'
import { openCabinetApi } from '@/common/apis/shop' import { openCabinetApi } from '@/common/apis/shop'
import { showSuccessToast, showFailToast } from 'vant' import { showSuccessToast, showFailToast } from 'vant'
import { ref } from 'vue' import { ref } from 'vue'
import { useWxStore } from '@/pinia/stores/wx'
import { useAb98UserStore } from '@/pinia/stores/ab98-user'
const orderStore = useOrderStore() const orderStore = useOrderStore()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const wxStore = useWxStore();
const { openid, balance, corpidLogin, userid: qyUserid, name: qyName } = storeToRefs(wxStore);
const ab98UserStore = useAb98UserStore();
const { tel, userid: ab98Userid, name } = storeToRefs(ab98UserStore);
const statusMap: Record<number, string> = { const statusMap: Record<number, string> = {
1: '待付款', 1: '待付款',
2: '已付款', 2: '已付款',
@ -72,14 +65,7 @@ async function handleOpenCabinet(item: OrderGoods) {
const orderGoodsId = item.orderGoods.orderGoodsId const orderGoodsId = item.orderGoods.orderGoodsId
isButtonDisabled.value[orderGoodsId] = true isButtonDisabled.value[orderGoodsId] = true
try { try {
const isInternal = corpidLogin.value ? 2 : ab98Userid.value ? 1 : 0; const result = await openCabinetApi(orderId.value, orderGoodsId)
const result = await openCabinetApi(orderId.value, orderGoodsId, {
userid: isInternal === 2 ? qyUserid.value : ab98Userid.value,
isInternal: isInternal,
name: isInternal === 2 ? qyName.value : name.value,
mobile: tel.value,
operationType: 1
})
if (result.code !== 0) { if (result.code !== 0) {
showFailToast(result.msg || '开启失败,请稍后重试') showFailToast(result.msg || '开启失败,请稍后重试')
return return
@ -134,7 +120,7 @@ async function handleOpenCabinet(item: OrderGoods) {
<p>小计: ¥{{ (item.orderGoods.price * item.orderGoods.quantity).toFixed(2) }}</p> <p>小计: ¥{{ (item.orderGoods.price * item.orderGoods.quantity).toFixed(2) }}</p>
<div class="button-group"> <div class="button-group">
<van-button <van-button
v-if="[1,5].includes(item.orderGoods.status) && [2,3].includes(order.payStatus)" v-if="[1,5].includes(item.orderGoods.status)"
type="primary" type="primary"
size="small" size="small"
@click="handleOpenCabinet(item)" @click="handleOpenCabinet(item)"
@ -143,7 +129,7 @@ async function handleOpenCabinet(item: OrderGoods) {
打开柜子 打开柜子
</van-button> </van-button>
<van-button <van-button
v-if="item.orderGoods.status === 1 && [2,3].includes(order.payStatus)" v-if="item.orderGoods.status === 1"
type="primary" type="primary"
size="small" size="small"
@click="handleRefund(item)" @click="handleRefund(item)"

View File

@ -14,7 +14,7 @@ const cartStore = useCartStore()
const { cartItems, totalPrice } = storeToRefs(cartStore) const { cartItems, totalPrice } = storeToRefs(cartStore)
const wxStore = useWxStore() const wxStore = useWxStore()
const { openid, balance, corpidLogin, userid: qyUserid, name: qyName } = storeToRefs(wxStore) const { openid, balance, corpidLogin, userid: qyUserid } = storeToRefs(wxStore)
const ab98UserStore = useAb98UserStore() const ab98UserStore = useAb98UserStore()
const { tel, userid: ab98Userid, name } = storeToRefs(ab98UserStore) const { tel, userid: ab98Userid, name } = storeToRefs(ab98UserStore)
@ -102,7 +102,7 @@ async function handleSubmit() {
})), })),
paymentType: selectedPayment.value, paymentType: selectedPayment.value,
mobile: tel.value, mobile: tel.value,
name: isInternal === 2 ? qyName.value : name.value, name: name.value,
qyUserid: isInternal === 2 ? qyUserid.value : ab98Userid.value, qyUserid: isInternal === 2 ? qyUserid.value : ab98Userid.value,
isInternal: isInternal isInternal: isInternal
} }

View File

@ -19,8 +19,6 @@ export const useWxStore = defineStore("wx", () => {
const corpidLogin = ref<boolean>(false); const corpidLogin = ref<boolean>(false);
// 是否是柜子管理员 // 是否是柜子管理员
const isCabinetAdmin = ref<boolean>(false); const isCabinetAdmin = ref<boolean>(false);
// 企业微信用户姓名
const name = ref<string>("");
// 设置 openid // 设置 openid
const setOpenid = (id: string) => { const setOpenid = (id: string) => {
@ -59,7 +57,6 @@ export const useWxStore = defineStore("wx", () => {
userid.value = res.data.userid; userid.value = res.data.userid;
openid.value = res.data.openid; openid.value = res.data.openid;
isCabinetAdmin.value = res.data.isCabinetAdmin === 1; isCabinetAdmin.value = res.data.isCabinetAdmin === 1;
name.value = res.data.name;
} }
} }
@ -90,7 +87,7 @@ export const useWxStore = defineStore("wx", () => {
} }
} }
return { code, state, openid, corpid, userid, balance, isCabinetAdmin, corpidLogin, name, return { code, state, openid, corpid, userid, balance, isCabinetAdmin, corpidLogin,
setOpenid, setBalance, handleWxCallback, setIsCabinetAdmin } setOpenid, setBalance, handleWxCallback, setIsCabinetAdmin }
}) })