MrShi
2026-05-12 47d56a8b0f22fb15a46b69dfd46fac23560ad2cd
mini-program/pages/confirm-order/confirm-order.vue
@@ -89,23 +89,23 @@
            <view class="info-item">
               <view class="info-item-label">商品总价</view>
               <view class="info-item-price">
                  <text>{{orderInfo.amount}}</text>
                  <text>{{((orderInfo.amount || 0)-(orderInfo.mailAmount || 0)).toFixed(2)}}</text>
               </view>
            </view>
            <view class="info-item">
               <view class="info-item-label">运费</view>
               <view class="info-item-price1">¥{{orderInfo.mailAmount}}</view>
            </view>
            <view class="info-item">
            <view class="info-item" @click="show = true">
               <view class="info-item-label">优惠券</view>
               <view class="info-item-price1" @click="show = true">
               <view class="info-item-price1">
                  -¥{{orderInfo.couponAmount}}
                  <image src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
               </view>
            </view>
            <view class="info-item">
            <view class="info-item" @click="show1 = true">
               <view class="info-item-label">积分抵扣</view>
               <view class="info-item-price1" @click="show1 = true">
               <view class="info-item-price1">
                  -¥{{orderInfo.integralAmount}}
                  <image src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
               </view>
@@ -113,7 +113,7 @@
            <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>{{orderInfo.payAmount}}</text>
                  <text>{{(orderInfo.payAmount || 0).toFixed(2)}}</text>
               </view>
            </view>
         </view>
@@ -140,26 +140,30 @@
         <view class="coupon">
            <view class="coupon-title">选择优惠券</view>
            <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>{{item.name}}</text>
                        <text>{{item.endDate.substring(0, 10)}} 日到期</text>
               <template v-if="orderInfo.memberCouponList && orderInfo.memberCouponList.length > 0">
                  <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>
                     <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 class="jiage1" v-if="item.couponType === 1">
                        <text>{{item.price}}</text>
                        <text>满{{item.limitPrice}}可用</text>
                     </view>
                     <view class="juaninfo">
                        <view class="juaninfo-info">
                           <text>{{item.name}}</text>
                           <text>{{item.endDate.substring(0, 10)}} 日到期</text>
                        </view>
                        <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>
               </template>
               <view class="coupon-list-wuData">暂无可用优惠卷</view>
            </scroll-view>
            <view class="coupon-btn" @click="confirmCoupon">确定</view>
            <view style="width: 100%; height: 30rpx;"></view>
         </view>
      </u-popup>
      <!-- 积分 -->
@@ -178,6 +182,7 @@
               </view>
            </view>
            <view class="coupon-btn" @click="confirmJF">确定</view>
            <view style="width: 100%; height: 30rpx;"></view>
         </view>
      </u-popup>
      <!-- 门店 -->
@@ -199,7 +204,7 @@
                  <view :class="item.active ? 'dian active' : 'dian'" @click="seleShop(index)" v-for="(item, index) in shopList" :key="index">
                     <view class="dian-top">
                        <view class="dian-top-image">
                           <image :src="item.imgFullUrl" mode="widthFix"></image>
                           <image :src="item.imgFullUrl || '/static/icon/default2.png'" mode="widthFix"></image>
                        </view>
                        <view class="dian-top-info">
                           <view class="dian-top-info-title">
@@ -237,6 +242,8 @@
            <view class="coupon-phone" @click="dianhua(shopId.phone)">{{shopId.phone}}</view>
         </view>
      </u-popup>
      <!-- 下单报错提示 -->
       <u-modal :show="show4" :content='content' @confirm="show4 = false"></u-modal>
   </view>
</template>
@@ -253,6 +260,8 @@
            show1: false,
            show2: false,
            show3: false,
            show4: false,
            content: '',
            shopName: '',
            orderInfo: null,
            addr: null,
@@ -261,13 +270,14 @@
            useIntegralCopy: 0,
            useIntegral: 0,
            receiveType: 0,
            couponId: null,
            couponId: -1,
            shopId: null,
            payDetailRequestList: [],
            shopList: [],
            isPosition: true,
            lat: '',
            lgt: '',
            loading: false,
         };
      },
      onLoad(option) {
@@ -283,6 +293,9 @@
         uni.$on('city', (data) => {
            this.cityName = data
            this.getShopLists()
         })
         uni.$on('addressDele', (data) => {
            this.getDefaultAddr()
         })
         this.getDefaultAddr()
      },
@@ -308,7 +321,7 @@
               success: function (addr) {
                  const locParam = { latitude: addr.latitude, longitude: addr.longitude };
                  const qqmapsdk = new QQMapWX({
                     key: 'HEIBZ-QJLLM-SZ36X-6ZBHI-S6Y2J-S6FND'
                     key: 'WE3BZ-HN6WS-ONDOH-62QCV-MNL6F-5NFNE'
                  });
                  qqmapsdk.reverseGeocoder({
                     locParam,
@@ -381,7 +394,7 @@
            this.$u.api.getShopList({
               cityName: this.cityName,
               lat: this.lat,
               lgt: this.lng,
               lgt: this.lgt,
               shopName: this.shopName
            }).then(res => {
               if (res.code === 200) {
@@ -406,6 +419,8 @@
               title: '请选择门店',
               icon: 'none'
            })
            if (this.loading) return;
            this.loading = true
            this.$u.api.orderPay({
               addressId: this.addr ? this.addr.id : null,
               couponId: this.couponId,
@@ -416,9 +431,11 @@
               titlePrice: this.orderInfo.payAmount,
               shopId: this.shopId ? this.shopId.id : null
            }).then(res => {
               console.log(res)
               if (res.code === 200) {
                  // 积分抵扣
                  if (res.data.payType === 1) {
                     uni.$emit('shuaxin')
                     uni.redirectTo({
                        url: `/pagesA/pages/order-details/order-details?id=${res.data.orderId}&userType=0`
                     })
@@ -430,17 +447,28 @@
                        signType: res.data.response.signType,
                        paySign: res.data.response.paySign,
                        success (pay) {
                           uni.$emit('shuaxin')
                           if (pay.errMsg === "requestPayment:ok") {
                              uni.redirectTo({
                                 url: `/pagesA/pages/order-details/order-details?id=${res.data.orderId}&userType=0`
                              })
                           } else {
                              uni.showToast({ title: '订单取消支付', icon: 'none' })
                           }
                        },
                        fail (err) {
                           uni.$emit('shuaxin')
                           uni.redirectTo({
                              url: '/pagesA/pages/order/order?userType=0&status=1'
                           })
                        }
                     })
                  }
               }
            }).catch(err => {
               console.log(err)
               this.show4 = true
               this.content = err.data.message || '下单失败,请稍后重试'
            }).finally(() => {
               this.loading = false
            })
         },
         // 确定使用积分
@@ -454,6 +482,8 @@
            let arr = this.orderInfo.memberCouponList.filter(item => item.active)
            if (arr.length > 0) {
               this.couponId = arr[0].id
            } else {
               this.couponId = null
            }
            this.show = false
            this.getOrderInfo()
@@ -461,7 +491,11 @@
         // 选择优惠券
         selectCoupon(i) {
            this.orderInfo.memberCouponList.forEach((item, index) => {
               item.active = index === i
               if (index === i) {
                  item.active = !item.active
               } else {
                  item.active = false
               }
            })
         },
         // 获取订单详细信息
@@ -478,7 +512,11 @@
                     res.data.memberCouponList = []
                  } else {
                     res.data.memberCouponList.forEach(item => {
                        item.active = false
                        if (res.data.memberCoupon) {
                           item.active = item.id === res.data.memberCoupon.id
                        } else {
                           item.active = false
                        }
                     })
                  }
                  this.orderInfo = res.data
@@ -699,7 +737,7 @@
            font-weight: 500;
            font-size: 32rpx;
            color: #FFFFFF;
            margin-top: 60rpx;
            margin: 60rpx 0 30rpx 0;
         }
         .coupon-content {
            width: 100%;
@@ -758,6 +796,15 @@
                     }
                  }
               }
            }
            .coupon-list-wuData {
               width: 100%;
               height: 600rpx;
               line-height: 600rpx;
               text-align: center;
               font-size: 26rpx;
               color: #999999;
               font-weight: 400;
            }
            .coupon-list-item {
               width: 100%;
@@ -1060,6 +1107,11 @@
               flex-direction: column;
               justify-content: space-between;
               .item-info-title {
                  width: 100%;
                  display: -webkit-box;
                  -webkit-box-orient: vertical;
                  -webkit-line-clamp: 2;
                  overflow: hidden;
                  font-weight: 400;
                  font-size: 30rpx;
                  color: #222222;