storeAdd.vue 73 KB

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