绿满眶商城微信小程序-uniapp
peng
2025-10-30 c61f03cfe1fcf023c7128f77f3d692aef309f77f
pages/order/fillorder.vue
@@ -387,6 +387,7 @@
        <div class="tabbar-right">立即支付</div>
        <!-- #endif -->
      </div>
    </div>
  </div>
</template>
@@ -399,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,
@@ -453,6 +457,17 @@
      storeAddress: "",
      originOrderData:"", // 原始订单数据
     pageSessionNo:"",
    sendOnShow:false,
     actionParam:{
           sessionId:'',
           actionType:"PAGE",
           joinType:"SELF",
           pageCode:"FILL_ORDER",
           pageParams:"{}",
           pageStatus:"JOIN",
           pageType:"DETAIL"
        }
    };
  },
  watch: {
@@ -515,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;
@@ -540,6 +575,7 @@
  mounted() {},
  methods: {
    //发票回调 选择发票之后刷新购物车
    async callbackInvoice(val) {
      this.invoiceFlag = false;
@@ -704,6 +740,20 @@
              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({