storeAdd.vue 73 KB

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