Blame view

Antis.Erp.Plat/sy/from.html 7.43 KB
f946e9dd   hexiaodong   hhh
1
  <!DOCTYPE html>

ec04c7b4   “wangming”   123
2
  <html lang="zh-CN" class="pos-app-root pos-html--embed-fill">

f946e9dd   hexiaodong   hhh
3
4
5
  

  <head>

      <meta charset="UTF-8">

ec04c7b4   “wangming”   123
6
      <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, maximum-scale=5">

39999bd8   “wangming”   feat(erp-plat): 单...
7
8
9
      <title>新增会员</title>

      <link rel="stylesheet" href="css/style.css">

      <link rel="stylesheet" href="css/pos-unified.css">

f946e9dd   hexiaodong   hhh
10
11
12
13
      <script src="./js/vue.min.js"></script>

      <script src="./axios-1.x/axios-1.x/dist/axios.js"></script>

      <script src="./axios-1.x/axios-1.x/dist/axios.min.js"></script>

      <script type="text/javascript" src="./js/jquery.min.js"></script>

f946e9dd   hexiaodong   hhh
14
15
  </head>

  

39999bd8   “wangming”   feat(erp-plat): 单...
16
17
18
  <body class="pos-page pos-page--embed">

      <div id="app" class="pos-embed-app">

          <form class="pos-embed-form" action="#" method="post" @submit.prevent>

ec04c7b4   “wangming”   123
19
20
21
22
23
24
              <header class="pos-embed-head">

                  <div class="pos-embed-head__text">

                      <h1 class="pos-embed-title">新建会员</h1>

                      <p class="pos-embed-sub"><span class="pos-embed-req" aria-hidden="true">*</span> 为必填;保存后可在收银中自动选中</p>

                  </div>

                  <button type="button" class="pos-embed-close" @click="close" aria-label="关闭">&times;</button>

39999bd8   “wangming”   feat(erp-plat): 单...
25
26
27
28
29
30
31
32
33
              </header>

  

              <div class="pos-embed-body">

                  <section class="pos-embed-section" aria-labelledby="embed-sec-basic">

                      <h2 id="embed-sec-basic" class="pos-embed-section__title">基本信息</h2>

                      <div class="pos-embed-field">

                          <label class="pos-embed-label" for="xm">姓名 <span class="pos-embed-req">*</span></label>

                          <input

                              id="xm"

ec04c7b4   “wangming”   123
34
                              class="pos-input"

39999bd8   “wangming”   feat(erp-plat): 单...
35
36
37
38
39
40
41
42
43
44
                              type="text"

                              v-model="from.xm"

                              placeholder="请输入会员姓名"

                              autocomplete="name"

                          >

                      </div>

                      <div class="pos-embed-field">

                          <label class="pos-embed-label" for="sjh">手机号码 <span class="pos-embed-req">*</span></label>

                          <input

                              id="sjh"

ec04c7b4   “wangming”   123
45
                              class="pos-input"

39999bd8   “wangming”   feat(erp-plat): 单...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
                              type="tel"

                              inputmode="numeric"

                              maxlength="11"

                              v-model="from.sjh"

                              placeholder="11 位手机号"

                              autocomplete="tel"

                          >

                      </div>

                  </section>

  

                  <section class="pos-embed-section pos-embed-section--optional" aria-labelledby="embed-sec-extra">

                      <h2 id="embed-sec-extra" class="pos-embed-section__title">选填信息</h2>

                      <div class="pos-embed-field">

                          <label class="pos-embed-label" for="xb">性别</label>

ec04c7b4   “wangming”   123
60
                          <select id="xb" class="pos-select pos-embed-select" v-model="from.xb">

39999bd8   “wangming”   feat(erp-plat): 单...
61
62
63
64
65
66
67
                              <option value="">请选择</option>

                              <option value="男"></option>

                              <option value="女"></option>

                          </select>

                      </div>

                      <div class="pos-embed-field">

                          <label class="pos-embed-label" for="qd">渠道</label>

ec04c7b4   “wangming”   123
68
                          <input id="qd" class="pos-input" type="text" v-model="from.qd" placeholder="如:门店、线上等">

39999bd8   “wangming”   feat(erp-plat): 单...
69
70
71
                      </div>

                      <div class="pos-embed-field">

                          <label class="pos-embed-label" for="hm">号码</label>

ec04c7b4   “wangming”   123
72
                          <input id="hm" class="pos-input" type="text" v-model="from.hm" placeholder="备用号码或其他编号">

39999bd8   “wangming”   feat(erp-plat): 单...
73
74
75
76
                      </div>

                  </section>

              </div>

  

ec04c7b4   “wangming”   123
77
78
79
80
              <footer class="pos-embed-foot">

                  <div class="pos-embed-foot__actions">

                      <button type="button" class="pos-embed-foot-btn pos-embed-foot-btn--ghost" @click="close">取消</button>

                      <button type="button" class="pos-embed-foot-btn pos-embed-foot-btn--primary" @click="submit">保存会员</button>

39999bd8   “wangming”   feat(erp-plat): 单...
81
82
                  </div>

              </footer>

f946e9dd   hexiaodong   hhh
83
84
85
86
87
88
89
90
91
92
          </form>

      </div>

  

      <script>

          var app = new Vue({

              el: '#app',

              data: {

                  baseUrl: (() => {

                    const currentOrigin = window.location.origin;

                    if (currentOrigin.includes('localhost') || currentOrigin.includes('127.0.0.1')) {

39999bd8   “wangming”   feat(erp-plat): 单...
93
                      return 'http://localhost:2011';

f946e9dd   hexiaodong   hhh
94
95
96
97
98
                    } else {

                      return currentOrigin.replace(/:\d+$/, '');

                    }

                  })(),

                  from: {

f946e9dd   hexiaodong   hhh
99
                      "sjh": "",

f946e9dd   hexiaodong   hhh
100
                      "xm": "",

f946e9dd   hexiaodong   hhh
101
                      "xb": "",

f946e9dd   hexiaodong   hhh
102
                      "qd": "",

f946e9dd   hexiaodong   hhh
103
                      "dgy": "",

f946e9dd   hexiaodong   hhh
104
                      "wldwmc": "",

f946e9dd   hexiaodong   hhh
105
                      "hm": "",

f946e9dd   hexiaodong   hhh
106
                      "skzh": "",

f946e9dd   hexiaodong   hhh
107
108
109
110
                      "shdz": ""

                  }

              },

              mounted() {

f946e9dd   hexiaodong   hhh
111
112
113
                  this.resetForm();

              },

              methods: {

f946e9dd   hexiaodong   hhh
114
115
116
117
118
119
120
121
122
123
124
125
126
127
                  resetForm() {

                      this.from = {

                          sjh: "",

                          xm: "",

                          xb: "",

                          qd: "",

                          dgy: "",

                          wldwmc: "",

                          hm: "",

                          skzh: "",

                          shdz: ""

                      };

                  },

                  close() {

f946e9dd   hexiaodong   hhh
128
129
130
131
132
                      this.resetForm();

                      window.parent.postMessage({ type: 'formSubmittedclose', data: this.from }, '*');

                  },

                  submit() {

                      var that = this

f946e9dd   hexiaodong   hhh
133
134
135
136
                      if (!that.from.xm || !that.from.sjh) {

                          window.alert('请填写姓名和手机号码');

                          return;

                      }

f946e9dd   hexiaodong   hhh
137
138
139
140
141
                      var phoneRegex = /^1[3-9]\d{9}$/;

                      if (!phoneRegex.test(that.from.sjh)) {

                          window.alert('请输入正确的手机号码格式');

                          return;

                      }

f946e9dd   hexiaodong   hhh
142
143
144
145
146
147
148
149
                      axios({

                          url: that.baseUrl + "/api/Extend/wthy",

                          method: 'POST',

                          headers: {

                              Authorization: localStorage.getItem('token')

                          },

                          data:this.from

                      }).then((res) => {

f946e9dd   hexiaodong   hhh
150
                          if (res.data && res.data.code == 200) {

f946e9dd   hexiaodong   hhh
151
                              window.alert('添加成功');

f946e9dd   hexiaodong   hhh
152
                              window.parent.postMessage({ type: 'formSubmitted', data: this.from }, '*');

f946e9dd   hexiaodong   hhh
153
154
                              this.resetForm();

                          } else {

39999bd8   “wangming”   feat(erp-plat): 单...
155
156
                              var errorMsg = (res.data && res.data.msg) ? res.data.msg : '添加失败';

                              window.alert(errorMsg);

f946e9dd   hexiaodong   hhh
157
                          }

39999bd8   “wangming”   feat(erp-plat): 单...
158
159
160
161
                      }).catch((err) => {

                          console.error(err);

                          window.alert('网络错误,请重试');

                      });

f946e9dd   hexiaodong   hhh
162
163
                  }

              }

39999bd8   “wangming”   feat(erp-plat): 单...
164
          });

f946e9dd   hexiaodong   hhh
165
166
      </script>

  </body>

39999bd8   “wangming”   feat(erp-plat): 单...
167
  </html>