This commit is contained in:
魏啾
2024-05-22 15:14:46 +08:00
6 changed files with 178 additions and 81 deletions

View File

@@ -67,6 +67,10 @@ export default {
paymodfiyOrderInfo(data) { //查询订单支付状态 paymodfiyOrderInfo(data) { //查询订单支付状态
return uni.api.post("/pay/modfiyOrderInfo", data); return uni.api.post("/pay/modfiyOrderInfo", data);
}, },
// 获取余额
shopUserInfo(data) {
return uni.api.get("/user/shopUserInfo", data);
},
// 优惠加倍 // 优惠加倍
yhqDouble(data) { //查询订单支付状态 yhqDouble(data) { //查询订单支付状态
return uni.api.post("/order/yhqDouble", data); return uni.api.post("/order/yhqDouble", data);

View File

@@ -15,7 +15,7 @@
<image class="contenttowitemone_dingweiimage" <image class="contenttowitemone_dingweiimage"
:src="item.image" mode="aspectFill"></image> :src="item.image" mode="aspectFill"></image>
<view class="contenttowitemone_dingweinumer"> <view class="contenttowitemone_dingweinumer">
{{item.distances}}km {{item.distances}}
</view> </view>
</view> </view>
<view class="contenttowitemone_text"> <view class="contenttowitemone_text">

View File

@@ -32,7 +32,12 @@
</view> </view>
<view <view
:class="item.status == 0?'containertopboxitemright_four':'containertopboxitemright_fours'"> :class="item.status == 0?'containertopboxitemright_four':'containertopboxitemright_fours'">
{{item.status == 0 ? '兑换积分':'已过期'}} <text v-if="orderfood">
{{item.status == 0 ? '去使用':'无法使用'}}
</text>
<text v-else>
{{item.status == 0 ? '兑换积分':'已过期'}}
</text>
</view> </view>
</view> </view>
</view> </view>
@@ -141,7 +146,7 @@
uni.navigateBack() uni.navigateBack()
} else { } else {
uni.showToast({ uni.showToast({
title: '优惠卷不能用于目前订单', title: '优惠券面值大于支付金额',
icon: "none", icon: "none",
}) })
} }
@@ -156,7 +161,7 @@
uni.navigateBack() uni.navigateBack()
} else { } else {
uni.showToast({ uni.showToast({
title: '优惠卷不能用于目前订单', title: '优惠券面值大于支付金额',
icon: "none", icon: "none",
}) })
} }

View File

@@ -23,8 +23,8 @@
<view> <view>
{{item.shopName}} {{item.shopName}}
</view> </view>
<view> <view style="margin-top: 20rpx;">
龙首.{{item.distances}}km {{item.distances}}
</view> </view>
</view> </view>
<view class="fivecontent_item_nav_lefttopstart flex-start"> <view class="fivecontent_item_nav_lefttopstart flex-start">
@@ -42,7 +42,7 @@
<image :src="item.image" mode=""></image> <image :src="item.image" mode=""></image>
<view class="fivecontent_item_boxitemleft flex-colum-start"> <view class="fivecontent_item_boxitemleft flex-colum-start">
<view class="fivecontent_item_boxitemleftone flex-between"> <view class="fivecontent_item_boxitemleftone flex-between">
<view>{{item.productName}}</view> <view>{{item.productName.length>7?item.productName.substring(0,7)+'...':item.productName}}</view>
<text>已抢{{item.realSalesNumber}}</text> <text>已抢{{item.realSalesNumber}}</text>
</view> </view>
<view class="flex-start flexstartboxfttow"> <view class="flex-start flexstartboxfttow">
@@ -77,7 +77,7 @@
:hour="item.end_times.h" :minute="item.end_times.m" :hour="item.end_times.h" :minute="item.end_times.m"
:second="item.end_times.s" :indexs='index' color="#FFFFFF" :second="item.end_times.s" :indexs='index' color="#FFFFFF"
border-color="#00B26A" splitorColor="#FFFFFF" border-color="#00B26A" splitorColor="#FFFFFF"
:font-size="7"></uni-countdown> :font-size="10"></uni-countdown>
</view> </view>
@@ -426,10 +426,14 @@
.indexboxitemlefttheretext { .indexboxitemlefttheretext {
// width: 100%; // width: 100%;
margin-top: 12rpx; margin-top: 12rpx;
align-items: flex-end; display: flex;
justify-content: center;
align-items: center;
.fivecontent_item_boxitemlefthere_one { .fivecontent_item_boxitemlefthere_one {
align-items: flex-end; display: flex;
justify-content: center;
align-items: center;
.flex_startone { .flex_startone {
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;

View File

@@ -15,14 +15,14 @@
</view> </view>
<view class="towcontent"> <view class="towcontent">
<view class="towcontentone"> <view class="towcontentone">
{{orderinfo.couponsPrice}} {{orderInfo.orderAmount}}
</view> </view>
<view class="towcontentow flex-between"> <view class="towcontentow flex-between">
<view class="towcontentow_O"> <view class="towcontentow_O">
订单编号 订单编号
</view> </view>
<view class="towcontentow_T"> <view class="towcontentow_T">
{{orderinfo.orderId}} {{orderInfo.orderNo}}
</view> </view>
</view> </view>
<view class="towcontentow flex-between"> <view class="towcontentow flex-between">
@@ -30,7 +30,7 @@
下单时间 下单时间
</view> </view>
<view class="towcontentow_T"> <view class="towcontentow_T">
{{orderinfo.createTime}} {{orderInfo.createdAt|createdAtfiter}}
</view> </view>
</view> </view>
<view class="towcontentow flex-between"> <view class="towcontentow flex-between">
@@ -41,7 +41,7 @@
微信支付 微信支付
</view> </view>
</view> </view>
<view class="towcontenthere flex-colum"> <view class="towcontenthere flex-colum" v-if="orderinfo">
<view class="towcontentherebox flex-center"> <view class="towcontentherebox flex-center">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/yhj.png" mode=""></image> <image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/yhj.png" mode=""></image>
<text>恭喜获得优惠券</text> <text>恭喜获得优惠券</text>
@@ -81,10 +81,24 @@
components: { components: {
navseat navseat
}, },
filters: {
createdAtfiter(d) {
const timestamp = d; // 待转换的时间戳
const date = new Date(timestamp); // 根据时间戳创建Date对象
const year = date.getFullYear(); // 获取年份
const month = date.getMonth() + 1; // 获取月份需要加1
const day = date.getDate(); // 获取日期
const hour = date.getHours(); // 获取小时
const minute = date.getMinutes(); // 获取分钟
const second = date.getSeconds(); // 获取秒数
const formattedDate = `${year}-${month}-${day} ${hour}:${minute}:${second}`; // 拼接成格式化后的日期字符串
return formattedDate
}
},
data() { data() {
return { return {
titlename: '支付详情', titlename: '支付详情',
orderId:"", orderId: "",
opacitys: false, opacitys: false,
towcontentclickindex: 0, towcontentclickindex: 0,
windowHeight: '', windowHeight: '',
@@ -102,7 +116,7 @@
name: '饮品小吃' name: '饮品小吃'
} }
], ],
orderinfo:null, orderinfo: null,
form: { form: {
address: '', //地址 address: '', //地址
type: '', //品类 type: '', //品类
@@ -112,6 +126,7 @@
size: 10, //页容量 size: 10, //页容量
status: 'loadmore' status: 'loadmore'
}, },
orderInfo: null
}; };
}, },
onPageScroll(e) { onPageScroll(e) {
@@ -127,12 +142,15 @@
} }
}, },
onLoad(e) { onLoad(e) {
console.log('调试',e)
this.orderId = e.orderId this.orderId = e.orderId
setTimeout(() => { setTimeout(() => {
this.GetTop() this.GetTop()
}, 1000) }, 1000)
this.getinfo(e.orderId) this.getinfo(e.orderId)
this.orderInfo = JSON.parse(e.orderInfo)
console.log('调试1', e)
console.log('调试2', JSON.parse(e.orderInfo))
console.log('调试3', this.orderInfo)
}, },
computed: { computed: {
HeighT() { //手机类型的尺寸 HeighT() { //手机类型的尺寸
@@ -140,24 +158,27 @@
}, },
}, },
methods: { methods: {
async getinfo(id){ async getinfo(id) {
let res = await this.api.getYhqDouble({ let res = await this.api.getYhqDouble({
orderId:id // orderId: 420
orderId: id
}) })
console.log('调试1',res) if (res.code == 0) {
if(res.code==0){ this.orderinfo = res.data
this.orderinfo= res.data
} }
}, },
wantEvent(){ wantEvent() {
uni.redirectTo({ uni.redirectTo({
url: '/pages/index/index' url: '/pages/order/order_detail?orderId=' + this.orderId
}); });
}, },
async DoublingEvent(){ async DoublingEvent() {
let res = await this.api.yhqDouble({ let res = await this.api.yhqDouble({
conponsId: this.listinfoid conponsId: this.orderinfo.id
}) })
if (res.code == 0) {
this.wantEvent()
}
}, },
//G滚动底部 //G滚动底部
loadMore(e) { loadMore(e) {

View File

@@ -70,13 +70,23 @@
</view> </view>
</view> </view>
</view> </view>
<view class="sixcontent"> <!-- <view class="sixcontent">
<view class="sixcontentone flex-between" style="padding: 0 0;" @click="orderfoodindex"> <view class="sixcontentone flex-between" style="padding: 0 0;" @click="orderfoodindex">
<view class="sixcontent_one" style="padding: 0 0;"> <view class="sixcontent_one" style="padding: 0 0;">
优惠 优惠
</view> </view>
<text style="color: red;">{{emitorderfoodform.couponsPrice}}</text> <text style="color: red;">{{emitorderfoodform.couponsPrice}}</text>
</view> </view>
</view> -->
<view class="redMoney">
<view>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/hongbao.png"
style="width: 30rpx;height: 30.24rpx;;" mode=""></image>
红包/低佣券
</view>
<view @click="orderfoodindex">
<!-- {{info.couponDetail.name}} -->
</view>
</view> </view>
<!-- 支付方式 --> <!-- 支付方式 -->
<view class="payType"> <view class="payType">
@@ -107,8 +117,8 @@
</view> </view>
</u-radio> </u-radio>
</u-radio-group> </u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;"> <view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;">
会员卡余额{{ amountVIP}} <text style="font-weight: 500;font-size: 28rpx;color: #FF4C11;" 会员卡余额{{ amountVIP.amount}} <text style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
@click="goRecharge">去充值</text> @click="goRecharge">去充值</text>
</view> </view>
</view> </view>
@@ -144,28 +154,28 @@
</view> </view>
</view> </view>
</view> --> </view> -->
<view :style="{height:height}"> <view :style="{height:height}">
</view> </view>
<view class="fixedview"> <view class="fixedview">
<view class="flex-between"> <view class="flex-between">
<view class="fixedview_one flex-start"> <view class="fixedview_one flex-start">
<view class="fixedview_oneone"> <view class="fixedview_oneone">
实付金额 实付金额
</view>
<view class="fixedview_onetow">
<text>¥</text>{{listinfo.amount}}
</view>
<view class="fixedview_onethere" v-if="emitorderfoodform.couponsPrice">
以优惠¥{{emitorderfoodform.couponsPrice}}
</view>
</view> </view>
<view class="fixedview_onetow"> <view class="fixedview_tow" @click="showpopupclick">
<text>¥</text>{{listinfo.amount}} 立即付款
</view> </view>
<view class="fixedview_onethere" v-if="emitorderfoodform.couponsPrice">
以优惠¥{{emitorderfoodform.couponsPrice}}
</view>
</view>
<view class="fixedview_tow" @click="showpopupclick">
立即付款
</view> </view>
</view> </view>
</view> </view>
</view>
</template> </template>
<script> <script>
@@ -184,10 +194,10 @@
emitorderfoodform: { emitorderfoodform: {
clickiconone: '' clickiconone: ''
}, },
amountVIP:0, amountVIP: null,
radiovalue1: '1', radiovalue1: '1',
vipId:null, vipId: null,
orderInfo: ''
}; };
}, },
@@ -203,8 +213,9 @@
this.handlemessage() this.handlemessage()
uni.$on('message', this.getMessage) uni.$on('message', this.getMessage)
// 获取余额
this.getAount()
this.amountVIP = uni.cache.get('userInfo').amount
this.vipId = uni.cache.get('userInfo').id this.vipId = uni.cache.get('userInfo').id
}, },
onShow() { onShow() {
@@ -225,6 +236,17 @@
}) })
}, },
methods: { methods: {
async getAount(){
let res = await this.api.shopUserInfo({
// shopId:店铺ID
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
})
if(res.code==0){
this.amountVIP = res.data
}
},
getMessage(msg) { getMessage(msg) {
console.log('tiaoshi1', msg) console.log('tiaoshi1', msg)
if (msg.status != 'success') { if (msg.status != 'success') {
@@ -240,6 +262,7 @@
case 'createOrder': //去结算 case 'createOrder': //去结算
console.log('tiaoshi2', msg) console.log('tiaoshi2', msg)
this.listinfoid = msg.data.id //下单需要的id this.listinfoid = msg.data.id //下单需要的id
this.orderInfo = msg.data
this.showpopupclickdd() this.showpopupclickdd()
// let item = JSON.stringify(msg.data) // let item = JSON.stringify(msg.data)
// uni.redirectTo({ // uni.redirectTo({
@@ -288,31 +311,40 @@
// 去结算 // 去结算
showpopupclick() { showpopupclick() {
let data = { //定义socket数据传参 let data = { //定义socket数据传参
"skuId": '', "skuId": '',
"num": '', //数量 "num": '', //数量
"type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”, "type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
"couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID, "couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID,
"isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用), "isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买) "isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id "productId": '', //商品id
"shopId": uni.cache.get('shopUser'), "shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
// tableId:uni.cache.get('tableCode') // tableId:uni.cache.get('tableCode')
} }
console.log(data) console.log(data)
uni.$u.debounce(this.socketSendMsg(data), 500) uni.$u.debounce(this.socketSendMsg(data), 500)
},
// 去充值
goRecharge() {
uni.pro.navigateTo('/pages/member/index')
}, },
// 余额支付 // 余额支付
async accountPayevent(id){ async accountPayevent(id) {
let res = await this.api.accountPay({ let res = await this.api.accountPay({
orderId: id, orderId: id,
memberId:this.vipId memberId: this.vipId
}) })
console.log(res,'调试12') console.log(res, '调试12')
if (res.code == 0) { if (res) {
} else {
setTimeout(() => {
this.goRecharge()
}, 1000)
} }
}, },
async showpopupclickdd(i) { async showpopupclickdd(i) {
@@ -325,7 +357,7 @@
mask: true mask: true
}) })
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
if(this.radiovalue1==1){ if (this.radiovalue1 == 1) {
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', //支付类型-固定值 provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号 partnerid: res.data.appId, // 微信支付商户号
@@ -338,20 +370,21 @@
uni.showToast({ uni.showToast({
title: "支付成功" title: "支付成功"
}) })
this.paymodfiyOrderInfo()
setTimeout(res => { setTimeout(res => {
uni.redirectTo({ uni.redirectTo({
url: '/pages/order/successful?orderId=' + this url: '/pages/order/successful?orderId=' + this
.listinfoid .listinfoid + '&orderInfo=' + JSON.stringify(
this.orderInfo)
}); });
}, 1000) }, 1000)
this.paymodfiyOrderInfo()
// uni.redirectTo({ // uni.redirectTo({
// url: "/pages/mall/order/ordersuccess?id=" + datareslane.data // url: "/pages/mall/order/ordersuccess?id=" + datareslane.data
// .order_id, // .order_id,
// }); // });
}, },
fail: (err) => { fail: (err) => {
setTimeout(res => { setTimeout(() => {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '支付失败' title: '支付失败'
@@ -361,11 +394,14 @@
uni.redirectTo({ uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this.listinfoid url: '/pages/order/order_detail?orderId=' + this.listinfoid
}); });
},
complete: (data) => {
console.log(data, '成功与否')
} }
}); });
}else{ } else {
this.accountPayevent(this.listinfoid) this.accountPayevent(this.listinfoid)
} }
// #endif // #endif
} }
@@ -561,6 +597,33 @@
} }
} }
.redMoney {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 30rpx;
background-color: #fff;
padding: 18rpx 14rpx;
>view:first-child {
display: flex;
align-items: center;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
>view:last-child {
background: #FFE9E9;
border-radius: 16rpx 16rpx 16rpx 16rpx;
font-weight: 400;
font-size: 28rpx;
color: #FF3333;
text-align: center;
padding: 9rpx 13rpx;
}
}
.payType { .payType {
padding: 32rpx 34rpx; padding: 32rpx 34rpx;
margin-top: 48rpx; margin-top: 48rpx;