From fe51d085d661cf7f3989a39d588c7814c3322739 Mon Sep 17 00:00:00 2001
From: XiaoXinPro 14 IAH5R <568170040@qq.com>
Date: Sun, 12 Mar 2023 15:17:17 +0800
Subject: [PATCH] upload
---
config/config.js | 6 +-
custom-tab-bar/index.js | 10 +--
index/user.wxml | 7 +-
pages/exchange/exchange.js | 14 ++-
pages/exchangeCard/exchangeCard.js | 128 ++++++++++++++++++++++-----
pages/exchangeCard/exchangeCard.wxml | 37 +++++---
pages/exchangeCard/exchangeCard.wxss | 27 +++++-
pages/getphoneInfo/index.js | 9 +-
8 files changed, 186 insertions(+), 52 deletions(-)
diff --git a/config/config.js b/config/config.js
index 422ff99..7f957d4 100755
--- a/config/config.js
+++ b/config/config.js
@@ -426,10 +426,10 @@ var config = {
verify: "/couponOrder/verify",
//全包下订单
couponPackageSave: "/order/couponPackageSave",
-
-
//获取动态核销码
- dynamicId: "/couponOrder/dynamicId"
+ dynamicId: "/couponOrder/dynamicId",
+ // 获取卡详情
+ getCardDetail: "/couponPassword/getCardDetail",
},
weapp: {
AppId: weappId
diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js
index 0145bfa..ba7408c 100644
--- a/custom-tab-bar/index.js
+++ b/custom-tab-bar/index.js
@@ -202,10 +202,10 @@ Component({
// wx.hideTabBar()
Http.get({
url: config.api.templateId,
- data: {
- pageNum: 1,
- pageSize: 100
- }
+ // data: {
+ // pageNum: 1,
+ // pageSize: 100
+ // }
}).then(res => {
const {
code,
@@ -213,7 +213,7 @@ Component({
} = res
if (code == 200) {
this.setData({
- templateId: data.list
+ templateId: data || ''
})
this.setWxMessage()
} else {
diff --git a/index/user.wxml b/index/user.wxml
index 8044f16..f49eaed 100644
--- a/index/user.wxml
+++ b/index/user.wxml
@@ -131,16 +131,17 @@
>
-
+
+
- 录入实体卡
+ 激活消费卡
>
diff --git a/pages/exchange/exchange.js b/pages/exchange/exchange.js
index 62d22de..e73fa65 100644
--- a/pages/exchange/exchange.js
+++ b/pages/exchange/exchange.js
@@ -18,7 +18,7 @@ Page({
let that = this;
let code = e.detail.value.code;
let formId = e.detail.formId;
- if (!code || !code.replace(/\s*/g, "")) {
+ if (!code) {
wx.showToast({
title: '请输入兑换码',
icon: "none",
@@ -39,7 +39,17 @@ Page({
that.setData({
code: num
})
- that.exchange({ detail: { value: num } })
+ const e = {
+ detail:
+ {
+ value:
+ {
+ code:
+ num
+ }
+ }
+ }
+ that.exchange(e)
},
fail: (res) => {
console.log(res, 'fail');
diff --git a/pages/exchangeCard/exchangeCard.js b/pages/exchangeCard/exchangeCard.js
index 169e9b0..cdbf6ff 100644
--- a/pages/exchangeCard/exchangeCard.js
+++ b/pages/exchangeCard/exchangeCard.js
@@ -14,19 +14,22 @@ Page({
pdwSwitch: 0,
isShowPwd: false,
isChangePhone: false,
+ isSHowInfoCard: false,
code: "",
- name: "叶文沁",
- phone: "1379****591",
- tempPhone: '',
- password: ''
+ title: "",
+ name: "",
+ phone: "",
+ tempPhone: "",
+ password: ""
},
- // 兑换
- exchange(e) {
- console.log(e, 'e');
- let that = this;
+ // 查询
+ searchCard(e) {
let code = e.detail.value.code;
- console.log(code);
+ this.setData({
+ code: e.detail.value.code
+ })
+ this.getCardDetail(code)
},
// 更改手机号
@@ -81,7 +84,8 @@ Page({
this.setData({
tabIndex: e.target.id,
code: '',
- password: ''
+ password: '',
+ isSHowInfoCard: false
})
},
@@ -103,7 +107,10 @@ Page({
that.setData({
code: num
})
- that.exchange({ detail: { value: num } })
+ const e = {
+ detail: { value: { code: num } }
+ }
+ that.searchCard(e)
},
fail: (res) => {
console.log(res, 'fail');
@@ -111,6 +118,72 @@ Page({
})
},
+ /** 根据卡id查询卡详情*/
+ getCardDetail(cardId) {
+ const that = this
+ Http.get({
+ url: config.api.getCardDetail,
+ data: { cardId }
+ })
+ .then(res => {
+ console.log(res, 'res');
+ that.setData({
+ title: res.data.title,
+ phone: res.data.ownerPhone,
+ ownerUserId: res.data.ownerUserId,
+ eCardId: res.data.eCardId,
+ owned: res.data.owned,
+ remainAmount: res.data.remainAmount / 100,
+ isSHowInfoCard: true // 显示卡详情
+ })
+ })
+ .catch(err => {
+ console.log(err);
+ wx.showToast({
+ title: err.message,
+ icon: "none"
+ })
+ })
+ },
+
+ getCouponOrderByPassword(password) {
+ Http.post({
+ url: config.api.getCouponOrderByPassword,
+ data: {
+ password,
+ }
+ })
+ .then(res => {
+ wx.showModal({
+ title: '激活成功',
+ content: '消费卡已发放到"我的卡包"',
+ showCancel: true,
+ cancelText: "知道了",
+ cancelColor: '',
+ confirmText: "去查看",
+ confirmColor: '#FD832D',
+ success: function (res) {
+ if (res.cancel) {
+ //点击取消,默认隐藏弹框
+ } else {
+ wx.redirectTo({
+ url: '/pages/cardorder/index/index',
+ })
+ }
+ },
+ fail: function (res) { },
+ complete: function (res) { }
+ })
+ })
+ .catch(err => {
+ wx.showToast({
+ title: err.message,
+ icon: 'none',
+ duration: 2000
+ })
+ })
+ },
+
setPwdShow() {
const isShowPwd = this.data.isShowPwd
this.setData({
@@ -119,17 +192,29 @@ Page({
},
submit() {
- const thisData = this.data
- const data = {
- name: thisData.name,
- phone: thisData.phone,
- pdwSwitch: thisData.pdwSwitch,
- password: thisData.password,
- }
- console.log(data, 'submitData');
+ const data = this.data
+ this.getCouponOrderByPassword(data.code)
},
- goGive() { },
+ goGive() {
+ if (this.data.ownerUserId && this.data.eCardId) {
+ if (this.data.owned && this.data.owned == 1) {
+ wx.navigateTo({
+ url: `/pages/ConsumeDetail/ConsumeDetail?cardId=${this.data.eCardId}`,
+ })
+ } else {
+ wx.showToast({
+ title: '当前用户不是该卡的持有者,无法转赠!',
+ icon: 'none'
+ })
+ }
+ } else {
+ wx.showToast({
+ title: '该卡未绑定',
+ icon: 'error'
+ })
+ }
+ },
// 检查用户登录状态
checkPhoneStatus() {
@@ -138,13 +223,12 @@ Page({
url: config.api.checkPhoneStatus,
})
.then(res => {
-
})
.catch(err => {
if (err.code == 11005) {
// 手机号没有授权,将值传到用户手机号授权的页面
wx.redirectTo({
- url: "/pages/getphoneInfo/index",
+ url: "/pages/getphoneInfo/index?path=exchangeCard",
})
} else {
wx.showToast({
diff --git a/pages/exchangeCard/exchangeCard.wxml b/pages/exchangeCard/exchangeCard.wxml
index e93b54c..0cea5e9 100644
--- a/pages/exchangeCard/exchangeCard.wxml
+++ b/pages/exchangeCard/exchangeCard.wxml
@@ -1,23 +1,39 @@
-
+
- 绑定
- 转增
+ 绑定并激活
+ 转赠
-
-
- 持卡人姓名:{{name}}
- 持卡人手机号:{{phone}} 更改
+
+
+
+
+
+ 卡名称:{{title}}
+ 卡余额:{{remainAmount}}
+
+
+ 持卡人手机号:{{phone}}
+
+
持卡人手机号:
@@ -25,7 +41,7 @@
取消
-
+
+
diff --git a/pages/exchangeCard/exchangeCard.wxss b/pages/exchangeCard/exchangeCard.wxss
index 27293d1..cbe52b1 100644
--- a/pages/exchangeCard/exchangeCard.wxss
+++ b/pages/exchangeCard/exchangeCard.wxss
@@ -58,7 +58,7 @@
}
.tab .tabItem {
- width: 100rpx;
+ width: 180rpx;
text-align: center;
padding-bottom: 15rpx;
transition: all .3s;
@@ -81,7 +81,7 @@
}
.infoCard view {
- margin-bottom: 35rpx;
+ margin-bottom: 45rpx;
}
.infoCard .phone .changePhone,
@@ -129,4 +129,27 @@
.btns {
margin-top: 50rpx;
padding: 0 40rpx;
+}
+
+.comment {
+ padding: 0 30rpx;
+ margin-top: 20rpx;
+ margin-bottom: 35rpx;
+}
+
+.comment text {
+ display: block;
+}
+
+.txt1 {
+ margin-top: 30rpx;
+ font-size: 34rpx;
+ margin-bottom: 20rpx;
+}
+
+.txt2,
+.txt3 {
+ font-size: 25rpx;
+ line-height: 40rpx;
+ color: #999;
}
\ No newline at end of file
diff --git a/pages/getphoneInfo/index.js b/pages/getphoneInfo/index.js
index 48007df..c0a1014 100755
--- a/pages/getphoneInfo/index.js
+++ b/pages/getphoneInfo/index.js
@@ -226,6 +226,10 @@ Page({
wx.switchTab({
url: app.globalData.goHomeUrl
});
+ } else if (that.data.path == 'exchangeCard') {
+ wx.navigateTo({
+ url: `/pages/exchangeCard/exchangeCard`
+ })
} else {
wx.showToast({
title: res.data.msg,
@@ -249,11 +253,6 @@ Page({
}
});
}
- if (that.data.path == 'exchangeCard') {
- wx.navigateTo({
- url: `/pages/exchangeCard/exchangeCard`
- })
- }
}).catch(err => {
wx.showToast({
title: err.message,