storeAdd.vue 72 KB

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