绿满眶商城微信小程序-uniapp
peng
1 天以前 89efee9a2e20fc04b4537d859917b47cf68a814c
pages/order/orderDetail.vue
@@ -141,14 +141,17 @@
          <view class="title">服务</view>
        </view>
        <view class="customer-list">
          <view class="customer-service"
<!--       <view class="customer-service"
            v-if="orderDetail.allowOperationVO && orderDetail.allowOperationVO.cancel == true"
            @click="onCancel(order.sn)">取消订单</view>
            @click="onCancel(order.sn)">取消订单</view> -->
          <view class="customer-service" v-if="order.orderStatus == 'DELIVERED'" @click="onLogistics(order)">查看物流</view>
          <view class="customer-service" v-if="order.orderStatus != 'UNPAID' && order.orderPromotionType == 'PINTUAN'"
            @click="ByUserMessage(order)">查看拼团信息</view>
            <view class="customer-service"
            @click="contact(order.storeId)">联系客服</view>
         <view class="customer-service" v-if="order.orderStatus==='COMPLETED' && order.orderType !=='VIRTUAL'"
         @click="buyBack"
         >再来一单</view>
        </view>
      </view>
    </view>
@@ -260,14 +263,14 @@
</template>
<script>
import '@/uview-components/uview-ui'
import { getExpress, getPackage } from "@/api/trade.js";
import '@/pages/subComponents/uview-components/uview-ui'
import { getExpress, getPackage ,buyBack} from "@/api/trade.js";
import { cancelOrder, confirmReceipt, getOrderDetail } from "@/api/order.js";
import shares from "@/components/m-share/index"; //分享
import shares from "@/pages/order/m-share/index.vue"; //分享
import { getClearReason } from "@/api/after-sale.js";
import { getSessionId, userAction } from "@/api/userAction.js";
export default {
  components: {
    shares,
@@ -320,9 +323,45 @@
      rogShow: false,
      reason: "",
     orderPackage:"",
     //商品信息再来一单使用
     skuList:[],
     pageSessionNo:"",
     actionParam:{
           sessionId:'',
           actionType:"PAGE",
           joinType:"SELF",
           pageCode:"ORDER_DETAIL",
           pageParams:"{}",
           pageStatus:"JOIN",
           pageType:"DETAIL"
        }
    };
  },
  onUnload() {
    let   param = this.actionParam;
    if (this.sendOnShow)return
    param.pageStatus = "LEAVE"
    userAction(param)
  },
  onHide() {
    this.startHidenTime = Date.now()
    let   param = this.actionParam;
    this.sendOnShow = true;
    param.pageStatus = "LEAVE"
    userAction(param)
  },
  onShow() {
     getSessionId().then(res=>{
        this.pageSessionNo = res.data.data
        if(this.pageSessionNo){
        let   param = this.actionParam;
           param.sessionId = this.pageSessionNo
           userAction(param)
        }
     })
  },
  onLoad(options) {
    this.actionParam.pageParams = JSON.stringify(options)
    this.loadData(options.sn);
    this.sn = options.sn;
  },
@@ -369,9 +408,9 @@
    },
    // 获取物流信息
    loadLogistics(sn) {
      getExpress(sn).then((res) => {
        this.logisticsList = res.data.result;
      });
      // getExpress(sn).then((res) => {
      //   this.logisticsList = res.data.result;
      // });
    },
    // 分享当前拼团信息
@@ -390,11 +429,31 @@
          this.orderGoodsList[0].goodsId,
      });
    },
   //再来一单
   buyBack(){
      console.log(JSON.stringify(this.skuList))
      buyBack(this.skuList).then(res=>{
         console.log('------------------->',res)
         if(res.data.code==200){
            uni.navigateTo({
               url: "/pages/order/fillorder?way=CART"
            })
         }
      })
   },
    async loadData(sn) {
      uni.showLoading({
        title: "加载中",
      });
     // 将再次购买商品置空重新获取
     this.skuList = []
      getOrderDetail(sn).then((res) => {
    this.skuList =   res.data.result.orderItems.map(item=>{
         return{
            skuId:item.skuId,
            num:item.num}
        })
        const order = res.data.result;
        this.order = order.order;
        this.orderGoodsList = order.orderItems;