first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1 @@
235d6086-e227-4fdd-8cc7-5dc49ab62000

View File

@@ -0,0 +1,250 @@
// user/recharge/recharge.js
const app = getApp();
const regeneratorRuntime = app.loadAsync()
const model = app.loadModel("index")
const http = app.loadHttp()
Page({
/**
* 页面的初始数据
*/
data: {
system: app.globalData.system, //设备相关信息
pageTitle: "充值", //头部标题
isBack: true,//显示返回
isLoading: true,//加载显示关闭
rechargeList: [],//金额列表
rechargeSelect: 0,//当前选中
money: {},//用户充值的余额
userInfo: {},//用户信息
cardInfo: [],//用户卡列表
id: "",//当前选中的会员卡id
card_id: "",//不知道是什么id
current_scroll: '1',//tab当前选中值
isCart: true,//
formData:'',
formData1:''
},
handleChangeScroll({ detail }) {
this.setData({
current_scroll: detail.key,
money: {},
cardInfo: [],
rechargeList: [],
isCart: false
});
this.getUserCard()
},
// 选择金额
selectRech(e) {
let index = e.currentTarget.dataset.index
this.setData({
rechargeSelect: index,
money: this.data.rechargeList[index]
})
},
// 自定义金额
moneyInput(e) {
let value = e.detail.value
this.setData({
'money.money': value
})
},
// 充值
async userRecharge() {
if (this.data.id == "") {
wx.showToast({
title: '请选择需要充值的卡',
icon: 'none',
duration: 1200
})
return
}
if (this.data.money.money == "") {
wx.showToast({
title: '请填写充值金额',
icon: 'none',
duration: 1200
})
return
}
let data = {
total_money: this.data.money.money,
card_id: this.data.id,
coupon_id: this.data.money.coupon_id,
num: this.data.money.num,
type: this.data.current_scroll
}
model.payment.pay(http.api.userRecharge, data)
},
// 获取用户卡列表
async getUserCard() {
let res = await http.http.request2({ url: `${http.api.userCard}/${this.data.current_scroll}`, method: "POST" })
if (res.data.data.length > 0) {
this.setData({
cardInfo: res.data.data,
isLoading: false,
id: res.data.data[0].id,
card_id: res.data.data[0].card_id
})
this.rechargeMoney()
} else {
this.setData({
isLoading: false,
isCart: true
})
}
},
// 获取用户信息显示用
async getUserInfo() {
let res = await model.storage.getSetting("userInfo")
this.setData({
userInfo: res
})
},
// 选择充值的会员卡
selectCard(e) {
this.setData({
id: e.currentTarget.dataset.id,
card_id: e.currentTarget.dataset.cardid
})
this.rechargeMoney()
},
// 获取充值金额列表
async rechargeMoney() {
let res = await http.http.request2({ url: `${http.api.rechargeMoney}`, method: "POST", data: { card_id: this.data.card_id } })
let rel = res.data.data
rel.push({ money: 0 })
this.setData({
rechargeList: rel,
money: rel[0],
isCart: true
})
},
// 加入会员跳转
joinVip(e) {
let url = e.currentTarget.dataset.url
wx.navigateTo({
url: url
})
},
// 用户卡充值
verifyRechargeCard(e) {
var that = this
if (!e.detail.value.card_num) {
wx.showToast({
title: '请输入卡号',
icon: 'none',
duration: 1200
})
return
}
if (!e.detail.value.card_password) {
wx.showToast({
title: '请输入密码',
icon: 'none',
duration: 1200
})
return
}
let data = {
card_num: e.detail.value.card_num,
card_password: e.detail.value.card_password,
form_id: e.detail.formId
}
wx.showModal({
title: '是否确定领取充值卡',
content: '点击确定领取',
success(res) {
if (res.confirm) {
http.http.request2({ url: `${http.api.verifyRechargeCard}`, method: "POST", data: data })
.then(res => {
if (res.data.status == 1) {
wx.showToast({
title: '领取成功',
icon: 'none',
duration: 1200
})
that.setData({
formData:'',
formData1:''
})
}
})
}
}
})
},
// 电话
tel(){
wx.makePhoneCall({
phoneNumber: '4000551071'
})
},
// 查看大图
bigImg(){
wx.previewImage({
current: 'http://cdn.yishaxiyi.com/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20190904101132.png', // 当前显示图片的http链接
urls: ['http://cdn.yishaxiyi.com/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20190904101132.png'] // 需要预览的图片http链接列表
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
current_scroll: options.index || 1
})
this.getUserCard()
this.getUserInfo()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@@ -0,0 +1,7 @@
{
"navigationBarTextStyle": "black",
"usingComponents": {
"i-tabs": "../../extend/iview/dist/tabs/index",
"i-tab": "../../extend/iview/dist/tab/index"
}
}

View File

@@ -0,0 +1,110 @@
<!-- 头部 -->
<nav-bar isBack="{{isBack}}" pageTitle="{{pageTitle}}" system="{{system}}"></nav-bar>
<!-- user/recharge/recharge.wxml -->
<view class="recharge">
<view class="recharge_title">
<view class="recharge_title_img">
<image src="{{userInfo.avatar}}" />
<span class="ml20">{{userInfo.nickname}}</span>
</view>
</view>
<i-tabs current="{{ current_scroll }}" scroll bindchange="handleChangeScroll">
<i-tab key="1" title="会员卡"></i-tab>
<i-tab key="2" title="礼品卡"></i-tab>
<!-- <i-tab key="3" title="团体卡"></i-tab> -->
<i-tab key="4" title="卡充值"></i-tab>
</i-tabs>
<view wx:if="{{current_scroll != 4 && isCart}}">
<view wx:if="{{cardInfo.length > 0}}" class="recharge_bac mt20">
<view class="recharge_list">
<view class="recharge_list_title">选择需要充值的会员卡:</view>
<view class="recharge_title_cen">
<view class="recharge_list_row" wx:for="{{cardInfo}}" wx:key="{{index}}" data-id="{{item.id}}" data-cardid="{{item.card_id}}" bind:tap="selectCard">
<view class="rec_row_p">
<image src="{{item.logo}}" />
<span class="row_span1 ml10">{{item.title}}{{item.discount/10}}折</span>
<view class="row_span2 ml20">
余额:
<span>¥{{item.money}}</span>
</view>
<span wx:if="{{item.level > 0 && item.level < 4 && current_scroll == 1}}" class="row_span3 ml20" data-url="/user/upgradeCart/upgradeCart?type={{current_scroll}}&openType=0&is_upgrade=0&card_upgrade={{item.id}}&card_id={{item.card_id}}" catchtap="joinVip">
升级会员 >
</span>
</view>
<view class="rec_row_active">
<image src="{{id == item.id?'/static/img/icon/wxPay2.png':'/static/img/icon/wxPay1.png'}}" />
</view>
</view>
</view>
</view>
<view class="recharge_num pd30 mt50">
<view class="recharge_num_title">选择充值金额</view>
<view class="recharge_num_cen">
<view wx:for="{{rechargeList}}" wx:key="{{index}}" class="recharge_num_row flex-con3 fl {{ rechargeSelect == index ? 'recharge_num_active' : '' }}" data-index="{{index}}" bind:tap="selectRech">
<view>
<span wx:if="{{item.money > 0}}" class="rech-mon">{{item.money}}元</span>
<span wx:if="{{item.money > 0}}" class="rech-rem">
{{item.remarks}}
</span>
<input wx:else type="number" placeholder="自定义" bindinput="moneyInput"></input>
</view>
</view>
</view>
<view class="clear"></view>
</view>
<view class="recharge_sub" bind:tap="userRecharge">立即充值</view>
</view>
<view wx:elif="{{cardInfo.length <= 0 && current_scroll == 1}}" class="rech-nothing mt150">
<view class="rech-nothing-img">
<image src="/static/img/rech-nothing-icon.png" />
</view>
<view class="rech-nothing-tips mt50">您当前还不是伊莎洗衣会员哦~</view>
<view class="rech-nothing-p mt10">加入伊莎洗衣会员,可享会员折扣</view>
<button class="rech-nothing-btn mt30" type="primary" data-url="/user/upgradeCart/upgradeCart?type={{current_scroll}}&openType=1&is_upgrade=2" bind:tap="joinVip">
加入会员
</button>
</view>
<view wx:elif="{{cardInfo.length <= 0 && current_scroll == 2}}" class="rech-nothing mt150">
<view class="rech-nothing-img">
<image src="/static/img/rech-nothing-icon.png" />
</view>
<view class="rech-nothing-tips mt50">您暂时还没有礼卡哦~</view>
<view class="rech-nothing-p mt10">现在购买有超值优惠</view>
<button class="rech-nothing-btn mt30" type="primary" data-url="/user/upgradeCart/upgradeCart?type={{current_scroll}}&openType=1&is_upgrade=2" bind:tap="joinVip">
去看看
</button>
</view>
<view wx:elif="{{cardInfo.length <= 0 && current_scroll == 3}}" class="rech-nothing mt90">
<view class="rech-tit">团体卡会员</view>
<view class="rech-p1 mt10">机关团体单位洗衣专属定制</view>
<view class="rech-p2 mt50">更贴心的员工洗衣福利</view>
<view class="rech-p2 mt5">专业的服务品质</view>
<view class="rech-p2 mt5">免费上门取送</view>
<view class="rech-p2 mt5">更多优惠服务方案</view>
<view class="brand-tit mt90">服务品牌</view>
<image class="brand-img mt20" src="http://cdn.yishaxiyi.com/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20190904101132.png" bind:tap="bigImg" />
<button class="rech-nothing-btn mt40" type="primary" bind:tap="tel">电话咨询</button>
</view>
</view>
<view wx:elif="{{ current_scroll == 4}}" class="recharge_bac2 mt20">
<form bindsubmit="verifyRechargeCard" report-submit>
<view class="recharge-four-input mtb20">
<view class="recharge-four-input-tit">卡号:</view>
<view class="recharge-input">
<input type="number" name="card_num" value="{{formData}}" placeholder="请输入卡号" />
</view>
</view>
<view class="recharge-four-input mtb20">
<view class="recharge-four-input-tit">卡密码:</view>
<view class="recharge-input">
<input type="text" name="card_password" value="{{formData1}}" password placeholder="请输入充值卡密码" />
</view>
</view>
<button class="recharge_sub mt90" type="primary" form-type="submit">立即充值</button>
</form>
</view>
</view>
<!-- 加载动画 -->
<loading-prog isLoading="{{isLoading}}"></loading-prog>
<!-- toasta提示 -->
<i-toast id="toast" />

View File

@@ -0,0 +1,318 @@
/* user/recharge/recharge.wxss */
page {
background: #fff;
}
.recharge_bac {
padding: 40rpx 0 60rpx 0;
background: #fff;
}
.recharge_bac2 {
padding: 100rpx 0 100rpx 0;
background: #fff;
}
.recharge_title {
height: 160rpx;
background-image: linear-gradient(-90deg, #34323a 0%, #3d3c45 100%),
linear-gradient(#3d3c45, #3d3c45);
background-blend-mode: normal, normal;
position: relative;
}
.recharge_title image {
width: 100%;
height: 160rpx;
}
.recharge_title_img {
position: absolute;
top: 0;
left: 0;
height: 160rpx;
width: 100%;
padding: 0 30rpx;
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
}
.recharge_title_img span {
font-size: 36rpx;
color: #fff;
}
.recharge_title_img image {
height: 80rpx;
width: 80rpx;
border-radius: 50%;
overflow: hidden;
}
.recharge_list {
padding: 0 30rpx;
}
.recharge_list_title {
font-size: 28rpx;
color: #666;
margin: 25rpx 0;
}
.recharge_list_row {
height: 100rpx;
border-bottom: 3rpx solid #ebebeb;
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
}
.rec_row_p {
flex: 1;
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
}
.rech-rem {
font-family: PingFang-SC-Medium;
font-size: 24rpx;
font-weight: normal;
font-stretch: normal;
color: #808080;
}
.row_span2 {
font-size: 24rpx;
color: #999;
}
.row_span2 span {
color: #ff5410;
}
.row_span3 {
text-align: center;
font-size: 22rpx;
color: #1dbf45;
vertical-align: middle;
}
.rec_row_p image {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
overflow: hidden;
}
.rec_row_active {
display: inline-block;
}
.rec_row_active image {
width: 30rpx;
height: 30rpx;
border-radius: 50%;
}
.recharge_num_title {
font-size: 40rpx;
color: #333;
}
.recharge_num_cen {
margin-top: 40rpx;
}
.recharge_num_row {
width: 32%;
margin-right: 2%;
border-radius: 10rpx;
text-align: center;
font-size: 36rpx;
color: #333;
padding: 0 40rpx;
height: 180rpx;
border: solid 2rpx #d9d9d9;
}
.recharge_num_row:nth-child(3n) {
margin-right: 0;
}
.recharge_num_row:nth-child(n+4) {
margin-top: 20rpx;
}
.recharge_num_row span {
display: block;
}
.rech-mon {
font-family: PingFang-SC-Medium;
font-size: 36rpx;
font-weight: 400;
font-stretch: normal;
color: #333;
}
.row_span1 {
font-size: 32rpx;
color: #333;
}
.recharge_num_active {
background-color: #e7f8ed;
border: solid 1px #1dbf53;
color: #1dbf53;
}
.recharge_sub {
margin: 50rpx auto 10rpx;
width: 690rpx;
height: 100rpx;
background-color: #1dbf53;
/* background-blend-mode: normal, normal; */
border-radius: 50rpx;
font-size: 38rpx;
color: #fff;
text-align: center;
line-height: 100rpx;
}
.clear {
clear: both;
}
/* 没有会员卡 */
.rech-nothing {
text-align: center;
}
.rech-nothing-img {
text-align: center;
}
.rech-nothing-img image {
width: 232rpx;
height: 232rpx;
}
.rech-nothing-tips {
font-family: PingFang-SC-Medium;
font-size: 36rpx;
font-weight: 400;
font-stretch: normal;
color: #666;
}
.rech-nothing-p {
font-family: PingFang-SC-Medium;
font-size: 28rpx;
font-weight: 400;
font-stretch: normal;
color: #999;
}
.rech-nothing-btn {
width: 274rpx;
height: 75rpx;
line-height: 75rpx;
background-image: linear-gradient(#1dbf53, #1dbf53), linear-gradient(#2fd152, #2fd152);
border-radius: 37rpx;
font-family: PingFang-SC-Medium;
font-size: 32rpx;
font-weight: 400;
color: #fff;
text-align: center;
}
.rech-tit{
font-family: PingFang-SC-Heavy;
font-size: 36rpx;
font-weight: 600;
font-stretch: normal;
color: #000000;
}
.rech-p1{
font-family: PingFang-SC-Medium;
font-size: 30rpx;
font-weight: 400;
font-stretch: normal;
color: #000000;
}
.rech-p2{
font-family: PingFang-SC-Medium;
font-size: 28rpx;
font-weight: 400;
font-stretch: normal;
color: #666666;
}
.brand-tit{
font-family: PingFang-SC-Medium;
font-size: 32rpx;
font-weight: 400;
font-stretch: normal;
letter-spacing: 0px;
color: #000000;
}
.brand-img{
height: 235rpx;
width: 678rpx;
}
/* 充值卡样式 */
.recharge-four-input {
height: 75rpx;
padding: 0 50rpx;
display: flex;
}
.recharge-four-input-tit {
flex: 1;
line-height: 75rpx;
text-align: right;
font-family: PingFang-SC-Medium;
font-size: 32rpx;
font-weight: 400;
font-stretch: normal;
letter-spacing: 0px;
color: #333;
}
.recharge-input {
width: 489rpx;
height: 75rpx;
background-color: #fbfbfb;
border: solid 2rpx #d9d9d9;
display: flex;
padding: 0 20rpx;
}
.recharge-input input {
flex: 1;
height: auto;
line-height: normal;
font-size: 32rpx;
}
/* 修改tabs样式 */
i-tab {
width: 25%;
display: inline-block;
}
.tabs-tab i-badge {
display: block;
}