storeAdd.vue 73 KB

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