auxiliarySalesOrderDetail.vue 49 KB

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