storeAdd.vue 77 KB

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