修改订单支付优惠券积分
This commit is contained in:
@@ -17,13 +17,13 @@ import infoBox from "@/commons/utils/infoBox.js"
|
|||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import { reject } from 'lodash';
|
import { reject } from 'lodash';
|
||||||
// 测试服
|
// 测试服
|
||||||
// let baseUrl = 'https://admintestpapi.sxczgkj.cn'
|
let baseUrl = 'https://admintestpapi.sxczgkj.cn'
|
||||||
|
|
||||||
//预发布
|
//预发布
|
||||||
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||||
|
|
||||||
//正式
|
//正式
|
||||||
let baseUrl = 'https://cashieradmin.sxczgkj.cn'
|
// let baseUrl = 'https://cashieradmin.sxczgkj.cn'
|
||||||
|
|
||||||
// 王伟本地测
|
// 王伟本地测
|
||||||
// let baseUrl = '/ww'
|
// let baseUrl = '/ww'
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
<view class="page-gray u-font-28">
|
<view class="page-gray u-font-28">
|
||||||
<view class="search bg-fff u-flex u-col-center ">
|
<view class="search bg-fff u-flex u-col-center ">
|
||||||
<view class="u-flex-1">
|
<view class="u-flex-1">
|
||||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索" @confirm="search"
|
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索" @confirm="search" @clear="search"
|
||||||
@clear="search"
|
|
||||||
v-model="query.name">
|
v-model="query.name">
|
||||||
</uni-search-bar>
|
</uni-search-bar>
|
||||||
</view>
|
</view>
|
||||||
@@ -25,7 +24,10 @@
|
|||||||
<image v-if="item.headImg" :src="item.headImg" class="img" mode=""></image>
|
<image v-if="item.headImg" :src="item.headImg" class="img" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-l-32">
|
<view class="u-m-l-32">
|
||||||
|
<view class="u-flex">
|
||||||
<view>{{item.nickName}}</view>
|
<view>{{item.nickName}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-12 ">手机号:{{item.telephone}}</view>
|
||||||
<view class=" u-font-24 u-m-t-12 u-flex">
|
<view class=" u-font-24 u-m-t-12 u-flex">
|
||||||
<text class="color-999" v-if="!item.isVip">非会员</text>
|
<text class="color-999" v-if="!item.isVip">非会员</text>
|
||||||
<text class="color-main" v-else>会员</text>
|
<text class="color-main" v-else>会员</text>
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="border-bottom u-p-b-30">
|
<view class="border-bottom u-p-b-30" v-if="payPrice!=order.amount">
|
||||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-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>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
|
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
|
||||||
v-if="accountPoints.price">
|
v-if="accountPoints.price&&accountPoints.sel">
|
||||||
<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(accountPoints.price)}}</text>
|
<text style="color: rgb(255, 95, 46);">-¥{{to2(accountPoints.price)}}</text>
|
||||||
@@ -169,7 +169,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="bg-fff card bottom border-r-12 u-p-32">
|
<view class="bg-fff card bottom border-r-12 u-p-32">
|
||||||
<view class="font-bold u-font-32 u-text-center">
|
<view class="font-bold u-font-32 u-text-center">
|
||||||
¥{{discount.currentPrice?discount.currentPrice: order.amount}}</view>
|
¥{{payPrice}}</view>
|
||||||
<view class="u-flex u-row-center u-m-t-24">
|
<view class="u-flex u-row-center u-m-t-24">
|
||||||
<template v-if="order.status=='unpaid'">
|
<template v-if="order.status=='unpaid'">
|
||||||
<up-loading-icon size="14" text="等待支付"></up-loading-icon>
|
<up-loading-icon size="14" text="等待支付"></up-loading-icon>
|
||||||
@@ -245,9 +245,12 @@
|
|||||||
price:0
|
price:0
|
||||||
})
|
})
|
||||||
async function calcUsablePoints(){
|
async function calcUsablePoints(){
|
||||||
|
if(!order.memberId){
|
||||||
|
return
|
||||||
|
}
|
||||||
const res=await Api.$calcUsablePoints({
|
const res=await Api.$calcUsablePoints({
|
||||||
memberId:order.memberId,
|
memberId:order.memberId,
|
||||||
orderAmount:order.amount
|
orderAmount:pointCanDicountPrice.value
|
||||||
})
|
})
|
||||||
accountPoints.calcRes=res
|
accountPoints.calcRes=res
|
||||||
accountPoints.num=res.maxUsablePoints
|
accountPoints.num=res.maxUsablePoints
|
||||||
@@ -424,16 +427,7 @@
|
|||||||
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)
|
||||||
@@ -486,7 +480,15 @@
|
|||||||
payType,
|
payType,
|
||||||
vipUserId: order.memberId,
|
vipUserId: order.memberId,
|
||||||
discount: 1,
|
discount: 1,
|
||||||
code: ''
|
code: '',
|
||||||
|
pointsNum:accountPoints.sel?accountPoints.num:0,
|
||||||
|
userCouponInfos:pays.quan.map(v=>{
|
||||||
|
return {
|
||||||
|
userCouponId:v.id,
|
||||||
|
num:v.num
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
paySuccess()
|
paySuccess()
|
||||||
}
|
}
|
||||||
@@ -553,11 +555,33 @@
|
|||||||
function getPayUrl() {
|
function getPayUrl() {
|
||||||
orderApi.$getOrderPayUrl({
|
orderApi.$getOrderPayUrl({
|
||||||
orderId: order.id,
|
orderId: order.id,
|
||||||
payAmount: discount.currentPrice ? discount.currentPrice : order.amount
|
payAmount: payPrice.value
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
payCodeUrl.value = res
|
payCodeUrl.value = res
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
watch(()=>payPrice.value,()=>{
|
||||||
|
getPayUrl()
|
||||||
|
})
|
||||||
|
const pointCanDicountPrice=computed(()=>{
|
||||||
|
const discountPrice=discount.currentPrice?discount.currentPrice:order.amount
|
||||||
|
const calcPrice=discountPrice-coupAllPrice.value
|
||||||
|
return (calcPrice<=0?0:calcPrice).toFixed(2)
|
||||||
|
})
|
||||||
|
watch(()=>pointCanDicountPrice.value,(newval)=>{
|
||||||
|
calcUsablePoints()
|
||||||
|
})
|
||||||
|
|
||||||
onLoad(async (opt) => {
|
onLoad(async (opt) => {
|
||||||
console.log(opt);
|
console.log(opt);
|
||||||
option = opt
|
option = opt
|
||||||
@@ -568,6 +592,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
console.log('onBeforeUnmount');
|
||||||
clear()
|
clear()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -45,8 +45,7 @@
|
|||||||
|
|
||||||
<template v-if="myQuan.types.sel==1">
|
<template v-if="myQuan.types.sel==1">
|
||||||
<view class="" @click="changeProductCoupon(item)" v-for="(item,index) in myQuan.res.productCoupon"
|
<view class="" @click="changeProductCoupon(item)" v-for="(item,index) in myQuan.res.productCoupon"
|
||||||
:class="{filtergray:!item.use}" :key="index"
|
:class="{filtergray:!item.use}" :key="index">
|
||||||
>
|
|
||||||
<view class="quan goods u-row-between u-flex u-col-center u-m-b-32 border-r-10 u-relative">
|
<view class="quan goods u-row-between u-flex u-col-center u-m-b-32 border-r-10 u-relative">
|
||||||
<view class="no-use" v-if="!item.use">
|
<view class="no-use" v-if="!item.use">
|
||||||
<image class="img" src="/pagesOrder/static/image/no-use.svg" mode=""></image>
|
<image class="img" src="/pagesOrder/static/image/no-use.svg" mode=""></image>
|
||||||
@@ -90,7 +89,13 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view :style="{height:safebottomHeight+'px'}"></view>
|
<view :style="{height:safebottomHeight+'px'}"></view>
|
||||||
<view class="fixed-b u-flex gap-20 bottom safe-bottom border-top">
|
<view class="fixed-b bottom safe-bottom border-top">
|
||||||
|
<view class="u-m-b-32">
|
||||||
|
<text>抵扣金额:</text>
|
||||||
|
<text class="color-red">¥</text>
|
||||||
|
<text class="color-red">{{discountAmount}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex gap-20">
|
||||||
<up-button shape="circle" plain @click="back">
|
<up-button shape="circle" plain @click="back">
|
||||||
<view class="font-bold">取消</view>
|
<view class="font-bold">取消</view>
|
||||||
</up-button>
|
</up-button>
|
||||||
@@ -98,6 +103,8 @@
|
|||||||
<view class="font-bold">确定</view>
|
<view class="font-bold">确定</view>
|
||||||
</up-button>
|
</up-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -125,7 +132,13 @@
|
|||||||
import {
|
import {
|
||||||
queryAllShopUser
|
queryAllShopUser
|
||||||
} from '@/http/yskApi/shop-user.js'
|
} from '@/http/yskApi/shop-user.js'
|
||||||
import {returnNewGoodsList,returnCoupCanUse,returnProductCoupon} from '../quan_util.js'
|
import {
|
||||||
|
returnNewGoodsList,
|
||||||
|
returnCoupCanUse,
|
||||||
|
returnCouponAllPrice,
|
||||||
|
returnProductCoupon
|
||||||
|
} from '../quan_util.js'
|
||||||
|
|
||||||
function back() {
|
function back() {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}
|
}
|
||||||
@@ -204,8 +217,7 @@
|
|||||||
}
|
}
|
||||||
const option = reactive({
|
const option = reactive({
|
||||||
orderId: '',
|
orderId: '',
|
||||||
memberId: '',
|
memberId: ''
|
||||||
payPrice:''
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function toEmitChooseQuan(item) {
|
function toEmitChooseQuan(item) {
|
||||||
@@ -222,7 +234,12 @@
|
|||||||
uni.$emit('choose-quan', arr)
|
uni.$emit('choose-quan', arr)
|
||||||
back()
|
back()
|
||||||
}
|
}
|
||||||
|
const discountAmount = computed(() => {
|
||||||
|
const goodsQuan = myQuan.res.productCoupon.filter(v => v.checked)
|
||||||
|
const fullReductionCoupon = myQuan.fullReductionCouponSel.id ? [myQuan.fullReductionCouponSel] : []
|
||||||
|
let coupArr = [...fullReductionCoupon, ...goodsQuan]
|
||||||
|
return returnCouponAllPrice(coupArr, canDikouGoodsArr, user.value)
|
||||||
|
})
|
||||||
onLoad((opt) => {
|
onLoad((opt) => {
|
||||||
Object.assign(option, opt)
|
Object.assign(option, opt)
|
||||||
getQuan()
|
getQuan()
|
||||||
@@ -238,6 +255,7 @@
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
// $quan-color:rgb(233, 77, 60);
|
// $quan-color:rgb(233, 77, 60);
|
||||||
$quan-color: #318AFE;
|
$quan-color: #318AFE;
|
||||||
|
|
||||||
.no-use {
|
.no-use {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -247,12 +265,14 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.img {
|
.img {
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-b {
|
.fixed-b {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export function returnProductCouponPrice(coup, goodsArr, vipUser) {
|
|||||||
}
|
}
|
||||||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||||
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
||||||
return price
|
return price*coup.num
|
||||||
|
|
||||||
}
|
}
|
||||||
//返回新的商品列表,过滤掉退菜的,退单的商品
|
//返回新的商品列表,过滤掉退菜的,退单的商品
|
||||||
@@ -20,9 +20,9 @@ export function returnNewGoodsList(arr) {
|
|||||||
}
|
}
|
||||||
//根据当前购物车商品以及数量,已选券对应商品数量,判断该券是否可用
|
//根据当前购物车商品以及数量,已选券对应商品数量,判断该券是否可用
|
||||||
export function returnCoupCanUse(goodsArr=[],coup,selCoupArr=[]) {
|
export function returnCoupCanUse(goodsArr=[],coup,selCoupArr=[]) {
|
||||||
// if(!coup.use){
|
if(!coup.use){
|
||||||
// return false
|
return false
|
||||||
// }
|
}
|
||||||
const findGoods=goodsArr.filter(v=>v.productId==coup.proId)
|
const findGoods=goodsArr.filter(v=>v.productId==coup.proId)
|
||||||
if(!findGoods.length){
|
if(!findGoods.length){
|
||||||
return false
|
return false
|
||||||
@@ -49,8 +49,7 @@ export function returnProductCoupon(coup, goodsArr, vipUser) {
|
|||||||
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
||||||
const discountAmount=(price*coup.num).toFixed(2)
|
const discountAmount=(price*coup.num).toFixed(2)
|
||||||
console.log(discountAmount);
|
console.log(discountAmount);
|
||||||
// const canUse=!coup.use?false:(discountAmount>0)
|
const canUse=!coup.use?false:(discountAmount>0)
|
||||||
const canUse=discountAmount>0
|
|
||||||
return { ...coup, discountAmount: discountAmount,use:canUse}
|
return { ...coup, discountAmount: discountAmount,use:canUse}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user