更换正式环境,测试修改
This commit is contained in:
77
pagesOrder/tuikuan/components/confirmRefundPopup.vue
Normal file
77
pagesOrder/tuikuan/components/confirmRefundPopup.vue
Normal file
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<uni-popup ref="popup" type="top" mask-background-color="rgba(0,0,0,.5)" :safe-area="false">
|
||||
<view class="card-wrapper">
|
||||
<image class="icon-close" src="/static/iconImg/icon-x.svg" mode="scaleToFill" @tap="close" />
|
||||
<view class="title">请输入支付密码</view>
|
||||
<view class="sub-title">退款</view>
|
||||
<view class="refund-money">¥{{ vdata.refundAmount }}</view>
|
||||
<JPasswordInput v-if="vdata.isShowPwdInput" margin="0 50rpx" :focus="true" ref="pwdInput" @inputChange="inputChange" />
|
||||
</view>
|
||||
</uni-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref, nextTick } from 'vue'
|
||||
const vdata = reactive({
|
||||
refundAmount: 0,
|
||||
isShowPwdInput: false,
|
||||
})
|
||||
const proms = {}
|
||||
const popup = ref(null)
|
||||
const pwdInput = ref(null)
|
||||
const open = (money, callBack) => {
|
||||
vdata.refundAmount = money
|
||||
vdata.callBack = callBack
|
||||
popup.value.open()
|
||||
|
||||
vdata.isShowPwdInput = false
|
||||
nextTick(() => {
|
||||
vdata.isShowPwdInput = true
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
const close = () => {
|
||||
popup.value.close()
|
||||
vdata.isShowPwdInput = false
|
||||
}
|
||||
// 输入框 e 输入的数字
|
||||
const inputChange = (e) => {
|
||||
if (e.length >= 6) return vdata.callBack(e)
|
||||
}
|
||||
const clearInput = () => pwdInput.value.clearInput()
|
||||
defineExpose({ open, clearInput, close })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-wrapper {
|
||||
margin: 0 50rpx;
|
||||
padding-bottom: 50rpx;
|
||||
margin-top: 162rpx;
|
||||
background-color: $J-bg-ff;
|
||||
border-radius: $J-b-r32;
|
||||
.icon-close {
|
||||
padding: 30rpx;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
.title {
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
.sub-title {
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 20rpx;
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
color: #808080;
|
||||
}
|
||||
.refund-money {
|
||||
margin-bottom: 70rpx;
|
||||
text-align: center;
|
||||
font-size: 50rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -39,7 +39,7 @@
|
||||
<view class="u-flex u-m-l-32 u-col-center">
|
||||
<up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon>
|
||||
<view class="u-m-l-28 u-m-r-28">{{item.number}}</view>
|
||||
<up-icon @click="changeItem(item,1)" :color="color.ColorMain" :size="20"
|
||||
<up-icon @click="changeItem(item,1)" :color="$utils.ColorMain" :size="20"
|
||||
name="plus-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
@@ -93,8 +93,9 @@
|
||||
<view style="height: 200rpx;"></view>
|
||||
<view class="fixed-b">
|
||||
<up-button text="确认退款" @click="tuikuanConfirm" shape="circle" type="primary" size="large"
|
||||
:color="color.ColorMain"></up-button>
|
||||
:color="$utils.ColorMain"></up-button>
|
||||
</view>
|
||||
<confirmRefundPopup ref="refundPopup" />
|
||||
|
||||
</view>
|
||||
</template>
|
||||
@@ -102,8 +103,8 @@
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import color from '@/commons/color.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import confirmRefundPopup from './components/confirmRefundPopup.vue';
|
||||
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import { refundOrder } from '@/http/api/order.js'
|
||||
import { mathFloorPrice } from '@/commons/utils/goodsUtil.js'
|
||||
@@ -132,10 +133,11 @@
|
||||
totalAmount: 0
|
||||
}
|
||||
})
|
||||
const refundPopup = ref(null);
|
||||
|
||||
onLoad((opt) => {
|
||||
orderDetail.info = JSON.parse(opt.orderInfo)
|
||||
orderDetail.goodsList = JSON.parse(opt.goodsList)
|
||||
console.log(orderDetail)
|
||||
option.productId = orderDetail.goodsList[0].productId
|
||||
option.orderId = orderDetail.goodsList[0].orderId
|
||||
})
|
||||
@@ -251,22 +253,23 @@
|
||||
/**
|
||||
* 确认退款
|
||||
*/
|
||||
let params;
|
||||
async function tuikuanConfirm() {
|
||||
const canTuikuan=await hasPermission('允许退款')
|
||||
if(!canTuikuan){
|
||||
return infoBox.showToast('您没有退款权限')
|
||||
return uni.$utils.showToast('您没有退款权限')
|
||||
}
|
||||
if (pageData.tabsIndex != 2&&tuikuanNumber.value <= 0) {
|
||||
return infoBox.showToast('退款商品数量不能为0!')
|
||||
return uni.$utils.showToast('退款商品数量不能为0!')
|
||||
}
|
||||
|
||||
const selTag=tuikuan.list[tuikuan.sel]
|
||||
const noteResult=`${selTag?selTag:''}${note.value?(','+note.value):''}`
|
||||
if (!noteResult) {
|
||||
return infoBox.showToast('请输入或选择退款原因!')
|
||||
return uni.$utils.showToast('请输入或选择退款原因!')
|
||||
}
|
||||
|
||||
let params = {
|
||||
|
||||
params = {
|
||||
orderId: option.orderId,
|
||||
refundReason: noteResult,
|
||||
refundDetails: orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
|
||||
@@ -285,10 +288,21 @@
|
||||
params.refundAmount = pageData.tabsIndex == 1 ? alltuikuanPrice.value : tuikuanPrice.value
|
||||
}
|
||||
if ( pageData.tabsIndex == 2 && params.refundAmount > orderDetail.info.payAmount){
|
||||
return infoBox.showToast('退款金额不能大于付款金额!')
|
||||
return uni.$utils.showToast('退款金额不能大于付款金额!')
|
||||
}
|
||||
if( uni.getStorageSync("shopInfo").isReturnPwd == 1){
|
||||
refundPopup.value.open(params.refundAmount, refundPost);
|
||||
return;
|
||||
}
|
||||
refundPost()
|
||||
}
|
||||
|
||||
async function refundPost (payPassword) {
|
||||
if( payPassword ){
|
||||
params.pwd = payPassword
|
||||
}
|
||||
await refundOrder(params)
|
||||
infoBox.showToast('退款请求提交成功')
|
||||
uni.$utils.showToast('退款请求提交成功')
|
||||
setTimeout(()=>{
|
||||
uni.navigateBack({delta:1})
|
||||
},500)
|
||||
|
||||
Reference in New Issue
Block a user