会员,充值,明细,下单问题修复
This commit is contained in:
@@ -92,3 +92,6 @@ page,
|
||||
.u-flex-1{
|
||||
flex:1;
|
||||
}
|
||||
.u-col-center{
|
||||
align-items: center;
|
||||
}
|
||||
128
components/coupon/coupon-icon.vue
Normal file
128
components/coupon/coupon-icon.vue
Normal file
@@ -0,0 +1,128 @@
|
||||
<!-- 优惠券图标 -->
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="icon icon1" v-if="props.item.couponType == 1">
|
||||
<view class="top">
|
||||
<text class="i">¥</text>
|
||||
<text class="num">{{ props.item.discountAmount }}</text>
|
||||
</view>
|
||||
<view class="intro">
|
||||
<text class="t">满{{ props.item.fullAmount }}可用</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="icon icon2" v-if="props.item.couponType == 2">
|
||||
<view class="top">
|
||||
<text class="i">{{ props.item.discountNum }}件</text>
|
||||
<text class="num">商品兑换</text>
|
||||
</view>
|
||||
<view class="intro">
|
||||
<text class="t">满{{ props.item.fullAmount }}可用</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="icon icon3" v-if="props.item.couponType == 3">
|
||||
<view class="top">
|
||||
<text class="num">{{ props.item.discountRate }}折</text>
|
||||
</view>
|
||||
<view class="intro">
|
||||
<text class="t">满{{ props.item.fullAmount }}可用</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="icon icon2" v-if="props.item.couponType == 4">
|
||||
<view class="top">
|
||||
<text class="i">第二件</text>
|
||||
<text class="num">半价券</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="icon icon2" v-if="props.item.couponType == 6">
|
||||
<view class="top">
|
||||
<text class="i">买一送</text>
|
||||
<text class="num">一券</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
$color: #ff1c1c;
|
||||
.container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
.icon {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
&.icon1 {
|
||||
.top {
|
||||
.i {
|
||||
color: $color;
|
||||
font-size: 24upx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.num {
|
||||
color: $color;
|
||||
font-size: 72upx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.icon2 {
|
||||
.top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.i {
|
||||
color: $color;
|
||||
font-size: 34upx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.num {
|
||||
color: $color;
|
||||
font-size: 34upx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.icon3 {
|
||||
.top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.i {
|
||||
color: $color;
|
||||
font-size: 34upx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.num {
|
||||
color: $color;
|
||||
font-size: 52upx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.intro {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
.t {
|
||||
font-size: 22upx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
82
components/coupon/list.vue
Normal file
82
components/coupon/list.vue
Normal file
@@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<view>
|
||||
<up-popup :show="show" mode="center" round="16rpx" close-on-click-overlay @close="close">
|
||||
<view class="model-box">
|
||||
<view class="u-flex u-flex-between">
|
||||
<view class="">
|
||||
<text class="color-333 font-16">查看优惠券</text>
|
||||
<text class="color-666 font-14">({{list.length}})张</text>
|
||||
</view>
|
||||
<up-icon name="close-circle" color="#666" size="28rpx" @click="close"></up-icon>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" class="u-m-t-42" style="max-height: 50vh;">
|
||||
<view class="list">
|
||||
<view class="item u-flex u-m-b-32 u-col-center" v-for="(item,index) in list" :key="index">
|
||||
<view class="left">
|
||||
<couponIcon :item="item.coupon" />
|
||||
<!-- <view class="red font-16 font-700" style="width: 122rpx;">第二件半价券</view> -->
|
||||
<view></view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex-1 u-p-l-26 ">
|
||||
<view class="color-333 font-16">
|
||||
{{item.coupon.title }}
|
||||
</view>
|
||||
<view class="color-999 font-12 u-m-t-8">
|
||||
有效期至:{{item.coupon.validEndTime||''}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import dayjs from 'dayjs';
|
||||
import couponIcon from './coupon-icon.vue'
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
})
|
||||
const show = defineModel(false)
|
||||
|
||||
function close() {
|
||||
show.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.model-box {
|
||||
width: 660rpx;
|
||||
padding: 28rpx 48rpx;
|
||||
}
|
||||
|
||||
.list {
|
||||
.item {
|
||||
padding: 32rpx 32rpx 32rpx 16rpx;
|
||||
border-radius: 36rpx;
|
||||
background: #F8F8F8;
|
||||
|
||||
.left {
|
||||
padding-right: 24rpx;
|
||||
border-right: 1px solid #EDEDED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.red {
|
||||
color: #FF1C1C;
|
||||
}
|
||||
</style>
|
||||
@@ -7,7 +7,7 @@
|
||||
</view>
|
||||
<scroll-view scroll-x="true" class="u-m-t-20">
|
||||
<view class="list">
|
||||
<view class="item color1" @click="itemClick" v-for="(item,index) in list" :key="index"
|
||||
<view class="item color1" @click="itemClick(index)" v-for="(item,index) in list" :key="index"
|
||||
:class="{active:sel==index}">
|
||||
<view class="">
|
||||
<text>¥</text>
|
||||
@@ -26,9 +26,9 @@
|
||||
</view>
|
||||
<view class="font-12 color-666" v-if="item.couponInfoList.length">
|
||||
<text>送</text>
|
||||
<text>{{item.couponInfoList.length}}</text>
|
||||
<text>{{couponNum(item.couponInfoList)}}</text>
|
||||
<text>张券</text>
|
||||
<text class="color2 u-m-l-8" v-if="sel==index">查看</text>
|
||||
<text class="color2 u-m-l-8" v-if="sel==index" @click="lookCoupon(item)">查看</text>
|
||||
</view>
|
||||
|
||||
<view class="sel u-flex" v-if="sel==index">
|
||||
@@ -40,21 +40,39 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="" v-else></view>
|
||||
<CouponList v-model="couponModel.show" :list="couponModel.couponInfoList"></CouponList>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import CouponList from '@/components/coupon/list.vue'
|
||||
import * as rechargeApi from '@/common/api/market/recharge.js'
|
||||
import {
|
||||
useCartsStore
|
||||
} from '@/stores/carts.js';
|
||||
const cartStore = useCartsStore()
|
||||
import {
|
||||
onMounted,
|
||||
onMounted,reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
const couponModel = reactive({
|
||||
show: false,
|
||||
couponInfoList: []
|
||||
})
|
||||
|
||||
function lookCoupon(item) {
|
||||
couponModel.couponInfoList = item.couponInfoList
|
||||
couponModel.show = true
|
||||
}
|
||||
|
||||
function couponNum(list) {
|
||||
return list.reduce((prve, cur) => {
|
||||
return prve + cur.num
|
||||
}, 0)
|
||||
}
|
||||
const cartStore = useCartsStore()
|
||||
|
||||
const list = ref([])
|
||||
const sel = ref(-1)
|
||||
const isShow = ref(false)
|
||||
@@ -82,19 +100,25 @@
|
||||
updateSel()
|
||||
}
|
||||
})
|
||||
|
||||
const emits=defineEmits(['updateChargeSel','updateRechargeId'])
|
||||
function updateSel(){
|
||||
const selItem=list.value[sel.value]
|
||||
emits('updateChargeSel',selItem?selItem:{})
|
||||
emits('updateRechargeId',data.id)
|
||||
}
|
||||
function itemClick(index){
|
||||
|
||||
console.log('itemClick',sel.value,index);
|
||||
if(sel.value==-1){
|
||||
sel.value=index
|
||||
return
|
||||
}
|
||||
if(sel.value==index){
|
||||
sel.value=-1
|
||||
return
|
||||
}
|
||||
sel.value=index
|
||||
}
|
||||
const emits=defineEmits(['updateChargeSel'])
|
||||
watch(()=>sel.value,(newval)=>{
|
||||
updateSel()
|
||||
})
|
||||
@@ -104,8 +128,14 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.color1{
|
||||
color: #5F2E0F;
|
||||
}
|
||||
.color2{
|
||||
color: #FF6300;
|
||||
}
|
||||
.box {
|
||||
background: linear-gradient(179.4deg, #f8eadc 0%, #fdf9f6 82%, #ffffff 100%);
|
||||
background-color: #fdf9f6;
|
||||
padding: 30rpx;
|
||||
margin-top: 32rpx;
|
||||
border-radius: 22rpx;
|
||||
@@ -125,7 +155,7 @@
|
||||
.item {
|
||||
padding: 36rpx 22rpx;
|
||||
border-radius: 42rpx;
|
||||
background: linear-gradient(180deg, #F5F5F5 58.54%, #FFF 140.47%);
|
||||
background: linear-gradient(180deg, #F5F5F5 58.54%, #FFF 104.47%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
@@ -88,8 +88,7 @@
|
||||
|
||||
|
||||
<!-- isTableFee == 0是不免除 -->
|
||||
<view class="cell-item"
|
||||
v-if="cartStore.orderCostSummary.seatFee">
|
||||
<view class="cell-item" v-if="cartStore.orderCostSummary.seatFee">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{cartStore.seatFeeConfig.personCount}}</view>
|
||||
@@ -117,13 +116,18 @@
|
||||
<u-image bgColor="#fff" :width="item.width||'44rpx'" :height="item.height||'44rpx'"
|
||||
v-if="item.icon" :src="item.icon" mode=""></u-image>
|
||||
</view>
|
||||
<text class="name u-m-l-16"> {{ item.name }} </text>
|
||||
<text class="name u-m-l-16 no-wrap"> {{ item.name }} </text>
|
||||
<text class="font-12" style="color: #666;margin-right: 16rpx;" v-if="item.type=='points'">
|
||||
「可用积分{{pointsRes.accountPoints}},最大可抵扣{{maxPointDiscount}}元」
|
||||
|
||||
</text>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 优惠卷 -->
|
||||
<view class="favorable_right" v-if="item.type=='coupon'">
|
||||
<text class="favorable_right_text red" v-if="returnCouponDiscount>0">-¥{{returnCouponDiscount}}</text>
|
||||
<text class="favorable_right_text red"
|
||||
v-if="returnCouponDiscount>0">-¥{{returnCouponDiscount}}</text>
|
||||
<up-icon name="arrow-right" color="#575B66" size="16"
|
||||
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'||!listinfo.id"></up-icon>
|
||||
|
||||
@@ -131,19 +135,31 @@
|
||||
|
||||
<!-- 新客立减 -->
|
||||
<view class="favorable_right" v-if="item.type=='newUser'">
|
||||
<text class="favorable_right_text red" v-if="newUserDiscount>0">-¥{{newUserDiscount}}</text>
|
||||
<text class="favorable_right_text red"
|
||||
v-if="newUserDiscount>0">-¥{{newUserDiscount}}</text>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 积分 -->
|
||||
<view class="favorable_right" v-if="item.type=='points'">
|
||||
<view class="favorable_right u-flex u-col-center" v-if="item.type=='points'">
|
||||
<up-icon name="checkmark-circle-fill" size="24rpx" v-if="usePoints"
|
||||
color="#FE7E00"></up-icon>
|
||||
<text v-if="usePoints" class="red">
|
||||
-¥{{cartStore.orderCostSummary.pointDeductionAmount}}
|
||||
</text>
|
||||
<view v-else class="u-flex u-col-center">
|
||||
<view class="round"></view>
|
||||
<text class="color-333 font-12 no-wrap">使用抵扣</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="favorable_right" v-if="item.type=='points'">
|
||||
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;"
|
||||
v-if="calcUsablePointsData.integral">
|
||||
使用 {{ calcUsablePointsData.integral}}
|
||||
积分抵扣¥{{props.listinfo.pointsDiscountAmount}}
|
||||
</text>
|
||||
<up-icon v-else name="arrow-right" color="#575B66" size="16"></up-icon>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@@ -247,6 +263,12 @@
|
||||
|
||||
} from 'vue'
|
||||
|
||||
const usePoints = ref(false)
|
||||
|
||||
function chnageIsUsePoints() {
|
||||
usePoints.value = !usePoints.value
|
||||
}
|
||||
|
||||
import IntegralInput from './IntegralInput.vue';
|
||||
import {
|
||||
APImemberPointsmyPoints,
|
||||
@@ -278,8 +300,7 @@
|
||||
},
|
||||
])
|
||||
|
||||
const favorablelist = reactive([
|
||||
{
|
||||
const favorablelist = reactive([{
|
||||
name: "新客立减",
|
||||
type: "newUser",
|
||||
width: '40rpx',
|
||||
@@ -374,12 +395,12 @@
|
||||
}
|
||||
|
||||
const returnCouponDiscount = computed(() => {
|
||||
if(!favorablelist[1].value){
|
||||
if (!favorablelist[1].value) {
|
||||
return 0
|
||||
}
|
||||
return favorablelist[1].value.reduce((prve,cur)=>{
|
||||
return prve+(cur.discountAmount||0)
|
||||
},0)
|
||||
return favorablelist[1].value.reduce((prve, cur) => {
|
||||
return prve + (cur.discountAmount || 0)
|
||||
}, 0)
|
||||
})
|
||||
|
||||
// 清空
|
||||
@@ -428,6 +449,8 @@
|
||||
break;
|
||||
|
||||
case 'points':
|
||||
chnageIsUsePoints()
|
||||
return
|
||||
IntegralInputclose()
|
||||
if (calcUsablePointsData.usable == 0) {
|
||||
uni.showToast({
|
||||
@@ -453,14 +476,47 @@
|
||||
})
|
||||
|
||||
|
||||
const pointsRes = reactive({
|
||||
accountPoints: 0
|
||||
})
|
||||
getMaxPointsDiscount()
|
||||
const maxPointDiscount=ref(0)
|
||||
async function getMaxPointsDiscount() {
|
||||
//积分可抵扣最大金额
|
||||
const maxMoney = cartStore.orderCostSummary.goodsRealAmount - cartStore.orderCostSummary
|
||||
.couponDeductionAmount
|
||||
let res = await APImemberPointscalcUsablePoints({
|
||||
shopUserId: props.orderVIP.id,
|
||||
orderAmount: maxMoney
|
||||
})
|
||||
console.log(res);
|
||||
Object.assign(pointsRes, res)
|
||||
const maxUsablePoints = res.maxUsablePoints
|
||||
maxPointDiscount.value=res.maxDeductionAmount
|
||||
// props.listinfo.pointsDiscountAmount = await APImemberPointscalcDeductionAmount({
|
||||
// points: maxUsablePoints,
|
||||
// shopUserId: props.orderVIP.id,
|
||||
// orderAmount: maxMoney
|
||||
// })
|
||||
cartStore.setUserPoints(maxUsablePoints)
|
||||
}
|
||||
watch(() => usePoints.value, (newval) => {
|
||||
if (newval) {
|
||||
getMaxPointsDiscount()
|
||||
} else {
|
||||
cartStore.setUserPoints(0)
|
||||
}
|
||||
})
|
||||
|
||||
const handleConfirm = async (integral) => {
|
||||
//积分可抵扣最大金额
|
||||
const maxMoney= cartStore.orderCostSummary.goodsRealAmount-cartStore.orderCostSummary.couponDeductionAmount
|
||||
const maxMoney = cartStore.orderCostSummary.goodsRealAmount - cartStore.orderCostSummary
|
||||
.couponDeductionAmount
|
||||
calcUsablePointsData.integral = integral
|
||||
props.listinfo.pointsDiscountAmount = await APImemberPointscalcDeductionAmount({
|
||||
points: integral,
|
||||
shopUserId: props.orderVIP.id,
|
||||
orderAmount:maxMoney
|
||||
orderAmount: maxMoney
|
||||
})
|
||||
cartStore.setUserPoints(integral)
|
||||
emits('clickPointsamount', {
|
||||
@@ -473,7 +529,7 @@
|
||||
const getCalcUsablePoints = async (data) => {
|
||||
Object.assign(calcUsablePointsData, data);
|
||||
try {
|
||||
cartStore.setPointDeductionRule(data.equivalentPoints,data.maxDeductionAmount)
|
||||
cartStore.setPointDeductionRule(data.equivalentPoints, data.maxDeductionAmount)
|
||||
calcUsablePointsData.minIntegral = data.minDeductionPoints
|
||||
calcUsablePointsData.maxIntegral = data.maxUsablePoints
|
||||
calcUsablePointsData.instructionText =
|
||||
@@ -514,18 +570,19 @@
|
||||
IntegralInputclose
|
||||
});
|
||||
|
||||
watch(()=>props.listinfo.seatNum,(newval)=>{
|
||||
cartStore.setSeatFeeConfig('personCount',newval||1)
|
||||
watch(() => props.listinfo.seatNum, (newval) => {
|
||||
cartStore.setSeatFeeConfig('personCount', newval || 1)
|
||||
})
|
||||
|
||||
const newUserDiscount=ref(0)
|
||||
async function getConsumeDiscount(){
|
||||
const newUserDiscount = ref(0)
|
||||
async function getConsumeDiscount() {
|
||||
const consumeDiscountRes = await consumeDiscount({
|
||||
shopId: uni.cache.get('shopId'),
|
||||
})
|
||||
if(consumeDiscountRes){
|
||||
newUserDiscount.value=consumeDiscountRes.amount
|
||||
cartStore.newUserDiscount=consumeDiscountRes.amount||0
|
||||
if (consumeDiscountRes&&consumeDiscountRes.isUse) {
|
||||
newUserDiscount.value = consumeDiscountRes.amount
|
||||
cartStore.newUserDiscount = consumeDiscountRes.amount || 0
|
||||
cartStore.consumeDiscount=consumeDiscountRes
|
||||
}
|
||||
}
|
||||
getConsumeDiscount()
|
||||
@@ -537,6 +594,14 @@
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
}
|
||||
|
||||
.round {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #fff;
|
||||
border: 1px solid #D9D9D9;
|
||||
}
|
||||
|
||||
::v-deep .u-textarea__field {
|
||||
background: #FAFAFA;
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
@@ -1043,7 +1108,8 @@
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
font-weight: 400rpx;
|
||||
&.red{
|
||||
|
||||
&.red {
|
||||
color: #FF3232;
|
||||
}
|
||||
}
|
||||
@@ -1058,9 +1124,11 @@
|
||||
|
||||
.favorable_right_text {
|
||||
margin-bottom: 10rpx;
|
||||
&.red{
|
||||
|
||||
&.red {
|
||||
color: #FF3232;
|
||||
}
|
||||
|
||||
text:nth-child(1) {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
@@ -1205,7 +1273,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.red{
|
||||
color:#FF3232;
|
||||
|
||||
.red {
|
||||
color: #FF3232;
|
||||
}
|
||||
</style>
|
||||
@@ -118,7 +118,10 @@
|
||||
BigNumber
|
||||
} from 'bignumber.js';
|
||||
import ChargeVue from './components/charge.vue';
|
||||
import {pay} from '@/utils/pay.js'
|
||||
import {
|
||||
pay
|
||||
} from '@/utils/pay.js'
|
||||
|
||||
function onback() {
|
||||
closeSocket()
|
||||
back()
|
||||
@@ -149,7 +152,8 @@
|
||||
import {
|
||||
APIgetOrderById,
|
||||
APIputuserorder,
|
||||
APIhistoryOrder,rechargePayOrder
|
||||
APIhistoryOrder,
|
||||
rechargePayOrder
|
||||
} from '@/common/api/order/index.js'
|
||||
import {
|
||||
APIusershopInfodetail,
|
||||
@@ -169,14 +173,17 @@
|
||||
|
||||
|
||||
//充值相关
|
||||
const rechargeItem=ref({id:''})
|
||||
const rechargeId=ref(null)
|
||||
const rechargeItem = ref({
|
||||
id: ''
|
||||
})
|
||||
const rechargeId = ref(null)
|
||||
|
||||
function updateRechargeId(e){
|
||||
rechargeId.value=e
|
||||
function updateRechargeId(e) {
|
||||
rechargeId.value = e
|
||||
}
|
||||
function updateChargeSel(e){
|
||||
rechargeItem.value=e
|
||||
|
||||
function updateChargeSel(e) {
|
||||
rechargeItem.value = e
|
||||
}
|
||||
|
||||
async function onMessage(Message) {
|
||||
@@ -192,8 +199,8 @@
|
||||
let res = await APIgetOrderById({
|
||||
orderId: listinfo.id
|
||||
})
|
||||
console.log('onMessage:APIgetOrderById',res);
|
||||
if(res){
|
||||
console.log('onMessage:APIgetOrderById', res);
|
||||
if (res) {
|
||||
// cartStore.carts=[];
|
||||
// cartStore.setOldOrder(res)
|
||||
}
|
||||
@@ -647,7 +654,7 @@
|
||||
if (!cartStore.isEmpty) {
|
||||
const res = await createOrder()
|
||||
//历史订单数据
|
||||
const res1= await APIgetOrderById({
|
||||
const res1 = await APIgetOrderById({
|
||||
orderId: res.id
|
||||
})
|
||||
cartStore.setOldOrder(res1)
|
||||
@@ -700,22 +707,26 @@
|
||||
const goToPay = async (isCreateOrder = false) => {
|
||||
// 余额支付
|
||||
if (paymentmethod.payType == 'accountPay') {
|
||||
if (orderVIP.value.isVip == 0) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您还不是会员,是否去注册会员?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.pro.navigateTo('user/member/index', {
|
||||
shopId: orderVIP.value.shopId,
|
||||
type: 'detail'
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (orderVIP.value.payPwd == '') {
|
||||
// if (orderVIP.value.isVip == 0) {
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: '您还不是会员,是否去注册会员?',
|
||||
// success: (res) => {
|
||||
// if (res.confirm) {
|
||||
// uni.pro.navigateTo('user/member/index', {
|
||||
// shopId: orderVIP.value.shopId,
|
||||
// type: 'detail'
|
||||
// })
|
||||
// } else if (res.cancel) {
|
||||
// console.log('用户点击取消');
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// return
|
||||
|
||||
// }
|
||||
|
||||
if (orderVIP.value.payPwd == '') {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您还未设置支付密码,是否去设置?',
|
||||
@@ -779,7 +790,7 @@
|
||||
vipPrice: cartStore.useVipPrice ? 1 : 0, //是否使用会员价0否1是
|
||||
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
|
||||
seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
|
||||
originAmount: cartStore.orderCostSummary.goodsRealAmount , //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
|
||||
discountAmount: 0, //手动优惠金额 写死0
|
||||
productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
|
||||
@@ -789,25 +800,29 @@
|
||||
roundAmount: 0, //抹零金额 减免多少钱
|
||||
pointsDiscountAmount: cartStore.orderCostSummary
|
||||
.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsNum: listinfo.pointsNum, //(扣除各类折扣 enable_deduction后使用)
|
||||
pointsNum: cartStore.orderCostSummary.pointUsed, //(扣除各类折扣 enable_deduction后使用)
|
||||
newCustomerDiscountAmount: cartStore.orderCostSummary.newUserDiscount, //新客立减
|
||||
newCustomerDiscountId: cartStore.orderCostSummary.newUserDiscount > 0 ? cartStore
|
||||
.consumeDiscount.id : '',
|
||||
remark: '', //用户备注
|
||||
}
|
||||
console.log('topay checkOrderPay', checkOrderPay);
|
||||
try {
|
||||
if(rechargeItem.value.id&&rechargeId.value){
|
||||
if (rechargeItem.value.id && rechargeId.value) {
|
||||
//充值支付
|
||||
const payRes= await rechargePayOrder({
|
||||
const payRes = await rechargePayOrder({
|
||||
checkOrderPay,
|
||||
payType: paymentmethod.payType,
|
||||
buyerRemark: '',
|
||||
returnUrl: '',
|
||||
rechargeId:rechargeId.value,
|
||||
rechargeDetailId:rechargeItem.value.id,
|
||||
shopUserId:orderVIP.value.id,
|
||||
rechargeId: rechargeId.value,
|
||||
rechargeDetailId: rechargeItem.value.id,
|
||||
shopUserId: orderVIP.value.id,
|
||||
shopId: orderVIP.value.shopId,
|
||||
})
|
||||
pay(payRes)
|
||||
}else{
|
||||
await pay(payRes)
|
||||
pay_unlock()
|
||||
} else {
|
||||
console.log('微信支付');
|
||||
await storeMemberpay.actionsltPayOrder({
|
||||
checkOrderPay,
|
||||
@@ -815,15 +830,17 @@
|
||||
buyerRemark: '',
|
||||
returnUrl: ''
|
||||
})
|
||||
pay_unlock()
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log('error',error);
|
||||
console.log('error', error);
|
||||
pay_unlock()
|
||||
//TODO handle the exception
|
||||
}
|
||||
}
|
||||
pay_unlock()
|
||||
console.log('orderorderInfo');
|
||||
orderorderInfo()
|
||||
}
|
||||
|
||||
@@ -853,7 +870,7 @@
|
||||
vipPrice: cartStore.useVipPrice ? 1 : 0, //是否使用会员价0否1是
|
||||
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
|
||||
seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
|
||||
originAmount: cartStore.orderCostSummary.goodsRealAmount , //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
|
||||
discountAmount: 0, //手动优惠金额 写死0
|
||||
productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
|
||||
@@ -863,7 +880,10 @@
|
||||
roundAmount: 0, //抹零金额 减免多少钱
|
||||
pointsDiscountAmount: cartStore.orderCostSummary
|
||||
.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsNum: listinfo.pointsNum, //(扣除各类折扣 enable_deduction后使用)
|
||||
pointsNum: cartStore.orderCostSummary.pointUsed, //(扣除各类折扣 enable_deduction后使用)
|
||||
newCustomerDiscountAmount: cartStore.orderCostSummary.newUserDiscount, //新客立减
|
||||
newCustomerDiscountId: cartStore.orderCostSummary.newUserDiscount > 0 ? cartStore.consumeDiscount
|
||||
.id : '',
|
||||
remark: '', //用户备注
|
||||
}
|
||||
try {
|
||||
@@ -934,7 +954,7 @@
|
||||
url: '/pages/product/index'
|
||||
})
|
||||
}
|
||||
const packfee=computed(()=>{
|
||||
const packfee = computed(() => {
|
||||
return cartStore.orderCostSummary.packFee
|
||||
})
|
||||
//不计算各种折扣前的实付金额
|
||||
|
||||
@@ -323,7 +323,10 @@
|
||||
let noUseGoodsCoupon = []
|
||||
let noUseDiscountCoupon = []
|
||||
const user = uni.cache.get('shopUserInfo')
|
||||
const shopInfo = uni.cache.get('shopInfo')
|
||||
let shopInfo = uni.cache.get('shopInfo')||{}
|
||||
if(!shopInfo.isMemberPrice){
|
||||
shopInfo={}
|
||||
}
|
||||
const goodsOrderPrice = uni.getStorageSync('goodsOrderPrice') || 0
|
||||
const goodsList = uni.getStorageSync('canDikouGoodsArr') || []
|
||||
const dinnerType = uni.getStorageSync('dinnerType')
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
</view>
|
||||
<view class="listStyle " v-for="(item,i) in formData.list" :key="i">
|
||||
<view class="flex-start">
|
||||
<view class="listStyle_left">
|
||||
<view class="listrigth">
|
||||
<view class="color-333 font-16 font-700 u-m-b-16">
|
||||
<view v-if="formData.active == 1">
|
||||
<text v-if="item.bizCode == 'cashIn'">
|
||||
现金充值
|
||||
@@ -60,6 +59,10 @@
|
||||
{{item.content}}
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="listStyle_left">
|
||||
<view class="listrigth color-333 font-14">
|
||||
<view>{{item.shopName||'门店名称'}}</view>
|
||||
<view v-if="formData.active == 1" :class="{colorStyle: (item.bizCode == 'cashIn' || item.bizCode == 'wechatIn' ||
|
||||
item.bizCode == 'alipayIn'|| item.bizCode == 'awardIn'|| item.bizCode == 'rechargeRefund')}">
|
||||
{{ item.amount }}
|
||||
@@ -285,11 +288,6 @@
|
||||
color: #FF7127;
|
||||
}
|
||||
|
||||
>view {
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.listStyle_left {
|
||||
@@ -304,7 +302,7 @@
|
||||
}
|
||||
|
||||
.listrigth2 {
|
||||
margin-top: 16rpx;
|
||||
margin-top: 4rpx;
|
||||
|
||||
>view {
|
||||
font-weight: 500;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<view class="balance-wrap">
|
||||
<view class="left">
|
||||
<text class="i t">余额</text>
|
||||
<text class="n t">{{shopUserInfo.amount}}</text>
|
||||
<text class="n t">{{shopUserInfo.amount||0}}</text>
|
||||
</view>
|
||||
<view class="right">
|
||||
<text class="t" @click="toDetail">明细</text>
|
||||
@@ -43,7 +43,7 @@
|
||||
:class="{active:sel==index}">
|
||||
<view class="">
|
||||
<text>¥</text>
|
||||
<text class="font-700" style="font-size: 48rpx;"
|
||||
<text class="font-700" style="font-size: 48 u-flex-1rpx;"
|
||||
:class="{color2:sel==index}">{{item.amount}}</text>
|
||||
</view>
|
||||
<view class="font-12" v-if="item.rewardAmount" :class="{color2:sel==index}">
|
||||
@@ -51,16 +51,16 @@
|
||||
<text>¥</text>
|
||||
<text class="font-14">{{item.rewardAmount}}</text>
|
||||
</view>
|
||||
<view class="font-12" v-if="item.rewardPoints">
|
||||
<view class="font-12" v-if="item.rewardPoints" style="color: #5F2E0F;">
|
||||
<text>送</text>
|
||||
<text>¥</text>
|
||||
<text class="font-14">{{item.rewardPoints}}</text>
|
||||
<text class="">积分</text>
|
||||
</view>
|
||||
<view class="font-12 color-666" v-if="item.couponInfoList.length">
|
||||
<text>送</text>
|
||||
<text>{{item.couponInfoList.length}}</text>
|
||||
<text>{{couponNum(item.couponInfoList) }}</text>
|
||||
<text>张券</text>
|
||||
<text class="color2 u-m-l-8" v-if="sel==index">查看</text>
|
||||
<text class="color2 u-m-l-8" v-if="sel==index" @click="lookCoupon(item)">查看</text>
|
||||
</view>
|
||||
|
||||
<view class="sel u-flex" v-if="sel==index">
|
||||
@@ -68,12 +68,15 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="state.isCustom">
|
||||
<view class="u-flex other flex-center">
|
||||
<text class="font-14 color-333 font-700 u-m-r-28">其他金额</text>
|
||||
<up-input v-model="money" type="number" placeholder="请输入充值金额" border="none"
|
||||
placeholder-style="font-size:14px;"></up-input>
|
||||
</view>
|
||||
<view class="color-999 font-12 u-m-t-4">自定义金额充值时,不享受任何优惠赠送</view>
|
||||
</template>
|
||||
|
||||
<button class="buy-btn" @click="buy">
|
||||
<text class="font-16 ">¥{{charge_money}}</text>
|
||||
<text class="font-14 u-m-l-24">立即充值</text>
|
||||
@@ -98,14 +101,14 @@
|
||||
</view>
|
||||
<view class="u-m-t-16 u-flex u-flex-y-center">
|
||||
<text class="no-wrap">充值说明</text>
|
||||
<view class="u-m-l-28">
|
||||
<text class="u-m-l-28" style="word-break: break-all;">
|
||||
{{state.remark||''}}
|
||||
</view>
|
||||
</text>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<CouponList v-model="couponModel.show" :list="couponModel.couponInfoList"></CouponList>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -114,6 +117,7 @@
|
||||
APIusershopInfodetail,
|
||||
APIshopUserInfo
|
||||
} from '@/common/api/member.js'
|
||||
import CouponList from '@/components/coupon/list.vue'
|
||||
import * as rechargeApi from '@/common/api/market/recharge.js'
|
||||
import {
|
||||
recharge
|
||||
@@ -134,6 +138,21 @@
|
||||
import {
|
||||
pay
|
||||
} from '@/utils/pay.js'
|
||||
|
||||
function couponNum(list) {
|
||||
return list.reduce((prve, cur) => {
|
||||
return prve + cur.num
|
||||
}, 0)
|
||||
}
|
||||
const couponModel = reactive({
|
||||
show: false,
|
||||
couponInfoList: []
|
||||
})
|
||||
|
||||
function lookCoupon(item) {
|
||||
couponModel.show = true
|
||||
couponModel.couponInfoList = item.couponInfoList
|
||||
}
|
||||
async function buy() {
|
||||
if (!charge_money.value) {
|
||||
return uni.showToast({
|
||||
@@ -146,7 +165,7 @@
|
||||
shopUserId: shopUserInfo.id,
|
||||
}
|
||||
if (sel.value < 0) {
|
||||
json.amount = `${money.value}`.trim()*1
|
||||
json.amount = `${money.value}`.trim() * 1
|
||||
} else {
|
||||
json.rechargeDetailId = list.value[sel.value].id
|
||||
json.amount = list.value[sel.value].amount
|
||||
|
||||
@@ -34,6 +34,8 @@ export const useCartsStore = defineStore('cart',
|
||||
isTableFee: 1
|
||||
})
|
||||
|
||||
const consumeDiscount=ref({})
|
||||
|
||||
// 适配工具库 BaseCartItem 接口的商品数据转换函数
|
||||
const convertToBaseCartItem = (item) => {
|
||||
const skuData = item.skuData ? {
|
||||
@@ -584,9 +586,12 @@ export const useCartsStore = defineStore('cart',
|
||||
setSeatFeeConfig,
|
||||
seatFeeConfig,
|
||||
shopInfo,
|
||||
//新客立减数据
|
||||
consumeDiscount,
|
||||
//新客立减金额
|
||||
newUserDiscount,
|
||||
getAllGoodsList
|
||||
getAllGoodsList,
|
||||
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -4,7 +4,7 @@
|
||||
<view class="top" style=" background-image: url(/static/czzx_header_bg.png);">
|
||||
<view>
|
||||
<view class="u-flex">
|
||||
<up-avatar size="136rpx" shape="square" round="20rpx" :src="shopInfo.logo"></up-avatar>
|
||||
<up-image radius="20rpx" width="136rpx" height="136rpx" :src="shopInfo.logo" mode="aspectFill"></up-image>
|
||||
<view class="u-p-l-20">
|
||||
<view class="shop-name u-line-1">{{shopInfo.shopName||'店铺名称' }}</view>
|
||||
<view class="u-flex">
|
||||
@@ -577,7 +577,7 @@
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
column-gap: 36rpx;
|
||||
|
||||
row-gap: 36rpx;
|
||||
.vip-list-item {
|
||||
border: 4rpx solid #D9D9D9;
|
||||
border-radius: 40rpx;
|
||||
|
||||
@@ -438,7 +438,7 @@ export function returnCanDikouGoods(arr, user, shopInfo) {
|
||||
return v.num > 0;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return returnGoodsPrice(b, use, shopInfo) - returnGoodsPrice(a, user, shopInfo);
|
||||
return returnGoodsPrice(b, user, shopInfo) - returnGoodsPrice(a, user, shopInfo);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
export const pay = (res) => {
|
||||
return new Promise((reslove, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.showLoading({
|
||||
title: '支付中...',
|
||||
mask: true
|
||||
|
||||
Reference in New Issue
Block a user