MrShi
20 小时以前 56d7ebbc6297c306ec7197f29737a59703ca4bda
mini-program/pages/confirm-order/confirm-order.vue
@@ -96,16 +96,16 @@
               <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>
@@ -160,6 +160,7 @@
               </view>
            </scroll-view>
            <view class="coupon-btn" @click="confirmCoupon">确定</view>
            <view style="width: 100%; height: 30rpx;"></view>
         </view>
      </u-popup>
      <!-- 积分 -->
@@ -178,6 +179,7 @@
               </view>
            </view>
            <view class="coupon-btn" @click="confirmJF">确定</view>
            <view style="width: 100%; height: 30rpx;"></view>
         </view>
      </u-popup>
      <!-- 门店 -->
@@ -261,13 +263,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 +286,9 @@
         uni.$on('city', (data) => {
            this.cityName = data
            this.getShopLists()
         })
         uni.$on('addressDele', (data) => {
            this.getDefaultAddr()
         })
         this.getDefaultAddr()
      },
@@ -398,6 +404,16 @@
         // 支付
         payment() {
            var that = this;
            if (that.receiveType === 0 && !that.addr) return uni.showToast({
               title: '请选择收货地址',
               icon: 'none'
            })
            if (that.receiveType === 1 && !that.shopId) return uni.showToast({
               title: '请选择门店',
               icon: 'none'
            })
            if (this.loading) return;
            this.loading = true
            this.$u.api.orderPay({
               addressId: this.addr ? this.addr.id : null,
               couponId: this.couponId,
@@ -408,18 +424,14 @@
               titlePrice: this.orderInfo.payAmount,
               shopId: this.shopId ? this.shopId.id : null
            }).then(res => {
               this.loading = false
               if (res.code === 200) {
                  // 积分抵扣
                  if (res.data.payType === 1) {
                     // if (this.receiveType === 0) {
                        uni.redirectTo({
                           url: `/pagesA/pages/order-details/order-details?id=${res.data.orderId}&userType=0`
                        })
                     // } else {
                     //    uni.reLaunch({
                     //       url: `/pages/payment-successful/payment-successful?id=${res.data.orderId}&userType=0`
                     //    })
                     // }
                     uni.$emit('shuaxin')
                     uni.redirectTo({
                        url: `/pagesA/pages/order-details/order-details?id=${res.data.orderId}&userType=0`
                     })
                  } else {
                     wx.requestPayment({
                        timeStamp: res.data.response.timeStamp,
@@ -428,19 +440,18 @@
                        signType: res.data.response.signType,
                        paySign: res.data.response.paySign,
                        success (pay) {
                           uni.$emit('shuaxin')
                           if (pay.errMsg === "requestPayment:ok") {
                              // if (that.receiveType === 0) {
                                 uni.redirectTo({
                                    url: `/pagesA/pages/order-details/order-details?id=${res.data.orderId}&userType=0`
                                 })
                              // } else {
                              //    uni.reLaunch({
                              //       url: `/pages/payment-successful/payment-successful?id=${res.data.orderId}&userType=0`
                              //    })
                              // }
                           } else {
                              uni.showToast({ title: '订单取消支付', icon: 'none' })
                              uni.redirectTo({
                                 url: `/pagesA/pages/order-details/order-details?id=${res.data.orderId}&userType=0`
                              })
                           }
                        },
                        fail (err) {
                           uni.$emit('shuaxin')
                           uni.navigateTo({
                              url: '/pagesA/pages/order/order?userType=0&status=1'
                           })
                        }
                     })
                  }
@@ -458,6 +469,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()
@@ -465,7 +478,11 @@
         // 选择优惠券
         selectCoupon(i) {
            this.orderInfo.memberCouponList.forEach((item, index) => {
               item.active = index === i
               if (index === i) {
                  item.active = !item.active
               } else {
                  item.active = false
               }
            })
         },
         // 获取订单详细信息
@@ -482,7 +499,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
@@ -1041,6 +1062,10 @@
            height: 144rpx;
            display: flex;
            align-items: center;
            margin-bottom: 20rpx;
            &:last-child {
               margin: 0 !important;
            }
            .item-image {
               flex-shrink: 0;
               width: 144rpx;
@@ -1060,6 +1085,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;