storeAdd.vue 79 KB

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