add_sender.php 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. {include file="public/head"}
  5. <link href="/system/frame/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
  6. <link href="/system/frame/css/style.min.css?v=3.0.0" rel="stylesheet">
  7. <title>{$title|default=''}</title>
  8. <style></style>
  9. </head>
  10. <body>
  11. <div class="wrapper wrapper-content">
  12. <div class="row">
  13. <div class="col-sm-12">
  14. <div class="ibox float-e-margins">
  15. <div class="ibox-title">
  16. <h5>配送员设置</h5>
  17. </div>
  18. <div id="store-attr" class="mp-form" v-cloak="">
  19. <i-Form :label-width="80" style="width: 100%">
  20. <template>
  21. <Form-Item>
  22. <Row>
  23. <i-Col span="13">
  24. <span>配送员姓名:</span>
  25. <i-Input placeholder="配送员姓名" v-model="form.name" style="width: 80%"
  26. type="text"></i-Input>
  27. </i-Col>
  28. </Row>
  29. </Form-Item>
  30. <Form-Item>
  31. <Row>
  32. <i-Col span="13">
  33. <span>配送员手机号:</span>
  34. <i-Input placeholder="配送员手机号" v-model="form.phone" style="width: 80%"
  35. type="text"></i-Input>
  36. </i-Col>
  37. </Row>
  38. </Form-Item>
  39. </template>
  40. <Form-Item>
  41. <Row>
  42. <i-Col span="8" offset="6">
  43. <i-Button type="primary" @click="submit">提交</i-Button>
  44. </i-Col>
  45. </Row>
  46. </Form-Item>
  47. </i-Form>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <script src="{__PLUG_PATH}city.js"></script>
  54. <script>
  55. var storeData = {:json_encode($store)};
  56. var store_id = {$store_id};
  57. mpFrame.start(function (Vue) {
  58. new Vue({
  59. data: function () {
  60. return {
  61. id: storeData.id || 0,
  62. form: {
  63. name: storeData.name || '',
  64. phone: storeData.phone || '',
  65. store_id: store_id,
  66. },
  67. visible: false,
  68. }
  69. },
  70. methods: {
  71. isPhone: function (test) {
  72. var reg = /^1[3456789]\d{9}$/;
  73. return reg.test(test);
  74. },
  75. submit: function () {
  76. var that = this;
  77. if (!that.form.name) return $eb.message('error', '请填写名称');
  78. if (!that.form.phone) return $eb.message('error', '请输入手机号码');
  79. if (!that.isPhone(that.form.phone)) return $eb.message('error', '请输入正确的手机号码');
  80. if (!that.form.store_id) return $eb.message('error', '请选择所属门店!');
  81. var index = layer.load(1, {
  82. shade: [0.5, '#fff']
  83. });
  84. $eb.axios.post('{:Url("save_sender")}' + (that.id ? '?id=' + that.id : ''), that.form).then(function (res) {
  85. layer.close(index);
  86. layer.msg(res.data.msg);
  87. if (res.data.data.id) that.id = res.data.data.id;
  88. }).catch(function (err) {
  89. console.log(err);
  90. layer.close(index);
  91. })
  92. },
  93. },
  94. }).$mount(document.getElementById('store-attr'))
  95. })
  96. </script>