From eeaebc31c0f59d0fcc40252473c72c4c2a21f21e Mon Sep 17 00:00:00 2001
From: fox <1466778434@qq.com>
Date: Fri, 21 Mar 2025 10:34:41 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=95=86=E5=93=81=E6=94=AF=E4=BB=98?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2;?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages_order/order/createOrder.vue | 664 +++++---------------------
pages_order/product/productDetail.vue | 12 +-
pages_order/static/createOrder/icon-arrow.png | Bin 0 -> 552 bytes
3 files changed, 134 insertions(+), 542 deletions(-)
create mode 100644 pages_order/static/createOrder/icon-arrow.png
diff --git a/pages_order/order/createOrder.vue b/pages_order/order/createOrder.vue
index 37f5666..80a127b 100644
--- a/pages_order/order/createOrder.vue
+++ b/pages_order/order/createOrder.vue
@@ -7,27 +7,6 @@
-
@@ -43,50 +22,38 @@
-
-
-
-
+
-
-
-
- 优惠券
- (¥{{ coupon.money || 0}})
+
+
+
+ 优惠券{{ `(满减券:${'满400减40'})` }}
+
+
+
+
-
-
-
-
-
-
-
- {{ payOrderProduct[0].orderDetails }}
-
-
-
-
-
- 本人已同意《用户使用协议》
+
+
+
+
-
-
+
+
+
+ 合计:
-
- 合计
- ¥{{ totalPrice }}元
-
-
-
- 立即支付
+ ¥
+
+ {{ totalPrice }}
-
-
+
+ 立即支付
+
+
@@ -117,25 +84,10 @@
},
data() {
return {
- address: {
- name: '请选择地址',
- address: '',
- },
- addressTotal: 0,
- remark: '',
+ selectedCoupon: [1],
num: 1,
- agreement: false,
coupon: {},
payMethod : 0,
- isGive : 0,
- type : '',
- titleMap : {
- def : '确认订单',
- give : '送礼清单',
- },
- multiNum: 2, // 多人礼包人数
- multiMinNum: 2, // 最小人数
- multiMaxNum: 100, // 最大人数
}
},
computed: {
@@ -155,58 +107,24 @@
...mapState(['userInfo', 'payOrderProduct']),
},
onLoad(args) {
- this.type = args.type || 'def'
- if(this.type == 'give'){
- this.isGive = 1
- }
this.$store.commit('getUserInfo')
},
onShow() {
- // todo
- return
- this.getAddressList()
this.getCouponList()
},
methods: {
- // 打开
- getAddressList() {
- // 获取地址列表
- this.$refs.addressList.getAddressList().then(res => {
- this.addressTotal = res.total
- if (this.addressTotal != 0) {
- this.address = res.records[0]
- }
- })
- },
//获取优惠券列表
getCouponList() {
this.$refs.couponList.getCouponList()
},
- // 打开选择地址
- openAddress() {
- if (this.addressTotal == 0) {
- return uni.navigateTo({
- url: '/pages_order/mine/address?type=back'
- })
- }
- this.$refs.addressPopup.open('bottom')
- },
- // 选择地址
- selectAddress(e) {
- this.address = e
- this.$refs.addressPopup.close()
- },
// 打开优惠券选择
openCoupon() {
- if (this.addressTotal == 0) {
- return uni.navigateTo({
- url: '/pages_order/mine/address?type=back'
- })
- }
this.$refs.couponPopup.open('bottom')
},
// 选择优惠券
selectCoupon(e) {
+ // todo
+
//判断优惠券限制
let {
useMoney
@@ -223,62 +141,23 @@
}
this.coupon = e
this.$refs.couponPopup.close()
+
+ this.selectedCoupon = [1]
},
submit() {
- let addressId = this.address.id
-
- if (!addressId) {
- uni.showToast({
- title: '请选择地址',
- icon: 'none'
- })
- return
- }
-
- if (!this.agreement) {
- uni.showToast({
- title: '请先同意使用协议',
- icon: 'none'
- })
- return
- }
-
let data = {}
let api = ''
-
- // 不是送礼
- if(this.type != 'give'){
-
- let list = []
- this.payOrderProduct.forEach(n => {
- list.push({
- num: n.num,
- shopId: n.shopId || n.id,
- })
- })
- data = {
- addressId,
- payType : this.payMethod,
- list: JSON.stringify(list),
- }
-
- api = 'createSumOrder'
-
- this.deleteCart(this.payOrderProduct.map(n => n.id).join(','))
-
- } else { //体验、常规商品
- data = {
- addressId,
- num: this.payOrderProduct[0].num,
- shopId: this.payOrderProduct[0].id,
- payType : this.payMethod,
- isGive : this.isGive,
- memberNum : 1,
- }
- api = 'createOrder'
+
+ data = {
+ addressId,
+ num: this.payOrderProduct[0].num,
+ shopId: this.payOrderProduct[0].id,
+ payType : this.payMethod,
+ memberNum : 1,
}
+ api = 'createOrder'
if(this.coupon.id){
data.couponId = this.coupon.id
@@ -299,38 +178,25 @@
return
}
- uni.requestPaymentWxPay(res)
- .then(e => {
- uni.showToast({
- title: '下单成功',
- icon: 'none'
- })
-
- this.paySuccess(res)
- }).catch(n => {
- setTimeout(uni.redirectTo, 700, {
- url: '/pages/index/order'
- })
- })
+ uni.requestPaymentWxPay(res).then(e => {
+ uni.showToast({
+ title: '下单成功',
+ icon: 'none'
+ })
+
+ this.paySuccess(res)
+ }).catch(n => {
+ setTimeout(uni.redirectTo, 700, {
+ url: '/pages/index/order'
+ })
+ })
}
})
},
- paySuccess(res){
- if(this.type == 'def'){
- setTimeout(uni.redirectTo, 700, {
- url: '/pages/index/order'
- })
- }else{
- setTimeout(uni.redirectTo, 700, {
- url: `/pages_order/order/instantGift?id=${res.message}`
- })
- }
- },
- // 删除购物车
- deleteCart(ids) {
- this.$api('deleteCart', {
- ids
+ paySuccess(res){
+ setTimeout(uni.redirectTo, 700, {
+ url: '/pages/index/order'
})
},
}
@@ -338,10 +204,13 @@
\ No newline at end of file
diff --git a/pages_order/product/productDetail.vue b/pages_order/product/productDetail.vue
index 483e537..e62cfc6 100644
--- a/pages_order/product/productDetail.vue
+++ b/pages_order/product/productDetail.vue
@@ -149,6 +149,7 @@
imgUrl: TEMP_BANNER_IMG_URL,
image: new Array(4).fill(1).map(() => TEMP_BANNER_IMG_URL),
price: 99,
+ num: 1,
sales: 235,
title: '60分钟肩颈推拿按摩',
desc: '疏通经络 放松肌肉',
@@ -171,10 +172,10 @@