diff --git a/pages/shop/confirm.vue b/pages/shop/confirm.vue index 41be0b2..4b147db 100644 --- a/pages/shop/confirm.vue +++ b/pages/shop/confirm.vue @@ -49,7 +49,7 @@ - 价格明细 + 价格明细 商品小计 ¥{{total | formatPrice}} @@ -68,13 +68,9 @@ - - 备注 - - 口味、偏好等要求 - - - + + + @@ -84,13 +80,50 @@ ¥{{fullPrice | formatPrice}} 共{{totalCount}}件 - + 提交订单 Checkout - + + + + + + 备注 + + + + + {{item}} + + + + + + + 其他 + {{ remarkValue.length }}/{{ txtmaxlength }} + + + + + + + + + + + + + @@ -98,14 +131,19 @@ import { calculateTotal, formatPrice, - totalPrice + totalPrice, + truncate } from '@/utils/index.js' export default { data() { return { isPressed: false, //提交按钮是否锁定 - remark: '' //用户备注 + remark: '', //用户备注 提交时候的值 + remarkShow: false, //用户备注弹出层 + currentRemark: -1, // 当前选中的备注索引 + remarkValue: '', // 备注输入的内容 + txtmaxlength: 30, //备注其他文本框最多字数限制 } }, computed: { @@ -117,6 +155,27 @@ shopCon() { return this.$store.state.shopCon }, + //备注预设列表 + remark_presup() { + if (this.shopCon !== null && this.shopCon.remark_presup !== '[]') { + return JSON.parse(this.shopCon.remark_presup) + } else { + return [] + } + }, + //备注缩略显示 + remarkDescription() { + if (this.currentRemark !== -1) { + if (this.currentRemark === this.remark_presup.length + 1) { + if (this.remarkValue) { + return this.remarkValue + } + } else { + return this.remark_presup[this.currentRemark] + } + } + return '口味、偏好等要求' + }, //预估送达时间 estimated() { return 30 @@ -157,6 +216,12 @@ } }, methods: { + handledrRemarkShow() { + this.remarkShow = true + }, + closeRemark() { + this.remarkShow = false + }, //计算购物车总价 totalPrice, //提交订单 @@ -166,6 +231,13 @@ } this.isPressed = true //提交订单 + if(this.currentRemark!==-1){ + if(this.currentRemark===this.remark_presup.length+1){ + this.remark=this.remarkValue + }else{ + this.remark=this.remark_presup[this.currentRemark] + } + } uni.$u.http.post('/Api/Check/checkout', { cartList: JSON.stringify(this.cartList), //购物车列表 shop_id: this.$store.state.shop_id, //商铺id @@ -212,6 +284,7 @@ filters: { calculateTotal, //计算spu单价 formatPrice, //格式化价格 + truncate //文本截取 }, onShow() { //购物车没有信息 跳转到订单查询页面 @@ -234,10 +307,6 @@ bottom: 0rpx; } - .backBox { - margin-bottom: 194rpx; - } - .colorBar { height: 5rpx; background-image: url('/static/colorBar.png'); @@ -246,4 +315,14 @@ background-position: center; /* 居中显示 */ } + + .checkBox { + width: 220rpx; + height: 100rpx; + } + + .radioBox { + width: 40rpx; + height: 40rpx; + } \ No newline at end of file