SFH5/pages/unlock/index.vue

1486 lines
38 KiB
Vue

<template>
<view class="container" :class="[`${themeInfo.theme}-theme`]">
<!-- <view class="header">
<uv-tabs lineWidth="80rpx" lineHeight="10rpx" lineColor="#f56c6c" :scrollable="false" :list="list">
</uv-tabs>
</view> -->
<view class="content">
<view class="card orderList" v-for="item in state.orderList" :key="item.orderId">
<view class="orderInfo">
<!-- <uv-button shape="circle">复制</uv-button> -->
<view class="orderOn">订单号:{{ item.orderNo }} <uv-button @click="copyOrderOn(item)" shape="circle">复制</uv-button> </view>
<view class="box1">
<!-- 顶部:左中右布局 -->
<view class="top">
<view class="left">
<image src="/static/home/siteicon.svg" class="icon"></image>
<view class="title-wrap">
<text class="title font36 fontb">{{ item.siteName }}</text>
</view>
</view>
</view>
<!-- 底部:地址 -->
<view class="bottom">
<image src="/static/home/siteicon2.svg" class="icon"></image>
<text class="address font26 fontb textGary">{{ item.siteCity }}{{ item.siteDistrict }}{{ item.siteAddress }}</text>
</view>
</view>
<view class="box2">
<view class="item">
<view class="label font26 fontb textGary">仓号:</view>
<view class="value font26 fontb"> {{ item.lockerName }}</view>
</view>
<view class="item">
<view class="label font26 fontb textGary">体积:</view>
<view class="value font26 fontb"> 长{{ item.lockerLength }}m*宽{{ item.lockerWidth }}m*高{{
item.lockerHight }}m ({{ item.lockerVolume }}m³)</view>
</view>
<view class="item">
<view class="label font26 fontb textGary">仓型: </view>
<view class="value font26 fontb">{{ item.unitTypeName }}</view>
</view>
<view class="item">
<view class="label font26 fontb textGary">租期: </view>
<view class="value font26 fontb"> {{ item.endTime?.substr(0, 10) }}</view>
</view>
<view class="item" v-if="!(item.orderStartStatus == 2 && item.refundLockerStatus === 0)">
<view class="label font26 fontb textGary">{{ $t('common.status') }}: </view>
<view class="value font26 fontb" style="color: #FB322E;">
<template v-if="item.refundLockerStatus === 0">{{ $t("common.notStarted") }}</template>
<template v-else-if="item.refundLockerStatus === 1">{{ $t("unlock.cancelPending")
}}</template>
<template v-else-if="item.refundLockerStatus === 2">{{ $t("unlock.outComplete")
}}</template>
<template v-else-if="item.refundLockerStatus === 3">{{ $t("unlock.disapproval") }} {{
item.orderStatus == 5 ? `(${$t("unlock.overdue")})` : ''}}</template>
<template v-else-if="item.refundLockerStatus === 4">{{ $t("unlock.overdue")
}}</template>
</view>
</view>
</view>
</view>
<view class="btn" v-show="[0, 3, 4].includes(item.refundLockerStatus)" v-if="item.orderStatus !== 2">
<uv-button
:disabled="!(item.orderStartStatus == 2 && item.refundLockerStatus !== 4 && item.orderStatus !== 5 && item.isOpenDoor)"
shape="circle" @click="openDevicePopup(item)">开门</uv-button>
<uv-button
:disabled="!(item.orderStartStatus == 2 && item.refundLockerStatus !== 4 && item.orderStatus !== 5 && item.isOpenLock)"
shape="circle" @click="openPwdPopup(item)">开锁</uv-button>
<uv-button v-show="item.orderStartStatus == 2 || item.orderStartStatus == 1"
:style="{ opacity: item.renewal ? '1' : '0.5' }" @click="showPayPopup(item)"
shape="circle">续仓</uv-button>
<uv-button shape="circle" @click="openDetailPopup(item)">详情</uv-button>
</view>
<!-- 退仓申请中 -->
<view class="btn" v-show="item.refundLockerStatus === 1">
<uv-button :customStyle="{
color: '#fff',
}" color="#FB322E" shape="circle" @click="cancelMoveOutRqt(item)">取消退仓申请</uv-button>
<uv-button shape="circle" @click="openDetailPopup(item)">{{ $t("unlock.details") }}</uv-button>
</view>
<view class="btn" v-show="item.refundLockerStatus === 2" style="justify-content: end;">
<uv-button shape="circle" @click="openDetailPopup(item)">{{ $t("unlock.details") }}</uv-button>
</view>
<view class="btn" v-if="state.orderData.orderStatus == 2" style="justify-content: start;">
<uv-button shape="circle" :customStyle="{
color: '#fff',
}" color="#FB322E" @click="handleCancelOrder(item)">取消订单</uv-button>
</view>
</view>
</view>
<view class="empt font32 fontb" style="text-align: center;position: absolute; top: 50%;left: 50%;transform: translate(-50%, -50%);" v-if="state.orderList.length === 0" >
你还没有订单哦~
</view>
<view class="footer">
<myCustomtTabBar direction="horizontal" :show-icon="true" :selected="1" @onTabItemTap="onTabItemTap">
</myCustomtTabBar>
</view>
<uv-popup ref="detailPopupRef" zIndex="999" round="16rpx">
<view class="popupBox popupBoxW710">
<view class="orderList">
<view class="orderInfo">
<!-- <uv-button shape="circle">复制</uv-button> -->
<view class="orderOn">订单号:{{ state.orderData.orderNo }} </view>
<view class="box1">
<!-- 顶部:左中右布局 -->
<view class="top">
<view class="left">
<image src="/static/home/siteicon.svg" class="icon"></image>
<view class="title-wrap">
<text class="title font36 fontb">{{ state.orderData.siteName }} </text>
</view>
</view>
</view>
<!-- 底部:地址 -->
<view class="bottom">
<image src="/static/home/siteicon2.svg" class="icon"></image>
<text class="address font26 fontb textGary">{{ state.orderData.siteCity }}{{
state.orderData.siteDistrict }}{{
state.orderData.siteAddress }}</text>
</view>
</view>
<view class="box2 box2_border">
<view class="item">
<view class="label font26 fontb textGary">仓号: </view>
<view class="value font26 fontb">{{ state.orderData.lockerName }}</view>
</view>
<view class="item">
<view class="label font26 fontb textGary">体积: </view>
<view class="value font26 fontb">长{{ state.orderData['length'] }}m*{{
state.orderData.width}}宽m*{{
state.orderData.height }}高m ({{ state.orderData.volume }}m³)</view>
</view>
<view class="item">
<view class="label font26 fontb textGary">仓型: </view>
<view class="value font26 fontb">{{ state.orderData.unitTypeName }}</view>
</view>
<view class="item"
v-if="!(state.orderData.orderStartStatus == 2 && state.orderData.refundLockerStatus === 0)">
<view class="label font26 fontb textGary">{{ $t('common.status') }}: </view>
<view class="value font26 fontb" style="color: #FB322E;">
<template v-if="state.orderData.refundLockerStatus === 0">{{ $t("common.notStarted")
}}</template>
<template v-else-if="state.orderData.refundLockerStatus === 1">{{
$t("unlock.cancelPending") }}</template>
<template v-else-if="state.orderData.refundLockerStatus === 2">{{
$t("unlock.outComplete") }}</template>
<template v-else-if="state.orderData.refundLockerStatus === 3">{{
$t("unlock.disapproval") }} {{ state.orderData.orderStatus == 5
? `(${$t("unlock.overdue")})`:''}}</template>
<template v-else-if="state.orderData.refundLockerStatus === 4">{{
$t("unlock.overdue") }}</template>
</view>
</view>
</view>
<view class="box2">
<view class="item">
<view class="label font26 fontb textGary">开始时间: </view>
<view class="value font26 fontb">{{ state.orderData.startTime?.substr(0, 10) }}</view>
</view>
<view class="item">
<view class="label font26 fontb textGary">结束时间: </view>
<view class="value font26 fontb">{{ state.orderData.endTime?.substr(0, 10) }}</view>
</view>
<view class="item">
<view class="label font26 fontb textGary">{{ $t("detail.rentalFee") }}: </view>
<view class="value font26 fontb">{{ currency }} {{ state.orderData.originalPrice }}
</view>
</view>
<view class="item">
<view class="label font26 fontb textGary">{{ $t("detail.deposit") }}: </view>
<view class="value font26 fontb">{{ currency }} {{ state.orderData.deposit }}</view>
</view>
<view class="item">
<view class="label font26 fontb textGary">{{ $t("detail.discount") }}: </view>
<view class="value font26 fontb">-{{ currency }} {{ state.orderData.favorable }} </view>
</view>
<view class="item">
<view class="label font26 fontb textGary">{{ $t("detail.total") }}: </view>
<view class="value font26 fontb">{{ currency }} {{ state.orderData.actualPay }} </view>
</view>
</view>
</view>
<view class="btn" v-if="state.orderData.orderStatus !== 2"
v-show="state.orderData.refundLockerStatus != 1 && state.orderData.refundLockerStatus !== 2">
<uv-button class="uv-btn" shape="circle" @click="openMoveOutModal">
{{ $t("unlock.moveout") }}
</uv-button>
</view>
</view>
</view>
</uv-popup>
<uv-popup ref="devicePopupRef" zIndex="999" round="16rpx">
<view class="popupBox popupBoxW688">
<view class="title fontb font32">
开门二维码
</view>
<view class="content">
<img @click="showImage(QRCode)" alt="加载失败" v-show="ifShow" class="paw" width="100%" height="300rpx" :src="QRCode"></img>
<text class="textGray font26">二维码的有效期仅为15分钟</text>
</view>
<view class="btnBox">
<uv-button @click="closeDevicePopup" :customStyle="{
height: '86rpx',
color: '#000',
fontSize: '32rpx',
}" shape="circle">
取消
</uv-button>
<uv-button @click="GetQRCode" :customStyle="{
height: '86rpx',
background: '#FB322E',
color: '#fff',
fontSize: '32rpx',
}" shape="circle">
刷新
</uv-button>
</view>
</view>
</uv-popup>
<uv-popup ref="pawPopupRef" zIndex="999" round="16rpx">
<view class="popupBox pwdBox popupBoxW688">
<view class="title fontb font32">
开锁
</view>
<view class="content">
<text class="font26 textRed fontb" style="font-size: 60rpx;">{{ lockPwd }}#</text>
<text class="textGray font26">输入密码即可开锁或一键开锁</text>
</view>
<view class="btnBox">
<uv-button @click="closePwdPopup" :customStyle="{
height: '86rpx',
color: '#000',
fontSize: '32rpx',
}" shape="circle">
取消
</uv-button>
<uv-button :customStyle="{
height: '86rpx',
background: '#FB322E',
color: '#fff',
fontSize: '32rpx',
}" shape="circle">
刷新
</uv-button>
</view>
</view>
</uv-popup>
<uv-popup ref="payPopupRef" mode="bottom" zIndex="999" round="16rpx">
<view class="popupBox payPopupBox">
<view class="title titleIcon font36 fontb">
<image src="/static/home/siteicon.svg" class="icon"></image>
<view class="title-wrap">
<text class="title font36 fontb">{{ state.selectItem.siteName }} {{ state.selectItem.lockerName
}}</text>
</view>
</view>
<view class="title2 font32 fontb">
<view class="bitianBox">续租时长 <view class="bitian">必填</view>
</view>
</view>
<view class="garyBox font28 card20" @click="showMonthPopup">
<view style="display: flex;align-items: center;">租期时长</view>
<view class="select"><text style="margin-right: 10rpx;color: #FB322E;font-weight: bold;">{{
state.month
}}个月</text> <uv-icon name="arrow-right" color="#000000" blod size="24rpx"></uv-icon></view>
</view>
<view class="title2 font32 fontb">
<text>租赁体积</text> <text>{{ `${state.lockData?.volume}` }}</text>
</view>
<view class="garyBox garyBoxM font28 card20">
<view class="mgb20">
仓号: {{ state.lockData?.name }}
</view>
<view>
尺寸: {{ state.lockData?.['length'] }}m*{{ state.lockData?.width }}m*{{ state.lockData?.height }}m
</view>
</view>
<view class="title2 font32 fontb">
<text>租金总价</text> <text> {{ state.priceData?.lockerExpense }}</text>
</view>
<view class="title2 textGary font28">
<text>租金月费</text> <text> {{ state.priceData?.lockerPrice }}</text>
</view>
<view class="title2 textGary font28">
<text>租期时长</text> <text> {{ state.month }}个月</text>
</view>
<view class="title2 font32 fontb">
<text>押金费用</text> <text> {{ state.priceData.securityDeposit }}</text>
</view>
<view class="title2 textGary font28">
<text>租赁押金在租期结束后给予归还</text>
</view>
<view class="title2 font32 fontb">
<text>优惠信息</text> <text style="color: #FB322E;">- {{ state.priceData.favorable }}</text>
</view>
<view class="toOrder card font28">
<view class="left font28">
<text class="price font36 fontb"> {{ state.priceData.expense ? `${state.priceData.expense}` :'--'}}</text>
</view>
<view class="right">
<view class="detail" v-if="state.priceData.expense" @click="hidePayPopup"><text
class="font28">明细</text>
<view class="viewIcon"><uv-icon name="play-left-fill" size="20" color="#FFF" /></view>
</view>
<uv-button :customStyle="{
height: '86rpx',
background: '#FB322E',
color: '#fff',
}" :textStyle="{
fontSize: '32rpx',
}" shape="circle" class="goOrder" @click="goOrder">续仓支付</uv-button>
</view>
</view>
</view>
</uv-popup>
<uv-popup ref="monthPopupRef" mode="bottom" zIndex="999" round="16rpx">
<view class="unitPopupBox">
<view class="title font36 fontb">
租期选择
</view>
<view class="info">
<uv-radio-group v-model="state.radioMonthvalue" activeColor="#fb322e" size="32rpx">
<view class="list" v-for="item in state.lockData?.discountList">
<view class="left">
<view class="volume mgb10">
租期: {{ item.month }}个月
</view>
<view class="unit mgb10">
优惠: 享受{{ (item.discount * 100) / 10 }}折优惠
</view>
<!-- <view class="site textGary mgb10">
尺寸: 120cm*100cm*100cm
</view> -->
</view>
<view class="right">
<view class="radioBox mgb10">
<uv-radio :key="item.month" :name="item.month">
</uv-radio>
</view>
</view>
</view>
<view class="list">
<view class="left">
<view class="volume mgb10" style="display: flex;">
自定义租期: &nbsp;<uv-number-box buttonSize="26" integer v-model="state.selfMonth"
color="#ffffff" bgColor="#FB322E" :min="1" :max="24" :step="1"
iconStyle="color: #fff"></uv-number-box>&nbsp;个月
</view>
<view class="unit mgb10" v-if="selfDiscount !== 1">
优惠: 享受{{ selfDiscount * 100 / 10 }}折优惠
</view>
<view class="unit mgb10 textRed" v-else>
优惠: --
</view>
<!-- <view class="site textGary mgb10">
尺寸: 120cm*100cm*100cm
</view> -->
</view>
<view class="right">
<view class="radioBox mgb10">
<uv-radio :key="0" :name="-1">
</uv-radio>
</view>
</view>
</view>
</uv-radio-group>
</view>
<view class="btn" @click="confirmMonth">
<uv-button :customStyle="{
height: '86rpx',
background: '#FB322E',
color: '#fff',
fontSize: '32rpx',
}" shape="circle">
确定
</uv-button>
</view>
</view>
</uv-popup>
<!-- 上传图片退仓的弹窗 -->
<uv-popup ref="moveOutPopup" customStyle="width: 688rpx; border-radius: 16rpx;"
:closeOnClickOverlay="false" zIndex="9999">
<view class="modal-container">
<view class="modal-title">{{ $t("unlock.moveoutReminder") }}</view>
<text class="modal-text">
{{ $t("unlock.moveoutTip") }}
</text>
<text class="textRed mgb10" style="font-size: 26rpx;margin-top: 10rpx;">
{{ $t('unlock.uploadTip') }}
</text>
<view class="upload">
<uv-upload :fileList="moveImageList" name="1" :maxCount="10" width="200rpx" height="200rpx" multiple
:previewFullImage="false" uploadText=" " @afterRead="afterRead"
@delete="deletePic">
</uv-upload>
</view>
<view class="modal-button">
<uv-button @click="closeMoveOutModal" :customStyle="{
height: '86rpx',
lineHeight: '86rpx',
color: '#000',
fontSize: '32rpx',
}" shape="circle">
{{ $t("unlock.cancel") }}
</uv-button>
<uv-button :customStyle="{
height: '86rpx',
background: '#FB322E',
lineHeight: '86rpx',
color: '#fff',
fontSize: '32rpx',
}" shape="circle" @click="handleRefundLocker">
{{ $t("unlock.confirmOut") }}
</uv-button>
</view>
</view>
</uv-popup>
<!-- 成功退仓弹窗 -->
<uv-popup ref="moveOutPopup2"
customStyle="width: 688rpx; border-radius: 16rpx;"
:closeOnClickOverlay="false" zIndex="9999">
<view class="modal-container">
<view class="modal-title">{{ $t("unlock.moveoutReminder") }}</view>
<text class="modal-text">
{{ $t("unlock.moveoutSuccess") }}
</text>
<view class="modal-button">
<!-- <view class="modal-button-2" @click="goEvaluate">{{ $t("unlock.evaluate") }}</view> -->
<uv-button @click="closeModal2" :customStyle="{
height: '86rpx',
lineHeight: '86rpx',
color: '#000',
fontSize: '32rpx',
}" shape="circle">
关闭
</uv-button>
</view>
</view>
</uv-popup>
</view>
</template>
<script setup>
import { ref, computed } from 'vue';
import { onTabItemTap, onShowRerequestByIsLogin, makePhoneCall } from '/utils/common.js'
import myModal from '@/components/myModal.vue';
import myCustomtTabBar from '@/components/myCustomtTabBar.vue';
import wxNavbar from '@/components/wxNavbar.vue';
import { useCountDown } from "@/hooks/index";
import { onLoad, onShow, onShareAppMessage, onHide } from '@dcloudio/uni-app'
import { useLockApi } from '@/Apis/lock.js';
import myPopup from '@/components/myPopup.vue';
// 主题色配置
import { useMainStore } from "@/store/index.js";
import { navbarHeightAndStatusBarHeight, shareParam } from "@/utils/common.js";
import { currency } from "@/config/index.js";
import { useGoodsApi } from "@/Apis/goodsList.js";
import { useLoginApi } from "@/Apis/login.js";
import { storeToRefs } from 'pinia';
import { useOrderApi } from "@/Apis/order.js";
import { baseImageUrl } from "@/config/index.js";
import { useSiteApi } from "@/Apis/site.js";
import { useI18n } from 'vue-i18n';
import dayjs from 'dayjs';
const payPopupRef = ref(null);
const monthPopupRef = ref(null);
const moveOutPopup = ref(null);
const moveOutPopup2 = ref(null);
const getGoodsApi = useGoodsApi();
const { themeInfo, getUserInfo, getHasVerify } = useMainStore();
const { storeState } = storeToRefs(useMainStore());
const { locale, t } = useI18n();
const getApi = useOrderApi()
const getLockApi = useLockApi();
const getSiteApi = useSiteApi();
const getLoginApi = useLoginApi();
const { count, countDown, cancelCout } = useCountDown();
const devicePopupRef = ref(null);
const pawPopupRef = ref(null);
const detailPopupRef = ref(null);
uni.hideTabBar();
const state = ref({
orderList: [],
selectItem: {}, // 当前选中的订单
orderData: {},// 详情
month: 24, // 租期
priceData: {}, // 订单价格
lockData: {
discountList: []
}, // 锁详情
radioMonthvalue: 24,
month: 24,
selfMonth: 1,
refundLoading: false,
});
const list = [{
name: '在租',
}, {
name: '到期',
}, {
name: '待支付'
}]
const showImage = (url) => {
if(!url) return;
uni.previewImage({
urls: [url],
});
};
const copyOrderOn = (item) => {
uni.setClipboardData({
data: item.orderNo,
success: function () {
uni.showToast({
title: '复制成功',
icon: 'none',
duration: 3000
})
}
});
}
const goOrder = async () => {
if (!state.value.selectItem?.orderId) {
return uni.showToast({
title: '请重新选择订单',
icon: 'none',
duration: 3000
})
}
if (!state.value.month) {
return uni.showToast({
title: '租期',
icon: 'none',
duration: 3000
}
)
}
let source = window.sf.isSfApp() ? 2 : 1;
uni.showLoading({
title: '支付中',
mask: true
})
getApi
.ContinuationOrder({
orderId: state.value.selectItem.orderId,
month: state.value.month,
source
})
.then((res) => {
uni.hideLoading();
if (res.code === 200) {
let path = window.location.pathname;
if (!path.endsWith('/')) {
path = path + '/';
}
const returnUrl = `${window.location.origin}${path}#/pages/unlock/index`;
if (window.sf.isSfApp()) {
window.sf.goPay({
partnerId: res.data.partnerId, //商户id
prepayId: res.data.package, // 预支付id
nonceStr: res.data.nonceStr, //随机字符串
timeStamp: res.data.timeStamp, //时间戳
sign: res.data.paySign, //签名
package: `prepay_id=${res.data.package}`,
payChannel: 'payByWeChat' // app微信支付
}).then(res => {
const { channelType, status, message, channelResult } = res && res.result || {}
if (state === 0) {
uni.showToast({
title: '支付成功',
icon: 'none',
duration: 3000
})
hidePayPopup();
GetOrderList();
} else {
uni.showToast({
title: '支付失败',
icon: 'none',
duration: 3000
})
}
}).catch(err => console.log(err))
} else {
uni.showLoading({
title: '支付中',
mask: true
})
window.sf.goPay({
timeStamp: res.data.timeStamp, // 从服务器获取的时间戳
nonceStr: res.data.nonceStr, // 从服务器获取的随机字符串
package: `prepay_id=${res.data.package}`, // 从服务器获取的预支付交易会话标识
signType: res.data.signType, // 签名方式
paySign: res.data.paySign, // 从服务器获取的签名
successUrl: returnUrl,
failUrl: returnUrl
}).then(res => { }).catch(err => console.log(err))
}
} else {
if (res.code === 1001) {
uni.showModal({
title: t('common.title'),
content: t('common.unpaidOrderTips'),
showCancel: false,
success: function () {
uni.switchTab({
url: '/pages/unlock/index',
})
},
})
return
}
}
});
}
const handleCancelOrder = (item) => {
uni.showModal({
title: t('common.cancelOrder'),
content: t('common.cancelOrderTips'),
success: (res) => {
if (res.confirm) {
cancelOrder(item);
}
},
});
}
const cancelOrder = (item) => {
uni.showLoading({
mark: true,
})
getApi.OrderCountdownTime({ orderId: item.orderId }).then(res=>{
uni.hideLoading()
if(res.code === 200){
GetOrderList();
}else{
uni.showToast({
title: res.msg,
icon: "none",
});
}
})
}
function openMoveOutModal() {
moveOutPopup.value.open()
}
function closeMoveOutModal() {
moveOutPopup.value.close()
}
const showMonthPopup = () => {
getLockerById();
monthPopupRef.value.open();
};
const hideMonthPopup = () => {
monthPopupRef.value.close();
};
const confirmMonth = () => {
if (state.value.radioMonthvalue === -1) {
state.value.month = state.value.selfMonth;
} else {
state.value.month = state.value.radioMonthvalue;
}
getLockerExpense();
hideMonthPopup();
}
const selfDiscount = computed(() =>
state.value.lockData.discountList
.sort((a, b) => b.month - a.month)
.find(item => state.value.selfMonth >= item.month)?.discount ?? 1
)
const showPayPopup = (item) => {
state.value.selectItem = item;
payPopupRef.value.open();
getLockerExpense();
getLockerById()
};
const hidePayPopup = () => {
payPopupRef.value.close();
state.value.selectItem = {}
}
const getLockerById = () => {
uni.showLoading();
getSiteApi.GetLockerById({ lockerId: state.value.selectItem.lockerId }).then((res) => {
if (res.code === 200) {
state.value.lockData = res.data;
state.value.lockData.orderId = state.value.selectItem.orderId;
GetOrderById();
getLockerExpense();
}
});
};
const getLockerExpense = () => {
uni.showLoading({
mask: true,
});
getApi
.ContinuationOrderPricePost({
orderId: state.value.selectItem.orderId,
month: state.value.month,
// couponIds: state.value.couponItem.map((item) => item.couponDispositionId),
// point:state.value.point,
// serialNumber: state.value.couponOtherItem.map(x => {
// return {
// dealGroupId: x.dealGroupId,
// number: x.number,
// marketPrice: x.marketPrice,
// purchasePrice: x.price
// }
// })
})
.then((res) => {
uni.hideLoading();
if (res.code === 200) {
state.value.priceData = res.data;
}
if (res.code === 1002) {
uni.showModal({
title: t('common.title'),
content: t('common.ORDER_AMOUNT_ERROR'),
showCancel: false,
success: function () {
clearCoupon();
state.value.point = 0;
},
});
}
});
};
const openDetailPopup = (item) => {
state.value.selectItem = item;
detailPopupRef.value.open();
GetOrderById()
}
const closeDetailPopup = () => {
state.value.selectItem = {};
detailPopupRef.value.close();
}
const openPwdPopup = (item) => {
state.value.selectItem = item;
pawPopupRef.value.open();
GetLockPwd();
}
const closePwdPopup = () => {
state.value.selectItem = {};
pawPopupRef.value.close();
}
const openDevicePopup = (item) => {
state.value.selectItem = item;
devicePopupRef.value.open();
GetQRCode();
}
const closeDevicePopup = () => {
devicePopupRef.value.close();
}
// 发起退仓请求后点击我的订单跳到unlock
function closeModal2() {
moveOutPopup2.value.close()
closeDetailPopup()
GetOrderList();
}
const moveImageList = ref([]);
// 删除图片
const deletePic = (event) => {
moveImageList.value.splice(event.index, 1);
};
// 新增图片方法
const afterRead = async (event) => {
let lists = [].concat(event.file);
let fileListLen = moveImageList.value.length;
lists.map(item => {
moveImageList.value.push({
...item,
status: 'uploading'
});
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadImage(lists[i].url);
let item = moveImageList.value[fileListLen];
moveImageList.value.splice(fileListLen, 1, Object.assign(item, {
status: result ? 'success' : 'failed',
url: result
}));
fileListLen++;
}
}
// 上传图片请求
const uploadImage = async (url) => {
let resUrl = '';
try {
const res = await getApi.UploaderImage({ filePath: url });
resUrl = res.data;
} catch (error) {
console.error('UploaderImage error:', error);
}
return resUrl;
}
// 确认退仓
const handleRefundLocker = async () => {
try {
const hasLoadingImage = moveImageList.value.find(item => item.status === 'uploading');
if (hasLoadingImage) {
uni.showToast({
title: '图片上传中,请稍后',
icon: 'none'
});
return;
}
const imageList = moveImageList.value.filter(item => item.status === 'success');
if (!imageList.length) {
uni.showToast({
title: '请上传图片',
icon: 'none'
});
return;
}
if (state.value.refundLoading) return;
uni.showLoading({ mask: true });
state.value.refundLoading = true;
let imageUrls = imageList.map(item => item.url);
imageUrls = imageUrls.join(',');
const { code } = await getApi.ApplyForRefundLocker({ orderId: state.value.selectItem.orderId, imageUrl: imageUrls });
if (code == 200) {
moveOutPopup.value.close();
moveOutPopup2.value.open();
}
uni.hideLoading();
state.value.refundLoading = false;
} catch (error) {
uni.hideLoading();
state.value.refundLoading = false;
}
}
// 取消退仓
const cancelMoveOutRqt = (item) => {
uni.showLoading()
getApi.CancelApplyForRefundLocker(item.orderId).then(res => {
uni.hideLoading()
if (res.code === 200) {
GetOrderList()
}
})
}
const lockPwd = ref('')
// 获取锁的密码
function GetLockPwd() {
lockPwd.value = ''
uni.showLoading({ mask: true })
getLockApi.GetDyncPwdByMac({ lockMac: state.value.selectItem.lockMac, siteId: state.value.selectItem.siteId }).then(res => {
if (!res.data.password) {
uni.hideLoading()
uni.showToast({
title: res.data.message,
duration: 3000,
icon: 'none'
})
} else {
uni.hideLoading()
lockPwd.value = res.data
}
})
}
const QRCode = ref('')
const ifShow = ref(false)
// 获取二维码
function GetQRCode() {
ifShow.value = false
uni.showLoading({ mask: true })
getLockApi.GetAccesscontrolQRCodeBySite({ siteId: state.value.selectItem.siteId, orderId: state.value.selectItem.orderId }).then(res => {
if (res.code === 200) {
QRCode.value = res.data
ifShow.value = true
} else {
ifShow.value = false
}
uni.hideLoading();
})
}
const GetOrderById = () => {
uni.showLoading()
state.value.orderData = {}
getApi.GetOrderById({ orderId: state.value.selectItem.orderId }).then(res => {
uni.hideLoading()
if (res.code === 200) {
state.value.orderData = res.data
}
})
}
const GetOrderList = () => {
uni.showLoading()
getApi.GetOrderList().then(res => {
state.value.orderList = []
if (res.code === 200) {
state.value.orderList = res.data;
//检查是否验证过
// checkedHasVerify()
}
uni.hideLoading();
})
}
onShareAppMessage((res) => {
if (res.from === "button") {
// 来自页面内分享按钮
console.log(res.target);
}
return shareParam;
});
onLoad(() => {
// GetOrderList()
})
onHide(() => {
})
const goVaild = () => {
uni.navigateTo({
url: "/pagesb/validationInfo/index",
});
};
const token = ref(uni.getStorageSync('token'))
onShow(() => {
uni.hideTabBar()
token.value = uni.getStorageSync('token')
onShowRerequestByIsLogin(() => {
GetOrderList();
}, (err) => {
state.value.orderList = []
})
})
</script>
<style scoped lang="scss">
@import '@/static/style/theme.scss';
// 解决H5转微信小程序使用v-show不生效的问题
[hidden] {
display: none !important;
}
.modal-container {
// height: 700rpx;
// background: #000;
display: flex;
justify-content: flex-start;
align-items: center;
flex-direction: column;
padding: 32rpx;
.modal-title {
width: 100%;
text-align: center;
font-weight: bold;
font-size: 36rpx;
color: #000000;
}
:deep(.uv-upload__wrap) {
display: flex;
}
.modal-text {
width: 100%;
margin-top: 20rpx;
font-size: 26rpx;
font-weight: 600;
text-align: center;
line-height: 32rpx;
}
.upload {
margin-top: 30rpx;
height: 250rpx;
width: 100%;
// background: #000;
display: flex;
justify-content: center;
// overflow-x: scroll;
overflow-y: scroll;
// white-space: nowrap;
flex-wrap: nowrap;
// overflow: hidden;
}
.modal-button {
margin-top: 20rpx;
width: 100%;
min-height: 86rpx;
display: flex;
gap: 20rpx;
:deep(.uv-button-wrapper) {
flex: 1;
}
}
}
.modal-container2 {
height: 400rpx;
@extend .modal-container
}
.payPopupBox {
padding-bottom: calc(32rpx + constant(safe-area-inset-bottom));
padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
.titleIcon {
display: flex;
align-items: center;
padding: 32rpx 0;
padding-top: 0;
image {
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
}
}
.garyBox {
border: 1px solid #F6F6F7;
background-color: #F8F9FB;
display: flex;
justify-content: space-between;
.select {
display: flex;
align-items: center;
}
}
.garyBoxM {
display: flex;
flex-direction: column;
}
.bitianBox {
display: flex;
align-items: center;
vertical-align: middle;
}
.title2 {
margin-bottom: 20px;
display: flex;
justify-content: space-between;
.bitian {
border: 1px solid #FB322E;
padding: 2rpx 8rpx;
color: #FB322E;
border-radius: 99rpx;
text-align: center;
font-size: 18rpx;
margin-left: 10rpx;
}
}
.toOrder {
padding: 0;
padding-left: 28rpx;
border-radius: 999rpx;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #0D1118;
color: #FFFFFF;
.left {
color: #E9CBA1;
}
.right {
display: flex;
align-items: center;
.detail {
display: flex;
align-items: center;
margin-right: 20rpx;
.viewIcon {
margin-left: 4rpx;
transform: rotate(270deg);
}
}
text {
display: flex;
align-items: center;
}
.goOrder {
height: 86rpx;
width: 250rpx;
:deep(.uv-button) {
font-size: 28rpx;
border: none;
}
}
}
}
}
.unitPopupBox {
min-height: 50%;
padding: 32rpx;
.title {
margin-bottom: 20px;
}
:deep(.uv-radio-group) {
width: 100%;
}
.info {
display: flex;
font-size: 28rpx;
.list {
display: flex;
width: 100%;
padding-bottom: 20rpx;
border-bottom: 1px solid #a8aaac69;
margin-bottom: 20rpx;
.left {
flex: 1;
font-size: 28rpx;
}
.radioBox {
display: flex;
justify-content: end;
}
}
}
}
.popupBoxW710{
width: 710rpx;
}
.popupBox {
display: flex;
flex-direction: column;
padding: 32rpx;
.title {
text-align: center;
}
.content {
display: flex;
flex-direction: column;
justify-content: center;
text {
margin: 20rpx 0;
text-align: center;
}
}
.btnBox {
display: flex;
gap: 20rpx;
width: 100%;
:deep(.uv-button-wrapper) {
flex: 1;
}
}
.orderList {
display: flex;
flex-direction: column;
.box2_border {
margin-bottom: 20rpx;
padding-top: 20rpx;
border-bottom: 1px solid #a8aaac69;
border-top: 1px solid #a8aaac69;
}
.box2 {
display: flex;
flex-direction: column;
.item {
display: flex;
margin-bottom: 20rpx;
.label {
padding-right: 10rpx;
}
}
}
.orderOn {
width: 100%;
display: flex;
align-items: center;
color: #626466;
font-size: 20rpx;
margin-bottom: 20rpx;
:deep(.uv-button) {
font-size: 14rpx;
color: #6f6f6f;
font-weight: bold;
height: 30rpx;
width: 70rpx;
}
}
.orderInfo {
width: 100%;
display: flex;
flex-direction: column;
border-bottom: 1px solid #a8aaac69;
margin-bottom: 20rpx;
:deep(.uv-button) {
margin-left: 8rpx;
height: 30rpx;
width: 70rpx;
}
}
image {
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
}
/* 顶部行 */
.top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
image {
margin-top: 4rpx;
}
.left {
display: flex;
align-items: center;
.title-wrap {
display: flex;
flex-direction: row;
align-items: center;
.tag {
background-color: $sfgrayBgColor;
margin-left: 8rpx;
border-radius: 8px;
height: 35rpx;
line-height: 35rpx;
padding: 0 8rpx;
}
}
}
.right {
.distance {}
}
}
/* 底部地址行 */
.bottom {
display: flex;
align-items: center;
margin-bottom: 20rpx;
.address {
word-wrap: break-word;
word-break: break-all;
}
}
.btn {
display: flex;
justify-content: space-between;
:deep(.uv-button) {
min-width: 135rpx;
height: 50rpx;
font-size: 20rpx;
color: #6f6f6f;
font-weight: bold;
}
}
}
}
.container {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
padding-bottom: 400rpx;
.header {
width: 100%;
padding: 20rpx;
:deep(.uv-tabs__wrapper__nav__item) {
height: 80rpx !important;
}
:deep(.uv-tabs__wrapper__nav__item__text) {
font-size: 32rpx;
font-weight: bold;
padding-bottom: 10rpx;
}
}
.content {
display: flex;
width: 100%;
flex-direction: column;
.orderList {
display: flex;
flex-direction: column;
.box2 {
display: flex;
flex-direction: column;
.item {
display: flex;
margin-bottom: 20rpx;
.label {
padding-right: 10rpx;
}
}
}
.orderOn {
width: 100%;
display: flex;
align-items: center;
color: #626466;
font-size: 20rpx;
margin-bottom: 20rpx;
:deep(.uv-button) {
font-size: 14rpx;
color: #6f6f6f;
font-weight: bold;
}
}
.orderInfo {
width: 100%;
display: flex;
flex-direction: column;
border-bottom: 1px solid #a8aaac69;
margin-bottom: 20rpx;
:deep(.uv-button) {
margin-left: 8rpx;
height: 30rpx;
width: 70rpx;
padding: 0;
}
}
image {
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
}
/* 顶部行 */
.top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
image {
margin-top: 4rpx;
}
.left {
display: flex;
align-items: center;
.title-wrap {
display: flex;
flex-direction: row;
align-items: center;
.title {}
.tag {
background-color: $sfgrayBgColor;
margin-left: 8rpx;
border-radius: 8px;
height: 35rpx;
line-height: 35rpx;
padding: 0 8rpx;
}
}
}
.right {
.distance {}
}
}
/* 底部地址行 */
.bottom {
display: flex;
align-items: center;
margin-bottom: 20rpx;
.address {
word-wrap: break-word;
word-break: break-all;
}
}
.btn {
display: flex;
justify-content: space-between;
:deep(.uv-button) {
min-width: 135rpx;
height: 50rpx;
font-size: 20rpx;
color: #6f6f6f;
font-weight: bold;
}
}
}
}
}
</style>