| | |
| | | <scroll-view class="content" scroll-y="true" show-scrollbar="false"> |
| | | <view class="content-inner"> |
| | | <view class="qr-card"> |
| | | <image v-if="codeImage != ''" class="code-image" :src="codeImage" mode="aspectFit"></image><text v-else class="dynamic-code-placeholder">{{codeError ? '核销码加载失败,点击重试' : '正在生成核销码'}}</text> |
| | | <image v-if="codeImage != ''" class="code-image" :src="codeImage" mode="aspectFit" @error="handleCodeImageError"></image><text v-else class="dynamic-code-placeholder" @tap="refreshCode">{{codeError ? '核销码加载失败,点击重试' : '正在生成核销码'}}</text> |
| | | <text class="qr-tip" @tap="refreshCode">{{codeText}}</text> |
| | | </view> |
| | | |
| | | <view class="product-card"> |
| | | <image class="product-image" :src="productCoverUrl" mode="aspectFill"></image> |
| | | <image class="product-image" :src="productCoverUrl" mode="aspectFill" @error="handleCoverImageError"></image> |
| | | <view class="product-info"><text class="product-name">{{productName}}</text><text class="product-original">¥ {{originalAmount}}</text></view> |
| | | <view class="product-payment"><text class="payment-label">实付</text><text class="payment-price">¥ {{payAmount}}</text></view> |
| | | </view> |
| | |
| | | const navWidth = ref(88) |
| | | const navRight = ref(10) |
| | | const isSubmittingRefund = ref(false) |
| | | const productCoverUrl = ref('/static/home-assets/top.jpg') |
| | | const productCoverUrl = ref('/static/common/image-placeholder.png') |
| | | const recordId = ref('') |
| | | const orderId = ref(''); const talentId = ref(''); const codeImage = ref(''); const codeText = ref('正在生成动态核销码'); const codeError = ref(false); const productName = ref('人才权益服务'); const originalAmount = ref('0.00'); const payAmount = ref('0.00'); const discountAmount = ref('0.00'); const merchantName = ref(''); const merchantAddress = ref(''); const merchantMobile = ref(''); const merchantLatitude = ref(0.0); const merchantLongitude = ref(0.0); const createdAt = ref(''); const verifyTime = ref('-'); const canRefund = ref(false); let refreshTimer = 0 |
| | | |
| | |
| | | onUnload(() => stopRefresh()) |
| | | |
| | | const goBack = () => safeBack('/pages/order/order') |
| | | const loadOrder = () => getPendingUseOrder(orderId.value, talentId.value, (data:any) => { productName.value=data.productNameSnapshot||productName.value; productCoverUrl.value=resolveApiUrl(data.productCoverUrlSnapshot||'/static/home-assets/top.jpg'); originalAmount.value=Number(data.originalAmount).toFixed(2); payAmount.value=Number(data.payAmount).toFixed(2); discountAmount.value=Number(data.discountAmount).toFixed(2); merchantName.value=data.merchantNameSnapshot||''; merchantAddress.value=data.merchantAddressSnapshot||''; merchantMobile.value=data.merchantMobileSnapshot||''; merchantLatitude.value=Number(data.merchantLatitudeSnapshot); merchantLongitude.value=Number(data.merchantLongitudeSnapshot); createdAt.value=(''+data.createdAt).replace('T',' ').substring(0,19); verifyTime.value=data.verifyTime?(''+data.verifyTime).replace('T',' ').substring(0,19):'-'; canRefund.value=data.canRefund===true }, () => {}) |
| | | const loadOrder = () => getPendingUseOrder(orderId.value, talentId.value, (data:any) => { |
| | | // 已退款(含退款中)或已取消的订单不再是「待使用」:这一页不发核销码,直接进订单状态页看退款结果。 |
| | | if (Number(data.orderStatus) == 2 || data.refundStatus != null) { |
| | | uni.redirectTo({ url: '/pages/order-cancelled/order-cancelled?recordId=' + encodeURIComponent(recordId.value) + '&orderId=' + encodeURIComponent(orderId.value) + '&talentId=' + encodeURIComponent(talentId.value) }) |
| | | return |
| | | } |
| | | productName.value=data.productNameSnapshot||productName.value; productCoverUrl.value=resolveApiUrl(data.productCoverUrlSnapshot||'/static/common/image-placeholder.png'); originalAmount.value=Number(data.originalAmount).toFixed(2); payAmount.value=Number(data.payAmount).toFixed(2); discountAmount.value=Number(data.discountAmount).toFixed(2); merchantName.value=data.merchantNameSnapshot||''; merchantAddress.value=data.merchantAddressSnapshot||''; merchantMobile.value=data.merchantMobileSnapshot||''; merchantLatitude.value=Number(data.merchantLatitudeSnapshot); merchantLongitude.value=Number(data.merchantLongitudeSnapshot); createdAt.value=(''+data.createdAt).replace('T',' ').substring(0,19); verifyTime.value=data.verifyTime?(''+data.verifyTime).replace('T',' ').substring(0,19):'-'; canRefund.value=data.canRefund===true }, () => {}) |
| | | const stopRefresh=()=>{if(refreshTimer!=0){clearTimeout(refreshTimer);refreshTimer=0}} |
| | | const refreshCode=()=>{stopRefresh(); if(orderId.value=='')return; codeError.value=false; issueOrderVerificationCode(orderId.value,talentId.value,(data:any)=>{codeImage.value=resolveApiUrl(data.imagePath as string);codeText.value='核销码 '+(data.displayCode as string)+',请向商家出示';refreshTimer=setTimeout(()=>refreshCode(),Math.max(1,Number(data.refreshAfterSeconds)-3)*1000)},()=>{codeImage.value='';codeError.value=true;codeText.value='点击重新生成核销码'})} |
| | | // @error 必须收回图片地址:二维码取不回来时页面只会剩一片空白,用户分不清是没生成、没网还是码失效。 |
| | | // 这是 7.22 遗留问题 P1-006(远程图片失败会留白)的同一类缺陷,人才码和免费券码页都已按此处理。 |
| | | const handleCodeImageError=()=>{codeImage.value='';codeError.value=true;codeText.value='核销码加载失败,点击重新生成'} |
| | | const handleCoverImageError=()=>{productCoverUrl.value='/static/common/image-placeholder.png'} |
| | | const openNavigation = () => { if(merchantLatitude.value==0||merchantLongitude.value==0){uni.showToast({title:'商户暂未配置导航地址',icon:'none'});return};uni.openLocation({latitude:merchantLatitude.value,longitude:merchantLongitude.value,name:merchantName.value,address:merchantAddress.value,scale:16}) } |
| | | const callMerchant = () => { if(merchantMobile.value==''){uni.showToast({title:'商户暂未配置联系电话',icon:'none'});return};uni.makePhoneCall({phoneNumber:merchantMobile.value}) } |
| | | const requestRefund = () => { |