storeEdit.vue 73 KB

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