绿满眶商城微信小程序-uniapp
peng
2025-09-16 b8452670a1e2b3f415f8111a3c179f3a9a838b11
pages/order/myOrder.vue
@@ -101,8 +101,19 @@
                    @click="waitPay(order)"
                    >立即付款</view
                  >
              <!-- 新增:优惠券卡包按钮 -->
              <view
                ripple
                shape="circle"
                class="cancel-btn"
                size="mini"
               v-if="order.couponFlag === 'COUPON'&& order.orderStatus ==='COMPLETED'"
                @click="openCouponPackage(order)"
              >
                优惠券卡包
              </view>
                  <!-- 取消订单 -->
                  <view
<!--                  <view
                    ripple
                    class="cancel-btn"
                    shape="circle"
@@ -111,7 +122,7 @@
                    @click="onCancel(order.sn)"
                  >
                    取消订单
                  </view>
                  </view> -->
                  <!-- 等待收货 -->
                  <view
                    ripple
@@ -138,13 +149,25 @@
                    shape="circle"
                    class="cancel-btn"
                    size="mini"
                    v-if="order.groupAfterSaleStatus && ( order.groupAfterSaleStatus.includes('NOT_APPLIED') || order.groupAfterSaleStatus.includes('PART_AFTER_SALE'))"
                    v-if="order.groupAfterSaleStatus &&
                ( order.groupAfterSaleStatus.includes('NOT_APPLIED')
                || order.groupAfterSaleStatus.includes('PART_AFTER_SALE')||order.orderStatus === 'UNDELIVERED')"
                    @click="applyService(order)"
                  >
                    退款/售后
                  </view>
              <view
                ripple
                shape="circle"
                class="cancel-btn"
                size="mini"
                v-if="order.orderStatus === 'COMPLETED'"
                @click="buyBack(order)"
              >
                再来一单
              </view>
                  <!-- TODO 后续完善 -->
                  <!-- <u-button ripple shape="circle" class="rebuy-btn" size="mini" v-if="
<!--                  <u-button ripple shape="circle" class="rebuy-btn" size="mini" v-if="
                      order.orderStatus === 'CANCELLED' ||
                      order.orderStatus === 'COMPLETE'
                    " @click="reBuy(order)">
@@ -217,6 +240,7 @@
import { getOrderXcxList, cancelOrder, confirmReceipt } from "@/api/order.js";
import { getClearReason } from "@/api/after-sale.js";
import LiLiWXPay from "@/js_sdk/lili-pay/wx-pay.js";
import {buyBack} from "@/api/trade.js";
export default {
  data() {
@@ -362,6 +386,32 @@
    },
  },
  methods: {
     openCouponPackage(order){
        console.log(order)
      uni.navigateTo({
         url:"/pages/order/cardPack?sn=" + order.sn
      })
     },
     //再来一单
     buyBack(order){
      console.log(JSON.stringify(order))
      const param = order.orderItems.map(item => {
        return {
          skuId: item.skuId,
          num: item.num
        }
      })
      console.log('------------------>',JSON.stringify(param))
        buyBack(param).then(res=>{
           console.log('------------------->',res)
           if(res.data.code==200){
              uni.navigateTo({
                 url: "/pages/order/fillorder?way=CART"
              })
           }
        })
     },
    // 售后
    applyService(order) {
      uni.navigateTo({
@@ -415,18 +465,9 @@
     */
    pay(val) {
      if (val.sn) {
        // #ifdef MP-WEIXIN
        new LiLiWXPay({
          sn: val.sn,
          price: val.flowPrice,
          orderType: "ORDER",
        }).pay();
        // #endif
        // #ifndef MP-WEIXIN
        uni.navigateTo({
          url: "/pages/cart/payment/payOrder?order_sn=" + val.sn,
        });
        // #endif
      }
    },