修复测试提出的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 = 'http://192.168.110.50:8083'
# 邮储奶茶活动
# 邮储奶茶活动(测试环境)
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 type="module" src="/src/main.js"></script>
<script>
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, {passive: false})
// document.addEventListener('touchmove', function(e) {
// e.preventDefault();
// }, {passive: false})
</script>
<script src="https://fastly.jsdelivr.net/npm/eruda"></script>
<script>
eruda.init()
</script>
<script>
var clickCount = 0
var timer = null
var isShow = false
function insertScript() {
isShow = true
// 创建一个新的script元素
var src = 'https://fastly.jsdelivr.net/npm/eruda'
var script = document.createElement('script')
script.type = 'text/javascript'
script.src = src
// 插入到head中
document.head.appendChild(script)
script.onload = function () {
eruda.init()
}
}
// var clickCount = 0
// var timer = null
// var isShow = false
// function insertScript() {
// isShow = true
// // 创建一个新的script元素
// var src = 'https://fastly.jsdelivr.net/npm/eruda'
// var script = document.createElement('script')
// script.type = 'text/javascript'
// script.src = src
// // 插入到head中
// document.head.appendChild(script)
// script.onload = function () {
// 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 < 6) {
clickCount++
console.log(`Clicked ${clickCount} times`)
// // 如果是第一次点击,则开始计时
// if (clickCount === 1) {
// timer = setTimeout(() => {
// clickCount = 0 // 重置点击计数
// }, 2000)
// }
// 如果是第一次点击,则开始计时
if (clickCount === 1) {
timer = setTimeout(() => {
clickCount = 0 // 重置点击计数
}, 2000)
}
// 如果点击次数达到6次则清除计时器并重置状态
if (clickCount >= 6) {
clearTimeout(timer)
insertScript()
clickCount = 0 // 重置点击计数
}
}
})
// // 如果点击次数达到6次则清除计时器并重置状态
// if (clickCount >= 6) {
// clearTimeout(timer)
// insertScript()
// clickCount = 0 // 重置点击计数
// }
// }
// })
</script>
</body>
</html>

View File

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

View File

@ -27,7 +27,7 @@
<view class="btn del" @click="goDel">删除订单</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 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>
</template>

View File

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

View File

@ -11,6 +11,7 @@
<template>
<scroll-view scroll-y class="page-wrapper">
<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 v-for="(item,key) in productList" :key="key">
<brand :products="item" :brandName="key"/>

View File

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

View File

@ -32,8 +32,7 @@
</view>
<view class="order-info">
<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">支付时间{{ 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">下单时间{{ orderDetail.create_time }}</view>
<view class="info-item" style="margin-bottom: 24rpx;">订单金额{{ orderDetail.price }}</view>
</view>
@ -41,26 +40,33 @@
<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="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>
</view>
</template>
<script setup>
import { onLoad } from '@dcloudio/uni-app';
import { onShow } from '@dcloudio/uni-app';
import { onMounted, reactive, ref, unref } from 'vue';
import { queryOrderDetail,refundOrder} from '../../api/ycnc';
import {getQueryString} from '../../utils/utils'
import usePay from './hooks/usePay';
const id = ref('');
const orderNo = ref('');
const orderDetail = reactive({});
onLoad((options) => {
console.log('options',options);
const {order_id,order_no} = options;
// onshow h5
onShow(()=>{
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
orderNo.value = order_no
orderNo.value = order_no;
getDetail();
})
const backIndex = () => {
@ -79,8 +85,15 @@
}
}
const goRefund = (detailData) => {
const {id} = detailData
const goRefund = () => {
const {id} = orderDetail
if(!id){
uni.showToast({
icon:'none',
title: '无有效的订单id',
});
return
}
const params = {order_id:id}
refundOrder({params}).then(res => {
uni.showToast({
@ -100,7 +113,7 @@
}
onMounted(() => {
getDetail()
// getDetail()
})
const getDetail = () => {

View File

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