storeEdit.vue 68 KB

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