From f82e8defd2c702ffd5f7c3c37fe5e0cb7fc69783 Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Tue, 27 Aug 2024 17:52:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- subPackages/techan/order.vue | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/subPackages/techan/order.vue b/subPackages/techan/order.vue index 23c0d04..40e991c 100644 --- a/subPackages/techan/order.vue +++ b/subPackages/techan/order.vue @@ -30,9 +30,9 @@ {{ contacts.province_text + contacts.city_text + contacts.district_text + contacts.detail_addr }} - + - @@ -542,7 +542,7 @@ view { .box { width: 100%; min-height: 100rpx; - padding: 28rpx 20rpx; + padding: 20rpx; background: #ffffff; border-radius: 16rpx; } @@ -898,8 +898,9 @@ view { display: flex; align-items: center; justify-content: space-between; + height: 100%; image { - width: 31rpx; + width: 36rpx; height: 36rpx; } .contacts-left { @@ -1069,15 +1070,18 @@ view { } .button { - font-size: 30rpx; - font-weight: 400; - color: #000000; + text-align: center; width: 100%; height: 80rpx; line-height: 80rpx; background-color: #ffffff; - border-radius: 60rpx; + border-radius: 40rpx; + font-family: PingFang SC; + font-weight: 400; + font-size: 33rpx; + color: #000000; + } } From 43b5960539b1daf4c6e32f9d768d79d0b3608892 Mon Sep 17 00:00:00 2001 From: shaojing <2901156235@qq.com> Date: Wed, 28 Aug 2024 14:58:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- store/modules/user.js | 5 + subPackages/food/foodDetail.vue | 32 +++-- subPackages/food/foodOrder.vue | 239 +++++++++++++++++++++++++++++--- 3 files changed, 244 insertions(+), 32 deletions(-) diff --git a/store/modules/user.js b/store/modules/user.js index 2704c9c..2c86df9 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -5,6 +5,7 @@ export default { token: "" }, //保存用户登录信息, toPath: "", //要跳转过去的页面, + foodInfo:"", //美食套餐信息 }, // 类似 vue 里的 mothods(同步方法) mutations: { @@ -23,5 +24,9 @@ export default { url: '/pages/login/login' }) }, + // 线路下单 + changeFoodInfo(state, data){ + state.foodInfo = data + } } } diff --git a/subPackages/food/foodDetail.vue b/subPackages/food/foodDetail.vue index 2fbc3b7..b08c0ba 100644 --- a/subPackages/food/foodDetail.vue +++ b/subPackages/food/foodDetail.vue @@ -30,7 +30,7 @@ {{info.title}} - + 收藏 @@ -55,26 +55,26 @@ 美食下单 - - + + - {{item.title}} + {{skuItem.title}} - {{item.price/100}} + {{skuItem.price/100}} - + {{tag}} | - 购买 + 购买 @@ -96,6 +96,9 @@ isCollect: 0, }; }, + onShow() { + this.$store.commit('changeFoodInfo', null); + }, onLoad(option) { this.id = option.id; this.getDetail(); @@ -107,6 +110,7 @@ goods_id: this.id },'/api/goods/getGoodDetail').then(res => { res.data.goods_new_tag = (res.data.goods_new_tag ? res.data.goods_new_tag.split(',') : []).splice(0, 2); + this.isCollect = res.data.is_collect this.info = res.data }) }, @@ -124,7 +128,7 @@ // 收藏 collect() { this.Post({ - type: 16, + type: 3, id: this.id }, '/api/scenic/collect' @@ -141,10 +145,16 @@ }); }, order(item) { - uni.setStorageSync('order', JSON.stringify(item)); //规格 - uni.setStorageSync('info', JSON.stringify(this.info)); //商品 + // uni.setStorageSync('order', JSON.stringify(item)); //规格 + // uni.setStorageSync('info', JSON.stringify(this.info)); //商品 + this.$store.commit('changeFoodInfo', item); + uni.navigateTo({ + url: '/subPackages/food/foodOrder' + }); + }, + taocanDetail() { uni.navigateTo({ - url: '/subPackages/oneplus/oneplusOrder' + url: '/subPackages/food/taocanDetail' }); }, }, diff --git a/subPackages/food/foodOrder.vue b/subPackages/food/foodOrder.vue index 23dec02..05bd1c1 100644 --- a/subPackages/food/foodOrder.vue +++ b/subPackages/food/foodOrder.vue @@ -2,51 +2,64 @@ - + - 名称名称名称名称名称名称名称名称名称名称名称名称名称名称名称名称名称名称 + {{info.title}} - 9.9 + {{info.money/100}} - - - 1 - + + - + {{num}} + + - - - 优惠券 - - - 暂无可用优惠券 - - - + + +
优惠券
+
+ 请选择 +
+
+ -¥{{coupon.discounts/100}} + -{{coupon.percent}}% + > +
+
联系人: - + 手机号: - + - +
- + + + 合计: + + + ¥{{ allprice }} + + + + 去支付 +
@@ -55,11 +68,131 @@ export default { data() { return { - coupon:null, + coupon:"", + reserve_name: '', + reserve_phone: '', + info:null, + detail:null,//商品的信息 + allprice: 0, + num:0, + } + }, + onShow() { + this.coupon = this.$store.state.user.coupon + console.log('传过来的优惠券',this.coupon); + this.total() + }, + onLoad(option) { + this.$store.commit("choseCoupon", ""); + this.info = this.$store.state.user.foodInfo + // this.info = JSON.parse(uni.getStorageSync('order')) + // this.detail = JSON.parse(uni.getStorageSync('detail')); + this.num = this.info.buyNum?this.info.buyNum:1 + if (!this.info) { + uni.navigateBack(); } + console.log(this.info); + this.total() }, methods: { - + cha() { + this.reserve_phone = '' + }, + order() { + if (!this.reserve_name) { + uni.showToast({ + title: '请输入姓名', + icon: 'none' + }); + return; + } + if (!this.reserve_phone) { + uni.showToast({ + title: '请输入电话', + icon: 'none' + }); + return; + } + let goods = []; + let goodsItem = { + specifications_id: this.info.id, + num: this.num, + }; + goods.push(goodsItem); + let data = { + goods: goods, + coupon: this.coupon ? this.coupon.id : null, + is_post: this.info.is_post, + reserve_name: this.reserve_name, + reserve_phone: this.reserve_phone + }; + this.Post( + { + method: 'POST', + data: JSON.stringify(data) + }, + '/api/order/place' + ).then(res => { + if (res.code == 200) { + this.Post( + { + order_id: res.data.order_id, + type: 'miniprogram', + platform: 'miniprogram' + }, + '/api/pay/unify' + ).then(res => { + if (res.data) { + uni.requestPayment({ + nonceStr: res.data.nonceStr, + package: res.data.package, + paySign: res.data.paySign, + signType: res.data.signType, + timeStamp: res.data.timeStamp, + complete() { + uni.navigateTo({ + url: '/subPackages/order/trades' + }); + } + }); + } + }); + } + }); + }, + plus() { + this.num = Number(this.num); + this.coupon = '' + this.$nextTick(() => { + this.num += 1; + this.total() + }); + }, + reduce() { + this.num = Number(this.num); + this.coupon = '' + if (this.num > 1) { + this.$nextTick(() => { + this.num -= 1; + this.total() + }); + } + }, + // 总价 + total() { + let price = 0 + if (this.coupon) { + if (this.coupon.percent == 0) { + price = this.info.money * this.num - this.coupon.discounts + } else{ + price = this.info.money * this.num - ((this.info.money * this.num + this.post) * this.coupon.percent) + } + } else{ + price = this.info.money * this.num + } + price < 0 ? 0 : price + this.allprice = price / 100 + }, } } @@ -88,6 +221,8 @@ left: 0; right: 0; bottom: 0; + display: flex; + justify-content: space-between; } .img { @@ -176,6 +311,7 @@ border-bottom: 1rpx solid #CCC; display: flex; justify-content: space-between; + align-items: center; } .name-box { @@ -220,5 +356,66 @@ margin-left: 20rpx; } + .totalText { + margin-right: 20rpx; + font-family: PingFang SC; + font-weight: 500; + font-size: 29rpx; + color: #333333; + } + + .totalPrice { + font-family: PingFang SC; + font-weight: 500; + font-size: 36rpx; + color: #F84A56; + } + + .order { + width: 267rpx; + height: 87rpx; + background: #F84A56; + border-radius: 43rpx; + font-family: PingFang; + font-weight: bold; + font-size: 36rpx; + color: #FFFFFF; + text-align: center; + line-height: 87rpx; + } + + .center { + display: flex; + align-items: center; + } + + .coupon-btn { + width: 140rpx; + height: 57rpx; + border: 1px solid #333333; + border-radius: 29rpx; + font-size: 28rpx; + font-family: PingFangSC; + font-weight: 400; + color: #000000; + text-align: center; + line-height: 57rpx; + + .select { + padding: 10rpx 18rpx; + background: #ED9230; + border-radius: 10rpx; + font-size: 28rpx; + font-weight: 400; + color: #fff; + } + } + + .coupon-price { + color:#DD0000; + font-size: 30rpx; + font-weight: 500; + } + From f795db93842d2b9d0c1111b888caafcdba0ed3e9 Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Wed, 28 Aug 2024 14:59:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compoents/addressAdd.vue | 2 +- pages.json | 6 + store/modules/user.js | 5 + subPackages/hotelHomestay/hotelHomestay.vue | 2 +- subPackages/order/orderCoupon.vue | 424 ++++++++++++++++++++ subPackages/techan/detail.vue | 2 +- subPackages/techan/order.vue | 213 +++++----- subPackages/techan/selfPickUpPoint.vue | 51 +-- subPackages/ticketBooking/detail.vue | 298 +++++++------- subPackages/ticketBooking/order.vue | 256 +++++++++++- subPackages/ticketBooking/ticketBooking.vue | 4 +- 11 files changed, 960 insertions(+), 303 deletions(-) create mode 100644 subPackages/order/orderCoupon.vue diff --git a/compoents/addressAdd.vue b/compoents/addressAdd.vue index dd80ecb..c8a527a 100644 --- a/compoents/addressAdd.vue +++ b/compoents/addressAdd.vue @@ -304,7 +304,7 @@ }) } - return res + return {...res,data: {id: this.id}} } } } diff --git a/pages.json b/pages.json index afb3b9f..bd2287a 100644 --- a/pages.json +++ b/pages.json @@ -74,6 +74,12 @@ "navigationBarTitleText": "选择自提点" } }, + { + "path": "order/orderCoupon", + "style": { + "navigationBarTitleText": "选择优惠券" + } + }, { "path": "line/lineList", "style": { diff --git a/store/modules/user.js b/store/modules/user.js index 2704c9c..f5810c4 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -6,6 +6,7 @@ export default { }, //保存用户登录信息, toPath: "", //要跳转过去的页面, }, + coupon: "",//下单选择优惠券 // 类似 vue 里的 mothods(同步方法) mutations: { //改变用户信息,自动保存到本地的COOKIE @@ -23,5 +24,9 @@ export default { url: '/pages/login/login' }) }, + // 选择优惠券 + choseCoupon(state, data) { + state.coupon = data + }, } } diff --git a/subPackages/hotelHomestay/hotelHomestay.vue b/subPackages/hotelHomestay/hotelHomestay.vue index 41959d1..e99754f 100644 --- a/subPackages/hotelHomestay/hotelHomestay.vue +++ b/subPackages/hotelHomestay/hotelHomestay.vue @@ -121,7 +121,7 @@ // 收藏按钮 like(item){ this.Post({ - type: 2, + type: 4, id: item.id }, 'https://yjdtadmin.sz-trip.com/api/scenic/collect').then(res => { if (res.code == 200) { diff --git a/subPackages/order/orderCoupon.vue b/subPackages/order/orderCoupon.vue new file mode 100644 index 0000000..242f487 --- /dev/null +++ b/subPackages/order/orderCoupon.vue @@ -0,0 +1,424 @@ + + + + + diff --git a/subPackages/techan/detail.vue b/subPackages/techan/detail.vue index 17e504b..45f62e3 100644 --- a/subPackages/techan/detail.vue +++ b/subPackages/techan/detail.vue @@ -189,7 +189,7 @@ // 收藏 collect() { this.Post({ - type: 3, + type: 5, id: this.id }, '/api/scenic/collect' diff --git a/subPackages/techan/order.vue b/subPackages/techan/order.vue index 40e991c..5967d60 100644 --- a/subPackages/techan/order.vue +++ b/subPackages/techan/order.vue @@ -2,13 +2,13 @@ - + 邮寄配送 - - 到店自提 + @@ -16,8 +16,9 @@ 收货地址 - + + 更多 + @@ -30,16 +31,17 @@ {{ contacts.province_text + contacts.city_text + contacts.district_text + contacts.detail_addr }} - + +
+ + 添加 -
- - + + @@ -115,11 +117,12 @@ - -
优惠券
-
- 请选择 -
+ + 优惠券 + + 请选择 + +
-¥{{coupon.discounts/100}} -{{coupon.percent}}% @@ -156,19 +159,19 @@ 添加收货地址 - + - + {{ item.name }} {{ item.tel }} 默认 - {{ item.address }} + {{ item.province_text + item.city_text + item.district_text + item.detail_addr }} + + + - - - @@ -200,7 +203,6 @@