add.php 16 KB

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