增加备注

This commit is contained in:
2025-12-17 18:42:01 +08:00
parent 6053e15014
commit 5546e6ccbb
3 changed files with 993 additions and 884 deletions

View File

@@ -0,0 +1,97 @@
<template>
<view>
<up-popup
:show="show"
mode="center"
:safeAreaInsetBottom="mode === 'bottom' ? true : false"
>
<view class="popup-content">
<view class="top u-flex u-row-between">
<text class="font-bold u-font-32 color-333">{{ title }}</text>
<up-icon size="18" name="close" @click="show = false"></up-icon>
</view>
<up-line></up-line>
<scroll-view style="max-height: 50vh" :scroll-y="true">
<slot></slot>
</scroll-view>
<template v-if="showBottom">
<up-line></up-line>
<view class="bottom">
<view class="btn cancel" @click="close">{{ cancelText }}</view>
<view class="btn success" @click="confirm">{{ confirmText }}</view>
</view>
</template>
</view>
</up-popup>
</view>
</template>
<script setup>
const props = defineProps({
mode: {
type: String,
default: "center",
},
title: {
type: String,
default: "标题",
},
confirmText: {
type: String,
default: "确认",
},
cancelText: {
type: String,
default: "取消",
},
showBottom: {
type: Boolean,
default: true,
},
});
const show = defineModel({
type: Boolean,
default: false,
});
const emits = defineEmits(["close", "confirm"]);
function close() {
show.value = false;
emits("close");
}
function confirm() {
emits("confirm");
}
</script>
<style lang="scss">
.popup-content {
background: #fff;
width: 640rpx;
border-radius: 18rpx;
}
.top {
padding: 40rpx 48rpx;
}
.bottom {
padding: 48rpx 52rpx;
display: flex;
justify-content: space-between;
gap: 50rpx;
.btn {
flex: 1;
text-align: center;
padding: 18rpx 60rpx;
border-radius: 100rpx;
font-size: 32rpx;
border: 2rpx solid transparent;
&.success {
background-color: $my-main-color;
color: #fff;
}
&.cancel {
border-color: $my-main-color;
color: $my-main-color;
}
}
}
</style>

View File

@@ -1,13 +1,7 @@
<template> <template>
<view> <view>
<up-popup <up-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }"
:show="showCart" @close="close">
:round="20"
:safeAreaInsetBottom="false"
:zIndex="98"
:overlayStyle="{ zIndex: 98 }"
@close="close"
>
<view class="cart-list-wrap"> <view class="cart-list-wrap">
<!-- <view class="cart-header flex-between"> <!-- <view class="cart-header flex-between">
<view class="num">已点 {{ cartLists_count }} </view> <view class="num">已点 {{ cartLists_count }} </view>
@@ -26,23 +20,14 @@
<text class="clear-btn">清空购物车</text> <text class="clear-btn">清空购物车</text>
</view> </view>
</view> </view>
<view <view class="shop-item" v-for="(item, index) in cartList" :key="item.id">
class="shop-item"
v-for="(item, index) in cartList"
:key="item.id"
>
<view class="shop-item-content"> <view class="shop-item-content">
<view class="cover" v-if="item.productId != -999"> <view class="cover" v-if="item.productId != -999">
<view class="limit-discount" v-if="showLimitDiscount(item)"> <view class="limit-discount" v-if="showLimitDiscount(item)">
限时折扣 限时折扣
</view> </view>
<up-image <up-image :src="item.coverImg" width="124rpx" height="124rpx" mode="aspectFill"
:src="item.coverImg" radius="10"></up-image>
width="124rpx"
height="124rpx"
mode="aspectFill"
radius="10"
></up-image>
</view> </view>
<view class="info"> <view class="info">
<view class="name"> <view class="name">
@@ -58,34 +43,27 @@
</text> </text>
</view> </view>
<view class="select-sku-wrap" v-if="item.type == 'package'"> <view class="select-sku-wrap" v-if="item.type == 'package'">
<view <view v-for="(a, b) in dataprocessing(item.cartListinfo)" :key="b">
v-for="(a, b) in dataprocessing(item.cartListinfo)"
:key="b"
>
<!-- <view>{{a.title}}</view> --> <!-- <view>{{a.title}}</view> -->
<text <text v-for="i in a.goods" :key="i.proId" style="margin-left: 4rpx">
v-for="i in a.goods"
:key="i.proId"
style="margin-left: 4rpx"
>
{{ i.proName }} {{ i.proName }}
</text> </text>
</view> </view>
</view> </view>
<view class="u-font-24 color-666 u-flex">
<text style="max-width: 296rpx;" class="u-line-1">备注</text>
<image @click="editRemark(item)"
src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/9fe4df7c6c8b4290aa5f78282b143900.png"
style="width: 34rpx;height: 34rpx;"></image>
</view>
<view class="price-wrap" style="padding-top: 0"> <view class="price-wrap" style="padding-top: 0">
<view class="price"> <view class="price">
<text class="i">¥</text> <text class="i">¥</text>
<goodsPrice <goodsPrice :limitDiscount="limitDiscount" :cart="item"
:limitDiscount="limitDiscount" :shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></goodsPrice>
:cart="item"
:shopUserInfo="shopUserInfo"
:shopInfo="shopInfo"
></goodsPrice>
<text <text class="originalprice"
class="originalprice" v-if="showLimitDiscount(item)" v-if="showLimitDiscount(item)">{{ item.salePrice }}</text>
>{{ item.salePrice }}</text
>
<!-- <text class="originalprice" <!-- <text class="originalprice"
v-if="item.originPrice">¥{{item.originPrice}}</text> v-if="item.originPrice">¥{{item.originPrice}}</text>
@@ -94,33 +72,21 @@
<view class="operation-wrap"> <view class="operation-wrap">
<view class="btn"> <view class="btn">
<up-icon <up-icon color="#E8AD7B" name="minus-circle" size="18"></up-icon>
color="#E8AD7B" <view class="btnClick" @click="cartListadd(item, '-')"></view>
name="minus-circle"
size="18"
></up-icon>
<view
class="btnClick"
@click="cartListadd(item, '-')"
></view>
</view> </view>
<text class="num">{{ ifcartNumber(item) }}</text> <text class="num">{{ ifcartNumber(item) }}</text>
<view class="btn" v-if="item.type != 'package'"> <view class="btn" v-if="item.type != 'package'">
<!-- <up-icon name="plus-circle-fill" <!-- <up-icon name="plus-circle-fill"
:color="{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? '#CECECE' : '#E9AB7A'" :color="{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? '#CECECE' : '#E9AB7A'"
size="25"></up-icon> --> size="25"></up-icon> -->
<up-icon <up-icon name="plus-circle-fill" color="#E8AD7B"
name="plus-circle-fill" size="18"></up-icon>
color="#E8AD7B" <view class="btnClick" @click="cartListadd(item, '+')"></view>
size="18"
></up-icon>
<view
class="btnClick"
@click="cartListadd(item, '+')"
></view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
@@ -129,17 +95,63 @@
</scroll-view> </scroll-view>
</view> </view>
</up-popup> </up-popup>
<model v-model="modelData.show" title="单品备注" @confirm="modelDataConfirm">
<view class="u-p-40">
<up-input v-model="modelData.item.cartListinfo.remark" placeholder="备注"></up-input>
</view>
</model>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, defineProps, computed, defineEmits, watch } from "vue"; import {
import { productStore } from "@/stores/user.js"; ref,
defineProps,
computed,
defineEmits,
watch,
reactive
} from "vue";
import {
productStore
} from "@/stores/user.js";
import goodsPrice from "@/components/goods-price.vue"; import goodsPrice from "@/components/goods-price.vue";
import * as orderUtils from "@/utils/order-utils.js"; import * as orderUtils from "@/utils/order-utils.js";
import model from './modal.vue'
const modelData = reactive({
show: false,
item: {
cartListinfo:{
remark: ''
}
}
})
function editRemark(item) {
console.log('editRemark', item)
modelData.item = item
modelData.show = true
}
function modelDataConfirm() {
emits('customevent', {
id: modelData.item.cartListinfo.id,
product_id: modelData.item.cartListinfo.product_id,
sku_id: modelData.item.cartListinfo.sku_id,
number: modelData.item.cartListinfo.number,
type: "shopping",
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
operate_type: "edit",
remark:modelData.item.cartListinfo.remark
})
modelData.show = false
}
// 定义自定义事件 // 定义自定义事件
const emits = defineEmits(["customevent", "close", "clickcancelOrder"]); const emits = defineEmits(["customevent", "close", "clickcancelOrder", 'updateRemark']);
const props = defineProps({ const props = defineProps({
nextFullAmountActivty: { nextFullAmountActivty: {
@@ -186,8 +198,7 @@ watch(
() => props.cartList, () => props.cartList,
(newCartList) => { (newCartList) => {
console.log("购物车数据变化", newCartList); console.log("购物车数据变化", newCartList);
}, }, {
{
deep: true, deep: true,
} }
); );
@@ -247,12 +258,9 @@ const cartListadd = async (item, i) => {
type: "shopping", type: "shopping",
table_code: uni.cache.get("tableCode"), table_code: uni.cache.get("tableCode"),
shop_id: uni.cache.get("shopId"), shop_id: uni.cache.get("shopId"),
operate_type: operate_type: calculateValue(item.cartNumber, i, suitNum) == "del" ?
calculateValue(item.cartNumber, i, suitNum) == "del" "del" : item.cartListId && item.cartNumber > 0 ?
? "del" "edit" : "add",
: item.cartListId && item.cartNumber > 0
? "edit"
: "add",
product_id: item.id, product_id: item.id,
sku_id: item.skuId, sku_id: item.skuId,
number: await calculateValue(item.cartNumber, i, suitNum), number: await calculateValue(item.cartNumber, i, suitNum),
@@ -330,6 +338,7 @@ const cartclear = () => {
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
} }
.cart-list-wrap { .cart-list-wrap {
.cart-header { .cart-header {
display: flex; display: flex;
@@ -364,9 +373,11 @@ const cartclear = () => {
.list-wrap { .list-wrap {
padding: 0 28rpx; padding: 0 28rpx;
&.pb-20 { &.pb-20 {
padding-bottom: 20px; padding-bottom: 20px;
} }
.ShoppingCart { .ShoppingCart {
font-size: 30rpx; font-size: 30rpx;
text-align: left; text-align: left;
@@ -390,8 +401,10 @@ const cartclear = () => {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.cover { .cover {
position: relative; position: relative;
.limit-discount { .limit-discount {
position: absolute; position: absolute;
background: #cc5617; background: #cc5617;
@@ -454,7 +467,7 @@ const cartclear = () => {
} }
.price-wrap { .price-wrap {
margin-top: 16rpx; margin-top: 8rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@@ -470,8 +483,7 @@ const cartclear = () => {
color: #333333; color: #333333;
} }
.i { .i {}
}
.price { .price {
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;