auxiliarySalesOrderDetail.vue 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346
  1. <template>
  2. <div class="s-page">
  3. <el-page-header @back="goBack" :content="title"></el-page-header>
  4. <el-divider></el-divider>
  5. <el-card class="box-card">
  6. <div slot="header" class="clearfix">
  7. <span>单据信息</span>
  8. </div>
  9. <div class="mymain-container">
  10. <el-form ref="formData" :rules="rules" :model="formData" label-width="110px" size="small" label-position="left">
  11. <el-row :gutter="20" justify="start">
  12. <el-col :span="8" v-if="id">
  13. <el-form-item label="单据状态">
  14. <el-input
  15. type="text"
  16. :value="
  17. formData.flag == 'SAVE'
  18. ? '已保存'
  19. : formData.flag == 'SUBMIT'
  20. ? '已提交'
  21. : formData.flag == 'CANCEL'
  22. ? '取消订单'
  23. : formData.flag == 'PAY_NOT_TAKE'
  24. ? '已支付,未提货'
  25. : formData.flag == 'PAY_TAKE'
  26. ? '已支付,已提货'
  27. : ''
  28. "
  29. disabled
  30. ></el-input>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="8" v-if="id">
  34. <el-form-item label="单据编号">
  35. <el-input type="text" :value="formData.salesId" disabled></el-input>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :span="16">
  39. <el-form-item label="网点名称" prop="websitId">
  40. <el-select
  41. clearable
  42. filterable
  43. v-model="formData.websit"
  44. :disabled="formData.flag != 'SAVE' && formType != 0"
  45. value-key="websitId"
  46. @change="changeWebsit"
  47. placeholder="请选择"
  48. style="width: 100%"
  49. >
  50. <el-option
  51. v-for="item in websitList"
  52. :key="item.websitId"
  53. :label="`(${item.websitId})${item.name}`"
  54. :value="item"
  55. >
  56. </el-option>
  57. </el-select>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="8">
  61. <el-form-item label="购买方" :required="true" style="padding-bottom: 1px">
  62. <el-radio-group
  63. v-model="formData.buyPeople"
  64. @change="
  65. formData.workerName = ''
  66. formData.workerMobile = ''
  67. "
  68. >
  69. <el-radio
  70. :disabled="(formData.flag != 'SAVE' && formType != 0) || formData.salesType == '工程'"
  71. label="WORKER"
  72. >内部师傅</el-radio
  73. >
  74. <el-radio
  75. :disabled="(formData.flag != 'SAVE' && formType != 0) || formData.salesType == '工程'"
  76. label="CUSTOMER"
  77. >客户</el-radio
  78. >
  79. </el-radio-group>
  80. </el-form-item>
  81. </el-col>
  82. <template v-if="formData.buyPeople == 'CUSTOMER'">
  83. <el-col :span="8">
  84. <el-form-item label="客户姓名" prop="workerName">
  85. <el-input
  86. type="text"
  87. :disabled="formData.flag != 'SAVE' && formType != 0"
  88. v-model="formData.workerName"
  89. placeholder="请输入"
  90. ></el-input>
  91. </el-form-item>
  92. </el-col>
  93. <el-col :span="8">
  94. <el-form-item label="客户联系电话" prop="workerMobile">
  95. <el-input
  96. type="text"
  97. :disabled="formData.flag != 'SAVE' && formType != 0"
  98. v-model="formData.workerMobile"
  99. placeholder="请输入"
  100. ></el-input>
  101. </el-form-item>
  102. </el-col>
  103. </template>
  104. <template v-else>
  105. <el-col :span="8">
  106. <el-form-item label="师傅姓名" prop="worker">
  107. <el-select
  108. v-model="formData.worker"
  109. :disabled="formData.flag != 'SAVE' && formType != 0"
  110. value-key="nickName"
  111. @focus="
  112. () => {
  113. if (!this.formData.websitId) {
  114. return this.$message.warning('请先选择网点名称!')
  115. }
  116. }
  117. "
  118. filterable
  119. @change="changeWorker"
  120. @blur="workerBlur"
  121. placeholder="请选择"
  122. style="width: 100%"
  123. >
  124. <el-option
  125. v-for="item in workerList"
  126. :key="item.workerNumber"
  127. :label="item.nickName + '-' + item.mobile"
  128. :value="item"
  129. >
  130. </el-option>
  131. </el-select>
  132. </el-form-item>
  133. </el-col>
  134. <!-- <el-col :span="8">
  135. <el-form-item label="师傅身份证" prop="identity" :required="true">
  136. <el-input type="text" :disabled="formData.flag != 'SAVE' && formType!=0" v-model="formData.identity" placeholder="请输入"></el-input>
  137. </el-form-item>
  138. </el-col> -->
  139. <el-col :span="8">
  140. <el-form-item label="师傅联系电话" prop="workerMobile">
  141. <el-input
  142. type="text"
  143. :disabled="formData.flag != 'SAVE' && formType != 0"
  144. v-model="formData.workerMobile"
  145. placeholder="请输入"
  146. ></el-input>
  147. </el-form-item>
  148. </el-col>
  149. </template>
  150. <!-- <el-col :span="8">
  151. <el-form-item label="销售类型" :required="true" style="padding-bottom: 1px">
  152. <el-radio-group v-model="formData.salesType" @change="changeSale">
  153. <el-radio :disabled="formData.flag != 'SAVE' && formType != 0" label="零售">零售</el-radio>
  154. <el-radio :disabled="formData.flag != 'SAVE' && formType != 0" label="工程">工程</el-radio>
  155. </el-radio-group>
  156. </el-form-item>
  157. </el-col> -->
  158. <el-col :span="8" v-if="id">
  159. <el-form-item label="单据金额">
  160. <el-input type="text" :value="formData.totalAmount" disabled></el-input>
  161. </el-form-item>
  162. </el-col>
  163. <el-col :span="8">
  164. <el-form-item label="订单来源" prop="orderSource" :required="true">
  165. <el-select v-model="formData.orderSource" :disabled="true" placeholder="请选择" style="width: 100%">
  166. <el-option
  167. v-for="item in [
  168. { name: '在线订单', id: 'ONLINE' },
  169. { name: '自建订单', id: 'SELF' }
  170. ]"
  171. :key="item.id"
  172. :label="item.name"
  173. :value="item.id"
  174. >
  175. </el-option>
  176. </el-select>
  177. </el-form-item>
  178. </el-col>
  179. <el-col :span="6">
  180. <el-form-item label="支付方式" prop="payType" :required="true">
  181. <el-radio-group v-model="formData.payType">
  182. <el-radio :disabled="formData.flag != 'SAVE' && formType != 0" label="CASH">现金</el-radio>
  183. <el-radio :disabled="formData.flag != 'SAVE' && formType != 0" label="ALLINPAY">通联支付</el-radio>
  184. <el-radio
  185. v-if="formData.salesType == '工程'"
  186. :disabled="formData.flag != 'SAVE' && formType != 0"
  187. label="ENGIN"
  188. >工程支付</el-radio
  189. >
  190. </el-radio-group>
  191. </el-form-item>
  192. </el-col>
  193. <el-col :span="2" v-if="formData.flag == 'SUBMIT' && formData.payType == 'ALLINPAY'">
  194. <div style="height: 32px; display: flex; align-items: center; cursor: pointer" @click="wxPay()">
  195. 通联支付<i class="el-icon-full-screen"></i>
  196. </div>
  197. </el-col>
  198. <el-col :span="2" v-else>
  199. <div style="opacity: 0">隐藏</div>
  200. </el-col>
  201. <el-col :span="6">
  202. <el-form-item label="出库仓库" prop="storage">
  203. <el-select
  204. v-model="formData.storage"
  205. value-key="storageId"
  206. @focus="
  207. () => {
  208. if (!this.formData.websitId) {
  209. return this.$message.warning('请先选择网点名称!')
  210. }
  211. }
  212. "
  213. @change="changeStorage"
  214. :disabled="
  215. (['SAVE', 'PAY_NOT_TAKE'].indexOf(formData.flag) == -1 && formData.orderSource == 'ONLINE') ||
  216. (formType != 0 && ['SAVE', 'PAY_NOT_TAKE'].indexOf(formData.flag) == -1)
  217. "
  218. placeholder="请选择"
  219. style="width: 100%"
  220. >
  221. <el-option
  222. v-for="(item, index) in warehouseList"
  223. :key="index"
  224. :label="item.storageName"
  225. :value="item"
  226. >
  227. </el-option>
  228. </el-select>
  229. </el-form-item>
  230. </el-col>
  231. <template v-if="formData.salesType == '工程'">
  232. <el-col :span="8">
  233. <el-form-item label="工程名称" prop="project" :required="true">
  234. <div style="display: flex; align-items: center">
  235. <el-select
  236. v-model="formData.project"
  237. value-key="id"
  238. @change="
  239. e => {
  240. formData.orderEnginBaseId = e.id
  241. }
  242. "
  243. :disabled="formData.flag != 'SAVE' && formType != 0"
  244. placeholder="请选择"
  245. style="width: 100%"
  246. >
  247. <el-option
  248. v-for="(item, index) in projectList"
  249. :key="index"
  250. :label="item.projectName"
  251. :value="item"
  252. >
  253. </el-option>
  254. </el-select>
  255. <i
  256. class="el-icon-circle-plus"
  257. @click="toAddProject"
  258. style="transform: scale(1.5); color: #1989fa; margin-left: 10px; cursor: pointer"
  259. ></i>
  260. </div>
  261. </el-form-item>
  262. </el-col>
  263. <el-col :span="6">
  264. <el-form-item label="工程编号" :required="true">
  265. <el-input
  266. type="text"
  267. :disabled="true"
  268. v-model="formData.project.projectNo"
  269. placeholder="请输入"
  270. ></el-input>
  271. </el-form-item>
  272. </el-col>
  273. <el-col :span="6">
  274. <el-form-item label="负责人" :required="true">
  275. <el-input
  276. type="text"
  277. :disabled="true"
  278. v-model="formData.project.manger"
  279. placeholder="请输入"
  280. ></el-input>
  281. </el-form-item>
  282. </el-col>
  283. <el-col :span="6">
  284. <el-form-item label="联系电话" :required="true">
  285. <el-input
  286. type="text"
  287. :disabled="true"
  288. v-model="formData.project.mobile"
  289. placeholder="请输入"
  290. ></el-input>
  291. </el-form-item>
  292. </el-col>
  293. <el-col :span="6">
  294. <el-form-item label="项目时间" :required="true">
  295. <el-date-picker
  296. style="width: 50%"
  297. v-model="formData.project.startTime"
  298. type="date"
  299. :disabled="true"
  300. value-format="yyyy-MM-dd"
  301. placeholder="开始日期"
  302. >
  303. </el-date-picker>
  304. <el-date-picker
  305. style="width: 50%"
  306. v-model="formData.project.endTime"
  307. type="date"
  308. :disabled="true"
  309. value-format="yyyy-MM-dd"
  310. placeholder="结束日期"
  311. >
  312. </el-date-picker>
  313. </el-form-item>
  314. </el-col>
  315. <el-col :span="24">
  316. <el-form-item label="项目地址" :required="true">
  317. <el-row>
  318. <el-col :span="5" style="margin-right: 12px">
  319. <el-input
  320. type="text"
  321. v-model="formData.project.province"
  322. disabled
  323. placeholder="请选择省"
  324. ></el-input>
  325. </el-col>
  326. <el-col :span="5" style="margin-right: 12px">
  327. <el-input type="text" v-model="formData.project.city" disabled placeholder="请选择市"></el-input>
  328. </el-col>
  329. <el-col :span="5" style="margin-right: 12px">
  330. <el-input type="text" v-model="formData.project.area" disabled placeholder="请选择区"></el-input>
  331. </el-col>
  332. <el-col :span="8">
  333. <el-input
  334. type="text"
  335. v-model="formData.project.street"
  336. disabled
  337. placeholder="请选择街道"
  338. ></el-input>
  339. </el-col>
  340. </el-row>
  341. </el-form-item>
  342. </el-col>
  343. <el-col :span="24">
  344. <el-form-item label="">
  345. <el-row :gutter="20">
  346. <el-col :span="24">
  347. <el-input
  348. type="text"
  349. v-model="formData.project.address"
  350. :disabled="true"
  351. placeholder="详细地址"
  352. ></el-input>
  353. </el-col>
  354. <!-- <el-col :span="2">
  355. <geographicalPosi :disabled="formType==2" :formData="this.formData" @selectPosi="selectAddress"/>
  356. </el-col> -->
  357. </el-row>
  358. </el-form-item>
  359. </el-col>
  360. </template>
  361. <el-col :span="6" v-if="id">
  362. <el-form-item label="制单人">
  363. <el-input type="text" :value="formData.createBy" disabled></el-input>
  364. </el-form-item>
  365. </el-col>
  366. <el-col :span="6" v-if="id">
  367. <el-form-item label="制单时间">
  368. <el-input type="text" :value="formData.createTime" disabled></el-input>
  369. </el-form-item>
  370. </el-col>
  371. <el-col :span="6" v-if="id">
  372. <el-form-item label="审核人">
  373. <el-input type="text" :value="formData.confirmBy" disabled></el-input>
  374. </el-form-item>
  375. </el-col>
  376. <el-col :span="6" v-if="id">
  377. <el-form-item label="审核时间">
  378. <el-input type="text" :value="formData.confirmTime" disabled></el-input>
  379. </el-form-item>
  380. </el-col>
  381. <el-col :span="24">
  382. <el-form-item label="备注">
  383. <el-input
  384. type="textarea"
  385. :rows="4"
  386. :disabled="formData.flag != 'SAVE' && formType != 0"
  387. v-model="formData.remark"
  388. placeholder="请输入"
  389. ></el-input>
  390. </el-form-item>
  391. </el-col>
  392. </el-row>
  393. </el-form>
  394. </div>
  395. </el-card>
  396. <el-card class="box-card">
  397. <div slot="header" class="clearfix">
  398. <span>辅材信息</span>
  399. </div>
  400. <el-button size="small" v-if="formData.flag == 'SAVE' || formType == 0" type="primary" @click="add()"
  401. >添加</el-button
  402. >
  403. <div class="table">
  404. <el-table :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  405. <el-table-column label="大类名称" align="center">
  406. <template slot-scope="scope">
  407. <el-select
  408. v-model="scope.row.parentCategory"
  409. value-key="categoryId"
  410. @change="changeMain"
  411. :disabled="isEdit != scope.$index || formType == 2"
  412. placeholder="请选择"
  413. style="width: 100%"
  414. >
  415. <el-option v-for="item in mainList" :key="item.categoryId" :label="item.categoryName" :value="item">
  416. </el-option>
  417. </el-select>
  418. </template>
  419. </el-table-column>
  420. <el-table-column label="小类名称" align="center">
  421. <template slot-scope="scope">
  422. <el-select
  423. v-model="scope.row.goodsCategory"
  424. @change="changeSmall"
  425. @focus="
  426. () => {
  427. if (!scope.row.parentCategory) {
  428. return this.$message.warning('请先选择大类!')
  429. }
  430. }
  431. "
  432. :disabled="isEdit != scope.$index || formType == 2"
  433. value-key="categoryId"
  434. placeholder="请选择"
  435. style="width: 100%"
  436. >
  437. <el-option
  438. v-for="item in scope.row.parentCategory.items"
  439. :key="item.categoryId"
  440. :label="item.categoryName"
  441. :value="item"
  442. >
  443. </el-option>
  444. </el-select>
  445. </template>
  446. </el-table-column>
  447. <el-table-column label="辅材名称" align="center" width="220px">
  448. <template slot-scope="scope">
  449. <el-select
  450. v-model="scope.row.goods"
  451. @change="changeGoods"
  452. value-key="goodsId"
  453. :disabled="isEdit != scope.$index || formType == 2"
  454. placeholder="请选择"
  455. style="width: 100%"
  456. >
  457. <el-option
  458. v-for="item in scope.row.goodsList"
  459. :key="item.goodsId"
  460. :label="item.goodsName"
  461. :value="item"
  462. >
  463. </el-option>
  464. </el-select>
  465. </template>
  466. </el-table-column>
  467. <el-table-column prop="goods.goodsSalesUnit" align="center" label="单位"></el-table-column>
  468. <el-table-column prop="" align="center" label="数量">
  469. <template slot-scope="scope">
  470. <el-input
  471. type="number"
  472. v-model="scope.row.salesQty"
  473. :disabled="isEdit != scope.$index || formType == 2"
  474. placeholder="请输入"
  475. ></el-input>
  476. </template>
  477. </el-table-column>
  478. <el-table-column prop="goods.goodsCode" align="center" label="辅材代码"></el-table-column>
  479. <el-table-column prop="goods.goodsSpecification" align="center" label="规格型号"></el-table-column>
  480. <el-table-column prop="" align="center" label="销售价格">
  481. <template slot-scope="scope">
  482. <el-input
  483. type="number"
  484. v-model="scope.row.price"
  485. :disabled="isEdit != scope.$index || formType == 2"
  486. placeholder="请输入"
  487. ></el-input>
  488. </template>
  489. </el-table-column>
  490. <el-table-column prop="" align="center" label="销售金额">
  491. <template slot-scope="scope" v-if="scope.row.salesQty && scope.row.price">
  492. {{ ((scope.row.price * 100 * scope.row.salesQty) / 100).toFixed(2) }}
  493. </template>
  494. </el-table-column>
  495. <el-table-column prop="goods.qty" align="center" label="全部库存数量"></el-table-column>
  496. <el-table-column label="操作" align="right" width="140">
  497. <template slot-scope="scope" v-if="formType != 2">
  498. <el-button size="mini" type="primary" v-if="scope.$index != isEdit" @click="isEdit = scope.$index"
  499. >编辑</el-button
  500. >
  501. <el-button size="mini" type="danger" @click="del(scope.$index)">删除</el-button>
  502. </template>
  503. </el-table-column>
  504. </el-table>
  505. </div>
  506. </el-card>
  507. <el-card class="box-card" v-if="formData.salesType == '工程' && formType != 0 && formData.flag == 'SAVE'">
  508. <div slot="header" class="clearfix">
  509. <span>收款信息</span>
  510. </div>
  511. <div class="mymain-container">
  512. <el-form
  513. ref="formData1"
  514. :rules="rules1"
  515. :model="formData1"
  516. label-width="110px"
  517. size="small"
  518. label-position="left"
  519. >
  520. <el-row :gutter="20" justify="start">
  521. <el-col :span="24">
  522. <el-form-item label="收款金额" prop="price">
  523. <el-input type="text" style="width: 30%" v-model="formData1.price" placeholder="请输入"></el-input>
  524. <span style="color: #ff8f47; margin-left: 10px">注:操作【提交】时,系统方可记录收款信息</span>
  525. </el-form-item>
  526. </el-col>
  527. <el-col :span="24">
  528. <el-form-item label="收款凭证">
  529. <ImageUpload :fileList="formData1.fileUrl" :limit="1" :isEdit="formType !== 2" />
  530. </el-form-item>
  531. </el-col>
  532. <el-col :span="24">
  533. <el-form-item label="备注">
  534. <el-input type="textarea" :rows="4" v-model="formData1.remark" placeholder="请输入"></el-input>
  535. </el-form-item>
  536. </el-col>
  537. </el-row>
  538. </el-form>
  539. </div>
  540. </el-card>
  541. <el-card class="box-card" v-if="formData.salesType == '工程' && formType != 0">
  542. <div slot="header" class="clearfix">
  543. <span>收款记录</span>
  544. </div>
  545. <div class="table">
  546. <el-table :data="collectionList" element-loading-text="Loading" border fit highlight-current-row stripe>
  547. <el-table-column prop="status" label="收款结果" align="center">
  548. <template slot-scope="scope">
  549. {{
  550. scope.row.status == 'NO'
  551. ? '未付款'
  552. : scope.row.status == 'WAIT'
  553. ? '部分付款'
  554. : scope.row.status == 'OK'
  555. ? '已完成'
  556. : ''
  557. }}
  558. </template>
  559. </el-table-column>
  560. <el-table-column prop="price" label="收款金额" align="center"></el-table-column>
  561. <el-table-column prop="" align="center" label="收款凭证">
  562. <template slot-scope="scope" v-if="scope.row.urlPrc">
  563. <el-image
  564. style="width: 80px"
  565. :src="$showImgUrl(scope.row.urlPrc)"
  566. fit="scale-down"
  567. :preview-src-list="[$showImgUrl(scope.row.urlPrc)]"
  568. ></el-image>
  569. </template>
  570. </el-table-column>
  571. <el-table-column prop="remark" label="备注" align="center"></el-table-column>
  572. <el-table-column prop="updateBy" align="center" label="收款人"></el-table-column>
  573. <el-table-column prop="updateTime" align="center" label="收款时间"></el-table-column>
  574. </el-table>
  575. </div>
  576. </el-card>
  577. <div class="page-footer">
  578. <div class="footer">
  579. <el-button
  580. v-if="formType == 0 || (formType == 1 && formData.flag == 'SAVE')"
  581. size="small"
  582. type="primary"
  583. @click="save()"
  584. >保存</el-button
  585. >
  586. <el-button v-if="formType != 0 && formData.flag == 'SAVE'" size="small" type="primary" @click="submit()"
  587. >提交</el-button
  588. >
  589. <el-button
  590. v-if="formData.flag == 'SUBMIT' && formData.payType == 'ALLINPAY'"
  591. size="small"
  592. type="primary"
  593. @click="wxPay()"
  594. >通联支付</el-button
  595. >
  596. <el-button v-if="formData.flag == 'PAY_NOT_TAKE'" size="small" type="primary" @click="confirm()"
  597. >确认提货</el-button
  598. >
  599. <el-button size="small" type="info" @click="goBack">返回</el-button>
  600. </div>
  601. </div>
  602. <el-dialog
  603. title="微信支付"
  604. :visible.sync="isPay"
  605. width="50%"
  606. :close-on-click-modal="false"
  607. :modal-append-to-body="false"
  608. @close="
  609. payCodeUrl = ''
  610. clear()
  611. "
  612. >
  613. <h3 style="text-align: center">扫二维码支付</h3>
  614. <!-- <el-image :src="payCodeUrl" fit="fit"></el-image> -->
  615. <div ref="payQRCode" style="display: flex; justify-content: center" />
  616. <div style="color: #ea8000; text-align: center; margin-top: 20px">注:支付成功后,方可操作确认提货!</div>
  617. <div style="display: flex; justify-content: flex-end; margin-top: 30px">
  618. <el-button
  619. size="mini"
  620. type="text"
  621. @click="
  622. isPay = false
  623. clear()
  624. "
  625. >取消</el-button
  626. >
  627. <el-button
  628. size="small"
  629. type="primary"
  630. @click="
  631. isPay = false
  632. getDetail()
  633. "
  634. >确定</el-button
  635. >
  636. </div>
  637. </el-dialog>
  638. </div>
  639. </template>
  640. <script>
  641. import { getWebsit } from '@/api/customerManagement'
  642. import QRCode from 'qrcodejs2'
  643. import { lbsAmapRegion, adminWebsitPayConfigList } from '@/api/common.js'
  644. import geographicalPosi from '@/components/geographicalPosi/index.vue'
  645. import ImageUpload from '@/components/file-upload'
  646. import {
  647. getWorker,
  648. getCategory,
  649. getGoods,
  650. getDetail,
  651. add,
  652. edit,
  653. confirm,
  654. submit,
  655. getCode,
  656. getProject,
  657. getProjectCollectionList
  658. } from '@/api/auxiliaryFittings/auxiliarySalesOrder'
  659. import { storageListPageV2 } from '@/api/storage.js'
  660. import selectEl from '@/utils/xialaxuanz.js'
  661. export default {
  662. components: { geographicalPosi, ImageUpload },
  663. props: ['id', 'title', 'formType'],
  664. data() {
  665. return {
  666. dataList: [],
  667. websitList: [],
  668. workerList: [],
  669. mainList: [],
  670. projectList: [],
  671. collectionList: [],
  672. warehouseList: [],
  673. isPay: false,
  674. payCodeUrl: '',
  675. formData: {
  676. websit: {},
  677. websitId: '',
  678. websitName: '',
  679. file_url: [],
  680. salesId: '',
  681. flag: '',
  682. createBy: '',
  683. createTime: '',
  684. confirmBy: '',
  685. confirmTime: '',
  686. worker: {},
  687. workerName: '',
  688. workerId: '',
  689. identity: '',
  690. workerMobile: '',
  691. orderSource: 'SELF',
  692. payType: '',
  693. remark: '',
  694. totalAmount: '',
  695. buyPeople: 'WORKER',
  696. salesType: '零售',
  697. province: '',
  698. provinceId: '',
  699. city: '',
  700. cityId: '',
  701. area: '',
  702. areaId: '',
  703. street: '',
  704. streetId: '',
  705. address: '',
  706. lat: '',
  707. lng: '',
  708. project: {},
  709. orderEnginBaseId: '',
  710. storage: null,
  711. storageId: '',
  712. storageName: ''
  713. },
  714. formData1: {
  715. price: '',
  716. remark: '',
  717. fileUrl: []
  718. },
  719. provinceList: [],
  720. cityList: [],
  721. areaList: [],
  722. streetList: [],
  723. isEdit: 0,
  724. is_submit: true,
  725. timer: '',
  726. companyName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
  727. rules: {
  728. websitId: [{ required: true, message: '请选择网点', trigger: 'change' }],
  729. worker: [{ required: true, message: '请选择师傅', trigger: 'change' }],
  730. orderSource: [{ required: true, message: '请选择订单来源', trigger: 'change' }],
  731. payType: [{ required: true, message: '请选择订单来源', trigger: 'change' }],
  732. identity: [
  733. { required: true, message: '请输入师傅身份证', trigger: 'blur' },
  734. { pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, message: '身份证号格式不正确', trigger: 'blur' }
  735. ],
  736. workerMobile: [
  737. { required: true, message: `请输入联系电话`, trigger: 'blur' },
  738. { required: true, message: `请输入联系电话`, trigger: 'change' },
  739. { pattern: /^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/, message: '电话号码格式不正确', trigger: 'blur' }
  740. ],
  741. workerName: [{ required: true, message: '请输入客户姓名', trigger: 'blur' }],
  742. storage: [{ required: true, message: `请选择入库仓库`, trigger: 'change' }]
  743. },
  744. rules1: {
  745. price: [{ pattern: /^[1-9]\d*(\.\d+)?$|^0\.[1-9]\d*$/, message: '请输入大于0的数字', trigger: 'blur' }]
  746. }
  747. }
  748. },
  749. computed: {},
  750. created() {
  751. if (this.id) {
  752. this.getDetail()
  753. }
  754. this.getinitlbslist()
  755. this.getWebsit()
  756. this.getProject()
  757. },
  758. mounted() {},
  759. methods: {
  760. // 返回
  761. goBack() {
  762. this.$emit('back')
  763. },
  764. async getDetail() {
  765. const that = this
  766. getDetail({ salesId: this.id }).then(async res => {
  767. Object.assign(this.formData, res.data, {
  768. websit: { websitId: res.data.websitId, name: res.data.websitName },
  769. worker: { nickName: res.data.workerName, userId: res.data.workerId },
  770. project: {
  771. id: res.data.orderEnginBaseId,
  772. projectName: res.data.projectName,
  773. projectNo: res.data.projectNo,
  774. manger: res.data.manger,
  775. mobile: res.data.mobile,
  776. startTime: res.data.startTime,
  777. endTime: res.data.endTime,
  778. province: res.data.province,
  779. provinceId: res.data.provinceId,
  780. city: res.data.city,
  781. cityId: res.data.cityId,
  782. area: res.data.area,
  783. areaId: res.data.areaId,
  784. street: res.data.street,
  785. streetId: res.data.streetId,
  786. address: res.data.address,
  787. lat: res.data.lat,
  788. lng: res.data.lng
  789. },
  790. storage: {
  791. storageId: res.data.storageId
  792. }
  793. })
  794. this.getWorker()
  795. this.getCategory(res.data.websitId, res.data.storageId)
  796. this.getWarehouseList(res.data.websitId)
  797. if (res.data.salesType == '工程') {
  798. this.getProjectCollectionList(res.data.orderEnginBaseId)
  799. }
  800. this.formData.remark = res.data.remark
  801. for (var item of res.data.items) {
  802. item.parentCategory = {
  803. categoryId: item.parentCategoryId,
  804. categoryName: item.parentCategoryName,
  805. items: [{ categoryId: item.goodsCategoryId, categoryName: item.goodsCategoryName }]
  806. }
  807. item.goodsCategory = { categoryId: item.goodsCategoryId, categoryName: item.goodsCategoryName }
  808. var ress = await that.getGoods(item.goodsCategoryId, item.goodsName, 1)
  809. item.goods = ress.data
  810. item.goodsList = ress.data ? [ress.data] : []
  811. }
  812. this.dataList = res.data.items
  813. console.log(this.dataList)
  814. })
  815. },
  816. getWebsit() {
  817. getWebsit({ type: 'C' }).then(res => {
  818. this.websitList = res.data
  819. })
  820. },
  821. changeWebsit(e) {
  822. this.dataList = []
  823. this.formData.websitId = e.websitId
  824. this.formData.websitName = e.name
  825. this.formData.storageName = ''
  826. this.formData.storageId = ''
  827. this.getWorker()
  828. this.getCategory(e.websitId, this.formData.storageId)
  829. this.getWarehouseList(e.websitId)
  830. },
  831. changeStorage(e) {
  832. if (!this.formData.isImport && this.formData.orderSource == 'SELF') {
  833. this.dataList = []
  834. }
  835. this.formData.storageId = e.storageId
  836. this.formData.storageName = e.storageName
  837. this.getCategory(this.formData.websitId, e.storageId)
  838. },
  839. getCategory(websitId, storageId) {
  840. if (websitId && storageId) {
  841. getCategory({ websitId, storageId }).then(res => {
  842. this.mainList = res.data
  843. })
  844. } else {
  845. this.mainList = []
  846. }
  847. },
  848. toAddProject() {
  849. this.$router.push({
  850. name: 'basicEngineeringData'
  851. })
  852. },
  853. getProject() {
  854. getProject({
  855. pageNum: 1,
  856. pageSize: -1,
  857. params: []
  858. }).then(res => {
  859. this.projectList = res.data.records
  860. })
  861. },
  862. getWarehouseList(websitId) {
  863. if (!websitId) {
  864. return (this.warehouseList = [])
  865. }
  866. storageListPageV2({
  867. pageNum: 1,
  868. pageSize: -1,
  869. params: [
  870. { param: 'a.type', compare: 'like', value: '辅材' },
  871. { param: 'a.status', compare: '=', value: 'true' },
  872. { param: 'a.websit_id', compare: '=', value: websitId }
  873. ]
  874. }).then(res => {
  875. this.warehouseList = res.data.records
  876. })
  877. },
  878. getProjectCollectionList(orderEnginBaseId) {
  879. getProjectCollectionList({ orderEnginBaseId, goodsType: 'M' }).then(res => {
  880. this.collectionList = res.data
  881. })
  882. },
  883. async getGoods(categoryId, goodsName, type) {
  884. // if(!this.formData.storageId){return this.$message.warning('请先选择出库仓库!')}
  885. const that = this
  886. if (type == 1) {
  887. return new Promise((resolve, reject) => {
  888. getGoods({
  889. websitId: this.formData.websitId,
  890. categoryId: categoryId,
  891. type: 'M',
  892. goodsName: goodsName,
  893. orderEnginBaseId: this.formData.orderEnginBaseId,
  894. saleType: this.formData.salesType,
  895. storageId: this.formData.storageId
  896. }).then(res => {
  897. resolve({
  898. data: res.data[0]
  899. })
  900. })
  901. })
  902. } else {
  903. getGoods({
  904. websitId: this.formData.websitId,
  905. categoryId: categoryId,
  906. type: 'M',
  907. orderEnginBaseId: this.formData.orderEnginBaseId,
  908. saleType: this.formData.salesType,
  909. storageId: this.formData.storageId
  910. }).then(res => {
  911. that.dataList[that.isEdit].goodsList = res.data
  912. })
  913. }
  914. },
  915. getWorker() {
  916. getWorker({
  917. pageNum: 1,
  918. pageSize: -1,
  919. params: this.formType == 2 ? [] : [{ param: 'b.websit_id', compare: '=', value: this.formData.websitId }]
  920. }).then(res => {
  921. this.workerList = res.data.records
  922. })
  923. },
  924. changeWorker(e) {
  925. this.formData.identity = e.idCard
  926. this.formData.workerMobile = e.mobile
  927. this.formData.workerId = e.workerNumber
  928. this.formData.workerName = e.nickName
  929. },
  930. workerBlur(e) {
  931. this.formData.worker = e.target.value
  932. this.$forceUpdate()
  933. },
  934. changeMain(e) {
  935. ;(this.dataList[this.isEdit].goodsList = []),
  936. (this.dataList[this.isEdit].parentCategory = e),
  937. (this.dataList[this.isEdit].parentCategoryId = e.categoryId),
  938. (this.dataList[this.isEdit].parentCategoryName = e.categoryName),
  939. (this.dataList[this.isEdit].goodsCategory = {}),
  940. (this.dataList[this.isEdit].goodsCategoryName = ''),
  941. (this.dataList[this.isEdit].goodsCategoryId = ''),
  942. (this.dataList[this.isEdit].goods = {}),
  943. (this.dataList[this.isEdit].goodsId = ''),
  944. (this.dataList[this.isEdit].goodsName = ''),
  945. (this.dataList[this.isEdit].goodsSalesUnit = ''),
  946. (this.dataList[this.isEdit].goodsSpecification = ''),
  947. (this.dataList[this.isEdit].goodsCode = ''),
  948. (this.dataList[this.isEdit].price = ''),
  949. (this.dataList[this.isEdit].saleAmount = ''),
  950. (this.dataList[this.isEdit].salesQty = '')
  951. ;(this.dataList[this.isEdit].qty = ''), (this.dataList[this.isEdit].goodsType = 'M')
  952. },
  953. async changeSmall(e) {
  954. ;(this.dataList[this.isEdit].goods = {}),
  955. (this.dataList[this.isEdit].goodsId = ''),
  956. (this.dataList[this.isEdit].goodsName = ''),
  957. (this.dataList[this.isEdit].goodsSalesUnit = ''),
  958. (this.dataList[this.isEdit].goodsSpecification = ''),
  959. (this.dataList[this.isEdit].goodsCode = ''),
  960. (this.dataList[this.isEdit].price = ''),
  961. (this.dataList[this.isEdit].saleAmount = ''),
  962. (this.dataList[this.isEdit].salesQty = '')
  963. ;(this.dataList[this.isEdit].qty = ''), (this.dataList[this.isEdit].goodsCategoryId = e.categoryId)
  964. this.dataList[this.isEdit].goodsCategoryName = e.categoryName
  965. // if(!this.formData.storageId){return this.$message.warning('请先选择出库仓库!')}
  966. getGoods({
  967. websitId: this.formData.websitId,
  968. categoryId: e.categoryId,
  969. type: 'M',
  970. orderEnginBaseId: this.formData.orderEnginBaseId,
  971. saleType: this.formData.salesType,
  972. storageId: this.formData.storageId
  973. }).then(res => {
  974. this.dataList[this.isEdit].goodsList = res.data
  975. })
  976. },
  977. changeGoods(e) {
  978. console.log(e)
  979. this.dataList[this.isEdit].goodsId = e.goodsId
  980. this.dataList[this.isEdit].goodsName = e.goodsName
  981. this.dataList[this.isEdit].goodsSalesUnit = e.goodsSalesUnit
  982. this.dataList[this.isEdit].goodsSpecification = e.goodsSpecification
  983. this.dataList[this.isEdit].price = e.price
  984. this.dataList[this.isEdit].goodsCode = e.goodsCode
  985. this.dataList[this.isEdit].qty = e.qty
  986. this.dataList[this.isEdit].itemSourceType = e.itemSourceType
  987. this.dataList[this.isEdit].itemSourceId = e.itemSourceId
  988. this.dataList[this.isEdit].normType = e.normType
  989. },
  990. add() {
  991. if (this.dataList.length != 0) {
  992. this.isEdit = 0
  993. }
  994. this.dataList.unshift({
  995. goodsList: [],
  996. parentCategory: {},
  997. parentCategoryId: '',
  998. parentCategoryName: '',
  999. goodsCategory: {},
  1000. goodsCategoryName: '',
  1001. goodsCategoryId: '',
  1002. goods: {},
  1003. goodsId: '',
  1004. goodsName: '',
  1005. goodsSalesUnit: '',
  1006. goodsSpecification: '',
  1007. goodsCode: '',
  1008. price: '',
  1009. saleAmount: '',
  1010. salesQty: 1,
  1011. qty: '',
  1012. goodsType: 'M',
  1013. itemSourceType: '',
  1014. itemSourceId: '',
  1015. normType: ''
  1016. })
  1017. },
  1018. del(index) {
  1019. if (index <= 1) {
  1020. this.isEdit == 0
  1021. } else {
  1022. this.isEdit -= 1
  1023. }
  1024. this.dataList.splice(index, 1)
  1025. },
  1026. confirmSubmit() {
  1027. if (this.formData1.price && !/^[1-9]\d*(\.\d+)?$|^0\.[0-9]\d*$/.test(this.formData1.price)) {
  1028. return this.$message.warning('请输入大于0的数字!')
  1029. }
  1030. this.$confirm(`请确定是否提交订单, 是否继续?`, '提示', {
  1031. confirmButtonText: '确定',
  1032. cancelButtonText: '取消',
  1033. type: 'warning'
  1034. }).then(() => {
  1035. submit({
  1036. salesId: this.formData.salesId,
  1037. price: this.formData1.price,
  1038. urlPrc: this.formData1.fileUrl.length > 0 ? this.formData1.fileUrl[0].url : '',
  1039. remark: this.formData1.remark
  1040. }).then(res => {
  1041. if (res.code == 200) {
  1042. this.$message.success('提交成功!')
  1043. if (this.formData.payType == 'ALLINPAY') {
  1044. this.wxPay()
  1045. } else {
  1046. this.goBack()
  1047. }
  1048. }
  1049. })
  1050. })
  1051. },
  1052. submit() {
  1053. const that = this
  1054. this.$refs.formData.validate((valid, invalidFields, errLabels) => {
  1055. if (valid) {
  1056. edit({
  1057. salesId: this.formData.salesId,
  1058. goodsType: 'M',
  1059. orderSource: this.formData.orderSource,
  1060. payType: this.formData.payType,
  1061. remark: this.formData.remark,
  1062. websitId: this.formData.websitId,
  1063. websitName: this.formData.websitName,
  1064. workerName: this.formData.workerName,
  1065. workerId: this.formData.workerId,
  1066. identity: this.formData.identity,
  1067. workerMobile: this.formData.workerMobile,
  1068. buyPeople: this.formData.buyPeople,
  1069. items: this.dataList,
  1070. orderEnginBaseId: this.formData.orderEnginBaseId,
  1071. salesType: this.formData.salesType,
  1072. storageId: this.formData.storageId,
  1073. storageName: this.formData.storageName
  1074. }).then(res => {
  1075. if (res.code == 200) {
  1076. this.$nextTick(() => {
  1077. that.confirmSubmit()
  1078. })
  1079. }
  1080. })
  1081. }
  1082. })
  1083. },
  1084. confirm() {
  1085. if (!this.formData.storageId) {
  1086. return this.$message.warning('请先选择出库仓库!')
  1087. }
  1088. this.$confirm(`请确定是否确认提货, 是否继续?`, '提示', {
  1089. confirmButtonText: '确定',
  1090. cancelButtonText: '取消',
  1091. type: 'warning'
  1092. }).then(() => {
  1093. confirm({
  1094. salesId: this.formData.salesId,
  1095. storageId: this.formData.storageId
  1096. }).then(res => {
  1097. if (res.code == 200) {
  1098. this.$message.success('审核成功!')
  1099. this.goBack()
  1100. }
  1101. })
  1102. })
  1103. },
  1104. checkPay() {
  1105. this.timer = setInterval(() => {
  1106. getDetail({ salesId: this.id }).then(res => {
  1107. if (res.data.payFlag == 'YES') {
  1108. this.$refs.payQRCode.innerHTML = ''
  1109. this.clear()
  1110. this.$message.success('支付成功!')
  1111. this.goBack()
  1112. }
  1113. })
  1114. }, 3000)
  1115. },
  1116. clear() {
  1117. clearInterval(this.timer)
  1118. },
  1119. wxPay() {
  1120. if (!this.is_submit) {
  1121. return false
  1122. }
  1123. adminWebsitPayConfigList({
  1124. status: true,
  1125. type: 'M',
  1126. websitId: this.formData.websitId
  1127. }).then(resd => {
  1128. selectEl
  1129. .bind(this)(
  1130. resd?.data?.map(item => ({
  1131. value: item.id,
  1132. label: item.name
  1133. }))
  1134. )
  1135. .then(val => {
  1136. this.is_submit = false
  1137. setTimeout(() => {
  1138. this.is_submit = true
  1139. }, 2000)
  1140. getCode({
  1141. payConfigId: val,
  1142. salesId: this.formData.salesId
  1143. }).then(res => {
  1144. if (res.code == 200) {
  1145. this.isPay = true
  1146. this.$nextTick(() => {
  1147. this.payCodeUrl = res.data.codeUrl
  1148. this.$refs.payQRCode.innerHTML = ''
  1149. this.$nextTick(() => {
  1150. this.payUrl = res.data.codeUrl
  1151. new QRCode(this.$refs.payQRCode, {
  1152. text: res.data.codeUrl,
  1153. width: 200,
  1154. height: 200,
  1155. colorDark: '#333333', // 二维码颜色
  1156. colorLight: '#ffffff', // 二维码背景色
  1157. correctLevel: QRCode.CorrectLevel.L // 容错率,L/M/H
  1158. })
  1159. this.checkPay()
  1160. })
  1161. })
  1162. }
  1163. })
  1164. })
  1165. })
  1166. },
  1167. save() {
  1168. this.$refs.formData.validate((valid, invalidFields, errLabels) => {
  1169. if (valid) {
  1170. if (this.formType == 0) {
  1171. add({
  1172. goodsType: 'M',
  1173. orderSource: this.formData.orderSource,
  1174. payType: this.formData.payType,
  1175. remark: this.formData.remark,
  1176. websitId: this.formData.websitId,
  1177. websitName: this.formData.websitName,
  1178. workerName: this.formData.workerName,
  1179. workerId: this.formData.workerId,
  1180. identity: this.formData.identity,
  1181. workerMobile: this.formData.workerMobile,
  1182. buyPeople: this.formData.buyPeople,
  1183. items: this.dataList,
  1184. orderEnginBaseId: this.formData.orderEnginBaseId,
  1185. salesType: this.formData.salesType,
  1186. storageId: this.formData.storageId,
  1187. storageName: this.formData.storageName
  1188. }).then(res => {
  1189. if (res.code == 200) {
  1190. this.$message.success('提交成功!')
  1191. this.goBack()
  1192. }
  1193. })
  1194. } else if (this.formType == 1) {
  1195. edit({
  1196. salesId: this.formData.salesId,
  1197. goodsType: 'M',
  1198. orderSource: this.formData.orderSource,
  1199. payType: this.formData.payType,
  1200. remark: this.formData.remark,
  1201. websitId: this.formData.websitId,
  1202. websitName: this.formData.websitName,
  1203. workerName: this.formData.workerName,
  1204. workerId: this.formData.workerId,
  1205. identity: this.formData.identity,
  1206. workerMobile: this.formData.workerMobile,
  1207. buyPeople: this.formData.buyPeople,
  1208. items: this.dataList,
  1209. orderEnginBaseId: this.formData.orderEnginBaseId,
  1210. salesType: this.formData.salesType,
  1211. storageId: this.formData.storageId,
  1212. storageName: this.formData.storageName
  1213. }).then(res => {
  1214. if (res.code == 200) {
  1215. this.dataList = []
  1216. this.$message.success('提交成功!')
  1217. this.goBack()
  1218. }
  1219. })
  1220. }
  1221. }
  1222. })
  1223. },
  1224. changeSale() {
  1225. this.formData.buyPeople = 'CUSTOMER'
  1226. },
  1227. getinitlbslist() {
  1228. // 初始化请求省市区街道下拉选项数据
  1229. lbsAmapRegion({ pid: 0 }).then(res => {
  1230. this.provinceList = res.data
  1231. // 创建工单时获取ip地址定位赋值
  1232. if (!this.id && this.$IpAdd.province) {
  1233. var item = this.provinceList.find(item => item.name === this.$IpAdd.province)
  1234. if (item) {
  1235. this.formData.provinceId = item.id
  1236. this.formData.province = item.name
  1237. }
  1238. }
  1239. if (this.formData.provinceId) {
  1240. lbsAmapRegion({ pid: this.formData.provinceId }).then(res => {
  1241. this.cityList = res.data
  1242. // 创建工单时获取ip地址定位赋值
  1243. if (!this.id && this.$IpAdd.city) {
  1244. var item2 = this.cityList.find(item => item.name === this.$IpAdd.city)
  1245. if (item2) {
  1246. this.formData.cityId = item2.id
  1247. this.formData.city = item2.name
  1248. }
  1249. }
  1250. if (this.formData.cityId) {
  1251. lbsAmapRegion({ pid: this.formData.cityId }).then(res => {
  1252. this.areaList = res.data
  1253. })
  1254. }
  1255. if (this.formData.areaId) {
  1256. lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
  1257. this.streetList = res.data
  1258. })
  1259. }
  1260. })
  1261. }
  1262. })
  1263. },
  1264. selectAddress(data) {
  1265. this.formData.lng = data.center[0]
  1266. this.formData.lat = data.center[1]
  1267. // 获取定位的省市区街道
  1268. var { province, city, district, township } = data.data.addressComponent
  1269. // 获取选中省名称id
  1270. var { id, name } = this.provinceList.find(item => item.name === province)
  1271. this.formData.provinceId = id
  1272. this.formData.province = name
  1273. // 请求市选项
  1274. lbsAmapRegion({ pid: this.formData.provinceId }).then(res => {
  1275. // 赋值市选项
  1276. this.cityList = res.data
  1277. // 获取选中市名称id
  1278. var { id, name } = res.data.find(item => item.name === city)
  1279. this.formData.cityId = id
  1280. this.formData.city = name
  1281. // 请求区选项
  1282. lbsAmapRegion({ pid: this.formData.cityId }).then(res => {
  1283. // 赋值区选项
  1284. this.areaList = res.data
  1285. // 获取选中区名称id
  1286. var { id, name } = res.data.find(item => item.name === district)
  1287. this.formData.areaId = id
  1288. this.formData.area = name
  1289. // 请求街道选项
  1290. lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
  1291. // 赋值街道选项
  1292. this.streetList = res.data
  1293. // 获取选中街道名称id
  1294. var { id, name } = res.data.find(item => item.name === township)
  1295. this.formData.streetId = id
  1296. this.formData.street = name
  1297. // 赋值GPS详细地址
  1298. this.formData.address = data.name
  1299. })
  1300. })
  1301. })
  1302. }
  1303. }
  1304. }
  1305. </script>
  1306. <style scoped="scoped" lang="scss">
  1307. .s-page {
  1308. padding: 20px;
  1309. background-color: #ffffff;
  1310. }
  1311. .page-footer {
  1312. height: 70px;
  1313. }
  1314. .footer {
  1315. position: fixed;
  1316. bottom: 0;
  1317. left: 0;
  1318. z-index: 1;
  1319. width: 100%;
  1320. background: #fff;
  1321. padding: 15px 40px;
  1322. box-sizing: border-box;
  1323. transition: all 0.28s;
  1324. text-align: right;
  1325. box-shadow: 0 2px 5px 0 rgb(0 0 0 / 50%), 0 2px 5px 0 rgb(0 0 0 / 10%);
  1326. &.hideSidebar {
  1327. margin-left: 54px;
  1328. width: calc(100vw - 54px);
  1329. }
  1330. &.openSidebar {
  1331. margin-left: 210px;
  1332. width: calc(100vw - 210px);
  1333. }
  1334. .tips {
  1335. font-size: 12px;
  1336. color: red;
  1337. margin-top: 10px;
  1338. }
  1339. }
  1340. </style>