Merge branch 'dev' of https://e.coding.net/g-cphe0354/cashier_front/cashier_admin_app into gh
This commit is contained in:
@@ -2,7 +2,7 @@ export function canComputedPackFee(v) {
|
|||||||
return v.pack && v.status != 'return' && v.status != 'refund' && v.status != 'refunding'
|
return v.pack && v.status != 'return' && v.status != 'refund' && v.status != 'refunding'
|
||||||
}
|
}
|
||||||
export function returnCanComputedGoodsArr(arr) {
|
export function returnCanComputedGoodsArr(arr) {
|
||||||
return arr.filter(v=>canComputedPackFee(v))
|
return arr.filter(v => canComputedPackFee(v))
|
||||||
}
|
}
|
||||||
export function returnPackFee(arr) {
|
export function returnPackFee(arr) {
|
||||||
return arr.reduce((prve, cur) => {
|
return arr.reduce((prve, cur) => {
|
||||||
@@ -10,18 +10,28 @@ export function returnPackFee(arr) {
|
|||||||
}, 0).toFixed(2)
|
}, 0).toFixed(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function canTuicai(orderInfo,item){
|
export function canTuicai(orderInfo, item) {
|
||||||
return orderInfo.status=='unpaid'&&orderInfo.useType!='dine-in-before'&& item.status!='return'
|
if (orderInfo.status == 'unpaid' && orderInfo.isPostpaid !== null && orderInfo.isPostpaid == 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return orderInfo.status == 'unpaid' && orderInfo.useType != 'dine-in-before' && item.status != 'return'
|
||||||
}
|
}
|
||||||
export function canTuiKuan(orderInfo,item){
|
export function canTuiKuan(orderInfo, item) {
|
||||||
return orderInfo.status!='unpaid'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding'
|
return orderInfo.status == 'closed' && item.status != 'return' && item.status != 'refund' && item.status !=
|
||||||
|
'refunding'
|
||||||
}
|
}
|
||||||
export function isTui(item){
|
export function isTuiCai(item) {
|
||||||
return item.status=='return'||item.status=='refund'||item.status=='refunding'
|
return item.status == 'return'
|
||||||
}
|
}
|
||||||
export function numSum(arr){
|
export function isTui(item) {
|
||||||
const sum=arr.reduce((a,b)=>{
|
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||||
return a+b*100
|
}
|
||||||
},0)
|
export function isGift(item) {
|
||||||
return (sum/100).toFixed(2)
|
return !isTui(item) && item.gift
|
||||||
|
}
|
||||||
|
export function numSum(arr) {
|
||||||
|
const sum = arr.reduce((a, b) => {
|
||||||
|
return a + b * 100
|
||||||
|
}, 0)
|
||||||
|
return (sum / 100).toFixed(2)
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,32 @@
|
|||||||
import {
|
import {
|
||||||
getCurrentInstance,
|
getCurrentInstance,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
export function getElRect(elClass, dataVal) {
|
export async function getElRect(elClass, instance,option) {
|
||||||
const instance = getCurrentInstance();
|
instance = instance ? instance : getCurrentInstance();
|
||||||
return new Promise((resolve, reject) => {
|
const query = uni.createSelectorQuery().in(instance.proxy);
|
||||||
const query = uni.createSelectorQuery().in(instance.proxy);
|
try{
|
||||||
|
const res= await getEle(query,elClass,option)
|
||||||
|
return res
|
||||||
|
}catch(e){
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function getEle(query,elClass,option){
|
||||||
|
return new Promise((resolve, reject)=>{
|
||||||
query.select('.' + elClass).fields({
|
query.select('.' + elClass).fields({
|
||||||
size: true
|
size: true,
|
||||||
|
...option
|
||||||
}, res => {
|
}, res => {
|
||||||
// 如果节点尚未生成,res值为null,循环调用执行
|
// 如果节点尚未生成,res值为null,循环调用执行
|
||||||
if (!res) {
|
if (!res) {
|
||||||
setTimeout(() => {
|
return setTimeout(() => {
|
||||||
getElRect(elClass);
|
getEle(query,elClass,option);
|
||||||
}, 10);
|
}, 10);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
resolve(res);
|
resolve(res);
|
||||||
}).exec();
|
}).exec();
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getSafeBottomHeight(className, height = 16) {
|
export async function getSafeBottomHeight(className, height = 16) {
|
||||||
|
|||||||
@@ -69,10 +69,14 @@
|
|||||||
price: {
|
price: {
|
||||||
type: [Number,String],
|
type: [Number,String],
|
||||||
default: 0
|
default: 0
|
||||||
|
},
|
||||||
|
nowPrice:{
|
||||||
|
type: [Number,String],
|
||||||
|
default: 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
function currentPriceInput(newval){
|
function currentPriceInput(newval){
|
||||||
form.discount=(newval*100/form.price).toFixed()
|
form.discount=(newval*100/form.price)
|
||||||
}
|
}
|
||||||
function discountInput(newval){
|
function discountInput(newval){
|
||||||
form.currentPrice=(form.price*newval/100).toFixed(2)
|
form.currentPrice=(form.price*newval/100).toFixed(2)
|
||||||
@@ -126,8 +130,8 @@
|
|||||||
function open() {
|
function open() {
|
||||||
model.value.open()
|
model.value.open()
|
||||||
form.price=props.price
|
form.price=props.price
|
||||||
form.currentPrice=props.price
|
|
||||||
form.discount=props.discount
|
form.discount=props.discount
|
||||||
|
form.currentPrice=(props.discount*props.price/100).toFixed(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
|
|||||||
@@ -389,9 +389,10 @@
|
|||||||
const year = years[arr[0]]
|
const year = years[arr[0]]
|
||||||
const month = arr[1] + 1
|
const month = arr[1] + 1
|
||||||
const day = arr[2] + 1
|
const day = arr[2] + 1
|
||||||
const hour = ('0' + arr[3]).slice(-2)
|
const hour = ('0' + (arr[3]||0)).slice(-2)
|
||||||
const min = ('0' + arr[4]).slice(-2)
|
console.log(hour)
|
||||||
const sen = ('0' + arr[5]).slice(-2)
|
const min = ('0' + (arr[4]||0)).slice(-2)
|
||||||
|
const sen = ('0' + (arr[5]||0)).slice(-2)
|
||||||
if (isObj) {
|
if (isObj) {
|
||||||
return new Date(year, month, day, hour, min, sen)
|
return new Date(year, month, day, hour, min, sen)
|
||||||
}
|
}
|
||||||
@@ -400,6 +401,7 @@
|
|||||||
|
|
||||||
|
|
||||||
function confirm(e) {
|
function confirm(e) {
|
||||||
|
console.log(value.value);
|
||||||
const start = returnDateString(value.value)
|
const start = returnDateString(value.value)
|
||||||
console.log(start);
|
console.log(start);
|
||||||
const end = returnDateString(value1.value)
|
const end = returnDateString(value1.value)
|
||||||
@@ -487,7 +489,9 @@
|
|||||||
const endTotal = returnDateString(e.detail.value, true).getTime()
|
const endTotal = returnDateString(e.detail.value, true).getTime()
|
||||||
value1.value = e.detail.value
|
value1.value = e.detail.value
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
value1.value = endTotal < startTotal ? value.value : e.detail.value
|
if (props.isArea) {
|
||||||
|
value1.value = endTotal < startTotal ? value.value : e.detail.value
|
||||||
|
}
|
||||||
debounce(changeDays(true, value1.value), 100)
|
debounce(changeDays(true, value1.value), 100)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -332,3 +332,61 @@ export function $returnOrder(data) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取订单可用优惠券
|
||||||
|
export function $activateByOrderId(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/tbShopCoupon/activateByOrderId',
|
||||||
|
method: "get",
|
||||||
|
params:{
|
||||||
|
shopId: uni.getStorageSync("shopId"),
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//会员积分列表
|
||||||
|
export function $returnMemberPointsList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/points/member-points/page',
|
||||||
|
method: "get",
|
||||||
|
params:{
|
||||||
|
shopId: uni.getStorageSync("shopId"),
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 会员积分账户信息
|
||||||
|
export function $returnMemberPoints(memberId) {
|
||||||
|
return request({
|
||||||
|
url: '/api/points/member-points/'+memberId,
|
||||||
|
method: "get",
|
||||||
|
params:{
|
||||||
|
shopId: uni.getStorageSync("shopId"),
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//002-获取订单可用积分及抵扣金额(支付页面使用)
|
||||||
|
export function $calcUsablePoints(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/points/member-points/calc-usable-points',
|
||||||
|
method: "get",
|
||||||
|
params:{
|
||||||
|
shopId: uni.getStorageSync("shopId"),
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 003-根据积分计算可抵扣金额
|
||||||
|
export function $calcDeDuctionPoints(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/points/member-points/calc-deduction-amount',
|
||||||
|
method: "get",
|
||||||
|
params:{
|
||||||
|
shopId: uni.getStorageSync("shopId"),
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -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'
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="boxconstant">
|
<view class="boxconstant">
|
||||||
<view class="boxconstantbox"
|
<view class="boxconstantbox"
|
||||||
style="border-radius: 18px 18px 0 0;padding:32rpx 24rpx 0 24rpx;border-bottom: 2rpx solid #E5E5E5;">
|
style="border-radius: 18px 18px 0 0;padding:32rpx 24rpx;border-bottom: 2rpx solid #E5E5E5;">
|
||||||
<view class="boxconstantbox_one">
|
<view class="boxconstantbox_one">
|
||||||
充值设置
|
充值设置
|
||||||
</view>
|
</view>
|
||||||
<view class="boxconstantbox_tow">
|
<view class="boxconstantbox_tow">
|
||||||
<text>用户消费结账时,成功充值成功</text>
|
<text>用户消费结账时,成功充值</text>
|
||||||
<input class="text" v-model="form.rechargeTimes"></input>
|
<input class="text" type="number" v-model="form.rechargeTimes" />
|
||||||
<text>倍的金额本单即可享受免单</text>
|
<text>倍的金额本单即可享受免单</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="boxconstantbox" style="padding:32rpx 24rpx 0 24rpx; border-radius: 0 0 18px 18px;">
|
<view class="boxconstantbox" style="border-radius: 0 0 18px 18px;">
|
||||||
<view class="boxconstantbox_one">
|
<view class="boxconstantbox_one">
|
||||||
充值门槛
|
充值门槛
|
||||||
</view>
|
</view>
|
||||||
<view class="boxconstantbox_tow">
|
<view class="boxconstantbox_tow">
|
||||||
<text>订单支付金额需满</text>
|
<text>订单支付金额需满</text>
|
||||||
<input class="text" v-model="form.rechargeThreshold"></input>
|
<input class="text" type="number" v-model="form.rechargeThreshold"></input>
|
||||||
<text> 元,才能使用</text>
|
<text> 元,才能使用</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -28,11 +28,11 @@
|
|||||||
<up-switch v-model="form.enable" size="18"></up-switch>
|
<up-switch v-model="form.enable" size="18"></up-switch>
|
||||||
</view>
|
</view>
|
||||||
<view class="boxconstantbox"
|
<view class="boxconstantbox"
|
||||||
style="margin-top:24rpx; padding:32rpx 24rpx 0 24rpx; border-radius: 0 0 18px 18px;">
|
style="margin-top:24rpx; padding:32rpx 24rpx; border-radius: 0 0 18px 18px;">
|
||||||
<view class="boxconstantbox_one">
|
<view class="boxconstantbox_one">
|
||||||
充值说明
|
充值说明
|
||||||
</view>
|
</view>
|
||||||
<view class="boxconstantbox_tow">
|
<view>
|
||||||
<up-textarea v-model="form.rechargeDesc" placeholder="请输入内容"></up-textarea>
|
<up-textarea v-model="form.rechargeDesc" placeholder="请输入内容"></up-textarea>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -83,9 +83,9 @@
|
|||||||
title: '保存成功'
|
title: '保存成功'
|
||||||
})
|
})
|
||||||
Object.assign(form, res)
|
Object.assign(form, res)
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
},1500)
|
}, 1500)
|
||||||
}
|
}
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
getlist()
|
getlist()
|
||||||
@@ -113,21 +113,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.boxconstantbox_tow {
|
.boxconstantbox_tow {
|
||||||
display: flex;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding-bottom: 24rpx;
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
box-sizing: border-box;
|
// display: flex;
|
||||||
|
// justify-content: flex-start;
|
||||||
|
// align-items: center;
|
||||||
|
// flex-wrap: wrap;
|
||||||
|
// align-content: flex-start;
|
||||||
.text {
|
.text {
|
||||||
|
display:inline-flex;
|
||||||
|
text-align: center;
|
||||||
margin: 0 12rpx;
|
margin: 0 12rpx;
|
||||||
width: 118rpx;
|
width: 118rpx;
|
||||||
height: 48rpx;
|
height: 48rpx;
|
||||||
|
line-height: 48rpx;
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||||
border: 2rpx solid #E5E5E5;
|
border: 2rpx solid #E5E5E5;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view>
|
<view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view>
|
||||||
</picker-view-column>
|
</picker-view-column>
|
||||||
<picker-view-column>
|
<!-- <picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||||
</picker-view-column>
|
</picker-view-column>
|
||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
</picker-view-column>
|
</picker-view-column>
|
||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||||
</picker-view-column>
|
</picker-view-column> -->
|
||||||
</picker-view>
|
</picker-view>
|
||||||
<view class="u-text-center color-999">至</view>
|
<view class="u-text-center color-999">至</view>
|
||||||
<picker-view :immediate-change="true" :value="value1" @pickend="pickend1" @change="bindChange1"
|
<picker-view :immediate-change="true" :value="value1" @pickend="pickend1" @change="bindChange1"
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in days1" :key="index">{{item}}日</view>
|
<view class="item" v-for="(item,index) in days1" :key="index">{{item}}日</view>
|
||||||
</picker-view-column>
|
</picker-view-column>
|
||||||
<picker-view-column>
|
<!-- <picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||||
</picker-view-column>
|
</picker-view-column>
|
||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
</picker-view-column>
|
</picker-view-column>
|
||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||||
</picker-view-column>
|
</picker-view-column> -->
|
||||||
</picker-view>
|
</picker-view>
|
||||||
|
|
||||||
<!-- 站位 -->
|
<!-- 站位 -->
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
耗材价格
|
耗材价格
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<input class="uni-input" placeholder="请输入耗材价格" type="number" v-model="datas.form.price" >
|
<input class="uni-input" placeholder="请输入耗材价格" type="number" v-model="datas.form.price">
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
预警值
|
预警值
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<input type="text" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="">
|
<input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="">
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <li style="justify-content: space-between;">
|
<!-- <li style="justify-content: space-between;">
|
||||||
@@ -110,6 +110,9 @@
|
|||||||
let sumbit = () => {
|
let sumbit = () => {
|
||||||
tbConsTypeput([{
|
tbConsTypeput([{
|
||||||
...datas.form,
|
...datas.form,
|
||||||
|
status: datas.form.status * 1,
|
||||||
|
isCheck: datas.form.isCheck * 1,
|
||||||
|
conWarning: datas.form.conWarning * 1,
|
||||||
shopId: uni.getStorageSync("shopId"),
|
shopId: uni.getStorageSync("shopId"),
|
||||||
conTypeId: datas.list[datas.nowStatusIndex].id,
|
conTypeId: datas.list[datas.nowStatusIndex].id,
|
||||||
id: datas.form.id
|
id: datas.form.id
|
||||||
@@ -132,8 +135,6 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|
||||||
|
|
||||||
ul,
|
ul,
|
||||||
li {
|
li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
@@ -186,6 +187,7 @@
|
|||||||
.bottombutton {
|
.bottombutton {
|
||||||
margin-top: 84rpx;
|
margin-top: 84rpx;
|
||||||
padding: 0 24rpx;
|
padding: 0 24rpx;
|
||||||
|
|
||||||
>button {
|
>button {
|
||||||
width: 530rpx;
|
width: 530rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
|
|||||||
@@ -45,8 +45,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view class="">
|
<view style="background-color: #fff;" @tap="show=true;showData = filtersSproductId(item.product)">
|
||||||
所属商品: {{ filtersSproductId(item.product)}}
|
所属商品:
|
||||||
|
{{ filtersSproductId(item.product).length>7?filtersSproductId(item.product).substring(0,6)+'...':filtersSproductId(item.product)}}
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<up-button shape="circle" type="primary" size="mini" color="#999"
|
<up-button shape="circle" type="primary" size="mini" color="#999"
|
||||||
@@ -73,6 +74,19 @@
|
|||||||
</view>
|
</view>
|
||||||
<my-action-sheet @itemClick="sheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet>
|
<my-action-sheet @itemClick="sheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet>
|
||||||
<my-reportDamage ref="reportDamage" title="耗材报损" :item="report.data" @affirm="affirm"></my-reportDamage>
|
<my-reportDamage ref="reportDamage" title="耗材报损" :item="report.data" @affirm="affirm"></my-reportDamage>
|
||||||
|
|
||||||
|
<up-popup :show="show" :round="18" mode="center" >
|
||||||
|
<view class="zhezhaopop">
|
||||||
|
<view class="">
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
<up-icon @tap="show=false" name="close-circle-fill"></up-icon>
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
{{showData}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</up-popup>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -98,6 +112,8 @@
|
|||||||
} from '@/http/yskApi/requestAll.js';
|
} from '@/http/yskApi/requestAll.js';
|
||||||
let reportDamage = ref(null)
|
let reportDamage = ref(null)
|
||||||
let refMoreSheet = ref(null)
|
let refMoreSheet = ref(null)
|
||||||
|
let show = ref(false)
|
||||||
|
let showData = ref()
|
||||||
const report = reactive({
|
const report = reactive({
|
||||||
data: {
|
data: {
|
||||||
// thumbnail: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240918/a17a62b7b55a4b65a2a2542050672b34.png',
|
// thumbnail: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240918/a17a62b7b55a4b65a2a2542050672b34.png',
|
||||||
@@ -251,7 +267,6 @@
|
|||||||
// const productName = ele.slice(startIndex + 1, ele.length)
|
// const productName = ele.slice(startIndex + 1, ele.length)
|
||||||
str = ele.name + ',' + str
|
str = ele.name + ',' + str
|
||||||
})
|
})
|
||||||
|
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
let toUrl = (url, d) => {
|
let toUrl = (url, d) => {
|
||||||
@@ -450,6 +465,24 @@
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.zhezhaopop {
|
||||||
|
padding: 34rpx 32rpx;
|
||||||
|
width: 594rpx;
|
||||||
|
|
||||||
|
>view:first-child {
|
||||||
|
|
||||||
|
.df;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
>span:nth-child(2) {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.df() {
|
.df() {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -33,6 +33,18 @@
|
|||||||
<input type="text" placeholder="请输入单价(元)" v-model="datas.form.list.price" name="" id="">
|
<input type="text" placeholder="请输入单价(元)" v-model="datas.form.list.price" name="" id="">
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view style="justify-content: space-between;">
|
||||||
|
<view>
|
||||||
|
单位
|
||||||
|
</view>
|
||||||
|
<picker @change="changeNowStatusIndexs" :range="datas.unitList">
|
||||||
|
<view class="color-333" style="height: 84rpx;line-height: 84rpx;">
|
||||||
|
{{datas.form.list.unit}}
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
<!-- defaultUnit -->
|
||||||
|
<uni-icons type="bottom" size="16"></uni-icons>
|
||||||
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
应付金额
|
应付金额
|
||||||
@@ -117,6 +129,7 @@
|
|||||||
list: [],
|
list: [],
|
||||||
// 供应商渲染数组
|
// 供应商渲染数组
|
||||||
status: [],
|
status: [],
|
||||||
|
unitList:[],
|
||||||
form: {
|
form: {
|
||||||
shopId: uni.getStorageSync("shopId"),
|
shopId: uni.getStorageSync("shopId"),
|
||||||
type: "out",
|
type: "out",
|
||||||
@@ -135,6 +148,10 @@
|
|||||||
})
|
})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
datas.item = JSON.parse(props.item)
|
datas.item = JSON.parse(props.item)
|
||||||
|
datas.form = Object.assign(datas.form, datas.item)
|
||||||
|
// 单位列表
|
||||||
|
datas.unitList = [ datas.form.conUnit,datas.form.conUnitTwo]
|
||||||
|
datas.form.list.unit=datas.form.defaultUnit
|
||||||
})
|
})
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
getList()
|
getList()
|
||||||
@@ -165,7 +182,9 @@ onShow(() => {
|
|||||||
nowStatusIndex.value = i.detail.value
|
nowStatusIndex.value = i.detail.value
|
||||||
showStatus.value = false
|
showStatus.value = false
|
||||||
}
|
}
|
||||||
|
function changeNowStatusIndexs(i) {
|
||||||
|
datas.form.list.unit = datas.unitList[i.detail.value]
|
||||||
|
}
|
||||||
function sumbit() {
|
function sumbit() {
|
||||||
|
|
||||||
if (!datas.form.list.stockNumber) {
|
if (!datas.form.list.stockNumber) {
|
||||||
|
|||||||
BIN
pageConsumables/time.png
Normal file
BIN
pageConsumables/time.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 501 B |
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="viewrecordsType">
|
<!-- <view class="viewrecordsType">
|
||||||
<view style="display: flex;align-items: center;" @tap="popPu">
|
<view style="display: flex;align-items: center;" @tap="popPu">
|
||||||
筛选时间<up-icon style="transform: rotate(90deg);" name="play-right-fill" size="12"></up-icon>
|
筛选时间<up-icon style="transform: rotate(90deg);" name="play-right-fill" size="12"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
@@ -7,6 +7,10 @@
|
|||||||
{{datas.statusTitle}} <up-icon style="transform: rotate(90deg);" name="play-right-fill" size="12"></up-icon>
|
{{datas.statusTitle}} <up-icon style="transform: rotate(90deg);" name="play-right-fill" size="12"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
</view> -->
|
||||||
|
<view style="position: fixed;right: 50rpx;top: 80vh;background-color: #fff;border-radius: 50%;width: 65rpx;height: 65rpx;display: flex;align-items: center;justify-content: center;">
|
||||||
|
<image src="./time.png" style="width: 50rpx;height: 50rpx;" @tap="popPu"
|
||||||
|
mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
<view :style="{height:showStatus?statusHeight:0}" class="tranistion status overflow-hide">
|
<view :style="{height:showStatus?statusHeight:0}" class="tranistion status overflow-hide">
|
||||||
<view @tap="changeNowStatusIndex(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
|
<view @tap="changeNowStatusIndex(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
|
||||||
|
|||||||
@@ -25,15 +25,6 @@
|
|||||||
<input type="number" placeholder="请输入数量" v-model="datas.form.list.stockNumber" name="" id="">
|
<input type="number" placeholder="请输入数量" v-model="datas.form.list.stockNumber" name="" id="">
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view style="justify-content: space-between;">
|
|
||||||
<view>
|
|
||||||
单位
|
|
||||||
</view>
|
|
||||||
<view style="width: 54%;" @tap="showStatusToggle">
|
|
||||||
{{datas.status[nowStatusIndex]}}
|
|
||||||
</view>
|
|
||||||
<uni-icons type="bottom" size="16"></uni-icons>
|
|
||||||
</view> -->
|
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
<text style="color: red;">*</text>单价
|
<text style="color: red;">*</text>单价
|
||||||
@@ -42,6 +33,18 @@
|
|||||||
<input type="number" placeholder="请输入单价(元)" v-model="datas.form.list.price" name="" id="">
|
<input type="number" placeholder="请输入单价(元)" v-model="datas.form.list.price" name="" id="">
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view style="justify-content: space-between;">
|
||||||
|
<view>
|
||||||
|
单位
|
||||||
|
</view>
|
||||||
|
<picker @change="changeNowStatusIndexs" :range="datas.unitList">
|
||||||
|
<view class="color-333" style="height: 84rpx;line-height: 84rpx;">
|
||||||
|
{{datas.form.list.unit}}
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
<!-- defaultUnit -->
|
||||||
|
<uni-icons type="bottom" size="16"></uni-icons>
|
||||||
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
应付金额
|
应付金额
|
||||||
@@ -71,14 +74,13 @@
|
|||||||
供应商
|
供应商
|
||||||
</view>
|
</view>
|
||||||
<picker @change="changeNowStatusIndex" :value="nowStatusIndex" :range="datas.status">
|
<picker @change="changeNowStatusIndex" :value="nowStatusIndex" :range="datas.status">
|
||||||
<view class="color-333" style="height: 84rpx;line-height: 84rpx;">{{datas.status[nowStatusIndex]}}</view>
|
<view class="color-333" style="height: 84rpx;line-height: 84rpx;">{{datas.status[nowStatusIndex]}}
|
||||||
|
</view>
|
||||||
</picker>
|
</picker>
|
||||||
<uni-icons type="bottom" size="16"></uni-icons>
|
<uni-icons type="bottom" size="16"></uni-icons>
|
||||||
<view style="color: #318AFE;width: 80rpx;text-align: center;" @tap="toggle">
|
<view style="color: #318AFE;width: 80rpx;text-align: center;" @tap="toggle">
|
||||||
新增
|
新增
|
||||||
</view>
|
</view>
|
||||||
<!-- <up-button type="text" style="color: #318AFE;" @tap="toggle" :plain="true"
|
|
||||||
text="新增"></up-button> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -120,6 +122,8 @@
|
|||||||
list: [],
|
list: [],
|
||||||
// 供应商渲染数组
|
// 供应商渲染数组
|
||||||
status: [],
|
status: [],
|
||||||
|
// 单位列表
|
||||||
|
unitList: [],
|
||||||
form: {
|
form: {
|
||||||
shopId: uni.getStorageSync("shopId"),
|
shopId: uni.getStorageSync("shopId"),
|
||||||
type: "in",
|
type: "in",
|
||||||
@@ -138,7 +142,10 @@
|
|||||||
})
|
})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
datas.item = JSON.parse(props.item)
|
datas.item = JSON.parse(props.item)
|
||||||
datas.form = assign(datas.form, ...datas.item)
|
datas.form = Object.assign(datas.form, datas.item)
|
||||||
|
// 单位列表
|
||||||
|
datas.unitList = [ datas.form.conUnit,datas.form.conUnitTwo]
|
||||||
|
datas.form.list.unit=datas.form.defaultUnit
|
||||||
})
|
})
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
getList()
|
getList()
|
||||||
@@ -159,7 +166,6 @@
|
|||||||
res.content.forEach(ele => {
|
res.content.forEach(ele => {
|
||||||
datas.status.push(ele.purveyorName)
|
datas.status.push(ele.purveyorName)
|
||||||
})
|
})
|
||||||
console.log(datas.status, '调试121')
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,6 +179,10 @@
|
|||||||
showStatus.value = false
|
showStatus.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeNowStatusIndexs(i) {
|
||||||
|
datas.form.list.unit = datas.unitList[i.detail.value]
|
||||||
|
}
|
||||||
|
|
||||||
function sumbit() {
|
function sumbit() {
|
||||||
if (!datas.form.list.stockNumber) {
|
if (!datas.form.list.stockNumber) {
|
||||||
refs.ctx.$refs.uToastRef.show({
|
refs.ctx.$refs.uToastRef.show({
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">使用门槛</view>
|
<view class="lable">使用门槛2</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<view>满</view><input v-model="formData.fullAmount" placeholder="填写金额" border="none"></input><view>元</view>,<view>减</view><input v-model="formData.discountAmount" placeholder="填写金额" border="none"></input><view>元</view>
|
<view>满</view><input v-model="formData.fullAmount" type="number" placeholder="填写金额" border="none"></input><view>元</view>,<view>减</view><input v-model="formData.discountAmount" type="number" placeholder="填写金额" border="none"></input><view>元</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -35,13 +35,15 @@
|
|||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">有效期(天)</view>
|
<view class="lable">有效期(天)</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<up-input v-model="formData.validDays" placeholder="填写天数" border="none"></up-input>
|
<up-input v-model="formData.validDays" type="number" placeholder="填写天数" border="none"></up-input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">隔天生效<up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon></view>
|
<view class="lable">隔天生效
|
||||||
|
<!-- <up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
|
||||||
|
</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<view>隔</view><input v-model="formData.daysToTakeEffect" placeholder="填写天数" border="none" ></input><view>天生效</view>
|
<view>隔</view><input v-model="formData.daysToTakeEffect" type="number" placeholder="填写天数" border="none" ></input><view>天生效</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
@@ -79,7 +81,7 @@
|
|||||||
<view class="card">
|
<view class="card">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">总发放数量
|
<view class="lable">总发放数量
|
||||||
<up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon>
|
<!-- <up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
|
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
|
||||||
@@ -311,6 +313,7 @@
|
|||||||
height: 150rpx;
|
height: 150rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
z-index: 9;
|
||||||
>button {
|
>button {
|
||||||
width: 530rpx;
|
width: 530rpx;
|
||||||
margin: 30rpx 0;
|
margin: 30rpx 0;
|
||||||
|
|||||||
@@ -10,13 +10,13 @@
|
|||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">使用门槛</view>
|
<view class="lable">使用门槛</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<view>满</view><input v-model="formData.fullAmount" placeholder="填写金额" border="none"></input><view>元,可用</view>
|
<view>满</view><input v-model="formData.fullAmount" type="number" placeholder="填写金额" border="none"></input><view>元,可用</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">总发放数量</view>
|
<view class="lable">总发放数量</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
|
<up-input v-model="formData.number" type="number" placeholder="填写数量" border="none" clearable ></up-input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -36,10 +36,10 @@
|
|||||||
<view v-if="item.type == 1"> 满 {{ item.fullAmount }} 元减 {{ item.discountAmount }} 元 </view>
|
<view v-if="item.type == 1"> 满 {{ item.fullAmount }} 元减 {{ item.discountAmount }} 元 </view>
|
||||||
<view v-if="item.type == 2"> 满 {{ item.fullAmount }} 元可用 </view>
|
<view v-if="item.type == 2"> 满 {{ item.fullAmount }} 元可用 </view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<!-- <view>
|
||||||
<view> 领取方式 </view>
|
<view> 领取方式 </view>
|
||||||
<view> 用户不可自行领取 </view>
|
<view> 用户不可自行领取 </view>
|
||||||
</view>
|
</view> -->
|
||||||
<view v-if="item.type == 1">
|
<view v-if="item.type == 1">
|
||||||
<view> 有效期 </view>
|
<view> 有效期 </view>
|
||||||
<view> 领券后{{ item.validDays }}天过期 </view>
|
<view> 领券后{{ item.validDays }}天过期 </view>
|
||||||
@@ -197,7 +197,7 @@
|
|||||||
padding: 32rpx 28rpx;
|
padding: 32rpx 28rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 79rpx;
|
top: 0rpx;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
.tag-item {
|
.tag-item {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
/* height: 544rpx; */
|
/* height: 544rpx; */
|
||||||
margin: 32rpx auto 0;
|
margin: 32rpx auto 0;
|
||||||
margin-bottom: 32rpx;
|
margin-bottom: 32rpx;
|
||||||
padding: 122rpx 28rpx 182rpx 28rpx;
|
padding: 70rpx 28rpx 182rpx 28rpx;
|
||||||
}
|
}
|
||||||
.couponContent {
|
.couponContent {
|
||||||
/* background-color: #f9f9f9; */
|
/* background-color: #f9f9f9; */
|
||||||
|
|||||||
@@ -265,22 +265,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.pageLineUpTop {
|
.pageLineUpTop {
|
||||||
.df;
|
display: flex;
|
||||||
justify-content: space-around;
|
// justify-content: space-around;
|
||||||
|
flex-wrap: wrap;
|
||||||
margin: 36rpx 0;
|
margin: 36rpx 0;
|
||||||
|
|
||||||
|
|
||||||
>view {
|
>view {
|
||||||
width: 208rpx;
|
width: 208rpx;
|
||||||
height: 136rpx;
|
height: 136rpx;
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||||
border: 2rpx solid #E5E5E5;
|
border: 2rpx solid #E5E5E5;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
margin-left: 22rpx;
|
||||||
|
|
||||||
>view {
|
>view {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// >view:last-child {
|
||||||
|
// margin-right: auto;
|
||||||
|
// margin-left: 22rpx;
|
||||||
|
// }
|
||||||
|
|
||||||
.active {
|
.active {
|
||||||
border: 2rpx solid #318AFE;
|
border: 2rpx solid #318AFE;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -846,7 +846,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
minLength: 1,
|
minLength: 1,
|
||||||
maxLength: 20,
|
maxLength: 40,
|
||||||
errorMessage: '商品名称长度在 {minLength} 到 {maxLength} 个字符',
|
errorMessage: '商品名称长度在 {minLength} 到 {maxLength} 个字符',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -1375,7 +1375,7 @@
|
|||||||
for (let i of FormData.specificationsGroup.selectSpec) {
|
for (let i of FormData.specificationsGroup.selectSpec) {
|
||||||
if (i.selectSpecResult.length) {
|
if (i.selectSpecResult.length) {
|
||||||
skuSnap.push({
|
skuSnap.push({
|
||||||
label: i.name,
|
name: i.name,
|
||||||
value: i.selectSpecResult.join(',')
|
value: i.selectSpecResult.join(',')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,7 +227,9 @@
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
// #ifndef H5
|
||||||
refForm.value.setRules(rules)
|
refForm.value.setRules(rules)
|
||||||
|
// #endif
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -256,7 +256,9 @@
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
// #ifndef H5
|
||||||
refForm.value.setRules(rules)
|
refForm.value.setRules(rules)
|
||||||
|
// #endif
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -89,10 +89,13 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
getCurrentInstance,
|
getCurrentInstance,
|
||||||
onMounted,
|
|
||||||
reactive,
|
reactive,
|
||||||
ref
|
ref
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
import {
|
||||||
|
onShow,
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import {
|
import {
|
||||||
tbShopPermissionList,
|
tbShopPermissionList,
|
||||||
@@ -123,7 +126,7 @@
|
|||||||
[]
|
[]
|
||||||
]);
|
]);
|
||||||
const show = ref(false)
|
const show = ref(false)
|
||||||
onMounted(() => {
|
onShow(() => {
|
||||||
// 获取角色信息
|
// 获取角色信息
|
||||||
getrolesEvent()
|
getrolesEvent()
|
||||||
if (props.type == 'add') {
|
if (props.type == 'add') {
|
||||||
@@ -139,6 +142,7 @@
|
|||||||
|
|
||||||
function gettbPlussShopStaffDetail(id) {
|
function gettbPlussShopStaffDetail(id) {
|
||||||
tbPlussShopStaffDetail(id).then(res => {
|
tbPlussShopStaffDetail(id).then(res => {
|
||||||
|
console.log(res,'编辑员工后的提示')
|
||||||
datas.formData = res
|
datas.formData = res
|
||||||
if (datas.rolesList) {
|
if (datas.rolesList) {
|
||||||
let rolefilter = datas.rolesList.filter(ele => ele.id == res.roleId)
|
let rolefilter = datas.rolesList.filter(ele => ele.id == res.roleId)
|
||||||
@@ -266,9 +270,10 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
margin-top: 50rpx;
|
margin: 0 auto;
|
||||||
margin-left: 50%;
|
// margin-top: 50rpx;
|
||||||
transform: translateX(-50%);
|
// margin-left: 50%;
|
||||||
|
// transform: translateX(-50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottomBotton2 {
|
.bottomBotton2 {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex-1 u-text-center" >
|
<view class="u-flex-1 u-text-center" >
|
||||||
<view class="font-bold color-000 pr-16" >{{data.totalScore}}</view>
|
<view class="font-bold color-000 pr-16" >{{data.accountPoints}}</view>
|
||||||
<view class="u-flex u-row-center" >
|
<view class="u-flex u-row-center" >
|
||||||
<view class="color-999">积分</view>
|
<view class="color-999">积分</view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="u-flex-1 u-text-center" @tap="toUser">
|
<!-- <view class="u-flex-1 u-text-center" @tap="toUser">
|
||||||
<view class="font-bold color-000 pr-16">{{data.totalScore}}</view>
|
<view class="font-bold color-000 pr-16">{{data.accountPoints}}</view>
|
||||||
<view class="u-flex u-row-center">
|
<view class="u-flex u-row-center">
|
||||||
<view class="color-999">已消费</view>
|
<view class="color-999">已消费</view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
|
|||||||
@@ -120,7 +120,6 @@
|
|||||||
<view class="constantboxitem" v-for="(item,index) in tableData.data" :key="index"
|
<view class="constantboxitem" v-for="(item,index) in tableData.data" :key="index"
|
||||||
@click="toDetail(item)">
|
@click="toDetail(item)">
|
||||||
<view class="head">{{item.dutyId|| '无'}}</view>
|
<view class="head">{{item.dutyId|| '无'}}</view>
|
||||||
<view class="head">班次</view>
|
|
||||||
<view class="head">{{item.staffName || '无'}}</view>
|
<view class="head">{{item.staffName || '无'}}</view>
|
||||||
<view class="head">{{item.startTime|| '无'}}</view>
|
<view class="head">{{item.startTime|| '无'}}</view>
|
||||||
<view class="head">{{item.endTime|| '无'}}</view>
|
<view class="head">{{item.endTime|| '无'}}</view>
|
||||||
|
|||||||
@@ -875,6 +875,14 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "退款"
|
"navigationBarTitleText": "退款"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "quan/quan",
|
||||||
|
"pageId": "PAGES_ORDER_QUAN",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "券包"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -184,11 +184,11 @@
|
|||||||
// icon: '/static/indexImg/icon-cashier.svg',
|
// icon: '/static/indexImg/icon-cashier.svg',
|
||||||
// pageUrl: 'PAGES_SHOP_SETUP',
|
// pageUrl: 'PAGES_SHOP_SETUP',
|
||||||
// },
|
// },
|
||||||
// {
|
{
|
||||||
// title: '优惠券',
|
title: '优惠券',
|
||||||
// icon: '/static/coupon/icon_coupon.svg',
|
icon: '/static/coupon/icon_coupon.svg',
|
||||||
// pageUrl: 'PAGES_COUPON_INDEX',
|
pageUrl: 'PAGES_COUPON_INDEX',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
title: '订阅通知',
|
title: '订阅通知',
|
||||||
icon: '/static/indexImg/icon-notification.svg',
|
icon: '/static/indexImg/icon-notification.svg',
|
||||||
|
|||||||
@@ -110,6 +110,15 @@
|
|||||||
|
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
|
|
||||||
|
<view class="agreement-policy">
|
||||||
|
<JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" />
|
||||||
|
同意
|
||||||
|
<text class="agreement" @click="toPrivacy">《用户服务协议》</text>
|
||||||
|
<text>与</text>
|
||||||
|
<text class="policy" @click="toPrivacy">《隐私政策》</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<!-- <view class="agreement-policy">
|
<!-- <view class="agreement-policy">
|
||||||
<JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" />
|
<JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" />
|
||||||
同意
|
同意
|
||||||
@@ -294,10 +303,10 @@
|
|||||||
function loginFunc() {
|
function loginFunc() {
|
||||||
// 表单验证
|
// 表单验证
|
||||||
formUtil.validate(loginFormRef.value).then(() => {
|
formUtil.validate(loginFormRef.value).then(() => {
|
||||||
// if (!vdata.isSelectedAgreement) {
|
if (!vdata.isSelectedAgreement) {
|
||||||
// refAgr.value.open()
|
infoBox.showToast('请勾选同意用户服务协议与隐私政策')
|
||||||
// return false
|
return false
|
||||||
// }
|
}
|
||||||
let loginPromise = null;
|
let loginPromise = null;
|
||||||
if (vdata.loginType == 'pwd') { // 用户名密码登录
|
if (vdata.loginType == 'pwd') { // 用户名密码登录
|
||||||
// loginPromise = $loginByPwd(vdata.formData.username, vdata.formData.pwd, vdata.formData.safetyCode)
|
// loginPromise = $loginByPwd(vdata.formData.username, vdata.formData.pwd, vdata.formData.safetyCode)
|
||||||
@@ -340,7 +349,7 @@
|
|||||||
go.to('PAGES_STATIC_POLICY')
|
go.to('PAGES_STATIC_POLICY')
|
||||||
// #endif
|
// #endif
|
||||||
// 打开小程序隐私政策
|
// 打开小程序隐私政策
|
||||||
// #ifdef APP-PLUS
|
// #ifdef MP-WEIXIN
|
||||||
wx.openPrivacyContract({
|
wx.openPrivacyContract({
|
||||||
fail: () => {
|
fail: () => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -463,6 +472,7 @@
|
|||||||
|
|
||||||
.agreement-policy {
|
.agreement-policy {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 30rpx;
|
padding: 0 30rpx;
|
||||||
margin-top: 10rpx;
|
margin-top: 10rpx;
|
||||||
|
|||||||
@@ -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>{{item.nickName}}</view>
|
<view class="u-flex">
|
||||||
|
<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>
|
||||||
@@ -35,7 +37,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="u-m-l-30 u-flex">
|
<view class="u-m-l-30 u-flex">
|
||||||
<text class="">积分:</text>
|
<text class="">积分:</text>
|
||||||
<text class="color-main">{{item.totalScore}}</text>
|
<text class="color-main">{{item.accountPoints}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -91,7 +93,7 @@
|
|||||||
headImg: '',
|
headImg: '',
|
||||||
telephone: '',
|
telephone: '',
|
||||||
amount: '0.00',
|
amount: '0.00',
|
||||||
totalScore: '0.00'
|
accountPoints: '0.00'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
list[index].checked = true
|
list[index].checked = true
|
||||||
@@ -107,16 +109,16 @@
|
|||||||
isVip: 1
|
isVip: 1
|
||||||
})
|
})
|
||||||
const list = reactive([])
|
const list = reactive([])
|
||||||
let hasAjax=ref(false)
|
let hasAjax = ref(false)
|
||||||
async function getUser() {
|
async function getUser() {
|
||||||
const {
|
const {
|
||||||
content,
|
content,
|
||||||
totalElements
|
totalElements
|
||||||
} = await Api.queryAllShopUser(query)
|
} = await Api.queryAllShopUser(query)
|
||||||
hasAjax.value=true
|
hasAjax.value = true
|
||||||
list.length=content.length
|
list.length = content.length
|
||||||
for (let i in content) {
|
for (let i in content) {
|
||||||
list[i]={
|
list[i] = {
|
||||||
...content[i],
|
...content[i],
|
||||||
checked: false
|
checked: false
|
||||||
}
|
}
|
||||||
@@ -126,7 +128,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pageChange(e) {
|
function pageChange(e) {
|
||||||
query.page=e
|
query.page = e
|
||||||
getUser()
|
getUser()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,15 +17,17 @@
|
|||||||
<!-- <view class="headeimg">
|
<!-- <view class="headeimg">
|
||||||
<image class="img" :src="user.headImg" mode=""></image>
|
<image class="img" :src="user.headImg" mode=""></image>
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="u-m-l-20">{{user.nickName}}</view>
|
<view class="u-m-l-20">
|
||||||
<view class="color-main u-m-l-10 u-font-24">{{user.isVip?'会员':'' }}</view>
|
<!-- <view class="color-main u-font-24 no-wrap">{{user.isVip?'会员':'' }}</view> -->
|
||||||
<view class="u-font-24 u-m-l-30"><text>余额:</text><text
|
<view class="">{{user.nickName}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-font-24 u-m-l-30 u-text-center"><text>余额:</text><text
|
||||||
class="color-main">{{user.amount}}</text>
|
class="color-main">{{user.amount}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-font-24 u-m-l-30"><text>积分:</text><text
|
<view class="u-font-24 u-m-l-30 u-text-center"><text>积分:</text><text
|
||||||
class="color-main">{{user.totalScore}}</text></view>
|
class="color-main">{{user.accountPoints}}</text></view>
|
||||||
</view>
|
</view>
|
||||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
<uni-icons type="right" color="#999" size="20" bold></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class=" ">
|
<view class=" ">
|
||||||
@@ -85,11 +87,11 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view>积分</view>
|
<view>积分</view>
|
||||||
<view class="color-333 u-m-l-10"> {{user.totalScore}}</view>
|
<view class="color-333 u-m-l-10"> {{user.accountPoints}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view>已消费</view>
|
<view class="u-text-center">订单数量</view>
|
||||||
<view class="color-333 u-m-l-10"> 0.00</view>
|
<view class="color-333 u-m-l-10">{{user.orderNumber||0}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -160,10 +162,29 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="font-bold">
|
<view class=" u-relative">
|
||||||
<text>¥</text>
|
<template v-if="item.isGift">
|
||||||
<text v-if="item.isGift">0</text>
|
<text class="line-th color-999">¥{{formatPrice(item.salePrice*item.number) }}</text>
|
||||||
<text v-else>{{formatPrice(item.salePrice*item.number) }}</text>
|
<view class="u-absolute" style="right: 0;bottom: 100%;">
|
||||||
|
<text class="font-bold">¥0</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<template v-if="isVip&&item.memberPrice&&item.memberPrice*1!=item.salePrice*1">
|
||||||
|
<text
|
||||||
|
class="line-th color-999">¥{{formatPrice(item.salePrice*item.number) }}</text>
|
||||||
|
<view class="u-absolute" style="right: 0;bottom: 100%;">
|
||||||
|
<text class="font-bold">¥{{formatPrice(item.memberPrice*item.number) }}</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="font-bold">
|
||||||
|
<text>¥</text>
|
||||||
|
<text class="">{{formatPrice(item.salePrice*item.number) }}</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<view class="color-999 u-text-right u-font-24 u-m-t-12">×{{item.number}}</view>
|
<view class="color-999 u-text-right u-font-24 u-m-t-12">×{{item.number}}</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -220,10 +241,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<view class="u-flex u-row-right u-m-t-38">
|
<view class="u-flex u-row-between u-m-t-38">
|
||||||
<!-- <template v-if="$shop.registerType=='munchies'">
|
<!-- <template v-if="$shop.registerType=='munchies'">
|
||||||
<view class="color-main" @tap="showModel('editMoney')">修改</view>
|
<view class="color-main" @tap="showModel('editMoney')">修改</view>
|
||||||
</template> -->
|
</template> -->
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="u-flex price" v-if="youhui*1>0">
|
||||||
|
<view class="">优惠金额</view>
|
||||||
|
<view class="font-bold u-font-32">¥{{formatPrice(youhui) }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="u-flex price u-m-l-32">
|
<view class="u-flex price u-m-l-32">
|
||||||
<view class="">实收金额</view>
|
<view class="">实收金额</view>
|
||||||
<view class="font-bold u-font-32">¥{{formatPrice(allPrice) }}</view>
|
<view class="font-bold u-font-32">¥{{formatPrice(allPrice) }}</view>
|
||||||
@@ -342,10 +370,10 @@
|
|||||||
console.log($shop.value);
|
console.log($shop.value);
|
||||||
const maxCapacity = table.value.tableId ? (table.value.maxCapacity || 0) : 100
|
const maxCapacity = table.value.tableId ? (table.value.maxCapacity || 0) : 100
|
||||||
if (table.value.tableId && userNumbers.defaultCateIndex * 1 + 1 > maxCapacity) {
|
if (table.value.tableId && userNumbers.defaultCateIndex * 1 + 1 > maxCapacity) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '当前台桌最大人数为: ' + maxCapacity
|
title: '当前台桌最大人数为: ' + maxCapacity
|
||||||
})
|
})
|
||||||
userNumbers.defaultCateIndex=maxCapacity-1
|
userNumbers.defaultCateIndex = maxCapacity - 1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!$shop.value.isTableFee && table.value.tableId) {
|
if (!$shop.value.isTableFee && table.value.tableId) {
|
||||||
@@ -492,10 +520,13 @@
|
|||||||
totalNumber: 0,
|
totalNumber: 0,
|
||||||
totalAmount: 0,
|
totalAmount: 0,
|
||||||
})
|
})
|
||||||
|
const isVip=computed(()=>{
|
||||||
|
return $shop.value.isMemberPrice&& user.value&&user.value.id&&user.value.isVip
|
||||||
|
})
|
||||||
const goodsPrice = computed(() => {
|
const goodsPrice = computed(() => {
|
||||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||||
const tPrice = cur.salePrice * cur.number
|
const memberPrice=cur.memberPrice?cur.memberPrice:cur.salePrice
|
||||||
console.log(cur.isPack);
|
const tPrice = (isVip.value? memberPrice:cur.salePrice) * cur.number
|
||||||
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
||||||
return prve + (cur.isGift ? 0 : tPrice) + tpackFee
|
return prve + (cur.isGift ? 0 : tPrice) + tpackFee
|
||||||
}, 0)
|
}, 0)
|
||||||
@@ -510,6 +541,19 @@
|
|||||||
// }, 0)
|
// }, 0)
|
||||||
// return (goodsTotalPrice + ($seatFee.totalAmount || 0)).toFixed(2)
|
// return (goodsTotalPrice + ($seatFee.totalAmount || 0)).toFixed(2)
|
||||||
})
|
})
|
||||||
|
const youhui=computed(()=>{
|
||||||
|
if(user.value&&user.value.id&&user.value.isVip){
|
||||||
|
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||||
|
const tPrice = cur.salePrice * cur.number
|
||||||
|
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
||||||
|
return prve + tPrice + tpackFee
|
||||||
|
}, 0)
|
||||||
|
return goodsTotalPrice-allPrice.value
|
||||||
|
}else{
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return goodsTotalPrice
|
||||||
|
})
|
||||||
|
|
||||||
function setGoodsItem(key, val) {
|
function setGoodsItem(key, val) {
|
||||||
item[key] = val
|
item[key] = val
|
||||||
@@ -529,12 +573,17 @@
|
|||||||
records,
|
records,
|
||||||
seatFee
|
seatFee
|
||||||
} = await Api.getCart(par)
|
} = await Api.getCart(par)
|
||||||
|
let useType=''
|
||||||
if (seatFee && seatFee.useType) {
|
if (seatFee && seatFee.useType) {
|
||||||
$storageManage.useType(seatFee.useType)
|
useType=seatFee.useType
|
||||||
// uni.setStorageSync('useType',seatFee.useType);
|
$storageManage.useType(useType)
|
||||||
eatTypes.active = seatFee.useType == 'takeout' ? seatFee.useType : seatFee.useType.replace(
|
}else{
|
||||||
/-after|-before/g, '');
|
useType=records[0].info[0].useType
|
||||||
|
$storageManage.useType(useType)
|
||||||
}
|
}
|
||||||
|
console.log(useType);
|
||||||
|
eatTypes.active =useType == 'takeout' ? useType : useType.replace(
|
||||||
|
/-after|-before/g, '');
|
||||||
goods.list = getNowCart(records)
|
goods.list = getNowCart(records)
|
||||||
if (seatFee && seatFee.totalNumber) {
|
if (seatFee && seatFee.totalNumber) {
|
||||||
userNumbers.defaultCateIndex = seatFee.totalNumber - 1 || 0
|
userNumbers.defaultCateIndex = seatFee.totalNumber - 1 || 0
|
||||||
@@ -653,7 +702,7 @@
|
|||||||
tableId: opt.tableId || '',
|
tableId: opt.tableId || '',
|
||||||
name: opt.name
|
name: opt.name
|
||||||
}
|
}
|
||||||
userNumbers.list = new Array(opt.maxCapacity?opt.maxCapacity*1:100).fill(1).map((v, index) => {
|
userNumbers.list = new Array(opt.maxCapacity ? opt.maxCapacity * 1 : 100).fill(1).map((v, index) => {
|
||||||
return (index + 1) + '人'
|
return (index + 1) + '人'
|
||||||
})
|
})
|
||||||
// console.log(userNumbers.list);
|
// console.log(userNumbers.list);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<view class="u-font-24 u-m-l-30"><text>余额:</text><text
|
<view class="u-font-24 u-m-l-30"><text>余额:</text><text
|
||||||
class="color-main">{{data.vipUser.amount}}</text></view>
|
class="color-main">{{data.vipUser.amount}}</text></view>
|
||||||
<view class="u-font-24 u-m-l-30"><text>积分:</text><text
|
<view class="u-font-24 u-m-l-30"><text>积分:</text><text
|
||||||
class="color-main">{{data.vipUser.totalScore}}</text></view>
|
class="color-main">{{data.vipUser.accountPoints}}</text></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
@@ -242,7 +242,7 @@
|
|||||||
itemId: '', // 栏目右边scroll-view用于滚动的id
|
itemId: '', // 栏目右边scroll-view用于滚动的id
|
||||||
tabbar: storageManage.cacheGoods() || [],
|
tabbar: storageManage.cacheGoods() || [],
|
||||||
menuItemPos: [],
|
menuItemPos: [],
|
||||||
arr: storageManage.cacheGoodsNode() || [], //左右联动布局节点信息
|
arr: [], //左右联动布局节点信息
|
||||||
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
|
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
|
||||||
timer: null, // 定时器
|
timer: null, // 定时器
|
||||||
topZhanwei: 136 + 24,
|
topZhanwei: 136 + 24,
|
||||||
@@ -269,6 +269,14 @@
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function returnUrlPar(str) {
|
||||||
|
let arr = str.split("?")[1].split("&"); //先通过?分解得到?后面的所需字符串,再将其通过&分解开存放在数组里
|
||||||
|
let obj = {};
|
||||||
|
for (let i of arr) {
|
||||||
|
obj[i.split("=")[0]] = i.split("=")[1]; //对数组每项用=分解开,=前为对象属性名,=后为属性值
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
function scanCode() {
|
function scanCode() {
|
||||||
// 只允许通过相机扫码
|
// 只允许通过相机扫码
|
||||||
@@ -278,6 +286,24 @@
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log('条码类型:' + res.scanType);
|
console.log('条码类型:' + res.scanType);
|
||||||
console.log('条码内容:' + res.result);
|
console.log('条码内容:' + res.result);
|
||||||
|
if (res.result.includes('codeplate?code=')) {
|
||||||
|
const par = returnUrlPar(res.result)
|
||||||
|
const tableId = par.code
|
||||||
|
console.log('par');
|
||||||
|
console.log(par);
|
||||||
|
onChooseTable({
|
||||||
|
tableId
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'error',
|
||||||
|
title: '请扫描正确的桌台码'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// uni.showModal({
|
||||||
|
// title:'',
|
||||||
|
// content:res.result
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -329,8 +355,10 @@
|
|||||||
return v.foods.length
|
return v.foods.length
|
||||||
})
|
})
|
||||||
data.tabbar = tabbar
|
data.tabbar = tabbar
|
||||||
|
nextTick(() => {
|
||||||
|
getMenuItemTop()
|
||||||
|
})
|
||||||
storageManage.cacheGoods(data.tabbar)
|
storageManage.cacheGoods(data.tabbar)
|
||||||
getMenuItemTop()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -448,17 +476,20 @@
|
|||||||
})
|
})
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if (res && res.content[0]) {
|
if (res && res.content[0]) {
|
||||||
data.table={...res.content[0],...data.table}
|
data.table = {
|
||||||
|
...res.content[0],
|
||||||
|
...data.table
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let $originGoods = []
|
let $originGoods = []
|
||||||
let $category = []
|
let $category = []
|
||||||
async function init() {
|
async function init() {
|
||||||
if(option.type=='add'){
|
if (option.type == 'add') {
|
||||||
data.masterId = option.masterId
|
data.masterId = option.masterId
|
||||||
setTabBar($category, $originGoods, [])
|
setTabBar($category, $originGoods, [])
|
||||||
}else{
|
} else {
|
||||||
const masterRes = await getMasterId()
|
const masterRes = await getMasterId()
|
||||||
data.masterId = masterRes.masterId
|
data.masterId = masterRes.masterId
|
||||||
}
|
}
|
||||||
@@ -488,7 +519,7 @@
|
|||||||
});
|
});
|
||||||
$originGoods = goods
|
$originGoods = goods
|
||||||
console.log(option);
|
console.log(option);
|
||||||
if(option.type=='add'){
|
if (option.type == 'add') {
|
||||||
cars.length = 0
|
cars.length = 0
|
||||||
setTabBar(category, goods, [])
|
setTabBar(category, goods, [])
|
||||||
return
|
return
|
||||||
@@ -586,29 +617,56 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function onChooseTable(item) {
|
||||||
|
console.log('onChooseTable');
|
||||||
|
const res = await $returnTableDetail({
|
||||||
|
tableId: item.tableId,
|
||||||
|
});
|
||||||
|
if (!res) {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '桌台不存在或不是该店铺的桌台'
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
// #ifndef MP-WEIXIN
|
||||||
|
infoBox.showToast('桌台不存在或不是该店铺的桌台')
|
||||||
|
// #endif
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log('---table:detail-----');
|
||||||
|
console.log(res);
|
||||||
|
if (data.table.tableId || cars.length <= 0) {
|
||||||
|
data.table = {
|
||||||
|
...res,
|
||||||
|
...item
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (res.status == "unbind") {
|
||||||
|
return infoBox.showToast('该台桌未绑定,清先去桌台管理里绑定码牌')
|
||||||
|
}
|
||||||
|
if (res.status != "idle") {
|
||||||
|
return infoBox.showToast('该台桌已在使用中')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.cartCount > 0) {
|
||||||
|
setModalShow('clear', true, item)
|
||||||
|
} else {
|
||||||
|
await $choseTable({
|
||||||
|
masterId: data.masterId,
|
||||||
|
tableId: item.tableId,
|
||||||
|
isClear: false
|
||||||
|
});
|
||||||
|
data.table = item
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function watchChooseTable() {
|
function watchChooseTable() {
|
||||||
uni.$off('choose-table')
|
uni.$off('choose-table')
|
||||||
uni.$on('choose-table', async (item) => {
|
uni.$on('choose-table', (item) => {
|
||||||
if (data.table.tableId || cars.length <= 0) {
|
onChooseTable(item)
|
||||||
data.table = item
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (item.status != "idle") {
|
|
||||||
return infoBox.showToast('该台桌已在使用中')
|
|
||||||
}
|
|
||||||
const res = await $returnTableDetail({
|
|
||||||
tableId: item.tableId,
|
|
||||||
});
|
|
||||||
if (res.cartCount > 0) {
|
|
||||||
setModalShow('clear', true, item)
|
|
||||||
} else {
|
|
||||||
await $choseTable({
|
|
||||||
masterId: data.masterId,
|
|
||||||
tableId: item.tableId,
|
|
||||||
isClear:false
|
|
||||||
});
|
|
||||||
data.table = item
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1045,12 +1103,14 @@
|
|||||||
}, 10);
|
}, 10);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let arr = []
|
||||||
rects.forEach((rect) => {
|
rects.forEach((rect) => {
|
||||||
// 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况)
|
// 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况)
|
||||||
data.arr.push(rect.top - rects[0].top);
|
arr.push(rect.top - rects[0].top);
|
||||||
storageManage.cacheGoodsNode(data.arr)
|
|
||||||
resolve();
|
|
||||||
})
|
})
|
||||||
|
data.arr = arr
|
||||||
|
console.log(data.arr);
|
||||||
|
resolve();
|
||||||
}).exec()
|
}).exec()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1102,7 +1162,7 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
watch(() => data.table.tableId, (newval, oldval) => {
|
watch(() => data.table.tableId, (newval, oldval) => {
|
||||||
if(option.type!='add'){
|
if (option.type != 'add') {
|
||||||
onSelTable()
|
onSelTable()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="packeFee>0||data.priceAmount>0">
|
<view class="default-box-padding bg-fff border-r-12 u-m-t-20"
|
||||||
|
v-if="packeFee>0||data.priceAmount>0||data.returnAmount>0">
|
||||||
<view class="u-flex u-row-between">
|
<view class="u-flex u-row-between">
|
||||||
<view class="font-bold">附加费</view>
|
<view class="font-bold">附加费</view>
|
||||||
<template v-if="extraCanTuicai(orderInfo,data)">
|
<template v-if="extraCanTuicai(orderInfo,data)">
|
||||||
@@ -14,7 +15,7 @@
|
|||||||
<view class="u-flex u-row-between u-m-t-24" v-if="data.priceAmount*1>0">
|
<view class="u-flex u-row-between u-m-t-24" v-if="data.priceAmount*1>0">
|
||||||
<view>{{data.productName||'餐位费'}}</view>
|
<view>{{data.productName||'餐位费'}}</view>
|
||||||
<view>x{{data.num||0}}</view>
|
<view>x{{data.num||0}}</view>
|
||||||
<view class="price-min-width">¥{{data.priceAmount}}</view>
|
<view class="price-min-width">¥{{seatFeePrice}}</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
@@ -24,7 +25,8 @@
|
|||||||
<view class="tag yitui u-m-l-10">{{data.status=='refunding'?'退款中': '已退'}}</view>
|
<view class="tag yitui u-m-l-10">{{data.status=='refunding'?'退款中': '已退'}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="line-th">x{{data.num||0}}</view>
|
<view class="line-th">x{{data.num||0}}</view>
|
||||||
<view class="line-th">¥{{data.priceAmount}}</view>
|
<view class="line-th">¥{{seatFeePrice}}</view>
|
||||||
|
<!-- <view class="line-th">¥{{data.priceAmount||data.returnAmount}}</view> -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<!-- <view class="u-flex u-row-right u-m-t-24">
|
<!-- <view class="u-flex u-row-right u-m-t-24">
|
||||||
@@ -50,24 +52,30 @@
|
|||||||
computed
|
computed
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import {
|
import {
|
||||||
returnCanComputedGoodsArr,canComputedPackFee,
|
returnCanComputedGoodsArr,
|
||||||
returnPackFee
|
canComputedPackFee,
|
||||||
|
returnPackFee,isTui,
|
||||||
|
isTuiCai,
|
||||||
|
isGift,
|
||||||
|
canTuiKuan,
|
||||||
|
canTuicai,
|
||||||
|
numSum
|
||||||
} from '@/commons/utils/goodsUtil.js'
|
} from '@/commons/utils/goodsUtil.js'
|
||||||
function extraCanTuicai(orderInfo,data){
|
|
||||||
return orderInfo.status=='unpaid'&&data.status!='return'&&data.priceAmount*1>0
|
|
||||||
}
|
|
||||||
function extraCanTuiKuan(orderInfo,data){
|
|
||||||
return orderInfo.status=='closed'&&data.status!='return'&&data.priceAmount*1>0
|
|
||||||
}
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {
|
||||||
|
return {
|
||||||
|
priceAmount: 0,
|
||||||
|
returnAmount: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
orderInfo: {
|
orderInfo: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {
|
return {
|
||||||
|
amount: 0,
|
||||||
detailList: []
|
detailList: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,6 +85,35 @@
|
|||||||
default: () => {}
|
default: () => {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const canTuiKuanPrice = computed(() => {
|
||||||
|
return props.orderInfo.detailList.filter(v =>!isTui(v)&& !v.userCouponId)
|
||||||
|
.reduce((a, b) => {
|
||||||
|
return a + b.priceAmount * 1
|
||||||
|
}, 0)
|
||||||
|
})
|
||||||
|
const seatFeePrice = computed(() => {
|
||||||
|
const item = props.data
|
||||||
|
if (props.data.returnAmount) {
|
||||||
|
return props.data.returnAmount
|
||||||
|
}
|
||||||
|
console.log(item);
|
||||||
|
if (props.orderInfo.pointsDiscountAmount > 0 || props.orderInfo.fullCouponDiscountAmount > 0) {
|
||||||
|
return item.canReturnAmount
|
||||||
|
// const shengyuKeTui=canTuiKuanPrice.value
|
||||||
|
// const bili = Math.floor((item.priceAmount / shengyuKeTui) * 100) / 100
|
||||||
|
// return Math.floor((props.orderInfo.amount-props.orderInfo.refundAmount) * bili * 100) / 100
|
||||||
|
} else {
|
||||||
|
return item.priceAmount
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function extraCanTuicai(orderInfo, data) {
|
||||||
|
return orderInfo.status == 'unpaid' && data.status != 'return' && data.priceAmount * 1 > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function extraCanTuiKuan(orderInfo, data) {
|
||||||
|
return orderInfo.status == 'closed' && data.status != 'refund' && data.priceAmount * 1 > 0
|
||||||
|
}
|
||||||
const packeNumbber = computed(() => {
|
const packeNumbber = computed(() => {
|
||||||
if (!props.orderInfo.detailList) {
|
if (!props.orderInfo.detailList) {
|
||||||
return 0
|
return 0
|
||||||
@@ -104,7 +141,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function tuikuan() {
|
function tuikuan() {
|
||||||
emits('tuikuan', props.data)
|
emits('tuikuan', {...props.data,priceAmount:props.data.canReturnAmount})
|
||||||
}
|
}
|
||||||
|
|
||||||
function tuicai() {
|
function tuicai() {
|
||||||
|
|||||||
548
pagesOrder/detail/components/list - 副本.vue
Normal file
548
pagesOrder/detail/components/list - 副本.vue
Normal file
@@ -0,0 +1,548 @@
|
|||||||
|
<template>
|
||||||
|
<view class="default-box-padding bg-fff border-r-24 u-m-t-32" v-if="data.length">
|
||||||
|
<view class=" font-bold u-p-b-32 border-bottom u-m-b-24" v-if="orderInfo.tableName">
|
||||||
|
<text class="">桌号:</text>
|
||||||
|
<text class="">{{orderInfo.tableName||""}}</text>
|
||||||
|
</view>
|
||||||
|
<view class=" color-999 border-bottom u-p-b-24">
|
||||||
|
<text>共</text>
|
||||||
|
<text class="color-333 "> {{goodsNumber}}</text>
|
||||||
|
<text>份菜品</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-b-20 " v-for="(order,orderIndex) in data" :key="orderIndex">
|
||||||
|
<view class="u-p-t-24"> 第{{ order.placeNum }}次下单
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-24 list">
|
||||||
|
<view class="item u-m-b-32" v-for="(item,index) in order.info" :key="index">
|
||||||
|
<view class="u-flex u-col-top">
|
||||||
|
<view class="u-flex">
|
||||||
|
<image class="img" :src="item.coverImg||item.productImg" mode=""></image>
|
||||||
|
</view>
|
||||||
|
<view class="u-p-l-32 u-flex-1">
|
||||||
|
<view class="u-flex u-row-between u-col-top">
|
||||||
|
|
||||||
|
<view class="">
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="tui" v-if="isTui(item)">
|
||||||
|
{{item.status=='refunding'?'退款中':'已退'}}
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
:class="{'line-th':item.status=='return'||item.status=='refund'||item.status=='refunding'}">
|
||||||
|
{{item.name||item.productName}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-m-t-8">
|
||||||
|
<view class="u-m-r-20 u-flex " v-if="item.gift">
|
||||||
|
<uni-tag text="赠送"
|
||||||
|
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||||
|
</uni-tag>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-r-20 u-flex " v-if="item.userCouponId">
|
||||||
|
<uni-tag :text=" productCouponDikou(item)"
|
||||||
|
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||||
|
</uni-tag>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-r-20 u-flex" v-if="item.pack">
|
||||||
|
<uni-tag
|
||||||
|
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||||
|
size="small" text="打包" inverted type="success" />
|
||||||
|
</view>
|
||||||
|
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnAmount">
|
||||||
|
<view class="color-666">退款金额:</view>
|
||||||
|
<view class="color-999 u-m-l-6">{{item.returnAmount}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="color-999 u-font-24 u-m-t-8">{{item.productSkuName||''}}</view>
|
||||||
|
|
||||||
|
|
||||||
|
<view class="u-m-t-12 color-666 u-font-24" v-if="item.note">
|
||||||
|
备注:{{item.note}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-text-right u-m-t-28">
|
||||||
|
<template v-if="isTui(item)">
|
||||||
|
<view>¥0.00</view>
|
||||||
|
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="isGift(item)||item.userCouponId">
|
||||||
|
<view>¥0.00</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 class=" color-666 line-th">
|
||||||
|
¥{{returnTotalMoney(item)}}</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view>¥{{returnTotalMoney(item)}}</view>
|
||||||
|
</template>
|
||||||
|
<!-- <template
|
||||||
|
v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
|
||||||
|
<view>¥{{returnVipMoney(item)}}</view>
|
||||||
|
<view class=" color-666 line-th">
|
||||||
|
¥{{returnTotalMoney(item)}}</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view>¥{{returnTotalMoney(item)}}</view>
|
||||||
|
</template> -->
|
||||||
|
</template>
|
||||||
|
<view class="u-m-t-22 color-999 u-font-24">X{{item.number||item.num}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="canTuicai(orderInfo,item)">
|
||||||
|
<view class="u-flex u-row-right gap-20 u-m-t-24">
|
||||||
|
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
|
||||||
|
<my-button :width="128" :height="48" plain shape="circle" @tap="tuicai(item,index)"><text
|
||||||
|
class="no-wrap">退菜</text></my-button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-if="canTuiKuan(orderInfo,item)">
|
||||||
|
<view class="u-flex u-row-right gap-20 u-m-t-20">
|
||||||
|
<my-button :width="128" :height="48" plain shape="circle" @tap="tuikuan(item,index)"><text
|
||||||
|
class="no-wrap">{{item.userCouponId?'退券':'退款' }}</text> </my-button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="bg-gray u-p-20 u-m-t-20" v-if="orderInfo.remark">
|
||||||
|
<view>备注</view>
|
||||||
|
<view class="u-m-t-10">{{orderInfo.remark}}</view>
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="u-flex u-row-between border-top u-p-t-32">
|
||||||
|
<view>
|
||||||
|
<template v-if="orderInfo.status=='unpaid'">
|
||||||
|
<view class="tag no-pay">
|
||||||
|
未支付
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-if="orderInfo.status=='refund'">
|
||||||
|
<view class="tag refund">
|
||||||
|
退款成功
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="u-flex u-m-r-24" v-if="youhuiAllPrice>0">
|
||||||
|
<view class="color-red u-m-r-6 ">
|
||||||
|
已优惠¥{{youhuiAllPrice}}
|
||||||
|
</view>
|
||||||
|
<up-icon name="info-circle" color="#999" :size="14" @click="youhuiDetailShow"></up-icon>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view>
|
||||||
|
<text>小计¥</text>
|
||||||
|
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<template v-if="orderInfo.refundAmount">
|
||||||
|
<view class="u-flex u-row-between u-m-t-32">
|
||||||
|
<view>退款金额</view>
|
||||||
|
<view class="color-999">
|
||||||
|
<text class="">{{(orderInfo.refundAmount).toFixed(2)}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-32">
|
||||||
|
<view>退款原因</view>
|
||||||
|
<view class="color-999">
|
||||||
|
<text class="">{{orderInfo.refundRemark||''}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-32 u-p-b-24 border-bottom">
|
||||||
|
<view></view>
|
||||||
|
<view class="">
|
||||||
|
<text class="">退款成功</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<view class="u-flex u-row-between u-m-t-20">
|
||||||
|
<view></view>
|
||||||
|
<view>
|
||||||
|
<text>总计¥</text>
|
||||||
|
<text class="font-bold u-font-32">{{to2(allPrice*1+seatFeePrice*1+packFee*1) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-20" v-if="orderInfo.status=='closed'">
|
||||||
|
<view></view>
|
||||||
|
<view>
|
||||||
|
<text>实付¥</text>
|
||||||
|
<text class="font-bold u-font-32">{{to2(orderInfo.amount) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="u-flex u-row-between u-m-t-20">
|
||||||
|
<view></view>
|
||||||
|
<view>
|
||||||
|
<text>原价¥</text>
|
||||||
|
<text class="font-bold u-font-32">{{to2(orderInfo.originAmount||0) }}</text>
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
|
<view class="u-m-t-24">
|
||||||
|
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<up-popup :round="10" :show="pop.youhui" mode="center" closeOnClickOverlay @close="youhuiDetailHide">
|
||||||
|
<view class="u-p-30" style="width: 80vw;">
|
||||||
|
<view class="font-bold u-text-center">优惠详情</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="u-flex u-row-between u-m-b-18" v-if="vipDiscountPrice*1>0">
|
||||||
|
<view>会员优惠</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text>{{vipDiscountPrice}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-b-18" v-if="discountAmount">
|
||||||
|
<view>打折</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text>{{to2(discountAmount) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between " v-if="orderInfo.fullCouponDiscountAmount*1>0">
|
||||||
|
<view>满减券抵扣</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-18" v-if="productCouponDiscountAmount*1>0">
|
||||||
|
<view>商品券抵扣</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text> {{productCouponDiscountAmount }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="u-flex u-row-between u-m-t-18"
|
||||||
|
v-if="orderInfo.productCouponDiscountAmount||productCoupPrice*1>0">
|
||||||
|
<view>商品券抵扣</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text> {{to2(orderInfo.productCouponDiscountAmount||productCoupPrice) }}</text>
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
|
<view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.pointsDiscountAmount">
|
||||||
|
<view>积分抵扣</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text>{{to2(orderInfo.pointsDiscountAmount) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</up-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
computed,
|
||||||
|
reactive
|
||||||
|
} from 'vue';
|
||||||
|
import color from '@/commons/color.js'
|
||||||
|
import {
|
||||||
|
hasPermission
|
||||||
|
} from '@/commons/utils/hasPermission.js'
|
||||||
|
import {
|
||||||
|
isTui,
|
||||||
|
isTuiCai,
|
||||||
|
isGift,
|
||||||
|
canTuiKuan,
|
||||||
|
canTuicai,
|
||||||
|
numSum
|
||||||
|
} from '@/commons/utils/goodsUtil.js'
|
||||||
|
const pop = reactive({
|
||||||
|
youhui: false
|
||||||
|
})
|
||||||
|
|
||||||
|
function youhuiDetailShow() {
|
||||||
|
pop.youhui = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function productCouponDikou(item) {
|
||||||
|
return '商品券抵扣¥' + returnProductCoupPrice(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
function youhuiDetailHide() {
|
||||||
|
pop.youhui = false
|
||||||
|
}
|
||||||
|
const props = defineProps({
|
||||||
|
orderInfo: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
seatFee: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {
|
||||||
|
id: '',
|
||||||
|
isVip: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function returnProductCoupPrice(item) {
|
||||||
|
if (!item.isMember) {
|
||||||
|
return item.price * item.num
|
||||||
|
}
|
||||||
|
const price = item.memberPrice ? item.memberPrice : item.price
|
||||||
|
return price * item.num
|
||||||
|
}
|
||||||
|
const productCouponDiscountAmount = computed(() => {
|
||||||
|
// if(props.orderInfo.productCouponDiscountAmount){
|
||||||
|
// return orderInfo.productCouponDiscountAmount.toFixed(2)
|
||||||
|
// }
|
||||||
|
if (!props.data.length) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
const n = props.data.reduce((prve, cur) => {
|
||||||
|
const curTotal = cur.info.filter(v => v.userCouponId).reduce((a, b) => {
|
||||||
|
return a + returnProductCoupPrice(b)
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
console.log(n);
|
||||||
|
return n.toFixed(2)
|
||||||
|
})
|
||||||
|
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
|
||||||
|
|
||||||
|
function returnVipMoney(item) {
|
||||||
|
if (!item.memberPrice || !props.user.isVip) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return (item.memberPrice * item.num).toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
function returnTotalMoney(item) {
|
||||||
|
return (item.price * item.num).toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
const canTuiKuanPrice = computed(() => {
|
||||||
|
return props.data.reduce((prve,cur)=>{
|
||||||
|
// const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
|
||||||
|
// return a+b.priceAmount*1
|
||||||
|
// },0)
|
||||||
|
const curTotal=cur.info.filter(v=>canTuiKuan(props.orderInfo,v)&&!v.userCouponId).reduce((a,b)=>{
|
||||||
|
return a+b.priceAmount*1
|
||||||
|
},0)
|
||||||
|
return prve+curTotal
|
||||||
|
},0)
|
||||||
|
})
|
||||||
|
function returnCanTuiMoney(item) {
|
||||||
|
console.log(canTuiKuanPrice.value);
|
||||||
|
if(props.orderInfo.status=='unpaid'){
|
||||||
|
return returnTotalMoney(item)
|
||||||
|
}else{
|
||||||
|
return (item.priceAmount/(canTuiKuanPrice.value+seatFeePrice.value*1)*props.orderInfo.amount).toFixed(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function to2(n) {
|
||||||
|
if (!n) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return n.toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
function tuicai(item, index) {
|
||||||
|
emits('tuicai', item, index)
|
||||||
|
}
|
||||||
|
|
||||||
|
function tuikuan(item, index) {
|
||||||
|
hasPermission('允许退款').then(res => {
|
||||||
|
if (res) {
|
||||||
|
emits('tuikuan', {...item,priceAmount:returnCanTuiMoney(item)}, index)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function printOrder() {
|
||||||
|
emits('printOrder')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const seatFeePrice = computed(() => {
|
||||||
|
if (!props.seatFee.priceAmount) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
const n = props.seatFee.priceAmount * (isTui(props.seatFee) ? 0 : 1)
|
||||||
|
return n.toFixed(2)
|
||||||
|
})
|
||||||
|
const discountAmount = computed(() => {
|
||||||
|
if (props.orderInfo.discountAmount) {
|
||||||
|
return props.orderInfo.discountAmount
|
||||||
|
}
|
||||||
|
console.log(props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio));
|
||||||
|
return (props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio))
|
||||||
|
})
|
||||||
|
const goodsOriginAllPrice = computed(() => {
|
||||||
|
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||||
|
const curTotal = cur.info.reduce((a,
|
||||||
|
b) => {
|
||||||
|
return a + (b.num * b.price)
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
return goodsPrice.toFixed(2)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const freePrice = computed(() => {
|
||||||
|
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||||
|
const curTotal = cur.info.filter(v => v.gift == true || isGift(v)).reduce((a,
|
||||||
|
b) => {
|
||||||
|
const price = (b.isMember && b.memberPrice) ? b.memberPrice : b.price
|
||||||
|
return a + (b.num * price)
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
return goodsPrice.toFixed(2)
|
||||||
|
})
|
||||||
|
const vipDiscountPrice = computed(() => {
|
||||||
|
if (!props.user.isVip) {
|
||||||
|
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((
|
||||||
|
a,
|
||||||
|
b) => {
|
||||||
|
return a + (b.num * (b.price - b.memberPrice))
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
return goodsPrice.toFixed(2)
|
||||||
|
})
|
||||||
|
|
||||||
|
const productCoupPrice = computed(() => {
|
||||||
|
if (props.orderInfo.status == 'closed') {
|
||||||
|
return props.orderInfo.productCouponDiscountAmount
|
||||||
|
}
|
||||||
|
const goodsPrice = props.data.reduce((a, b) => {
|
||||||
|
const curTotal = b.info.filter(v => v.gift != true && v.userCouponId).reduce((prve,
|
||||||
|
cur) => {
|
||||||
|
const isVip = props.user.isVip && cur.isMember
|
||||||
|
const memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
|
||||||
|
const price = isVip ? memberPrice : cur.price
|
||||||
|
const curTotal = price * cur.num
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
return a + curTotal
|
||||||
|
}, 0)
|
||||||
|
return goodsPrice.toFixed(2)
|
||||||
|
})
|
||||||
|
|
||||||
|
const youhuiAllPrice = computed(() => {
|
||||||
|
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) => {
|
||||||
|
const curTotal = cur.info.filter(v => v.status !== "return").reduce((a,
|
||||||
|
b) => {
|
||||||
|
return a + b.packAmount
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
return goodsPrice.toFixed(2)
|
||||||
|
|
||||||
|
})
|
||||||
|
const allPrice = computed(() => {
|
||||||
|
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
|
||||||
|
return (n < 0 ? 0 : n).toFixed(2)
|
||||||
|
|
||||||
|
// if (props.orderInfo.status == 'unpaid') {
|
||||||
|
// const n = goodsOriginAllPrice.value - youhuiAllPrice.value
|
||||||
|
// return (n < 0 ? 0 : n).toFixed(2)
|
||||||
|
// }
|
||||||
|
// return props.orderInfo.amount
|
||||||
|
})
|
||||||
|
|
||||||
|
const goodsNumber = computed(() => {
|
||||||
|
let result = 0
|
||||||
|
result = props.data.reduce((a, b) => {
|
||||||
|
const bTotal = b.info.reduce((prve, cur) => {
|
||||||
|
return prve + (cur.number || cur.num) * 1;
|
||||||
|
}, 0);
|
||||||
|
return a + bTotal
|
||||||
|
}, 0)
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.img {
|
||||||
|
width: 152rpx;
|
||||||
|
height: 152rpx;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-top {
|
||||||
|
border-color: #F6F6F6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-r-24 {
|
||||||
|
border-radius: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-bottom {
|
||||||
|
// border-color: rgb(240, 240, 240);
|
||||||
|
border-color: #F6F6F6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line-th {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
padding: 4rpx 8rpx 2rpx 10rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
|
||||||
|
&.no-pay {
|
||||||
|
background-color: rgb(170, 170, 170);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.refund {
|
||||||
|
background-color: #FCE7E7;
|
||||||
|
padding: 8rpx 20rpx 6rpx 22rpx;
|
||||||
|
color: #EB4F4F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui {
|
||||||
|
background-color: rgb(239, 239, 239);
|
||||||
|
border-radius: 4rpx;
|
||||||
|
margin-right: 6rpx;
|
||||||
|
color: #666;
|
||||||
|
padding: 0 4rpx;
|
||||||
|
font-size: 20rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -26,7 +26,9 @@
|
|||||||
<view class="tui" v-if="isTui(item)">
|
<view class="tui" v-if="isTui(item)">
|
||||||
{{item.status=='refunding'?'退款中':'已退'}}
|
{{item.status=='refunding'?'退款中':'已退'}}
|
||||||
</view>
|
</view>
|
||||||
<view :class="{'line-th':item.status=='return'||item.status=='refund'||item.status=='refunding'}">{{item.name||item.productName}}
|
<view
|
||||||
|
:class="{'line-th':item.status=='return'||item.status=='refund'||item.status=='refunding'}">
|
||||||
|
{{item.name||item.productName}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-m-t-8">
|
<view class="u-flex u-m-t-8">
|
||||||
@@ -35,11 +37,20 @@
|
|||||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||||
</uni-tag>
|
</uni-tag>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="u-m-r-20 u-flex " v-if="item.userCouponId">
|
||||||
|
<uni-tag :text=" productCouponDikou(item)"
|
||||||
|
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||||
|
</uni-tag>
|
||||||
|
</view>
|
||||||
<view class="u-m-r-20 u-flex" v-if="item.pack">
|
<view class="u-m-r-20 u-flex" v-if="item.pack">
|
||||||
<uni-tag
|
<uni-tag
|
||||||
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||||
size="small" text="打包" inverted type="success" />
|
size="small" text="打包" inverted type="success" />
|
||||||
</view>
|
</view>
|
||||||
|
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnAmount">
|
||||||
|
<view class="color-666">退款金额:</view>
|
||||||
|
<view class="color-999 u-m-l-6">{{item.returnAmount}}</view>
|
||||||
|
</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.productSkuName||''}}</view>
|
||||||
|
|
||||||
@@ -54,8 +65,29 @@
|
|||||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="isGift(item)||item.userCouponId">
|
||||||
|
<view>¥0.00</view>
|
||||||
|
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<view>¥{{returnTotalMoney(item)}}</view>
|
<template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1">
|
||||||
|
<view>¥{{returnCanTuiMoney(item)}}</view>
|
||||||
|
<view class=" color-666 line-th">
|
||||||
|
¥{{returnTotalMoney(item)}}</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view>¥{{returnTotalMoney(item)}}</view>
|
||||||
|
</template>
|
||||||
|
<!-- <template
|
||||||
|
v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
|
||||||
|
<view>¥{{returnVipMoney(item)}}</view>
|
||||||
|
<view class=" color-666 line-th">
|
||||||
|
¥{{returnTotalMoney(item)}}</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view>¥{{returnTotalMoney(item)}}</view>
|
||||||
|
</template> -->
|
||||||
</template>
|
</template>
|
||||||
<view class="u-m-t-22 color-999 u-font-24">X{{item.number||item.num}}</view>
|
<view class="u-m-t-22 color-999 u-font-24">X{{item.number||item.num}}</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -70,10 +102,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="canTuiKuan(orderInfo,item)">
|
<template v-if="canTuiKuan(orderInfo,item)">
|
||||||
<view class="u-flex u-row-right gap-20 u-m-t-20">
|
<view class="u-flex u-row-right gap-20 u-m-t-20">
|
||||||
<my-button :width="128" :height="48" plain shape="circle"
|
<my-button :width="128" :height="48" plain shape="circle" @tap="tuikuan(item,index)"><text
|
||||||
@tap="tuikuan(item,index)"><text class="no-wrap">退款</text> </my-button>
|
class="no-wrap">{{item.userCouponId?'退券':'退款' }}</text> </my-button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@@ -99,13 +131,22 @@
|
|||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view>
|
<view class="u-flex">
|
||||||
<text>小计¥</text>
|
<view class="u-flex u-m-r-24" v-if="youhuiAllPrice>0">
|
||||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
<view class="color-red u-m-r-6 ">
|
||||||
|
已优惠¥{{youhuiAllPrice}}
|
||||||
|
</view>
|
||||||
|
<!-- <up-icon name="info-circle" color="#999" :size="14" @click="youhuiDetailShow"></up-icon> -->
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<text>小计¥</text>
|
||||||
|
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<template v-if="orderInfo.status=='refund'">
|
<template v-if="orderInfo.refundAmount">
|
||||||
<view class="u-flex u-row-between u-m-t-32">
|
<view class="u-flex u-row-between u-m-t-32">
|
||||||
<view>退款金额</view>
|
<view>退款金额</view>
|
||||||
<view class="color-999">
|
<view class="color-999">
|
||||||
@@ -127,34 +168,241 @@
|
|||||||
</template>
|
</template>
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
<view class="u-flex u-row-between u-m-t-20">
|
||||||
<view></view>
|
<view></view>
|
||||||
<view>
|
<template v-if="orderInfo.status=='unpaid'">
|
||||||
<text>总计¥</text>
|
<view>
|
||||||
<!-- <text class="font-bold u-font-32">{{numSum([allPrice,seatFeePrice,packFee]) }}</text> -->
|
<text>总计¥</text>
|
||||||
<text class="font-bold u-font-32">{{to2(allPrice*1+seatFeePrice*1+packFee*1) }}</text>
|
<text class="font-bold u-font-32">{{orderInfo.amount }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view>
|
||||||
|
<text>总计¥</text>
|
||||||
|
<text class="font-bold u-font-32">{{orderInfo.amount}}</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
<!-- <view class="u-flex u-row-between u-m-t-20" v-if="orderInfo.status=='closed'">
|
||||||
|
<view></view>
|
||||||
|
<view>
|
||||||
|
<text>实付¥</text>
|
||||||
|
<text class="font-bold u-font-32">{{to2(orderInfo.amount) }}</text>
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
|
<!-- <view class="u-flex u-row-between u-m-t-20">
|
||||||
|
<view></view>
|
||||||
|
<view>
|
||||||
|
<text>原价¥</text>
|
||||||
|
<text class="font-bold u-font-32">{{to2(orderInfo.originAmount||0) }}</text>
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
<view class="u-m-t-24">
|
<view class="u-m-t-24">
|
||||||
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
|
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<up-popup :round="10" :show="pop.youhui" mode="center" closeOnClickOverlay @close="youhuiDetailHide">
|
||||||
|
<view class="u-p-30" style="width: 80vw;">
|
||||||
|
<view class="font-bold u-text-center">优惠详情</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="u-flex u-row-between u-m-b-18" v-if="vipDiscountPrice*1>0">
|
||||||
|
<view>会员优惠</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text>{{vipDiscountPrice}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-b-18" v-if="discountAmount">
|
||||||
|
<view>打折</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text>{{to2(discountAmount) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between " v-if="orderInfo.fullCouponDiscountAmount*1>0">
|
||||||
|
<view>满减券抵扣</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-18" v-if="productCouponDiscountAmount*1>0">
|
||||||
|
<view>商品券抵扣</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text> {{productCouponDiscountAmount }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="u-flex u-row-between u-m-t-18"
|
||||||
|
v-if="orderInfo.productCouponDiscountAmount||productCoupPrice*1>0">
|
||||||
|
<view>商品券抵扣</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text> {{to2(orderInfo.productCouponDiscountAmount||productCoupPrice) }}</text>
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
|
<view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.pointsDiscountAmount">
|
||||||
|
<view>积分抵扣</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text>{{to2(orderInfo.pointsDiscountAmount) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</up-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
computed
|
computed,
|
||||||
|
reactive
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import color from '@/commons/color.js'
|
import color from '@/commons/color.js'
|
||||||
import {
|
import {
|
||||||
hasPermission
|
hasPermission
|
||||||
} from '@/commons/utils/hasPermission.js'
|
} from '@/commons/utils/hasPermission.js'
|
||||||
import {isTui,canTuiKuan,canTuicai,numSum} from '@/commons/utils/goodsUtil.js'
|
import {
|
||||||
|
isTui,
|
||||||
|
isTuiCai,
|
||||||
|
isGift,
|
||||||
|
canTuiKuan,
|
||||||
|
canTuicai,
|
||||||
|
numSum
|
||||||
|
} from '@/commons/utils/goodsUtil.js'
|
||||||
|
const pop = reactive({
|
||||||
|
youhui: false
|
||||||
|
})
|
||||||
|
|
||||||
|
function youhuiDetailShow() {
|
||||||
|
pop.youhui = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function productCouponDikou(item) {
|
||||||
|
return '商品券抵扣¥' + returnProductCoupPrice(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
function youhuiDetailHide() {
|
||||||
|
pop.youhui = false
|
||||||
|
}
|
||||||
|
const props = defineProps({
|
||||||
|
orderInfo: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
seatFee: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {
|
||||||
|
id: '',
|
||||||
|
isVip: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function returnProductCoupPrice(item) {
|
||||||
|
if (!item.isMember) {
|
||||||
|
return item.price * item.num
|
||||||
|
}
|
||||||
|
const price = item.memberPrice ? item.memberPrice : item.price
|
||||||
|
return price * item.num
|
||||||
|
}
|
||||||
|
const productCouponDiscountAmount = computed(() => {
|
||||||
|
// if(props.orderInfo.productCouponDiscountAmount){
|
||||||
|
// return orderInfo.productCouponDiscountAmount.toFixed(2)
|
||||||
|
// }
|
||||||
|
if (!props.data.length) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
const n = props.data.reduce((prve, cur) => {
|
||||||
|
const curTotal = cur.info.filter(v => v.userCouponId).reduce((a, b) => {
|
||||||
|
return a + returnProductCoupPrice(b)
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
console.log(n);
|
||||||
|
return n.toFixed(2)
|
||||||
|
})
|
||||||
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
|
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
|
||||||
|
|
||||||
|
function returnVipMoney(item) {
|
||||||
|
if (!item.memberPrice || !props.user.isVip) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return (item.memberPrice * item.num).toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
function returnTotalMoney(item) {
|
function returnTotalMoney(item) {
|
||||||
return (item.price * item.num).toFixed(2)
|
return (item.price * item.num).toFixed(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const canTuiKuanPrice = computed(() => {
|
||||||
|
const goodsTotal= props.data.reduce((prve, cur) => {
|
||||||
|
// const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
|
||||||
|
// return a+b.priceAmount*1
|
||||||
|
// },0)
|
||||||
|
const curTotal = cur.info.filter(v => !isTui(v)&& !v.userCouponId)
|
||||||
|
.reduce((a, b) => {
|
||||||
|
return a + b.priceAmount * 1
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
console.log(goodsTotal);
|
||||||
|
console.log(seatFeePrice.value);
|
||||||
|
return (goodsTotal+seatFeePrice.value*1).toFixed(2)
|
||||||
|
})
|
||||||
|
const TuiKuanPrice = computed(() => {
|
||||||
|
return props.data.reduce((prve, cur) => {
|
||||||
|
// const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
|
||||||
|
// return a+b.priceAmount*1
|
||||||
|
// },0)
|
||||||
|
const curTotal = cur.info.filter(v => isTui(v)&&!v.userCouponId)
|
||||||
|
.reduce((a, b) => {
|
||||||
|
return a + b.priceAmount * 1
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
})
|
||||||
|
const noTuiKuanPrice=computed(()=>{
|
||||||
|
return props.data.reduce((prve, cur) => {
|
||||||
|
const curTotal = cur.info.filter(v => !isTui(v)&&!v.userCouponId)
|
||||||
|
.reduce((a, b) => {
|
||||||
|
return a + b.priceAmount * 1
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
})
|
||||||
|
const cantuiSeatFee=computed(()=>{
|
||||||
|
let seatFee=props.orderInfo.seatInfo?(props.orderInfo.seatInfo.priceAmount):0
|
||||||
|
const bili = Math.floor((seatFee / canTuiKuanPrice.value) * 100) / 100
|
||||||
|
seatFee= Math.floor((props.orderInfo.amount-props.orderInfo.refundAmount) * bili * 100) / 100
|
||||||
|
return seatFee
|
||||||
|
})
|
||||||
|
function returnCanTuiMoney(item) {
|
||||||
|
return props.orderInfo.status == 'unpaid'? item.priceAmount: item.canReturnAmount
|
||||||
|
if (props.orderInfo.status == 'unpaid') {
|
||||||
|
return returnTotalMoney(item)
|
||||||
|
} else {
|
||||||
|
if(props.orderInfo.pointsDiscountAmount>0||props.orderInfo.fullCouponDiscountAmount>0){
|
||||||
|
return item.canReturnAmount
|
||||||
|
// const bili=Math.floor((item.priceAmount/canTuiKuanPrice.value )*100)/100
|
||||||
|
// return Math.floor((allPrice.value)*bili*100)/100
|
||||||
|
}else{
|
||||||
|
return item.priceAmount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function to2(n) {
|
function to2(n) {
|
||||||
if (!n) {
|
if (!n) {
|
||||||
return 0
|
return 0
|
||||||
@@ -169,7 +417,10 @@
|
|||||||
function tuikuan(item, index) {
|
function tuikuan(item, index) {
|
||||||
hasPermission('允许退款').then(res => {
|
hasPermission('允许退款').then(res => {
|
||||||
if (res) {
|
if (res) {
|
||||||
emits('tuikuan', item, index)
|
emits('tuikuan', {
|
||||||
|
...item,
|
||||||
|
priceAmount: item.canReturnAmount
|
||||||
|
}, index)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -177,46 +428,97 @@
|
|||||||
function printOrder() {
|
function printOrder() {
|
||||||
emits('printOrder')
|
emits('printOrder')
|
||||||
}
|
}
|
||||||
const props = defineProps({
|
|
||||||
orderInfo: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
type: Array,
|
|
||||||
default: () => []
|
|
||||||
},
|
|
||||||
seatFee: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const seatFeePrice = computed(() => {
|
const seatFeePrice = computed(() => {
|
||||||
if (!props.seatFee.priceAmount) {
|
if (!props.seatFee.priceAmount) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
const n = props.seatFee.priceAmount * (props.seatFee.status == 'return' ? 0 : 1)
|
const n = props.seatFee.priceAmount * (isTui(props.seatFee) ? 0 : 1)
|
||||||
return n.toFixed(2)
|
return n.toFixed(2)
|
||||||
})
|
})
|
||||||
|
const discountAmount = computed(() => {
|
||||||
const allPrice = computed(() => {
|
if (props.orderInfo.discountAmount) {
|
||||||
|
return props.orderInfo.discountAmount
|
||||||
|
}
|
||||||
|
console.log(props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio));
|
||||||
|
return (props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio))
|
||||||
|
})
|
||||||
|
const goodsOriginAllPrice = computed(() => {
|
||||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||||
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return").reduce((a,
|
const curTotal = cur.info.reduce((a,
|
||||||
b) => {
|
b) => {
|
||||||
// return a + b.priceAmount*1||(b.num*b.price+b.packAmount*1)
|
|
||||||
// return a + (b.num*b.price+b.packAmount*1)
|
|
||||||
return a + (b.num * b.price)
|
return a + (b.num * b.price)
|
||||||
}, 0)
|
}, 0)
|
||||||
return prve + curTotal
|
return prve + curTotal
|
||||||
}, 0)
|
}, 0)
|
||||||
return goodsPrice.toFixed(2)
|
return goodsPrice.toFixed(2)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const packFee = computed(() => {
|
|
||||||
|
|
||||||
|
const freePrice = computed(() => {
|
||||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||||
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return").reduce((a,
|
const curTotal = cur.info.filter(v => v.gift == true || isGift(v)).reduce((a,
|
||||||
|
b) => {
|
||||||
|
const price = (b.isMember && b.memberPrice) ? b.memberPrice : b.price
|
||||||
|
return a + (b.num * price)
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
return goodsPrice.toFixed(2)
|
||||||
|
})
|
||||||
|
const vipDiscountPrice = computed(() => {
|
||||||
|
if (!props.user.isVip) {
|
||||||
|
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((
|
||||||
|
a,
|
||||||
|
b) => {
|
||||||
|
return a + (b.num * (b.price - b.memberPrice))
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
return goodsPrice.toFixed(2)
|
||||||
|
})
|
||||||
|
|
||||||
|
const productCoupPrice = computed(() => {
|
||||||
|
if (props.orderInfo.status == 'closed') {
|
||||||
|
return props.orderInfo.productCouponDiscountAmount
|
||||||
|
}
|
||||||
|
const goodsPrice = props.data.reduce((a, b) => {
|
||||||
|
const curTotal = b.info.filter(v => v.gift != true && v.userCouponId).reduce((prve,
|
||||||
|
cur) => {
|
||||||
|
const isVip = props.user.isVip && cur.isMember
|
||||||
|
const memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
|
||||||
|
const price = isVip ? memberPrice : cur.price
|
||||||
|
const curTotal = price * cur.num
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
return a + curTotal
|
||||||
|
}, 0)
|
||||||
|
return goodsPrice.toFixed(2)
|
||||||
|
})
|
||||||
|
|
||||||
|
const youhuiAllPrice = computed(() => {
|
||||||
|
const n= props.orderInfo.originAmount-props.orderInfo.amount+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) => {
|
||||||
|
const curTotal = cur.info.filter(v => v.status !== "return").reduce((a,
|
||||||
b) => {
|
b) => {
|
||||||
return a + b.packAmount
|
return a + b.packAmount
|
||||||
}, 0)
|
}, 0)
|
||||||
@@ -225,8 +527,27 @@
|
|||||||
return goodsPrice.toFixed(2)
|
return goodsPrice.toFixed(2)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
const allPrice = computed(() => {
|
||||||
|
|
||||||
|
|
||||||
|
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||||
|
const curTotal = cur.info.reduce((a,
|
||||||
|
b) => {
|
||||||
|
return a +(props.orderInfo.status == 'unpaid'?b.priceAmount:b.canReturnAmount*1)
|
||||||
|
}, 0)
|
||||||
|
return prve + curTotal
|
||||||
|
}, 0)
|
||||||
|
return goodsPrice.toFixed(2)
|
||||||
|
if (props.orderInfo.status == 'unpaid') {
|
||||||
|
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
|
||||||
|
return (n < 0 ? 0 : n).toFixed(2)
|
||||||
|
}
|
||||||
|
const returnAmount=props.orderInfo.seatInfo&&props.orderInfo.seatInfo.returnAmount?props.orderInfo.seatInfo.returnAmount:0
|
||||||
|
const canReturnAmount=props.orderInfo.seatInfo&&props.orderInfo.seatInfo.canReturnAmount?props.orderInfo.seatInfo.canReturnAmount:0
|
||||||
|
const total=props.orderInfo.amount-(returnAmount?returnAmount:canReturnAmount)
|
||||||
|
return (total<=0?0:total).toFixed(2)
|
||||||
|
})
|
||||||
|
|
||||||
const goodsNumber = computed(() => {
|
const goodsNumber = computed(() => {
|
||||||
let result = 0
|
let result = 0
|
||||||
result = props.data.reduce((a, b) => {
|
result = props.data.reduce((a, b) => {
|
||||||
|
|||||||
@@ -33,12 +33,12 @@
|
|||||||
<view class="color-666 u-m-t-8 u-font-24">余额</view>
|
<view class="color-666 u-m-t-8 u-font-24">余额</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="font-bold">{{user.totalScore}}</view>
|
<view class="font-bold">{{user.accountPoints}}</view>
|
||||||
<view class="color-666 u-m-t-8 u-font-24">积分</view>
|
<view class="color-666 u-m-t-8 u-font-24">积分</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="font-bold">0.00</view>
|
<view class="font-bold u-text-center">{{user.orderNumber||0}}</view>
|
||||||
<view class="color-666 u-m-t-8 u-font-24">已消费</view>
|
<view class="color-666 u-m-t-8 u-font-24">订单数量</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
headImg:'',
|
headImg:'',
|
||||||
telephone:'',
|
telephone:'',
|
||||||
amount:'0.00',
|
amount:'0.00',
|
||||||
totalScore:'0.00'
|
accountPoints:'0.00'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,14 @@
|
|||||||
<text class="">{{orderDetail.info.tableName}}</text>
|
<text class="">{{orderDetail.info.tableName}}</text>
|
||||||
</view> -->
|
</view> -->
|
||||||
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
|
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
|
||||||
|
:user="user"
|
||||||
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee" @tuicai="onTuiCai"></goods-list>
|
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee" @tuicai="onTuiCai"></goods-list>
|
||||||
<!-- <template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount"> -->
|
<!-- <template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount"> -->
|
||||||
|
|
||||||
|
<!-- <view class="default-box-padding bg-fff border-r-12 u-m-t-20 u-flex u-row-between" v-if="orderDetail.info.discountAmount>0">
|
||||||
|
<view>服务员改价</view>
|
||||||
|
<view class="color-red">-¥{{orderDetail.info.discountAmount}}</view>
|
||||||
|
</view> -->
|
||||||
<template v-if="true">
|
<template v-if="true">
|
||||||
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info"
|
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info"
|
||||||
:data="orderDetail.seatFee"></extra-vue>
|
:data="orderDetail.seatFee"></extra-vue>
|
||||||
@@ -176,7 +182,7 @@
|
|||||||
orderId,
|
orderId,
|
||||||
num,
|
num,
|
||||||
priceAmount,
|
priceAmount,
|
||||||
price
|
price,userCouponId
|
||||||
} = goods
|
} = goods
|
||||||
go.to('PAGES_ORDER_TUIKUAN', {
|
go.to('PAGES_ORDER_TUIKUAN', {
|
||||||
id,
|
id,
|
||||||
@@ -189,7 +195,8 @@
|
|||||||
number: 0,
|
number: 0,
|
||||||
productSkuName: productSkuName || '',
|
productSkuName: productSkuName || '',
|
||||||
priceAmount:priceAmount?priceAmount:(num*price).toFixed(2),
|
priceAmount:priceAmount?priceAmount:(num*price).toFixed(2),
|
||||||
price
|
price,
|
||||||
|
userCouponId:userCouponId?userCouponId:''
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -315,10 +322,10 @@
|
|||||||
headImg:'',
|
headImg:'',
|
||||||
telephone:'',
|
telephone:'',
|
||||||
amount:'0.00',
|
amount:'0.00',
|
||||||
totalScore:'0.00'
|
accountPoints:'0.00'
|
||||||
})
|
})
|
||||||
//更新选择用户
|
//更新选择用户
|
||||||
function setUser(par) {
|
async function setUser(par) {
|
||||||
const submitPar = {
|
const submitPar = {
|
||||||
orderId:options.id||'',
|
orderId:options.id||'',
|
||||||
masterId: options.masterId,
|
masterId: options.masterId,
|
||||||
@@ -327,7 +334,9 @@
|
|||||||
type: user.value.id ? 0 : 1 //0 设置 1 取消
|
type: user.value.id ? 0 : 1 //0 设置 1 取消
|
||||||
}
|
}
|
||||||
Object.assign(submitPar, par)
|
Object.assign(submitPar, par)
|
||||||
return Api.$setUser(submitPar)
|
const res=await Api.$setUser(submitPar)
|
||||||
|
init()
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,7 @@
|
|||||||
<view class="u-m-t-32">
|
<view class="u-m-t-32">
|
||||||
<view class="u-font-32">{{goosZhonglei}}种商品,共{{goodsNumber}}件</view>
|
<view class="u-font-32">{{goosZhonglei}}种商品,共{{goodsNumber}}件</view>
|
||||||
<view class="border-bottom u-p-b-32">
|
<view class="border-bottom u-p-b-32">
|
||||||
<view class="" v-for="(item,index) in data.detailList"
|
<view class="" v-for="(item,index) in data.detailList" :key="index">
|
||||||
:key="index">
|
|
||||||
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
|
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
|
||||||
<view>
|
<view>
|
||||||
<view class=""> {{item.productName}}</view>
|
<view class=""> {{item.productName}}</view>
|
||||||
@@ -41,12 +40,27 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-flex-1 u-row-right">
|
<view class="u-flex u-flex-1 u-row-right">
|
||||||
<view>×{{item.num}}</view>
|
<view>×{{item.num}}</view>
|
||||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
<template v-if="item.gift||item.userCouponId">
|
||||||
<text :class="{'line-th':item.gift}">¥{{goodsPriceAmount(item)}}</text>
|
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||||
<view class="u-absolute" style="bottom: 100%;right: 0;" v-if="item.gift">
|
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||||
¥0
|
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||||
|
¥0
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</template>
|
||||||
|
<template v-else-if="item.isMember&&data.memberId&&item.memberPrice&&item.memberPrice!=item.price">
|
||||||
|
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||||
|
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||||
|
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||||
|
¥{{goodsVipPriceAmount(item)}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||||
|
<text>¥{{goodsPriceAmount(item)}}</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -54,7 +68,8 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="border-bottom u-p-t-32 u-p-b-32" v-if="data.packFee>0||(data.seatInfo&&data.seatInfo.priceAmount>0)">
|
<view class="border-bottom u-p-t-32 u-p-b-32"
|
||||||
|
v-if="data.packFee>0||(data.seatInfo&&data.seatInfo.priceAmount>0)">
|
||||||
<view class="u-flex u-row-between u-col-top" v-if="data.packFee>0">
|
<view class="u-flex u-row-between u-col-top" v-if="data.packFee>0">
|
||||||
<view class="no-wrap u-m-r-32">打包费</view>
|
<view class="no-wrap u-m-r-32">打包费</view>
|
||||||
<view>¥{{data.packFee||0}}</view>
|
<view>¥{{data.packFee||0}}</view>
|
||||||
@@ -65,6 +80,22 @@
|
|||||||
<view>¥{{data.seatInfo.priceAmount}}</view>
|
<view>¥{{data.seatInfo.priceAmount}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="border-bottom u-p-b-32 u-m-t-32"
|
||||||
|
v-if="data.fullCouponDiscountAmount>0||data.productCouponDiscountAmount>0||data.pointsDiscountAmount>0">
|
||||||
|
<view class="u-flex u-row-between u-col-top" v-if="data.fullCouponDiscountAmount>0">
|
||||||
|
<view class="no-wrap u-m-r-32">满减券抵扣</view>
|
||||||
|
<view class="color-red">-¥{{data.fullCouponDiscountAmount||0}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-32 u-col-top" v-if="data.productCouponDiscountAmount>0">
|
||||||
|
<view class="no-wrap u-m-r-32">商品券抵扣</view>
|
||||||
|
<view class="color-red">-¥{{data.productCouponDiscountAmount||0}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-32 u-col-top" v-if="data.pointsDiscountAmount>0">
|
||||||
|
<view class="no-wrap u-m-r-32">积分抵扣</view>
|
||||||
|
<view class="color-red">-¥{{data.pointsDiscountAmount||0}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<view class="u-flex u-row-between border-bottom u-m-t-32 u-p-b-32 u-col-top">
|
<view class="u-flex u-row-between border-bottom u-m-t-32 u-p-b-32 u-col-top">
|
||||||
@@ -88,7 +119,11 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import orderEnum from '@/commons/orderEnum.js'
|
import orderEnum from '@/commons/orderEnum.js'
|
||||||
import go from '@/commons/utils/go.js'
|
import go from '@/commons/utils/go.js'
|
||||||
import {isTui,canTuiKuan,canTuicai} from '@/commons/utils/goodsUtil.js'
|
import {
|
||||||
|
isTui,
|
||||||
|
canTuiKuan,
|
||||||
|
canTuicai
|
||||||
|
} from '@/commons/utils/goodsUtil.js'
|
||||||
import {
|
import {
|
||||||
computed,
|
computed,
|
||||||
reactive,
|
reactive,
|
||||||
@@ -100,11 +135,11 @@
|
|||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return{
|
return {
|
||||||
packFee:0,
|
packFee: 0,
|
||||||
seatInfo:{
|
seatInfo: {
|
||||||
productName:'客座费',
|
productName: '客座费',
|
||||||
priceAmount:0
|
priceAmount: 0
|
||||||
},
|
},
|
||||||
detailList: []
|
detailList: []
|
||||||
}
|
}
|
||||||
@@ -120,8 +155,17 @@
|
|||||||
let goodsNumber = ref(0)
|
let goodsNumber = ref(0)
|
||||||
|
|
||||||
const priceSize = 9
|
const priceSize = 9
|
||||||
function goodsPriceAmount(item){
|
let minWidth=ref(36)
|
||||||
return (item.price*item.num).toFixed(2)
|
function goodsPriceAmount(item) {
|
||||||
|
const total=(item.price * item.num).toFixed(2)
|
||||||
|
const minW=total.length * priceSize + 15
|
||||||
|
minWidth.value=minW<minWidth.value?minWidth.value:minW
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
|
||||||
|
function goodsVipPriceAmount(item) {
|
||||||
|
const price = item.memberPrice ? item.memberPrice : item.price
|
||||||
|
return (price * item.num).toFixed(2)
|
||||||
}
|
}
|
||||||
// const packeFee=computed(()=>{
|
// const packeFee=computed(()=>{
|
||||||
// return props.data.detailList.reduce((prve,cur)=>{
|
// return props.data.detailList.reduce((prve,cur)=>{
|
||||||
@@ -129,14 +173,8 @@
|
|||||||
// },0).toFixed(2)
|
// },0).toFixed(2)
|
||||||
// })
|
// })
|
||||||
function computedPriceStyle() {
|
function computedPriceStyle() {
|
||||||
const item = props.data.detailList.reduce((prev, current) => (`${prev.price}`.length > `${current.price}`
|
|
||||||
.length) ? prev : current)
|
|
||||||
if (!item) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
const minW=`${item.price}`.length * priceSize + 15
|
|
||||||
return {
|
return {
|
||||||
'min-width':(minW<36?36:minW) + 'px'
|
'min-width':minWidth.value + 'px'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// const computedPriceStyle = computed(() => {
|
// const computedPriceStyle = computed(() => {
|
||||||
|
|||||||
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 u-font-28">
|
||||||
|
<view class="u-m-t-32 u-flex ">
|
||||||
|
<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-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="pointsInput" @change="pointsChange" paddingNone
|
||||||
|
:inputBorder="false" v-model="form.points" 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: '积分抵扣'
|
||||||
|
},
|
||||||
|
accountPoints:{
|
||||||
|
type:Object,
|
||||||
|
default:()=>{
|
||||||
|
return {
|
||||||
|
calcRes:{
|
||||||
|
usable: false,
|
||||||
|
unusableReason: '',
|
||||||
|
minDeductionPoints: 0,
|
||||||
|
maxUsablePoints: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
price: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function to2(n) {
|
||||||
|
if (!n) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return n.toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
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({
|
||||||
|
points: props.price,
|
||||||
|
})
|
||||||
|
watch(() => props.price, (newval) => {
|
||||||
|
form.points = newval
|
||||||
|
})
|
||||||
|
|
||||||
|
function resetForm() {
|
||||||
|
form.points=0
|
||||||
|
}
|
||||||
|
|
||||||
|
const model = ref(null)
|
||||||
|
|
||||||
|
function open() {
|
||||||
|
model.value.open()
|
||||||
|
form.points = props.price
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
model.value.close()
|
||||||
|
}
|
||||||
|
const emits = defineEmits(['confirm'])
|
||||||
|
|
||||||
|
function confirm() {
|
||||||
|
emits('confirm',Math.floor(form.points) )
|
||||||
|
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,43 +1,98 @@
|
|||||||
<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="originPrice!=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=" ">{{originPrice}}</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">{{originPrice}}</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-l-26 u-p-r-26 card top u-m-t-30">
|
||||||
<view class="u-flex u-p-l-24 u-p-r-24 border-bottom-dashed u-row-between u-p-b-30">
|
<view class="border-bottom-dashed u-p-b-30 u-p-t-30" v-if="vipDiscount*1>0">
|
||||||
<view>优惠券</view>
|
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between ">
|
||||||
<view class="color-999 u-flex u-col-center">
|
<view>会员优惠</view>
|
||||||
<text>选择优惠券</text>
|
<view class="color-red">
|
||||||
<view class="u-flex u-col-center">
|
-¥{{vipDiscount}}
|
||||||
<uni-icons type="right" color="#999"></uni-icons>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<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"
|
|
||||||
v-if="discount.price&&discount.currentPrice!=order.amount">
|
<view class="border-bottom-dashed u-p-b-30 u-p-t-30">
|
||||||
<view>服务员改价</view>
|
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between " @click="toQuan">
|
||||||
<view class=" u-flex u-col-center">
|
<view>优惠券</view>
|
||||||
<text style="color: rgb(255, 95, 46);">-¥{{to2(order.amount- discount.currentPrice)}}</text>
|
<view class="color-999 u-flex u-col-center">
|
||||||
|
<text>选择优惠券</text>
|
||||||
|
<view class="u-flex u-col-center">
|
||||||
|
<uni-icons type="right" color="#999"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<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">
|
||||||
|
<view class="hui">减</view>
|
||||||
|
<view class="u-m-l-18">{{item.name}}</view>
|
||||||
|
<view class="u-m-l-18 color-999">x{{item.num}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="color-red">
|
||||||
|
-¥{{item.discountAmount}}
|
||||||
|
</view>
|
||||||
|
<view class="u-m-l-12" @click="delQuan(index)">
|
||||||
|
<up-icon :size="16" name="minus-circle-fill" color="rgb(255, 0, 0)"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="border-bottom u-p-b-30" v-if="discount.value||accountPoints.sel">
|
||||||
|
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 " v-if="discount.value">
|
||||||
|
<view>服务员改价</view>
|
||||||
|
<view class=" u-flex u-col-center">
|
||||||
|
<text style="color: rgb(255, 95, 46);">-¥{{to2(discount.value)}}</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&&accountPoints.sel">
|
||||||
|
<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">
|
||||||
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
|
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
|
||||||
<template v-if="pays.selIndex==0">
|
<template v-if="pays.selIndex==0">
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<view class="item" @click="changePayType(index,item)"
|
<view class="item" @click="changePayType(index,item)" :class="{disabled:item.disabled}"
|
||||||
v-for="(item,index) in pays.payTypes.list" :key="index">
|
v-for="(item,index) in pays.payTypes.list" :key="index">
|
||||||
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
@@ -45,7 +100,8 @@
|
|||||||
<text class="u-m-l-10 no-wrap">{{item.payName}}</text>
|
<text class="u-m-l-10 no-wrap">{{item.payName}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex color-999 u-font-24">
|
<view class="u-flex color-999 u-font-24">
|
||||||
<view class="u-m-r-20" v-if="item.payType=='vipPay'">
|
<view class="u-m-r-20" v-if="item.payType=='vipPay'&&user.id"
|
||||||
|
@click.stop="chooseUser">
|
||||||
<view>
|
<view>
|
||||||
<text>会员:</text>
|
<text>会员:</text>
|
||||||
<text class="u-m-r-4">{{user.telephone||user.nickName}}</text>
|
<text class="u-m-r-4">{{user.telephone||user.nickName}}</text>
|
||||||
@@ -54,14 +110,65 @@
|
|||||||
<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)"
|
<view :class="{op3:item.disabled}">
|
||||||
:modelValue="index==pays.payTypes.selIndex">
|
<my-radio @click="changePayType(index,item)"
|
||||||
</my-radio>
|
:modelValue="index==pays.payTypes.selIndex">
|
||||||
|
</my-radio>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</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" @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">
|
||||||
|
<view><text>{{accountPoints.num}}</text></view>
|
||||||
|
<view v-if="accountPoints.calcRes.usable" @click.stop="refPointsOpen">
|
||||||
|
<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>
|
||||||
@@ -81,7 +188,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>
|
||||||
@@ -104,8 +211,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
<edit-discount :nowPrice="order.amount-productCouponDiscountAmount-fullCouponDiscountAmount"
|
||||||
:price="order.amount"></edit-discount>
|
@confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
||||||
|
:price="order.amount-productCouponDiscountAmount" :discount="discount.discount"></edit-discount>
|
||||||
|
|
||||||
|
<up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText"
|
||||||
|
:cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
|
||||||
|
@cancel="confirmModelCancel" @close="confirmModelCancel" width="300px" />
|
||||||
|
|
||||||
|
<edit-accountPoints @confirm="pointsConfirm" :price="accountPoints.num" :accountPoints="accountPoints"
|
||||||
|
ref="refPoints"></edit-accountPoints>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -115,29 +231,181 @@
|
|||||||
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'
|
||||||
async function discountShow(){
|
import editAccountPoints from './components/edit-accountPoints.vue'
|
||||||
const bol=await hasPermission('yun_xu_da_zhe')
|
import {
|
||||||
if(bol){
|
returnGoodsPayPriceMap,
|
||||||
showModel('editMoney',true)
|
returnProCoupStartIndex,
|
||||||
|
returnProductCoupAllPrice,
|
||||||
|
returnProductCanUseNum
|
||||||
|
} from '../quan_util.js'
|
||||||
|
|
||||||
|
const modal = reactive({
|
||||||
|
title: '提示',
|
||||||
|
cancelText: '取消',
|
||||||
|
confirmText: '确认',
|
||||||
|
content: '',
|
||||||
|
key: 'cash',
|
||||||
|
show: false,
|
||||||
|
data: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
function confirmModelCancel() {
|
||||||
|
if (modal.key == 'fullCoupon') {
|
||||||
|
// 取消改价
|
||||||
|
discount.discount = 100
|
||||||
|
discount.value = 0
|
||||||
|
}
|
||||||
|
confirmModelClose()
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmModelClose() {
|
||||||
|
modal.show = false
|
||||||
|
modal.key = ''
|
||||||
|
modal.data = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function cashConfirmShow() {
|
||||||
|
modal.content = '是否确认已现金收款' + payPrice.value
|
||||||
|
modal.key = 'cash'
|
||||||
|
modal.show = true
|
||||||
|
}
|
||||||
|
async function confirmModelConfirm() {
|
||||||
|
if (modal.key == 'cash') {
|
||||||
|
await pay()
|
||||||
|
confirmModelCancel()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (modal.key == 'fullCoupon') {
|
||||||
|
//删除满减券
|
||||||
|
const index = pays.quan.findIndex(v => v.type == 1)
|
||||||
|
pays.quan.splice(index, 1)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let option = {isNowPay:false}
|
|
||||||
let payFinish=ref(false)
|
//商品数量从0到n每一个对应的价格
|
||||||
|
let $goodsPayPriceMap = {}
|
||||||
|
|
||||||
|
const refPoints = ref(null)
|
||||||
|
|
||||||
|
function delQuan(i) {
|
||||||
|
pays.quan.splice(i, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
})
|
||||||
|
|
||||||
|
function pointsConfirm(e) {
|
||||||
|
accountPoints.num = e
|
||||||
|
}
|
||||||
|
async function calcUsablePoints(orderAmount) {
|
||||||
|
if (!order.memberId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log(orderAmount);
|
||||||
|
const res = await Api.$calcUsablePoints({
|
||||||
|
memberId: order.memberId,
|
||||||
|
orderAmount: orderAmount ? orderAmount : payPrice.value
|
||||||
|
})
|
||||||
|
accountPoints.calcRes = res
|
||||||
|
accountPoints.num = res.maxUsablePoints
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
watch(() => accountPoints.sel, (newval) => {
|
||||||
|
if (newval) {
|
||||||
|
calcDeDuctionPoints()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
async function calcDeDuctionPoints() {
|
||||||
|
if (accountPoints.num <= 0) {
|
||||||
|
accountPoints.price = 0
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
const res = await Api.$calcDeDuctionPoints({
|
||||||
|
memberId: order.memberId,
|
||||||
|
orderAmount: originPrice.value,
|
||||||
|
points: accountPoints.num
|
||||||
|
})
|
||||||
|
if (res) {
|
||||||
|
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);
|
||||||
|
if (!order.memberId) {
|
||||||
|
return infoBox.showToast('请先选择会员', 0.5).then(() => {
|
||||||
|
chooseUser()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
go.to('PAGES_ORDER_QUAN', {
|
||||||
|
orderId: order.id,
|
||||||
|
memberId: order.memberId,
|
||||||
|
orderPrice: (payPrice.value * 1 + coupAllPrice.value * 1).toFixed(2)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function discountShow() {
|
||||||
|
const bol = await hasPermission('yun_xu_da_zhe')
|
||||||
|
if (bol) {
|
||||||
|
showModel('editMoney', true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let option = {
|
||||||
|
isNowPay: false
|
||||||
|
}
|
||||||
|
let payFinish = ref(false)
|
||||||
onBackPress(() => {
|
onBackPress(() => {
|
||||||
uni.$emit('orderDetail:update')
|
uni.$emit('orderDetail:update')
|
||||||
console.log('onBackPress');
|
console.log('onBackPress');
|
||||||
@@ -148,7 +416,6 @@
|
|||||||
// }
|
// }
|
||||||
// return false
|
// return false
|
||||||
})
|
})
|
||||||
let payStatus = ref(null) //loading success
|
|
||||||
|
|
||||||
let timer = null
|
let timer = null
|
||||||
|
|
||||||
@@ -165,7 +432,7 @@
|
|||||||
if (!n) {
|
if (!n) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
return n.toFixed(2)
|
return Number(n).toFixed(2)
|
||||||
}
|
}
|
||||||
const pays = reactive({
|
const pays = reactive({
|
||||||
list: ['扫码收款', '二维码收款'],
|
list: ['扫码收款', '二维码收款'],
|
||||||
@@ -173,17 +440,19 @@
|
|||||||
payTypes: {
|
payTypes: {
|
||||||
list: [],
|
list: [],
|
||||||
selIndex: 0
|
selIndex: 0
|
||||||
}
|
},
|
||||||
|
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,
|
||||||
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 取消
|
||||||
@@ -191,21 +460,75 @@
|
|||||||
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({
|
pays.quan = []
|
||||||
vipUserId: data.id ? data.id : '',
|
setUser({
|
||||||
type: data.id ? 0 : 1 //0 设置 1 取消
|
vipUserId: data.id ? data.id : '',
|
||||||
}).then(res=>{
|
type: data.id ? 0 : 1 //0 设置 1 取消
|
||||||
user.value = data
|
}).then(res => {
|
||||||
order.memberId=data.id
|
user.value = data
|
||||||
})
|
order.memberId = data.id
|
||||||
|
init()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
onShow(()=>{
|
|
||||||
|
function setQuan(arr) {
|
||||||
|
console.log(arr);
|
||||||
|
discount.discount = 100
|
||||||
|
discount.value = 0
|
||||||
|
discount.currentPrice = order.amount
|
||||||
|
const manjianCoup = arr.filter(v => v.type == 1 && v.num >= 1)
|
||||||
|
let productCoup = arr.filter(v => v.type == 2)
|
||||||
|
console.log(productCoup);
|
||||||
|
//商品券分组
|
||||||
|
let coupMap = {}
|
||||||
|
for (let i in productCoup) {
|
||||||
|
const coup = productCoup[i]
|
||||||
|
if (coupMap.hasOwnProperty(coup.proId)) {
|
||||||
|
coupMap[coup.proId].push(coup)
|
||||||
|
} else {
|
||||||
|
coupMap[coup.proId] = [coup]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(coupMap);
|
||||||
|
for (let key in coupMap) {
|
||||||
|
const arr = coupMap[key]
|
||||||
|
for (let i in arr) {
|
||||||
|
const coup = arr[i]
|
||||||
|
const proCoupStartIndex = returnProCoupStartIndex(arr, i)
|
||||||
|
console.log(proCoupStartIndex);
|
||||||
|
const coupUseNum = returnProductCanUseNum($goodsPayPriceMap[coup.proId], proCoupStartIndex,
|
||||||
|
coup.num)
|
||||||
|
const num = Math.min($goodsPayPriceMap[coup.proId].length, coupUseNum)
|
||||||
|
coup.num = num
|
||||||
|
console.log($goodsPayPriceMap[coup.proId]);
|
||||||
|
const findGoods = order.detailList.find(v => v.productId == coup.proId)
|
||||||
|
const isMember = findGoods.isMember
|
||||||
|
coup.discountAmount = returnProductCoupAllPrice($goodsPayPriceMap[coup.proId],
|
||||||
|
proCoupStartIndex, num, isMember).toFixed(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
productCoup = productCoup.filter(v => v.num >= 1)
|
||||||
|
console.log(productCoup);
|
||||||
|
pays.quan = [...manjianCoup, ...productCoup]
|
||||||
|
console.log(pays.quan);
|
||||||
|
}
|
||||||
|
|
||||||
|
function watchChooseQuan() {
|
||||||
|
uni.$off('choose-quan')
|
||||||
|
uni.$on('choose-quan', (arr) => {
|
||||||
|
setQuan(arr)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
watchChooseuser()
|
watchChooseuser()
|
||||||
|
watchChooseQuan()
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(() => pays.selIndex, (newval) => {
|
watch(() => pays.selIndex, (newval) => {
|
||||||
@@ -239,31 +562,56 @@
|
|||||||
|
|
||||||
//打折相关数据
|
//打折相关数据
|
||||||
const discount = reactive({
|
const discount = reactive({
|
||||||
|
discount: 100,
|
||||||
|
currentPrice: 0,
|
||||||
|
value: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
function editDiscountConfirm(form) {
|
function editDiscountConfirm(form) {
|
||||||
console.log(form);
|
console.log(form);
|
||||||
Object.assign(discount, form)
|
accountPoints.sel = false
|
||||||
|
Object.assign(discount, {
|
||||||
|
...form,
|
||||||
|
value: form.price - form.currentPrice
|
||||||
|
})
|
||||||
|
const fullCoupon = pays.quan.find(v => v.type == 1)
|
||||||
|
if (fullCoupon && form.currentPrice < fullCoupon.fullAmount) {
|
||||||
|
modal.content = '改价后价格不满足满减券最低满减需求' + fullCoupon.fullAmount + '元'
|
||||||
|
modal.key = 'fullCoupon'
|
||||||
|
modal.show = true
|
||||||
|
modal.cancelText = '取消改价'
|
||||||
|
modal.confirmText = '删除满减券'
|
||||||
|
}
|
||||||
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.map(v => {
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
disabled: false
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function changePayType(i, item) {
|
function changePayType(i, item) {
|
||||||
|
if (item.disabled) {
|
||||||
|
return infoBox.showToast(item.payName + '不可用')
|
||||||
|
}
|
||||||
pays.payTypes.selIndex = i
|
pays.payTypes.selIndex = i
|
||||||
if (item.payType == 'vipPay' ) {
|
if (item.payType == 'vipPay' && !user.value.id) {
|
||||||
chooseUser()
|
chooseUser()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let payStatus = '';
|
||||||
//支付成功回调
|
//支付成功回调
|
||||||
function paySuccess() {
|
function paySuccess() {
|
||||||
infoBox.showToast('支付成功')
|
infoBox.showToast('支付成功')
|
||||||
|
payStatus = 'success'
|
||||||
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({
|
||||||
@@ -278,29 +626,55 @@
|
|||||||
if (payType == 'scanCode' || payType == 'deposit') {
|
if (payType == 'scanCode' || payType == 'deposit') {
|
||||||
return saomaPay()
|
return saomaPay()
|
||||||
}
|
}
|
||||||
|
if (payType == 'cash' && payPrice.value * 1 > 0) {
|
||||||
|
return cashConfirmShow()
|
||||||
|
}
|
||||||
payOrder()
|
payOrder()
|
||||||
}
|
}
|
||||||
|
const tipsMap = {
|
||||||
|
paying: '支付中',
|
||||||
|
success: '已支付成功'
|
||||||
|
}
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (payStatus) {
|
||||||
|
return infoBox.showToast(tipsMap[payStatus])
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
pay()
|
||||||
|
} catch (e) {
|
||||||
|
//TODO handle the exception
|
||||||
|
payStatus = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function pay(par) {
|
||||||
|
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||||
|
payStatus = 'paying'
|
||||||
await Api.$payOrder({
|
await Api.$payOrder({
|
||||||
tableId: order.tableId,
|
tableId: order.tableId,
|
||||||
masterId: order.masterId,
|
masterId: order.masterId,
|
||||||
orderId: order.id || order.orderId,
|
orderId: order.id || order.orderId,
|
||||||
payType,
|
payType,
|
||||||
vipUserId: order.memberId,
|
vipUserId: order.memberId,
|
||||||
discount: 1,
|
discount: discount.discount / 100,
|
||||||
code: ''
|
code: '',
|
||||||
|
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
||||||
|
userCouponInfos: pays.quan.map(v => {
|
||||||
|
return {
|
||||||
|
userCouponId: v.id,
|
||||||
|
num: v.num
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
...par
|
||||||
})
|
})
|
||||||
paySuccess()
|
paySuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
getPayType()
|
|
||||||
})
|
|
||||||
const order = reactive({
|
const order = reactive({
|
||||||
amount: 0
|
amount: 0
|
||||||
})
|
})
|
||||||
@@ -314,14 +688,8 @@
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log('条码类型:' + res.scanType);
|
console.log('条码类型:' + res.scanType);
|
||||||
console.log('条码内容:' + res.result);
|
console.log('条码内容:' + res.result);
|
||||||
Api.$payOrder({
|
pay({
|
||||||
"orderId": order.orderId, // 订单id
|
code: res.result
|
||||||
"payType": item.payType, //
|
|
||||||
"discount": order.discount,
|
|
||||||
"code": res.result
|
|
||||||
}).then(res => {
|
|
||||||
console.log(res);
|
|
||||||
paySuccess()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -344,41 +712,140 @@
|
|||||||
async function init() {
|
async function init() {
|
||||||
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
|
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
|
||||||
Object.assign(order, orderRes)
|
Object.assign(order, orderRes)
|
||||||
|
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailList)
|
||||||
|
const hasSelQuan = orderRes.couponInfoList ? JSON.parse(orderRes.couponInfoList) : {
|
||||||
|
fullReductionCoupon: [],
|
||||||
|
productCoupon: []
|
||||||
|
};
|
||||||
|
const fullReductionCoupon = hasSelQuan.fullReductionCoupon.filter(v => v.type == 1)
|
||||||
|
const productCoupon = hasSelQuan.productCoupon.filter(v => v.type == 2)
|
||||||
|
setQuan([...fullReductionCoupon, ...productCoupon])
|
||||||
|
|
||||||
if (orderRes.memberId) {
|
if (orderRes.memberId) {
|
||||||
|
calcUsablePoints()
|
||||||
|
if (orderRes.pointsNum) {
|
||||||
|
accountPoints.sel = true
|
||||||
|
}
|
||||||
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]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
getPayUrl()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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(() => {
|
||||||
|
const n = pays.quan.reduce((prve, cur) => {
|
||||||
|
return prve + cur.discountAmount * 1
|
||||||
|
}, 0)
|
||||||
|
return n
|
||||||
|
})
|
||||||
|
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)
|
||||||
|
const total = (originPrice.value) - vipDiscount.value - productCouponDiscountAmount.value - discount
|
||||||
|
.value -
|
||||||
|
fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||||
|
return (total < 0 ? 0 : total).toFixed(2)
|
||||||
|
})
|
||||||
|
const vipDiscount = computed(() => {
|
||||||
|
if (!user.value.isVip) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
const goodsPrice = order.detailList.filter(v => v.gift != true && v.status !== "return" && (v.isMember &&
|
||||||
|
v.memberPrice) && (v.memberPrice != v.price)).reduce((
|
||||||
|
a,
|
||||||
|
b) => {
|
||||||
|
return a + (b.num * (b.price - b.memberPrice))
|
||||||
|
}, 0)
|
||||||
|
return goodsPrice.toFixed(2)
|
||||||
|
})
|
||||||
|
const originPrice = computed(() => {
|
||||||
|
const n = (order.amount || 0) * 1 + vipDiscount.value * 1 + (order.fullCouponDiscountAmount || 0) + (order
|
||||||
|
.productCouponDiscountAmount || 0) +
|
||||||
|
(order.pointsDiscountAmount || 0)
|
||||||
|
|
||||||
|
return n.toFixed(2)
|
||||||
|
})
|
||||||
|
const fullCouponDiscountAmount = computed(() => {
|
||||||
|
return pays.quan.filter(v => v.type == 1).reduce((prve, cur) => {
|
||||||
|
return prve + cur.discountAmount * 1
|
||||||
|
}, 0)
|
||||||
|
})
|
||||||
|
const productCouponDiscountAmount = computed(() => {
|
||||||
|
return pays.quan.filter(v => v.type == 2).reduce((prve, cur) => {
|
||||||
|
return prve + cur.discountAmount * 1
|
||||||
|
}, 0)
|
||||||
|
})
|
||||||
|
watch(() => payPrice.value, (newval) => {
|
||||||
|
getPayUrl()
|
||||||
|
if (newval <= 0) {
|
||||||
|
const arr = ['cash', 'vipPay']
|
||||||
|
pays.payTypes.list.map(v => {
|
||||||
|
if (arr.includes(v.payType)) {
|
||||||
|
v.disabled = false
|
||||||
|
} else {
|
||||||
|
v.disabled = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const index = pays.payTypes.list.findIndex(v => !v.disabled)
|
||||||
|
pays.payTypes.selIndex = index
|
||||||
|
} else {
|
||||||
|
pays.payTypes.list.map(v => {
|
||||||
|
v.disabled = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const pointCanDicountPrice = computed(() => {
|
||||||
|
const total = (order.amount || 0) - productCouponDiscountAmount.value - discount.value -
|
||||||
|
fullCouponDiscountAmount.value
|
||||||
|
return (total < 0 ? 0 : total).toFixed(2)
|
||||||
|
})
|
||||||
|
watch(() => pointCanDicountPrice.value, (newval) => {
|
||||||
|
calcUsablePoints()
|
||||||
|
})
|
||||||
|
|
||||||
onLoad(async (opt) => {
|
onLoad(async (opt) => {
|
||||||
console.log(opt);
|
console.log(opt);
|
||||||
option = opt
|
option = opt
|
||||||
Object.assign(order, opt)
|
Object.assign(order, opt)
|
||||||
const payTypeList = await Api.$getPayType()
|
getPayType()
|
||||||
pays.payTypes.list = payTypeList
|
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
console.log('onBeforeUnmount');
|
||||||
clear()
|
clear()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
$quan-color: #318AFE;
|
||||||
|
|
||||||
|
.op3 {
|
||||||
|
opacity: .3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hui {
|
||||||
|
// background-color: $quan-color;
|
||||||
|
background-image: linear-gradient(to right bottom, rgb(254, 103, 4), rgb(241, 50, 42));
|
||||||
|
padding: 4rpx 10rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
.box-shadow {
|
.box-shadow {
|
||||||
box-shadow: 0 0 5px #E5E5E5;
|
box-shadow: 0 0 5px #E5E5E5;
|
||||||
}
|
}
|
||||||
@@ -401,6 +868,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
|
.item {
|
||||||
|
&.disabled {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.item:last-child {
|
.item:last-child {
|
||||||
.border-bottom {
|
.border-bottom {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
|
|||||||
575
pagesOrder/quan/quan.vue
Normal file
575
pagesOrder/quan/quan.vue
Normal file
@@ -0,0 +1,575 @@
|
|||||||
|
<template>
|
||||||
|
<view class="u-p-l-30 u-p-r-30 u-p-t-30 u-font-28 ">
|
||||||
|
<up-sticky offset-top="0">
|
||||||
|
<my-tabs v-model="myQuan.types.sel" :list="myQuan.types.list"></my-tabs>
|
||||||
|
</up-sticky>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<template v-if="myQuan.types.sel==0">
|
||||||
|
<view class="" @click="changeFullReductionCouponSel(item)"
|
||||||
|
v-for="(item,index) in myQuan.res.fullReductionCoupon" :class="{filtergray:!item.use}" :key="index">
|
||||||
|
<view class="quan u-row-between u-flex u-col-center u-m-b-32 border-r-10 ">
|
||||||
|
<view class="no-use" v-if="!item.use">
|
||||||
|
<image class="img" src="/pagesOrder/static/image/no-use.svg" mode=""></image>
|
||||||
|
</view>
|
||||||
|
<view class="sel u-abso" v-if="item.id==myQuan.fullReductionCouponSel.id ">
|
||||||
|
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||||
|
</view>
|
||||||
|
<view class="u-p-t-32 u-p-b-32 u-p-l-24 u-p-r-24 left">
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="hui">减</view>
|
||||||
|
<view class="u-m-l-18">{{item.name}}</view>
|
||||||
|
</view>
|
||||||
|
<view class=" u-m-t-20 u-flex">
|
||||||
|
<view>有效期:</view>
|
||||||
|
<view class="u-font-24 u-m-l-6"> {{dayjs(item.endTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-10 color-999 u-font-24">
|
||||||
|
{{ formatStr(item.useRestrictions)}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="right u-flex u-flex-col u-row-between">
|
||||||
|
<view class="u-flex u-row-center u-font-36 ">
|
||||||
|
¥{{item.discountAmount}}
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-font-24">
|
||||||
|
满{{item.fullAmount}}可用
|
||||||
|
</view>
|
||||||
|
<view class="u-flex ">
|
||||||
|
<view class="use-btn" @click.stop="toEmitChooseQuan(item)">去使用</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="myQuan.res.fullReductionCoupon.length<=0&&myQuan.hasAjax">
|
||||||
|
<my-img-empty tips="暂无可用优惠券"></my-img-empty>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="myQuan.types.sel==1">
|
||||||
|
<view class="" @click="changeProductCoupon(item)" v-for="(item,index) in myQuan.res.productCoupon"
|
||||||
|
: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="no-use" v-if="!item.use">
|
||||||
|
<image class="img" src="/pagesOrder/static/image/no-use.svg" mode=""></image>
|
||||||
|
</view>
|
||||||
|
<view class="sel u-abso" v-if="item.checked">
|
||||||
|
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||||
|
</view>
|
||||||
|
<view class="u-p-t-32 u-p-b-32 u-p-l-24 u-p-r-24">
|
||||||
|
<view class="u-flex">
|
||||||
|
<up-image width="80rpx" height="80rpx" :src="item.productCover"></up-image>
|
||||||
|
<view class="u-m-l-18">
|
||||||
|
<view class="u-m-l-18">{{item.productName}}</view>
|
||||||
|
<view class="u-m-l-18 u-m-t-10 u-font-24 color-666">x{{item.num}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class=" u-m-t-14 u-flex">
|
||||||
|
<view>有效期:</view>
|
||||||
|
<view class="u-font-24 u-m-l-6"> {{dayjs(item.endTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-10 color-999 u-font-24">
|
||||||
|
{{ formatStr(item.useRestrictions)}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="right u-flex u-flex-col u-col-bottom u-row-center">
|
||||||
|
<!-- <view class="u-flex u-row-center w-full">
|
||||||
|
<view class="color-red font-bold u-m-b-24 ">¥{{item.discountAmount}}</view>
|
||||||
|
</view> -->
|
||||||
|
<view class="u-flex ">
|
||||||
|
<view class="use-btn" @click.stop="toEmitChooseQuan(item)">去使用</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<template v-if="myQuan.res.productCoupon.length<=0&&myQuan.hasAjax">
|
||||||
|
<my-img-empty tips="暂无可用优惠券"></my-img-empty>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view :style="{height:safebottomHeight+'px'}"></view>
|
||||||
|
<view class="fixed-b bottom safe-bottom border-top">
|
||||||
|
|
||||||
|
<view class="u-m-b-32 u-flex u-row-between u-p-t-10">
|
||||||
|
<view class="u-flex">
|
||||||
|
<text>抵扣金额:</text>
|
||||||
|
<text class="color-red">¥</text>
|
||||||
|
<text class="color-red">{{discountAmount}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-relative">
|
||||||
|
<text>支付金额:</text>
|
||||||
|
<text class="color-red">¥</text>
|
||||||
|
<text class="color-red">{{payPrice }}</text>
|
||||||
|
<view class="u-absolute u-flex u-row-between" style="bottom: 100%;right: 0;"
|
||||||
|
v-if="payPrice*1!=option.orderPrice*1">
|
||||||
|
<view class="u-flex line-th color-999">
|
||||||
|
<text class="">¥</text>
|
||||||
|
<text class="">{{option.orderPrice}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex gap-20">
|
||||||
|
<up-button shape="circle" plain @click="back">
|
||||||
|
<view class="font-bold">取消</view>
|
||||||
|
</up-button>
|
||||||
|
<up-button shape="circle" type="primary" @click="toEmitChooseQuan()">
|
||||||
|
<view class="font-bold">确定</view>
|
||||||
|
</up-button>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<up-modal :title="modal.title" :content="modal.content" :show="modal.clear" :confirmText="modal.confirmText"
|
||||||
|
:cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
|
||||||
|
@cancel="confirmModelCancel" @close="setModalShow('clear',false)" width="300px" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
reactive,
|
||||||
|
watch,
|
||||||
|
computed,
|
||||||
|
onMounted
|
||||||
|
} from 'vue';
|
||||||
|
import color from '@/commons/color.js'
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import {
|
||||||
|
getSafeBottomHeight
|
||||||
|
} from '@/commons/utils/safe-bottom.js'
|
||||||
|
import go from '@/commons/utils/go.js'
|
||||||
|
import {
|
||||||
|
onLoad,
|
||||||
|
onReady
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import * as orderApi from '@/http/yskApi/order.js'
|
||||||
|
import {
|
||||||
|
$activateByOrderId
|
||||||
|
} from '@/http/yskApi/Instead.js'
|
||||||
|
import infoBox from '@/commons/utils/infoBox.js'
|
||||||
|
import {
|
||||||
|
queryAllShopUser
|
||||||
|
} from '@/http/yskApi/shop-user.js'
|
||||||
|
import {
|
||||||
|
returnNewGoodsList,
|
||||||
|
returnCoupCanUse,
|
||||||
|
returnCouponAllPrice,
|
||||||
|
returnProductCoupon,
|
||||||
|
returnCanUseFullReductionCoupon
|
||||||
|
} from '../quan_util.js'
|
||||||
|
|
||||||
|
const modal = reactive({
|
||||||
|
title: '提示',
|
||||||
|
cancelText: '取消',
|
||||||
|
confirmText: '确定',
|
||||||
|
content: '',
|
||||||
|
key: '',
|
||||||
|
clear: false,
|
||||||
|
data: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
function confirmModelCancel() {
|
||||||
|
setModalShow('clear', false, '')
|
||||||
|
}
|
||||||
|
async function confirmModelConfirm() {
|
||||||
|
if (modal.key == 'clear') {
|
||||||
|
myQuan.fullReductionCouponSel = {
|
||||||
|
id: ''
|
||||||
|
}
|
||||||
|
const item = modal.data
|
||||||
|
item.checked = !item.checked
|
||||||
|
const CheckedArr = myQuan.res.productCoupon.filter(v => v.checked)
|
||||||
|
const noCheckedArr = myQuan.res.productCoupon.filter(v => !v.checked)
|
||||||
|
noCheckedArr.map(v => {
|
||||||
|
console.log(returnCoupCanUse(canDikouGoodsArr, v, CheckedArr));
|
||||||
|
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr)
|
||||||
|
})
|
||||||
|
setModalShow('clear', false, '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setModalShow(key = 'show', show = true, data) {
|
||||||
|
modal.key = key
|
||||||
|
modal[key] = show
|
||||||
|
modal.data = data
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function back() {
|
||||||
|
uni.navigateBack()
|
||||||
|
}
|
||||||
|
let order = ref({
|
||||||
|
|
||||||
|
})
|
||||||
|
let canDikouGoodsArr = []
|
||||||
|
const myQuan = reactive({
|
||||||
|
fullReductionCouponSel: {
|
||||||
|
id: ''
|
||||||
|
},
|
||||||
|
res: {
|
||||||
|
fullReductionCoupon: [],
|
||||||
|
productCoupon: []
|
||||||
|
},
|
||||||
|
types: {
|
||||||
|
list: ['满减券(单选)', '商品券(多选)'],
|
||||||
|
sel: 0
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
sel: -1,
|
||||||
|
hasAjax: false
|
||||||
|
})
|
||||||
|
|
||||||
|
function changeProductCoupon(item) {
|
||||||
|
if (!item.use) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (myQuan.fullReductionCouponSel.id && !item.checked) {
|
||||||
|
const goodsQuan = myQuan.res.productCoupon.filter(v => v.checked)
|
||||||
|
const fullReductionCoupon = myQuan.fullReductionCouponSel.id ? [myQuan.fullReductionCouponSel] : []
|
||||||
|
let coupArr = [...goodsQuan, item]
|
||||||
|
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, user.value)
|
||||||
|
if (payPrice<=0) {
|
||||||
|
modal.content = '选择该商品券后支付金额将为0,继续选择将取消选择的满减券'
|
||||||
|
modal.cancelText = '取消'
|
||||||
|
modal.confirmText = '继续选择'
|
||||||
|
setModalShow('clear', true, item)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (myQuan.fullReductionCouponSel.fullAmount > payPrice) {
|
||||||
|
modal.content = '选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券'
|
||||||
|
modal.cancelText = '取消'
|
||||||
|
modal.confirmText = '继续选择'
|
||||||
|
setModalShow('clear', true, item)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
item.checked = !item.checked
|
||||||
|
const CheckedArr = myQuan.res.productCoupon.filter(v => v.checked)
|
||||||
|
if (CheckedArr.length <= 0) {
|
||||||
|
return myQuan.res.productCoupon.map(v => {
|
||||||
|
v.use = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const noCheckedArr = myQuan.res.productCoupon.filter(v => !v.checked)
|
||||||
|
noCheckedArr.map(v => {
|
||||||
|
console.log(returnCoupCanUse(canDikouGoodsArr, v, CheckedArr));
|
||||||
|
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeFullReductionCouponSel(item) {
|
||||||
|
if (!item.use) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log(item);
|
||||||
|
if (item.id == myQuan.fullReductionCouponSel.id) {
|
||||||
|
myQuan.fullReductionCouponSel = {
|
||||||
|
id: ''
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
myQuan.fullReductionCouponSel = item
|
||||||
|
}
|
||||||
|
myQuan.res.fullReductionCoupon = returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value, myQuan
|
||||||
|
.fullReductionCouponSel)
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatStr(str) {
|
||||||
|
return str.replaceAll('"', '')
|
||||||
|
}
|
||||||
|
|
||||||
|
function toUse(item) {
|
||||||
|
|
||||||
|
}
|
||||||
|
let user = reactive({
|
||||||
|
isVip: false
|
||||||
|
})
|
||||||
|
|
||||||
|
let $fullReductionCoupon = []
|
||||||
|
let $productCoupon = []
|
||||||
|
async function getQuan() {
|
||||||
|
order.value = await orderApi.tbOrderInfoDetail(option.orderId)
|
||||||
|
if (order.value.memberId) {
|
||||||
|
const userRes = await queryAllShopUser({
|
||||||
|
id: order.value.memberId
|
||||||
|
})
|
||||||
|
if (userRes.content[0]) {
|
||||||
|
user.value = userRes.content[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(order.value);
|
||||||
|
const res = await $activateByOrderId({
|
||||||
|
orderId: option.orderId,
|
||||||
|
memberId: option.memberId
|
||||||
|
})
|
||||||
|
canDikouGoodsArr = returnNewGoodsList(order.value.detailList || [])
|
||||||
|
res.fullReductionCoupon = res.fullReductionCoupon.map((v) => {
|
||||||
|
if(option.orderPrice<=0){
|
||||||
|
return {...v,use:false}
|
||||||
|
}else{
|
||||||
|
return{
|
||||||
|
...v,
|
||||||
|
use:v.use && option.orderPrice * 1 >= v
|
||||||
|
.fullAmount * 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
res.productCoupon = res.productCoupon.map(v => {
|
||||||
|
const calcCoup = returnProductCoupon(v, canDikouGoodsArr, user.value)
|
||||||
|
return {
|
||||||
|
...calcCoup,
|
||||||
|
checked: false,
|
||||||
|
use:option.orderPrice<=0?false:v.use
|
||||||
|
}
|
||||||
|
}).filter((v) => v.use);
|
||||||
|
$fullReductionCoupon = res.fullReductionCoupon
|
||||||
|
$productCoupon = res.productCoupon
|
||||||
|
myQuan.res = res
|
||||||
|
myQuan.hasAjax = true;
|
||||||
|
}
|
||||||
|
const option = reactive({
|
||||||
|
orderId: '',
|
||||||
|
memberId: '',
|
||||||
|
orderPrice: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
function toEmitChooseQuan(item) {
|
||||||
|
let arr = []
|
||||||
|
if (item) {
|
||||||
|
arr = [item]
|
||||||
|
} else {
|
||||||
|
if (myQuan.fullReductionCouponSel.id) {
|
||||||
|
arr.push(myQuan.fullReductionCouponSel)
|
||||||
|
}
|
||||||
|
const goodsQuan = myQuan.res.productCoupon.filter(v => v.checked)
|
||||||
|
arr.push(...goodsQuan)
|
||||||
|
}
|
||||||
|
uni.$emit('choose-quan', arr)
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
const payPrice = computed(() => {
|
||||||
|
const pay = option.orderPrice - discountAmount.value
|
||||||
|
return (pay < 0 ? 0 : pay).toFixed(2)
|
||||||
|
})
|
||||||
|
watch(() => myQuan.types.sel, (newval) => {
|
||||||
|
if (newval == 0) {
|
||||||
|
myQuan.res.fullReductionCoupon = returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value,
|
||||||
|
myQuan.fullReductionCouponSel)
|
||||||
|
}
|
||||||
|
if (newval == 1) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onLoad((opt) => {
|
||||||
|
Object.assign(option, opt)
|
||||||
|
getQuan()
|
||||||
|
})
|
||||||
|
let safebottomHeight = ref(0)
|
||||||
|
onReady(() => {
|
||||||
|
getSafeBottomHeight('bottom', 0).then(height => {
|
||||||
|
console.log(height);
|
||||||
|
safebottomHeight.value = height
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
// $quan-color:rgb(233, 77, 60);
|
||||||
|
$quan-color: #318AFE;
|
||||||
|
|
||||||
|
.no-use {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 200rpx;
|
||||||
|
height: 200rpx;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-b {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-gray {
|
||||||
|
border-radius: 18rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.price1 {
|
||||||
|
color: rgb(255, 107, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.payType {
|
||||||
|
.radio {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: rgb(255, 212, 0);
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
opacity: 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.active {
|
||||||
|
.radio {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-block {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: -30rpx;
|
||||||
|
display: block;
|
||||||
|
width: 12rpx;
|
||||||
|
top: 0;
|
||||||
|
background-color: rgb(255, 212, 0);
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.filtergray {
|
||||||
|
filter: grayscale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: rgb(255, 255, 255);
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
|
||||||
|
&.active {}
|
||||||
|
}
|
||||||
|
|
||||||
|
.use-btn {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 100rpx;
|
||||||
|
padding: 4rpx 20rpx;
|
||||||
|
color: $quan-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-font-40 {
|
||||||
|
font-size: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yilingqu {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 20rpx;
|
||||||
|
right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lingqu {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 20rpx;
|
||||||
|
right: 20rpx;
|
||||||
|
background-color: rgb(255, 207, 0);
|
||||||
|
padding: 10rpx 30rpx;
|
||||||
|
border-radius: 100rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
background-color: $my-main-color;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hui {
|
||||||
|
// background-color: $quan-color;
|
||||||
|
background-image: linear-gradient(to right bottom, rgb(254, 103, 4), rgb(241, 50, 42));
|
||||||
|
padding: 4rpx 10rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quan {
|
||||||
|
border: 1px solid rgb(238, 238, 238);
|
||||||
|
position: relative;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
box-shadow: 0 0 5px #eee;
|
||||||
|
overflow: hidden;
|
||||||
|
.left{
|
||||||
|
max-width: 80%;
|
||||||
|
}
|
||||||
|
.sel {
|
||||||
|
padding: 2rpx 4rpx;
|
||||||
|
position: absolute;
|
||||||
|
background-color: $quan-color;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
border-radius: 0 0 24rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
padding: 20rpx 24rpx;
|
||||||
|
color: #fff;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background-color: $quan-color;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.goods {
|
||||||
|
.right {
|
||||||
|
background-color: #fff;
|
||||||
|
position: initial;
|
||||||
|
|
||||||
|
.use-btn {
|
||||||
|
padding: 10rpx 40rpx;
|
||||||
|
color: #fff;
|
||||||
|
background-color: $quan-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
padding: 30rpx 30rpx 80rpx 30rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
250
pagesOrder/quan_util.js
Normal file
250
pagesOrder/quan_util.js
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
export function isTui(item) {
|
||||||
|
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||||
|
}
|
||||||
|
//是否使用会员价
|
||||||
|
export function isUseVipPrice(vipUser,goods){
|
||||||
|
return vipUser.id&&vipUser.isVip&&goods.isMember
|
||||||
|
}
|
||||||
|
|
||||||
|
//计算商品券优惠价格
|
||||||
|
export function returnProductCouponPrice(coup, goodsArr, vipUser) {
|
||||||
|
const item = goodsArr.find(v => v.productId == coup.proId);
|
||||||
|
if (!item) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||||
|
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
|
||||||
|
return price * coup.num
|
||||||
|
|
||||||
|
}
|
||||||
|
//返回新的商品列表,过滤掉退菜的,退单的商品
|
||||||
|
export function returnNewGoodsList(arr) {
|
||||||
|
let goodsMap = {}
|
||||||
|
return arr.filter(v => !isTui(v))
|
||||||
|
}
|
||||||
|
//根据当前购物车商品以及数量,已选券对应商品数量,判断该商品券是否可用
|
||||||
|
export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
|
||||||
|
// if(!coup.use){
|
||||||
|
// return false
|
||||||
|
// }
|
||||||
|
const findGoods = goodsArr.filter(v => v.productId == coup.proId)
|
||||||
|
if (!findGoods.length) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const findGoodsTotalNumber = findGoods.reduce((prve, cur) => {
|
||||||
|
return prve + cur.num * 1
|
||||||
|
}, 0)
|
||||||
|
const selCoupNumber = selCoupArr.filter(v => v.proId == coup.proId).reduce((prve, cur) => {
|
||||||
|
return prve + cur.num * 1
|
||||||
|
}, 0)
|
||||||
|
if (selCoupNumber >= findGoodsTotalNumber) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
console.log(selCoupNumber,findGoodsTotalNumber);
|
||||||
|
return findGoodsTotalNumber < selCoupNumber ? false : true
|
||||||
|
}
|
||||||
|
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
|
||||||
|
export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
|
||||||
|
const newGoodsArr = returnNewGoodsList(goodsArr)
|
||||||
|
const item = newGoodsArr.find(v => v.productId == coup.proId);
|
||||||
|
if (!item) {
|
||||||
|
return {
|
||||||
|
...coup,
|
||||||
|
discountAmount: 0,
|
||||||
|
use: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||||
|
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
|
||||||
|
const discountAmount = (price * coup.num).toFixed(2)
|
||||||
|
console.log(discountAmount);
|
||||||
|
|
||||||
|
// const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
|
||||||
|
// const canUse=discountAmount>0
|
||||||
|
const canUse=coup.use
|
||||||
|
return {
|
||||||
|
...coup,
|
||||||
|
discountAmount: discountAmount,
|
||||||
|
use: canUse
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据购物车商品计算商品券抵扣价格以及是否满足可用需求
|
||||||
|
* 1.商品券对应商品数量大于购物车对应商品数量不可用
|
||||||
|
* 2.未在购物车找到相关商品不可用
|
||||||
|
* @param {*} coupArr
|
||||||
|
* @param {*} goodsArr
|
||||||
|
* @param {*} vipUser
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
|
||||||
|
return coupArr.map((v) => {
|
||||||
|
return returnProductCoupon(v, goodsArr, vipUser)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
//返回商品实际支付价格
|
||||||
|
export function returnProductPayPrice(goods,vipUser){
|
||||||
|
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
|
||||||
|
const price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
|
||||||
|
return price
|
||||||
|
}
|
||||||
|
//返回商品券抵扣的商品价格
|
||||||
|
export function returnProductCoupAllPrice(productPriceArr,startIndex,num,isMember=true){
|
||||||
|
console.log(productPriceArr);
|
||||||
|
return productPriceArr.slice(startIndex,startIndex+num).reduce((prve,cur)=>{
|
||||||
|
let curPrice=0
|
||||||
|
if(typeof cur==='object'){
|
||||||
|
curPrice=isMember?cur.memberPrice*1:cur.price
|
||||||
|
}else{
|
||||||
|
curPrice=cur*1
|
||||||
|
}
|
||||||
|
return prve+curPrice
|
||||||
|
},0)
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回商品券可抵扣的商品数量
|
||||||
|
export function returnProductCanUseNum(productPriceArr,startIndex,num){
|
||||||
|
console.log(productPriceArr);
|
||||||
|
console.log(num);
|
||||||
|
let n=0;
|
||||||
|
for(let i=0;i<num;i++){
|
||||||
|
if(productPriceArr[startIndex*1+i]){
|
||||||
|
n+=1
|
||||||
|
console.log(n);
|
||||||
|
}else{
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回同类商品券在同类商品价格数组里的开始位置
|
||||||
|
export function returnProCoupStartIndex(coupArr,index){
|
||||||
|
return coupArr.slice(0,index).reduce((prve,cur)=>{
|
||||||
|
return prve+cur.num*1
|
||||||
|
},0)
|
||||||
|
}
|
||||||
|
//返回商品数量从0到n每一个对应的价格对照表
|
||||||
|
export function returnGoodsPayPriceMap(goodsArr){
|
||||||
|
return goodsArr.reduce((prve,cur)=>{
|
||||||
|
if(!prve.hasOwnProperty(cur.productId)){
|
||||||
|
prve[cur.productId]=[]
|
||||||
|
}
|
||||||
|
const arr=new Array(cur.num).fill(cur).map(v=>{
|
||||||
|
return {
|
||||||
|
memberPrice:v.memberPrice?v.memberPrice:v.price,
|
||||||
|
price:v.price
|
||||||
|
}
|
||||||
|
})
|
||||||
|
prve[cur.productId].push(...arr)
|
||||||
|
return prve
|
||||||
|
},{})
|
||||||
|
}
|
||||||
|
//计算商品券总优惠价格
|
||||||
|
export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
|
||||||
|
if (coupArr.length == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//商品分组
|
||||||
|
const goodsMap={}
|
||||||
|
//商品数量从0到n每一个对应的价格
|
||||||
|
const goodsPayPriceMap={}
|
||||||
|
//商品券分组
|
||||||
|
let coupMap={}
|
||||||
|
for(let i in coupArr){
|
||||||
|
const coup=coupArr[i]
|
||||||
|
if(coupMap.hasOwnProperty(coup.proId)){
|
||||||
|
coupMap[coup.proId].push(coup)
|
||||||
|
}else{
|
||||||
|
coupMap[coup.proId]=[coup]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let total=0
|
||||||
|
for(let key in coupMap){
|
||||||
|
const arr=coupMap[key]
|
||||||
|
for(let i in arr){
|
||||||
|
const coup=arr[i]
|
||||||
|
if(!goodsMap.hasOwnProperty(coup.proId)){
|
||||||
|
goodsMap[coup.proId]=goodsArr.filter(v=>v.productId==coup.proId).map(v=>{
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
payPrice:returnProductPayPrice(v,vipUser)
|
||||||
|
}
|
||||||
|
}).sort((a,b)=>{
|
||||||
|
const aPrice=a.payPrice
|
||||||
|
const bPrice=b.payPrice
|
||||||
|
return aPrice-bPrice
|
||||||
|
})
|
||||||
|
goodsPayPriceMap[coup.proId]=goodsMap[coup.proId].reduce((prve,cur)=>{
|
||||||
|
const arr=new Array(cur.num).fill(cur.payPrice)
|
||||||
|
console.log(arr);
|
||||||
|
prve.push(...arr)
|
||||||
|
return prve
|
||||||
|
},[])
|
||||||
|
}
|
||||||
|
const proCoupStartIndex=returnProCoupStartIndex(arr,i)
|
||||||
|
console.log(proCoupStartIndex);
|
||||||
|
const coupNum=Math.min(goodsPayPriceMap[coup.proId].length,coup.num)
|
||||||
|
console.log(coupNum);
|
||||||
|
total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coupNum)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return total.toFixed(2);
|
||||||
|
|
||||||
|
}
|
||||||
|
//计算满减券总优惠价格
|
||||||
|
export function returnFullReductionCouponAllPrice(coupArr) {
|
||||||
|
if (coupArr.length == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return coupArr.filter(v => v.type == 1).reduce((a, b) => {
|
||||||
|
const price = b.discountAmount
|
||||||
|
return a + price;
|
||||||
|
}, 0).toFixed(2);
|
||||||
|
|
||||||
|
}
|
||||||
|
//计算优惠券总价格
|
||||||
|
export function returnCouponAllPrice(coupArr, goodsArr, vipUser) {
|
||||||
|
const poductAllprice = returnProductCouponAllPrice(coupArr, goodsArr, vipUser)
|
||||||
|
const pointAllPrice = returnFullReductionCouponAllPrice(coupArr)
|
||||||
|
return (poductAllprice * 1 + pointAllPrice * 1).toFixed(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回当前满减券列表可用状态
|
||||||
|
export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
|
||||||
|
return coupArr.map(v => {
|
||||||
|
if (v.id == selCoup.id) {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
const isfullAmount = payPrice >= v.fullAmount * 1
|
||||||
|
if(payPrice<=0){
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
use: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
use: v.use && isfullAmount
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据商品数量还有商品券数量返回优惠券可以使用的数量数组
|
||||||
|
export function returnCanUseNumProductCoup(coupArr,){
|
||||||
|
let productCoup = coupArr.filter(v => v.type == 2)
|
||||||
|
//商品券分组
|
||||||
|
let coupMap={}
|
||||||
|
for(let i in productCoup){
|
||||||
|
const coup=productCoup[i]
|
||||||
|
if(coupMap.hasOwnProperty(coup.proId)){
|
||||||
|
coupMap[coup.proId].push(coup)
|
||||||
|
}else{
|
||||||
|
coupMap[coup.proId]=[coup]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arr
|
||||||
|
}
|
||||||
1
pagesOrder/static/image/no-use.svg
Normal file
1
pagesOrder/static/image/no-use.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 6.4 KiB |
@@ -20,7 +20,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<template v-if="option.productId=='-999'">
|
<template v-if="option.productId=='-999'">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view class="color-red">¥{{item.priceAmount}}</view>
|
<view class="color-red" >¥{{item.priceAmount}}</view>
|
||||||
<view class="u-flex u-m-l-32 u-col-center">
|
<view class="u-flex u-m-l-32 u-col-center">
|
||||||
<view class="u-m-l-28 u-m-r-28">x{{item.number}}</view>
|
<view class="u-m-l-28 u-m-r-28">x{{item.number}}</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view class="color-red">¥{{item.priceAmount}}</view>
|
<view class="color-red" v-if="!option.userCouponId">¥{{item.priceAmount}}</view>
|
||||||
<view class="u-flex u-m-l-32 u-col-center">
|
<view class="u-flex u-m-l-32 u-col-center">
|
||||||
<up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon>
|
<up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon>
|
||||||
<view class="u-m-l-28 u-m-r-28">{{item.number}}</view>
|
<view class="u-m-l-28 u-m-r-28">{{item.number}}</view>
|
||||||
@@ -39,21 +39,24 @@
|
|||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
|
<template v-if="!option.userCouponId">
|
||||||
<view>支付金额</view>
|
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
|
||||||
<view>
|
<view>支付金额</view>
|
||||||
{{to2(totalPrice)}}元
|
<view>
|
||||||
|
{{to2(totalPrice)}}元
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
|
||||||
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
|
<view>退款金额</view>
|
||||||
<view>退款金额</view>
|
<view class="color-red">
|
||||||
<view class="color-red">
|
{{to2(tuikuanPrice)}}元
|
||||||
{{to2(tuikuanPrice)}}元
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</template>
|
||||||
|
|
||||||
<view class="bg-fff u-p-24 border-r-12 u-m-t-32">
|
<view class="bg-fff u-p-24 border-r-12 u-m-t-32">
|
||||||
<view>退回优惠券</view>
|
<view>退回优惠券</view>
|
||||||
<view class="u-font-24 color-999 u-m-t-16">
|
<view class="u-font-24 color-999 u-m-t-16" v-if="!option.userCouponId">
|
||||||
该订单未使用优惠券
|
该订单未使用优惠券
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -143,7 +146,8 @@
|
|||||||
})
|
})
|
||||||
const tuikuanPrice = computed(() => {
|
const tuikuanPrice = computed(() => {
|
||||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||||
return prve + cur.number * cur.price
|
const n=(cur.number/cur.num*100) * cur.priceAmount
|
||||||
|
return prve + (n/100).toFixed(2)
|
||||||
}, 0)
|
}, 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user