From a868117cdac58c4b036c06c1eb6f54ad817b3228 Mon Sep 17 00:00:00 2001
From: GaoHao <1210693421@qq.com>
Date: Sat, 26 Oct 2024 09:23:21 +0800
Subject: [PATCH] =?UTF-8?q?=E5=85=85=E5=80=BC=E6=B4=BB=E5=8A=A8=E7=9B=B8?=
=?UTF-8?q?=E5=85=B3=E5=A2=9E=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/js/api.js | 4 +-
pages/member/index.vue | 56 ++++++++++++++++++-------
pages/user/coupon.vue | 24 +++++------
pagesOrder/components/topUpActivity.vue | 11 ++---
pagesOrder/confirm_order/index.vue | 2 +-
5 files changed, 62 insertions(+), 35 deletions(-)
diff --git a/common/js/api.js b/common/js/api.js
index 2236663..8f69837 100644
--- a/common/js/api.js
+++ b/common/js/api.js
@@ -161,7 +161,9 @@ export default {
getUserConpons(data) { //我的优惠券
return uni.api.post("/userConpons/find", data);
},
-
+ conponList(data) { //获取优惠券
+ return uni.api.post("/coupon/find", data);
+ },
ordergetYhqPara(data) { //获取优惠券参数列表
return uni.api.get("/order/getYhqPara", data);
},
diff --git a/pages/member/index.vue b/pages/member/index.vue
index 0fbf4e5..b8d29b8 100644
--- a/pages/member/index.vue
+++ b/pages/member/index.vue
@@ -27,26 +27,27 @@
type="number"
v-model="amount"
inputAlign="left"
- :placeholder="`充${minNum}送${handselNum}`"
+ :placeholder="`充${amount}送${giftAmount}`"
:customStyle="{border: '0'}"
+ @input="amountChange"
>
自定义金额
-
+
充值
- ¥{{item.minNum}}
-
+ ¥{{item.amount}}
+
- 赠
- ¥{{ item.handselNum }}
+ 赠{{inputshow}}
+ ¥{{ item.giftAmount }}
- 赠送{{item.handselNum}}元
+ 赠送{{item.giftAmount}}元
@@ -108,8 +109,7 @@
isProtocol: false,
listdata: [],
amount: 0,
- minNum: 0,
- handselNum: 0,
+ giftAmount: 0,
userInfo: {},
shopUserInfo: null,
shopId: '',
@@ -142,9 +142,11 @@
} else{
this.shopId = e.shopId;
this.type = e.type;
+ if ( e.amount ) { this.amount = e.amount; }
uni.cache.set('shopId',this.shopId)
this.shopInfo();
this.paygetActive()
+
}
},
methods: {
@@ -200,14 +202,38 @@
try {
this.listdata = res.data.list;
this.giftList = this.listdata[0].gives;
- this.amount = this.listdata[0].minNum;
- this.minNum = this.listdata[0].minNum;
- this.handselNum = this.listdata[0].handselNum
+ this.giftAmount = this.listdata[0].giftAmount
+ if ( this.type == 'topUpActivity') {
+ this.amountChange()
+ } else {
+ this.amount = this.listdata[0].amount;
+ }
} catch (e) {
//TODO handle the exception
}
},
+ /**
+ * 监听金额修改
+ */
+ amountChange () {
+ let item = this.listdata.filter(item=>this.amount==item.amount)
+
+ if ( item.length > 0 ) {
+ this.listdata.forEach((v,e)=>{
+ if ( this.amount == v.amount) {
+ this.inputshow = e;
+ this.clickinput(v,e)
+ }
+ })
+ } else {
+ this.inputshow = '';
+ this.giftList = [];
+ this.giftAmount = '';
+ }
+
+ },
+
/**
* 进入明细\管理
* @param {Object} e
@@ -296,12 +322,10 @@
* @param {Object} b
*/
clickinput(a, b) {
- console.log(a, b)
this.inputshow = b;
this.giftList = a.gives;
- this.amount = a.minNum;
- this.minNum = a.minNum;
- this.handselNum = a.handselNum;
+ this.amount = a.amount;
+ this.giftAmount = a.giftAmount;
},
/**
diff --git a/pages/user/coupon.vue b/pages/user/coupon.vue
index e60afef..775e73e 100644
--- a/pages/user/coupon.vue
+++ b/pages/user/coupon.vue
@@ -3,10 +3,10 @@
+ :class="tabIndex == index?'towcontentlistxitemboxopacity':''"
+ v-for="(item,index) in tabList" :key="index" @click="towcontentclick(index,item)">
{{item.name}}
-
@@ -74,27 +74,27 @@
export default {
data() {
return {
- listbox: [{
+ tabList: [{
name: '全部',
type: ''
},
{
name: '未使用',
- type: '0'
+ type: '1'
},
{
name: '已使用',
- type: '1'
+ type: '2'
}
],
- towcontentclickindex: 0,
+ tabIndex: 0,
list: [],
status: "",
};
},
onLoad() {
- this.ordermineCouponsthis()
+ this.getCouponList()
},
methods: {
@@ -105,17 +105,17 @@
* @param {Object} item
*/
towcontentclick(index, item) {
- this.towcontentclickindex = index;
+ this.tabIndex = index;
this.status = item.type;
- this.ordermineCouponsthis()
+ this.getCouponList()
},
/**
* 获取优惠券数据
*/
- async ordermineCouponsthis() {
+ async getCouponList() {
try {
- let res = await this.api.getUserConpons({
+ let res = await this.api.conponList({
userId: uni.cache.get('userInfo').id,
shopId: uni.cache.get('shopId'),
status: this.status
diff --git a/pagesOrder/components/topUpActivity.vue b/pagesOrder/components/topUpActivity.vue
index 073dbb3..dc7a6b1 100644
--- a/pagesOrder/components/topUpActivity.vue
+++ b/pagesOrder/components/topUpActivity.vue
@@ -4,10 +4,10 @@
充值更划算
-
+
首充优惠
- {{ item.minNum }}元
- 赠{{ item.handselNum }}元50积分
+ {{ item.amount }}元
+ 赠{{ item.giftAmount }}元50积分
赠送2张优惠券
@@ -35,10 +35,11 @@
/**
* 去充值
*/
- goTopUp() {
+ goTopUp( item ) {
uni.pro.navigateTo('/pages/member/index', {
shopId: uni.cache.get('shopId'),
- type: "topUpActivity"
+ type: "topUpActivity",
+ amount: item.amount,
})
},
diff --git a/pagesOrder/confirm_order/index.vue b/pagesOrder/confirm_order/index.vue
index d319ee8..ab447e0 100644
--- a/pagesOrder/confirm_order/index.vue
+++ b/pagesOrder/confirm_order/index.vue
@@ -109,7 +109,7 @@
-
+