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 @@
538bde40-f4ed-40e0-9cbd-abce1b9df7d2

View File

@@ -0,0 +1 @@
3b2418b1-a368-4206-aa08-66d5acbb3c65

View File

@@ -0,0 +1,118 @@
// user/payment/card/card.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,//显示返回
current: '1',//当前所在的标签的 key 值
cardList: [],//会员卡列表
type: '',//1为商城订单
},
// tab选中事件
handleChange({ detail }) {
this.setData({
current: detail.key
});
this.userCard()
},
// 获取礼品卡
async userCard() {
this.setData({
cardList: []
})
let res = await http.http.request2({ url: `${http.api.userCard}/${this.data.current}`, method: "POST", data: { kind: this.data.type } })
this.setData({
cardList: res.data.data
})
},
// 选择礼品卡
async selectGiftCard(e) {
let item = e.currentTarget.dataset.item
await model.storage.setStorage("itemGiftCard", item)
let giftCard = {
id: item.id,
price: item.discount / 10,
title: item.title,
logo: item.logo
}
await model.storage.setStorage("giftCard", giftCard)
wx.navigateBack({
})
},
// 办卡
goCard(){
wx.navigateTo({
url:`/user/balance/balance?index=${this.data.current}`
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (!!options.type) {
this.setData({
type: options.type
})
}
this.userCard()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
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,113 @@
<!-- 头部 -->
<nav-bar isBack="{{isBack}}" pageTitle="{{pageTitle}}" system="{{system}}"></nav-bar>
<!-- user/payment/card/card.wxml -->
<view class="card">
<view class="order_tab" style="top:{{system.statusHeight+system.titleHeight+'px'}}">
<i-tabs current="{{ current }}" scroll color="#1dbf45" bindchange="handleChange">
<i-tab key="1" title="会员卡"></i-tab>
<i-tab key="2" title="礼品卡"></i-tab>
<i-tab key="3" title="团体卡"></i-tab>
</i-tabs>
</view>
<view class="tab_con">
<view wx:if="{{current == 1}}" class="con_lsit_card">
<view class="list_card mt20" wx:for="{{cardList}}" wx:key="{{index}}" data-item="{{item}}" bind:tap="selectGiftCard">
<view class="card_lv">
<image src="{{item.src}}" />
</view>
<view class="card_lv2">
<view class="card_text">
<view class="text_cen">
<view class="text_top">
<view class="text_l">
<image src="/static/img/icon/vip.png" />
<span class="ml10">{{item.title}}</span>
</view>
<view class="text_r">
<span>{{item.discount/10}}</span>
折
</view>
</view>
<view class="text_botton mt10">
<view class="text_botton_l">发卡时间 {{item.create_time}}</view>
<view class="text_botton_r">余额 ¥{{item.money}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view wx:if="{{current == 2}}" class="con_lsit_card" wx:for="{{cardList}}" wx:key="{{index}}" data-item="{{item}}" bind:tap="selectGiftCard">
<view class="list_card mt20">
<view class="card_lv">
<image src="{{item.src}}" />
</view>
<view class="card_lv2">
<view class="card_text">
<view class="text_cen">
<view class="text_top">
<view class="text_l">
<image src="/static/img/icon/vip.png" />
<span class="ml10">{{item.title}}</span>
</view>
<!-- <view class="text_r card2">
余额¥
<span>{{item.money}}</span>
</view> -->
</view>
<view class="text_botton mt20">
<view class="card2_text">
<view class="card2_p">发卡时间{{item.create_time}}</view>
<!-- <view class="card2_p">
卡号 YS123456789 有效期{{item.create_time}}
</view> -->
<view class="text_r card2">
余额¥
<span>{{item.money}}</span>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view wx:if="{{current == 3}}" class="con_lsit_card">
<view class="list_card mt20" wx:for="{{cardList}}" wx:key="{{index}}" data-item="{{item}}" bind:tap="selectGiftCard">
<view class="card_lv">
<image src="{{item.src}}" />
</view>
<view class="card_lv2">
<view class="card_text">
<view class="text_cen">
<view class="text_top">
<view class="text_l">
<image src="/static/img/icon/vip.png" />
<span class="ml10">{{item.title}}</span>
</view>
<view class="text_r">
<span>{{item.discount/10}}</span>
折
</view>
</view>
<view class="text_botton mt10">
<view class="text_botton_l">发卡时间 {{item.create_time}}</view>
<view class="text_botton_r">余额 ¥{{item.money}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view wx:if="{{cardList.length <= 0}}" class="rech-nothing">
<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>
<view wx:if="{{current != 3}}" class="rech-nothing-btn" bind:tap="goCard">办卡</view>
</view>
</view>
</view>
<!-- toasta提示 -->
<i-toast id="toast" />

View File

@@ -0,0 +1,164 @@
/* user/payment/card/card.wxss */
.order_tab{
position: fixed;
width: 100%;
height: auto;
top: 0;
z-index: 9999;
}
.tab_con{
margin-top: 52px;
padding: 0 30rpx;
}
.list_card{
width: 100%;
height: 200rpx;
position: relative;
}
.card_lv{
width: 100%;
height: 200rpx;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 997;
}
.card_lv2{
width: 100%;
height: 200rpx;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 998;
}
.card_lv image{
width: 100%;
height: 100%;
}
.card_text{
display: block;
padding: 0 30rpx;
height: 100%;
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
}
.text_cen{
width: 100%;
}
.text_top{
display: flex;
}
.text_l,.text_r{
flex: 2;
color: black;
}
.text_l{
text-align: left;
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
}
.text_l image{
width: 43rpx;
height: 43rpx;
}
.text_l span{
font-size: 36rpx;
font-weight: 700;
color: #ffffff;
}
.text_r{
text-align: right;
font-size: 30rpx;
color: #ffffff;
}
.text_r span{
font-size: 60rpx;
}
.text_botton{
display: flex;
}
.text_botton_l,.text_botton_r{
flex: 2;
font-size: 26rpx;
color: #ffffff;
opacity: 0.6;
}
.text_botton_l{
text-align: left;
}
.text_botton_r{
text-align: right;
}
.card2{
font-size: 26rpx;
}
.card2 span{
font-size: 40rpx;
color: #ffffff;
}
.card2_text{
flex: 1;
}
.card2_p{
font-size: 22rpx;
color: #ffffff;
padding-left: 53rpx;
}
/* 修改tabs样式 */
i-tab {
width: 33.33%;
display: inline-block;
}
/* 无卡 */
/* 没有会员卡 */
.rech-nothing{
margin-top: 150rpx;
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: #666666;
}
.rech-nothing-p{
font-family: PingFang-SC-Medium;
font-size: 28rpx;
font-weight: 400;
font-stretch: normal;
color: #999999;
}
.rech-nothing-btn{
width: 274rpx;
height: 75rpx;
margin: 30rpx auto 0;
line-height: 75rpx;
background-color: #1dbf53;
border-radius: 37rpx;
font-family: PingFang-SC-Medium;
font-size: 32rpx;
font-weight: 400;
color: #ffffff;
text-align: center;
}

View File

@@ -0,0 +1,230 @@
// user/payment/payment.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,//加载条
oreder: {},//订单信息
coupon: {
id: 0,
price: 0
},//优惠券信息,
giftCard: {},//卡劵
isgiftCard: "",//拼接的卡劵信息方便操作
isPay: 2,//2微信支付 1卡支付
all: {},//总价格和差价
postage_money: {//邮费配置
satisfy_money: 0,//邮费
postage_money: 0,//未满指定免邮金额需要支付的邮费
},
},
// 支付
async pay(e) {
let formId = e.detail.formId
let payInfo = {
orderID: this.data.oreder.orederId,
payType: this.data.isPay,
form_id: formId,
userCouponID: 0,
userCardID: 0
}
if (!!this.data.coupon && !!this.data.coupon.price) {
payInfo.userCouponID = this.data.coupon.id
}
if (this.data.isPay == 1) {
payInfo.userCardID = this.data.giftCard.id
}
let api = http.api.preShopOrder
if (this.data.oreder.type == 1) {
api = http.api.pre_order
}
let res = await model.payment.pay(api, payInfo)
if (res == 1) {
wx.showToast({
title: '支付成功',
icon: 'none',
duration: 1000
})
// 改变变量使返回列表页刷新
app.globalData.isOrderList = true
setTimeout(() => {
wx.navigateBack({
delta: 2
})
}, 1000);
return
}
},
// 获取优惠券
async getCoupon() {
let coupon = await model.storage.getSetting("coupon")
if (!!coupon) {
model.storage.deleteStorage('coupon')
this.setData({
coupon: coupon
})
this.calculate()
}
},
// 获取卡劵
async getGiftCard() {
let giftCard = await model.storage.getSetting("giftCard")
if (!!giftCard) {
model.storage.deleteStorage('giftCard')
this.setData({
giftCard: giftCard,
isgiftCard: giftCard.title + " " + giftCard.price + '折',
isPay: 1
})
this.calculate()
}
},
// 选择支付方式
selectPay(e) {
let type = e.currentTarget.dataset.type
let url = e.currentTarget.dataset.url
if (type == 2) {
this.setData({
isgiftCard: "",
giftCard: {},
isPay: type
})
this.calculate()
} else if (type == 1) {
wx.navigateTo({
url: url
})
}
},
// 计算价格
async calculate() {
let order = this.data.oreder.realPrice //订单价格
let fjPrice = parseInt(this.data.oreder.fjPrice) //洗衣附加费
let postage_money = this.data.postage_money // 邮寄费
let coupon = this.data.coupon.price || 0 // 优惠券
let giftCard = this.data.giftCard.price || 10 // 卡支付
let oreder = this.data.oreder // 上一个页面传来的信息
let oriPrice = order //洗衣订单减去附加费计算
let all = {
allPrice: null,
difPrice: null
}
// 商城 (总-优惠) + 邮费
if (!!oreder.type) {
all = {
allPrice: parseFloat((oriPrice - coupon).toFixed(2)),
difPrice: parseFloat((oriPrice - (oriPrice - coupon)).toFixed(2)) || 0
}
// 运费
// if (all.allPrice < postage_money.satisfy_money) {
// all.allPrice += parseFloat(postage_money.postage_money)
// }
} else {
let data = {
orderID: this.data.oreder.orederId,
payType: this.data.isPay,
userCouponID: this.data.coupon.id || 0,
userCardID: this.data.giftCard.id || 0
}
let res = await http.http.request2({ url: `${http.api.shopOrderMoney}`, method: "POST", data: data })
if (res.data.status == 1) {
if (oriPrice <= postage_money.satisfy_money) {
oriPrice += postage_money.postage_money
}
all = {
allPrice: res.data.data.totalPrice,
difPrice: oriPrice - res.data.data.totalPrice || 0
}
}
}
all.allPrice = all.allPrice.toFixed(2)
all.difPrice = all.difPrice.toFixed(2)
this.setData({
all: all
})
},
// 获取邮费配置
async postage() {
let order = this.data.oreder
let type = !!order.type ? 1 : 2
let res = await http.http.request2({ url: `${http.api.postage}`, method: "POST", data: { type: type } })
this.setData({
postage_money: res.data.data
})
this.calculate()
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
oreder: JSON.parse(options.data),
})
this.postage()
// 一秒后显示
setTimeout(() => {
this.setData({
isLoading: false
})
}, 1000)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getCoupon()
this.getGiftCard()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@@ -0,0 +1,7 @@
{
"navigationBarTextStyle": "black",
"usingComponents": {
"wux-cell-group": "../../extend/wux/dist/cell-group/index",
"wux-cell": "../../extend/wux/dist/cell/index"
}
}

View File

@@ -0,0 +1,36 @@
<!-- 头部 -->
<nav-bar isBack="{{isBack}}" pageTitle="{{pageTitle}}" system="{{system}}"></nav-bar>
<!-- user/payment/payment.wxml -->
<view class="payment">
<view class="mt20" wx:if="{{oreder.type !== 1}}">
<wux-cell-group>
<wux-cell url="/user/couponCard/couponCard?price={{oreder.realPrice-oreder.fjPrice}}" thumb="/static/img/icon/yhj.png" title="优惠券" is-link>
<span wx:if="{{ !!coupon && !!coupon.price }}" class="you">-¥{{coupon.price}}</span>
</wux-cell>
</wux-cell-group>
</view>
<view class="mt20">
<wux-cell-group>
<wux-cell hover-class="none" title="订单编号" extra="{{oreder.order_num}}" right="text_right_cell"></wux-cell>
<wux-cell hover-class="none" title="待付款" extra="¥{{oreder.realPrice}}" right="text_right_cell1"></wux-cell>
</wux-cell-group>
</view>
<view>
<wux-cell-group title="请选择支付方式">
<wux-cell data-type="2" bind:tap="selectPay" thumb="/static/img/icon/wxlogo2.png" title="微信支付" rightUrl="{{isPay == 2 ? '/static/img/icon/wxPay2.png' : '/static/img/icon/wxPay1.png'}}"></wux-cell>
<wux-cell data-type="1" bind:tap="selectPay" data-url="/user/payment/card/card?type={{!!oreder.type?1:''}}" right="text_right_cell2" thumb="{{!!giftCard.logo?giftCard.logo:'/static/img/icon/yhk.png'}}" title="{{isgiftCard != ''?isgiftCard:'会员卡支付'}}" rightUrl="{{isPay == 1 ? '/static/img/icon/wxPay2.png' : '/static/img/icon/wxPay1.png'}}"></wux-cell>
</wux-cell-group>
</view>
<view class="pay">
<form report-submit bindsubmit="pay">
<button class="pay_button ml20" form-type="submit">确认支付</button>
</form>
<view class="pay_moy ml10">¥{{all.allPrice > 0 ? all.allPrice : 0}}</view>
<view class="pay_span ml20">合计:</view>
<view class="pay_p">已优惠¥{{all.difPrice}}</view>
</view>
</view>
<!-- 加载动画 -->
<loading-prog isLoading="{{isLoading}}"></loading-prog>
<!-- toasta提示 -->
<i-toast id="toast" />

View File

@@ -0,0 +1,74 @@
/* user/payment/payment.wxss */
.you{
font-size: 32rpx !important;
color: #ff4838 !important;
margin-left: 28rpx;
}
.wux-cell__text{
font-size: 32rpx !important;
color: #333333 !important;
}
.text_right_cell{
font-size: 32rpx !important;
color: #333333 !important;
}
.text_right_cell1{
font-size: 36rpx !important;
color: #ff5410 !important;
}
.text_right_cell2{
font-size: 36rpx !important;
color: #ff5410 !important;
text-align: right;
}
.pay{
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: block;
height: 110rpx;
background-color: #ffffff;
padding: 0 30rpx;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row-reverse;
flex-direction: row-reverse;
-webkit-align-items: center;
align-items: center;
}
.pay view{
display: inline-block;
float: right;
}
.pay_button{
width: 212rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
background-image: linear-gradient(
#1dbf53,
#1dbf53),
linear-gradient(
#2fd152,
#2fd152);
background-blend-mode: normal,
normal;
border-radius: 40rpx;
font-size: 30rpx;
color: #ffffff;
}
.pay_moy{
font-size: 36rpx;
color: #000000;
font-weight: 400;
}
.pay_p{
font-size: 26rpx;
color: #999999;
}
.pay_span{
font-size: 26rpx;
color: #333333;
}