代码更新

This commit is contained in:
GaoHao
2025-03-04 18:30:16 +08:00
parent fd0c452a76
commit 4f65b08c06
32 changed files with 622 additions and 1616 deletions

View File

@@ -38,7 +38,7 @@
</view>
</view>
<view class="u-flex u-m-t-8">
<view class="u-m-r-20 u-flex " v-if="item.payAmount<=0">
<view class="u-m-r-20 u-flex" v-if="item.isGift">
<uni-tag text="赠送"
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
</uni-tag>
@@ -57,8 +57,12 @@
<view class="color-666">退款金额:</view>
<view class="color-999 u-m-l-6">{{item.returnAmount}}</view>
</view>
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnNum">
<view class="color-666">退菜数量:</view>
<view class="color-999 u-m-l-6">{{item.returnNum}}</view>
</view>
</view>
<view class="color-999 u-font-24 u-m-t-8">{{item.productSkuName||''}}</view>
<view class="color-999 u-font-24 u-m-t-8">{{item.skuName||''}}</view>
<view class="u-m-t-12 color-666 u-font-24" v-if="item.remark">
@@ -66,21 +70,20 @@
</view>
</view>
<view class="u-text-right u-m-t-28">
{{isTui(item)}}
<template v-if="isTui(item)">
<view>0.00</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}
</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template>
<template v-else-if="isGift(item)||item.userCouponId">
<template v-else-if="item.userCouponId">
<view>0.00</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}
</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template>
<template v-else>
<template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1">
<view>{{returnCanTuiMoney(item)}}</view>
<view>{{returnTotalMoney(item)}}</view>
<view class=" color-666 line-th">
{{returnTotalMoney(item)}}</view>
{{returnCanTuiMoney(item)}}</view>
</template>
<template v-else>
<view>{{returnTotalMoney(item)}}</view>
@@ -353,7 +356,7 @@
}
function returnTotalMoney(item) {
return (item.payAmount * item.num).toFixed(2)
return (item.payAmount).toFixed(2)
}
const canTuiKuanPrice = computed(() => {
@@ -394,12 +397,13 @@
})
function returnCanTuiMoney(item) {
return props.orderInfo.status == 'unpaid' ? item.payAmount : item.payAmount
if (props.orderInfo.status == 'unpaid') {
return returnTotalMoney(item)
} else {
if (props.orderInfo.pointsDiscountAmount > 0 || props.orderInfo.fullCouponDiscountAmount > 0) {
return item.canReturnAmount
} else if (item.price != item.unitPrice) {
return item.price*item.num
} else {
return item.payAmount
}
@@ -476,8 +480,8 @@
return 0
}
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return" && (v.isMember &&
v.memberPrice) && (v.memberPrice != v.price)).reduce((
const curTotal = cur.info.filter(v => v.discountSaleAmount <= 0 && v.isGift != 1 && v.status !== "return" && (v.price !=
v.unitPrice) && (v.memberPrice != v.price)).reduce((
a,
b) => {
return a + (b.num * (b.price - b.memberPrice))
@@ -504,20 +508,15 @@
}, 0)
return goodsPrice.toFixed(2)
})
/**
* 已优惠金额
*/
const youhuiAllPrice = computed(() => {
const n = props.orderInfo.originAmount - props.orderInfo.amount + vipDiscountPrice.value * 1
const n = props.orderInfo.orderAmount - props.orderInfo.payAmount + vipDiscountPrice.value * 1
return (n < 0 ? 0 : n).toFixed(2)
// if(props.orderInfo.status!='unpaid'){
// const seatfee=(props.orderInfo.amount==0&&allPrice.value==0)?seatFeePrice.value:0
// return (goodsOriginAllPrice.value-allPrice.value+seatfee*1).toFixed(2)
// }
// return (freePrice.value * 1 + vipDiscountPrice.value * 1 + props.orderInfo.fullCouponDiscountAmount + props
// .orderInfo.pointsDiscountAmount + (props.orderInfo.status == 'unpaid' ? productCoupPrice.value :
// productCouponDiscountAmount.value) * 1 + (props.orderInfo.discountAmount ||
// 0)).toFixed(2)
})
const packFee = computed(() => {
//不是退菜只要有打包费的都计算,包括赠送
const goodsPrice = props.data.reduce((prve, cur) => {

View File

@@ -18,7 +18,7 @@
</view>
<view class="u-flex u-row-between u-m-t-24">
<view>支付方式</view>
<view>{{data.payType||''}}</view>
<view>{{returnPayType(data.payType)||''}}</view>
</view>
<view class="u-flex u-row-between u-m-t-24">
<view>下单时间</view>
@@ -45,6 +45,7 @@
</template>
<script setup>
import { ref } from 'vue';
import orderEnum from '@/commons/orderEnum.js'
const props = defineProps({
data: {
@@ -62,7 +63,24 @@
}
}
})
const payTypeList = [
{name: '主扫', type:'main_scan'},
{name: '被扫', type:'back_scan'},
{name: '微信小程序', type:'wechat_mini'},
{name: '支付宝小程序', type:'alipay_mini'},
{name: '会员支付', type:'vip_pay'},
{name: '现金支付', type:'cash_pay'},
]
const payTypeName = ref(null)
/**
* 获取支付方式
*/
function returnPayType(payType) {
let item = payTypeList.find( v=> v.type == payType )
return item ? item.name : ''
}
function returnStatus(status) {
const item = orderEnum.status.find(v => v.key == status)
return item ? item.label : ''

View File

@@ -60,12 +60,9 @@
</template>
<script setup>
import {
reactive,
ref,
watch
} from 'vue';
import { reactive, ref, watch } from 'vue';
import infoBox from '@/commons/utils/infoBox.js'
const emits = defineEmits(['update:show', 'confirm'])
const props = defineProps({
data: {
type: Object,
@@ -83,7 +80,6 @@
const form = reactive({
note: ''
})
const emits = defineEmits(['update:show', 'confirm'])
let model = ref(null)
let modelShow = ref(props.show)
let number = ref(0)
@@ -101,7 +97,18 @@
checked: false
}])
let timer = null
watch(() => props.show, (newval) => {
modelShow.value = newval
})
watch(() => modelShow.value, (newval) => {
emits('update:show', newval)
if (newval) {
open()
} else {
close()
}
})
function parseIntNumber(val, isNow) {
let newval = val * 1
if (newval > props.data.num) {
@@ -125,18 +132,7 @@
function changeTagSel(item) {
item.checked = !item.checked
}
watch(() => props.show, (newval) => {
modelShow.value = newval
})
watch(() => modelShow.value, (newval) => {
emits('update:show', newval)
if (newval) {
open()
} else {
close()
}
})
function toggleModelShow(show) {
modelShow.value = show ? true : false
}
@@ -165,7 +161,10 @@
})
form.note = ''
}
/**
* 确认退菜
*/
function confirm() {
const selTag = tags.value.filter(item => item.checked).map(item => item.label).join(",")
const note = selTag + (form.note.length > 0 ? "," + form.note : "");
@@ -176,10 +175,17 @@
if (!note) {
return infoBox.showToast("请输入退菜原因");
}
emits('confirm', {
note,
num: number.value
})
let par = {
orderId: props.data.orderId,
refundAmount: number.value*props.data.unitPrice,
refundReason: note,
refundDetails: [{
id: props.data.id,
returnAmount: number.value*props.data.unitPrice,
num: number.value,
}],
}
emits('confirm', par)
}
</script>