add.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. <Alert type="warning">除门店简介外其他选项都是必填项</Alert>
  22. <Form-Item>
  23. <Row>
  24. <i-Col span="13">
  25. <span>门店名称:</span>
  26. <i-Input placeholder="门店名称" v-model="form.name" style="width: 80%" 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.introduction" style="width: 80%" type="text"></i-Input>
  35. </i-Col>
  36. </Row>
  37. </Form-Item>
  38. <Form-Item>
  39. <Row>
  40. <i-Col span="13">
  41. <span>门店分类:</span>
  42. <i-Select placeholder="门店分类" v-model="form.cate_id" style="width: 80%" type="text">
  43. {volist name="cate" id="vo"}
  44. <i-option :value="{$vo.id}">{$vo.cate_name}</i-option>
  45. {/volist}
  46. </i-Select>
  47. </i-Col>
  48. </Row>
  49. </Form-Item>
  50. <Form-Item>
  51. <Row>
  52. <i-Col span="13">
  53. <span>门店手机号:</span>
  54. <i-Input placeholder="门店手机号" v-model="form.phone" style="width: 80%" type="text"></i-Input>
  55. </i-Col>
  56. </Row>
  57. </Form-Item>
  58. <Form-Item>
  59. <Row>
  60. <i-Col span="13">
  61. <span>门店地址:</span>
  62. <Cascader :data="addresData" :value.sync="form.address" @on-change="handleChange" style="width: 80%;display: inline-block;"></Cascader>
  63. </i-Col>
  64. </Row>
  65. </Form-Item>
  66. <Form-Item>
  67. <Row>
  68. <i-Col span="13">
  69. <span>详细地址:</span>
  70. <i-Input placeholder="详细地址" v-model="form.detailed_address" style="width: 80%" type="text"></i-Input>
  71. </i-Col>
  72. </Row>
  73. </Form-Item>
  74. <!-- <Form-Item>-->
  75. <!-- <Row>-->
  76. <!-- <i-Col span="13">-->
  77. <!-- <span>核销时效:</span>-->
  78. <!-- <Date-picker type="daterange" @on-change="changeValidTime" placeholder="选择日期" :value="form.valid_time"></Date-picker>-->
  79. <!-- </i-Col>-->
  80. <!-- </Row>-->
  81. <!-- </Form-Item>-->
  82. <Form-Item>
  83. <Row>
  84. <i-Col span="13">
  85. <span>营业时间:</span>
  86. <Time-picker type="timerange" @on-change="changeDayTime" placement="bottom-end" :value="form.day_time" placeholder="选择时间"></Time-picker>
  87. </i-Col>
  88. </Row>
  89. </Form-Item>
  90. <Form-Item>
  91. <Row>
  92. <i-Col span="13">
  93. <span>门店logo:</span>
  94. <div class="demo-upload-list" v-if="form.image">
  95. <template>
  96. <img :src="form.image">
  97. <div class="demo-upload-list-cover">
  98. <Icon type="ios-eye-outline" @click="visible = true "></Icon>
  99. <Icon type="ios-trash-outline" @click="form.image=''"></Icon>
  100. </div>
  101. </template>
  102. </div>
  103. <div class="ivu-upload" style="display: inline-block; width: 58px;" @click="openWindows('选择图片','{:Url('widget.images/index',['fodder'=>'image'])}',{w:900,h:550})" v-if="!form.image">
  104. <div class="ivu-upload ivu-upload-drag">
  105. <div style="width: 58px; height: 58px; line-height: 58px;">
  106. <i class="ivu-icon ivu-icon-camera" style="font-size: 20px;"></i>
  107. </div>
  108. </div>
  109. </div>
  110. <Modal title="查看图片" :visible.sync="visible">
  111. <img :src="form.image" v-if="visible" style="width: 100%">
  112. </Modal>
  113. </i-Col>
  114. </Row>
  115. </Form-Item>
  116. <Form-Item>
  117. <Row>
  118. <i-Col span="13">
  119. <span style="float: left">经纬度:</span>
  120. <Tooltip content="请点击查找位置进行选择位置">
  121. <i-Input placeholder="经纬度" v-model="form.latlng" :readonly="true" style="width: 80%" >
  122. <span slot="append" @click="openWindows('查找位置','{:Url('select_address')}',{w:400,h:700})" style="cursor:pointer">查找位置</span>
  123. </i-Input>
  124. </Tooltip>
  125. </i-Col>
  126. </Row>
  127. </Form-Item>
  128. </template>
  129. <Form-Item>
  130. <Row>
  131. <i-Col span="8" offset="6">
  132. <i-Button type="primary" @click="submit">提交</i-Button>
  133. </i-Col>
  134. </Row>
  135. </Form-Item>
  136. </i-Form>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. <script src="{__PLUG_PATH}city.js"></script>
  143. <script>
  144. var storeData={:json_encode($store)};
  145. mpFrame.start(function(Vue) {
  146. $.each(city,function (key,item) {
  147. city[key].value = item.label;
  148. if(item.children && item.children.length){
  149. $.each(item.children,function (i,v) {
  150. city[key].children[i].value=v.label;
  151. if(v.children && v.children.length){
  152. $.each(v.children,function (k,val) {
  153. city[key].children[i].children[k].value=val.label;
  154. });
  155. }
  156. });
  157. }
  158. });
  159. new Vue({
  160. data:function() {
  161. return {
  162. id:storeData.id || 0,
  163. addresData:city,
  164. form:{
  165. name:storeData.name || '',
  166. introduction:storeData.introduction || '',
  167. phone:storeData.phone || '',
  168. address:storeData.address || [],
  169. image:storeData.image || '',
  170. detailed_address:storeData.detailed_address || '',
  171. latlng:storeData.latlng || '',
  172. valid_time:storeData.valid_time || [],
  173. day_time:storeData.day_time || [],
  174. cate_id:storeData.cate_id || '',
  175. },
  176. visible:false,
  177. }
  178. },
  179. methods:{
  180. changeDayTime:function(date){
  181. this.$set(this.form,'day_time',date);
  182. },
  183. changeValidTime:function(date){
  184. this.$set(this.form,'valid_time',date);
  185. },
  186. createFrame:function(title,src,opt){
  187. opt === undefined && (opt = {});
  188. var h = parent.document.body.clientHeight - 100;
  189. return layer.open({
  190. type: 2,
  191. title:title,
  192. area: [(opt.w || 700)+'px', (opt.h || h)+'px'],
  193. fixed: false, //不固定
  194. maxmin: true,
  195. moveOut:false,//true 可以拖出窗外 false 只能在窗内拖
  196. anim:5,//出场动画 isOutAnim bool 关闭动画
  197. offset:'auto',//['100px','100px'],//'auto',//初始位置 ['100px','100px'] t[ 上 左]
  198. shade:0,//遮罩
  199. resize:true,//是否允许拉伸
  200. content: src,//内容
  201. move:'.layui-layer-title'
  202. });
  203. },
  204. handleChange:function(value,selectedData){
  205. var that = this;
  206. that.form.address = [];
  207. $.each(selectedData,function (key,item) {
  208. that.form.address.push(item.label);
  209. });
  210. that.$set(that.form,'address',that.form.address);
  211. },
  212. openWindows:function(title,url,opt){
  213. return this.createFrame(title,url,opt);
  214. },
  215. changeIMG:function(name,url){
  216. this.form[name]=url;
  217. },
  218. isPhone:function(test){
  219. var reg = /^1[3456789]\d{9}$/;
  220. return reg.test(test);
  221. },
  222. submit:function () {
  223. var that = this;
  224. if(!that.form.name) return $eb.message('error','请填写门店行名称');
  225. if(!that.form.phone) return $eb.message('error','请输入手机号码');
  226. // if(!that.isPhone(that.form.phone)) return $eb.message('error','请输入正确的手机号码');
  227. if(!that.form.address) return $eb.message('error','请选择门店地址');
  228. if(!that.form.detailed_address) return $eb.message('error','请填写门店详细地址');
  229. if(!that.form.image) return $eb.message('error','请选择门店logo');
  230. if(!that.form.valid_time) return $eb.message('error','请选择核销时效');
  231. if(!that.form.day_time) return $eb.message('error','请选择门店营业时间');
  232. if(!that.form.latlng) return $eb.message('error','请选择门店经纬度!');
  233. if(!that.form.cate_id) return $eb.message('error','请选择门店分类');
  234. var index = layer.load(1, {
  235. shade: [0.5,'#fff']
  236. });
  237. $eb.axios.post('{:Url("save")}'+(that.id ? '?id='+that.id : ''),that.form).then(function (res) {
  238. layer.close(index);
  239. layer.msg(res.data.msg);
  240. if(res.data.data.id) that.id=res.data.data.id;
  241. }).catch(function (err) {
  242. console.log(err);
  243. layer.close(index);
  244. })
  245. },
  246. selectAdderss:function (data) {
  247. //lat 纬度 lng 经度
  248. this.form.latlng=data.latlng.lat+','+data.latlng.lng;
  249. }
  250. },
  251. mounted:function () {
  252. window.changeIMG=this.changeIMG;
  253. window.selectAdderss=this.selectAdderss;
  254. }
  255. }).$mount(document.getElementById('store-attr'))
  256. })
  257. </script>