ONEZ.prototype.qrcode=function(vue,req){
  return new Promise((resolve, reject) => {
    var url=window.location.protocol+'//'+window.location.hostname;
    if(window.location.port && window.location.port!=80){
      url+=(':'+window.location.port);
    }
    url+='/index.php?action=$pay.auto';
    for(var k in req){
      url+='&'+k+'='+encodeURIComponent(req[k]);
    }
    resolve([true,url]);
  });
};
ONEZ.prototype.pay=function(vue,req){
  return new Promise((resolve, reject) => {
    vue.post({
        $purl:'bs.pay:/php/pay.php',
        ac:'pay',
        noVue:1,
        data:req,
      },(res)=>{
      if(res.error){
        onez.alert(res.error);
        resolve([false,res.error]);
      }else if(res.orderno){
        onez.onEvent({
          token:'page',
          action:'bs.pay:/pay.php?orderno='+res.orderno,
          option:{
            auto_resize:true,
            width:760,
            height:650,
            title:'结算'
          }
        },vue);
        resolve([true,res.orderno]);
      }else{
        onez.alert('未知错误');
        resolve([false,'未知错误']);
      }
    });
  });
};