add_store.blade.php 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900
  1. @extends('layouts.base')
  2. @section('title', trans('Yunshop\StoreCashier::pack.store_detail'))
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/store-cashier/src/common/static/index.css')}}">
  5. <!-- <script src="{{resource_get('app/common/components/ueditor/dialogs/map/getscript.js?v=1.1&ak=&services=true&t=20130716024058')}}"></script> -->
  6. <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=QXSZyPZk26shrYzAXjTkDLx5LbRCHECz"></script>
  7. <!-- app\common\components\ueditor\dialogs\map\getscript.js -->
  8. <div class="all">
  9. <div id="app" v-cloak>
  10. <div class="vue-crumbs">
  11. <a @click="goParent(1)">门店-收银台</a>
  12. >
  13. <a @click="goParent(2)">门店管理</a>
  14. > [[id?'编辑':'添加']]门店
  15. </div>
  16. <el-form ref="form" :model="form" :rules="rules" label-width="15%">
  17. <div class="vue-main">
  18. <div class="vue-main-title">
  19. <div class="vue-main-title-left"></div>
  20. <div class="vue-main-title-content">门店基本信息</div>
  21. </div>
  22. <div class="vue-main-form">
  23. <el-form-item label="门店名称" prop="store_name">
  24. <el-input v-model="form.store_name" style="width:70%;"></el-input>
  25. </el-form-item>
  26. <el-form-item label="门店LOGO" prop="thumb">
  27. <div class="upload-box" @click="openUpload('thumb')" v-if="!form.thumb_url">
  28. <i class="el-icon-plus" style="font-size:32px"></i>
  29. </div>
  30. <div @click="openUpload('thumb')" class="upload-boxed" v-if="form.thumb_url">
  31. <img :src="form.thumb_url" alt="" style="width:150px;height:150px;border-radius: 5px;cursor: pointer;">
  32. <div class="upload-boxed-text">点击重新上传</div>
  33. </div>
  34. <div class="tip">提示: 100*100px或正方型图片</div>
  35. </el-form-item>
  36. <el-form-item label="门店banner图" prop="banner_thumb">
  37. <div class="upload-box" @click="openUpload('banner_thumb')" v-if="!form.banner_thumb_url">
  38. <i class="el-icon-plus" style="font-size:32px"></i>
  39. </div>
  40. <div @click="openUpload('banner_thumb')" class="upload-boxed" v-if="form.banner_thumb_url">
  41. <img :src="form.banner_thumb_url" alt="" style="width:150px;height:150px;border-radius: 5px;cursor: pointer;">
  42. <div class="upload-boxed-text">点击重新上传</div>
  43. </div>
  44. <div class="tip">提示: 414*150px或正方型图片</div>
  45. </el-form-item>
  46. <el-form-item label="分类">
  47. <el-select v-model="form.category_id" clearable placeholder="门店分类" style="width:70%;">
  48. <el-option v-for="(item,index) in category_list" :key="index" :label="item.name" :value="item.id"></el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="门店地址">
  52. <el-select v-model="form.province_id" placeholder="请选择省" clearable @change="changeProvince" :style="street==1?'width:17.5%':'width:23.3%'">
  53. <el-option v-for="item in province_list" :key="item.id" :label="item.areaname" :value="item.id"></el-option>
  54. </el-select>
  55. <el-select v-model="form.city_id" placeholder="请选择市" clearable @change="changeCity" :style="street==1?'width:17.5%':'width:23.3%'">
  56. <el-option v-for="item in city_list" :key="item.id" :label="item.areaname" :value="item.id"></el-option>
  57. </el-select>
  58. <el-select v-model="form.district_id" placeholder="请选择区" clearable @change="changeDistrict" :style="street==1?'width:17.5%':'width:23.3%'">
  59. <el-option v-for="item in district_list" :key="item.id" :label="item.areaname" :value="item.id"></el-option>
  60. </el-select>
  61. <el-select v-if="street==1" v-model="form.street_id" placeholder="请选择街道" clearable :style="street==1?'width:17.5%':'width:23.3%'">
  62. <el-option v-for="item in street_list" :key="item.id" :label="item.areaname" :value="item.id"></el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item label="详细地址" prop="address">
  66. <el-input v-model="form.address" style="width:70%;"></el-input>
  67. </el-form-item>
  68. <el-form-item label="定位" prop="">
  69. <el-input v-model="markersParam[0]" style="width:35%;"></el-input>
  70. <el-input v-model="markersParam[1]" style="width:35%;"></el-input>
  71. <el-button @click="openMap">选择坐标</el-button>
  72. </el-form-item>
  73. <el-form-item label="店铺电话" prop="mobile">
  74. <el-input v-model="form.mobile" style="width:70%;"></el-input>
  75. </el-form-item>
  76. <el-form-item label="门店介绍" prop="store_introduce">
  77. <el-input type="textarea" rows="5" v-model="form.store_introduce" style="width:70%;"></el-input>
  78. </el-form-item>
  79. <el-form-item label="营业时间" prop="business_hours_start">
  80. <el-time-picker v-model="form.business_hours_start" value-format="HH:mm" placeholder="请选择开始时间" style="width:35%"></el-time-picker>
  81. <el-time-picker v-model="form.business_hours_end" value-format="HH:mm" placeholder="请选择结束时间" style="width:35%"></el-time-picker>
  82. </el-form-item>
  83. <el-form-item label="资质" prop="aptitude_imgs">
  84. <div class="upload-boxed-list">
  85. <div class="upload-boxed-list-a" v-for="(item,index) in form.aptitude_imgs_url" :key="index">
  86. <img :src="item" alt="" style="width:150px;height:150px;border-radius: 5px;">
  87. <i class="el-icon-close" @click="clearImg('aptitude_imgs','list',index)" title="点击清除图片"></i>
  88. </div>
  89. <div class="upload-box" @click="openListUpload('aptitude_imgs')">
  90. <i class="el-icon-plus" style="font-size:32px"></i>
  91. </div>
  92. </div>
  93. <div class="tip">提示: 640*640px或正方型图片</div>
  94. </el-form-item>
  95. <el-form-item label="公告" prop="affiche">
  96. <el-input v-model="form.affiche" style="width:70%;" placeholder="请输入公告"></el-input>
  97. </el-form-item>
  98. </div>
  99. </div>
  100. <div class="vue-head" style="margin-top:20px">
  101. <div class="vue-main-title">
  102. <div class="vue-main-title-left"></div>
  103. <div class="vue-main-title-content">门店账户设置</div>
  104. </div>
  105. <div class="vue-main-form">
  106. <el-form-item label="连锁店" prop="is_boss">
  107. <el-switch v-model="is_boss" :active-value="1" :inactive-value="0"></el-switch>
  108. </el-form-item>
  109. <el-form-item label="连锁店老板" prop="boss_uid" v-show="is_boss==1">
  110. <div class="upload-box" @click="openMember('boss_uid')" v-if="!form.boss_uid">
  111. <div class="upload-box-member">
  112. <i class="el-icon-plus" style="font-size:32px"></i><br>
  113. 选 择
  114. </div>
  115. </div>
  116. <div class="upload-boxed" v-if="form.boss_uid">
  117. <img @click="openMember('boss_uid')" :src="choosed_boss.avatar" alt="" style="width:150px;height:150px;border-radius: 5px;cursor: pointer;" />
  118. <div @click="openMember('boss_uid')" class="upload-boxed-text">重新选择</div>
  119. <div class="upload-boxed-text-clear" @click="clearMember('boss_uid')">清除选择</div>
  120. <div style="text-align:center;line-height: 20px;">[[choosed_boss.nickname]]</div>
  121. </div>
  122. </el-form-item>
  123. <el-form-item label="门店店长" prop="uid">
  124. <div class="upload-box" @click="openMember('uid')" v-if="!form.uid">
  125. <div class="upload-box-member">
  126. <i class="el-icon-plus" style="font-size:32px"></i><br>
  127. 选 择
  128. </div>
  129. </div>
  130. <div class="upload-boxed" v-if="form.uid">
  131. <img @click="openMember('uid')" :src="choosed_store.avatar" alt="" style="width:150px;height:150px;border-radius: 5px;cursor: pointer;" />
  132. <div class="upload-boxed-text">重新选择</div>
  133. <div class="upload-boxed-text-clear" @click="clearMember('uid')">清除选择</div>
  134. <div style="text-align:center;line-height: 20px;">[[choosed_store.nickname]]</div>
  135. </div>
  136. </el-form-item>
  137. <el-form-item label="登录账户" prop="username">
  138. <el-input v-model="form.username" style="width:70%;" :disabled="id!=0"></el-input>
  139. </el-form-item>
  140. <el-form-item label="登录密码" prop="password" v-if="!id">
  141. <el-input v-model="form.password" type="password" style="width:70%;"></el-input>
  142. </el-form-item>
  143. <el-form-item label="确认密码" prop="password_again" v-if="!id">
  144. <el-input v-model="form.password_again" type="password" style="width:70%;"></el-input>
  145. </el-form-item>
  146. </div>
  147. </div>
  148. <div class="vue-head" style="margin-top:20px">
  149. <div class="vue-main-title">
  150. <div class="vue-main-title-left"></div>
  151. <div class="vue-main-title-content">门店营业设置</div>
  152. </div>
  153. <div class="vue-main-form">
  154. <el-form-item label="门店入驻期限(天)" prop="validity" v-if="!id">
  155. <el-input v-model="form.validity" style="width:70%;"></el-input>
  156. </el-form-item>
  157. <!-- <el-form-item label="订单语音提醒" prop="operating_state">
  158. <el-switch v-model="form.operating_state" :active-value="1" :inactive-value="0"></el-switch>
  159. </el-form-item> -->
  160. <el-form-item label="经营状态" prop="operating_state">
  161. <el-radio v-model="form.operating_state" :label="1">休息</el-radio>
  162. <el-radio v-model="form.operating_state" :label="0">经营</el-radio>
  163. <!-- <el-switch v-model="form.operating_state" :active-value="1" :inactive-value="0"></el-switch>
  164. <div class="tip">提示:开启为经营中,关闭为休息</div> -->
  165. </el-form-item>
  166. <el-form-item label="配送方式" prop="dispatch_type">
  167. <el-checkbox-group v-model="form.dispatch_type" style="margin-top:6px">
  168. <el-checkbox :label="1">快递</el-checkbox>
  169. <el-checkbox :label="2">门店自提</el-checkbox>
  170. <el-checkbox :label="3">门店配送</el-checkbox>
  171. <el-button type="text" @click="gotoDelivery" style="margin-left:50px;padding:0" v-if="store_delivery&&form.dispatch_type.indexOf(3)!=-1">设置门店配送规则</el-button>
  172. </el-checkbox-group>
  173. </el-form-item>
  174. <el-form-item label="选择通知人" prop="">
  175. <div class="upload-boxed-list">
  176. <div class="upload-boxed-list-a" v-for="(value,key,index) in form.salers" :key="index">
  177. <el-image :src="value.avatar_image" alt="" style="width:150px;height:150px;border-radius: 5px;"></el-image>
  178. <div style="text-align:center;line-height:20px">[[value.nickname]]</div>
  179. <i class="el-icon-close" @click="clearMember1('salers',index,key)" title="点击清除选择"></i>
  180. </div>
  181. <div class="upload-box" @click="openMember('salers')">
  182. <div class="upload-box-member">
  183. <i class="el-icon-plus" style="font-size:32px"></i><br>
  184. 添 加
  185. </div>
  186. </div>
  187. </div>
  188. </el-form-item>
  189. <!-- <el-form-item label="门店核销员" prop="">
  190. <div class="upload-boxed-list">
  191. <div class="upload-boxed-list-a" v-for="(item,index) in form.images_url" :key="index">
  192. <img :src="item" alt="" style="width:150px;height:150px;border-radius: 5px;">
  193. <div style="text-align:center">会员名称</div>
  194. <i class="el-icon-close" @click="clearImg('images','list',index)" title="点击清除图片"></i>
  195. </div>
  196. <div class="upload-box" @click="openListUpload('images')">
  197. <div class="upload-box-member">
  198. <i class="el-icon-plus" style="font-size:32px"></i><br>
  199. 添 加
  200. </div>
  201. </div>
  202. </div>
  203. </el-form-item> -->
  204. </div>
  205. </div>
  206. <div class="vue-head" style="margin-top:20px">
  207. <div class="vue-main-title">
  208. <div class="vue-main-title-left"></div>
  209. <div class="vue-main-title-content">门店详情</div>
  210. </div>
  211. <div class="vue-main-form">
  212. <!-- <el-form-item label="" prop="desc"> -->
  213. <div style="width:85%;margin:0 auto">
  214. <tinymceee v-model="form.information" ></tinymceee>
  215. </div>
  216. <!-- </el-form-item> -->
  217. </div>
  218. </div>
  219. </el-form>
  220. <!-- 分页 -->
  221. <div class="vue-page">
  222. <div class="vue-center">
  223. <el-button type="primary" @click="submitForm('form')">保存设置</el-button>
  224. <el-button @click="goBack">返回</el-button>
  225. </div>
  226. </div>
  227. <el-dialog :visible.sync="map_show" width="60%" center title="选择坐标">
  228. <div>
  229. <div>
  230. <input v-model="map_keyword" style="width:70%" @keyup.enter="searchMap" class="el-input__inner">
  231. <el-button type="primary" @click="searchMap()">搜索</el-button>
  232. </div>
  233. <div ref="ditucontent" style="width:100%;height:450px;margin:20px 0"></div>
  234. </div>
  235. <span slot="footer" class="dialog-footer">
  236. <el-button @click="sureMap">确 定</el-button>
  237. <el-button @click="map_show = false">取 消</el-button>
  238. </span>
  239. </el-dialog>
  240. <!-- 选择会员 -->
  241. <el-dialog title="选择会员" :visible.sync="member_show" width="60%">
  242. <div>
  243. <el-input v-model="member_keyword" style="width:60%;" placeholder="会员信息"></el-input>
  244. <el-button @click="getMember" >搜索</el-button>
  245. </div>
  246. <el-table :data="member_list" style="width: 100%;height:500px;overflow:auto" v-loading="loading">
  247. <el-table-column label="ID" prop="uid" align="center" width="100px"></el-table-column>
  248. <el-table-column label="会员信息">
  249. <template slot-scope="scope">
  250. <div style="display:flex;align-items: center;">
  251. <div v-if="scope.row.avatar_image" style="width:40px;">
  252. <el-image :src="scope.row.avatar_image" alt="" style="width:40px;height:40px;border-radius:50%"></el-image>
  253. </div>
  254. <div style="flex:1;">【id:[[scope.row.uid]]】[[scope.row.nickname]]</div>
  255. </div>
  256. </template>
  257. </el-table-column>
  258. <el-table-column prop="refund_time" label="操作" align="center" width="320">
  259. <template slot-scope="scope">
  260. <el-button @click="chooseMember(scope.row)">
  261. 选择
  262. </el-button>
  263. </template>
  264. </el-table-column>
  265. </el-table>
  266. <span slot="footer" class="dialog-footer">
  267. <el-button @click="member_show = false">取 消</el-button>
  268. </span>
  269. </el-dialog>
  270. <upload-img :upload-show="uploadShow" :name="chooseImgName" @replace="changeProp" @sure="sureImg"></upload-img>
  271. <upload-img-list :upload-list-show="uploadListShow" :name="chooseImgListName" @replace="changeListProp" @sure="sureImgList"></upload-img-list>
  272. </div>
  273. </div>
  274. <script src="{{resource_get('static/yunshop/tinymce4.7.5/tinymce.min.js')}}"></script>
  275. <!-- <script src="{{resource_get('static/yunshop/tinymceTemplate.js')}}"></script> -->
  276. @include('public.admin.tinymceee')
  277. @include('public.admin.uploadImg')
  278. @include('public.admin.uploadImgList')
  279. <script>
  280. var top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角,添加比例尺
  281. var top_left_navigation = new BMap.NavigationControl(); //左上角,添加默认缩放平移控件
  282. var top_right_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT, type: BMAP_NAVIGATION_CONTROL_SMALL}); //右上角,仅包含平移和缩放按钮
  283. /*缩放控件type有四种类型:
  284. BMAP_NAVIGATION_CONTROL_SMALL:仅包含平移和缩放按钮;BMAP_NAVIGATION_CONTROL_PAN:仅包含平移按钮;BMAP_NAVIGATION_CONTROL_ZOOM:仅包含缩放按钮*/
  285. var app = new Vue({
  286. el:"#app",
  287. delimiters: ['[[', ']]'],
  288. name: 'test',
  289. data() {
  290. let id = {!! $id?:0 !!};
  291. console.log(id);
  292. return{
  293. id:id,
  294. form:{
  295. dispatch_type:[],
  296. province_id:'',
  297. city_id:'',
  298. district_id:'',
  299. street_id:'',
  300. salers:{},
  301. },
  302. store_delivery:0,//门店配送是否开启
  303. is_boss:0,//连锁店开关
  304. uploadShow:false,
  305. chooseImgName:'',
  306. submit_url:'',
  307. showVisible:false,
  308. uploadListShow:false,
  309. chooseImgListName:'',
  310. loading: false,
  311. uploadImg1:'',
  312. province_list:[],
  313. city_list:[],
  314. district_list:[],
  315. street_list:[],
  316. areaLoading:false,
  317. street:1,
  318. category_list:[],
  319. map: "",
  320. marker: "",
  321. centerParam: [116.413384,39.910925],
  322. zoomParam: "",
  323. markersParam: [116.413384,39.910925],
  324. pointNew:"",
  325. choose_center:[],
  326. choose_marker:[],
  327. map_show:false,
  328. map_keyword:'',
  329. // 会员
  330. member_keyword:'',
  331. member_show:false,
  332. member_list:[],
  333. choose_member_type:'',
  334. choosed_boss:{},
  335. choosed_store:{},
  336. rules:{
  337. store_name:{ required: true, message: '请输入门店名称'},
  338. thumb:{ required: true, message: '请选择门店logo'},
  339. banner_thumb:{ required: true, message: '请选择门店banner图'},
  340. category_id :{ required: true, message: '请选择分类'},
  341. province_id :{ required: true, message: '请选择地址'},
  342. address :{ required: true, message: '请输入详细地址'},
  343. mobile :{ required: true, message: '请输入店铺电话'},
  344. store_introduce :{ required: true, message: '请输入门店介绍'},
  345. business_hours_start:{ required: true, message: '请选择时间'},
  346. aptitude_imgs:{ required: true, message: '请输入资质'},
  347. // affiche:{ required: true, message: '请输入公告'},
  348. operating_state:{ required: true, message: '请选择经营状态'},
  349. dispatch_type:{ required: true, message: '请选择配送方式'},
  350. salers:{ required: true, message: '请选择通知人'},
  351. validity:{ required: true, message: '请输入门店入驻期限'},
  352. },
  353. }
  354. },
  355. created() {
  356. },
  357. mounted() {
  358. // this.initMap();
  359. this.id = this.getParam("store_id");
  360. this.initProvince();
  361. this.getCategoryData();
  362. if(this.id) {
  363. this.submit_url = `{!! yzWebFullUrl('plugin.store-cashier.admin.store-manage.edit-store-post') !!}`;
  364. this.getData();
  365. }
  366. else {
  367. this.submit_url = `{!! yzWebFullUrl('plugin.store-cashier.admin.store-manage.add-store-post') !!}`;
  368. }
  369. },
  370. methods: {
  371. openMap() {
  372. this.map_show = true;
  373. setTimeout(() => {
  374. this.initMap();
  375. },100)
  376. this.map_keyword = "";
  377. },
  378. goParent(level) {
  379. if(level==1) {
  380. window.location.href = `{!! yzWebFullUrl('plugin.store-cashier.admin.store-manage.store-list') !!}`;
  381. }
  382. else if(level==2) {
  383. window.location.href = `{!! yzWebFullUrl('plugin.store-cashier.admin.store-manage.store-list') !!}`;
  384. }
  385. },
  386. getData() {
  387. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  388. this.$http.post('{!! yzWebFullUrl('plugin.store-cashier.admin.store-manage.get-store-one') !!}',{id:this.id}).then(function (response) {
  389. if (response.data.result){
  390. this.form = {
  391. ...response.data.data,
  392. };
  393. if(this.form.salers.length==0) {
  394. this.form.salers = {};
  395. }
  396. if(this.form.dispatch_type&&this.form.dispatch_type.length>0) {
  397. this.form.dispatch_type.forEach((item,index) => {
  398. this.form.dispatch_type[index] = Number(item);
  399. })
  400. }
  401. console.log(this.form.dispatch_type)
  402. this.store_delivery = this.form.store_delivery;
  403. // 经纬度
  404. if(this.form.longitude) {
  405. this.centerParam = [];
  406. this.markersParam = [];
  407. this.centerParam.push(this.form.longitude,this.form.latitude);
  408. this.markersParam.push(this.form.longitude,this.form.latitude);
  409. }
  410. // 老板、店长
  411. if(this.form.boss_uid) {
  412. this.choosed_boss = {
  413. uid:this.form.boss_uid,
  414. avatar:this.form.boss_avatar,
  415. nickname:this.form.boss_nickname,
  416. }
  417. this.is_boss = 1;
  418. }
  419. if(this.form.uid) {
  420. this.choosed_store = {
  421. uid:this.form.uid,
  422. avatar:this.form.member_avatar,
  423. nickname:this.form.member_nickname,
  424. }
  425. }
  426. // 省市区
  427. if(response.data.data.province_id) {
  428. this.changeProvince(response.data.data.province_id);
  429. this.form.province_id = response.data.data.province_id;
  430. }
  431. if(response.data.data.city_id) {
  432. this.changeCity(response.data.data.city_id);
  433. this.form.city_id = response.data.data.city_id;
  434. }
  435. if(response.data.data.district_id) {
  436. this.changeDistrict(response.data.data.district_id);
  437. this.form.district_id = response.data.data.district_id;
  438. this.form.street_id = response.data.data.street_id;
  439. }
  440. }
  441. else {
  442. this.$message({message: response.data.msg,type: 'error'});
  443. }
  444. loading.close();
  445. },function (response) {
  446. this.$message({message: response.data.msg,type: 'error'});
  447. loading.close();
  448. }
  449. );
  450. },
  451. getCategoryData() {
  452. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  453. this.$http.post('{!! yzWebFullUrl('plugin.store-cashier.admin.store-manage.get-all-category') !!}',{}).then(function(response) {
  454. if (response.data.result) {
  455. this.category_list = response.data.data.category;
  456. this.street = response.data.data.street;
  457. loading.close();
  458. } else {
  459. this.$message({
  460. message: response.data.msg,
  461. type: 'error'
  462. });
  463. }
  464. loading.close();
  465. }, function(response) {
  466. this.$message({
  467. message: response.data.msg,
  468. type: 'error'
  469. });
  470. loading.close();
  471. });
  472. },
  473. submitForm(formName) {
  474. console.log(this.form)
  475. console.log(this.$refs);
  476. let that = this;
  477. let json = {
  478. store_name:this.form.store_name,
  479. thumb:this.form.thumb,
  480. banner_thumb:this.form.banner_thumb,
  481. category_id:this.form.category_id,
  482. province_id:this.form.province_id,
  483. city_id:this.form.city_id,
  484. district_id:this.form.district_id,
  485. street_id:this.form.street_id,
  486. address:this.form.address,
  487. lng:"",
  488. lat:"",
  489. mobile:this.form.mobile,
  490. store_introduce:this.form.store_introduce,
  491. business_hours_start:this.form.business_hours_start,
  492. business_hours_end:this.form.business_hours_end,
  493. aptitude_imgs:this.form.aptitude_imgs,
  494. affiche:this.form.affiche,
  495. boss_uid:this.form.boss_uid,
  496. uid:this.form.uid,
  497. // validity:this.form.validity,//门店期限
  498. operating_state:this.form.operating_state,
  499. dispatch_type:this.form.dispatch_type,
  500. salers:this.form.salers,
  501. information:this.form.information,
  502. };
  503. if(this.markersParam.length>0) {
  504. json.lng = this.markersParam[0];
  505. json.lat = this.markersParam[1];
  506. }
  507. // 连锁店关闭,boss_uid传0
  508. if(this.is_boss == 0) {
  509. json.boss_uid = 0;
  510. }
  511. console.log(json);
  512. if(this.id) {
  513. json.id = this.id
  514. }
  515. if(!this.id) {
  516. json.username = this.form.username;
  517. json.password = this.form.password;
  518. json.password_again = this.form.password_again;
  519. json.validity = this.form.validity;
  520. }
  521. this.$refs[formName].validate((valid) => {
  522. if (valid) {
  523. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  524. this.$http.post(this.submit_url,json).then(response => {
  525. if (response.data.result) {
  526. this.$message({type: 'success',message: '操作成功!'});
  527. this.goBack();
  528. } else {
  529. this.$message({message: response.data.msg,type: 'error'});
  530. }
  531. loading.close();
  532. },response => {
  533. loading.close();
  534. });
  535. }
  536. else {
  537. console.log('error submit!!');
  538. return false;
  539. }
  540. });
  541. },
  542. initProvince(val) {
  543. console.log(val);
  544. this.areaLoading = true;
  545. this.$http.get("{!! yzWebUrl('area.list.init', ['area_ids'=>'']) !!}"+val).then(response => {
  546. this.province_list = response.data.data;
  547. this.areaLoading = false;
  548. }, response => {
  549. this.areaLoading = false;
  550. });
  551. },
  552. changeProvince(val) {
  553. this.city_list = [];
  554. this.district_list = [];
  555. this.street_list = [];
  556. this.form.city_id = "";
  557. this.form.district_id = "";
  558. this.form.street_id = "";
  559. this.areaLoading = true;
  560. let url = "<?php echo yzWebUrl('area.list', ['parent_id'=> '']); ?>" + val;
  561. this.$http.get(url).then(response => {
  562. if (response.data.data.length) {
  563. this.city_list = response.data.data;
  564. } else {
  565. this.city_list = null;
  566. }
  567. this.areaLoading = false;
  568. }, response => {
  569. this.areaLoading = false;
  570. });
  571. },
  572. // 市改变
  573. changeCity(val) {
  574. this.district_list = [];
  575. this.street_list = [];
  576. this.form.district_id = "";
  577. this.form.street_id = "";
  578. this.areaLoading = true;
  579. let url = "<?php echo yzWebUrl('area.list', ['parent_id'=> '']); ?>" + val;
  580. this.$http.get(url).then(response => {
  581. if (response.data.data.length) {
  582. this.district_list = response.data.data;
  583. } else {
  584. this.district_list = null;
  585. }
  586. this.areaLoading = false;
  587. }, response => {
  588. this.areaLoading = false;
  589. });
  590. },
  591. // 区改变
  592. changeDistrict(val) {
  593. console.log(val)
  594. this.street_list = [];
  595. this.form.street_id = "";
  596. this.areaLoading = true;
  597. let url = "<?php echo yzWebUrl('area.list', ['parent_id'=> '']); ?>" + val;
  598. this.$http.get(url).then(response => {
  599. if (response.data.data.length) {
  600. this.street_list = response.data.data;
  601. } else {
  602. this.street_list = null;
  603. }
  604. this.areaLoading = false;
  605. }, response => {
  606. this.areaLoading = false;
  607. });
  608. },
  609. goBack() {
  610. history.go(-1)
  611. },
  612. openUpload(str) {
  613. this.chooseImgName = str;
  614. this.uploadShow = true;
  615. },
  616. changeProp(val) {
  617. if(val == true) {
  618. this.uploadShow = false;
  619. }
  620. else {
  621. this.uploadShow = true;
  622. }
  623. },
  624. sureImg(name,image,image_url) {
  625. this.form[name] = image;
  626. this.form[name+'_url'] = image_url;
  627. },
  628. clearImg(str,type,index) {
  629. if(!type) {
  630. this.form[str] = "";
  631. this.form[str+'_url'] = "";
  632. }
  633. else {
  634. this.form[str].splice(index,1);
  635. this.form[str+'_url'].splice(index,1);
  636. }
  637. this.$forceUpdate();
  638. },
  639. openListUpload(str) {
  640. this.chooseImgListName = str;
  641. this.uploadListShow = true;
  642. },
  643. changeListProp(val) {
  644. if(val == true) {
  645. this.uploadListShow = false;
  646. }
  647. else {
  648. this.uploadListShow = true;
  649. }
  650. },
  651. sureImgList(name,image,image_url) {
  652. console.log(name)
  653. console.log(image)
  654. console.log(image_url)
  655. if(!this.form[name] || !this.form[name+'_url']) {
  656. this.form[name] = [];
  657. this.form[name+'_url'] = [];
  658. }
  659. image.forEach((item,index) => {
  660. this.form[name].push(item);
  661. this.form[name+'_url'].push(image_url[index]);
  662. })
  663. console.log(this.form)
  664. },
  665. getParam(name) {
  666. return location.href.match(new RegExp("[?#&]" + name + "=([^?#&]+)", "i"))
  667. ? RegExp.$1
  668. : "";
  669. },
  670. openMember(type) {
  671. this.member_show = true;
  672. this.choose_member_type = type;
  673. },
  674. getMember(){
  675. this.$http.post("{!! yzWebUrl('plugin.store-cashier.admin.store-manage.member-query') !!}",{keyword:this.member_keyword}).then(response => {
  676. if (response.data.result) {
  677. this.member_list=response.data.data
  678. }else{
  679. this.$message({type: 'error',message: response.data.msg});
  680. }
  681. }, response => {
  682. this.$message({type: 'error',message: response.data.msg});
  683. console.log(response);
  684. });
  685. },
  686. chooseMember(row) {
  687. let that = this;
  688. if(this.choose_member_type !="salers") {
  689. if(this.choose_member_type == "boss_uid") {
  690. this.choosed_boss = row;
  691. }
  692. else if(this.choose_member_type == "uid") {
  693. this.choosed_store = row;
  694. }
  695. this.form[this.choose_member_type] = row.uid
  696. this.member_show = false;
  697. console.log(this.form)
  698. }
  699. // 多选
  700. else {
  701. for(let i in this.form.salers) {
  702. if(row.uid == i) {
  703. this.$message.error("该会员已选择,请勿重复选择!");
  704. return;
  705. }
  706. }
  707. that.form.salers[row.uid] = row;
  708. console.log(this.form.salers)
  709. }
  710. },
  711. clearMember(type) {
  712. if(this.choose_member_type == "boss_uid") {
  713. this.choosed_boss = {};
  714. }
  715. else if(this.choose_member_type == "uid") {
  716. this.choosed_store = {};
  717. }
  718. this.form[type] = "";
  719. this.$forceUpdate();
  720. },
  721. clearMember1(type,index,key) {
  722. console.log(index,key);
  723. delete(this.form[type][key]);
  724. console.log(this.form[type]);
  725. this.$forceUpdate();
  726. },
  727. gotoDelivery() {
  728. let link = `{!! yzWebFullUrl('plugin.store-cashier.admin.delivery.index') !!}`+`&store_id=`+this.id;
  729. window.location.href = link;
  730. },
  731. searchMap() {
  732. console.log(this.marker);
  733. let that = this;
  734. geo.getPoint(this.map_keyword, function(point){
  735. that.choose_marker = [point.lng,point.lat];
  736. that.choose_center = [point.lng,point.lat];
  737. console.log(point)
  738. that.map.panTo(point);
  739. that.marker.setPosition(point);
  740. that.marker.setAnimation(BMAP_ANIMATION_BOUNCE);
  741. setTimeout(function(){that.marker.setAnimation(null)}, 3600);
  742. });
  743. },
  744. sureMap() {
  745. let that = this;
  746. this.markersParam = [];
  747. this.centerParam = [];
  748. this.markersParam = this.choose_marker.length<=0?[116.413384,39.910925]:this.choose_marker;
  749. this.centerParam = this.choose_center.length<=0?[116.413384,39.910925]:this.choose_center;;
  750. console.log(this.centerParam);
  751. console.log(this.markersParam);
  752. that.map_show = false;
  753. },
  754. //创建和初始化地图函数:
  755. initMap() {
  756. let that = this;
  757. // [FF]切换模式后报错
  758. if (!window.BMap) {
  759. return;
  760. }
  761. console.log(this.$refs['ditucontent']);
  762. for(let i in this.$refs) {
  763. console.log(i)
  764. }
  765. this.createMap(); //创建地图
  766. this.setMapEvent(); //设置地图事件
  767. this.addMapControl(); //向地图添加控件
  768. geo = new BMap.Geocoder();
  769. // 创建标注
  770. var point = new BMap.Point(this.markersParam[0], this.markersParam[1]);
  771. this.marker = new BMap.Marker(point);
  772. this.marker.enableDragging();
  773. this.map.addOverlay(this.marker); // 将标注添加到地图中
  774. this.marker.addEventListener('dragend', function (e) {//拖动标注结束
  775. that.pointNew = e.point;
  776. var point = that.marker.getPosition();
  777. geo.getLocation(point, function(address){
  778. console.log(address.address);
  779. that.map_keyword = address.address;
  780. });
  781. console.log(e);
  782. console.log("使用拖拽获取的百度坐标"+that.pointNew.lng+","+that.pointNew.lat);
  783. that.choose_marker = [that.pointNew.lng,that.pointNew.lat];
  784. that.choose_center = [that.pointNew.lng,that.pointNew.lat];
  785. });
  786. this.marker.setLabel(new BMap.Label('请您移动此标记,选择您的坐标!', {'offset': new BMap.Size(10,-20)}));
  787. if (parent.editor && parent.document.body.contentEditable == "true") {
  788. //在编辑状态下
  789. setMapListener(); //地图改变修改外层的iframe标签src属性
  790. }
  791. },
  792. //创建地图函数:
  793. createMap() {
  794. this.map = new BMap.Map(this.$refs['ditucontent']); //在百度地图容器中创建一个地图
  795. // this.centerParam = '116.712617,24.778619';
  796. // var centerArr = this.centerParam.split(",");
  797. var point = new BMap.Point(
  798. this.centerParam[0],
  799. this.centerParam[1]
  800. ); //
  801. this.zoomParam = 12;
  802. this.map.centerAndZoom(point, parseInt(this.zoomParam)); //设定地图的中心点和坐标并将地图显示在地图容器中
  803. },
  804. //地图事件设置函数:
  805. setMapEvent() {
  806. // this.map.disableDragging(); //启用地图拖拽事件,默认启用(可不写)
  807. this.map.enableScrollWheelZoom(); //启用地图滚轮放大缩小
  808. this.map.enableDoubleClickZoom(); //启用鼠标双击放大,默认启用(可不写)
  809. this.map.enableKeyboard(); //启用键盘上下左右键移动地图
  810. },
  811. //地图控件添加函数:
  812. addMapControl() {
  813. this.map.addControl(new BMap.NavigationControl());
  814. this.map.addControl(top_left_control);
  815. this.map.addControl(top_left_navigation);
  816. this.map.addControl(top_right_navigation);
  817. },
  818. setMapListener() {
  819. var editor = parent.editor,
  820. containerIframe,
  821. iframes = parent.document.getElementsByTagName("iframe");
  822. for (var key in iframes) {
  823. if (iframes[key].contentWindow == window) {
  824. containerIframe = iframes[key];
  825. break;
  826. }
  827. }
  828. if (containerIframe) {
  829. this.map.addEventListener("moveend", mapListenerHandler);
  830. this.map.addEventListener("zoomend", mapListenerHandler);
  831. this.marker.addEventListener("dragend", mapListenerHandler);
  832. }
  833. function mapListenerHandler() {
  834. var zoom = this.map.getZoom();
  835. this.center = this.map.getCenter();
  836. this.marker = window.marker.getPoint();
  837. containerIframe.src = containerIframe.src
  838. .replace(
  839. new RegExp("([?#&])center=([^?#&]+)", "i"),
  840. "$1center=" + center.lng + "," + center.lat
  841. )
  842. .replace(
  843. new RegExp("([?#&])markers=([^?#&]+)", "i"),
  844. "$1markers=" + this.marker.lng + "," + this.marker.lat
  845. )
  846. .replace(new RegExp("([?#&])zoom=([^?#&]+)", "i"), "$1zoom=" + zoom);
  847. editor.fireEvent("saveScene");
  848. }
  849. },
  850. },
  851. })
  852. </script>
  853. @endsection