storeAdd.vue 72 KB

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