优化代码

This commit is contained in:
duan 2024-05-27 16:58:04 +08:00
parent d67ab4d9b6
commit 91d22d5e7d
9 changed files with 521 additions and 28 deletions

View File

@ -231,6 +231,20 @@
"style": {
"navigationBarTitleText": "订单详情"
}
},
{
"path" : "pages/member/memberdetails",
"style" :
{
"navigationBarTitleText" : "会员卡"
}
},
{
"path" : "pages/member/billDetails",
"style" :
{
"navigationBarTitleText" : "账单明细"
}
}
],
"globalStyle": {

BIN
pages/member/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,100 @@
<template>
<!-- 账单明细 -->
<view>
<view class="bild">
<view class="bildLeft">
<text>充值金额</text>
<view>12</view>
</view>
<view class="bildRight">
<text>剩余次数</text>
<view>12</view>
</view>
</view>
<view class="navTop">
<view @click="clickEvent(1)">
充值
<view :class="[active==1?'xian':'']" style="left: 8rpx;"> </view>
</view>
<view @click="clickEvent(2)">
消费
<view :class="[active==2?'xian':'']" style="left: 8rpx;"> </view>
</view>
</view>
<view class="listStyle">
<image :src="request('./1.png')" style="width: 76rpx;height: 76rpx;float: left;" mode=""></image>
<view style="float: left;">
<text>阿什顿</text>
<text>阿什顿</text>
<text>阿什顿</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
active: 1
}
},
methods: {
clickEvent(i) {
this.active = i
}
}
}
</script>
<style scoped lang="less">
.bild {
height: 488rpx;
background-image: url('https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/czmxbg.png');
display: flex;
justify-content: space-around;
align-items: center;
.bildLeft,
.bildRight {
font-weight: 400;
font-size: 32rpx;
>view,
>text {
text-align: center;
color: rgba(255, 255, 255, 0.7);
}
>view {
margin-top: 34rpx;
font-weight: bold;
}
}
}
.navTop {
display: flex;
justify-content: space-around;
align-items: center;
color: #fff;
margin-top: -50rpx;
padding: 0 120rpx;
>view {
position: relative;
.xian {
width: 58rpx;
height: 6rpx;
background: #F1CB66;
border-radius: 2rpx 2rpx 2rpx 2rpx;
position: absolute;
bottom: -6rpx;
}
}
}
.listStyle {}
</style>

View File

@ -49,13 +49,13 @@
}
},
onLoad(e) {
console.log(e,'调试')
console.log(e,'调试2')
if (e.type == 'list') {//
this.paygetShopByMember(e.shopId_id)
}else{
this.paygetShopByMember(e.shopId_id)
}
this.paygetActive() //
this.paygetActive(e.shopId_id) //
},
methods: {
async paygetShopByMember(w) {
@ -67,9 +67,9 @@
})
this.userInfo = res.data.list[0]
},
async paygetActive() {
async paygetActive(shopid) {
let res = await this.api.paygetActive({
shopId: uni.cache.get('shopUser'),
shopId:shopid,
page: 1,
pageSize: 10
})

View File

@ -79,7 +79,8 @@
}
},
eeInfo(item) {
uni.pro.navigateTo('member/index',{
console.log(item,'调试123123')
uni.pro.navigateTo('member/memberdetails',{
shopId_id:item.shopId,
type:'list'
})

View File

@ -0,0 +1,375 @@
<template>
<!-- 会员详情 -->
<view class="content">
<view class="towcontentitem">
<view class="towcontentitemone flex-start">
<image class="towcontentitemoneimage" :src="userInfo.logo" mode="aspectFill"></image>
<view class="towcontentitemonetext flex-colum-start">
<text class="towcontentitemonetextone">{{userInfo.chainName || '暂无昵称'}}</text>
</view>
</view>
<view class="towcontentitemthere flex-start">
余额<text class="towcontentitemtheretext">{{userInfo.amount || '0.00'}}</text>
</view>
<view class="towcontentitemtow flex-between">
<text class="towcontentitemtowetext">vip{{userInfo.code || '无'}}</text>
</view>
<view class="towcontentitevip">
vip{{userInfo.is_vip}}
</view>
</view>
<view class="memberdetailsStyle">
<text>会员详情</text>
<view @click="goUrl('member/billDetails')">
<text>账单明细</text>
<uni-icons type="right" style="color: #333;" size="20"></uni-icons>
</view>
<view @click="goUrl('member/index')">
<text>会员充值</text>
<uni-icons type="right" style="color: #333;" size="20"></uni-icons>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
info:null,
inputshow: 0,
memberlist: {},
listdata: [],
amount: '',
shopUser: {},
userInfo: {},
}
},
onLoad(e) {
this.info = e
if (e.type == 'list') { //
this.paygetShopByMember(e.shopId_id)
} else {
this.paygetShopByMember(e.shopId_id)
}
// this.paygetActive() //
},
methods: {
async paygetShopByMember(w) {
let res = await this.api.paygetShopByMember({
page: 1,
pageSize: 10,
userId: uni.cache.get('userInfo').id,
shopId: w
})
this.userInfo = res.data.list[0]
},
async paygetActive() {
let res = await this.api.paygetActive({
shopId: uni.cache.get('shopUser'),
page: 1,
pageSize: 10
})
try {
this.listdata = res.data.list
this.amount = res.data.list[0].minNum
} catch (e) {
//TODO handle the exception
}
},
async userbalancerechangesub() {
if (this.amount == null || this.amount == '') {
uni.showToast({
title: '金额不能为空',
icon: 'none'
});
return false;
}
let res = await this.api.paymemeberIn({
shopId: uni.cache.get('shopUser'), // ,
amount: this.amount // ,
})
if (res) {
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay', //-
partnerid: res.data.appId, //
timeStamp: res.data.timeStamp, //
nonceStr: res.data.nonceStr, //
package: res.data.package, //
signType: res.data.signType, //
paySign: res.data.paySign, //
success: (res) => {
uni.showToast({
title: "支付成功"
})
setTimeout(res => {
uni.navigateBack()
}, 1000)
},
fail: (err) => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
setTimeout(res => {
uni.hideLoading()
}, 1000)
}
});
// #endif
}
},
clickinput(a, b) {
console.log(a, b)
this.inputshow = b
this.amount = a.minNum
},
goUrl(url){
uni.pro.navigateTo(url,this.info)
},
eeInfo(e) {
uni.pro.navigateTo('my/member/memberinfo', {
id: e,
})
},
}
}
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
.content {
padding: 0 28rpx;
.towcontentitem {
width: 100%;
position: relative;
padding: 32rpx;
border-radius: 12rpx;
background: linear-gradient(126deg, #FFFBF2 0%, #F2D093 100%);
border-radius: 12rpx 12rpx 12rpx 12rpx;
&::after {
position: absolute;
bottom: 0;
right: 68rpx;
content: '';
display: inline-block;
width: 240rpx;
height: 232rpx;
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/member.png) no-repeat;
background-size: 100% 100%;
}
.towcontentitemimage {
top: 0;
left: 0;
position: absolute;
width: 100%;
height: 100%;
border-radius: 12rpx;
z-index: 5;
}
.towcontentitemone {
width: 100%;
position: relative;
z-index: 9;
.towcontentitemoneimage {
width: 76rpx;
height: 76rpx;
border-radius: 50%;
}
.towcontentitemonetext {
height: 76rpx;
margin-left: 16rpx;
.towcontentitemonetextone {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 36rpx;
color: #333333;
}
.towcontentitemonetexttow {
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #422A07;
}
}
}
.towcontentitemprogressa {
padding: 8rpx 44rpx;
z-index: 10;
position: relative;
margin-top: 54rpx;
}
.towcontentitemtow {
margin-top: 84rpx;
z-index: 10;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #422A07;
}
.towcontentitevip {
position: absolute;
right: 0;
top: 0;
width: 92rpx;
height: 40rpx;
font-size: 20rpx;
background: #F4C380;
border-radius: 0rpx 12rpx 0rpx 12rpx;
text-align: center;
line-height: 40rpx;
color: #fff;
font-family: Source Han Sans CN-Medium;
font-weight: Medium;
}
.towcontentitemthere {
margin-left: 92rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: Medium;
font-size: 24rpx;
color: #333333;
.towcontentitemtheretext {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 36rpx;
color: #333333;
}
}
}
.therecontent {
margin-top: 32rpx;
position: relative;
padding: 22rpx 32rpx;
width: 100%;
background: #FFFFFF;
border-radius: 8rpx;
input {
padding-left: 30rpx;
text-align: right;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #666666;
}
}
.therecontent::after {
position: absolute;
top: 50%;
left: 32rpx;
transform: translateY(-50%);
content: '¥';
display: inline-block;
width: 28rpx;
height: 40rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.fourcontent {
.fourcontentlnage {
width: 33.33%;
.fourcontentitem {
margin: 24rpx 10rpx;
padding: 16rpx 0;
text-align: center;
background: #FFFFFF;
border-radius: 8rpx;
border: 1rpx solid #333333;
font-size: 28rpx;
font-family: Roboto-Medium, Roboto;
font-weight: 500;
color: #333333;
}
.fourcontentitems {
margin: 24rpx 10rpx;
padding: 16rpx 0;
text-align: center;
border-radius: 8rpx;
background: #F1CB66;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 2rpx solid #F1CB66;
font-size: 28rpx;
font-family: Roboto-Medium, Roboto;
font-weight: 500;
color: #FFFFFF;
}
}
}
.fivecontent {
position: relative;
bottom: 44rpx;
margin-top: 62rpx;
padding: 20rpx 0;
text-align: center;
width: 100%;
font-size: 36rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
border-radius: 8rpx;
background: #F1CB66;
}
//
.memberdetailsStyle {
margin-top: 32rpx;
border-radius: 24rpx 24rpx 24rpx 24rpx;
background-color: #fff;
padding: 32rpx;
height: 252rpx;
display: flex;
justify-content: space-between;
flex-direction: column;
>text {
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
>view {
font-weight: 400;
font-size: 28rpx;
color: #333333;
display: flex;
justify-content: space-between;
align-items: center;
}
}
}
</style>

View File

@ -91,7 +91,7 @@
const hour = date.getHours(); //
const minute = date.getMinutes(); //
const second = date.getSeconds(); //
const formattedDate = `${year}-${month}-${day} ${hour}:${minute}:${second}`; //
const formattedDate = `${year}-${month}-${day} ${hour.length==1? '0'+hour:hour}:${minute.length==1? '0'+minute:minute}:${second.length==1? '0'+second:second}`; //
return formattedDate
}
},

View File

@ -171,7 +171,7 @@
以优惠¥{{emitorderfoodform.couponsPrice}}
</view>
</view>
<view class="fixedview_tow" @click="shopEvent">
<view class="fixedview_tow" @tap="fangdouevent">
立即付款
</view>
</view>
@ -255,7 +255,11 @@
})
},
methods: {
fangdouevent() {
this.$u.debounce(() => {
this.showpopupclick()
}, 1000)
},
async getcoupon() {
let res = await this.api.userCoupon({
"orderNum": this.listinfo.amount,
@ -336,10 +340,7 @@
orderId: this.listinfoid
})
},
//
shopEvent(){
uni.$u.throttle(this.showpopupclick, 500)
},
//
showpopupclick() {
if (this.numValue == 0) {

View File

@ -49,7 +49,7 @@
</view>
<!-- 支付方式 -->
<view class="payType" >
<view class="payType">
<view class="">
支付方式
</view>
@ -65,7 +65,8 @@
</text>
</view>
</u-radio>
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;" v-if="info.isUseVip==1"> </view>
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;"
v-if="info.isUseVip==1"> </view>
<u-radio activeColor="#ffd158" name="2" v-if="info.isUseVip==1">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
@ -76,7 +77,8 @@
</view>
</u-radio>
</u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;" v-if="info.isUseVip==1">
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;"
v-if="info.isUseVip==1">
会员卡余额{{ amountVIP.amount}} <text
style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
@click="goRecharge">去充值</text>
@ -94,7 +96,7 @@
<view class="">
{{Quantity}} 已优惠{{calculateEvent(info.save) }}
</view>
<button class="btnStyle" @click="sumbitFroms">提交订单</button>
<button class="btnStyle" @click="fangdouevent">提交订单</button>
</view>
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-show="ispws"></payPassword>
</view>
@ -108,8 +110,6 @@
},
onLoad(e) {
this.getInfo(e.id)
this.orderIds = e.id
this.amount = uni.cache.get('userInfo').amount
this.vipId = uni.cache.get('userInfo').id
@ -149,9 +149,9 @@
})
if (res.code == 0) {
let orderInfo = {
createdAt:this.listinfoid.createTime,
orderNo:this.listinfoid.orderNo,
orderAmount:this.calculateEvent(this.info.salePrice)
createdAt: this.listinfoid.createTime,
orderNo: this.listinfoid.orderNo,
orderAmount: this.calculateEvent(this.info.salePrice)
}
uni.showToast({
icon: 'none',
@ -160,7 +160,8 @@
setTimeout(res => {
uni.redirectTo({
url: '/pages/order/successful?orderId=' + this
.listinfoid.id + '&orderInfo=' + JSON.stringify(orderInfo)
.listinfoid.id + '&orderInfo=' + JSON.stringify(
orderInfo)
});
}, 1000)
}
@ -173,16 +174,17 @@
}
},
calculateEvent(d) {
return (d * 1000 * this.Quantity)/1000
return (d * 1000 * this.Quantity) / 1000
},
goRecharge() {
uni.pro.navigateTo('/pages/member/index', {
shopId_id: this.info.shopId
})
},
//
sumbitFroms(){
uni.$u.throttle(this.sumbitFrom, 500)
fangdouevent() {
this.$u.debounce(() => {
this.sumbitFrom()
}, 1000)
},
async sumbitFrom() {
let payMoney = this.info.salePrice * this.Quantity
@ -201,7 +203,7 @@
this.payEvent(res.data.id)
} else {
// 0
let isVip = uni.cache.get('userInfo').isPwd
let isVip = uni.cache.get('userInfo').isPwd
if (isVip == 0) {
uni.pro.navigateTo('/pages/user/repairpassword', {
shopId_id: uni.cache.get('shopUser')