This commit is contained in:
weipengfei 2024-05-17 18:24:23 +08:00
parent 8f28955f44
commit aad2f02a5d
2 changed files with 135 additions and 127 deletions

View File

@ -1,148 +1,152 @@
<template>
<up-popup :show="show" closeable round="10" @close="close" :safeAreaInsetBottom="false">
<view class="good-popup">
<view class="head-title">
{{datas.is_bulk ? '称重商品' : '计件商品'}}
</view>
<view class="row">
<view>商品名称</view>
<view>{{datas.name || datas.goods_name}}</view>
</view>
<view class="row">
<view>商品单位</view>
<view>{{datas.unit_name}}</view>
</view>
<view class="row">
<view>商品价格</view>
<view>¥ {{datas.sell}}</view>
</view>
<view class="row">
<view>小计</view>
<view style="color: #F55726;">¥ {{subtotal}}</view>
</view>
<view v-if="datas.is_bulk" class="row">
<view>购买重量<text style="color: #F55726;">*</text></view>
<view style="flex: 1;">
<up-input v-model="datas.cart_num" :cursorSpacing='120' type="number" border="none"
placeholder="请输入购买重量" inputAlign="right"></up-input>
</view>
</view>
<view v-else class="row">
<view>购买数量<text style="color: #F55726;">*</text></view>
<view style="flex: 1;">
<up-input v-model="datas.cart_num" :cursorSpacing='120' type="number" border="none"
placeholder="请输入购买数量" inputAlign="right"></up-input>
</view>
</view>
<view class="row" style="padding-top: 30px;padding-bottom: 30rpx;">
<view style="width: 30%;margin-right: 30rpx;">
<up-button @click="close" color="#f7f7f7"><text style="color: #333;">取消</text></up-button>
</view>
<view style="flex: 1;">
<up-button @click="change" color="#20b128">确定</up-button>
</view>
</view>
</view>
</up-popup>
<up-popup :show="show" closeable round="10" @close="close" :safeAreaInsetBottom="false">
<view class="good-popup">
<view class="head-title">
{{datas.is_bulk ? '称重商品' : '计件商品'}}
</view>
<view class="row">
<view>商品名称</view>
<view>{{datas.name || datas.goods_name}}</view>
</view>
<view class="row">
<view>商品单位</view>
<view>{{datas.unit_name}}</view>
</view>
<view class="row">
<view>商品价格</view>
<view>¥ {{datas.sell}}</view>
</view>
<view class="row">
<view>小计</view>
<view style="color: #F55726;">¥ {{subtotal}}</view>
</view>
<view v-if="datas.is_bulk" class="row">
<view>购买重量<text style="color: #F55726;">*</text></view>
<view style="flex: 1;">
<up-input v-model="datas.cart_num" :cursorSpacing='120' type="number" border="none" placeholder="请输入购买重量"
inputAlign="right"></up-input>
</view>
</view>
<view v-else class="row">
<view>购买数量<text style="color: #F55726;">*</text></view>
<view style="flex: 1;">
<up-input v-model="datas.cart_num" :cursorSpacing='120' type="number" border="none" placeholder="请输入购买数量"
inputAlign="right">
<template #suffix>
<span style="color: #20b128;">{{datas.unit_name}}</span>
</template>
</up-input>
</view>
</view>
<view class="row" style="padding-top: 30px;padding-bottom: 30rpx;">
<view style="width: 30%;margin-right: 30rpx;">
<up-button @click="close" color="#f7f7f7"><text style="color: #333;">取消</text></up-button>
</view>
<view style="flex: 1;">
<up-button @click="change" color="#20b128">确定</up-button>
</view>
</view>
</view>
</up-popup>
</template>
<script setup>
import {
computed,
ref
} from "vue"
import {
toast
} from "../uni_modules/uview-plus";
import {
computed,
ref
} from "vue"
import {
toast
} from "../uni_modules/uview-plus";
const props = defineProps({
show: {
type: Boolean,
default: false
},
})
const props = defineProps({
show: {
type: Boolean,
default: false
},
})
const datas = ref({
cart_num: ''
});
const setData = (e) => {
datas.value = e;
}
const datas = ref({
cart_num: ''
});
const setData = (e) => {
datas.value = e;
}
const emit = defineEmits(['close', 'change']);
const close = () => {
emit('close');
}
const emit = defineEmits(['close', 'change']);
const close = () => {
emit('close');
}
const change = () => {
if (subtotal.value <= 0) {
uni.$u.toast('金额不可小于等于0');
datas.value.cart_num = '';
return;
}
emit('change', datas.value);
}
const change = () => {
if (subtotal.value <= 0) {
uni.$u.toast('金额不可小于等于0');
datas.value.cart_num = '';
return;
}
emit('change', datas.value);
}
const subtotal = computed(() => {
let num = +datas.value.cart_num || 0;
let sell = +datas.value.sell;
return Math.ceil(num * sell * 100) / 100
})
const subtotal = computed(() => {
let num = +datas.value.cart_num || 0;
let sell = +datas.value.sell;
return Math.ceil(num * sell * 100) / 100
})
defineExpose({
setData
})
defineExpose({
setData
})
</script>
<style scoped lang="scss">
.good-popup {
padding: 30rpx;
.good-popup {
padding: 30rpx;
.head-title {
font-weight: bold;
text-align: center;
margin-bottom: 20rpx;
}
.head-title {
font-weight: bold;
text-align: center;
margin-bottom: 20rpx;
}
.row {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 20rpx;
border-bottom: 1rpx solid #f6f6f6;
margin-bottom: 20rpx;
.row {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 20rpx;
border-bottom: 1rpx solid #f6f6f6;
margin-bottom: 20rpx;
&:last-child {
border-bottom: none;
margin-bottom: 0;
}
&:last-child {
border-bottom: none;
margin-bottom: 0;
}
.content {
.top {
display: flex;
.content {
.top {
display: flex;
view {
margin-right: 20rpx;
}
}
view {
margin-right: 20rpx;
}
}
.bottom {}
}
.bottom {}
}
image {
width: 40rpx;
height: 40rpx;
flex-shrink: 0;
}
}
}
image {
width: 40rpx;
height: 40rpx;
flex-shrink: 0;
}
}
}
@keyframes disappear {
to {
opacity: 0;
/* 渐隐 */
transform: scale(0);
/* 缩小 */
}
}
@keyframes disappear {
to {
opacity: 0;
/* 渐隐 */
transform: scale(0);
/* 缩小 */
}
}
</style>

View File

@ -13,7 +13,10 @@
<text style="margin: 0 10rpx;">自提点</text>
</view>
<view v-if="shopInfo.mer_id">
<view>{{shopInfo.mer_name}}</view>
<view>
{{shopInfo.mer_name}}
<span v-if="shopInfo.recommend" style="font-size: 10px;color: #fff;background-color: #20b128;padding: 2rpx 5rpx;border-radius: 4rpx;">推荐</span>
</view>
<view>
<text>{{shopInfo.service_phone}}</text>
<text
@ -218,6 +221,7 @@
if (mer_name === null && myAddressInfo.value.long && merchantList.value.length > 0 && !shopInfo
.value.mer_id) {
shopInfo.value = merchantList.value[0];
shopInfo.value.recommend = 1;
nextTick(() => {
shopRef.value.setCheck(shopInfo.value.mer_id);
})