订单结算更新

This commit is contained in:
YeMingfei666 2025-11-12 13:43:35 +08:00
parent 378cddb582
commit d0cee95145
6 changed files with 395 additions and 429 deletions

View File

@ -9,7 +9,7 @@
"jsencrypt": "^3.3.2", "jsencrypt": "^3.3.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"uview-plus": "^3.3.32", "uview-plus": "^3.3.32",
"ysk-utils": "^1.0.56" "ysk-utils": "^1.0.58"
}, },
"devDependencies": { "devDependencies": {
"copy-webpack-plugin": "^12.0.2", "copy-webpack-plugin": "^12.0.2",

View File

@ -1,305 +1,319 @@
<template> <template>
<view class="page-gray"> <view class="page-gray">
<view class="bg-fff"> <view class="bg-fff">
<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
v-model="searchValue"> bgColor="#F9F9F9"
</uni-search-bar> cancelButton="none"
</view> placeholder="输入桌号"
<!-- <view class="u-flex"> @confirm="search"
v-model="searchValue"
>
</uni-search-bar>
</view>
<!-- <view class="u-flex">
<image src="/pagesCreateOrder/static/images/icon-saoma.svg" class="icon-saoma" mode=""></image> <image src="/pagesCreateOrder/static/images/icon-saoma.svg" class="icon-saoma" mode=""></image>
</view> --> </view> -->
</view> </view>
<view> <view>
<picker @change="areaChange" range-key="name" :value="area.defaultCateIndex" :range="area.list"> <picker
<view class="u-flex u-row-between area"> @change="areaChange"
<view class="color-333">桌台类型<text v-if="area.sel">{{area.sel.name}}</text> <text range-key="name"
v-else>全部</text> </view> :value="area.defaultCateIndex"
<uni-icons type="right"></uni-icons> :range="area.list"
</view> >
</picker> <view class="u-flex u-row-between area">
</view> <view class="color-333"
</view> >桌台类型<text v-if="area.sel">{{ area.sel.name }}</text>
<text v-else>全部</text>
</view>
<uni-icons type="right"></uni-icons>
</view>
</picker>
</view>
</view>
<view class="list "> <view class="list">
<view class=""> <view class="">
<template v-if="tables.list.length"> <template v-if="tables.list.length">
<view class=" bg-fff box bg-fff"> <view class="bg-fff box bg-fff">
<view class="" v-for="(item,index) in tables.list" :key="index" @tap="chooseTable(index,item)"> <view
<template v-if="item.status=='idle'"> class=""
<view class="u-flex item u-row-between" style="border-bottom: 1px solid #E5E5E5;"> v-for="(item, index) in tables.list"
<view class="u-flex"> :key="index"
<view class=""> @tap="chooseTable(index, item)"
<view class="u-flex"> >
<view>{{item.name}}</view> <template v-if="item.status == 'idle'">
<view class="line"></view> <view
<view>{{''}}</view> class="u-flex item u-row-between"
</view> style="border-bottom: 1px solid #e5e5e5"
<view class="color-999 u-font-24 u-m-t-12"> >
<text <view class="u-flex">
:style="{color:returnStutasColor(item.status)}">{{returnStutasText(item.status)}}</text> <view class="">
</view> <view class="u-flex">
</view> <view>{{ item.name }}</view>
</view> <view class="line"></view>
<view class="my-radio u-font-28 u-flex color-333"> <view>{{ "" }}</view>
<view class="circle u-flex u-row-center" </view>
:class="{active:index==tables.selIndex}"> <view class="color-999 u-font-24 u-m-t-12">
<uni-icons type="checkmarkempty" :size="16" color="#fff"></uni-icons> <text
</view> :style="{ color: returnStutasColor(item.status) }"
</view> >{{ returnStutasText(item.status) }}</text
</view> >
</template> </view>
</view> </view>
</view> </view>
<view class="u-m-t-32"> <view class="my-radio u-font-28 u-flex color-333">
<my-pagination :page="query.page" :totalElements="query.totalElements" :size="query.size" <view
@change="pageChange"></my-pagination> class="circle u-flex u-row-center"
</view> :class="{ active: index == tables.selIndex }"
>
<uni-icons
type="checkmarkempty"
:size="16"
color="#fff"
></uni-icons>
</view>
</view>
</view>
</template>
</view>
</view>
<view class="u-m-t-32">
<my-pagination
:page="query.page"
:totalElements="query.totalElements"
:size="query.size"
@change="pageChange"
></my-pagination>
</view>
</template>
</template> <template v-if="tables.list.length <= 0">
<my-img-empty tips="未找到相关的桌台"></my-img-empty>
</template>
<template v-if="tables.list.length<=0"> </view>
<my-img-empty tips="未找到相关的桌台"></my-img-empty> </view>
</template> </view>
</view>
</view>
</view>
</template> </template>
<script setup> <script setup>
import { import { $table, $tableArea } from "@/http/yskApi/table.js";
$table, import { reactive, ref, watch } from "vue";
$tableArea import { $status } from "@/commons/table-status.js";
} from '@/http/yskApi/table.js' import { onLoad } from "@dcloudio/uni-app";
import { let nouser = ref(false);
reactive,
ref,
watch
} from 'vue';
import {
$status
} from '@/commons/table-status.js'
import {
onLoad
} from '@dcloudio/uni-app'
let nouser = ref(false)
function returnStutasText(key) { function returnStutasText(key) {
const item = $status[key] const item = $status[key];
return item ? item.label : '' return item ? item.label : "";
} }
function returnStutasColor(key) { function returnStutasColor(key) {
// if(key=='using'){ // if(key=='using'){
// return 'rgb(250,85,85)' // return 'rgb(250,85,85)'
// }else{ // }else{
// return '' // return ''
// } // }
const item = $status[key] const item = $status[key];
return item ? item.type : '' return item ? item.type : "";
} }
function emitChooeTable(data) { function emitChooeTable(data) {
uni.$emit('choose-table', data) uni.$emit("choose-table", data);
setTimeout(() => { setTimeout(() => {
uni.navigateBack() uni.navigateBack();
}, 100) }, 100);
} }
let searchValue = ref('') let searchValue = ref("");
function search() { function search() {
query.page = 1 query.page = 1;
getTable() getTable();
} }
function chooseTable(index, item) { function chooseTable(index, item) {
if (item.status == 'closed') { if (item.status == "closed") {
return uni.showToast({ return uni.showToast({
title: '该桌台已关闭!', title: "该桌台已关闭!",
icon: 'none' icon: "none",
}) });
} }
if (index === undefined || item === undefined) { if (index === undefined || item === undefined) {
nouser.value = true nouser.value = true;
return emitChooeTable() return emitChooeTable();
} else { } else {
tables.selIndex = index tables.selIndex = index;
emitChooeTable(item) emitChooeTable(item);
} }
} }
//
const area = reactive({
list: [
{
name: "全部",
},
],
defaultCateIndex: 0,
sel: "",
});
function areaChange(e) {
area.defaultCateIndex = e.detail.value;
area.sel = area.list[e.detail.value];
query.page = 1;
getTable();
}
const query = {
page: 1,
size: 10,
areaId: 0,
totalElements: 0,
};
//
function pageChange(page) {
console.log(page);
query.page = page;
getTable();
}
const tables = reactive({
hasAjax: false,
selIndex: -1,
originList: [],
list: [],
});
async function getTable() {
// let state=status.list[status.active].key
// state=state?(state=='all'?'':state):''
const areaId = area.list[area.defaultCateIndex].id || "";
let { data } = await $table.get({
...query,
areaId,
name: searchValue.value,
state: "idle",
});
query.totalElements = data.totalRow || 0;
tables.hasAjax = true;
tables.list = data.records;
tables.selIndex = data.records.findIndex(
(v) => v.tableCode == option.tableCode
);
tables.originList = data.records;
}
async function getArea() {
const { data } = await $tableArea.get({
page: 0,
size: 300,
});
data.records.unshift({
name: "全部",
});
area.list = data.records.map((v) => {
return {
...v,
};
});
}
// watch(
const area = reactive({ () => area.sel,
list: [{ (newval) => {
name: '全部' getTable();
}], }
defaultCateIndex: 0, );
sel: '' let option = {};
}) onLoad((opt) => {
Object.assign(option, opt);
function areaChange(e) { console.log(option);
area.defaultCateIndex = e.detail.value getTable();
area.sel = area.list[e.detail.value] getArea();
query.page = 1 });
getTable()
}
const query = {
page: 1,
size: 10,
areaId: 0,
totalElements: 0
}
//
function pageChange(page) {
console.log(page);
query.page = page
getTable()
}
const tables = reactive({
hasAjax: false,
selIndex: -1,
originList: [],
list: []
})
async function getTable() {
// let state=status.list[status.active].key
// state=state?(state=='all'?'':state):''
const areaId = area.list[area.defaultCateIndex].id || ''
let {
data
} = await $table.get({
...query,
areaId,
name: searchValue.value,
state: 'idle'
})
query.totalElements = data.totalRow || 0;
tables.hasAjax = true;
tables.list = data.records
tables.selIndex = data.records.findIndex(v => v.tableCode == option.tableCode)
tables.originList = data.records
}
async function getArea() {
const {
data
} = await $tableArea.get({
page: 0,
size: 300
})
data.records.unshift({
name: '全部'
})
area.list = data.records.map(v => {
return {
...v,
}
})
}
watch(() => area.sel, (newval) => {
getTable()
})
let option = {}
onLoad(opt => {
Object.assign(option, opt)
console.log(option);
getTable()
getArea()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.line { .line {
width: 1px; width: 1px;
height: 20rpx; height: 20rpx;
background-color: #E5E5E5; background-color: #e5e5e5;
margin-left: 8rpx; margin-left: 8rpx;
margin-right: 16rpx; margin-right: 16rpx;
} }
.my-radio { .my-radio {
.circle {
background: #ffffff;
width: 18px;
height: 18px;
.circle { &.active {
background: #FFFFFF; background-color: $my-main-color;
width: 18px; border-color: $my-main-color;
height: 18px; }
&.active { border: 1px solid #707070;
background-color: $my-main-color; border-radius: 50%;
border-color: $my-main-color; overflow: hidden;
}
border: 1px solid #707070; &.square {
border-radius: 50%; border-radius: 8rpx;
overflow: hidden; }
}
}
&.square { .area {
border-radius: 8rpx; padding: 2px 28rpx 24rpx 28rpx;
} }
}
} .scale7 {
transform: scale(0.7);
}
.area { ::v-deep .uni-searchbar {
padding: 2px 28rpx 24rpx 28rpx; padding: 0 !important;
} }
.scale7 { .search {
transform: scale(0.7); padding: 20rpx 28rpx 20rpx 28rpx;
}
::v-deep .uni-searchbar { .icon-saoma {
padding: 0 !important; margin-left: 20rpx;
} width: 34rpx;
height: 32rpx;
}
}
.search { .list {
padding: 20rpx 28rpx 20rpx 28rpx; padding: 32rpx 24rpx;
.icon-saoma { .no-choose {
margin-left: 20rpx; padding: 36rpx 30rpx 36rpx 24rpx;
width: 34rpx; }
height: 32rpx;
}
}
.list { .box {
padding: 32rpx 24rpx; padding: 32rpx 30rpx 32rpx 24rpx;
.no-choose { .item {
padding: 36rpx 30rpx 36rpx 24rpx; padding: 24rpx 0;
}
.box { .headimg {
padding: 32rpx 30rpx 32rpx 24rpx; border-radius: 12rpx 12rpx 12rpx 12rpx;
overflow: hidden;
font-size: 0;
width: 84rpx;
height: 84rpx;
.item { .img {
padding: 24rpx 0; width: 84rpx;
height: 84rpx;
}
}
}
.headimg { .item:not(:first-child) {
border-radius: 12rpx 12rpx 12rpx 12rpx; border-top: 1px solid #e5e5e5;
overflow: hidden; }
font-size: 0; }
width: 84rpx; }
height: 84rpx;
.img {
width: 84rpx;
height: 84rpx;
}
}
}
.item:not(:first-child) {
border-top: 1px solid #E5E5E5;
}
}
}
</style> </style>

View File

@ -384,20 +384,20 @@
</view> </view>
</view> </view>
<view class="border-bottom"> <view class="border-bottom">
<template v-if="$seatFee && $seatFee.totalAmount"> <template v-if="orderCostSummary.seatFee > 0">
<view class="u-flex u-row-between u-m-t-18 u-p-b-34"> <view class="u-flex u-row-between u-m-t-18 u-p-b-34">
<view> <view>
<text>桌位费</text> <text>桌位费</text>
</view> </view>
<view>{{ $seatFee.totalAmount.toFixed(2) || "0.00" }}</view> <view>{{ orderCostSummary.seatFee }}</view>
</view> </view>
</template> </template>
<template v-if="$packFee > 0"> <template v-if="orderCostSummary.packFee > 0">
<view class="u-flex u-row-between u-m-t-18 u-p-b-34"> <view class="u-flex u-row-between u-m-t-18 u-p-b-34">
<view> <view>
<text>打包费</text> <text>打包费</text>
</view> </view>
<view>{{ $packFee || "0.00" }}</view> <view>{{ orderCostSummary.packFee }}</view>
</view> </view>
</template> </template>
</view> </view>
@ -412,7 +412,9 @@
<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">{{ orderCostSummary.finalPayAmount }}</view> <view class="font-bold u-font-32"
>{{ orderCostSummary.finalPayAmount }}</view
>
</view> </view>
</view> </view>
</view> </view>
@ -479,7 +481,6 @@ import { getSafeBottomHeight } from "@/commons/utils/safe-bottom.js";
import go from "@/commons/utils/go.js"; import go from "@/commons/utils/go.js";
import { hasPermission } from "@/commons/utils/hasPermission.js"; import { hasPermission } from "@/commons/utils/hasPermission.js";
import { getNowCart } from "@/pagesCreateOrder/util.js"; import { getNowCart } from "@/pagesCreateOrder/util.js";
import { number } from "uview-plus/libs/function/test";
import { getShopTableDetail } from "@/http/api/table.js"; import { getShopTableDetail } from "@/http/api/table.js";
import { getShopInfo } from "@/http/api/shop.js"; import { getShopInfo } from "@/http/api/shop.js";
@ -622,7 +623,6 @@ const $seatFee = reactive({
* 打包费 * 打包费
*/ */
const $packFee = computed(() => { const $packFee = computed(() => {
let packAmount = 0;
return goods.list return goods.list
.reduce((prve, cur) => { .reduce((prve, cur) => {
return prve + (cur.packFee || 0) * parseFloat(cur.pack_number).toFixed(2); return prve + (cur.packFee || 0) * parseFloat(cur.pack_number).toFixed(2);
@ -630,15 +630,6 @@ const $packFee = computed(() => {
.toFixed(2); .toFixed(2);
}); });
/**
* 菜品数量
*/
const goodsNumber = computed(() => {
const result = goods.list.reduce((prve, cur) => {
return prve + cur.number;
}, 0);
return result;
});
/** /**
* 判断是否是会员 * 判断是否是会员
@ -652,57 +643,13 @@ const isVip = computed(() => {
); );
}); });
const discount_sale_amount = computed(() => {
return goods.list
.filter((v) => v.discount_sale_amount && v.discount_sale_amount > 0)
.reduce((a, b) => {
const lowMemberPrice = b.lowMemberPrice ? b.lowMemberPrice : b.lowPrice;
const tPrice = isVip.value ? lowMemberPrice : b.lowPrice;
return a + b.number * (tPrice - b.discount_sale_amount);
}, 0);
});
function returnLimitPrice(data) {
const price = yskUtils.limitUtils.returnPrice({
goods: data,
shopInfo: shopInfo,
limitTimeDiscountRes: pageData.limitTimeDiscount,
shopUserInfo: null,
idKey: "id",
});
return price;
}
const goodsPrice = computed(() => {
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
const lowMemberPrice = cur.lowMemberPrice
? cur.lowMemberPrice
: cur.lowPrice;
let price = isVip.value ? lowMemberPrice : cur.lowPrice;
if (cur.is_time_discount) {
price = returnLimitPrice(cur);
}
const tPrice = Math.floor(price * cur.number * 100) / 100;
return prve + (cur.is_gift ? 0 : tPrice);
}, 0);
const tpackFee = $packFee.value > 0 ? $packFee.value * 1 : 0;
return (goodsTotalPrice - discount_sale_amount.value + tpackFee || 0).toFixed(
2
);
});
/**
* 实收金额
*/
const allPrice = computed(() => {
const n = goodsPrice.value * 1 + $seatFee.totalAmount;
return n.toFixed(2);
});
/** /**
* 计算优惠金额 * 计算优惠金额
*/ */
const youhui = computed(() => { const youhui = computed(() => {
return 0 return 0;
}); });
function toFixed(price, item) { function toFixed(price, item) {
@ -752,16 +699,17 @@ function onMessage() {
switch (msg.operate_type) { switch (msg.operate_type) {
case "pad_init": case "pad_init":
goods.list = []; goods.list = [];
console.log(msg.data);
msg.data.map((item) => { msg.data.map((item) => {
cartItem = getNowCart(item, $goods, pageData.user); cartItem = getNowCart(item, $goods, pageData.user);
console.log(cartItem);
if (cartItem.isGrounding || cartItem.is_temporary == 1) { if (cartItem.isGrounding || cartItem.is_temporary == 1) {
cartControls(cartItem, "add"); cartControls(cartItem, "add");
} else { } else {
delCart(cartItem.id); delCart(cartItem.id);
} }
}); });
if (pageData.eatTypes.isShow) { if (pageData.eatTypes.isShow) {
if (pageData.eatTypes.active == "take-out") { if (pageData.eatTypes.active == "take-out") {
cartItem.pack_number = cartItem.number; cartItem.pack_number = cartItem.number;
@ -811,6 +759,9 @@ function onMessage() {
case "product_update": case "product_update":
init(); init();
break; break;
case "pad_batch":
init();
break;
} }
}); });
} }
@ -838,22 +789,28 @@ function cartControls(cartItem, type) {
pageData.table.tableCode = cartItem.table_code; pageData.table.tableCode = cartItem.table_code;
} }
let cartIndex = 0; let cartIndex = 0;
goods.list.map((item, index) => { goods.list.map((item, index) => {
if (item.id == cartItem.id) { if (item.id == cartItem.id) {
cartIndex = index; cartIndex = index;
} }
}); });
if (type == "del") { if (type == "del") {
goods.list.splice(cartIndex, 1); goods.list.splice(cartIndex, 1);
return; return;
} }
if (type == "add") { if (type == "add") {
goods.list.push(cartItem); goods.list.push({...cartItem,packNumber:cartItem.pack_number});
} }
if (type == "edit") { if (type == "edit") {
goods.list[cartIndex].number = cartItem.number; goods.list[cartIndex].number = cartItem.number;
goods.list[cartIndex].pack_number = cartItem.pack_number;
goods.list[cartIndex].packNumber = cartItem.pack_number;
} }
} }
/** /**
@ -880,6 +837,7 @@ async function getTbShopInfo() {
id: uni.getStorageSync("shopId"), id: uni.getStorageSync("shopId"),
}); });
pageData.shopInfo = res.data; pageData.shopInfo = res.data;
seatFeeConfig.pricePerPerson = res.data.tableFee || 0;
uni.setStorageSync("shopInfo", res.data); uni.setStorageSync("shopInfo", res.data);
} }
@ -922,7 +880,18 @@ async function changeUseType() {
if (!goods.list.length) { if (!goods.list.length) {
return; return;
} }
getCart(); websocketUtil.send(
JSON.stringify({
type: "pad",
is_pack: pageData.eatTypes.active == "take-out" ? 1 : 0,
account: uni.getStorageSync("shopInfo").id,
shop_id: uni.getStorageSync("shopInfo").id,
operate_type: "batch",
table_code: pageData.table.tableCode,
})
);
// getCart();
} }
/** /**
@ -1160,7 +1129,6 @@ async function createAnOrder() {
let vipPrice = isVip.value ? 1 : 0; let vipPrice = isVip.value ? 1 : 0;
let placeNum = pageData.orderInfo ? pageData.orderInfo.placeNum + 1 : 1; let placeNum = pageData.orderInfo ? pageData.orderInfo.placeNum + 1 : 1;
let originAmount = goodsPrice.value * 1 + youhui.value * 1;
let par = { let par = {
shopId: pageData.shopInfo.id, //Id shopId: pageData.shopInfo.id, //Id
userId: pageData.user.userId, //Id userId: pageData.user.userId, //Id
@ -1168,12 +1136,12 @@ async function createAnOrder() {
dineMode: pageData.eatTypes.active, // dine-in take-out take-away dineMode: pageData.eatTypes.active, // dine-in take-out take-away
remark: pageData.form.note, // remark: pageData.form.note, //
seatNum: 0, // seatNum: 0, //
packFee: $packFee.value, // packFee:pageData.eatTypes.active=='dine-in'?seatFeeConfig.personCount : 0, //
originAmount: originAmount, //+ originAmount: orderCostSummary.value.goodsRealAmount, //+
placeNum: placeNum, // placeNum: placeNum, //
waitCall: 0, // 0 1 waitCall: 0, // 0 1
vipPrice: vipPrice, //使 vipPrice: vipPrice, //使
limitRate:pageData.limitTimeDiscount limitRate: pageData.limitTimeDiscount,
}; };
if (!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id) { if (!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id) {
par.seatNum = userNumbers.defaultCateIndex * 1 + 1; par.seatNum = userNumbers.defaultCateIndex * 1 + 1;
@ -1186,7 +1154,7 @@ async function createAnOrder() {
console.log(res, "创建订单"); console.log(res, "创建订单");
if (res.code != 200) { if (res.code != 200) {
uni.showToast({ uni.showToast({
title: res.msg||'创建订单失败!', title: res.msg || "创建订单失败!",
icon: "none", icon: "none",
}); });
return; return;
@ -1223,7 +1191,7 @@ async function createAnOrder() {
"PAGES_ORDER_DETAIL", "PAGES_ORDER_DETAIL",
{ {
id: res.data.id, id: res.data.id,
dinnerType: pageData.eatTypes.active, dinnerType: pageData.eatTypes.active,
}, },
"redirect" "redirect"
); );
@ -1239,9 +1207,6 @@ async function createAnOrder() {
}); });
} }
// //
const selCoupon = ref([]); const selCoupon = ref([]);
// //
@ -1303,6 +1268,7 @@ const orderExtraConfig = computed(() => {
}); });
// //
const orderCostSummary = computed(() => { const orderCostSummary = computed(() => {
console.log(goods.list, "购物车数据");
const costSummary = yskUtils.OrderPriceCalculator.calculateOrderCostSummary( const costSummary = yskUtils.OrderPriceCalculator.calculateOrderCostSummary(
goods.list, goods.list,
pageData.eatTypes.active, pageData.eatTypes.active,
@ -1315,7 +1281,15 @@ const orderCostSummary = computed(() => {
console.log(" 订单费用汇总", costSummary); console.log(" 订单费用汇总", costSummary);
return costSummary; return costSummary;
}); });
watch(
() => $seatFee.totalNumber,
(newVal, oldVal) => {
seatFeeConfig.personCount = newVal;
},
{
immediate: true,
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -35,7 +35,6 @@ export function getNowCart(carItem,goodsList,user) {
}) })
} else { } else {
// 临时菜 // 临时菜
console.log(carItem,'salePrice1111111111')
carItem.number = parseFloat(carItem.number) carItem.number = parseFloat(carItem.number)
carItem.name = carItem.product_name carItem.name = carItem.product_name
carItem.lowPrice = carItem.discount_sale_amount carItem.lowPrice = carItem.discount_sale_amount

View File

@ -1,27 +1,29 @@
<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">
<view class="u-font-32"> <text class="price-fuhao"></text>
<text class="price-fuhao"></text> <text class="font-bold price">{{
<text class="font-bold price">{{ orderCostSummary.finalPayAmount
orderCostSummary.finalPayAmount }}</text>
}}</text> </view>
</view> <view
<view class="u-m-t-10 color-999 old-price" v-if="orderCostSummary.merchantReduction.actualAmount"> class="u-m-t-10 color-999 old-price"
<text class=""></text> v-if="orderCostSummary.merchantReduction.actualAmount"
<text class=" ">{{ returnMerchantReductionBeforeMoney }}</text> >
</view> <text class=""></text>
<view class="u-m-t-10 u-flex u-row-center color-main"> <text class=" ">{{ returnMerchantReductionBeforeMoney }}</text>
<view @click="discountShow">修改</view> </view>
</view> <view class="u-m-t-10 u-flex u-row-center color-main">
<view class="u-m-t-10 u-flex u-row-center color-main"> <view @click="discountShow">修改</view>
<view @click="chooseUser()">选择用户</view> </view>
</view> <view class="u-m-t-10 u-flex u-row-center color-main">
<view @click="chooseUser()">选择用户</view>
</view>
</view> </view>
<view class="content bg-fff border-r-12"> <view class="content bg-fff border-r-12">
<view class="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 <view
class="border-bottom-dashed u-p-b-30 u-p-t-30" class="border-bottom-dashed u-p-b-30 u-p-t-30"
v-if="orderCostSummary.newUserDiscount" v-if="orderCostSummary.newUserDiscount"
> >
@ -584,28 +586,7 @@ const discountSaleAmount = computed(() => {
} }
}); });
/**
* 优惠券金额
*/
const fullCouponDiscountAmount = computed(() => {
return pays.quan
.filter((v) => v.type == 1)
.reduce((prve, cur) => {
// console.log("",prve + cur.discountAmount * 1)
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);
});
// 使bignumber.js // 使bignumber.js
const returnMerchantReductionBeforeMoney = computed(() => { const returnMerchantReductionBeforeMoney = computed(() => {
@ -752,7 +733,7 @@ watch(
} }
); );
watch( watch(
() => payPrice.value, () => orderCostSummary.value.finalPayAmount,
(newval) => { (newval) => {
if (pageData.payUrlShow) { if (pageData.payUrlShow) {
setTimeout(() => { setTimeout(() => {
@ -940,9 +921,6 @@ function changeAccountPoints() {
} }
} }
/** /**
* 选择优惠券 * 选择优惠券
*/ */
@ -1015,28 +993,28 @@ function chooseUser() {
function watchChooseuser() { function watchChooseuser() {
uni.$off("choose-user"); uni.$off("choose-user");
uni.$on("choose-user", (data) => { uni.$on("choose-user", (data) => {
if(pageData.user.id!=data.id){ if (pageData.user.id != data.id) {
selCoupon.value=[] selCoupon.value = [];
accountPoints.sel=false; accountPoints.sel = false;
} }
pageData.user = data; pageData.user = data;
if(data.id){ if (data.id) {
getNewUserDiscount() getNewUserDiscount();
} }
init(); init();
}); });
} }
// //
function getNewUserDiscount(){ function getNewUserDiscount() {
getDiscountByUserId({ getDiscountByUserId({
shopUserId: pageData.user.id shopUserId: pageData.user.id,
}).then(res=>{ }).then((res) => {
if(res.data){ if (res.data) {
newUserDiscount.value=res.data.amount||0 newUserDiscount.value = res.data.amount || 0;
} }
}) });
} }
/** /**
@ -1281,6 +1259,7 @@ function objToArrary(obj) {
item.map((v) => { item.map((v) => {
v.salePrice = v.salePrice ? v.salePrice : v.price; v.salePrice = v.salePrice ? v.salePrice : v.price;
v.number = v.num; v.number = v.num;
v.packFee = v.packAmount || 0;
return v; return v;
}); });
arr = [...arr, ...item]; arr = [...arr, ...item];

View File

@ -36,8 +36,8 @@ importers:
specifier: ^3.3.32 specifier: ^3.3.32
version: 3.6.10 version: 3.6.10
ysk-utils: ysk-utils:
specifier: ^1.0.56 specifier: ^1.0.58
version: 1.0.56 version: 1.0.58
devDependencies: devDependencies:
copy-webpack-plugin: copy-webpack-plugin:
specifier: ^12.0.2 specifier: ^12.0.2
@ -177,8 +177,8 @@ packages:
'@types/json-schema@7.0.15': '@types/json-schema@7.0.15':
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
'@types/node@24.10.0': '@types/node@24.10.1':
resolution: {integrity: sha512-qzQZRBqkFsYyaSWXuEHc2WR9c0a0CXwiE5FWUvn7ZM+vdy1uZLfCunD38UzhuB7YN/J11ndbDBcTmOdxJo9Q7A==} resolution: {integrity: sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==}
'@webassemblyjs/ast@1.14.1': '@webassemblyjs/ast@1.14.1':
resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==} resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==}
@ -269,8 +269,8 @@ packages:
base64-js@1.5.1: base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
baseline-browser-mapping@2.8.25: baseline-browser-mapping@2.8.26:
resolution: {integrity: sha512-2NovHVesVF5TXefsGX1yzx1xgr7+m9JQenvz6FQY3qd+YXkKkYiv+vTCc7OriP9mcDZpTC5mAOYN4ocd29+erA==} resolution: {integrity: sha512-73lC1ugzwoaWCLJ1LvOgrR5xsMLTqSKIEoMHVtL9E/HNk0PXtTM76ZIm84856/SF7Nv8mPZxKoBsgpm0tR1u1Q==}
hasBin: true hasBin: true
big.js@5.2.2: big.js@5.2.2:
@ -283,8 +283,8 @@ packages:
resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
engines: {node: '>=8'} engines: {node: '>=8'}
browserslist@4.27.0: browserslist@4.28.0:
resolution: {integrity: sha512-AXVQwdhot1eqLihwasPElhX2tAZiBjWdJ9i/Zcj2S6QYIjkx62OKSfnobkriB81C3l4w0rVy3Nt4jaTBltYEpw==} resolution: {integrity: sha512-tbydkR/CxfMwelN0vwdP/pLkDwyAASZ+VfWm4EOwlB6SWhx1sYnWLqo8N5j0rAzPfzfRaxt0mM/4wPU/Su84RQ==}
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true hasBin: true
@ -328,8 +328,8 @@ packages:
engines: {node: '>=0.10'} engines: {node: '>=0.10'}
hasBin: true hasBin: true
electron-to-chromium@1.5.249: electron-to-chromium@1.5.250:
resolution: {integrity: sha512-5vcfL3BBe++qZ5kuFhD/p8WOM1N9m3nwvJPULJx+4xf2usSlZFJ0qoNYO2fOX4hi3ocuDcmDobtA+5SFr4OmBg==} resolution: {integrity: sha512-/5UMj9IiGDMOFBnN4i7/Ry5onJrAGSbOGo3s9FEKmwobGq6xw832ccET0CE3CkkMBZ8GJSlUIesZofpyurqDXw==}
emojis-list@3.0.0: emojis-list@3.0.0:
resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==}
@ -688,8 +688,8 @@ packages:
webpack-cli: webpack-cli:
optional: true optional: true
ysk-utils@1.0.56: ysk-utils@1.0.58:
resolution: {integrity: sha512-TsRQGo1TEIVWZTc/j084eKVhTeI4r73dJRrzJHPUI56861hy40ekwYtozoa8v+LURXgEVIwXlMHM6zkgv8zBZw==} resolution: {integrity: sha512-hpu7QlcIn0lo0WAWjgjPAhEpCD0NQjVT0Xx0enJ6vytJt5ISKvTNO52xKWDPWs2VsW3PVIamMKJbbxX8VZ1QTA==}
snapshots: snapshots:
@ -801,7 +801,7 @@ snapshots:
'@types/json-schema@7.0.15': {} '@types/json-schema@7.0.15': {}
'@types/node@24.10.0': '@types/node@24.10.1':
dependencies: dependencies:
undici-types: 7.16.0 undici-types: 7.16.0
@ -920,7 +920,7 @@ snapshots:
base64-js@1.5.1: {} base64-js@1.5.1: {}
baseline-browser-mapping@2.8.25: {} baseline-browser-mapping@2.8.26: {}
big.js@5.2.2: {} big.js@5.2.2: {}
@ -930,13 +930,13 @@ snapshots:
dependencies: dependencies:
fill-range: 7.1.1 fill-range: 7.1.1
browserslist@4.27.0: browserslist@4.28.0:
dependencies: dependencies:
baseline-browser-mapping: 2.8.25 baseline-browser-mapping: 2.8.26
caniuse-lite: 1.0.30001754 caniuse-lite: 1.0.30001754
electron-to-chromium: 1.5.249 electron-to-chromium: 1.5.250
node-releases: 2.0.27 node-releases: 2.0.27
update-browserslist-db: 1.1.4(browserslist@4.27.0) update-browserslist-db: 1.1.4(browserslist@4.28.0)
buffer-from@1.1.2: {} buffer-from@1.1.2: {}
@ -978,7 +978,7 @@ snapshots:
detect-libc@1.0.3: detect-libc@1.0.3:
optional: true optional: true
electron-to-chromium@1.5.249: {} electron-to-chromium@1.5.250: {}
emojis-list@3.0.0: {} emojis-list@3.0.0: {}
@ -1079,7 +1079,7 @@ snapshots:
jest-worker@27.5.1: jest-worker@27.5.1:
dependencies: dependencies:
'@types/node': 24.10.0 '@types/node': 24.10.1
merge-stream: 2.0.0 merge-stream: 2.0.0
supports-color: 8.1.1 supports-color: 8.1.1
@ -1246,9 +1246,9 @@ snapshots:
unicorn-magic@0.3.0: {} unicorn-magic@0.3.0: {}
update-browserslist-db@1.1.4(browserslist@4.27.0): update-browserslist-db@1.1.4(browserslist@4.28.0):
dependencies: dependencies:
browserslist: 4.27.0 browserslist: 4.28.0
escalade: 3.2.0 escalade: 3.2.0
picocolors: 1.1.1 picocolors: 1.1.1
@ -1278,7 +1278,7 @@ snapshots:
'@webassemblyjs/wasm-parser': 1.14.1 '@webassemblyjs/wasm-parser': 1.14.1
acorn: 8.15.0 acorn: 8.15.0
acorn-import-phases: 1.0.4(acorn@8.15.0) acorn-import-phases: 1.0.4(acorn@8.15.0)
browserslist: 4.27.0 browserslist: 4.28.0
chrome-trace-event: 1.0.4 chrome-trace-event: 1.0.4
enhanced-resolve: 5.18.3 enhanced-resolve: 5.18.3
es-module-lexer: 1.7.0 es-module-lexer: 1.7.0
@ -1300,7 +1300,7 @@ snapshots:
- esbuild - esbuild
- uglify-js - uglify-js
ysk-utils@1.0.56: ysk-utils@1.0.58:
dependencies: dependencies:
bignumber.js: 9.3.1 bignumber.js: 9.3.1
loadsh: 0.0.4 loadsh: 0.0.4