Skip to content

Commit a538fef

Browse files
committed
允许填写接受发票的邮箱
1 parent 68a2c7f commit a538fef

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

www/cart/order.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,10 @@ <h3>填写公司信息</h3>
457457
<input type="text" class="form-control" value="未填写" name="post_code"/>
458458
<p class="help-block"></p>
459459
</div>
460-
<div class="form-group" style="display: none">
461-
<label for="post_address">详细地址</label>
462-
<input type="text" class="form-control" value="未填写" name="post_address"/>
463-
<p class="help-block"></p>
460+
<div class="form-group">
461+
<label for="post_address">接受发票的邮箱地址</label>
462+
<input type="text" class="form-control" value="*" name="post_address"/>
463+
<p class="help-block">如果不填写则发送到订单的注册邮箱,仅当需要发送到其它邮箱时候填写</p>
464464
</div>
465465
</form>
466466
</div>

www/cart/order.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,14 @@ function submitInvoice() {
390390
element.focus();
391391
return false;
392392
}
393+
394+
if ( name === 'post_address' && element.value.length > 4) {
395+
var emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
396+
if ( ! emailPattern.test( element.value ) ) {
397+
element.focus();
398+
return false;
399+
}
400+
}
393401
}
394402

395403
var url = server_url + '/product/invoices/' + (invoice_id ? invoice_id + '/' : '');

0 commit comments

Comments
 (0)