storeEdit.vue 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122
  1. <template>
  2. <div class="storeEdit">
  3. <!-- 顶部条-->
  4. <div class="navBarTOP">
  5. <van-nav-bar
  6. class="navBar"
  7. title="编辑信息"
  8. left-arrow
  9. @click-left="onClickLeft"
  10. right-text="保存"
  11. @click-right="onSubmit" />
  12. </div>
  13. <!-- 主体内容-->
  14. <div style="margin-top: 44px">
  15. <van-dialog v-model="show" title="门店位置">
  16. <mapmarker :info="fromValue"></mapmarker>
  17. </van-dialog>
  18. <van-form ref="tabstoreVal">
  19. <van-tabs class="myTab" v-model="tabVal" color="#1989fa">
  20. <van-tab title="基础信息" name="insidePlan">
  21. <van-field readonly v-model="fromValue.storeCode" label="编号">
  22. <template #left-icon>
  23. <span class="van-f-red"> </span>
  24. </template>
  25. </van-field>
  26. <van-field
  27. readonly
  28. clickable
  29. name="picker"
  30. :value="fromValue.storeCategoryName"
  31. label="类型"
  32. placeholder="点击选择类型"
  33. @click="showPicker = true">
  34. <template #left-icon>
  35. <span class="van-f-red">*</span>
  36. </template>
  37. </van-field>
  38. <van-field
  39. readonly
  40. clickable
  41. name="picker"
  42. :value="fromValue.orgName"
  43. label="部门名称"
  44. placeholder="点击选择部门名称"
  45. @click="PickerDept">
  46. <template #left-icon>
  47. <span class="van-f-red">*</span>
  48. </template>
  49. </van-field>
  50. <div
  51. style="background-color: white; padding: 0 14px"
  52. class="morelaji"
  53. v-if="fromValue.storeCategory != 'C917'">
  54. <!-- 分销店 -->
  55. <template
  56. v-if="
  57. verifyStoreType(fromValue.storeCategory) &&
  58. verifyStoreType(fromValue.storeCategory).type == 'fxd'
  59. ">
  60. <van-row style="border-bottom: 1px solid #ebedf0">
  61. <van-col span="24">
  62. <van-field label="经销商名称" @click="showPickerChainsListFn" class="TCFXList">
  63. <template #left-icon>
  64. <span class="van-f-red">*</span>
  65. </template>
  66. <template #input>
  67. <template v-if="sfaStoreChainsContactList.length">
  68. <div
  69. class="sfaStoreChainsContactList"
  70. v-for="(item, index) in sfaStoreChainsContactList"
  71. :key="index">
  72. {{ item.categoryDescribe }}
  73. {{ item.chainCode }}
  74. {{ item.chainName }}
  75. </div>
  76. </template>
  77. <template v-else>
  78. <span style="color: rgb(150, 151, 153)"> 点击选择经销商名称 </span>
  79. </template>
  80. </template>
  81. </van-field>
  82. </van-col>
  83. </van-row>
  84. </template>
  85. <template v-else>
  86. <van-row style="border-bottom: 1px solid #ebedf0">
  87. <van-col span="20">
  88. <van-field
  89. rows="1"
  90. autosize
  91. type="textarea"
  92. readonly
  93. clickable
  94. name="picker"
  95. :value="fromValue.chainName"
  96. label="经销商名称"
  97. placeholder="点击选择经销商名称"
  98. @click="showPickerChainsListFn">
  99. <template #left-icon>
  100. <span
  101. v-if="
  102. fromValue.ifJzStoreType != 1 &&
  103. fromValue.storeCategory != 'C912' &&
  104. fromValue.storeCategory != 'C917'
  105. "
  106. class="van-f-red"
  107. >*</span
  108. >
  109. </template>
  110. </van-field>
  111. </van-col>
  112. <van-col span="4"
  113. ><van-button
  114. size="small"
  115. type="info"
  116. style="margin-top: 6px"
  117. native-type="button"
  118. @click="moreTypeShowFn"
  119. ><van-icon name="list-switching" />更多</van-button
  120. ></van-col
  121. >
  122. </van-row>
  123. </template>
  124. </div>
  125. <van-field
  126. v-model="fromValue.storeName"
  127. @blur="setStoreNameFn"
  128. :label="storeName"
  129. placeholder="请输入">
  130. <template #left-icon>
  131. <span class="van-f-red">*</span>
  132. </template>
  133. </van-field>
  134. <van-field
  135. readonly
  136. clickable
  137. name="picker"
  138. :value="fromValue.provinceName"
  139. label="省(州)"
  140. placeholder="点击选择省(州)"
  141. @click="showProvincePicker = true">
  142. <template #left-icon>
  143. <span class="van-f-red">*</span>
  144. </template>
  145. </van-field>
  146. <van-field
  147. readonly
  148. clickable
  149. name="picker"
  150. :value="fromValue.cityName"
  151. label="城市"
  152. placeholder="点击选择城市"
  153. @click="showCityPicker = true">
  154. <template #left-icon>
  155. <span class="van-f-red">*</span>
  156. </template>
  157. </van-field>
  158. <van-field
  159. readonly
  160. clickable
  161. name="picker"
  162. :value="fromValue.districtName"
  163. label="区(县)"
  164. placeholder="点击选择区(县)"
  165. @click="showDistrictPicker = true">
  166. <template #left-icon>
  167. <span class="van-f-red">*</span>
  168. </template>
  169. </van-field>
  170. <van-field
  171. readonly
  172. clickable
  173. name="picker"
  174. :value="fromValue.townName"
  175. label="街道"
  176. placeholder="点击选择街道"
  177. @click="showTownPicker = true">
  178. <template #left-icon>
  179. <span class="van-f-red">*</span>
  180. </template>
  181. </van-field>
  182. <van-field
  183. v-model="fromValue.addressLine"
  184. rows="1"
  185. autosize
  186. type="textarea"
  187. :label="address"
  188. placeholder="地址"
  189. @blur="addressFn">
  190. <template #left-icon>
  191. <span class="van-f-red">*</span>
  192. </template>
  193. <template #button>
  194. <van-button size="small" type="info" native-type="button" @click="fns"
  195. ><van-icon name="location-o" />地图</van-button
  196. >
  197. </template>
  198. </van-field>
  199. <van-field v-model="fromValue.lat" readonly label="经度" placeholder="经度">
  200. <template #left-icon>
  201. <span class="van-f-red"> </span>
  202. </template>
  203. </van-field>
  204. <van-field v-model="fromValue.lon" readonly label="维度" placeholder="维度">
  205. <template #left-icon>
  206. <span class="van-f-red"> </span>
  207. </template>
  208. </van-field>
  209. <van-field
  210. readonly
  211. clickable
  212. name="picker"
  213. :value="fromValue.cityLevel"
  214. label="城市等级"
  215. placeholder="点击选择城市等级">
  216. <template #left-icon>
  217. <span class="van-f-red"></span>
  218. </template>
  219. </van-field>
  220. <div v-if="fromValue.storeCategory != 'C917'">
  221. <van-field
  222. v-if="fromValue.ifJzStoreType != 1"
  223. v-model="fromValue.area"
  224. @input="numberFn"
  225. type="number"
  226. label="面积(m²)"
  227. @
  228. placeholder="面积">
  229. <template #left-icon>
  230. <span class="van-f-red"> </span>
  231. </template>
  232. </van-field>
  233. <van-field
  234. v-if="fromValue.ifJzStoreType == 1"
  235. v-model="fromValue.area"
  236. @input="numberFn"
  237. type="number"
  238. label="家装展厅面积(m²)"
  239. placeholder="面积">
  240. <template #left-icon>
  241. <span class="van-f-red">*</span>
  242. </template>
  243. </van-field>
  244. </div>
  245. <van-field
  246. v-model="fromValue.contactName"
  247. v-if="fromValue.ifJzStoreType != 1 && fromValue.storeCategory != 'C917'"
  248. label="联系人"
  249. placeholder="联系人">
  250. <template #left-icon>
  251. <span class="van-f-red">*</span>
  252. </template>
  253. </van-field>
  254. <van-field
  255. v-model="fromValue.contactName"
  256. v-if="fromValue.ifJzStoreType == 1 && fromValue.storeCategory != 'C917'"
  257. label="老板"
  258. placeholder="老板">
  259. <template #left-icon>
  260. <span class="van-f-red"> </span>
  261. </template>
  262. </van-field>
  263. <van-field
  264. v-if="fromValue.storeCategory != 'C917'"
  265. type="tel"
  266. v-model="fromValue.telephone"
  267. label="联系电话"
  268. placeholder="联系电话"
  269. @blur="phoneCheck">
  270. <template #left-icon>
  271. <span class="van-f-red" v-if="fromValue.ifJzStoreType != 1">*</span>
  272. </template>
  273. </van-field>
  274. <van-field
  275. readonly
  276. v-model="fromValue.salesmanName"
  277. label="销售员"
  278. placeholder="销售员">
  279. <template #left-icon>
  280. <span class="van-f-red"> </span>
  281. </template>
  282. </van-field>
  283. <div v-if="GZAttributeFormShow" style="background-color: #ffffff; padding: 10px">
  284. <p style="color: #666"><span class="van-f-red">*</span>潜在客户类型</p>
  285. <div style="padding: 4px">
  286. <van-radio-group v-model="fromValue.potentialCustomerType" class="typeRadioStore1">
  287. <van-row gutter="20">
  288. <van-col
  289. span="12"
  290. v-for="(item, index) in potentialCustomerTypeList"
  291. :key="index"
  292. style="margin-bottom: 10px">
  293. <van-radio shape="square" :name="item.dictCode">{{ item.text }}</van-radio>
  294. </van-col>
  295. </van-row>
  296. </van-radio-group>
  297. </div>
  298. </div>
  299. <van-field label="是否车铺开店" v-if="typeABshow">
  300. <template #input>
  301. <span v-if="fromValue.carShop == 1">是</span>
  302. <span v-if="fromValue.carShop == 0">否</span>
  303. </template>
  304. <template #left-icon>
  305. <span class="van-f-red">*</span>
  306. </template>
  307. </van-field>
  308. <van-field label="车铺照片" v-if="fromValue.carShop == 1 && typeABshow">
  309. <template #left-icon>
  310. <span class="van-f-red">*</span>
  311. </template>
  312. </van-field>
  313. <div v-if="fromValue.carShop == 1 && typeABshow">
  314. <p
  315. style="
  316. color: #666;
  317. font-size: 14px;
  318. margin: 0;
  319. background-color: #fff;
  320. padding: 6px 18px;
  321. ">
  322. 注:店招及车铺产品拍在一张照片里
  323. </p>
  324. <viewUploadImg :imgs="fromValue.carShopImgList"></viewUploadImg>
  325. </div>
  326. <div v-if="fromValue.storeCategory != 'C917'">
  327. <div style="padding: 20px; height: 228px; background-color: #f1f1f1">
  328. <div class="displayImg">
  329. <div class="displayImgBox">
  330. <div v-if="storeTypePOP">
  331. <upload-img
  332. :uploadid="uploadid2"
  333. :imgArr="fromValue.img"
  334. @newimgarr="newimgarr1"
  335. :imgText="fromValue.ifJzStoreType != 1 ? '门店照' : '家装前台照片'"
  336. :type="1"></upload-img>
  337. </div>
  338. <div v-else>
  339. <upload-img
  340. :uploadid="uploadid2"
  341. :imgArr="fromValue.img"
  342. @newimgarr="newimgarr1"
  343. :imgText="fromValue.storeCategory == 'C912' ? '工地铭牌照片' : '公司照片'"
  344. :type="1"></upload-img>
  345. </div>
  346. </div>
  347. <template
  348. v-if="fromValue.ifJzStoreType != 1 && storeTypePOP && displayImg.length">
  349. <div class="displayImgBox" v-for="(urls, index) in displayImg" :key="index">
  350. <van-icon name="close" size="16" @click="deleteImg(index)" />
  351. <img :src="urls" width="99%" height="99%" @click="previewsImg(index)" />
  352. <div class="title">陈列照</div>
  353. </div>
  354. </template>
  355. <div class="displayImgBox" v-if="fromValue.ifJzStoreType != 1">
  356. <div v-if="storeTypePOP">
  357. <upload-img
  358. v-if="fromValue.ifJzStoreType != 1"
  359. :uploadid="uploadid2"
  360. imgArr=""
  361. @newimgarr="newimgarr1"
  362. imgText="陈列照(至少一张)"
  363. :type="2"
  364. :count="1"></upload-img>
  365. </div>
  366. </div>
  367. </div>
  368. </div>
  369. </div>
  370. <!-- 无效店铺,关闭店铺 -->
  371. <!-- <div class="invalid">
  372. <van-button type="warning" round @click="valid">无效关店</van-button>
  373. </div> -->
  374. </van-tab>
  375. <van-tab title="属性信息" name="Planpic">
  376. <!-- 同城分销店-属性信息 -->
  377. <div v-if="dictTypeFormShow" style="background-color: #ffffff; padding: 10px">
  378. <p style="color: #666"><span class="van-f-red">*</span>属性</p>
  379. <div style="padding: 4px">
  380. <van-radio-group v-model="fromValue.tcfxName" class="typeRadioStore1">
  381. <van-row gutter="20">
  382. <van-col
  383. span="12"
  384. v-for="(item, index) in TCFXList"
  385. :key="index"
  386. style="margin-bottom: 10px"
  387. v-if="item.remark == fromValue.storeCategory">
  388. <van-radio shape="square" :name="item.dictCode + ''">{{
  389. item.text
  390. }}</van-radio>
  391. </van-col>
  392. </van-row>
  393. </van-radio-group>
  394. </div>
  395. </div>
  396. <div v-if="dictTypeSJSFormShow" style="background-color: #ffffff; padding: 10px">
  397. <p style="color: #666"><span class="van-f-red">*</span>属性</p>
  398. <div style="padding: 4px">
  399. <van-radio-group v-model="fromValue.tcfxName" class="typeRadioStore1">
  400. <van-row gutter="20">
  401. <van-col
  402. span="12"
  403. v-for="(item, index) in SJSList"
  404. :key="index"
  405. style="margin-bottom: 10px">
  406. <van-radio shape="square" :name="item.dictCode">{{ item.text }}</van-radio>
  407. </van-col>
  408. </van-row>
  409. </van-radio-group>
  410. </div>
  411. </div>
  412. <div v-if="dictTypeAFormShow" style="background-color: #ffffff; padding: 10px">
  413. <p style="color: #666"><span class="van-f-red">*</span>属性</p>
  414. <div style="padding: 4px">
  415. <van-radio-group
  416. v-model="fromValue.attribute3"
  417. class="typeRadioStore1"
  418. @change="attrChange">
  419. <van-row gutter="20">
  420. <van-col
  421. span="12"
  422. v-for="(item, index) in brandst"
  423. :key="index"
  424. style="margin-bottom: 10px">
  425. <van-radio shape="square" :name="item.dictCode">{{ item.text }}</van-radio>
  426. </van-col>
  427. </van-row>
  428. </van-radio-group>
  429. </div>
  430. <van-field
  431. v-if="attrShow"
  432. v-model="fromValue.attribute5"
  433. label="其他品牌"
  434. placeholder="其他品牌">
  435. <template #left-icon>
  436. <span class="van-f-red">*</span>
  437. </template>
  438. </van-field>
  439. </div>
  440. <div v-if="dictTypeQGJZFormShow" style="background-color: #ffffff; padding: 10px">
  441. <p style="color: #666"><span class="van-f-red">*</span>属性</p>
  442. <div style="padding: 4px">
  443. <van-radio-group v-model="fromValue.tcfxName" class="typeRadioStore1">
  444. <van-row gutter="20">
  445. <van-col
  446. span="12"
  447. v-for="(item, index) in QGJZist"
  448. :key="index"
  449. style="margin-bottom: 10px">
  450. <van-radio shape="square" :name="item.dictCode">{{ item.text }}</van-radio>
  451. </van-col>
  452. </van-row>
  453. </van-radio-group>
  454. </div>
  455. </div>
  456. </van-tab>
  457. </van-tabs>
  458. </van-form>
  459. </div>
  460. <!--类型-->
  461. <van-popup v-model="showPicker" position="bottom">
  462. <van-picker
  463. show-toolbar
  464. :columns="storeCategoryList"
  465. value-key="dictLabel"
  466. @confirm="onConfirm"
  467. @cancel="showPicker = false" />
  468. </van-popup>
  469. <!--经销商-->
  470. <van-popup
  471. v-model="showPickerChainsList"
  472. position="bottom"
  473. class="agencyBox"
  474. :close-on-click-overlay="false">
  475. <!-- 分销店 -->
  476. <template
  477. v-if="
  478. verifyStoreType(fromValue.storeCategory) &&
  479. verifyStoreType(fromValue.storeCategory).type == 'fxd'
  480. ">
  481. <div class="header_btn">
  482. <div class="cancel" @click="showPickerChainsList = false">取消</div>
  483. <div class="confirm" @click="treeSelectConfirm">确定</div>
  484. </div>
  485. <van-tree-select
  486. :items="treeSelect"
  487. :main-active-index.sync="activeIndex"
  488. @click-nav="clickNav">
  489. <template #content>
  490. <div
  491. class="treeSelectchildren"
  492. v-if="activeIndex == index"
  493. v-for="(item, index) in treeSelect"
  494. :key="index">
  495. <div
  496. class="item"
  497. v-for="(val, ind) in item.children"
  498. :key="ind"
  499. @click="treeSelectItemClick(item, index, val, ind)">
  500. <div
  501. :class="{
  502. 'van-radio__icon': true,
  503. 'van-radio__icon--round': true,
  504. 'van-radio__icon--checked': val.Check,
  505. }">
  506. <i class="van-icon van-icon-success"></i>
  507. </div>
  508. <div class="value">{{ val.chainCode }} {{ val.chainName }}</div>
  509. </div>
  510. </div>
  511. </template>
  512. </van-tree-select>
  513. </template>
  514. <template v-else>
  515. <van-picker
  516. show-toolbar
  517. :columns="ChainsList"
  518. value-key="chainName"
  519. @confirm="onConfirmChainsList"
  520. @cancel="showPickerChainsList = false" />
  521. </template>
  522. </van-popup>
  523. <van-popup v-model="moreTypeShow" position="bottom" style="height: 80%; font-size: 14px">
  524. <van-row style="background-color: #f5f5f5">
  525. <van-col span="20">
  526. <van-field
  527. left-icon="search"
  528. style="margin-top: 2px; border-radius: 6px; overflow: hidden"
  529. v-model="chainName"
  530. label=""
  531. placeholder="请输入关键词"
  532. clearable />
  533. </van-col>
  534. <van-col
  535. span="4"
  536. style="text-align: center; line-height: 48px"
  537. @click="getChainsByDeptCodesearch">
  538. <div style="background-color: #0057ba; color: #fff">搜索</div></van-col
  539. >
  540. </van-row>
  541. <van-picker
  542. show-toolbar
  543. :columns="ChainsLists"
  544. value-key="chainName"
  545. @confirm="onConfirmChainsList"
  546. @cancel="moreTypeShow = false" />
  547. </van-popup>
  548. <van-popup v-model="showPickerDeptList" position="bottom">
  549. <van-picker
  550. show-toolbar
  551. :columns="deptList"
  552. @confirm="onDeptConfirm"
  553. @cancel="showPickerDeptList = false" />
  554. </van-popup>
  555. <!--同城类型-->
  556. <van-popup v-model="showTCFXL" position="bottom">
  557. <van-picker
  558. show-toolbar
  559. :columns="TCFXList"
  560. @confirm="onTCFXLConfirm"
  561. @cancel="showTCFXL = false" />
  562. </van-popup>
  563. <!--省、市、区、街道-->
  564. <van-popup v-model="showProvincePicker" position="bottom">
  565. <van-picker
  566. show-toolbar
  567. title="省(州)"
  568. :columns="provinceList"
  569. @confirm="onProvinceConfirm"
  570. @cancel="showProvincePicker = false" />
  571. </van-popup>
  572. <van-popup v-model="showCityPicker" position="bottom">
  573. <van-picker
  574. show-toolbar
  575. title="城市"
  576. :columns="cityList"
  577. @confirm="onCityConfirm"
  578. @cancel="showCityPicker = false" />
  579. </van-popup>
  580. <van-popup v-model="showDistrictPicker" position="bottom">
  581. <van-picker
  582. show-toolbar
  583. title="县区"
  584. :columns="districtList"
  585. @confirm="onDistrictConfirm"
  586. @cancel="showDistrictPicker = false" />
  587. </van-popup>
  588. <van-popup v-model="showTownPicker" position="bottom">
  589. <van-picker
  590. show-toolbar
  591. title="街道"
  592. :columns="townList"
  593. @confirm="onTownConfirm"
  594. @cancel="showTownPicker = false" />
  595. </van-popup>
  596. <!-- 部门数据 -->
  597. <div id="allmap"></div>
  598. <div style="position: fixed; top: 0; height: 100%; z-index: 3000; width: 100%" v-if="showmap">
  599. <div id="allmap1" style="height: 100%; width: 100%"></div>
  600. <div style="position: fixed; z-index: 99999; top: 0; width: 100%; background-color: white">
  601. <van-search
  602. v-model="search"
  603. shape="round"
  604. background="#0057ba"
  605. @input="searchFn"
  606. placeholder="请输入搜索关键词" />
  607. <div style="height: 200px; overflow: hidden" v-if="searchSHow">
  608. <div style="height: 100px; min-height: 200px; overflow-y: scroll; padding: 12px">
  609. <div
  610. v-for="(itme, index) in mapsearchlist"
  611. style="border-bottom: 1px solid #eee"
  612. @click="addressFns(itme)">
  613. <p>{{ itme.title }}</p>
  614. <p>{{ itme.address }}</p>
  615. </div>
  616. </div>
  617. </div>
  618. </div>
  619. <div class="mapaddress">
  620. <div class="title">
  621. <span @click="showmap = false" style="float: left"
  622. ><van-icon name="cross" size="16"
  623. /></span>
  624. <p class="titleText">附近地址信息</p>
  625. <span style="float: right" @click="confirmMap">确定</span>
  626. </div>
  627. <div class="listBox">
  628. <van-radio-group v-model="addresssb" @change="mapselect">
  629. <van-radio :name="index" v-for="(item, index) in maplist" :key="index">
  630. <p style="margin: 4px 0; font-weight: bold">{{ item.title }}</p>
  631. <p style="margin: 4px 0">{{ item.address }}</p>
  632. </van-radio>
  633. </van-radio-group>
  634. <br />
  635. <br />
  636. <br />
  637. <br />
  638. </div>
  639. </div>
  640. </div>
  641. </div>
  642. </template>
  643. <script>
  644. import {
  645. updateStore,
  646. beforeAdd,
  647. streetQuery,
  648. getTCFXList,
  649. getById,
  650. phoneCheck,
  651. getChainsByDeptCode,
  652. addStore,
  653. checkVisit,
  654. getSJSList,
  655. getQGJZist,
  656. getbrands,
  657. getCustomerInfoList,
  658. getCustomerNatureList,
  659. getMainProjectList,
  660. getMainRelationList,
  661. getManagementModelList,
  662. getpotentialCustomerTypeList,
  663. getDictOption,
  664. } from '@/api/index';
  665. import uploadImg from '@/components/uploadImgVStore';
  666. import uploadImgc from '@/components/uploadImgVStorec';
  667. import viewUploadImg from '@/components/viewUploadImg';
  668. import mapmarker from '@/components/mapMarker';
  669. import { jsonp } from 'vue-jsonp';
  670. import txmapimg1 from '@/assets/txmap1.svg';
  671. import txmapimg2 from '@/assets/txmap2.svg';
  672. import txmapimg3 from '@/assets/marker_blue.png';
  673. import { valid } from '@/api/visitstore';
  674. import { ImagePreview } from 'vant';
  675. import { getPosition, getTicketFun, getMapPoi, getkeywordPoi } from '@/utils/TXApiFun';
  676. import { listChainsByCategory } from '@/api/store';
  677. export default {
  678. name: 'storeAdd',
  679. components: { uploadImg, mapmarker, uploadImgc, viewUploadImg },
  680. data() {
  681. return {
  682. searchSHow: false,
  683. mapsearchlist: [],
  684. search: '',
  685. showmap: false,
  686. showDialog: false,
  687. msgList: '',
  688. tabVal: 'insidePlan',
  689. typeABshow: false,
  690. showPickerChainsList: false,
  691. showDistribute: false,
  692. showProvincePicker: false,
  693. showCityPicker: false,
  694. showDistrictPicker: false,
  695. showTownPicker: false,
  696. showPickerDeptList: false,
  697. dictTypeFormShow: false,
  698. moreTypeShow: false,
  699. typeShow: false,
  700. dictTypeSJSFormShow: false,
  701. dictTypeAFormShow: false,
  702. dictTypeQGJZFormShow: false,
  703. attrShow: false,
  704. provinceList: [],
  705. showTCFXL: false,
  706. show: false,
  707. cityList: [],
  708. deptList: [],
  709. districtList: [],
  710. cont: 0,
  711. townList: [],
  712. uploadid2: 'uploadid2',
  713. storeTypePOP: false,
  714. storeName: '名称',
  715. fromValue: {
  716. addressLine: '',
  717. chainCode: '',
  718. telephone: '',
  719. storeCategoryName: '',
  720. provinceName: '',
  721. salesmanName: '',
  722. orgName: '',
  723. lat: '',
  724. lon: '',
  725. districtName: '',
  726. contactName: '',
  727. cityName: '',
  728. cityLevel: '',
  729. potentialCustomerType: '',
  730. storeName: '',
  731. storeCategory: '',
  732. area: '',
  733. img: '',
  734. imgSed: '',
  735. townName: '',
  736. tcfxName: '',
  737. tcfxCode: '',
  738. orgId: '',
  739. carShop: '',
  740. carShopImgList: [],
  741. showroom: '',
  742. attribute3: '',
  743. attribute5: '',
  744. customerInfoFrom: '',
  745. customerNature: '',
  746. managementModel: '',
  747. mainProjectType: '',
  748. mainRelationFrom: '',
  749. },
  750. img: 'https://svs-test.oss-cn-shanghai.aliyuncs.com/1647398239620微信截图_20220315112921.png',
  751. location: {
  752. lat: '34.616712',
  753. lon: '112.440816',
  754. },
  755. checkboxGroup: [],
  756. radio: '',
  757. Radiocolumns: [
  758. { name: '1', text: '选项01' },
  759. { name: '2', text: '选项02' },
  760. ],
  761. showPicker: false,
  762. cityLeveList: [],
  763. storeTypeList: [],
  764. storeCategoryList: [],
  765. ChainsList: [],
  766. TCFXList: [],
  767. imgs: [],
  768. provinceCode: '',
  769. cityCode: '',
  770. countyCode: '',
  771. districtName: '',
  772. contactName: '',
  773. cityName: '',
  774. cityLevel: '',
  775. storeCategory: '',
  776. phoneNumber: true,
  777. sfaOrderProducts: [],
  778. deptShow: false,
  779. validFlag: '',
  780. QGJZist: [],
  781. SJSList: [],
  782. chainName: '',
  783. ChainsLists: [],
  784. address: '地址',
  785. brandst: [],
  786. maplist: [],
  787. ManagementModelList: [],
  788. MainRelationList: [],
  789. MainProjectList: [],
  790. CustomerNatureList: [],
  791. CustomerInfoList: [],
  792. potentialCustomerTypeList: [],
  793. GZAttributeFormShow: false,
  794. addresssb: -1,
  795. markers: undefined,
  796. markers1: undefined,
  797. marker: undefined,
  798. pageShow: false,
  799. map: '',
  800. pLat: '',
  801. pLot: '',
  802. displayImg: [],
  803. activeIndex: 0,
  804. treeSelectItemInd: 0,
  805. treeSelect: [],
  806. sfaStoreChainsContactList: [], //选中确定的经销商
  807. activatedTCFXList: [], //选中的经销商
  808. };
  809. },
  810. activated() {
  811. this.tabVal = 'insidePlan';
  812. this.treeSelect = [];
  813. // 授权
  814. getTicketFun(['getLocation', 'chooseImage', 'uploadImage']).then(() => {
  815. this.getTCFXList();
  816. this.getSJSList();
  817. this.getQGJZist();
  818. this.getDetail();
  819. this.getbrands();
  820. this.getStreetQuery();
  821. this.getCustomerInfoList();
  822. this.getManagementModelList();
  823. this.getMainRelationList();
  824. this.getMainProjectList();
  825. this.getCustomerNatureList();
  826. this.getpotentialCustomerTypeList();
  827. this.showmap = false;
  828. });
  829. },
  830. methods: {
  831. addressFns(val) {
  832. var that = this;
  833. setTimeout(() => {
  834. that.searchSHow = false;
  835. that.map.setCenter(new TMap.LatLng(val.location.lat, val.location.lng));
  836. that.markers1.updateGeometries([
  837. {
  838. id: 'marker',
  839. styleId: 'marker',
  840. position: new TMap.LatLng(val.location.lat, val.location.lng),
  841. },
  842. ]);
  843. that.maplist = [];
  844. // 地点搜索 获取500米范围poi点
  845. getMapPoi({ latitude: val.location.lat, longitude: val.location.lng }).then((res) => {
  846. console.log(res);
  847. that.maplist = res.data;
  848. that.marker.setGeometries([]);
  849. setTimeout(() => {
  850. for (let p = 0; p < res.data.length; p++) {
  851. that.marker.updateGeometries([
  852. {
  853. id: res.data[p].id,
  854. position: new TMap.LatLng(res.data[p].location.lat, res.data[p].location.lng),
  855. },
  856. ]);
  857. }
  858. });
  859. });
  860. that.addresssb = -1;
  861. });
  862. },
  863. searchFn(val) {
  864. this.searchSHow = false;
  865. getkeywordPoi({ latitude: this.pLat, longitude: this.pLot }, val).then((res) => {
  866. // 不显示下拉选择
  867. if (!res.data.length && !val) {
  868. this.searchSHow = false;
  869. } else {
  870. this.searchSHow = true;
  871. }
  872. // 联想下拉选
  873. this.mapsearchlist = res.data;
  874. });
  875. },
  876. mapselect(val) {
  877. this.searchSHow = false;
  878. if (val > -1) {
  879. this.markers.updateGeometries([
  880. {
  881. id: 'markers1',
  882. styleId: 'abc',
  883. position: new TMap.LatLng(
  884. this.maplist[val].location.lat,
  885. this.maplist[val].location.lng
  886. ),
  887. },
  888. ]);
  889. }
  890. },
  891. confirmMap() {
  892. if (this.addresssb > -1) {
  893. let checkedPoint = this.maplist[this.addresssb];
  894. // 坐标转换
  895. let TXisBD = this.CJ02BD(checkedPoint.location.lat, checkedPoint.location.lng);
  896. this.fromValue.addressLine = checkedPoint.address;
  897. var location = this.CJ02BD(this.pLat, this.pLot);
  898. this.fromValue.lat = location.lat;
  899. this.fromValue.lon = location.lon;
  900. this.fromValue.poiAddress = checkedPoint.address;
  901. this.fromValue.poiLat = TXisBD.lat;
  902. this.fromValue.poiLon = TXisBD.lon;
  903. this.fromValue.poiId = checkedPoint.id;
  904. this.fromValue.poiName = checkedPoint.title;
  905. }
  906. this.showmap = false;
  907. },
  908. fns() {
  909. this.search = '';
  910. getPosition()
  911. .then((res) => {
  912. let { TXisBD, resData } = res;
  913. this.pLat = resData.latitude;
  914. this.pLot = resData.longitude;
  915. if (this.fromValue.lon == '') {
  916. this.fromValue.lon = TXisBD.lon;
  917. this.fromValue.lat = TXisBD.lat;
  918. }
  919. this.showmap = true;
  920. // 地点搜索 获取500米范围poi点
  921. getMapPoi({ latitude: this.pLat, longitude: this.pLot }).then((res) => {
  922. console.log(res);
  923. this.maplist = res.data;
  924. setTimeout(() => {
  925. this.addVisits1('1');
  926. });
  927. });
  928. })
  929. .catch((error) => {
  930. this.$dialog.alert({
  931. message: error,
  932. });
  933. });
  934. this.addresssb = -1;
  935. },
  936. addVisits1(val) {
  937. var that = this;
  938. var latlng = {
  939. lat: this.pLat,
  940. lon: this.pLot,
  941. };
  942. var map = new TMap.Map('allmap1', {
  943. zoom: 15,
  944. center: new TMap.LatLng(latlng.lat, latlng.lon),
  945. });
  946. var markers = new TMap.MultiMarker({
  947. id: 'markers',
  948. map: map,
  949. geometries: [],
  950. styles: {
  951. marker: new TMap.MarkerStyle({
  952. width: 32,
  953. height: 40,
  954. anchor: { x: 16, y: 32 },
  955. src: 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/marker-pink.png',
  956. }),
  957. },
  958. });
  959. markers.setGeometries([]);
  960. var location = new TMap.LatLng(latlng.lat, latlng.lon);
  961. map.setCenter(location);
  962. markers.updateGeometries([
  963. {
  964. id: 'marker',
  965. styleId: 'marker',
  966. position: location,
  967. },
  968. ]);
  969. var marker = new TMap.MultiMarker({
  970. map: map,
  971. styles: {
  972. default: new TMap.MarkerStyle({
  973. width: 32,
  974. height: 40,
  975. anchor: {
  976. x: 17,
  977. y: 21,
  978. },
  979. src: 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/marker_blue.png',
  980. }),
  981. },
  982. geometries: [],
  983. });
  984. marker.setGeometries([]);
  985. setTimeout(() => {
  986. for (let p = 0; p < this.maplist.length; p++) {
  987. marker.updateGeometries([
  988. {
  989. id: this.maplist[p].id,
  990. position: new TMap.LatLng(this.maplist[p].location.lat, this.maplist[p].location.lng),
  991. },
  992. ]);
  993. }
  994. });
  995. var markers1 = new TMap.MultiMarker({
  996. map: map,
  997. mapgeometries: [
  998. {
  999. id: 'markers1',
  1000. position: new TMap.LatLng(0, 0),
  1001. },
  1002. ],
  1003. styles: {
  1004. abc: new TMap.MarkerStyle({
  1005. width: 32,
  1006. height: 40,
  1007. anchor: { x: 16, y: 32 },
  1008. src: txmapimg3,
  1009. }),
  1010. },
  1011. });
  1012. markers1.setGeometries([]);
  1013. this.map = map;
  1014. this.markers = markers1;
  1015. this.markers1 = markers;
  1016. this.marker = marker;
  1017. map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.SCALE);
  1018. map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.ROTATION);
  1019. map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.ZOOM);
  1020. },
  1021. addressFn() {
  1022. localStorage.setItem('locationRemark', this.fromValue.addressLine);
  1023. },
  1024. getChainsByDeptCodesearch(chainName) {
  1025. this.ChainsLists = [];
  1026. getChainsByDeptCode({
  1027. chainName: this.chainName,
  1028. cityName: this.fromValue.cityNameOld,
  1029. districtName: this.fromValue.districtNameOld,
  1030. deptId: this.fromValue.deptId,
  1031. ifJzStoreType: this.fromValue.ifJzStoreType,
  1032. storeCategory: this.fromValue.storeCategory,
  1033. }).then((res) => {
  1034. this.ChainsLists = res.data.sfaChains;
  1035. this.ChainsLists.push({});
  1036. this.ChainsLists.pop();
  1037. });
  1038. },
  1039. //
  1040. PickerDept() {
  1041. if (this.deptShow) {
  1042. this.showPickerDeptList = true;
  1043. }
  1044. },
  1045. handleSelectionChange(val) {
  1046. this.fromValue.orderProductStoreList = val;
  1047. },
  1048. getpotentialCustomerTypeList() {
  1049. getpotentialCustomerTypeList().then((res) => {
  1050. var potentialCustomerTypeList = [];
  1051. for (var t = 0; t < res.data.length; t++) {
  1052. potentialCustomerTypeList.push({
  1053. text: res.data[t].dictLabel,
  1054. dictCode: res.data[t].dictValue,
  1055. });
  1056. }
  1057. this.potentialCustomerTypeList = potentialCustomerTypeList;
  1058. });
  1059. },
  1060. getChainsByDeptCode(deptCode, ifJzStoreType) {
  1061. getChainsByDeptCode({
  1062. cityName: this.fromValue.cityName,
  1063. districtName: this.fromValue.districtName,
  1064. deptId: deptCode,
  1065. ifJzStoreType: ifJzStoreType,
  1066. storeCategory: this.fromValue.storeCategory,
  1067. }).then((res) => {
  1068. if (res.data.deptList.length == 1) {
  1069. this.fromValue.orgId = res.data.deptList[0].deptId;
  1070. this.fromValue.orgName = res.data.deptList[0].deptName;
  1071. localStorage.setItem('orgName', res.data.deptList[0].deptName);
  1072. this.ChainsList = res.data.sfaChains;
  1073. this.deptShow = false;
  1074. } else {
  1075. this.deptShow = true;
  1076. this.ChainsList = [];
  1077. var deptList = [];
  1078. for (var t1 = 0; t1 < res.data.deptList.length; t1++) {
  1079. deptList.push({
  1080. deptId: res.data.deptList[t1].deptId,
  1081. text: res.data.deptList[t1].deptName,
  1082. });
  1083. }
  1084. this.deptList = deptList;
  1085. }
  1086. var arrlist = [];
  1087. if (res.data.sfaOrderProducts != null) {
  1088. for (var n1 = 0; n1 < this.fromValue.orderProductStoreList.length; n1++) {
  1089. for (var n2 = 0; n2 < res.data.sfaOrderProducts.length; n2++) {
  1090. res.data.sfaOrderProducts[n2].storeProductId =
  1091. res.data.sfaOrderProducts[n2].orderProductId;
  1092. if (
  1093. res.data.sfaOrderProducts[n2].orderProductId ==
  1094. this.fromValue.orderProductStoreList[n1].productId
  1095. ) {
  1096. res.data.sfaOrderProducts[n2].orderNum =
  1097. this.fromValue.orderProductStoreList[n1].orderNum;
  1098. res.data.sfaOrderProducts[n2].storeProductId =
  1099. this.fromValue.orderProductStoreList[n1].storeProductId;
  1100. arrlist.push(res.data.sfaOrderProducts[n2]);
  1101. }
  1102. }
  1103. }
  1104. this.sfaOrderProducts = res.data.sfaOrderProducts;
  1105. }
  1106. });
  1107. },
  1108. getCustomerInfoList() {
  1109. getCustomerInfoList().then((res) => {
  1110. var CustomerInfoList = [];
  1111. for (var t = 0; t < res.data.length; t++) {
  1112. CustomerInfoList.push({ text: res.data[t].dictLabel, dictCode: res.data[t].dictValue });
  1113. }
  1114. this.CustomerInfoList = CustomerInfoList;
  1115. });
  1116. },
  1117. getCustomerNatureList() {
  1118. getCustomerNatureList().then((res) => {
  1119. var CustomerNatureList = [];
  1120. for (var t = 0; t < res.data.length; t++) {
  1121. CustomerNatureList.push({ text: res.data[t].dictLabel, dictCode: res.data[t].dictValue });
  1122. }
  1123. this.CustomerNatureList = CustomerNatureList;
  1124. });
  1125. },
  1126. getMainProjectList() {
  1127. getMainProjectList().then((res) => {
  1128. var MainProjectList = [];
  1129. for (var t = 0; t < res.data.length; t++) {
  1130. MainProjectList.push({ text: res.data[t].dictLabel, dictCode: res.data[t].dictValue });
  1131. }
  1132. this.MainProjectList = MainProjectList;
  1133. });
  1134. },
  1135. getMainRelationList() {
  1136. getMainRelationList().then((res) => {
  1137. var MainRelationList = [];
  1138. for (var t = 0; t < res.data.length; t++) {
  1139. MainRelationList.push({ text: res.data[t].dictLabel, dictCode: res.data[t].dictValue });
  1140. }
  1141. this.MainRelationList = MainRelationList;
  1142. });
  1143. },
  1144. getManagementModelList() {
  1145. getManagementModelList().then((res) => {
  1146. var ManagementModelList = [];
  1147. for (var t = 0; t < res.data.length; t++) {
  1148. ManagementModelList.push({
  1149. text: res.data[t].dictLabel,
  1150. dictCode: res.data[t].dictValue,
  1151. });
  1152. }
  1153. this.ManagementModelList = ManagementModelList;
  1154. });
  1155. },
  1156. getChainsByDeptId(deptCode, ifJzStoreType) {
  1157. getChainsByDeptCode({
  1158. cityName: this.fromValue.cityName,
  1159. districtName: this.fromValue.districtName,
  1160. deptId: deptCode,
  1161. ifJzStoreType: ifJzStoreType,
  1162. storeCategory: this.fromValue.storeCategory,
  1163. }).then((res) => {
  1164. this.ChainsList = res.data.sfaChains;
  1165. });
  1166. },
  1167. onDeptConfirm(value) {
  1168. this.fromValue.orgName = value.text;
  1169. localStorage.setItem('orgName', value.text);
  1170. this.fromValue.orgId = value.deptId;
  1171. this.fromValue.chainCode = '';
  1172. this.fromValue.chainName = '';
  1173. this.getChainsByDeptId(value.deptId, this.fromValue.ifJzStoreType);
  1174. this.showPickerDeptList = false;
  1175. },
  1176. setStoreNameFn() {
  1177. localStorage.setItem('chainName', this.fromValue.storeName);
  1178. },
  1179. attrChange(val) {
  1180. if (val == '0') {
  1181. this.attrShow = true;
  1182. } else {
  1183. this.attrShow = false;
  1184. this.fromValue.attribute5 = '';
  1185. }
  1186. },
  1187. getStreetQuery(type) {
  1188. var provinceCode = '';
  1189. var cityCode = '';
  1190. var countyCode = '';
  1191. if (type == '1') {
  1192. provinceCode = this.fromValue.province;
  1193. cityCode = '';
  1194. countyCode = '';
  1195. } else if (type == '2') {
  1196. provinceCode = this.fromValue.province;
  1197. cityCode = this.fromValue.city;
  1198. countyCode = '';
  1199. } else if (type == '3') {
  1200. provinceCode = this.fromValue.province;
  1201. cityCode = this.fromValue.city;
  1202. countyCode = this.fromValue.district;
  1203. } else {
  1204. provinceCode = '';
  1205. cityCode = '';
  1206. countyCode = '';
  1207. }
  1208. streetQuery({ provinceCode: provinceCode, cityCode: cityCode, countyCode: countyCode }).then(
  1209. (res) => {
  1210. var provinceList = [];
  1211. var cityList = [];
  1212. var districtList = [];
  1213. var townList = [];
  1214. if (type == '1') {
  1215. for (var z1 = 0; z1 < res.data.length; z1++) {
  1216. cityList.push({ cityCode: res.data[z1].cityCode, text: res.data[z1].cityName });
  1217. }
  1218. this.cityList = cityList;
  1219. } else if (type == '2') {
  1220. for (var z2 = 0; z2 < res.data.length; z2++) {
  1221. districtList.push({
  1222. countyCode: res.data[z2].countyCode,
  1223. text: res.data[z2].countyName,
  1224. countyLevel: res.data[z2].countyLevel,
  1225. });
  1226. }
  1227. this.districtList = districtList;
  1228. } else if (type == '3') {
  1229. for (var z3 = 0; z3 < res.data.length; z3++) {
  1230. townList.push({ townCode: res.data[z3].townCode, text: res.data[z3].townName });
  1231. }
  1232. this.townList = townList;
  1233. } else {
  1234. for (var z = 0; z < res.data.length; z++) {
  1235. provinceList.push({
  1236. provinceCode: res.data[z].provinceCode,
  1237. text: res.data[z].provinceName,
  1238. });
  1239. }
  1240. this.provinceList = provinceList;
  1241. }
  1242. }
  1243. );
  1244. },
  1245. getDetail() {
  1246. // 获取当前定位
  1247. this.getLocation();
  1248. this.phoneNumber = true;
  1249. let loading1 = this.$toast.loading({
  1250. duration: 0,
  1251. message: '加载中...',
  1252. forbidClick: true,
  1253. });
  1254. var postType = localStorage.getItem('postType');
  1255. if (postType == 'GZ') {
  1256. this.typeShow = false;
  1257. } else {
  1258. this.typeShow = true;
  1259. }
  1260. getById({ storeId: this.$route.query.id }).then((res) => {
  1261. loading1.clear();
  1262. this.validFlag = this.$route.query.validFlag;
  1263. if (res.code == 200) {
  1264. this.fromValue = res.data;
  1265. this.sfaStoreChainsContactList = this.fromValue.sfaStoreChainsContactList;
  1266. if (this.fromValue.imgSed && this.fromValue.imgSed != '') {
  1267. this.displayImg = this.fromValue.imgSed.split(',');
  1268. } else {
  1269. this.displayImg = [];
  1270. }
  1271. if (this.fromValue.lat != null) {
  1272. } else {
  1273. this.fromValue.lat = '';
  1274. this.fromValue.lon = '';
  1275. }
  1276. localStorage.setItem('locationRemark', res.data.addressLine);
  1277. localStorage.setItem('orgName', res.data.orgName);
  1278. if (
  1279. this.fromValue.potentialCustomerType != null &&
  1280. this.fromValue.potentialCustomerType != undefined
  1281. ) {
  1282. } else {
  1283. this.fromValue.potentialCustomerType = '';
  1284. }
  1285. if (this.fromValue.carShopImgList != null) {
  1286. } else {
  1287. this.fromValue.carShopImgList = [];
  1288. }
  1289. if (this.fromValue.attribute3 != null) {
  1290. } else {
  1291. this.fromValue.attribute3 = '';
  1292. }
  1293. if (this.fromValue.attribute5 != null) {
  1294. } else {
  1295. this.fromValue.attribute5 = '';
  1296. }
  1297. // this.getChainsByDeptCode(res.data.orgId)
  1298. this.getChainsByDeptCode(null, res.data.ifJzStoreType);
  1299. if (
  1300. this.verifyStoreType(this.fromValue.storeCategory) &&
  1301. this.verifyStoreType(this.fromValue.storeCategory).type == 'fxd'
  1302. ) {
  1303. this.typeABshow = true;
  1304. this.dictTypeFormShow = true;
  1305. }
  1306. // if (this.fromValue.storeCategory == '129081') {
  1307. // this.dictTypeAFormShow = true;
  1308. // }
  1309. // if (this.fromValue.storeCategory == '10131') {
  1310. // this.dictTypeFormShow = true;
  1311. // }
  1312. if (this.fromValue.attribute3 == '0') {
  1313. this.attrShow = true;
  1314. }
  1315. if (this.fromValue.storeCategory == 'sjs61') {
  1316. this.dictTypeSJSFormShow = true;
  1317. }
  1318. if (this.fromValue.storeCategory == 'zyjz63') {
  1319. this.dictTypeQGJZFormShow = true;
  1320. } else {
  1321. this.dictTypeQGJZFormShow = false;
  1322. }
  1323. if (this.fromValue.storeCategory == 'C912') {
  1324. this.storeTypePOP = false;
  1325. this.storeName = '铭牌上项目名称';
  1326. this.address = '地址';
  1327. } else if (this.fromValue.storeCategory == 'C917') {
  1328. this.storeTypePOP = false;
  1329. this.storeName = '名称';
  1330. this.address = '地址';
  1331. } else {
  1332. this.storeTypePOP = true;
  1333. this.storeName = '名称';
  1334. this.address = '地址';
  1335. }
  1336. if (this.fromValue.storeCategory == 'C917') {
  1337. this.GZAttributeFormShow = true;
  1338. this.dictTypeSJSFormShow = false;
  1339. this.dictTypeQGJZFormShow = false;
  1340. this.dictTypeFormShow = false;
  1341. this.dictTypeAFormShow = false;
  1342. this.typeABshow = false;
  1343. } else {
  1344. this.GZAttributeFormShow = false;
  1345. }
  1346. localStorage.setItem('chainName', res.data.storeName);
  1347. this.getStreetQuery();
  1348. this.getStreetQuery('1');
  1349. this.getStreetQuery('2');
  1350. this.getStreetQuery('3');
  1351. this.beforeAddFn(res.data.ifJzStoreType);
  1352. } else {
  1353. this.$toast.fail(res.msg);
  1354. }
  1355. });
  1356. },
  1357. newimgarr1(val) {
  1358. if (val.type == '1') {
  1359. this.fromValue.img = val.fileUrl;
  1360. } else if (val.type == '2') {
  1361. // this.fromValue.imgSed = val.fileUrl;
  1362. this.displayImg.push(val.fileUrl);
  1363. } else {
  1364. this.fromValue.carShopImgList.push(val.fileUrl);
  1365. }
  1366. },
  1367. // 关闭无效店铺
  1368. valid() {
  1369. this.$dialog
  1370. .confirm({
  1371. title: '系统提示',
  1372. message: '是否确认无效关店?',
  1373. })
  1374. .then(() => {
  1375. this.toastLoading();
  1376. valid({ storeId: this.$route.query.id }).then((res) => {
  1377. this.toastLoading().clear();
  1378. if (res.code == 200) {
  1379. this.$router.go(-2);
  1380. } else {
  1381. this.Toast({
  1382. message: res.msg,
  1383. duration: 3000,
  1384. });
  1385. }
  1386. });
  1387. });
  1388. },
  1389. beforeAddFn(ifJzStoreType) {
  1390. beforeAdd({
  1391. cityName: this.fromValue.cityName,
  1392. districtName: this.fromValue.districtName,
  1393. ifJzStoreType: ifJzStoreType,
  1394. storeId: this.$route.query.id,
  1395. }).then((res) => {
  1396. this.storeCategoryList = res.data.storeCategoryList;
  1397. });
  1398. },
  1399. getbrands() {
  1400. getbrands({}).then((res) => {
  1401. var brandst = [];
  1402. for (var t = 0; t < res.data.length; t++) {
  1403. brandst.push({ text: res.data[t].dictLabel, dictCode: res.data[t].dictValue });
  1404. }
  1405. this.brandst = brandst;
  1406. });
  1407. },
  1408. addVisits2() {
  1409. var that = this;
  1410. var map = new TMap.Map('allmap', {
  1411. zoom: 15,
  1412. center: new TMap.LatLng(39.986785, 116.301012),
  1413. });
  1414. var geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
  1415. var markers = new TMap.MultiMarker({
  1416. map: map,
  1417. geometries: [],
  1418. });
  1419. markers.setGeometries([]);
  1420. var latlng = this.gcj02BD(this.fromValue.lat, this.fromValue.lon);
  1421. var location = new TMap.LatLng(latlng.lat, latlng.lon);
  1422. map.setCenter(location);
  1423. markers.updateGeometries([
  1424. {
  1425. id: 'marker',
  1426. position: location,
  1427. },
  1428. ]);
  1429. geocoder.getAddress({ location: location }).then(function (result) {
  1430. var addresses = result.result.formatted_addresses;
  1431. (that.cityName = result.result.ad_info.city),
  1432. (that.districtName = result.result.ad_info.district),
  1433. (that.provinceName = result.result.ad_info.province),
  1434. (that.addressLine = addresses.recommend);
  1435. localStorage.setItem('locationRemark', addresses.recommend);
  1436. localStorage.setItem('address', addresses.recommend);
  1437. that.beforeAddFn();
  1438. });
  1439. },
  1440. getLocation() {
  1441. getPosition()
  1442. .then((res) => {
  1443. let { TXisBD } = res;
  1444. this.location = TXisBD;
  1445. this.fromValue.lat = TXisBD.lat;
  1446. this.fromValue.lon = TXisBD.lon;
  1447. })
  1448. .catch((error) => {
  1449. this.$dialog.alert({
  1450. message: error,
  1451. });
  1452. });
  1453. },
  1454. showPickerChainsListFn() {
  1455. if (this.fromValue.storeCategoryName == '') {
  1456. this.$toast('类型未选择');
  1457. return;
  1458. } else if (this.fromValue.orgName == '') {
  1459. this.$toast('部门未选择');
  1460. return;
  1461. } else {
  1462. // 分销店
  1463. if (
  1464. this.verifyStoreType(this.fromValue.storeCategory) &&
  1465. this.verifyStoreType(this.fromValue.storeCategory).type == 'fxd'
  1466. ) {
  1467. this.getStoreChainsContact();
  1468. } else {
  1469. this.showPickerChainsList = true;
  1470. }
  1471. }
  1472. },
  1473. // 同城分销-属性信息
  1474. getTCFXList() {
  1475. getTCFXList({}).then((res) => {
  1476. var TCFXList = [];
  1477. for (var t = 0; t < res.data.length; t++) {
  1478. TCFXList.push({
  1479. text: res.data[t].dictLabel,
  1480. dictCode: res.data[t].dictValue,
  1481. remark: res.data[t].remark,
  1482. });
  1483. }
  1484. this.TCFXList = TCFXList;
  1485. });
  1486. },
  1487. getSJSList() {
  1488. getSJSList({}).then((res) => {
  1489. var SJSList = [];
  1490. for (var t = 0; t < res.data.length; t++) {
  1491. SJSList.push({ text: res.data[t].dictLabel, dictCode: res.data[t].dictValue });
  1492. }
  1493. this.SJSList = SJSList;
  1494. });
  1495. },
  1496. getQGJZist() {
  1497. getQGJZist({}).then((res) => {
  1498. var QGJZist = [];
  1499. for (var t = 0; t < res.data.length; t++) {
  1500. QGJZist.push({ text: res.data[t].dictLabel, dictCode: res.data[t].dictValue });
  1501. }
  1502. this.QGJZist = QGJZist;
  1503. });
  1504. },
  1505. onProvinceConfirm(value) {
  1506. this.fromValue.provinceName = value.text;
  1507. this.fromValue.province = value.provinceCode;
  1508. this.fromValue.cityName = '';
  1509. this.fromValue.city = '';
  1510. this.fromValue.districtName = '';
  1511. this.fromValue.district = '';
  1512. this.fromValue.townName = '';
  1513. this.fromValue.townCode = '';
  1514. this.countyCode = '';
  1515. this.cityCode = '';
  1516. this.provinceCode = value.provinceCode;
  1517. this.getStreetQuery('1');
  1518. this.showProvincePicker = false;
  1519. },
  1520. onCityConfirm(value) {
  1521. this.fromValue.cityName = value.text;
  1522. this.fromValue.city = value.cityCode;
  1523. this.fromValue.districtName = '';
  1524. this.fromValue.district = '';
  1525. this.fromValue.townName = '';
  1526. this.fromValue.townCode = '';
  1527. this.countyCode = '';
  1528. this.cityCode = value.cityCode;
  1529. this.getStreetQuery('2');
  1530. this.showCityPicker = false;
  1531. },
  1532. onDistrictConfirm(value) {
  1533. this.fromValue.districtName = value.text;
  1534. this.fromValue.district = value.countyCode;
  1535. this.fromValue.townName = '';
  1536. this.fromValue.townCode = '';
  1537. this.countyCode = value.countyCode;
  1538. this.fromValue.cityLevel = value.countyLevel;
  1539. this.getStreetQuery('3');
  1540. this.showDistrictPicker = false;
  1541. },
  1542. onTownConfirm(value) {
  1543. this.fromValue.townName = value.text;
  1544. this.fromValue.townCode = value.townCode;
  1545. this.showTownPicker = false;
  1546. },
  1547. onTCFXLConfirm(value) {
  1548. this.fromValue.tcfxName = value.text;
  1549. this.fromValue.tcfxCode = value.dictCode;
  1550. this.showTCFXL = false;
  1551. },
  1552. moreTypeShowFn() {
  1553. if (this.fromValue.storeCategoryName == '') {
  1554. this.$toast('类型未选择');
  1555. return;
  1556. } else if (this.fromValue.orgName == '') {
  1557. this.$toast('部门未选择');
  1558. return;
  1559. } else {
  1560. this.ChainsLists = [];
  1561. this.moreTypeShow = true;
  1562. }
  1563. },
  1564. onConfirm(value) {
  1565. // || value.dictValue == "129081" ||value.dictValue == "10131"
  1566. this.fromValue.storeCategoryName = value.text;
  1567. this.fromValue.storeCategory = value.dictValue;
  1568. if (
  1569. this.verifyStoreType(this.fromValue.storeCategory) &&
  1570. this.verifyStoreType(this.fromValue.storeCategory).type == 'fxd'
  1571. ) {
  1572. this.typeABshow = true;
  1573. this.dictTypeFormShow = true;
  1574. } else {
  1575. this.typeABshow = false;
  1576. this.fromValue.carShop = '';
  1577. this.fromValue.carShopImgList = [];
  1578. this.fromValue.tcfxName = '';
  1579. this.fromValue.tcfxCode = '';
  1580. this.dictTypeFormShow = false;
  1581. }
  1582. // if (value.dictValue == '129081') {
  1583. // this.dictTypeAFormShow = true;
  1584. // } else {
  1585. // this.fromValue.tcfxName = '';
  1586. // this.fromValue.tcfxCode = '';
  1587. // this.dictTypeAFormShow = false;
  1588. // }
  1589. if (value.dictValue == 'C917') {
  1590. this.GZAttributeFormShow = true;
  1591. this.dictTypeSJSFormShow = false;
  1592. this.dictTypeQGJZFormShow = false;
  1593. this.dictTypeFormShow = false;
  1594. this.dictTypeAFormShow = false;
  1595. this.typeABshow = false;
  1596. } else {
  1597. this.fromValue.tcfxName = '';
  1598. this.fromValue.tcfxCode = '';
  1599. this.GZAttributeFormShow = false;
  1600. }
  1601. // if (value.dictValue == '10131') {
  1602. // this.dictTypeFormShow = true;
  1603. // } else {
  1604. // this.fromValue.tcfxName = '';
  1605. // this.fromValue.tcfxCode = '';
  1606. // this.dictTypeFormShow = false;
  1607. // }
  1608. if (value.dictValue == 'sjs61') {
  1609. this.dictTypeSJSFormShow = true;
  1610. } else {
  1611. this.fromValue.tcfxName = '';
  1612. this.fromValue.tcfxCode = '';
  1613. this.dictTypeSJSFormShow = false;
  1614. }
  1615. if (value.dictValue == 'zyjz63') {
  1616. this.dictTypeQGJZFormShow = true;
  1617. } else {
  1618. this.fromValue.tcfxName = '';
  1619. this.fromValue.tcfxCode = '';
  1620. this.dictTypeQGJZFormShow = false;
  1621. }
  1622. if (this.fromValue.ifJzStoreType == 1 && value.ifJzStoreType != 1) {
  1623. this.$toast('家装公司不能变为同城店');
  1624. return;
  1625. } else if (this.fromValue.ifJzStoreType != 1 && value.ifJzStoreType == 1) {
  1626. this.$toast('同城店不能变为家装公司');
  1627. return;
  1628. } else {
  1629. this.fromValue.chainName = '';
  1630. this.fromValue.chainCode = '';
  1631. this.fromValue.orgName = '';
  1632. this.fromValue.orgId = '';
  1633. this.fromValue.storeCategoryName = value.dictLabel;
  1634. this.fromValue.storeCategory = value.dictValue;
  1635. this.fromValue.ifJzStoreType = value.ifJzStoreType;
  1636. this.getChainsByDeptCode(null, value.ifJzStoreType);
  1637. // 切换门店类型删除选定经销商
  1638. this.treeSelect = [];
  1639. this.sfaStoreChainsContactList = []; //选中确定的经销商
  1640. this.activatedTCFXList = []; //选中的经销商
  1641. this.showPicker = false;
  1642. }
  1643. if (value.dictValue == 'C912') {
  1644. this.storeTypePOP = false;
  1645. this.storeName = '铭牌上项目名称';
  1646. this.address = '地址';
  1647. } else if (value.dictValue == 'C917') {
  1648. this.storeTypePOP = false;
  1649. this.storeName = '名称';
  1650. this.address = '地址';
  1651. } else {
  1652. this.storeTypePOP = true;
  1653. this.storeName = '名称';
  1654. this.address = '地址';
  1655. }
  1656. },
  1657. onConfirmChainsList(value) {
  1658. this.fromValue.chainName = value.chainName;
  1659. this.fromValue.chainCode = value.chainCode;
  1660. this.showPickerChainsList = false;
  1661. this.moreTypeShow = false;
  1662. },
  1663. numberFn() {
  1664. if (Number(this.fromValue.area) < 1) {
  1665. this.fromValue.area = '';
  1666. } else {
  1667. this.fromValue.area = this.fromValue.area.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1');
  1668. }
  1669. },
  1670. onSubmit() {
  1671. this.fromValue.imgSed = this.displayImg.join(',');
  1672. for (var n1 = 0; n1 < this.fromValue.orderProductStoreList.length; n1++) {
  1673. for (var n2 = 0; n2 < this.sfaOrderProducts.length; n2++) {
  1674. if (
  1675. this.sfaOrderProducts[n2].storeProductId ==
  1676. this.fromValue.orderProductStoreList[n1].storeProductId
  1677. ) {
  1678. this.fromValue.orderProductStoreList[n1].orderNum = this.sfaOrderProducts[n2].orderNum;
  1679. }
  1680. }
  1681. }
  1682. var fromValue = this.fromValue;
  1683. var telrg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
  1684. if (fromValue.orgId == '') {
  1685. this.$toast('部门未选择');
  1686. return;
  1687. } else if (fromValue.storeName == '') {
  1688. if (fromValue.storeCategory == 'C912') {
  1689. this.$toast('铭牌上项目名称未填写');
  1690. } else if (fromValue.storeCategory == 'C917') {
  1691. this.$toast('名称未填写');
  1692. } else {
  1693. this.$toast('名称未填写');
  1694. }
  1695. return;
  1696. } else if (fromValue.addressLine == '') {
  1697. if (fromValue.storeCategory == 'C912') {
  1698. this.$toast('地址未填写');
  1699. } else if (fromValue.storeCategory == 'C917') {
  1700. this.$toast('地址未填写');
  1701. } else {
  1702. this.$toast('地址未填写');
  1703. }
  1704. return;
  1705. } else if (fromValue.storeCategoryName == '') {
  1706. this.$toast('类型未填写');
  1707. return;
  1708. } else if (fromValue.provinceName == '') {
  1709. this.$toast('所在省份未填写');
  1710. return;
  1711. } else if (fromValue.cityName == '') {
  1712. this.$toast('所在城市未填写');
  1713. return;
  1714. } else if (fromValue.districtName == '') {
  1715. this.$toast('所在县区未填写');
  1716. return;
  1717. } else if (fromValue.townName == '') {
  1718. this.$toast('所在街道未填写');
  1719. return;
  1720. } else if (
  1721. fromValue.contactName == '' &&
  1722. fromValue.ifJzStoreType != 1 &&
  1723. fromValue.storeCategory != 'C917'
  1724. ) {
  1725. this.$toast('联系人未填写');
  1726. return;
  1727. } else if (
  1728. fromValue.telephone.trim() == '' &&
  1729. fromValue.ifJzStoreType != 1 &&
  1730. fromValue.storeCategory != 'C917'
  1731. ) {
  1732. this.$toast('联系电话未填写');
  1733. return;
  1734. } else if (
  1735. !telrg.test(fromValue.telephone) &&
  1736. fromValue.ifJzStoreType != 1 &&
  1737. fromValue.storeCategory != 'C917'
  1738. ) {
  1739. this.$toast('手机号格式错误');
  1740. return;
  1741. } else if (
  1742. !this.phoneNumber &&
  1743. fromValue.ifJzStoreType != 1 &&
  1744. fromValue.storeCategory != 'C917'
  1745. ) {
  1746. this.$toast('不能填写业务员手机号');
  1747. return;
  1748. } else if (fromValue.img == '' && fromValue.storeCategory != 'C917') {
  1749. if (this.storeTypePOP) {
  1750. if (fromValue.ifJzStoreType != 1) {
  1751. this.$toast('图片未上传');
  1752. } else {
  1753. this.$toast('家装前台照片未上传');
  1754. }
  1755. } else {
  1756. this.$toast('照片未上传');
  1757. }
  1758. return;
  1759. } else if (
  1760. (fromValue.storeCategory == 'sjs61' || fromValue.storeCategory == 'zyjz63') &&
  1761. fromValue.tcfxName == ''
  1762. ) {
  1763. this.$toast('属性未填写');
  1764. return;
  1765. }
  1766. if (fromValue.area.trim() == '' && fromValue.ifJzStoreType == 1) {
  1767. this.$toast('家装展厅面积未填写');
  1768. return;
  1769. }
  1770. if (this.GZAttributeFormShow && fromValue.potentialCustomerType == '') {
  1771. this.$toast('潜在客户类型未填写');
  1772. return;
  1773. }
  1774. // 同城分销类型门店
  1775. if (
  1776. this.verifyStoreType(this.fromValue.storeCategory) &&
  1777. this.verifyStoreType(this.fromValue.storeCategory).type == 'fxd'
  1778. ) {
  1779. // 同城分销多经销商
  1780. this.fromValue.sfaStoreChainsContactList = this.sfaStoreChainsContactList;
  1781. if (!this.fromValue.sfaStoreChainsContactList.length) {
  1782. this.$toast('经销商未填写');
  1783. return;
  1784. }
  1785. if (fromValue.tcfxName == '') {
  1786. this.$toast('属性未填写');
  1787. return;
  1788. }
  1789. } else {
  1790. // 非同城分销店 经销商必填校验
  1791. if (
  1792. fromValue.chainName == '' &&
  1793. fromValue.ifJzStoreType != 1 &&
  1794. fromValue.storeCategory != 'C912' &&
  1795. fromValue.storeCategory != 'C917'
  1796. ) {
  1797. this.$toast('经销商未选择');
  1798. return;
  1799. }
  1800. if (
  1801. fromValue.imgSed == '' &&
  1802. fromValue.ifJzStoreType != 1 &&
  1803. this.storeTypePOP &&
  1804. fromValue.storeCategory != 'C917'
  1805. ) {
  1806. this.$toast('图片未上传');
  1807. return;
  1808. }
  1809. }
  1810. let loading1 = this.$toast.loading({
  1811. duration: 0,
  1812. message: '加载中...',
  1813. forbidClick: true,
  1814. });
  1815. // 当前定位复制
  1816. this.fromValue.myLat = this.location.lat;
  1817. this.fromValue.myLon = this.location.lon;
  1818. console.log(this.fromValue);
  1819. updateStore(this.fromValue).then((res) => {
  1820. loading1.clear();
  1821. if (res.code == 200) {
  1822. this.$dialog
  1823. .alert({
  1824. title: '系统提示',
  1825. message: res.msg,
  1826. })
  1827. .then(() => {
  1828. this.$router.go(-1);
  1829. });
  1830. } else {
  1831. this.$dialog.alert({
  1832. message: res.msg,
  1833. messageAlign: 'left',
  1834. });
  1835. }
  1836. });
  1837. },
  1838. onClickLeft() {
  1839. this.$router.go(-1);
  1840. },
  1841. phoneCheck() {
  1842. if (this.fromValue.ifJzStoreType != 1) {
  1843. var telrg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
  1844. if (this.fromValue.telephone.trim() == '') {
  1845. return;
  1846. } else if (!telrg.test(this.fromValue.telephone)) {
  1847. this.$toast('手机号格式错误');
  1848. return;
  1849. } else {
  1850. phoneCheck({ phoneNumber: this.fromValue.telephone }).then((res) => {
  1851. if (res.code == 200) {
  1852. this.phoneNumber = true;
  1853. } else {
  1854. this.phoneNumber = false;
  1855. }
  1856. });
  1857. }
  1858. }
  1859. },
  1860. // 陈列照 图片删除
  1861. deleteImg(index) {
  1862. this.displayImg.splice(index, 1);
  1863. },
  1864. // 预览
  1865. previewsImg(index) {
  1866. var arrimg = [];
  1867. for (var imgi = 0; imgi < this.displayImg.length; imgi++) {
  1868. arrimg.push(this.displayImg[imgi]);
  1869. }
  1870. ImagePreview({
  1871. images: arrimg,
  1872. startPosition: index,
  1873. });
  1874. },
  1875. //获取经销商
  1876. async getStoreChainsContact() {
  1877. // 打开select,上次选中确认数据赋值给选中待确认,回显使用
  1878. this.activatedTCFXList = JSON.parse(JSON.stringify(this.sfaStoreChainsContactList));
  1879. if (!this.treeSelect.length) {
  1880. this.toastLoading(0, '加载中...', true);
  1881. listChainsByCategory({ orgId: this.fromValue.orgId }).then((res) => {
  1882. this.toastLoading().clear();
  1883. // 初始化数据
  1884. res.data.forEach((val) => {
  1885. val.dot = false;
  1886. });
  1887. this.showPickerChainsList = true;
  1888. this.treeSelect = res.data;
  1889. this.setCheckData();
  1890. });
  1891. } else {
  1892. this.showPickerChainsList = true;
  1893. this.setCheckData();
  1894. }
  1895. },
  1896. setCheckData() {
  1897. for (let x = 0; x < this.treeSelect.length; x++) {
  1898. // 设置左侧选中图标
  1899. let activate = this.activatedTCFXList.find((item) => {
  1900. return item.categoryCode == this.treeSelect[x].code;
  1901. });
  1902. this.treeSelect[x].dot = activate ? true : false;
  1903. // 右侧选中返现
  1904. let children = this.treeSelect[x].children;
  1905. if (children && this.treeSelect[x].dot) {
  1906. for (let y = 0; y < children.length; y++) {
  1907. let activate = this.activatedTCFXList.find((item) => {
  1908. return (
  1909. children[y].categoryCode == item.categoryCode &&
  1910. children[y].chainCode == item.chainCode
  1911. );
  1912. });
  1913. if (activate) {
  1914. children[y].Check = true;
  1915. } else {
  1916. children[y].Check = false;
  1917. }
  1918. }
  1919. }
  1920. }
  1921. this.$forceUpdate();
  1922. this.activeIndex = 0;
  1923. },
  1924. // 左侧数据点击
  1925. clickNav(index) {
  1926. // this.treeSelect[index].children.forEach((val) => {
  1927. // // 回显右侧选中
  1928. // let activate = this.activatedTCFXList.find((item) => item.code == val.code);
  1929. // val.Check = activate ? true : false;
  1930. // });
  1931. },
  1932. // 右侧数据点击
  1933. treeSelectItemClick(itemData, index, val, ind) {
  1934. itemData.children.forEach((item) => {
  1935. if (val.chainCode == item.chainCode) {
  1936. item.Check = !item.Check;
  1937. // 设置左侧选中图标
  1938. itemData.dot = item.Check;
  1939. } else {
  1940. item.Check = false;
  1941. }
  1942. });
  1943. this.$forceUpdate();
  1944. },
  1945. // 分销店 确认
  1946. treeSelectConfirm() {
  1947. let treeSelectArr = [];
  1948. this.treeSelect.forEach((item) => {
  1949. if (item.dot) {
  1950. let childrenData = item.children.find((val) => val.Check);
  1951. treeSelectArr.push(childrenData);
  1952. }
  1953. });
  1954. if (!treeSelectArr.length) {
  1955. this.$toast('请选择至少选择一个经销商');
  1956. return false;
  1957. }
  1958. console.log(treeSelectArr);
  1959. this.sfaStoreChainsContactList = treeSelectArr;
  1960. this.showPickerChainsList = false;
  1961. },
  1962. },
  1963. };
  1964. </script>
  1965. <style scoped lang="scss">
  1966. .myTab .van-tabs__nav--card {
  1967. margin: 0 !important;
  1968. border-left: 0;
  1969. border-right: 0;
  1970. }
  1971. .myTab .van-tabs__wrap,
  1972. .myTab .van-tabs__nav--card {
  1973. height: 40px;
  1974. }
  1975. .myTab .van-tab {
  1976. line-height: 40px;
  1977. }
  1978. .van-f-red {
  1979. color: red;
  1980. width: 4px;
  1981. display: inline-block;
  1982. }
  1983. .storeEdit {
  1984. .invalid {
  1985. display: flex;
  1986. justify-content: center;
  1987. padding-bottom: 10px;
  1988. .van-button {
  1989. width: 70%;
  1990. }
  1991. }
  1992. }
  1993. .displayImg {
  1994. overflow: hidden;
  1995. .displayImgBox {
  1996. position: relative;
  1997. width: 48%;
  1998. padding: 20px 0;
  1999. height: 210px;
  2000. float: left;
  2001. margin-right: 4%;
  2002. .title {
  2003. text-align: center;
  2004. padding: 5px 0;
  2005. }
  2006. }
  2007. .displayImgBox:nth-child(even) {
  2008. margin-right: 0;
  2009. }
  2010. i {
  2011. position: absolute;
  2012. right: 4px;
  2013. color: white;
  2014. background: red;
  2015. overflow: hidden;
  2016. border-radius: 50%;
  2017. }
  2018. }
  2019. </style>
  2020. <style lang="scss">
  2021. #allmap {
  2022. width: 100px;
  2023. height: 100px;
  2024. position: fixed;
  2025. left: -2000px;
  2026. }
  2027. .van-dialog__confirm,
  2028. .van-dialog__confirm:active {
  2029. color: #0057ba;
  2030. }
  2031. .navBarTOP {
  2032. position: fixed;
  2033. width: 100%;
  2034. z-index: 2;
  2035. top: 0;
  2036. }
  2037. .typeRadioStore .van-radio {
  2038. margin: 10px;
  2039. }
  2040. .typeRadioStore .van-radio__icon .van-icon {
  2041. border: 0 !important;
  2042. }
  2043. .typeRadioStore .van-radio__icon--checked .van-icon {
  2044. color: #1989fa;
  2045. background-color: transparent;
  2046. border-color: transparent;
  2047. }
  2048. .typeRadioStore .van-cell {
  2049. padding: 0 16px;
  2050. line-height: 40px;
  2051. }
  2052. .container .typeRadioStore .van-cell__title {
  2053. height: 40px;
  2054. }
  2055. .typeRadioStore1 .van-radio__icon .van-icon {
  2056. border-radius: 2px;
  2057. border-color: #ccc !important;
  2058. }
  2059. .typeRadioStore1 .van-radio__icon--checked .van-icon {
  2060. background-color: transparent;
  2061. color: #1989fa;
  2062. border-color: #1989fa !important;
  2063. }
  2064. .typeRadioStore1 .van-radio[aria-checked='true'] .van-radio__label {
  2065. color: #1989fa;
  2066. }
  2067. .morelaji .van-cell {
  2068. padding: 10px 0;
  2069. }
  2070. .storeEdit {
  2071. .agencyBox {
  2072. .header_btn {
  2073. display: flex;
  2074. align-items: center;
  2075. justify-content: space-between;
  2076. padding: 10px;
  2077. font-size: 16px;
  2078. border-bottom: 1px solid #ccc;
  2079. div {
  2080. padding: 3px;
  2081. }
  2082. }
  2083. .van-sidebar {
  2084. width: 100px;
  2085. text-align: center;
  2086. flex: none;
  2087. }
  2088. .treeSelectchildren {
  2089. .item {
  2090. display: flex;
  2091. align-items: center;
  2092. padding: 5px;
  2093. .value {
  2094. margin-left: 15px;
  2095. }
  2096. }
  2097. }
  2098. }
  2099. .TCFXList {
  2100. .van-field__control--custom {
  2101. flex-direction: column;
  2102. align-items: self-start;
  2103. .sfaStoreChainsContactList {
  2104. padding: 3px;
  2105. }
  2106. }
  2107. }
  2108. }
  2109. </style>