{
  template: '${tmpl}',
    data: function() {
      return {
        phoneNum: null,
        demand: null,
        city: null,
      }
    },
  mounted: function() {
    $('.mobilesubmitdemand input').on('blur', () => {
      window.scroll(0, 0);
    });
  },
  created: function() {

  },
  watch: {
    phoneNum(n){
      if (n.length > 11) {
        this.phoneNum = this.phoneNum.slice(0, 11);
      }
    }
  },
  methods: {
    subDemand(){
      let reg = /0?(13|14|15|17|18|19)[0-9]{9}/;

      /** */
      if (reg.test(this.phoneNum)) {
        let obj = {};
        obj.publisherMobile = this.phoneNum;
        obj.city = this.city;
        obj.publisherName = "h5提交需求";
        obj.servicecode = this.$route.query.servicecode;
        obj.company_id = "4";
        this.$root.postReq("/web/needCtl/submitneed", obj).then((res) => {
          console.log(res);
          this.$alert('提交成功', '提示', {
            confirmButtonText: '确定',
            callback: action => {
              /**跳转到.... */
              this.$router.push({ path: "mobileservicetype" });
            }
          });
        })
      } else {
        console.log(this);
        this.$alert('请输入正确的手机号码', '提示', {
          confirmButtonText: '确定',
          callback: action => {

          }
        });
      }


    }
    /*
        "publisherName": publisherName,
        "publisherMobile": publisherMobile,
        "city": city ?? "",
        "notes": notes ?? "",
        "servicecode": servicecode,
        "company_id": company_id,
    */
  },
  vname: "gsb-mobilesubmitdemand"
}
