new_edit_shop.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. {extend name="public/layout" /} {block name="title"}添加企业{/block} {block name="body"}
  2. <link rel="stylesheet" href="__STATIC__/css/index.css">
  3. <style type="text/css">
  4. html {
  5. background: #fff;
  6. }
  7. body {
  8. min-width: 320px;
  9. }
  10. @media screen and (max-width: 450px) {
  11. .layui-form-item {
  12. width: 100%;
  13. }
  14. }
  15. #add-company-shop {
  16. width: 400px;
  17. }
  18. #add-company-shop .layui-form-label {
  19. width: 80px;
  20. }
  21. #add-company-shop .layui-input-inline {
  22. width: 230px;
  23. }
  24. #add-company-shop .layui-form-select dl {
  25. max-height: 120px;
  26. }
  27. .arrimg {
  28. width: 12px;
  29. }
  30. .arrinput {
  31. width: 100%;
  32. height: 36px;
  33. border: 1px solid #d2d2d2;
  34. display: flex;
  35. align-items: center;
  36. border-radius: 2px;
  37. }
  38. .arrinput>input {
  39. width: 90%;
  40. height: 100%;
  41. box-sizing: border-box;
  42. padding-left: 10px;
  43. border: none;
  44. outline: none;
  45. }
  46. .arrinput>div {
  47. width: 90%;
  48. box-sizing: border-box;
  49. padding-left: 10px;
  50. }
  51. </style>
  52. <body>
  53. <div id="edit-company-shop">
  54. <form class="layui-form" id="edit-company-shop-form" enctype="multipart/form-data" style="margin: 20px 10px;">
  55. <div class="layui-form-item">
  56. <label class="layui-form-label">店面名称</label>
  57. <div class="layui-input-inline">
  58. <input type="text" name="company_name" value="{$data.company_name}" placeholder="请输入店面名称" autocomplete="off" class="layui-input"
  59. style="max-width: 500px;">
  60. </div>
  61. </div>
  62. <div class="layui-form-item">
  63. <label class="layui-form-label">店面电话</label>
  64. <div class="layui-input-inline">
  65. <input type="text" name="tel" value="{$data.tel}" placeholder="请输入店面电话" autocomplete="off" class="layui-input"
  66. style="max-width: 500px;">
  67. </div>
  68. </div>
  69. <div class="layui-form-item">
  70. <label class="layui-form-label">负责人姓名</label>
  71. <div class="layui-input-inline">
  72. <input type="text" name="leader_name" value="{$data.leader_name}" placeholder="请输入负责人姓名" autocomplete="off" class="layui-input"
  73. style="max-width: 500px;">
  74. </div>
  75. </div>
  76. <div class="layui-form-item">
  77. <label class="layui-form-label">初始账号</label>
  78. <div class="layui-input-inline">
  79. <input type="text" name="phone" id="phone" value="{$data.phone}" placeholder="请输入初始账号(手机号)" autocomplete="off"
  80. class="layui-input" style="max-width: 500px;">
  81. </div>
  82. </div>
  83. <div class="layui-form-item">
  84. <label class="layui-form-label">所属地域</label>
  85. <div class="layui-input-inline">
  86. <div class="arrinput" @click="toSelect">
  87. <div>{{city||"{$data.province_city}"}}</div>
  88. <img class="arrimg" :src="img" />
  89. </div>
  90. <input type="hidden" id="addressEle" name="province_city" value="{$data.province_city}">
  91. <input type="hidden" id="addressCode" name="province_city_code" value="{$data.province_city_code}">
  92. <input type="hidden" id="provinceEl" name="province" value="{$data.province}">
  93. <input type="hidden" id="cityElement" name="city" value="{$data.city}">
  94. </div>
  95. </div>
  96. <div class="layui-form-item">
  97. <label class="layui-form-label">店面品牌</label>
  98. <div class="layui-input-inline">
  99. <select name="company_brand" id="edit-shop-branch">
  100. <option value="">请选择品牌</option>
  101. </select>
  102. </div>
  103. </div>
  104. <div class="layui-form-item">
  105. <label class="layui-form-label">到期时间</label>
  106. <div class="layui-input-inline">
  107. <input type="text" id="shop_end_dates" value="{$data.end_date}" name="end_date" placeholder="店面到期时间" autocomplete="off" class="layui-input"
  108. style="max-width: 500px;">
  109. </div>
  110. </div>
  111. <div class="layui-form-item">
  112. <label class="layui-form-label">小程序</label>
  113. <div class="layui-input-inline">
  114. <select name="mini">
  115. {volist name="miniprogram" id="mini"}
  116. <option value="{$mini.id}" {if condition="$data.mini eq $mini.id"}selected{/if}>{$mini.type}</option>
  117. {/volist}
  118. </select>
  119. </div>
  120. </div>
  121. <div class="layui-form-item">
  122. <input type="hidden" name="id" value="{$id}" />
  123. <input type="hidden" name="company_group" value="{$company_id}" />
  124. <input style="margin-left: 110px;" type="button" class="layui-btn" lay-submit lay-filter="edit-shop-submit" id="edit-shop-submit" value="保存">
  125. </div>
  126. </form>
  127. <van-popup v-model="show" position="bottom" :style="{ height: '60%' }">
  128. <van-area :area-list="areaList" @confirm="confirmFn" @cancel="cancelFn"
  129. :columns-placeholder="['请选择', '请选择', '请选择']" title="标题" />
  130. </van-popup>
  131. </div>
  132. </body>
  133. {/block} {block name="js"}
  134. <script src="__STATIC__/js/city_vue.js"></script>
  135. <script src="__STATIC__/js/city_vant.min.js"></script>
  136. <script src="__STATIC__/js/city_area.js"></script>
  137. <script>
  138. new Vue({
  139. el: "#edit-company-shop",
  140. data: {
  141. show: false,
  142. msg: "",
  143. colNum: "3", //省市区显示列数,3-省市区,2-省市,1-省
  144. city: "",
  145. areaList: are,
  146. img: "https://sucai.suoluomei.cn/sucai_zs/images/20191204103033-xiala.png"
  147. },
  148. mounted() {},
  149. methods: {
  150. toSelect() {
  151. this.show = true;
  152. },
  153. confirmFn(are) {
  154. that = this
  155. that.show = false;
  156. let arr, SelectProvinceName, SelectCityName, SelectCountyName, ko;
  157. arr = are;
  158. //判断是否都选择
  159. if (arr[0].name == "" || arr[1].name == "" || arr[2].name == "") {
  160. that.$dialog.alert({
  161. title: "提示", //加上标题
  162. message: "请选择完整的地址", //改变弹出框的内容
  163. showCancelButton: false //展示取消按钮
  164. })
  165. .then(() => { //点击确认按钮后的调用
  166. console.log("点击了确认按钮噢")
  167. })
  168. } else {
  169. SelectProvinceName = arr[0].name; // 省
  170. SelectCityName = arr[1].name; // 市
  171. SelectCountyName = arr[2].name; // 区
  172. ko = " ";//空格
  173. that.$emit("ProCityCountyVal", [
  174. SelectProvinceName, //选择的省
  175. SelectCityName, //选择的市
  176. SelectCountyName //选择的区
  177. ]);
  178. that.city = `${SelectProvinceName}/${SelectCityName}/${SelectCountyName}`;//将选择的值赋值给city以显示在页面中
  179. that.addressinfo = that.city;
  180. that.isActive = true;
  181. that.address = arr;
  182. document.querySelector('#addressEle').value = that.city;
  183. document.querySelector('#addressCode').value = that.address[2].code;
  184. document.querySelector('#provinceEl').value = SelectProvinceName;
  185. document.querySelector('#cityElement').value = SelectCityName;
  186. }
  187. },
  188. cancelFn() {
  189. this.show = false;
  190. console.log("点击了取消按钮");
  191. }
  192. },
  193. created() {
  194. }
  195. })
  196. layui.config({
  197. base: '__LAYUI__/',
  198. urlbase: '/adminall'
  199. }).extend({
  200. index: 'lib/index' //主入口模块
  201. }).use(['index', 'form', 'upload', 'layedit', 'laydate'], function () {
  202. var form = layui.form,
  203. layedit = layui.layedit,
  204. laydate = layui.laydate,
  205. $ = layui.jquery;
  206. laydate.render({
  207. elem: '#shop_end_dates'
  208. , type: 'date'
  209. });
  210. form.render();
  211. // 店面管理
  212. function companyBrandList(id, domid, def = 0) {
  213. $.get('{:url("company/brand")}?id=' + id, function (res) {
  214. if (res.code > 0) layer.msg(res.msg, {
  215. anim: 0
  216. , time: 2000
  217. });
  218. else {
  219. let selectDom = $(domid);
  220. selectDom.html('<option value="">请选择品牌</option>');
  221. res.data.forEach(element => {
  222. if (element.id == def)
  223. selectDom.append("<option value='" + element.id + "' selected>" + element.brand_name + "</option>");
  224. else
  225. selectDom.append("<option value='" + element.id + "'>" + element.brand_name + "</option>");
  226. });
  227. form.render('select');
  228. }
  229. });
  230. }
  231. companyBrandList("{$company_id}", '#edit-shop-branch', "{$data.company_brand}");
  232. /* 监听提交 */
  233. form.on('submit(edit-shop-submit)', function (obj) {
  234. var index = parent.layer.getFrameIndex(window.name);
  235. let load = layer.load(0, { shade: 0.3 });
  236. let url = '{:url("company/editShop")}';
  237. $.post(url, obj.field, function (res) {
  238. if (res.code === 0) {
  239. layer.msg(res.msg, {
  240. anim: 0
  241. , time: 2000
  242. }, function () {
  243. parent.layer.close(index);
  244. layer.close(load);
  245. });
  246. } else {
  247. layer.msg(res.msg, {
  248. anim: 6
  249. , time: 2000
  250. });
  251. layer.close(load);
  252. }
  253. });
  254. return false;
  255. });
  256. //日期
  257. laydate.render({
  258. elem: '#end_date'
  259. });
  260. });
  261. </script>
  262. {/block}