auxiliarySalesOrderDetail.vue 51 KB

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