绿满眶商城微信小程序-uniapp
zxl
3 天以前 796977e24baa7c1d3a333e2c1c8e06ca73fd9a56
pages/order/fillorder.vue
@@ -148,6 +148,11 @@
            "
            :span="3"
          >
<!--         <video v-if="val.goodsSku.goodsVideo" :src="val.goodsSku.goodsVideo"
        style="width: 200rpx;height: 200rpx;border-radius: 10rpx;"
       :initial-time="0"
          :controls="false" object-fit="contain" :show-play-btn="false" :show-center-play-btn="false"
        ></video> -->
            <u-image
              borderRadius="10rpx"
              width="200rpx"
@@ -379,14 +384,15 @@
        <div class="tabbar-right">提交订单</div>
        <!-- #endif -->
        <!-- #ifdef MP-WEIXIN -->
        <div class="tabbar-right">微信支付</div>
        <div class="tabbar-right">立即支付</div>
        <!-- #endif -->
      </div>
    </div>
  </div>
</template>
<script>
import '@/uview-components/uview-ui'
import '@/components/uview-components/uview-ui'
import * as API_Address from "@/api/address";
import * as API_Order from "@/api/order";
import * as API_Trade from "@/api/trade";
@@ -394,9 +400,12 @@
import LiLiWXPay from "@/js_sdk/lili-pay/wx-pay.js";
import invoices from "@/pages/order/invoice/setInvoice";
import { mapState } from "vuex";
import { getSessionId, userAction } from "@/api/userAction.js";
export default {
  onLoad: function (val) {
    this.routerVal = val;
   this.actionParam.pageParams = JSON.stringify(val)
   console.log('获取的参数-----------》',JSON.stringify(decodeURIComponent(this.routerVal.template)))
  },
  components: {
    invoices,
@@ -448,6 +457,17 @@
      storeAddress: "",
      originOrderData:"", // 原始订单数据
     pageSessionNo:"",
    sendOnShow:false,
     actionParam:{
           sessionId:'',
           actionType:"PAGE",
           joinType:"SELF",
           pageCode:"FILL_ORDER",
           pageParams:"{}",
           pageStatus:"JOIN",
           pageType:"DETAIL"
        }
    };
  },
  watch: {
@@ -510,8 +530,28 @@
      return true; //阻止默认返回行为
    }
  },
  onUnload() {
    let   param = Object.assign({}, this.actionParam);
    if (this.sendOnShow)return
    param.pageStatus = "LEAVE"
    userAction(param)
  },
  onHide() {
    this.startHidenTime = Date.now()
    let   param = Object.assign({}, this.actionParam);
    this.sendOnShow = true;
    param.pageStatus = "LEAVE"
    userAction(param)
  },
  async onShow() {
     getSessionId().then(res=>{
        this.pageSessionNo = res.data.data
      this.actionParam.sessionId = this.pageSessionNo
        if(this.pageSessionNo){
        let   param = Object.assign({}, this.actionParam);
           userAction(param)
        }
     })
    // 判断是否存在写过备注信息的商品
    if (this.remark && this.remark.length > 0) {
      this.remarkFlag = true;
@@ -535,6 +575,7 @@
  mounted() {},
  methods: {
    //发票回调 选择发票之后刷新购物车
    async callbackInvoice(val) {
      this.invoiceFlag = false;
@@ -699,22 +740,29 @@
              duration: 2000,
              icon: "none",
            });
         debugger;
         console.log('--------------绑定模板------------------>',decodeURIComponent(this.routerVal.template))
         //判断如果有template那么就直接根据trade的sn编号去将订单与模板绑定
         if(this.routerVal.template){
            let parms = {};
            const template = JSON.parse(decodeURIComponent(this.routerVal.template))
            parms.sn = res.data.result.sn;
            parms.templateId = template.templateId;
            parms.templateName = template.templateName;
            parms.chooseImage = template.chooseImage;
            parms.chooseImageId = template.chooseImageId;
            parms.templateForm = template.templateForm;
            API_Trade.bindingTemplate(parms)
         }
            // 如果当前价格为0跳转到订单列表
            if (this.orderMessage.priceDetailDTO.billPrice == 0) {
              uni.navigateTo({
                url: "/pages/order/myOrder?status=0",
              });
            } else {
              // #ifdef MP-WEIXIN
              // 微信小程序中点击创建订单直接开始支付
              this.pay(res.data.result.sn);
              // #endif
              // #ifndef MP-WEIXIN
              this.navigateTo(
                `/pages/cart/payment/payOrder?trade_sn=${res.data.result.sn}`
              );
              // #endif
            }
          } else {
            uni.showToast({