初始化

This commit is contained in:
2024-12-06 16:18:22 +08:00
commit 884dd70d83
751 changed files with 60883 additions and 0 deletions
@@ -0,0 +1,338 @@
const {
etmsPost
} = require("../../com");
const config = require("../../config");
const app = getApp();
import Dialog from 'tdesign-miniprogram/dialog/index';
Page({
data: {
activityMainId: null,
tenantId: null,
userId: "",
type: 0,
activityRouteId: null,
activityBascInfo: {},
groupPurchaseRule: {},
teamLeaderRoute: {},
activityConfig: {},
studentFieldName1: "",
studentFieldName2: "",
isLoadFinish: false,
studentName: "",
studentPhone: "",
studentFieldValue1: "",
studentFieldValue2: "",
isSubOkLoading: false,
canIUseGetUserProfile: false,
avatarUrl: "",
isGetPhone: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(options)
wx.hideShareMenu({
menus: ['shareAppMessage', 'shareTimeline']
});
if (wx.getUserProfile) {
this.setData({
canIUseGetUserProfile: true
})
}
var activityRouteId = 0;
if (parseInt(options.type) === 1) {
activityRouteId = options.activityRouteId
}
this.setData({
type: options.type,
tenantId: options.tenantId,
activityMainId: options.activityMainId,
userId: options.userId,
activityRouteId: activityRouteId,
studentPhone: app.globalData.phone,
studentName: app.globalData.name
})
this.initActivityGetSimple();
console.log(this.data.activityMainId)
this.setData({
avatarUrl: app.globalData.avatarUrl
})
},
initActivityGetSimple() {
etmsPost(
app.globalData,
"openParent2/WxMiniActivityGetSimple", {
tenantId: this.data.tenantId,
activityMainId: this.data.activityMainId,
activityRouteId: this.data.activityRouteId
},
(data) => {
this.analysisActivityData(data);
}
);
},
analysisActivityData(data) {
var groupPurchaseRule = data.groupPurchaseRule.items.reverse();
this.setData({
activityBascInfo: data,
studentFieldName1: data.studentFieldName1,
studentFieldName2: data.studentFieldName2,
groupPurchaseRule: groupPurchaseRule,
teamLeaderRoute: data.teamLeaderRoute,
activityConfig: data.activityConfig,
isLoadFinish: true
});
},
onChooseAvatar(e) {
const {
avatarUrl
} = e.detail;
var etmsData = {
openId: app.globalData.openId,
unionid: app.globalData.unionid,
miniPgmUserId: app.globalData.u
};
let that = this;
wx.uploadFile({
url: config.upLoadMiniProgramAvatar,
filePath: avatarUrl,
name: 'file',
formData: {
"etmsData": JSON.stringify(etmsData)
},
success(res) {
var obj = JSON.parse(res.data)
that.setData({
avatarUrl: obj.resultData
})
}
})
},
getPhoneNumber(e) {
let errMsg = e.detail.errMsg;
if (errMsg == 'getPhoneNumber:ok') {
etmsPost(
app.globalData,
"openParent2/DecodedPhoneNumber", {
EncryptedData: e.detail.encryptedData,
Iv: e.detail.iv,
},
(data) => {
this.setData({
studentPhone: data.phone,
isGetPhone: true
});
}
);
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
handleGetUserProfile(e) {
if (!this.data.studentName || this.data.studentName === '') {
wx.showToast({
title: "请输入学员姓名",
icon: "none",
duration: 2000,
});
return;
}
if (!this.data.studentPhone || this.data.studentPhone === '') {
wx.showToast({
title: "请获取手机号码",
icon: "none",
duration: 2000,
});
return;
}
wx.getUserProfile({
desc: '用于获取参与活动的学员的头像',
success: (res) => {
console.log(res.userInfo);
this.processGetUserInfo(res.userInfo);
}
})
},
processGetUserInfo(myuser) {
// etmsPost(
// app.globalData,
// "openParent2/WxMiniEditUserInfo", {
// nickName: myuser.nickName,
// avatarUrl: myuser.avatarUrl,
// },
// () => {}
// );
this.goGroupPurchaseGoProcess();
},
goGroupPurchaseGo(info) {
if (info && info.nickName) {
this.processGetUserInfo(info);
return;
}
this.goGroupPurchaseGoProcess();
},
goGroupPurchaseGoProcess() {
if (!this.data.studentName || this.data.studentName === '') {
wx.showToast({
title: "请输入学员姓名",
icon: "none",
duration: 2000,
});
return;
}
if (!this.data.studentPhone || this.data.studentPhone === '') {
wx.showToast({
title: "请获取手机号码",
icon: "none",
duration: 2000,
});
return;
}
this.setData({
isSubOkLoading: true
});
if (parseInt(this.data.type) === 1) { //去成团
etmsPost(
app.globalData,
"openParent2/WxMiniGroupPurchaseJoin", {
tenantId: this.data.activityBascInfo.tenantId,
activityMainId: this.data.activityBascInfo.activityMainId,
ActivityRouteId: this.data.activityRouteId,
studentName: this.data.studentName,
studentPhone: this.data.studentPhone,
studentFieldValue1: this.data.studentFieldValue1,
studentFieldValue2: this.data.studentFieldValue2,
userId:this.data.userId
},
(data) => {
this.analysisResult(data);
}, () => {
this.setData({
isSubOkLoading: false
});
}
);
} else { //开团
etmsPost(
app.globalData,
"openParent2/WxMiniGroupPurchaseStartGo ", {
tenantId: this.data.activityBascInfo.tenantId,
activityMainId: this.data.activityBascInfo.activityMainId,
studentName: this.data.studentName,
studentPhone: this.data.studentPhone,
studentFieldValue1: this.data.studentFieldValue1,
studentFieldValue2: this.data.studentFieldValue2,
userId:this.data.userId
},
(data) => {
this.analysisResult(data);
}, () => {
this.setData({
isSubOkLoading: false
});
}
);
}
},
analysisResult(data) {
console.log(data);
var payInfo = data.payInfo;
if (data.isMustPay) {
wx.requestPayment({
timeStamp: payInfo.timeStamp,
nonceStr: payInfo.nonceStr,
package: payInfo.package_str,
signType: payInfo.signType,
paySign: payInfo.paySign,
success: () => {
this.paySuccess(data);
},
fail: () => {
this.setData({
isSubOkLoading: false
});
}
});
return;
} else {
wx.showToast({
title: "报名成功",
icon: "success",
duration: 2000,
complete: () => {
wx.switchTab({
url: `../index/index`,
})
}
});
this.setData({
isSubOkLoading: false
});
}
},
paySuccess(data) {
etmsPost(
app.globalData,
"openParent2/WxMiniPaySuccess", {
tenantId: this.data.activityBascInfo.tenantId,
activityRouteItemId: data.activityRouteItemId
},
(data) => {
wx.showToast({
title: "报名成功",
icon: "success",
duration: 2000,
complete: () => {
wx.switchTab({
url: `../index/index`,
})
}
});
this.setData({
isSubOkLoading: false
});
});
}
})
@@ -0,0 +1,25 @@
{
"usingComponents": {
"mp-loading": "../../components/loading/loading",
"t-loading": "tdesign-miniprogram/loading/loading",
"t-swiper": "tdesign-miniprogram/swiper/swiper",
"t-swiper-item": "tdesign-miniprogram/swiper/swiper-item",
"t-swiper-nav": "tdesign-miniprogram/swiper/swiper-nav",
"t-image": "tdesign-miniprogram/image/image",
"t-tag": "tdesign-miniprogram/tag/tag",
"t-check-tag": "tdesign-miniprogram/tag/check-tag",
"t-dialog": "tdesign-miniprogram/dialog/dialog",
"t-toast": "tdesign-miniprogram/toast/toast",
"t-steps": "tdesign-miniprogram/steps/steps",
"t-step": "tdesign-miniprogram/steps/step-item",
"t-button": "tdesign-miniprogram/button/button",
"t-button-group": "tdesign-miniprogram/button-group/button-group",
"t-avatar": "tdesign-miniprogram/avatar/avatar",
"t-avatar-group": "tdesign-miniprogram/avatar/avatar-group",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-badge": "tdesign-miniprogram/badge/badge",
"t-input": "tdesign-miniprogram/input/input",
"t-cell": "tdesign-miniprogram/cell/cell"
},
"navigationBarTitleText": "支付确认"
}
@@ -0,0 +1,74 @@
<view class="sb1_body">
<view class="sb1_content" wx:if="{{activityBascInfo&&activityBascInfo.activityMainId}}">
<view class="sb1_info">
<view class="sb1_info_img">
<t-image t-class="sb1_info_img_value" src="{{activityBascInfo.coverImage}}"></t-image>
</view>
<view class="sb1_info_basc">
<view class="sb1_info_basc_title">{{activityBascInfo.title}}</view>
<view wx:if="{{activityRouteId}}" class="sb1_info_basc_rt">
<view class="hm_status_count">{{activityBascInfo.newCountFinish}}/{{activityBascInfo.newCountLimit}}</view>
<view class="hm_status_mystatus hm_status_vie_{{activityBascInfo.activityRouteStatus}}">
{{activityBascInfo.activityRouteStatusDesc}}
</view>
</view>
<view class="sb1_info_basc_price">{{activityBascInfo.payPriceDesc}}¥{{activityBascInfo.payMustValue}}<label class="sb1_info_basc_price_originalPrice">{{activityBascInfo.originalPrice}}</label></view>
</view>
</view>
<view class="sb1_pay">
<view class="sb1_pay_title">实付</view>
<view class="sb1_pay_value" wx:if="{{activityBascInfo.isOpenPay}}"><label class="sb1_pay_value_desc">({{activityBascInfo.payPriceDesc}})</label>¥<label class="sb1_pay_value_v">{{activityBascInfo.payMustValue}}</label></view>
<view wx:else class="ac1_not_pay_value">先用后付</view>
</view>
<view class="sb1_input">
<view class="sb1_input_item">
<t-input label="姓名" t-class="sb1_input_item_val" model:value="{{studentName}}" Number="10" placeholder="请输入学员姓名">
</t-input>
</view>
<view class="sb1_input_item">
<t-input label="手机号" t-class="sb1_input_item_val" model:value="{{studentPhone}}" Number="10" placeholder="请输入手机号码">
<t-button slot="suffix" theme="primary" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"> 获取号码 </t-button>
</t-input>
</view>
<view wx:if="{{studentFieldName1}}" class="sb1_input_item">
<t-input label="{{studentFieldName1}}" t-class="sb1_input_item_val" model:value="{{studentFieldValue1}}" Number="20" placeholder="请输入{{studentFieldName1}}" />
</view>
<view wx:if="{{studentFieldName2}}" class=" sb1_input_item">
<t-input label="{{studentFieldName2}}" t-class="sb1_input_item_val" model:value="{{studentFieldValue2}}" Number="20" placeholder="请输入{{studentFieldName2}}" />
</view>
<view wx:if="{{!avatarUrl}}" class="sb1_input_item">
<t-cell title="头像" t-class-title="sb1_input_item_cell_title" t-class-note="sb1_input_note" t-class="sb1_input_item_cell">
<t-button slot="right-icon" theme="primary" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">获取头像</t-button>
</t-cell>
</view>
</view>
<view class="sb1_pay_tp" wx:if="{{activityConfig.payTp}}">
{{activityConfig.payTp}}
</view>
<view class="sb1_pay_submit">
<view wx:if="{{activityBascInfo.isOpenPay}}" class="sb1_pay_submit_go1">
<view class="sb1_pay_submit_go1_desc">
实付款:<label class="sb1_pay_submit_go1_value">¥{{activityBascInfo.payMustValue}}</label>
</view>
<view class="sb1_pay_submit_go1_sub">
<t-button wx:if="{{canIUseGetUserProfile}}" open-type="getUserInfo" disabled="{{isSubOkLoading}}" loading="{{isSubOkLoading}}" bindtap="handleGetUserProfile" block="true" theme="danger" shape="rectangle" t-class="ec_GroupPurchaseStartGo1" size="large">立即支付</t-button>
<t-button wx:else open-type="getUserInfo" disabled="{{isSubOkLoading}}" loading="{{isSubOkLoading}}" bindtap="goGroupPurchaseGo" block="true" theme="danger" shape="rectangle" t-class="ec_GroupPurchaseStartGo1" size="large">立即支付</t-button>
</view>
</view>
<view wx:else class="sb1_pay_submit_go2">
<t-button wx:if="{{canIUseGetUserProfile}}" open-type="getUserInfo" disabled="{{isSubOkLoading}}" loading="{{isSubOkLoading}}" bindtap="handleGetUserProfile" block="true" theme="danger" shape="rectangle" t-class="ec_GroupPurchaseStartGo2" size="large">立即报名</t-button>
<t-button wx:else open-type="getUserInfo" disabled="{{isSubOkLoading}}" loading="{{isSubOkLoading}}" bindtap="goGroupPurchaseGo" block="true" theme="danger" shape="rectangle" t-class="ec_GroupPurchaseStartGo2" size="large">立即报名</t-button>
</view>
</view>
</view>
<view class="sb1_loading" wx:else>
<view>
<t-loading theme="dots" size="80rpx" loading></t-loading>
</view>
</view>
</view>
@@ -0,0 +1,245 @@
page {
background-color: #f4f6fa;
color: rgba(0, 0, 0, 0.9);
font-family: Microsoft YaHei;
padding-bottom: 60px;
}
.sb1_loading {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}
.sb1_info_basc_price_originalPrice {
color: #999;
text-decoration: line-through;
margin-left: 10px;
}
.sb1_info {
margin-top: 10px;
display: flex;
flex-direction: row;
background-color: #fff;
padding-left: 20px;
padding-right: 20px;
height: 100px;
}
.sb1_info_img {
width: 100px;
height: 90px;
margin-top: 5px;
}
.sb1_info_img_value {
width: 100px;
height: 90px;
}
.sb1_info_basc {
flex: 1 1 auto;
margin-left: 10px;
position: relative;
}
.sb1_info_basc_title {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
margin-top: 20px;
}
.sb1_info_basc_price {
position: absolute;
right: 0px;
bottom: 0px;
margin-bottom: 5px;
font-size: 13px;
}
.sb1_pay {
margin-top: 10px;
display: flex;
flex-direction: row;
background-color: #fff;
padding-left: 20px;
padding-right: 20px;
height: 50px;
line-height: 50px;
}
.sb1_pay_title {
width: 50%;
text-align: left;
}
.sb1_pay_value {
width: 50%;
text-align: right;
}
.sb1_pay_value {
color: #FA063C;
font-size: 13px;
}
.sb1_pay_value_desc {
color: #999;
font-size: 13px;
margin-right: 5px;
}
.sb1_pay_value_v {
font-size: 30px;
}
.sb1_input {
margin-top: 10px;
background-color: #fff;
padding-left: 20px;
padding-right: 20px;
}
.sb1_input_item {
width: 100%;
}
.sb1_pay_tp {
margin-top: 5px;
padding-left: 20px;
padding-right: 20px;
font-size: 13px;
color: #999;
}
.sb1_input_item_val {
padding-left: 0px !important;
}
.sb1_input_note {
justify-content: left !important;
flex: 0 0 auto !important;
margin-left: 20px !important;
}
.sb1_input_note_lable {
color: #000000 !important;
margin-left: 34px !important;
}
.sb1_input_item_cell {
padding-left: 0px !important;
}
.sb1_input_item .t-cell {
padding-right: 0px;
}
.sb1_pay_submit_go1 {
display: flex;
}
.sb1_pay_submit {
position: fixed;
bottom: 0px;
width: 100%;
overflow: hidden;
z-index: 9999;
overflow: hidden;
}
.sb1_pay_submit_go1_value {
color: #FF123C;
font-weight: bold;
}
.sb1_pay_submit_go1_desc {
flex: 1 1 auto !important;
padding-left: 20px;
background-color: #fff;
height: 60px;
line-height: 60px;
align-items: center;
}
.sb1_pay_submit_go1_sub {
width: 260rpx;
text-align: center;
height: 60px;
line-height: 60px;
align-items: center;
text-align: center;
color: #fff;
}
.ec_GroupPurchaseStartGo1 {
height: 100% !important;
height: 100% !important;
background: -webkit-linear-gradient(left, #FF123C, #FE2A38, #FD5028) !important;
border-radius: 0px;
}
.ec_GroupPurchaseStartGo2 {
background: -webkit-linear-gradient(left, #FF123C, #FE2A38, #FD5028) !important;
width: 100%;
}
.ac1_not_pay_value {
width: 50%;
text-align: right;
color: #67C23A;
font-weight: bolder;
font-size: 20px;
}
.sb1_info_basc_rt {
position: absolute;
right: 0px;
top: 0px;
font-size: 12px;
display: flex;
flex-direction: row;
}
.hm_status_count {
margin-right: 5px;
}
.hm_status_mystatus {
color: #fff;
padding-left: 5px;
padding-right: 5px;
border-bottom-left-radius: 5px;
}
.hm_status_vie_0 {
background-color: #409EFF;
}
.hm_status_vie_1 {
background-color: #67C23A;
}
.hm_status_vie_2 {
background-color: #07c160;
}
.hm_status_vie_3 {
background-color: #E6A23C;
}
.sb1_input_item .t-button--base {
width: auto;
line-height: 64rpx;
height: 64rpx;
padding: 0 20rpx;
}
.sb1_input_item .t-input {
padding-right: 0px;
}