增加券
This commit is contained in:
File diff suppressed because it is too large
Load Diff
195
pagesOrder/pay-order/components/edit-accountPoints.vue
Normal file
195
pagesOrder/pay-order/components/edit-accountPoints.vue
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
<template>
|
||||||
|
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template #btn>
|
||||||
|
<view class="u-p-30">
|
||||||
|
<view class="u-m-t-10">
|
||||||
|
<my-button @tap="confirm" shape="circle" fontWeight="700" >修改</my-button>
|
||||||
|
<view class="">
|
||||||
|
<my-button @tap="close" type="cancel" bgColor="#fff" >取消</my-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</my-model>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
reactive,
|
||||||
|
nextTick,
|
||||||
|
ref,watch
|
||||||
|
} from 'vue';
|
||||||
|
import myModel from '@/components/my-components/my-model.vue'
|
||||||
|
import myButton from '@/components/my-components/my-button.vue'
|
||||||
|
import myTabs from '@/components/my-components/my-tabs.vue'
|
||||||
|
import infoBox from '@/commons/utils/infoBox.js'
|
||||||
|
const props = defineProps({
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '积分抵扣'
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
type: Array,
|
||||||
|
default: []
|
||||||
|
},
|
||||||
|
discount:{
|
||||||
|
type: [Number,String],
|
||||||
|
default:100
|
||||||
|
},
|
||||||
|
price: {
|
||||||
|
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')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const $form = {
|
||||||
|
price:props.price,
|
||||||
|
currentPrice: props.price,
|
||||||
|
discount: 100
|
||||||
|
}
|
||||||
|
const form = reactive({
|
||||||
|
...$form
|
||||||
|
})
|
||||||
|
watch(()=>props.price,(newval)=>{
|
||||||
|
console.log(newval);
|
||||||
|
form.price=newval
|
||||||
|
form.currentPrice=newval
|
||||||
|
})
|
||||||
|
function resetForm() {
|
||||||
|
Object.assign(form, {
|
||||||
|
...$form
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const model = ref(null)
|
||||||
|
|
||||||
|
function open() {
|
||||||
|
model.value.open()
|
||||||
|
form.price=props.price
|
||||||
|
form.currentPrice=props.price
|
||||||
|
form.discount=props.discount
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
model.value.close()
|
||||||
|
}
|
||||||
|
const emits = defineEmits(['confirm'])
|
||||||
|
|
||||||
|
function confirm() {
|
||||||
|
console.log(form);
|
||||||
|
emits('confirm',{...form,currentPrice:Number(form.currentPrice).toFixed(2)})
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
open,
|
||||||
|
close
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.border{
|
||||||
|
border-radius: 8rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
border-color: #999;
|
||||||
|
}
|
||||||
|
.lh34 {
|
||||||
|
line-height: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #E5E5E5;
|
||||||
|
line-height: inherit;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
padding: 6rpx 20rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
border-color: #E6F0FF;
|
||||||
|
color: $my-main-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hover-class {
|
||||||
|
background-color: #E5E5E5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discount {
|
||||||
|
.u-absolute {
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg1 {
|
||||||
|
background: #F7F7FA;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab {
|
||||||
|
padding: 0 80rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border {
|
||||||
|
border: 1px solid #E5E5E5;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-box {
|
||||||
|
padding: 22rpx 32rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placeholder-class {
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,17 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="bg-gray min-page u-p-30 u-font-28">
|
<view class="bg-gray min-page u-p-30 u-font-28">
|
||||||
<view class="u-p-t-60 u-p-b-60 u-text-center">
|
<view class="u-p-t-60 u-p-b-60 u-text-center">
|
||||||
<view class="u-font-32 ">
|
<template v-if="order.amount!=payPrice">
|
||||||
<text class="price-fuhao">¥</text>
|
<view class="u-font-32 ">
|
||||||
<text class="font-bold price">{{discount.currentPrice?discount.currentPrice:order.amount}}</text>
|
<text class="price-fuhao">¥</text>
|
||||||
</view>
|
<!-- <text class="font-bold price">{{discount.currentPrice?discount.currentPrice:order.amount}}</text> -->
|
||||||
<view class="u-m-t-10 color-999 old-price">
|
<text class="font-bold price">{{payPrice}}</text>
|
||||||
<text class="">¥</text>
|
</view>
|
||||||
<text class=" ">{{order.amount}}</text>
|
<view class="u-m-t-10 color-999 old-price">
|
||||||
</view>
|
<text class="">¥</text>
|
||||||
<view class="u-m-t-10 u-flex u-row-center color-main">
|
<text class=" ">{{order.amount}}</text>
|
||||||
<view @click="discountShow">修改</view>
|
</view>
|
||||||
</view>
|
<view class="u-m-t-10 u-flex u-row-center color-main">
|
||||||
|
<view @click="discountShow">修改</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="u-font-32 ">
|
||||||
|
<text class="price-fuhao">¥</text>
|
||||||
|
<text class="font-bold price">{{order.amount}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-10 u-flex u-row-center color-main">
|
||||||
|
<view @click="discountShow">修改</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="content bg-fff border-r-12">
|
<view class="content bg-fff border-r-12">
|
||||||
<view class=" u-p-t-30 u-p-l-26 u-p-r-26 card top u-m-t-30">
|
<view class=" u-p-t-30 u-p-l-26 u-p-r-26 card top u-m-t-30">
|
||||||
@@ -26,7 +39,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-24" v-if="pays.quan.length>0">
|
<view class="u-m-t-24" v-if="pays.quan.length>0">
|
||||||
<view class="u-flex u-p-l-24 u-p-r-24 u-m-t-24 u-row-between " v-for="(item,index) in pays.quan" :key="index">
|
<view class="u-flex u-p-l-24 u-p-r-24 u-m-t-24 u-row-between "
|
||||||
|
v-for="(item,index) in pays.quan" :key="index">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view class="hui">减</view>
|
<view class="hui">减</view>
|
||||||
<view class="u-m-l-18">{{item.name}}</view>
|
<view class="u-m-l-18">{{item.name}}</view>
|
||||||
@@ -36,17 +50,26 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="border-bottom u-p-b-30">
|
||||||
<view class="u-flex u-p-l-24 u-p-r-24 border-bottom u-row-between u-p-t-30 u-p-b-30"
|
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
|
||||||
v-if="discount.price&&discount.currentPrice!=order.amount">
|
v-if="discount.price&&discount.currentPrice!=order.amount">
|
||||||
<view>服务员改价</view>
|
<view>服务员改价</view>
|
||||||
<view class=" u-flex u-col-center">
|
<view class=" u-flex u-col-center">
|
||||||
<text style="color: rgb(255, 95, 46);">-¥{{to2(order.amount- discount.currentPrice)}}</text>
|
<text style="color: rgb(255, 95, 46);">-¥{{to2(order.amount- discount.currentPrice)}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
|
||||||
|
v-if="accountPoints.price">
|
||||||
|
<view>积分抵扣</view>
|
||||||
|
<view class=" u-flex u-col-center">
|
||||||
|
<text style="color: rgb(255, 95, 46);">-¥{{to2(accountPoints.price)}}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="bg-fff border-r-12 ">
|
<view class="bg-fff border-r-12 ">
|
||||||
<view class="u-p-t-30 u-p-l-50 u-p-r-50 card bottom">
|
<view class="u-p-t-30 u-p-l-50 u-p-r-50 card bottom">
|
||||||
@@ -70,6 +93,10 @@
|
|||||||
<text>余额:</text>
|
<text>余额:</text>
|
||||||
<text>¥{{user.amount||'0'}}</text>
|
<text>¥{{user.amount||'0'}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- <view>
|
||||||
|
<text>积分:</text>
|
||||||
|
<text>{{user.accountPoints||'0'}}</text>
|
||||||
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<my-radio @click="changePayType(index,item)"
|
<my-radio @click="changePayType(index,item)"
|
||||||
:modelValue="index==pays.payTypes.selIndex">
|
:modelValue="index==pays.payTypes.selIndex">
|
||||||
@@ -78,6 +105,51 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="border-bottom-dashed "></view>
|
||||||
|
<view class="u-flex u-row-between u-p-t-24" v-if="user.id&&user.accountPoints"
|
||||||
|
@click="changeAccountPoints">
|
||||||
|
<view class="u-flex ">
|
||||||
|
<view class="">积分抵扣</view>
|
||||||
|
<view class="color-999 u-m-l-10">
|
||||||
|
<text>(</text>
|
||||||
|
<text>{{user.accountPoints||'0'}}</text>
|
||||||
|
<text>)</text>
|
||||||
|
</view>
|
||||||
|
<!-- <view><text class="color-red font-bold">{{accountPoints.price}}</text>元</view> -->
|
||||||
|
</view>
|
||||||
|
<view class="u-flex">
|
||||||
|
|
||||||
|
<view class="u-flex" @click.stop="refPointsOpen">
|
||||||
|
<view><text>{{accountPoints.num}}</text></view>
|
||||||
|
<view v-if="accountPoints.calcRes.usable">
|
||||||
|
<up-icon name="edit-pen" size="16" color="#999"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-m-l-32 u-relative" v-if="accountPoints.calcRes.usable" >
|
||||||
|
<view class="u-absolute position-all"></view>
|
||||||
|
<my-radio
|
||||||
|
:modelValue="accountPoints.sel">
|
||||||
|
</my-radio>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="color-999 u-font-24 u-m-t-16" >
|
||||||
|
<view class="" v-if="accountPoints.calcRes.unusableReason">
|
||||||
|
<text class="color-red">*</text>
|
||||||
|
<text >{{accountPoints.calcRes.unusableReason}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="" 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-60 u-p-b-30">
|
<view class="u-m-t-60 u-p-b-30">
|
||||||
<my-button @click="payOrderClick">确认付款</my-button>
|
<my-button @click="payOrderClick">确认付款</my-button>
|
||||||
</view>
|
</view>
|
||||||
@@ -122,6 +194,8 @@
|
|||||||
|
|
||||||
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
||||||
:price="order.amount"></edit-discount>
|
:price="order.amount"></edit-discount>
|
||||||
|
|
||||||
|
<edit-accountPoints ref="refPoints"></edit-accountPoints>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -131,41 +205,108 @@
|
|||||||
onMounted,
|
onMounted,
|
||||||
watch,
|
watch,
|
||||||
ref,
|
ref,
|
||||||
onBeforeUnmount
|
onBeforeUnmount,
|
||||||
|
computed
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
onBackPress,onShow
|
onBackPress,
|
||||||
|
onShow
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
import go from '@/commons/utils/go.js'
|
import go from '@/commons/utils/go.js'
|
||||||
import * as Api from '@/http/yskApi/Instead.js'
|
import * as Api from '@/http/yskApi/Instead.js'
|
||||||
import {
|
import {
|
||||||
queryAllShopUser
|
queryAllShopUser
|
||||||
} from '@/http/yskApi/shop-user.js'
|
} from '@/http/yskApi/shop-user.js'
|
||||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
import {
|
||||||
|
hasPermission
|
||||||
|
} from '@/commons/utils/hasPermission.js'
|
||||||
import * as orderApi from '@/http/yskApi/order.js'
|
import * as orderApi from '@/http/yskApi/order.js'
|
||||||
import infoBox from '@/commons/utils/infoBox.js'
|
import infoBox from '@/commons/utils/infoBox.js'
|
||||||
import editDiscount from '@/components/my-components/edit-discount.vue'
|
import editDiscount from '@/components/my-components/edit-discount.vue'
|
||||||
function toQuan(){
|
import editAccountPoints from './components/edit-accountPoints.vue'
|
||||||
|
|
||||||
|
const refPoints=ref(null)
|
||||||
|
function refPointsOpen(){
|
||||||
|
if(!accountPoints.calcRes.usable&&accountPoints.sel){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
refPoints.value.open()
|
||||||
|
}
|
||||||
|
const accountPoints = reactive({
|
||||||
|
sel: false,
|
||||||
|
num: 0,
|
||||||
|
calcRes:{
|
||||||
|
usable:false,
|
||||||
|
unusableReason:'',
|
||||||
|
minDeductionPoints:0,
|
||||||
|
maxUsablePoints:0
|
||||||
|
},
|
||||||
|
price:0
|
||||||
|
})
|
||||||
|
async function calcUsablePoints(){
|
||||||
|
const res=await Api.$calcUsablePoints({
|
||||||
|
memberId:order.memberId,
|
||||||
|
orderAmount:order.amount
|
||||||
|
})
|
||||||
|
accountPoints.calcRes=res
|
||||||
|
accountPoints.num=res.maxUsablePoints
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
watch(()=>accountPoints.sel,(newval)=>{
|
||||||
|
if(newval){
|
||||||
|
calcUsablePoints()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
async function calcDeDuctionPoints(){
|
||||||
|
const res=await Api.$calcDeDuctionPoints({
|
||||||
|
memberId: order.memberId,
|
||||||
|
orderAmount: order.amount,
|
||||||
|
points: accountPoints.num
|
||||||
|
})
|
||||||
|
accountPoints.price=res
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
watch(()=>accountPoints.num,(newval)=>{
|
||||||
|
if(!newval){
|
||||||
|
accountPoints.price=0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
calcDeDuctionPoints()
|
||||||
|
})
|
||||||
|
|
||||||
|
function changeAccountPoints() {
|
||||||
|
if(!accountPoints.calcRes.usable){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
accountPoints.sel = !accountPoints.sel
|
||||||
|
if (!accountPoints.sel) {
|
||||||
|
accountPoints.num = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toQuan() {
|
||||||
console.log(order);
|
console.log(order);
|
||||||
if(!order.memberId){
|
if (!order.memberId) {
|
||||||
return infoBox.showToast('请先选择会员',0.5).then(()=>{
|
return infoBox.showToast('请先选择会员', 0.5).then(() => {
|
||||||
chooseUser()
|
chooseUser()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
go.to('PAGES_ORDER_QUAN',{
|
go.to('PAGES_ORDER_QUAN', {
|
||||||
orderId:order.id,
|
orderId: order.id,
|
||||||
memberId:order.memberId
|
memberId: order.memberId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
async function discountShow(){
|
async function discountShow() {
|
||||||
const bol=await hasPermission('yun_xu_da_zhe')
|
const bol = await hasPermission('yun_xu_da_zhe')
|
||||||
if(bol){
|
if (bol) {
|
||||||
showModel('editMoney',true)
|
showModel('editMoney', true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let option = {isNowPay:false}
|
let option = {
|
||||||
let payFinish=ref(false)
|
isNowPay: false
|
||||||
|
}
|
||||||
|
let payFinish = ref(false)
|
||||||
onBackPress(() => {
|
onBackPress(() => {
|
||||||
uni.$emit('orderDetail:update')
|
uni.$emit('orderDetail:update')
|
||||||
console.log('onBackPress');
|
console.log('onBackPress');
|
||||||
@@ -202,18 +343,18 @@
|
|||||||
list: [],
|
list: [],
|
||||||
selIndex: 0
|
selIndex: 0
|
||||||
},
|
},
|
||||||
quan:[]
|
quan: []
|
||||||
})
|
})
|
||||||
|
|
||||||
function chooseUser() {
|
function chooseUser() {
|
||||||
go.to('PAGES_CHOOSE_USER')
|
go.to('PAGES_CHOOSE_USER')
|
||||||
}
|
}
|
||||||
//更新选择用户
|
//更新选择用户
|
||||||
function setUser(par) {
|
function setUser(par) {
|
||||||
console.log(option);
|
console.log(option);
|
||||||
const submitPar = {
|
const submitPar = {
|
||||||
tableId: order.tableId,
|
tableId: order.tableId,
|
||||||
orderId:order.id,
|
orderId: order.id,
|
||||||
masterId: order.masterId,
|
masterId: order.masterId,
|
||||||
vipUserId: user.value.id ? user.value.id : '',
|
vipUserId: user.value.id ? user.value.id : '',
|
||||||
type: user.value.id ? 0 : 1 //0 设置 1 取消
|
type: user.value.id ? 0 : 1 //0 设置 1 取消
|
||||||
@@ -221,29 +362,31 @@
|
|||||||
Object.assign(submitPar, par)
|
Object.assign(submitPar, par)
|
||||||
return Api.$setUser(submitPar)
|
return Api.$setUser(submitPar)
|
||||||
}
|
}
|
||||||
|
|
||||||
function watchChooseuser() {
|
function watchChooseuser() {
|
||||||
uni.$off('choose-user')
|
uni.$off('choose-user')
|
||||||
uni.$on('choose-user', (data) => {
|
uni.$on('choose-user', (data) => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
setUser({
|
setUser({
|
||||||
vipUserId: data.id ? data.id : '',
|
vipUserId: data.id ? data.id : '',
|
||||||
type: data.id ? 0 : 1 //0 设置 1 取消
|
type: data.id ? 0 : 1 //0 设置 1 取消
|
||||||
}).then(res=>{
|
}).then(res => {
|
||||||
user.value = data
|
user.value = data
|
||||||
order.memberId=data.id
|
order.memberId = data.id
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function watchChooseQuan() {
|
function watchChooseQuan() {
|
||||||
uni.$off('choose-quan')
|
uni.$off('choose-quan')
|
||||||
uni.$on('choose-quan', (arr) => {
|
uni.$on('choose-quan', (arr) => {
|
||||||
console.log(arr);
|
console.log(arr);
|
||||||
pays.quan=arr
|
pays.quan = arr
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow(()=>{
|
onShow(() => {
|
||||||
watchChooseuser()
|
watchChooseuser()
|
||||||
watchChooseQuan()
|
watchChooseQuan()
|
||||||
})
|
})
|
||||||
@@ -281,12 +424,22 @@
|
|||||||
const discount = reactive({
|
const discount = reactive({
|
||||||
|
|
||||||
})
|
})
|
||||||
|
const coupAllPrice=computed(()=>{
|
||||||
|
return pays.quan.reduce((prve,cur)=>{
|
||||||
|
return prve+cur.discountAmount*1
|
||||||
|
},0)
|
||||||
|
})
|
||||||
|
const payPrice=computed(()=>{
|
||||||
|
const discountPrice=discount.currentPrice?discount.currentPrice:order.amount
|
||||||
|
const calcPrice=discountPrice-coupAllPrice.value-accountPoints.price*(accountPoints.sel?1:0)
|
||||||
|
return (calcPrice<=0?0:calcPrice).toFixed(2)
|
||||||
|
})
|
||||||
function editDiscountConfirm(form) {
|
function editDiscountConfirm(form) {
|
||||||
console.log(form);
|
console.log(form);
|
||||||
Object.assign(discount, form)
|
Object.assign(discount, form)
|
||||||
getPayUrl()
|
getPayUrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getPayType() {
|
async function getPayType() {
|
||||||
const payTypeList = await Api.$getPayType()
|
const payTypeList = await Api.$getPayType()
|
||||||
pays.payTypes.list = payTypeList
|
pays.payTypes.list = payTypeList
|
||||||
@@ -294,8 +447,8 @@
|
|||||||
|
|
||||||
function changePayType(i, item) {
|
function changePayType(i, item) {
|
||||||
pays.payTypes.selIndex = i
|
pays.payTypes.selIndex = i
|
||||||
if (item.payType == 'vipPay' ) {
|
if (item.payType == 'vipPay') {
|
||||||
chooseUser()
|
chooseUser()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//支付成功回调
|
//支付成功回调
|
||||||
@@ -303,7 +456,7 @@
|
|||||||
infoBox.showToast('支付成功')
|
infoBox.showToast('支付成功')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// uni.$emit('orderDetail:update')
|
// uni.$emit('orderDetail:update')
|
||||||
payFinish.value=true
|
payFinish.value = true
|
||||||
uni.$emit('get:table')
|
uni.$emit('get:table')
|
||||||
uni.$emit('update:orderDetail')
|
uni.$emit('update:orderDetail')
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
@@ -323,8 +476,8 @@
|
|||||||
async function payOrder() {
|
async function payOrder() {
|
||||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||||
if (payType == 'vipPay' && user.value.amount * 1 < order.amount * 1) {
|
if (payType == 'vipPay' && user.value.amount * 1 < order.amount * 1) {
|
||||||
infoBox.showToast('余额不足')
|
infoBox.showToast('余额不足')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await Api.$payOrder({
|
await Api.$payOrder({
|
||||||
tableId: order.tableId,
|
tableId: order.tableId,
|
||||||
@@ -385,11 +538,12 @@
|
|||||||
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
|
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
|
||||||
Object.assign(order, orderRes)
|
Object.assign(order, orderRes)
|
||||||
if (orderRes.memberId) {
|
if (orderRes.memberId) {
|
||||||
|
calcUsablePoints()
|
||||||
queryAllShopUser({
|
queryAllShopUser({
|
||||||
id: orderRes.memberId
|
id: orderRes.memberId
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if(res.content[0]){
|
if (res.content[0]) {
|
||||||
user.value =res.content[0]
|
user.value = res.content[0]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -420,14 +574,16 @@
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
$quan-color: #318AFE;
|
$quan-color: #318AFE;
|
||||||
|
|
||||||
.hui {
|
.hui {
|
||||||
// background-color: $quan-color;
|
// background-color: $quan-color;
|
||||||
background-image: linear-gradient(to right bottom,rgb(254,103,4),rgb(241,50,42));
|
background-image: linear-gradient(to right bottom, rgb(254, 103, 4), rgb(241, 50, 42));
|
||||||
padding: 4rpx 10rpx;
|
padding: 4rpx 10rpx;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.box-shadow {
|
.box-shadow {
|
||||||
box-shadow: 0 0 5px #E5E5E5;
|
box-shadow: 0 0 5px #E5E5E5;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,12 +108,16 @@
|
|||||||
onLoad,
|
onLoad,
|
||||||
onReady
|
onReady
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
|
import * as orderApi from '@/http/yskApi/order.js'
|
||||||
import {
|
import {
|
||||||
$activateByOrderId
|
$activateByOrderId
|
||||||
} from '@/http/yskApi/Instead.js'
|
} from '@/http/yskApi/Instead.js'
|
||||||
function back(){
|
function back(){
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}
|
}
|
||||||
|
let order=ref({
|
||||||
|
|
||||||
|
})
|
||||||
const myQuan = reactive({
|
const myQuan = reactive({
|
||||||
fullReductionCouponSel: {
|
fullReductionCouponSel: {
|
||||||
id: ''
|
id: ''
|
||||||
@@ -146,8 +150,10 @@
|
|||||||
function toUse(item) {
|
function toUse(item) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getQuan() {
|
async function getQuan() {
|
||||||
|
order.value=await orderApi.tbOrderInfoDetail(option.orderId)
|
||||||
|
console.log(order.value);
|
||||||
const res = await $activateByOrderId(option)
|
const res = await $activateByOrderId(option)
|
||||||
res.fullReductionCoupon = res.fullReductionCoupon.filter((v) => !v.use)
|
res.fullReductionCoupon = res.fullReductionCoupon.filter((v) => !v.use)
|
||||||
res.productCoupon = res.productCoupon.filter((v) => !v.use).map(v => {
|
res.productCoupon = res.productCoupon.filter((v) => !v.use).map(v => {
|
||||||
@@ -162,6 +168,7 @@
|
|||||||
const option = reactive({
|
const option = reactive({
|
||||||
orderId: '',
|
orderId: '',
|
||||||
memberId: '',
|
memberId: '',
|
||||||
|
payPrice:''
|
||||||
})
|
})
|
||||||
|
|
||||||
function toEmitChooseQuan(item){
|
function toEmitChooseQuan(item){
|
||||||
|
|||||||
Reference in New Issue
Block a user