add.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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-Select v-model="form.cid" style="width: 80%" multiple>
  27. <i-Option v-for="item in category" :value="item.id">{{item.cate_name}}</i-Option>
  28. </i-Select>
  29. </i-Col>
  30. </Row>
  31. </Form-Item>
  32. <Form-Item>
  33. <Row>
  34. <i-Col span="13">
  35. <span>门店名称:</span>
  36. <i-Input placeholder="门店名称" v-model="form.name" style="width: 80%"
  37. type="text"></i-Input>
  38. </i-Col>
  39. </Row>
  40. </Form-Item>
  41. <Form-Item>
  42. <Row>
  43. <i-Col span="13">
  44. <span>门店简介:</span>
  45. <i-Input placeholder="门店简介" v-model="form.introduction" style="width: 80%"
  46. type="text"></i-Input>
  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%"
  55. type="text"></i-Input>
  56. </i-Col>
  57. </Row>
  58. </Form-Item>
  59. <Form-Item>
  60. <Row>
  61. <i-Col span="13">
  62. <span>门店地址:</span>
  63. <Cascader :data="addresData" :value.sync="form.address"
  64. @on-change="handleChange"
  65. style="width: 80%;display: inline-block;"></Cascader>
  66. </i-Col>
  67. </Row>
  68. </Form-Item>
  69. <Form-Item>
  70. <Row>
  71. <i-Col span="13">
  72. <span>详细地址:</span>
  73. <i-Input placeholder="详细地址" v-model="form.detailed_address" style="width: 80%"
  74. type="text"></i-Input>
  75. </i-Col>
  76. </Row>
  77. </Form-Item>
  78. <!-- <Form-Item>-->
  79. <!-- <Row>-->
  80. <!-- <i-Col span="13">-->
  81. <!-- <span>核销时效:</span>-->
  82. <!-- <Date-picker type="daterange" @on-change="changeValidTime" placeholder="选择日期" :value="form.valid_time"></Date-picker>-->
  83. <!-- </i-Col>-->
  84. <!-- </Row>-->
  85. <!-- </Form-Item>-->
  86. <Form-Item>
  87. <Row>
  88. <i-Col span="13">
  89. <span>营业时间:</span>
  90. <Time-picker type="timerange" @on-change="changeDayTime" placement="bottom-end"
  91. :value="form.day_time" placeholder="选择时间"></Time-picker>
  92. </i-Col>
  93. </Row>
  94. </Form-Item>
  95. <Form-Item>
  96. <Row>
  97. <i-Col span="13">
  98. <span>门店logo:</span>
  99. <div class="demo-upload-list" v-if="form.image">
  100. <template>
  101. <img :src="form.image">
  102. <div class="demo-upload-list-cover">
  103. <Icon type="ios-eye-outline" @click="visible = true "></Icon>
  104. <Icon type="ios-trash-outline" @click="form.image=''"></Icon>
  105. </div>
  106. </template>
  107. </div>
  108. <div class="ivu-upload" style="display: inline-block; width: 58px;"
  109. @click="openWindows('选择图片','{:Url('widget.images/index',['fodder'=>'image'])}',{w:900,h:550})"
  110. v-if="!form.image">
  111. <div class="ivu-upload ivu-upload-drag">
  112. <div style="width: 58px; height: 58px; line-height: 58px;">
  113. <i class="ivu-icon ivu-icon-camera" style="font-size: 20px;"></i>
  114. </div>
  115. </div>
  116. </div>
  117. <div style="width: 670px; height: 320px;bottom:10%;display: block; position: absolute;z-index: 999999"
  118. v-if="visible" @click="visible = false ">
  119. <img :src="form.image"
  120. style="max-width: 100%;max-height: 100%;width:auto;height:auto;position: absolute;left: 50%;top: 50%;transform: translate3d(-50%,-50%,0);-webkit-transform: translate3d(-50%,-50%,0);">
  121. </div>
  122. </i-Col>
  123. </Row>
  124. </Form-Item>
  125. <Form-Item>
  126. <Row>
  127. <i-Col span="13">
  128. <span style="float: left">经纬度:</span>
  129. <Tooltip content="请点击查找位置进行选择位置">
  130. <i-Input placeholder="经纬度" v-model="form.latlng" :readonly="true"
  131. style="width: 80%">
  132. <span slot="append"
  133. @click="openWindows('查找位置','{:Url('select_address')}',{w:400,h:700})"
  134. style="cursor:pointer">查找位置</span>
  135. </i-Input>
  136. </Tooltip>
  137. </i-Col>
  138. </Row>
  139. </Form-Item>
  140. <Form-Item>
  141. <Row>
  142. <i-Col span="13">
  143. <span>终端号:</span>
  144. <i-Input placeholder="终端号" v-model="form.terminal_number" style="width: 80%"
  145. 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 placeholder="店长用户编号" v-model="form.uid" style="width: 80%"
  154. type="text"></i-Input>
  155. </i-Col>
  156. </Row>
  157. </Form-Item>
  158. <Form-Item>
  159. <Row>
  160. <i-Col span="13">
  161. <span>第三方门店:</span>
  162. <i-Select v-model="form.is_triple" style="width: 80%">
  163. <i-Option value="1">是</i-Option>
  164. <i-Option value="0">否</i-Option>
  165. </i-Select>
  166. </i-Col>
  167. </Row>
  168. </Form-Item>
  169. <Form-Item>
  170. <Row>
  171. <i-Col span="13">
  172. <span>推荐奖:</span>
  173. <i-Input placeholder="%" v-model="form.recommend" style="width: 80%"
  174. type="text"></i-Input>
  175. </i-Col>
  176. </Row>
  177. </Form-Item>
  178. <Form-Item>
  179. <Row>
  180. <i-Col span="13">
  181. <span>订单手续费:</span>
  182. <i-Input placeholder="%" v-model="form.commission_order" style="width: 80%"
  183. type="text"></i-Input>
  184. </i-Col>
  185. </Row>
  186. </Form-Item> <Form-Item>
  187. <Row>
  188. <i-Col span="13">
  189. <span>提现手续费:</span>
  190. <i-Input placeholder="%" v-model="form.commission" style="width: 80%"
  191. type="text"></i-Input>
  192. </i-Col>
  193. </Row>
  194. </Form-Item>
  195. <Form-Item>
  196. <Row>
  197. <i-Col span="13">
  198. <span>推荐用户:</span>
  199. <i-Select v-model="form.spread_uid" style="width: 80%">
  200. <i-Option v-for="item in userData" :value="item.uid">{{item.nickname}}({{item.phone}})</i-Option>
  201. </i-Select>
  202. </i-Col>
  203. </Row>
  204. </Form-Item>
  205. </template>
  206. <Form-Item>
  207. <Row>
  208. <i-Col span="8" offset="6">
  209. <i-Button type="primary" @click="submit">提交</i-Button>
  210. </i-Col>
  211. </Row>
  212. </Form-Item>
  213. </i-Form>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. <script src="{__PLUG_PATH}city.js"></script>
  220. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  221. <script>
  222. var storeData = {:json_encode($store)};
  223. var userData = {:json_encode($users)};
  224. var category = {:json_encode($category)};
  225. mpFrame.start(function (Vue) {
  226. $.each(city, function (key, item) {
  227. city[key].value = item.label;
  228. if (item.children && item.children.length) {
  229. $.each(item.children, function (i, v) {
  230. city[key].children[i].value = v.label;
  231. if (v.children && v.children.length) {
  232. $.each(v.children, function (k, val) {
  233. city[key].children[i].children[k].value = val.label;
  234. });
  235. }
  236. });
  237. }
  238. });
  239. new Vue({
  240. data: function () {
  241. return {
  242. id: storeData.id || 0,
  243. addresData: city,
  244. form: {
  245. name: storeData.name || '',
  246. introduction: storeData.introduction || '',
  247. phone: storeData.phone || '',
  248. address: storeData.address || [],
  249. image: storeData.image || '',
  250. detailed_address: storeData.detailed_address || '',
  251. latlng: storeData.latlng || '',
  252. valid_time: storeData.valid_time || [],
  253. day_time: storeData.day_time || [],
  254. cid: storeData.cid || [],
  255. terminal_number: storeData.terminal_number || '',
  256. uid: storeData.uid || 0,
  257. commission: storeData.commission || 0,
  258. commission_order: storeData.commission_order || 0,
  259. recommend: storeData.recommend || 0,
  260. spread_uid: storeData.spread_uid || 0,
  261. is_triple: storeData.is_triple || "0",
  262. },
  263. visible: false,
  264. }
  265. },
  266. methods: {
  267. changeModel(newval) {
  268. console.log(newval);
  269. },
  270. changeDayTime: function (date) {
  271. this.$set(this.form, 'day_time', date);
  272. },
  273. changeValidTime: function (date) {
  274. this.$set(this.form, 'valid_time', date);
  275. },
  276. createFrame: function (title, src, opt) {
  277. opt === undefined && (opt = {});
  278. var h = parent.document.body.clientHeight - 100;
  279. return layer.open({
  280. type: 2,
  281. title: title,
  282. area: [(opt.w || 700) + 'px', (opt.h || h) + 'px'],
  283. fixed: false, //不固定
  284. maxmin: true,
  285. moveOut: false,//true 可以拖出窗外 false 只能在窗内拖
  286. anim: 5,//出场动画 isOutAnim bool 关闭动画
  287. offset: 'auto',//['100px','100px'],//'auto',//初始位置 ['100px','100px'] t[ 上 左]
  288. shade: 0,//遮罩
  289. resize: true,//是否允许拉伸
  290. content: src,//内容
  291. move: '.layui-layer-title'
  292. });
  293. },
  294. handleChange: function (value, selectedData) {
  295. var that = this;
  296. that.form.address = [];
  297. $.each(selectedData, function (key, item) {
  298. that.form.address.push(item.label);
  299. });
  300. that.$set(that.form, 'address', that.form.address);
  301. },
  302. openWindows: function (title, url, opt) {
  303. return this.createFrame(title, url, opt);
  304. },
  305. changeIMG: function (name, url) {
  306. this.form[name] = url;
  307. },
  308. isPhone: function (test) {
  309. var reg = /^1[3456789]\d{9}$/;
  310. return reg.test(test);
  311. },
  312. submit: function () {
  313. var that = this;
  314. console.log(that.from)
  315. if (!that.from.cid) return $eb.message('error', '请选择门店分类');
  316. if (!that.form.name) return $eb.message('error', '请填写门店行名称');
  317. if (!that.form.phone) return $eb.message('error', '请输入手机号码');
  318. if (!that.isPhone(that.form.phone)) return $eb.message('error', '请输入正确的手机号码');
  319. if (!that.form.address) return $eb.message('error', '请选择门店地址');
  320. if (!that.form.detailed_address) return $eb.message('error', '请填写门店详细地址');
  321. if (!that.form.image) return $eb.message('error', '请选择门店logo');
  322. if (!that.form.valid_time) return $eb.message('error', '请选择核销时效');
  323. if (!that.form.day_time) return $eb.message('error', '请选择门店营业时间');
  324. if (!that.form.latlng) return $eb.message('error', '请选择门店经纬度!');
  325. var index = layer.load(1, {
  326. shade: [0.5, '#fff']
  327. });
  328. $eb.axios.post('{:Url("save")}' + (that.id ? '?id=' + that.id : ''), that.form).then(function (res) {
  329. layer.close(index);
  330. layer.msg(res.data.msg);
  331. if (res.data.data.id) that.id = res.data.data.id;
  332. }).catch(function (err) {
  333. console.log(err);
  334. layer.close(index);
  335. })
  336. },
  337. selectAdderss: function (data) {
  338. //lat 纬度 lng 经度
  339. this.form.latlng = data.latlng.lat + ',' + data.latlng.lng;
  340. }
  341. },
  342. mounted: function () {
  343. window.changeIMG = this.changeIMG;
  344. window.selectAdderss = this.selectAdderss;
  345. }
  346. }).$mount(document.getElementById('store-attr'))
  347. })
  348. </script>