add-edit.php 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-dialog-select');
  4. ComponentHelper::loadComponentView('com-select-cat');
  5. ComponentHelper::loadComponentView('com-rich-text');
  6. ComponentHelper::loadComponentView('com-image');
  7. ComponentHelper::loadComponentView('com-qq-map');
  8. ?>
  9. <div id="app" v-cloak>
  10. <el-card shadow="never" style="border:0;min-width: 1500px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  11. <div class="form-body">
  12. <el-form :model="ruleForm" :rules="rules" size="small" ref="ruleForm" label-width="150px" v-loading="listLoading">
  13. <el-row>
  14. <el-col :span="24">
  15. <div class="title">
  16. <span>基础信息</span>
  17. </div>
  18. <el-form-item label="" prop="">
  19. <el-button type="primary" style="padding:9px 40px" size="small" @click.sync='chooseUser(1)'>选择会员 </el-button>
  20. </el-form-item>
  21. <el-form-item label="选中会员" v-if="userInfo?.id > 0">
  22. <div style="display: inline-block; margin-left: 15px;">会员ID:<span>{{userInfo.id}}</span></div>
  23. <div style="display: inline-block; margin-left: 15px;">会员昵称:<span>{{userInfo.nickname}}</span></div>
  24. </el-form-item>
  25. <el-form-item label="" prop="">
  26. <el-button type="primary" style="padding:9px 40px" size="small" @click.sync='chooseUser(2)'>选择推广员 </el-button>
  27. </el-form-item>
  28. <el-form-item label="选中推广员" v-if="businessUser?.id > 0">
  29. <div style="display: inline-block; margin-left: 15px;">会员ID:<span>{{businessUser.id}}</span></div>
  30. <div style="display: inline-block; margin-left: 15px;">会员昵称:<span>{{businessUser.nickname}}</span></div>
  31. </el-form-item>
  32. <el-form-item label="店长姓名" prop="shop_owner">
  33. <el-input size="small" v-model="ruleForm.shop_owner" size="small" placeholder="请输入店长姓名" style="width:300px;"></el-input>
  34. </el-form-item>
  35. <el-form-item label="手机号" prop="shop_mobile">
  36. <el-input size="small" v-model="ruleForm.shop_mobile" size="small" placeholder="请输入店长手机号" style="width:300px;"></el-input>
  37. <div class="tips-text" >
  38. <span style="color: red;">*</span><span style="color:#B9B9B9;">注:手机号为商家后台登录的账号</span>
  39. </div>
  40. </el-form-item>
  41. <el-form-item label="门店名称" prop="store_name">
  42. <el-input size="small" v-model="ruleForm.store_name" size="small" placeholder="请输入门店名称" style="width:300px;"></el-input>
  43. </el-form-item>
  44. <el-form-item label="门店简介" prop="store_desc">
  45. <el-input type="textarea" size="small" v-model="ruleForm.store_desc" size="small" placeholder="请输入门店简介" maxlength="255" show-word-limit style="width:300px;"></el-input>
  46. </el-form-item>
  47. <el-form-item prop="logo_img" class="com-goods" label="商家LOGO">
  48. <div class="pic-url-remark">
  49. 建议尺寸 120px*120px
  50. </div>
  51. <template v-if="ruleForm.logo_img">
  52. <div style="margin-right: 20px;position: relative;display: inline-block;">
  53. <com-attachment :multiple="false" :max="1" type="images">
  54. <com-image mode="aspectFill" width="100px" height='100px' :src="ruleForm.logo_img"> </com-image>
  55. </com-attachment>
  56. <el-button class="del-btn" size="mini" type="danger" icon="el-icon-close" circle @click="delPic('logo_img')"></el-button>
  57. </div>
  58. </template>
  59. <template v-if="!ruleForm.logo_img">
  60. <com-attachment :multiple="false" :max="1" type="images" @selected="selectedImg($event, 'logo_img')">
  61. <el-tooltip class="item" effect="dark" content="建议尺寸:120px * 120px" placement="top">
  62. <div flex="main:center cross:center" class="add-image-btn">
  63. + 添加图片
  64. </div>
  65. </el-tooltip>
  66. </com-attachment>
  67. </template>
  68. </el-form-item>
  69. <el-form-item prop="license_img" class="com-goods" label="营业执照">
  70. <div class="pic-url-remark">
  71. 建议尺寸 686*485
  72. </div>
  73. <template v-if="ruleForm.license_img">
  74. <div style="margin-right: 20px;position: relative;display: inline-block;">
  75. <com-attachment v-model="ruleForm.license_img">
  76. <com-image v-if="ruleForm.license_img" mode="aspectFill" width="100px" height='100px' :src="ruleForm.license_img"> </com-image>
  77. </com-attachment>
  78. <el-button class="del-btn" size="mini" type="danger" icon="el-icon-close" circle @click="delPic('license_img')"></el-button>
  79. </div>
  80. </template>
  81. <template v-if="!ruleForm.license_img">
  82. <com-attachment :multiple="false" :max="1" type="images" @selected="selectedImg($event, 'license_img')">
  83. <div flex="main:center cross:center" class="add-image-btn">
  84. + 添加图片
  85. </div>
  86. </com-attachment>
  87. </template>
  88. </el-form-item>
  89. <el-form-item label="所在区域:" prop="province_id">
  90. <div class="flex flex-y-center">
  91. <el-select v-model="provinceInfo" value-key='id' placeholder="请选择省" @change="regionChange($event, 1)">
  92. <el-option v-for="item in provinces" :key="item.id" :label="item.name" :value="item"></el-option>
  93. </el-select>
  94. <el-select v-model="cityInfo" value-key='id' placeholder="请选择市" @change="regionChange($event, 2)">
  95. <el-option v-for="item in citys" :key="item.id" :label="item.name" :value="item"></el-option>
  96. </el-select>
  97. <el-select v-model="districtInfo" value-key='id' placeholder="请选择区" @change='regionChange($event, 3)'>
  98. <el-option v-for="item in districts" :key="item.id" :label="item.name" :value="item"></el-option>
  99. </el-select>
  100. <el-select v-model="streetInfo" value-key='id' placeholder="请选街道"
  101. @change='regionChange($event, 4)'>
  102. <el-option v-for="item in streets" :key="item.id" :label="item.name" :value="item"></el-option>
  103. </el-select>
  104. </div>
  105. </el-form-item>
  106. <el-form-item label="详细地址" prop="address">
  107. <el-input size="small" v-model="ruleForm.address" size="small" placeholder="请输入门店详细地址" style="width:300px;"></el-input>
  108. </el-form-item>
  109. <el-form-item label="经纬度" prop="">
  110. <el-input size="small" v-model="long_lat" size="small" disabled style="width:300px;"></el-input>
  111. </el-form-item>
  112. <!-- 地图 start -->
  113. <el-form-item label="" prop="">
  114. <com-qq-map @map-submit="mapEvent" :address="ruleForm.address" :lat="ruleForm.latitude"
  115. :long="ruleForm.longitude">
  116. <el-button type="primary" size="small">展开地图</el-button>
  117. </com-qq-map>
  118. </el-form-item>
  119. <!-- 地图 end -->
  120. <!-- <div class="title">-->
  121. <!-- <span>运营</span>-->
  122. <!-- -->
  123. <!-- </div>-->
  124. <!-- <el-form-item label="营业状态" prop="shop_status">-->
  125. <!-- <template>-->
  126. <!-- <el-radio v-model="ruleForm.shop_status" :label="1">营业</el-radio>-->
  127. <!-- <el-radio v-model="ruleForm.shop_status" :label="0">休息</el-radio><br />-->
  128. <!-- </template>-->
  129. <!-- <div class="tips-text" >-->
  130. <!-- 可管理门店运营状态,休息状态无法自提-->
  131. <!-- </div>-->
  132. <!-- </el-form-item>-->
  133. <!-- <el-form-item label="营业时间" prop="range_time">-->
  134. <!-- <template>-->
  135. <!-- <el-time-picker is-range v-model="times" value-format="HH:mm" format="HH:mm" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围" @change="selectTime"> </el-time-picker>-->
  136. <!-- </template>-->
  137. <!-- <div class="tips-text" >-->
  138. <!-- 设置门店营业时间,方便自提用户到店消费-->
  139. <!-- </div>-->
  140. <!-- </el-form-item>-->
  141. <!-- <div class="title">-->
  142. <!-- <span>配送</span>-->
  143. <!-- </div>-->
  144. <!-- <el-form-item label="同城配送">-->
  145. <!-- <template>-->
  146. <!-- <el-switch v-model="ruleForm.merchant_distribution" :active-value="1" :inactive-value="0">-->
  147. <!-- </el-switch>-->
  148. <!-- </template>-->
  149. <!-- <div class="tips-text" >-->
  150. <!-- 启用同城配送后,在配送范围内的买家可以选择同城配送,商家自己配送-->
  151. <!-- </div>-->
  152. <!-- </el-form-item>-->
  153. <!-- <el-form-item label="是否独立设置" prop="delivery_status">-->
  154. <!-- <template>-->
  155. <!-- <el-radio-group v-model="ruleForm.intra_city_distribution.is_alone" @input="changeRadioValue">-->
  156. <!-- <el-radio :label="0">跟随系统</el-radio>-->
  157. <!-- <el-radio :label="1">独立设置</el-radio>-->
  158. <!-- </el-radio-group>-->
  159. <!-- </template>-->
  160. <!-- <div class="tips-text" >-->
  161. <!-- 可管理门店运营状态,休息状态无法自提-->
  162. <!-- </div>-->
  163. <!-- </el-form-item>-->
  164. <!-- <div v-if="ruleForm.intra_city_distribution.is_alone == 1">-->
  165. <!-- <el-form-item label="配送范围">-->
  166. <!-- <template>-->
  167. <!-- <el-input size="small" v-model="ruleForm.intra_city_distribution.distribution_scope" style="width: 200px;" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入配送范围">-->
  168. <!-- <template slot="append">KM</template>-->
  169. <!-- </el-input>-->
  170. <!-- </template>-->
  171. <!-- <div class="tips-text" >-->
  172. <!-- 为空则不限制配送距离-->
  173. <!-- </div>-->
  174. <!-- </el-form-item>-->
  175. <!-- <el-form-item label="起送金额">-->
  176. <!-- <template>-->
  177. <!-- <el-input size="small" v-model="ruleForm.intra_city_distribution.initial_delivery_amount" style="width: 200px;" @input="formatLocaltion">-->
  178. <!-- <template slot="append">元</template>-->
  179. <!-- </el-input>-->
  180. <!-- </template>-->
  181. <!-- </el-form-item>-->
  182. <!-- -->
  183. <!-- <el-form-item label="配送费设置" prop="delivery_fee">-->
  184. <!-- <template>-->
  185. <!-- <el-radio v-model="ruleForm.intra_city_distribution.delivery_fee" :label="0">免配送费</el-radio>-->
  186. <!-- <el-radio v-model="ruleForm.intra_city_distribution.delivery_fee" :label="1">统一配送费</el-radio><br />-->
  187. <!-- </template>-->
  188. <!-- </el-form-item>-->
  189. <!-- <el-form-item label="配送费用" required v-if="ruleForm.intra_city_distribution.delivery_fee == 1">-->
  190. <!-- <template>-->
  191. <!-- <div style="display:flex;">-->
  192. <!-- <el-form-item prop="intra_city_distribution.distance" style="width: 100px;"><el-input size="small" v-model="ruleForm.intra_city_distribution.distance" oninput="value=value.replace(/[^\d]/g,'')"></el-input></el-form-item> 公里内,-->
  193. <!-- 收费 <el-form-item prop="intra_city_distribution.distance_charge" style="width: 100px;"><el-input size="small" v-model="ruleForm.intra_city_distribution.distance_charge" oninput="value=value.replace(/[^\d]/g,'')"></el-input></el-form-item> 元,-->
  194. <!-- 每增加 <el-form-item prop="intra_city_distribution.every_distance" style="width: 100px;"><el-input size="small" v-model="ruleForm.intra_city_distribution.every_distance" oninput="value=value.replace(/[^\d]/g,'')"></el-input></el-form-item> 公里,-->
  195. <!-- 配送费增加 <el-form-item prop="intra_city_distribution.every_distance_charge" style="width: 100px;"><el-input size="small" v-model="ruleForm.intra_city_distribution.every_distance_charge" oninput="value=value.replace(/[^\d]/g,'')"></el-input></el-form-item> 元-->
  196. <!-- </div>-->
  197. <!-- </template>-->
  198. <!-- </el-form-item>-->
  199. <!-- </div>-->
  200. <!-- <div v-else>-->
  201. <!-- <el-form-item label="配送范围">-->
  202. <!-- <template>-->
  203. <!-- <el-input size="small" disabled v-model="ruleForm.intra_city_distribution.distribution_scope" style="width: 200px;" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入配送范围">-->
  204. <!-- <template slot="append">KM</template>-->
  205. <!-- </el-input>-->
  206. <!-- </template>-->
  207. <!-- <div class="tips-text" >-->
  208. <!-- 为空则不限制配送距离-->
  209. <!-- </div>-->
  210. <!-- </el-form-item>-->
  211. <!-- <el-form-item label="起送金额">-->
  212. <!-- <template>-->
  213. <!-- <el-input size="small" disabled v-model="ruleForm.intra_city_distribution.initial_delivery_amount" style="width: 200px;" @input="formatLocaltion">-->
  214. <!-- <template slot="append">元</template>-->
  215. <!-- </el-input>-->
  216. <!-- </template>-->
  217. <!-- </el-form-item>-->
  218. <!-- -->
  219. <!-- <el-form-item label="配送费设置" prop="delivery_fee">-->
  220. <!-- <template>-->
  221. <!-- <el-radio v-model="ruleForm.intra_city_distribution.delivery_fee" :label="0" disabled>免配送费</el-radio>-->
  222. <!-- <el-radio v-model="ruleForm.intra_city_distribution.delivery_fee" :label="1" disabled>统一配送费</el-radio><br />-->
  223. <!-- </template>-->
  224. <!-- </el-form-item>-->
  225. <!-- <el-form-item label="配送费用" required v-if="ruleForm.intra_city_distribution.delivery_fee == 1">-->
  226. <!-- <template>-->
  227. <!-- <div style="display:flex;">-->
  228. <!-- <el-form-item prop="distance" style="width: 120px;"><el-input size="small" disabled v-model="ruleForm.intra_city_distribution.distance" oninput="value=value.replace(/[^\d]/g,'')"></el-input></el-form-item> 公里内,-->
  229. <!-- 收费 <el-form-item prop="start_amount" style="width: 120px;"><el-input size="small" disabled v-model="ruleForm.intra_city_distribution.distance_charge" oninput="value=value.replace(/[^\d]/g,'')"></el-input></el-form-item> 元,-->
  230. <!-- 每增加 <el-form-item prop="add_limit" style="width: 120px;"><el-input size="small" disabled v-model="ruleForm.intra_city_distribution.every_distance" oninput="value=value.replace(/[^\d]/g,'')"></el-input></el-form-item> 公里,-->
  231. <!-- 配送费增加 <el-form-item prop="add_amount" style="width: 120px;"><el-input size="small" disabled v-model="ruleForm.intra_city_distribution.every_distance_charge" oninput="value=value.replace(/[^\d]/g,'')"></el-input></el-form-item> 元-->
  232. <!-- </div>-->
  233. <!-- </template>-->
  234. <!-- </el-form-item>-->
  235. <!-- </div>-->
  236. <!-- <el-form-item label="上门自提">-->
  237. <!-- <template>-->
  238. <!-- <el-switch v-model="ruleForm.self_mention" :active-value="1" :inactive-value="0">-->
  239. <!-- </el-switch>-->
  240. <!-- </template>-->
  241. <!-- <div class="tips-text" >-->
  242. <!-- 启用上门自提后,买家可以就近选择商品自提点,买家下单后,您需要确保买家指定的自提点商品库存充足-->
  243. <!-- </div>-->
  244. <!-- </el-form-item>-->
  245. </el-col>
  246. </el-row>
  247. </el-form>
  248. </div>
  249. <el-button class="button-item" style="margin-bottom: 15px;" type="primary" @click="submitForm('ruleForm')" size="small" :loading="btnLoading">保存
  250. </el-button>
  251. </el-card>
  252. <el-dialog title="添加会员" :visible.sync="dialogVisible" width="50%">
  253. <div class="search-box">
  254. <div class="input-item">
  255. <el-input @keyup.enter.native="getUser" size="small" placeholder="请输入会员ID" v-model="searchData.user_id"> </el-input>
  256. </div>
  257. <div class="input-item">
  258. <el-input @keyup.enter.native="getUser" size="small" placeholder="会员昵称/手机号" v-model="searchData.keyword"> </el-input>
  259. </div>
  260. <el-button type="primary" size="small" @click="getUser">搜索</el-button>
  261. <el-button type="warning" size="small" @click="clereSearch" v-if="searchData.keyword || searchData.user_id" style="padding: 9px 15px !important;">清除搜索条件</el-button>
  262. </div>
  263. <el-table :data="userList" v-if="userList" stripe v-loading="userListLoading" style="width: 100%"
  264. @current-change="clickChange">
  265. <el-table-column prop="date" width="50">
  266. <template slot-scope="scope">
  267. <el-radio v-model="currentUser" :label="scope.row"><i></i></el-radio>
  268. </template>
  269. </el-table-column>
  270. <el-table-column prop="id" label="ID" width="80">
  271. <template slot-scope="scope">
  272. {{scope.row.id}}
  273. </template>
  274. </el-table-column>
  275. <el-table-column prop="avatar_url" label="会员" width="80">
  276. <template slot-scope="scope">
  277. <el-image style="width: 60px; height: 60px" :src="scope.row.avatar_url" fit="cover"></el-image>
  278. </template>
  279. </el-table-column>
  280. <el-table-column prop="nickname" width="180"> </el-table-column>
  281. <el-table-column prop="mobile" label="手机号" width="200">
  282. </el-table-column>
  283. <el-table-column prop="level_name" label="会员等级">
  284. <template slot-scope="scope">
  285. <div v-if="scope.row.level > 0">等级{{scope.row.level_name}}</div>
  286. <div v-else>普通用户</div>
  287. </template>
  288. </el-table-column>
  289. <el-table-column prop="parent_nickname" label="已绑定推荐人">
  290. </el-table-column>
  291. </el-table>
  292. <div style="text-align: right;margin: 20px 0;">
  293. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  294. </div>
  295. <span slot="footer" class="dialog-footer">
  296. <el-button @click="dialogVisible = false">取 消</el-button>
  297. <el-button type="primary" @click="selectUser">确 定</el-button>
  298. </span>
  299. </el-dialog>
  300. </div>
  301. <script>
  302. const app = new Vue({
  303. el: '#app',
  304. data() {
  305. return {
  306. listLoading: false,
  307. btnLoading: false,
  308. userListLoading: false,
  309. dialogVisible: false,
  310. businessUser:{},
  311. currentUser: {},
  312. streetInfo:{},
  313. ruleForm: {
  314. user_id: 0,
  315. shop_owner: '',
  316. shop_mobile: '',
  317. store_name: '',
  318. logo_img: '',
  319. license_img: '',
  320. province_id: '',
  321. city_id: '',
  322. district_id: '',
  323. address: '',
  324. longitude: '',
  325. latitude: '',
  326. shop_status: 1,
  327. business_id:'',
  328. business_time_start: '00:00',
  329. business_time_end: '23:59',
  330. merchant_distribution: 1,
  331. self_mention: 1,
  332. intra_city_distribution: {
  333. is_alone: 0,
  334. distribution_scope: '',
  335. delivery_fee: 0,
  336. initial_delivery_amount: 0,
  337. distance: 0,
  338. distance_charge: 0,
  339. every_distance: 0,
  340. every_distance_charge: 0,
  341. },
  342. },
  343. system_setting: [],
  344. alone_setting: {
  345. is_alone: 1,
  346. distribution_scope: '',
  347. delivery_fee: 0,
  348. initial_delivery_amount: 0,
  349. distance: 0,
  350. distance_charge: 0,
  351. every_distance: 0,
  352. every_distance_charge: 0,
  353. },
  354. categorys: [],
  355. provinces: [],
  356. provinceInfo: {},
  357. citys: [],
  358. cityInfo: {},
  359. districts: [],
  360. districtInfo: {},
  361. streets: [],
  362. communitys: [],
  363. type:1,
  364. userList: [],
  365. userInfo: {},
  366. times: ['00:00', '23:59'],
  367. searchData: {
  368. user_id: null,
  369. keyword: '',
  370. },
  371. currPage: 1,
  372. rules: {
  373. shop_owner: [{
  374. required: true,
  375. message: '店长姓名不能为空',
  376. trigger: 'blur'
  377. }, ],
  378. shop_mobile: [{
  379. required: true,
  380. message: '店长手机号不能为空',
  381. trigger: 'blur'
  382. }, ],
  383. store_name: [{
  384. required: true,
  385. message: '门店名称不能为空',
  386. trigger: 'blur'
  387. }, ],
  388. logo_img: [{
  389. required: true,
  390. message: '请选择商店LOGO',
  391. trigger: 'blur'
  392. }, ],
  393. 'intra_city_distribution.distance':[{required: true, message: '请填写初始公里数', trigger: 'blur'}],
  394. 'intra_city_distribution.distance_charge': [{required: true, message: '请填写初始配送费', trigger: 'blur'}],
  395. 'intra_city_distribution.every_distance': [{required: true, message: '请填写递增公里数', trigger: 'blur'}],
  396. 'intra_city_distribution.every_distance_charge': [{required: true, message: '请填写每次递增配送费', trigger: 'blur'}],
  397. // address: [{
  398. // required: true,
  399. // message: '门店详细地址不能为空',
  400. // trigger: 'blur'
  401. // }, ],
  402. },
  403. page: 1,
  404. pageCount: 0,
  405. long_lat: '', // 经纬度
  406. };
  407. },
  408. mounted() {
  409. this.loadData();
  410. },
  411. methods: {
  412. loadData() {
  413. let self = this;
  414. self.listLoading = true;
  415. request({
  416. params: {
  417. r: 'happiness/store/storage',
  418. },
  419. method: 'get',
  420. }).then(e => {
  421. self.listLoading = false;
  422. console.log(e.data.data)
  423. if (e.data.code == 0) {
  424. self.provinces = e.data.data.provinces;
  425. self.system_setting = e.data.data.configs;
  426. if (Object.keys(e.data.data.configs).length > 0) {
  427. self.ruleForm.intra_city_distribution.distribution_scope = e.data.data.configs.localtion_limit;
  428. self.ruleForm.intra_city_distribution.delivery_fee = e.data.data.configs.delivery_fee;
  429. self.ruleForm.intra_city_distribution.initial_delivery_amount = e.data.data.configs.delivery_amount;
  430. self.ruleForm.intra_city_distribution.distance = e.data.data.configs.start_limit;
  431. self.ruleForm.intra_city_distribution.distance_charge = e.data.data.configs.start_amount;
  432. self.ruleForm.intra_city_distribution.every_distance = e.data.data.configs.add_limit;
  433. self.ruleForm.intra_city_distribution.every_distance_charge = e.data.data.configs.add_amount;
  434. }
  435. }
  436. }).catch(e => {
  437. console.log(e);
  438. self.listLoading = false;
  439. self.$message.error('网络错误');
  440. });
  441. },
  442. submitForm(formName) {
  443. let self = this;
  444. if (!self.ruleForm.user_id) {
  445. self.$message.error('请选择关联会员');
  446. return false;
  447. }
  448. if (!self.ruleForm.logo_img) {
  449. self.$message.error('请上传商家LOGO图片');
  450. return false;
  451. }
  452. if (!self.ruleForm.license_img) {
  453. self.$message.error('请上传营业执照图片');
  454. return false;
  455. }
  456. if (!self.provinceInfo || !self.cityInfo || !self.districtInfo) {
  457. self.$message.error('请选择完善门店地址');
  458. return false;
  459. }
  460. self.ruleForm.province_id = self.provinceInfo.id;
  461. self.ruleForm.city_id = self.cityInfo.id;
  462. self.ruleForm.district_id = self.districtInfo.id;
  463. self.ruleForm.street_id = self.streetInfo.id;
  464. console.log('sumbit ===: ', self.ruleForm);
  465. self.btnLoading = true;
  466. self.$refs[formName].validate((valid, obj) => {
  467. if (valid) {
  468. request({
  469. params: {
  470. r: 'happiness/store/storage',
  471. },
  472. method: 'post',
  473. data: self.ruleForm,
  474. }).then(e => {
  475. self.btnLoading = false;
  476. if (e.data.code == 0) {
  477. self.$message.success('保存成功');
  478. navigateTo({
  479. r: 'happiness/store/index',
  480. });
  481. } else {
  482. self.$message.error(e.data.msg);
  483. }
  484. }).catch(e => {
  485. self.btnLoading = false;
  486. console.log(e);
  487. self.$message.error('网络错误');
  488. return false;
  489. });
  490. } else {
  491. self.btnLoading = false;
  492. var msg = '';
  493. for (let index in obj) {
  494. msg = msg + '*' + obj[index][0].message + ' ';
  495. }
  496. this.$message({
  497. message: msg,
  498. type: 'error'
  499. });
  500. return false;
  501. }
  502. });
  503. },
  504. selectedImg(e, key) {
  505. // console.log('ddddd: ', e, key);
  506. this.ruleForm[key] = e[0].url;
  507. this.$forceUpdate();
  508. },
  509. delPic(key) {
  510. this.ruleForm[key] = '';
  511. this.$forceUpdate();
  512. },
  513. selectTime(e) {
  514. if (e) {
  515. this.ruleForm.business_time_start = this.times[0];
  516. this.ruleForm.business_time_end = this.times[1];
  517. } else {
  518. this.times = null;
  519. this.ruleForm.business_time_start = '';
  520. this.ruleForm.business_time_end = '';
  521. }
  522. },
  523. // 省市区三级联动
  524. regionChange(e, level) {
  525. // console.log(e);
  526. let self = this;
  527. if (level < 4 && e.lng !== "" && e.lat !== "") {
  528. self.ruleForm.longitude = e.lng;
  529. self.ruleForm.latitude = e.lat;
  530. self.long_lat = e.lng + '-' + e.lat;
  531. }
  532. request({
  533. params: {
  534. r: 'happiness/store/get-regions',
  535. region_id: e.id,
  536. level: level,
  537. },
  538. method: 'get',
  539. }).then(e => {
  540. if (e.data.code == 0) {
  541. switch (level) {
  542. case 1:
  543. self.citys = e.data.data;
  544. this.cityInfo = {}
  545. this.districtInfo = {}
  546. break;
  547. case 2:
  548. self.districts = e.data.data;
  549. this.districtInfo = {}
  550. break;
  551. case 3:
  552. self.streets = e.data.data;
  553. this.streetInfo = {}
  554. this.getMapDetailData(level);
  555. break;
  556. }
  557. } else {
  558. self.$message.error(e.data.msg);
  559. }
  560. }).catch(e => {
  561. console.log(e);
  562. self.$message.error('网络错误');
  563. return false;
  564. });
  565. },
  566. //选择通过详细地址获取经纬度
  567. getMapDetailData(level) {
  568. let address = this.provinceInfo.name + this.cityInfo.name + this.districtInfo.name;
  569. if (level < 4 && this.districtInfo.lat !== "" && this.districtInfo.lng !== "") {
  570. return true;
  571. }
  572. console.log(address);
  573. request({
  574. params: {
  575. r: 'common/qq-map/geocoder',
  576. },
  577. method: 'post',
  578. data: {
  579. address: address
  580. },
  581. }).then(e => {
  582. if (e.data.code == 0) {
  583. this.ruleForm.longitude = e.data.data.location.lng;
  584. this.ruleForm.latitude = e.data.data.location.lat;
  585. this.long_lat = e.data.data.location.lng + '-' + e.data.data.location.lat;
  586. } else {
  587. this.$message.error(e.data.msg);
  588. }
  589. }).catch(e => {
  590. // this.btnLoading = false;
  591. console.log(e);
  592. // this.$message.error('网络错误');
  593. return false;
  594. });
  595. },
  596. //地图确定事件
  597. mapEvent(e) {
  598. // console.log(e, '----')
  599. this.ruleForm.longitude = e.long;
  600. this.ruleForm.latitude = e.lat;
  601. this.ruleForm.ll = e.lat + ',' + e.long;
  602. this.ruleForm.address = e.address;
  603. let address = e.address;
  604. let reg = new RegExp(/(.*?(?:省|自治区|北京市|天津市|上海市|重庆市))+(.*?(?:市|自治州|地区|区划|县))+(.*?(?:市|区|县|镇|乡|街道))/);
  605. let rst = address.match(reg);
  606. let addr = '';
  607. if (rst) {
  608. addr += rst[1] + '/' + rst[2] + '/' + rst[3];
  609. }
  610. this.ruleForm.addr = addr;
  611. // console.log(rst, 'rst ==================');
  612. // this.$forceUpdate();
  613. },
  614. clearValidate(formName) {
  615. this.$refs[formName].clearValidate();
  616. },
  617. // 获取会员列表
  618. getUser() {
  619. let url='happiness/store/get-users'
  620. if(this.type==2)
  621. {
  622. url='happiness/store-agent/get-agent-users'
  623. }
  624. let self = this;
  625. self.userListLoading = true;
  626. request({
  627. params: {
  628. r: url,
  629. page: self.currPage,
  630. ...self.searchData,
  631. },
  632. method: 'get',
  633. }).then(e => {
  634. self.userListLoading = false;
  635. if (e.data.code == 0) {
  636. self.userList = e.data.data.list;
  637. self.pageCount = e.data.data.page_count;
  638. } else {
  639. self.$message.error(e.data.msg);
  640. return false;
  641. }
  642. }).catch(e => {
  643. console.log(e);
  644. self.$message.error('网络错误');
  645. return false;
  646. });
  647. },
  648. // 选择会员
  649. chooseUser(type) {
  650. this.type=type;
  651. this.currPage=1;
  652. this.currentUser= {}
  653. this.getUser()
  654. this.dialogVisible = true;
  655. },
  656. // 会员列表分页
  657. pagination(currentPage) {
  658. this.currPage = currentPage;
  659. this.getUser();
  660. },
  661. // 选中会员确定回调
  662. selectUser() {
  663. if(this.type==1)
  664. {
  665. this.ruleForm.user_id = this.userInfo.id;
  666. this.ruleForm.shop_mobile = this.userInfo.mobile;
  667. this.dialogVisible = false;
  668. }
  669. else
  670. {
  671. this.ruleForm.business_id=this.businessUser.id;
  672. this.dialogVisible = false;
  673. }
  674. },
  675. // 会员列表选中
  676. clickChange(userInfo) {
  677. if(this.type==1)
  678. {
  679. this.userInfo = userInfo;
  680. }
  681. else {
  682. this.businessUser=userInfo;
  683. }
  684. this.currentUser=userInfo;
  685. },
  686. // 清楚搜索条件
  687. clereSearch() {
  688. this.searchData.user_id = null;
  689. this.searchData.keyword = '';
  690. this.getUser();
  691. },
  692. formatLocaltion(value) {
  693. let temp = this.formatNumber(value);
  694. this.ruleForm.intra_city_distribution.initial_delivery_amount = temp;
  695. },
  696. formatNumber(value) {
  697. let temp = value.toString();
  698. temp = temp.replace(/。/g, ".");
  699. temp = temp.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
  700. temp = temp.replace(/^\./g, ""); //验证第一个字符是数字
  701. temp = temp.replace(/\.{2,}/g, ""); //只保留第一个, 清除多余的
  702. temp = temp.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
  703. temp = temp.replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3");
  704. return temp;
  705. },
  706. changeRadioValue(e) {
  707. if (e == 1) {
  708. this.ruleForm.intra_city_distribution = {...this.ruleForm.intra_city_distribution, ...this.alone_setting};
  709. } else {
  710. this.alone_setting = {...this.alone_setting, ...this.ruleForm.intra_city_distribution};
  711. this.alone_setting.is_alone = 1;
  712. this.ruleForm.intra_city_distribution.distribution_scope = this.system_setting.localtion_limit;
  713. this.ruleForm.intra_city_distribution.delivery_fee = this.system_setting.delivery_fee;
  714. this.ruleForm.intra_city_distribution.initial_delivery_amount = this.system_setting.delivery_amount;
  715. this.ruleForm.intra_city_distribution.distance = this.system_setting.start_limit;
  716. this.ruleForm.intra_city_distribution.distance_charge = this.system_setting.start_amount;
  717. this.ruleForm.intra_city_distribution.every_distance = this.system_setting.add_limit;
  718. this.ruleForm.intra_city_distribution.every_distance_charge = this.system_setting.add_amount;
  719. console.log(this.alone_setting);
  720. }
  721. },
  722. }
  723. });
  724. </script>
  725. <style>
  726. .el-popover {
  727. padding: 30px;
  728. }
  729. .form-body {
  730. padding: 20px;
  731. background-color: #fff;
  732. margin-bottom: 20px;
  733. padding-right: 20%;
  734. min-width: 900px;
  735. }
  736. .form-body .el-form-item {
  737. /* padding-right: 25%; */
  738. /* min-width: 850px; */
  739. }
  740. .form-button {
  741. margin: 0;
  742. }
  743. .form-button .el-form-item__content {
  744. margin-left: 0 !important;
  745. }
  746. .button-item {
  747. padding: 9px 25px;
  748. }
  749. .check-group {
  750. font-size: 14px !important;
  751. }
  752. .check-group .el-col {
  753. display: flex;
  754. }
  755. .check-group .el-input {
  756. margin: 0 5px;
  757. }
  758. .check-group .el-col .el-checkbox {
  759. display: flex;
  760. align-items: center;
  761. }
  762. .check-group .el-col .el-input {
  763. width: 100px;
  764. }
  765. .check-group .el-col .el-input .el-input__inner {
  766. height: 30px;
  767. width: 100px;
  768. }
  769. .el-checkbox-group .el-col {
  770. margin-bottom: 10px;
  771. }
  772. .inp {
  773. width: 140px;
  774. }
  775. .inp .el-input__inner {
  776. border-radius: 4px 0 0 4px;
  777. }
  778. .inp2 {
  779. width: 60px;
  780. }
  781. .inp-text {
  782. background: #EFEFEF;
  783. border: 1px solid #E3E2E5;
  784. font-size: 15px;
  785. padding: 0px 15px;
  786. border-radius: 0 4px 4px 0;
  787. height: 32px;
  788. }
  789. /* flex公共样式 */
  790. .flex {
  791. display: -webkit-box;
  792. display: -webkit-flex;
  793. display: flex;
  794. }
  795. .flex-x-center {
  796. display: -webkit-box;
  797. display: -webkit-flex;
  798. display: flex;
  799. -webkit-box-pack: center;
  800. -webkit-justify-content: center;
  801. -ms-flex-pack: center;
  802. justify-content: center;
  803. }
  804. .flex-x-between {
  805. display: -webkit-box;
  806. display: -webkit-flex;
  807. display: flex;
  808. -webkit-box-pack: space-between;
  809. -webkit-justify-content: space-between;
  810. -ms-flex-pack: space-between;
  811. justify-content: space-between;
  812. }
  813. .flex-y-center {
  814. display: -webkit-box;
  815. display: -webkit-flex;
  816. display: flex;
  817. -webkit-box-align: center;
  818. -webkit-align-items: center;
  819. -ms-flex-align: center;
  820. -ms-grid-row-align: center;
  821. align-items: center;
  822. }
  823. .flex-y-bottom {
  824. display: -webkit-box;
  825. display: -webkit-flex;
  826. display: flex;
  827. -webkit-box-align: end;
  828. -webkit-align-items: flex-end;
  829. -ms-flex-align: end;
  830. -ms-grid-row-align: flex-end;
  831. align-items: flex-end;
  832. }
  833. .pic-url-remark {
  834. font-size: 13px;
  835. color: #c9c9c9;
  836. margin-bottom: 12px;
  837. }
  838. .add-image-btn {
  839. width: 100px;
  840. height: 100px;
  841. color: #419EFB;
  842. border: 1px solid #e2e2e2;
  843. cursor: pointer;
  844. }
  845. .del-btn {
  846. position: absolute;
  847. right: -14px;
  848. top: -14px;
  849. }
  850. /* .el-input__inner {
  851. width: 74%;
  852. } */
  853. .el-input-group {
  854. width: 69%;
  855. }
  856. .el-input.is-disabled .el-input__inner {
  857. /* width: 49%; */
  858. }
  859. .search-box {
  860. display: flex;
  861. margin-bottom: 30px;
  862. }
  863. .input-item {
  864. width: 200px;
  865. margin-right: 16px;
  866. }
  867. .title {
  868. padding: 0px 8px;
  869. border-left: 5px solid #1479F0;
  870. background-color: #fff;
  871. font-size: 18px;
  872. position: relative;
  873. left: 32px;
  874. margin: 20px 0;
  875. }
  876. </style>