修复测试提出的bug

This commit is contained in:
xiaogang 2024-08-02 13:45:11 +08:00
parent 0e85a92e51
commit de644ad138
9 changed files with 99 additions and 69 deletions

View File

@ -3,5 +3,7 @@
# VITE_BASE_URL = 'https://zxjt.86698.cn' # VITE_BASE_URL = 'https://zxjt.86698.cn'
# 兴业优酷 # 兴业优酷
# VITE_BASE_URL = 'http://192.168.110.50:8083' # VITE_BASE_URL = 'http://192.168.110.50:8083'
# 邮储奶茶活动 # 邮储奶茶活动(测试环境)
VITE_BASE_URL = 'http://milk.api.test.86698.cn' VITE_BASE_URL = 'http://milk.api.test.86698.cn'
# 邮储奶茶活动(正式环境)
# VITE_BASE_URL = 'https://milk.api.cdlsxd.cn'

View File

@ -18,49 +18,52 @@
<script src="/static/ycnc/YT_Client_api.js"></script> <script src="/static/ycnc/YT_Client_api.js"></script>
<script type="module" src="/src/main.js"></script> <script type="module" src="/src/main.js"></script>
<script> <script>
document.addEventListener('touchmove', function(e) { // document.addEventListener('touchmove', function(e) {
e.preventDefault(); // e.preventDefault();
}, {passive: false}) // }, {passive: false})
</script>
<script src="https://fastly.jsdelivr.net/npm/eruda"></script>
<script>
eruda.init()
</script> </script>
<script> <script>
var clickCount = 0 // var clickCount = 0
var timer = null // var timer = null
var isShow = false // var isShow = false
function insertScript() { // function insertScript() {
isShow = true // isShow = true
// 创建一个新的script元素 // // 创建一个新的script元素
var src = 'https://fastly.jsdelivr.net/npm/eruda' // var src = 'https://fastly.jsdelivr.net/npm/eruda'
var script = document.createElement('script') // var script = document.createElement('script')
script.type = 'text/javascript' // script.type = 'text/javascript'
script.src = src // script.src = src
// 插入到head中 // // 插入到head中
document.head.appendChild(script) // document.head.appendChild(script)
script.onload = function () { // script.onload = function () {
eruda.init() // eruda.init()
} // }
} // }
// document.addEventListener('click', function () {
// if (isShow) return false
// if (clickCount < 6) {
// clickCount++
// console.log(`Clicked ${clickCount} times`)
document.addEventListener('click', function () { // // 如果是第一次点击,则开始计时
if (isShow) return false // if (clickCount === 1) {
if (clickCount < 6) { // timer = setTimeout(() => {
clickCount++ // clickCount = 0 // 重置点击计数
console.log(`Clicked ${clickCount} times`) // }, 2000)
// }
// 如果是第一次点击,则开始计时 // // 如果点击次数达到6次则清除计时器并重置状态
if (clickCount === 1) { // if (clickCount >= 6) {
timer = setTimeout(() => { // clearTimeout(timer)
clickCount = 0 // 重置点击计数 // insertScript()
}, 2000) // clickCount = 0 // 重置点击计数
} // }
// }
// 如果点击次数达到6次则清除计时器并重置状态 // })
if (clickCount >= 6) {
clearTimeout(timer)
insertScript()
clickCount = 0 // 重置点击计数
}
}
})
</script> </script>
</body> </body>
</html> </html>

View File

@ -1,13 +1,13 @@
<script> <script>
export default { export default {
onLaunch: function () { onLaunch: function () {
console.log('App Launch') // console.log('App Launch')
}, },
onShow: function () { onShow: function () {
console.log('App Show') // console.log('App Show')
}, },
onHide: function () { onHide: function () {
console.log('App Hide') // console.log('App Hide')
}, },
} }
</script> </script>

View File

@ -27,7 +27,7 @@
<view class="btn del" @click="goDel">删除订单</view> <view class="btn del" @click="goDel">删除订单</view>
<view class="btn pay" v-if="[1].includes(detail.state)" @click="goPay">立即付款</view> <view class="btn pay" v-if="[1].includes(detail.state)" @click="goPay">立即付款</view>
<view class="btn view" v-if="[3].includes(detail.state) && !!detail.voucher_link" @click="goPwd">查看卡密</view> <view class="btn view" v-if="[3].includes(detail.state) && !!detail.voucher_link" @click="goPwd">查看卡密</view>
<view class="btn pay" @click="goRefund" v-if="[3].includes(detail.state) && !detail.voucher_link">申请退款</view> <view class="btn pay" @click="goRefund" v-if="[4].includes(detail.state)">申请退款</view>
</view> </view>
</view> </view>
</template> </template>

View File

@ -25,7 +25,7 @@ export default function usePay(){
const params = { const params = {
Plain:handleParams(Plain), Plain:handleParams(Plain),
} }
console.log('handCodePay-params',params); console.log('handCodePay-params',Plain);
Fw.device.api.handCodePay(params); Fw.device.api.handCodePay(params);
} }
return {payFunc} return {payFunc}

View File

@ -11,6 +11,7 @@
<template> <template>
<scroll-view scroll-y class="page-wrapper"> <scroll-view scroll-y class="page-wrapper">
<view class="nav-btn" @click="toOrder">我的订单</view> <view class="nav-btn" @click="toOrder">我的订单</view>
<!-- <view style="opacity: 0;width: 100%;height:200rpx;position:absolute;top:230rpx" @click="test"></view> -->
<view class="wrapper flex flex-col flex-items-center box-border"> <view class="wrapper flex flex-col flex-items-center box-border">
<view v-for="(item,key) in productList" :key="key"> <view v-for="(item,key) in productList" :key="key">
<brand :products="item" :brandName="key"/> <brand :products="item" :brandName="key"/>

View File

@ -19,12 +19,14 @@
</view> --> </view> -->
<view class="order-wrapper flex flex-col flex-items-center" v-if="Array.isArray(list) && list.length > 0"> <view class="order-wrapper flex flex-col flex-items-center" v-if="Array.isArray(list) && list.length > 0">
<view v-for="(ele,index) in list" :key="`${ele.id}-${item.state}`"> <view v-for="(ele,index) in list" :key="`${ele.id}-${item.state}`">
<OrderItem :detail="ele" <OrderItem
:detail="ele"
@pay-event="pay" @pay-event="pay"
@detail-event="viewDetail" @detail-event="viewDetail"
@pwd-event="viewPwd" @pwd-event="viewPwd"
@del-event="(orderData) => removeOrder(orderData,index)" @del-event="removeOrder"
@refund-event="refund"/> @refund-event="refund"
/>
</view> </view>
<view class="no-more" v-if="isLastPage">没有更多了~</view> <view class="no-more" v-if="isLastPage">没有更多了~</view>
</view> </view>
@ -139,7 +141,7 @@
} }
} }
function removeOrder(orderData,index){ function removeOrder(orderData){
message message
.confirm({ .confirm({
msg: '删除订单后无法恢复,确认继续吗?', msg: '删除订单后无法恢复,确认继续吗?',
@ -162,6 +164,13 @@
function refund(orderData){ function refund(orderData){
const {id} = orderData const {id} = orderData
if(!id){
uni.showToast({
icon:'none',
title: '无有效的订单id',
});
return
}
const params = {order_id:id} const params = {order_id:id}
refundOrder({params}).then(res => { refundOrder({params}).then(res => {
uni.showToast({ uni.showToast({

View File

@ -32,8 +32,7 @@
</view> </view>
<view class="order-info"> <view class="order-info">
<view class="info-item">订单编号{{ orderDetail.order_no }}</view> <view class="info-item">订单编号{{ orderDetail.order_no }}</view>
<!-- <view class="info-item" v-if="![1].includes(orderDetail.state)">支付时间{{ orderDetail.exchange_time || '' }}</view> --> <view class="info-item" v-if="!!orderDetail.exchange_time && ![9].includes(orderDetail.state)">支付时间{{ orderDetail.exchange_time }}</view>
<view class="info-item" v-if="!!orderDetail.exchange_time">支付时间{{ orderDetail.exchange_time }}</view>
<view class="info-item">下单时间{{ orderDetail.create_time }}</view> <view class="info-item">下单时间{{ orderDetail.create_time }}</view>
<view class="info-item" style="margin-bottom: 24rpx;">订单金额{{ orderDetail.price }}</view> <view class="info-item" style="margin-bottom: 24rpx;">订单金额{{ orderDetail.price }}</view>
</view> </view>
@ -41,26 +40,33 @@
<view class="btns"> <view class="btns">
<view class="btn pwd" @click="viewPwd(orderDetail)" v-if="[3].includes(orderDetail.state) && !!orderDetail.voucher_link">查看卡密</view> <view class="btn pwd" @click="viewPwd(orderDetail)" v-if="[3].includes(orderDetail.state) && !!orderDetail.voucher_link">查看卡密</view>
<view class="btn pwd" @click="pay(orderDetail)" v-if="[1].includes(orderDetail.state)">立即付款</view> <view class="btn pwd" @click="pay(orderDetail)" v-if="[1].includes(orderDetail.state)">立即付款</view>
<view class="btn pwd" v-if="[3].includes(orderDetail.state) && !orderDetail.voucher_link" @click="goRefund">申请退款</view> <view class="btn pwd" v-if="[4].includes(orderDetail.state) && !orderDetail.voucher_link" @click="goRefund">申请退款</view>
<view class="btn back" @click="backIndex">返回首页</view> <view class="btn back" @click="backIndex">返回首页</view>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import { onLoad } from '@dcloudio/uni-app'; import { onShow } from '@dcloudio/uni-app';
import { onMounted, reactive, ref, unref } from 'vue'; import { onMounted, reactive, ref, unref } from 'vue';
import { queryOrderDetail,refundOrder} from '../../api/ycnc'; import { queryOrderDetail,refundOrder} from '../../api/ycnc';
import {getQueryString} from '../../utils/utils'
import usePay from './hooks/usePay'; import usePay from './hooks/usePay';
const id = ref(''); const id = ref('');
const orderNo = ref(''); const orderNo = ref('');
const orderDetail = reactive({}); const orderDetail = reactive({});
onLoad((options) => { // onshow h5
console.log('options',options); onShow(()=>{
const {order_id,order_no} = options; const url = window.location.href
console.log('url-->',url);
const order_id = getQueryString('order_id')
const order_no = getQueryString('order_no')
console.log(order_id,order_no);
if(!order_id && !order_no) return
id.value = order_id id.value = order_id
orderNo.value = order_no orderNo.value = order_no;
getDetail();
}) })
const backIndex = () => { const backIndex = () => {
@ -79,8 +85,15 @@
} }
} }
const goRefund = (detailData) => { const goRefund = () => {
const {id} = detailData const {id} = orderDetail
if(!id){
uni.showToast({
icon:'none',
title: '无有效的订单id',
});
return
}
const params = {order_id:id} const params = {order_id:id}
refundOrder({params}).then(res => { refundOrder({params}).then(res => {
uni.showToast({ uni.showToast({
@ -100,7 +113,7 @@
} }
onMounted(() => { onMounted(() => {
getDetail() // getDetail()
}) })
const getDetail = () => { const getDetail = () => {

View File

@ -20,20 +20,22 @@ function http(options) {
uni.hideLoading().then(() => { uni.hideLoading().then(() => {
uni.showToast({ uni.showToast({
title: "api错误" + res.errMsg, title: "api错误" + res.errMsg,
icon: 'error' icon: 'none'
}); });
}) })
reject() reject()
} else { } else {
if(res.data?.code >= 200 && res.data?.code < 300){ if(res.data?.code >= 200 && res.data?.code < 300){
setTimeout(()=>{
uni.hideLoading() uni.hideLoading()
},500)
resolve(res.data.data) resolve(res.data.data)
}else if(res.data?.code === 401){ }else if(res.data?.code === 401){
//邮储银行专用的 //邮储银行专用的
const authCode = await useCode(); const authCode = await useCode();
const params = {code:authCode}; const params = {code:authCode};
const {token} = await login({params}); const {token} = await login({params});
uni.setStorageSync('token',token); window.localStorage.setItem('token',token);
http(options).then(ress => { http(options).then(ress => {
resolve(ress) resolve(ress)
}) })
@ -41,7 +43,7 @@ function http(options) {
uni.hideLoading().then(() => { uni.hideLoading().then(() => {
uni.showToast({ uni.showToast({
title: res.data.message, title: res.data.message,
icon: 'error' icon: 'none'
}); });
}) })
reject(res.data.message) reject(res.data.message)
@ -53,7 +55,7 @@ function http(options) {
uni.hideLoading().then(() => { uni.hideLoading().then(() => {
uni.showToast({ uni.showToast({
title: err, title: err,
icon: 'error' icon: 'none'
}); });
}) })
reject(err) reject(err)