Merge branch 'ymf' of https://e.coding.net/g-cphe0354/cashier_front/cashier_admin_app into dev
This commit is contained in:
commit
8e201b7554
|
|
@ -3,16 +3,23 @@
|
|||
<template #desc>
|
||||
<view class="u-text-left u-p-30 color-666">
|
||||
<view class="u-m-t-32 u-flex ">
|
||||
<view class="color-red">*</view>
|
||||
<view class="u-m-l-32">
|
||||
<view class="u-m-l-32" v-if="accountPoints.calcRes.usable">
|
||||
<text class="color-red">*</text>
|
||||
<text class=""
|
||||
v-if="accountPoints.calcRes.equivalentPoints">100积分等于{{to2(accountPoints.calcRes.equivalentPoints*100)}}元,</text>
|
||||
<text>
|
||||
最大抵扣积分{{accountPoints.calcRes.maxUsablePoints}}
|
||||
</text>
|
||||
<text>,
|
||||
最小抵扣积分0
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-40 u-flex ">
|
||||
<view>积分</view>
|
||||
<view class="u-m-l-32 border u-p-l-10 u-p-r-10 u-flex-1">
|
||||
<uni-easyinput type="number" @input="currentPriceInput" @change="currentPriceChange" paddingNone :inputBorder="false"
|
||||
v-model="form.currentPrice"
|
||||
placeholder="输入实际金额"></uni-easyinput>
|
||||
<uni-easyinput type="number" @input="pointsInput" @change="pointsChange" paddingNone
|
||||
:inputBorder="false" v-model="form.points" placeholder="输入积分抵扣数量"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -20,9 +27,9 @@
|
|||
<template #btn>
|
||||
<view class="u-p-30">
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm" shape="circle" fontWeight="700" >修改</my-button>
|
||||
<my-button @tap="confirm" shape="circle" fontWeight="700">修改</my-button>
|
||||
<view class="">
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff" >取消</my-button>
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff">取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -34,7 +41,8 @@
|
|||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref,watch
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
|
|
@ -45,76 +53,68 @@
|
|||
type: String,
|
||||
default: '积分抵扣'
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
discount:{
|
||||
type: [Number,String],
|
||||
default:100
|
||||
accountPoints:{
|
||||
type:Object,
|
||||
default:()=>{
|
||||
return {
|
||||
calcRes:{
|
||||
usable: false,
|
||||
unusableReason: '',
|
||||
minDeductionPoints: 0,
|
||||
maxUsablePoints: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
price: {
|
||||
type: [Number,String],
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
function currentPriceInput(newval){
|
||||
form.discount=(newval*100/form.price).toFixed()
|
||||
}
|
||||
function discountInput(newval){
|
||||
form.currentPrice=(form.price*newval/100).toFixed(2)
|
||||
}
|
||||
function currentPriceChange(newval){
|
||||
if(newval<0){
|
||||
form.currentPrice=0
|
||||
form.discount=100
|
||||
return infoBox.showToast('实收金额不能小于0')
|
||||
}
|
||||
if(newval>props.price){
|
||||
form.currentPrice=props.price
|
||||
form.discount=0
|
||||
return infoBox.showToast('实收金额不能大于应付金额')
|
||||
}
|
||||
}
|
||||
function discountChange(newval){
|
||||
if(newval<0){
|
||||
form.currentPrice=props.price
|
||||
form.discount=0
|
||||
return infoBox.showToast('优惠折扣不能小于0')
|
||||
}
|
||||
if(newval>100){
|
||||
form.discount=100
|
||||
form.currentPrice=0
|
||||
return infoBox.showToast('优惠折扣不能大于100')
|
||||
|
||||
function to2(n) {
|
||||
if (!n) {
|
||||
return ''
|
||||
}
|
||||
return n.toFixed(2)
|
||||
}
|
||||
|
||||
const $form = {
|
||||
price:props.price,
|
||||
currentPrice: props.price,
|
||||
discount: 100
|
||||
function pointsInput(e){
|
||||
setTimeout(()=>{
|
||||
form.points=Math.floor(e)
|
||||
},100)
|
||||
}
|
||||
|
||||
|
||||
function pointsChange(newval) {
|
||||
form.points=Math.floor(newval)
|
||||
if (newval < 0) {
|
||||
form.points = 0
|
||||
return infoBox.showToast('积分抵扣不能小于0')
|
||||
}
|
||||
if (newval > props.accountPoints.calcRes.maxUsablePoints) {
|
||||
form.points = props.price
|
||||
return infoBox.showToast('积分抵扣不能大于'+props.accountPoints.calcRes.maxUsablePoints)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const form = reactive({
|
||||
...$form
|
||||
points: props.price,
|
||||
})
|
||||
watch(()=>props.price,(newval)=>{
|
||||
console.log(newval);
|
||||
form.price=newval
|
||||
form.currentPrice=newval
|
||||
watch(() => props.price, (newval) => {
|
||||
form.points = newval
|
||||
})
|
||||
|
||||
function resetForm() {
|
||||
Object.assign(form, {
|
||||
...$form
|
||||
})
|
||||
form.points=0
|
||||
}
|
||||
|
||||
const model = ref(null)
|
||||
|
||||
function open() {
|
||||
model.value.open()
|
||||
form.price=props.price
|
||||
form.currentPrice=props.price
|
||||
form.discount=props.discount
|
||||
form.points = props.price
|
||||
}
|
||||
|
||||
function close() {
|
||||
|
|
@ -123,8 +123,7 @@
|
|||
const emits = defineEmits(['confirm'])
|
||||
|
||||
function confirm() {
|
||||
console.log(form);
|
||||
emits('confirm',{...form,currentPrice:Number(form.currentPrice).toFixed(2)})
|
||||
emits('confirm',Math.floor(form.points) )
|
||||
close()
|
||||
}
|
||||
defineExpose({
|
||||
|
|
@ -134,11 +133,12 @@
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.border{
|
||||
.border {
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
border-color: #999;
|
||||
}
|
||||
|
||||
.lh34 {
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@
|
|||
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
||||
:price="order.amount"></edit-discount>
|
||||
|
||||
<edit-accountPoints ref="refPoints"></edit-accountPoints>
|
||||
<edit-accountPoints @confirm="pointsConfirm" :price="accountPoints.num" :accountPoints="accountPoints" ref="refPoints"></edit-accountPoints>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -251,6 +251,9 @@
|
|||
},
|
||||
price: 0
|
||||
})
|
||||
function pointsConfirm(e){
|
||||
accountPoints.num=e
|
||||
}
|
||||
async function calcUsablePoints() {
|
||||
if (!order.memberId) {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
|
|||
}
|
||||
}
|
||||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||
const price = item ? (vipUser(vipUser,item) ? memberPrice : item.price) : 0;
|
||||
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
|
||||
const discountAmount = (price * coup.num).toFixed(2)
|
||||
console.log(discountAmount);
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
|
|||
//返回商品实际支付价格
|
||||
export function returnProductPayPrice(goods,vipUser){
|
||||
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
|
||||
const price = (vipUser,item) ? memberPrice : item.price;
|
||||
const price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
|
||||
return price
|
||||
}
|
||||
//返回商品券抵扣的商品价格
|
||||
|
|
|
|||
Loading…
Reference in New Issue