From 62b483cc627b0a5f7d626d6b333a3ef7c7c1f4f4 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 25 二月 2026 18:41:01 +0800
Subject: [PATCH] 调试
---
mini-program/pages/confirm-order/confirm-order.vue | 360 +++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 273 insertions(+), 87 deletions(-)
diff --git a/mini-program/pages/confirm-order/confirm-order.vue b/mini-program/pages/confirm-order/confirm-order.vue
index d5db9c4..f239f1c 100644
--- a/mini-program/pages/confirm-order/confirm-order.vue
+++ b/mini-program/pages/confirm-order/confirm-order.vue
@@ -1,71 +1,79 @@
<template>
- <view class="box">
+ <view class="box" v-if="orderInfo">
<view class="box-addr">
<view class="box-addr-list">
- <view class="box-addr-list-row active">
+ <view @click="changeOrderType(0)" :class="receiveType === 0 ? 'box-addr-list-row active' : 'box-addr-list-row'">
<image src="/static/icon/ic_wuliu_sel@2x.png" mode="widthFix"></image>
<text>鐗╂祦閰嶉��</text>
</view>
- <view class="box-addr-list-row">
+ <view @click="changeOrderType(1)" :class="receiveType === 1 ? 'box-addr-list-row active' : 'box-addr-list-row'">
<image src="/static/icon/ic_daodian@2x.png" mode="widthFix"></image>
<text>闂ㄥ簵鑷彁</text>
</view>
</view>
<!-- 鐗╂祦閰嶉�� -->
- <!-- <view class="box-addr-val">
+ <view class="box-addr-val" v-if="receiveType === 0">
<image class="icon1" src="/static/icon/ic_location@2x.png" mode="widthFix"></image>
- <view class="info">
- <view class="info-top">
- <text>鏉庨噾骞�</text>
- <text>181777889338</text>
- </view>
- <view class="info-bottom">
- 瀹夊窘鐪佸悎鑲ュ競缁忓紑鍖烘澗璋疯矾鍑ゅ嚢鍥介檯B搴�808 璞嗙背绉戞妧鏈夐檺鍏徃
+ <view class="info" @click="jumpAddr">
+ <template v-if="addr">
+ <view class="info-top">
+ <text>{{addr.name}}</text>
+ <text>{{addr.phone}}</text>
+ </view>
+ <view class="info-bottom">
+ {{addr.areaDetail}}{{addr.addr}}
+ </view>
+ </template>
+ <view class="info-wu" v-else>
+ <text>閫夋嫨鍦板潃</text>
+ <image class="icon2" src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
</view>
</view>
- <image class="icon2" src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
- </view> -->
+ <image class="icon2" src="/static/icon/ic_ar2@2x.png" mode="widthFix" v-if="addr"></image>
+ </view>
<!-- 闂ㄥ簵鑷彁 -->
- <view class="box-addr-val">
- <image class="icon1" src="/static/icon/ic_address@2x1.png" mode="widthFix"></image>
- <view class="info">
- <view class="info-top">
- <text>XXX缁忛攢鍟�</text>
+ <template v-if="receiveType === 1">
+ <view class="box-addr-val">
+ <image class="icon1" src="/static/icon/ic_address@2x1.png" mode="widthFix"></image>
+ <view class="info">
+ <view class="info-top">
+ <text>XXX缁忛攢鍟�</text>
+ </view>
+ <view class="info-bottom">
+ 瀹夊窘鐪佸悎鑲ュ競缁忓紑鍖烘澗璋疯矾鍑ゅ嚢鍥介檯B搴�808瀹�
+ </view>
</view>
- <view class="info-bottom">
- 瀹夊窘鐪佸悎鑲ュ競缁忓紑鍖烘澗璋疯矾鍑ゅ嚢鍥介檯B搴�808瀹�
+ <image class="icon2" src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
+ </view>
+ <view class="box-addr-time">
+ <text>钀ヤ笟鏃堕棿锛�</text>
+ <text>鍛ㄤ竴鑷冲懆浜� 09:00-19:00</text>
+ </view>
+ <view class="box-addr-dz">
+ <view class="box-addr-dz-left">
+ <text>鑱旂郴鐢佃瘽锛�</text>
+ <text>0551-87899903</text>
+ </view>
+ <view class="box-addr-dz-r">
+ <image src="/static/icon/ic_address@2x.png" mode="widthFix"></image>
+ <text>1.3km</text>
</view>
</view>
- <image class="icon2" src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
- </view>
- <view class="box-addr-time">
- <text>钀ヤ笟鏃堕棿锛�</text>
- <text>鍛ㄤ竴鑷冲懆浜� 09:00-19:00</text>
- </view>
- <view class="box-addr-dz">
- <view class="box-addr-dz-left">
- <text>鑱旂郴鐢佃瘽锛�</text>
- <text>0551-87899903</text>
- </view>
- <view class="box-addr-dz-r">
- <image src="/static/icon/ic_address@2x.png" mode="widthFix"></image>
- <text>1.3km</text>
- </view>
- </view>
+ </template>
</view>
<view class="box-shop">
- <view class="item">
+ <view class="item" v-for="(item, index) in orderInfo.goodsCalculateList" :key="index">
<view class="item-image">
- <image src="/static/logo.png" mode="widthFix"></image>
+ <image :src="item.skuImg" mode="widthFix"></image>
</view>
<view class="item-info">
- <view class="item-info-title">涓仈鑹剧瀹介娇 閫傜敤闆锋矁/涓仈/涔呬繚鐢�</view>
+ <view class="item-info-title">{{item.name}}</view>
<view class="item-info-bottom">
- <view class="price">楼499.00</view>
+ <view class="price">楼{{item.skuAmount}}</view>
<view class="num">
- <view class="num-add">-</view>
- <view class="num-total">0</view>
- <view class="num-add">+</view>
+ <!-- <view class="num-add">-</view> -->
+ <view class="num-total">鏁伴噺锛歿{item.goodsNum}}</view>
+ <!-- <view class="num-add">+</view> -->
</view>
</view>
</view>
@@ -75,104 +83,95 @@
<view class="info-item">
<view class="info-item-label">鍟嗗搧鎬讳环</view>
<view class="info-item-price">
- <text>897</text>
- <text>.00</text>
+ <text>{{orderInfo.amount}}</text>
</view>
</view>
<view class="info-item">
<view class="info-item-label">杩愯垂</view>
- <view class="info-item-price1">楼10.00</view>
+ <view class="info-item-price1">楼{{orderInfo.mailAmount}}</view>
</view>
<view class="info-item">
<view class="info-item-label">浼樻儬鍒�</view>
- <view class="info-item-price1">
- -楼100.00
+ <view class="info-item-price1" @click="show = true">
+ -楼{{orderInfo.couponAmount}}
<image src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
</view>
</view>
<view class="info-item">
<view class="info-item-label">绉垎鎶垫墸</view>
- <view class="info-item-price1">
- -楼10.00
+ <view class="info-item-price1" @click="show1 = true">
+ -楼{{orderInfo.integralAmount}}
<image src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
</view>
</view>
<view class="info-item">
<view class="info-item-label" style="color: #222222; font-size: 30rpx; font-weight: 600;">搴斾粯娆�</view>
<view class="info-item-price2">
- <text>797</text>
- <text>.00</text>
+ <text>{{orderInfo.payAmount}}</text>
</view>
</view>
</view>
</view>
<view class="remark">
<view class="remark-label">璁㈠崟澶囨敞</view>
- <input type="text" placeholder="璇疯緭鍏ュ娉�" />
+ <input type="text" v-model="remark" placeholder="璇疯緭鍏ュ娉�" />
</view>
<view class="play">
<view class="play-info">
<image src="/static/icon/order_ic_wepay@2x.png" mode="widthFix"></image>
<text>寰俊鏀粯</text>
</view>
- <image src="/static/icon/ic_agree@2x.png" mode=""></image>
+ <image src="/static/icon/cart_ic_sel@2x.png" mode="widthFix"></image>
</view>
<view class="footer">
<view class="edit">
- <view class="edit-btn">绔嬪嵆鏀粯 楼799.00</view>
+ <view class="edit-btn" @click="payment">绔嬪嵆鏀粯 楼{{orderInfo.payAmount}}</view>
</view>
<view style="width: 100%; height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 浼樻儬鍒� -->
- <u-popup :show="show" round="15" :closeable="true" mode="bottom">
+ <u-popup :show="show" round="15" :closeable="true" @close="show = false" mode="bottom">
<view class="coupon">
<view class="coupon-title">閫夋嫨浼樻儬鍒�</view>
- <view class="coupon-list">
- <view class="coupon-list-item">
- <view class="jiage">
- <text>100</text>
- <text>婊�300鍙敤</text>
+ <scroll-view scroll-y class="coupon-list">
+ <view class="coupon-list-item" v-for="(item, index) in orderInfo.memberCouponList" :key="index" @click="selectCoupon(index)">
+ <view class="jiage" v-if="item.couponType === 0">
+ <text>{{item.price}}</text>
+ <text>婊{item.limitPrice}}鍙敤</text>
+ </view>
+ <view class="jiage1" v-if="item.couponType === 1">
+ <text>{{item.price}}</text>
+ <text>婊{item.limitPrice}}鍙敤</text>
</view>
<view class="juaninfo">
<view class="juaninfo-info">
- <text>鏂板涓撲韩</text>
- <text>2020.5.25 鏃ュ埌鏈�</text>
+ <text>{{item.name}}</text>
+ <text>{{item.endDate.substring(0, 10)}} 鏃ュ埌鏈�</text>
</view>
- <image src="/static/icon/ic_agree@2x.png" mode="widthFix"></image>
+ <image src="/static/icon/ic_agree@2x.png" mode="widthFix" v-if="!item.active"></image>
+ <image src="/static/icon/cart_ic_sel@2x.png" mode="widthFix" v-else></image>
</view>
</view>
- <view class="coupon-list-item disable">
- <view class="jiage">
- <text>100</text>
- <text>婊�300鍙敤</text>
- </view>
- <view class="juaninfo">
- <view class="juaninfo-info">
- <text>鏂板涓撲韩</text>
- <text>2020.5.25 鏃ュ埌鏈�</text>
- </view>
- <image src="/static/icon/ic_agree@2x.png" mode="widthFix"></image>
- </view>
- </view>
- </view>
- <view class="coupon-btn">纭畾</view>
+ </scroll-view>
+ <view class="coupon-btn" @click="confirmCoupon">纭畾</view>
</view>
</u-popup>
<!-- 绉垎 -->
- <u-popup :show="show1" round="15" :closeable="true" mode="bottom">
+ <u-popup :show="show1" round="15" @close="show1 = false" :closeable="true" mode="bottom">
<view class="coupon">
<view class="coupon-title">浣跨敤绉垎</view>
<view class="coupon-content">
<view class="coupon-content-a">
<text>褰撳墠绉垎锛�</text>
- <text>1200</text>
+ <text>{{orderInfo.surplusIntegral || 0}}</text>
</view>
- <view class="coupon-content-b">
- <text>鏈崟鍙敤绉垎锛�1000</text>
- <image src="/static/icon/ic_agree_sel@2x.png" mode="widthFix"></image>
+ <view class="coupon-content-b" @click="useIntegralCopy = useIntegralCopy === 1 ? 0 : 1">
+ <text>鏈崟鍙敤绉垎锛歿{orderInfo.deductIntegral}}</text>
+ <image src="/static/icon/ic_agree_sel@2x.png" mode="widthFix" v-if="useIntegralCopy === 1"></image>
+ <image src="/static/icon/ic_agree@2x.png" mode="widthFix" v-else></image>
</view>
</view>
- <view class="coupon-btn">纭畾</view>
+ <view class="coupon-btn" @click="confirmJF">纭畾</view>
</view>
</u-popup>
<!-- 闂ㄥ簵 -->
@@ -226,15 +225,154 @@
</template>
<script>
+ import { mapState } from 'vuex'
export default {
+ computed: {
+ ...mapState(['position'])
+ },
data() {
return {
show: false,
show1: false,
show2: false,
- show3: true,
- keyword: ''
+ show3: false,
+ keyword: '',
+ orderInfo: null,
+ addr: null,
+ remark: '',
+ useIntegralCopy: 0,
+ useIntegral: 0,
+ receiveType: 0,
+ couponId: null,
+ payDetailRequestList: []
};
+ },
+ onLoad(option) {
+ const shop = uni.getStorageSync('shop');
+ if (shop) {
+ this.payDetailRequestList = shop
+ uni.removeStorageSync('shop');
+ }
+ uni.$on('update', (data) => {
+ this.addr = data
+ this.getOrderInfo()
+ })
+ this.getDefaultAddr()
+ },
+ methods: {
+ // 鑾峰彇闄勮繎闂ㄥ簵
+ getShopLists() {
+ this.$u.api.getShopList({
+ cityName: this.position.ad_info.city,
+ lat: this.position.location.lat,
+ lgt: this.position.location.lng
+ }).then(res => {
+ if (res.code === 200) {
+ console.log(res)
+ }
+ })
+ },
+ // 鏀粯
+ payment() {
+ this.$u.api.orderPay({
+ addressId: this.addr.id,
+ couponId: this.couponId,
+ payDetailRequestList: this.payDetailRequestList,
+ receiveType: this.receiveType,
+ useIntegral: this.useIntegral,
+ remark: this.remark,
+ titlePrice: this.orderInfo.payAmount
+ }).then(res => {
+ if (res.code === 200) {
+ // 绉垎鎶垫墸
+ if (res.data.payType === 1) {
+ uni.reLaunch({
+ url: `/pagesA/pages/order-details/order-details?id=${res.data.orderId}&userType=0`
+ })
+ } else {
+ wx.requestPayment({
+ timeStamp: res.data.response.timeStamp,
+ nonceStr: res.data.response.nonceStr,
+ package: res.data.response.packageValue,
+ signType: res.data.response.signType,
+ paySign: res.data.response.paySign,
+ success (pay) {
+ if (pay.errMsg === "requestPayment:ok") {
+ uni.reLaunch({
+ url: `/pagesA/pages/order-details/order-details?id=${res.data.orderId}&userType=0`
+ })
+ } else {
+ uni.showToast({ title: '璁㈠崟鍙栨秷鏀粯', icon: 'none' })
+ }
+ }
+ })
+ }
+ }
+ })
+ },
+ // 纭畾浣跨敤绉垎
+ confirmJF() {
+ this.useIntegral = this.useIntegralCopy
+ this.show1 = false
+ this.getOrderInfo()
+ },
+ // 纭畾閫夋嫨浼樻儬鍒�
+ confirmCoupon() {
+ let arr = this.orderInfo.memberCouponList.filter(item => item.active)
+ if (arr.length > 0) {
+ this.couponId = arr[0].id
+ }
+ this.show = false
+ this.getOrderInfo()
+ },
+ // 閫夋嫨浼樻儬鍒�
+ selectCoupon(i) {
+ this.orderInfo.memberCouponList.forEach((item, index) => {
+ item.active = index === i
+ })
+ },
+ // 鑾峰彇璁㈠崟璇︾粏淇℃伅
+ getOrderInfo() {
+ this.$u.api.orderPayConfirm({
+ addressId: this.addr ? this.addr.id : null,
+ couponId: this.couponId,
+ payDetailRequestList: this.payDetailRequestList,
+ receiveType: this.receiveType,
+ useIntegral: this.useIntegral
+ }).then(res => {
+ if (res.code === 200) {
+ if (!res.data.memberCouponList) {
+ res.data.memberCouponList = []
+ } else {
+ res.data.memberCouponList.forEach(item => {
+ item.active = false
+ })
+ }
+ this.orderInfo = res.data
+ }
+ })
+ },
+ changeOrderType(type) {
+ this.receiveType = type
+ if (this.receiveType === 1) {
+ this.getShopLists()
+ }
+ this.getOrderInfo()
+ },
+ jumpAddr() {
+ uni.navigateTo({
+ url: '/pages/address/address?type=1'
+ })
+ },
+ getDefaultAddr() {
+ this.$u.api.findDefault()
+ .then(res => {
+ if (res.code === 200) {
+ this.addr = res.data
+ this.getOrderInfo()
+ }
+ })
+ }
}
}
</script>
@@ -434,6 +572,7 @@
}
.coupon-list {
width: 100%;
+ max-height: 600rpx;
display: flex;
flex-direction: column;
.disable {
@@ -481,6 +620,35 @@
color: #E4001D;
&::before {
content: '锟�';
+ font-weight: 600;
+ font-size: 24rpx;
+ color: #E4001D;
+ }
+ }
+ &:nth-child(2) {
+ font-weight: 400;
+ font-size: 24rpx;
+ color: #E93047;
+ margin-top: 8rpx;
+ }
+ }
+ }
+ .jiage1 {
+ flex-shrink: 0;
+ width: 208rpx;
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ border-right: 1rpx dashed #E3C1C1;
+ text {
+ &:nth-child(1) {
+ font-weight: 600;
+ font-size: 44rpx;
+ color: #E4001D;
+ &::after {
+ content: '鎶�';
font-weight: 600;
font-size: 24rpx;
color: #E4001D;
@@ -868,6 +1036,7 @@
}
.info {
flex: 1;
+ min-height: 48rpx;
display: flex;
flex-direction: column;
.info-top {
@@ -893,6 +1062,23 @@
color: #333333;
margin-top: 14rpx;
}
+ .info-wu {
+ flex: 1;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ text {
+ font-weight: 400;
+ font-size: 26rpx;
+ color: #333333;
+ }
+ image {
+ width: 12rpx;
+ height: 24rpx;
+ margin: 0 !important;
+ }
+ }
}
.icon2 {
flex-shrink: 0;
--
Gitblit v1.9.3