Commit 847e7c8b by 胡悦

feat(订单创建): 添加退出确认弹窗并重构商品类型命名

refactor(订单表单): 将otherGoods重命名为skuGoods以保持一致性
feat(弹窗组件): 新增NoticePopup组件用于重要操作确认
style(图标): 更新sprite.png及相关样式文件
1 parent f73a4bca

2.56 MB | W: | H:

2.55 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -20,7 +20,7 @@
<template slot="package">
<Package></Package>
</template>
<template slot="otherGoods">
<template slot="skuGoods">
<view class="total" v-if="totalPrice > 0">
<view class="total-left">总价</view>
<view class="total-right">¥{{totalPrice}}</view>
......
<template>
<uni-popup ref="popup" type="center" border-radius="16px" :mask-click="false">
<view class="popup-content" :class="[`popup-${type}`]">
<view class="popup-icon">
<image
:src="require(`../../../../assets/images/common/${type}-notice.png`)"
mode="aspectFit"
class="icon-image"
/>
</view>
<view class="popup-title">{{ title }}</view>
<view class="popup-text">{{ text }}</view>
<view class="popup-buttons">
<view
v-for="(button, index) in buttons"
:key="index"
class="popup-button"
:class="[
`button-${button.type || 'default'}`,
{ 'single-button': buttons.length === 1 }
]"
@click="handleButtonClick(button)"
>
{{ button.text }}
</view>
</view>
</view>
</uni-popup>
</template>
<script>
export default {
props: {
// 弹窗类型:success, error, warning, info
type: {
type: String,
default: 'info'
},
// 弹窗标题
title: {
type: String,
default: '提示'
},
// 弹窗内容
text: {
type: String,
default: ''
},
// 按钮配置
buttons: {
type: Array,
default: () => [{
text: '确认',
type: 'primary',
callback: null
}]
}
},
data() {
return {
popupShow: false
}
},
computed: {
// 根据类型返回对应的图标
iconSrc() {
const iconMap = {
success: 'https://img01.glsx.com.cn/weapp/resource/app-tape/media/common/icon-success.png',
error: 'https://img01.glsx.com.cn/weapp/resource/app-tape/media/common/icon-error.png',
warning: '@/assets/images/common/warning-notice.png',
info: 'https://img01.glsx.com.cn/weapp/resource/app-tape/media/common/icon-info.png'
}
return iconMap[this.type] || iconMap.info
}
},
methods: {
open() {
this.$refs.popup.open("center");
},
close() {
this.$refs.popup.close()
},
// 处理按钮点击事件
handleButtonClick(button) {
if (typeof button.callback === 'function') {
button.callback()
} else {
this.close()
}
// 触发点击事件,传递按钮信息
this.$emit('buttonClick', button)
}
}
}
</script>
<style scoped lang="scss">
.popup-content {
background-color: #fff;
border-radius: toRpx(38);
width: toRpx(848);
height: toRpx(660);
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
overflow: hidden;
}
.popup-icon {
width: 100%;
margin-bottom: toRpx(48);
.icon-image {
width: 100%;
height: toRpx(248);
// border-radius: toRpx(38) toRpx(38) 0 0;
}
}
.popup-title {
font-size: toRpx(40);
font-weight: 500;
color: #333;
margin-bottom: toRpx(16);
text-align: center;
}
.popup-text {
font-size: 28rpx;
color: #666;
text-align: center;
margin-bottom: 32rpx;
line-height: 1.5;
}
.popup-buttons {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
gap: toRpx(32);
margin-top: auto;
height: toRpx(160);
}
.popup-button {
flex: 1;
height: toRpx(80);
line-height: toRpx(80);
text-align: center;
border-radius: toRpx(40);
font-size: toRpx(28);
max-width: toRpx(344);
&.single-button {
max-width: toRpx(688);
}
}
.button-primary {
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #fff;
}
.button-default {
background-color: #f5f5f5;
color: #333;
}
.button-danger {
background-color: #f45001;
color: #fff;
}
</style>
\ No newline at end of file
......@@ -179,17 +179,17 @@ const FORM_LIST = [
},
{
label: '套餐',
value: 'couponInfo',
value: 'package',
type: 'select',
key: 'name',
// addHtml: 'package'
addHtml: 'package'
},
{
label: '其他精品',
value: 'couponInfo',
value: 'skuGoods',
type: 'select',
key: 'name',
addHtml: 'otherGoods'
addHtml: 'skuGoods'
},
{
label: '收款方式',
......@@ -336,7 +336,15 @@ const popupTypeEnum = {
10: {
key: 'sunRoof',
list: '',
}
},
11: {
key: 'package',
list: '',
},
12: {
key: 'skuGoods',
list: '',
},
}
export {
......
......@@ -21,6 +21,7 @@
<component :is="toolComponentName" @jump="jump" :transmission-of-data="transmissionOfData" />
</view>
</view>
<NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup>
</view>
</template>
......@@ -31,6 +32,7 @@ import DailyReport from './components/DailyReport.vue'
import DefeatOrder from './components/DefeatOrder.vue'
import OrderManagement from './components/OrderManagement.vue'
import ConfirmOrder from './components/ConfirmOrder.vue'
import NoticePopup from './components/NoticePopup.vue'
export default {
components: {
Entrance,
......@@ -38,7 +40,8 @@ export default {
DailyReport,
DefeatOrder,
OrderManagement,
ConfirmOrder
ConfirmOrder,
NoticePopup
},
data() {
return {
......@@ -52,10 +55,38 @@ export default {
methods: {
entranceClick(item) {
console.log(item)
this.toolComponentName = item.name
if (item.name !== 'CreateOrder') {
// 保存当前选择的组件信息,但不立即切换
const selectedItem = item
// 如果当前组件是OrderManagement,直接切换组件,不显示弹窗
if (this.toolComponentName === 'OrderManagement') {
this.toolComponentName = selectedItem.name
this.transmissionOfData = null
return
}
// 配置弹窗按钮
this.$refs.notice.buttons = [{
text: '确认退出',
type: 'default',
callback: () => {
// 点击确认后才切换组件
this.toolComponentName = selectedItem.name
if (selectedItem.name !== 'CreateOrder') {
this.transmissionOfData = null
}
this.$refs.notice.close()
}
}, {
text: '继续编辑',
type: 'primary',
callback: () => {
this.$refs.notice.close()
}
}]
// 打开弹窗
this.$refs.notice.open()
},
backPage() {
uni.navigateBack()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!