deliveryGoodsInfo.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. <template>
  2. <div class="info">
  3. <div class="edit">
  4. <span @click="edit">编辑</span>
  5. </div>
  6. <div class="g-box">
  7. <div class="info-row" v-if="!hideOrderCode">
  8. <div class="info-col">
  9. <span class="label">内部订单号:</span>
  10. <span :title="value.omsOrderIds">{{ value.omsOrderIds }}</span>
  11. </div>
  12. </div>
  13. <!-- <div class="info-row">
  14. <div class="info-col col-width">
  15. <span class="label">订单类型:</span>
  16. <span :title="value.orderType">{{ value.orderType }}</span>
  17. </div>
  18. </div> -->
  19. <div class="info-row">
  20. <div class="info-col col-width">
  21. <span class="label">业务员:</span>
  22. <span :title="value.tmsBusinessMan">{{ value.tmsBusinessMan }}</span>
  23. </div>
  24. <div class="info-col col-width">
  25. <span class="label">备注:</span>
  26. <span :title="value.tmsRemark">{{ value.tmsRemark }}</span>
  27. </div>
  28. </div>
  29. <div class="info-row">
  30. <div class="info-col col-width">
  31. <span class="label">业务员手机:</span>
  32. <span :title="value.tmsBusinessPhone">{{ value.tmsBusinessPhone }}</span>
  33. </div>
  34. <div class="info-col col-width" v-if="!hideOrderCode">
  35. <span class="label">发货状态:</span>
  36. <span>{{ value.isSuccess ? '发货中' : '' }}</span>
  37. </div>
  38. </div>
  39. <div class="info-row">
  40. <div class="info-col">
  41. <span class="label">运输方式:</span>
  42. <span :title="value.tmsTransportMethod">{{ value.tmsTransportMethod }}</span>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="g-box">
  47. <div class="info-row">
  48. <div class="info-col col-width">
  49. <span class="label">发货省:</span>
  50. <span :title="value.tmsShipmentProvince">{{ value.tmsShipmentProvince }}</span>
  51. </div>
  52. <div class="info-col col-width">
  53. <span class="label">收货省:</span>
  54. <span :title="value.tmsUnloadingProvince">{{ value.tmsUnloadingProvince }}</span>
  55. </div>
  56. </div>
  57. <div class="info-row">
  58. <div class="info-col col-width">
  59. <span class="label">发货市:</span>
  60. <span :title="value.tmsShipmentCity">{{ value.tmsShipmentCity }}</span>
  61. </div>
  62. <div class="info-col col-width">
  63. <span class="label">收货市:</span>
  64. <span :title="value.tmsUnloadingCity">{{ value.tmsUnloadingCity }}</span>
  65. </div>
  66. </div>
  67. <div class="info-row">
  68. <div class="info-col col-width">
  69. <span class="label">发货区(县):</span>
  70. <span :title="value.tmsShipmentRegion">{{ value.tmsShipmentRegion }}</span>
  71. </div>
  72. <div class="info-col col-width">
  73. <span class="label">收货区(县):</span>
  74. <span :title="value.tmsUnloadingRegion">{{ value.tmsUnloadingRegion }}</span>
  75. </div>
  76. </div>
  77. <div class="info-row">
  78. <div class="info-col col-width">
  79. <span class="label">发货街道:</span>
  80. <span :title="value.tmsShipmentStreet">{{ value.tmsShipmentStreet }}</span>
  81. </div>
  82. <div class="info-col col-width">
  83. <span class="label">收货街道:</span>
  84. <span :title="value.tmsUnloadingStreet">{{ value.tmsUnloadingStreet }}</span>
  85. </div>
  86. </div>
  87. <div class="info-row">
  88. <div class="info-col col-width">
  89. <span class="label">发货地址(详情):</span>
  90. <span :title="value.tmsShipmentAddress">{{ value.tmsShipmentAddress }}</span>
  91. </div>
  92. <div class="info-col col-width">
  93. <span class="label">收货地址(详情):</span>
  94. <span :title="value.tmsUnloadingAddress">{{ value.tmsUnloadingAddress }}</span>
  95. </div>
  96. </div>
  97. <div class="info-row">
  98. <div class="info-col col-width">
  99. <span class="label">发货人:</span>
  100. <span :title="value.tmsShipmentConsignor">{{ value.tmsShipmentConsignor }}</span>
  101. </div>
  102. <div class="info-col col-width">
  103. <span class="label">收货人:</span>
  104. <span :title="value.tmsUnloadingConsignor">{{ value.tmsUnloadingConsignor }}</span>
  105. </div>
  106. </div>
  107. <div class="info-row">
  108. <div class="info-col col-width">
  109. <span class="label">发货人联系电话:</span>
  110. <span :title="value.tmsShipmentContacts">{{ value.tmsShipmentContacts }}</span>
  111. </div>
  112. <div class="info-col col-width">
  113. <span class="label">收货人联系电话:</span>
  114. <span :title="value.tmsUnloadingContacts">{{ value.tmsUnloadingContacts }}</span>
  115. </div>
  116. </div>
  117. <div class="info-row">
  118. <div class="info-col col-width">
  119. <span class="label">期望送达时间:</span>
  120. <span class="time">{{value.tmsArrivalDate}}</span>
  121. </div>
  122. <div class="info-col col-width">
  123. <span class="label">期望提货时间:</span>
  124. <span class="time">{{value.tmsDeliveryDate}}</span>
  125. </div>
  126. </div>
  127. </div>
  128. <div class="g-box">
  129. <div class="goods-top">
  130. <div class="g-label">物料信息</div>
  131. <div class="g-cont">
  132. <div class="g-total">
  133. <span class="name-label">重量合计:</span>
  134. <span class="total-num">{{totalWeight}}kg</span>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="table">
  139. <vxe-table
  140. border
  141. size="mini"
  142. align="center"
  143. header-cell-class-name="header-cell"
  144. :data="value.subItem">
  145. <vxe-column field="tmsGoodsCode" title="物料编码" width="130"></vxe-column>
  146. <vxe-column field="name" title="物料名称" width="260"></vxe-column>
  147. <vxe-column field="weight" title="重量"></vxe-column>
  148. <vxe-column field="price" title="单价"></vxe-column>
  149. <vxe-column field="tmsQuantity" title="数量"></vxe-column>
  150. <vxe-column field="tmsGoodsTotalPrice" title="小计"></vxe-column>
  151. </vxe-table>
  152. </div>
  153. </div>
  154. <vxe-modal v-model="showModal" id="deliverInfoEdit" width="900" height="80%" @show="show" @hide="hide" title="编辑" transfer show-footer>
  155. <by-form :propConfig="config" ref="form" />
  156. <template #footer>
  157. <div class="btn">
  158. <el-button plain size="small" @click="showModal = false">取消</el-button>
  159. <el-button type="primary" size="small" @click="btn">确定</el-button>
  160. </div>
  161. </template>
  162. </vxe-modal>
  163. </div>
  164. </template>
  165. <script lang="ts">
  166. import { Component, Prop, Vue, Watch } from "vue-property-decorator";
  167. import { add,multiply,subtract,divide } from '@/benyun/utils/accuracy'
  168. @Component
  169. export default class DeliveryGoodsInfo extends Vue {
  170. @Prop()
  171. hideOrderCode?:Boolean
  172. data:Array<any>=[];
  173. value:any={};
  174. showModal=false;
  175. totalWeight:any=0;
  176. config:any={
  177. attr:{
  178. size:'small',
  179. labelWidth:'120px',
  180. rules:{
  181. // orderType:[{
  182. // required: true, message: '请选择订单类型!', trigger: 'change'
  183. // }],
  184. tmsBusinessMan:[{
  185. required: true, message: '业务员不能为空!', trigger: 'blur'
  186. }],
  187. tmsBusinessPhone:[{
  188. required: true, message: '业务员手机不能为空!', trigger: 'blur'
  189. },{
  190. validator: this.validatePhone, trigger: 'blur'
  191. }],
  192. tmsShipmentConsignor:[{
  193. required: true, message: '发货人不能为空!', trigger: 'blur'
  194. }],
  195. tmsShipmentContacts:[{
  196. required: true, message: '发货人电话不能为空!', trigger: 'blur'
  197. }],
  198. tmsShipmentProvince:[{
  199. required: true, message: '请选择发货地址!', trigger: 'change'
  200. }],
  201. tmsShipmentAddress:[{
  202. required: true, message: '发货地址不能为空!', trigger: 'blur'
  203. }],
  204. tmsUnloadingConsignor:[{
  205. required: true, message: '收货人不能为空!', trigger: 'blur'
  206. }],
  207. tmsUnloadingContacts:[{
  208. required: true, message: '收货人电话不能为空!', trigger: 'blur'
  209. }],
  210. tmsUnloadingProvince:[{
  211. required: true, message: '请选择收货地址!', trigger: 'change'
  212. }],
  213. tmsUnloadingAddress:[{
  214. required: true, message: '收货地址不能为空!', trigger: 'blur'
  215. }],
  216. storeHouse:[{
  217. required: true, message: '请选择仓库!', trigger: 'change'
  218. }],
  219. tmsArrivalDate:[{
  220. required: true, message: '期望送达时间不能为空!', trigger: 'blur'
  221. }],
  222. tmsDeliveryDate:[{
  223. required: true, message: '期望提货时间不能为空!', trigger: 'blur'
  224. }]
  225. }
  226. },
  227. columns:[
  228. // [
  229. // {
  230. // label:'订单类型',
  231. // prop:'orderType',
  232. // component:'by-select',
  233. // compConfig:{
  234. // attr:{
  235. // data: [{
  236. // label:'B2C',
  237. // value:'B2C'
  238. // },{
  239. // label:'B2B',
  240. // value:'B2B'
  241. // }],
  242. // clearable:true
  243. // }
  244. // }
  245. // }
  246. // ],
  247. [{
  248. label:'业务员',
  249. prop:'tmsBusinessMan',
  250. component:'by-input',
  251. compConfig:{
  252. attr:{
  253. clearable:true
  254. }
  255. }
  256. },{
  257. label:'业务员手机',
  258. prop:'tmsBusinessPhone',
  259. component:'by-input',
  260. compConfig:{
  261. attr:{
  262. clearable:true
  263. }
  264. }
  265. }],
  266. [{
  267. label:'备注',
  268. prop:'tmsRemark',
  269. component:'by-input',
  270. compConfig:{
  271. attr:{
  272. clearable:true
  273. }
  274. }
  275. }],
  276. [{
  277. label:'发货人',
  278. prop:'tmsShipmentConsignor',
  279. component:'by-input',
  280. compConfig:{
  281. attr:{
  282. clearable:true
  283. }
  284. }
  285. },{
  286. label:'发货人电话',
  287. prop:'tmsShipmentContacts',
  288. component:'by-input',
  289. compConfig:{
  290. attr:{
  291. clearable:true
  292. }
  293. }
  294. }],
  295. [{
  296. labelWidth:'120px',
  297. label:'发货地址选择',
  298. prop:'tmsShipmentProvince',
  299. component:'by-area',
  300. compConfig:{
  301. attr:{
  302. province:'tmsShipmentProvince', //省
  303. provinceCode:'tmsShipmentProvinceNo', //省编码
  304. city:'tmsShipmentCity', //市
  305. cityCode:'tmsShipmentCityNo', //市编码
  306. county:'tmsShipmentRegion', //县/区
  307. countyCode:'tmsShipmentRegionNo', //县/区编码
  308. townCode:'tmsShipmentStreetNo',
  309. town:'tmsShipmentStreet'
  310. }
  311. }
  312. }],
  313. [{
  314. label:'发货地址',
  315. prop:'tmsShipmentAddress',
  316. component:'by-input',
  317. compConfig:{
  318. attr:{
  319. clearable:true
  320. }
  321. }
  322. }],
  323. [{
  324. label:'收货人',
  325. prop:'tmsUnloadingConsignor',
  326. component:'by-input',
  327. compConfig:{
  328. attr:{
  329. clearable:true
  330. }
  331. }
  332. },{
  333. label:'收货人电话',
  334. prop:'tmsUnloadingContacts',
  335. component:'by-input',
  336. compConfig:{
  337. attr:{
  338. clearable:true
  339. }
  340. }
  341. }],
  342. [{
  343. labelWidth:'120px',
  344. label:'收货地址选择',
  345. prop:'tmsUnloadingProvince',
  346. component:'by-area',
  347. compConfig:{
  348. attr:{
  349. province:'tmsUnloadingProvince', //省
  350. provinceCode:'tmsUnloadingProvinceNo', //省编码
  351. city:'tmsUnloadingCity', //市
  352. cityCode:'tmsUnloadingCityNo', //市编码
  353. county:'tmsUnloadingRegion', //县/区
  354. countyCode:'tmsUnloadingRegionNo', //县/区编码
  355. townCode:'tmsUnloadingStreetNo',
  356. town:'tmsUnloadingStreet'
  357. }
  358. }
  359. }],
  360. [{
  361. label:'收货人地址',
  362. prop:'tmsUnloadingAddress',
  363. component:'by-input',
  364. compConfig:{
  365. attr:{
  366. clearable:true
  367. }
  368. }
  369. }],
  370. [{
  371. label:'期望送达时间',
  372. prop:'tmsArrivalDate',
  373. component:'byDatePicker',
  374. compConfig:{
  375. attr:{
  376. clearable:true,
  377. type:'datetime'
  378. }
  379. }
  380. },{
  381. label:'期望提货时间',
  382. prop:'tmsDeliveryDate',
  383. component:'byDatePicker',
  384. compConfig:{
  385. attr:{
  386. clearable:true,
  387. type:'datetime'
  388. }
  389. }
  390. }],
  391. [{
  392. label:'仓库',
  393. prop:'storeHouse',
  394. component:'warehouse',
  395. compConfig:{
  396. attr:{
  397. placeholder:'请选择仓库',
  398. clearable:true
  399. }
  400. }
  401. },{
  402. label:'运输方式',
  403. prop:'tmsTransportMethod',
  404. component:'by-input',
  405. compConfig:{
  406. attr:{
  407. clearable:true
  408. }
  409. }
  410. }]
  411. ]
  412. }
  413. validatePhone(rule:any, value:any, callback:any){
  414. if (value) {
  415. if(!/^1[3|4|5|6|7|8|9][0-9]\d{8}$/.test(value)) {
  416. callback(new Error('手机号格式不正确!')); return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
  417. }else{
  418. callback();
  419. }
  420. } else {
  421. callback();
  422. }
  423. }
  424. setValue(v:any){
  425. this.value = v ? v : {};
  426. this.totalWeight = 0;
  427. if(this.value.subItem && this.value.subItem.length > 0){
  428. for(const item of this.value.subItem){
  429. if(Number(item.weight)){
  430. let totalWeight = multiply(Number(item.weight),Number(item.tmsQuantity))
  431. this.totalWeight = add(this.totalWeight,totalWeight);
  432. }
  433. }
  434. }
  435. }
  436. hide(){
  437. this.$emit('editState',true)
  438. }
  439. show(){
  440. this.value.tmsBusinessMan = (this as any).$store.getters.userInfo.userName;
  441. this.value.tmsBusinessPhone = (this as any).$store.getters.userInfo.phonenumber;
  442. this.$nextTick(()=>{
  443. if(this.$refs.form){
  444. (this.$refs.form as any).clearValue();
  445. (this.$refs.form as any).setValue(this.value);
  446. }
  447. })
  448. }
  449. edit(){
  450. this.showModal = true;
  451. this.$emit('editState',false)
  452. }
  453. btn() {
  454. if(this.$refs.form){
  455. (this.$refs.form as any).validate().then(()=>{
  456. this.value = (this.$refs.form as any).getValue();
  457. if(!this.value.tmsShipmentCity){
  458. this.$message({
  459. message:'请选择发货城市!',
  460. type:'warning'
  461. })
  462. return
  463. }
  464. if(!this.value.tmsShipmentRegion){
  465. this.$message({
  466. message:'请选择发货区/县!',
  467. type:'warning'
  468. })
  469. return
  470. }
  471. if(!this.value.tmsUnloadingCity){
  472. this.$message({
  473. message:'请选择收货城市!',
  474. type:'warning'
  475. })
  476. return
  477. }
  478. if(!this.value.tmsUnloadingRegion){
  479. this.$message({
  480. message:'请选择收货区/县!',
  481. type:'warning'
  482. })
  483. return
  484. }
  485. this.showModal = false;
  486. this.$emit('editState',true);
  487. this.$emit('editResult',this.value);
  488. }).catch(()=>{})
  489. }
  490. }
  491. }
  492. </script>
  493. <style lang="scss" scoped>
  494. .info{
  495. width: 100%;
  496. .edit{
  497. width: 100%;
  498. display: flex;
  499. justify-content: flex-end;
  500. padding-bottom: 8px;
  501. span{
  502. color: rgb(0, 119, 255);
  503. font-size: 14px;
  504. cursor: pointer;
  505. }
  506. }
  507. .g-box{
  508. width: 100%;
  509. background-color: rgba(160,205,255,0.22);
  510. margin-bottom: 16px;
  511. padding:16px;
  512. box-sizing: border-box;
  513. .info-row{
  514. width: 100%;
  515. display: flex;
  516. padding-bottom: 16px;
  517. .info-col{
  518. width: 100%;
  519. overflow: hidden;
  520. text-overflow: ellipsis;
  521. white-space: nowrap;
  522. span{
  523. font-size: 14px;
  524. }
  525. .label{
  526. color: #666;
  527. }
  528. .time{
  529. color: #F00;
  530. }
  531. }
  532. .col-width{
  533. width: 50%;
  534. }
  535. }
  536. .info-row:last-child{
  537. padding: 0;
  538. }
  539. .goods-top{
  540. padding-bottom: 8px;
  541. width: 100%;
  542. display: flex;
  543. align-items: center;
  544. justify-content: space-between;
  545. .g-label{
  546. font-size: 14px;
  547. }
  548. .g-cont{
  549. width: 60%;
  550. display: flex;
  551. align-items: center;
  552. justify-content: flex-end;
  553. .g-total{
  554. padding-left: 8px;
  555. font-size: 12px;
  556. .name-label{
  557. color: #999;
  558. }
  559. }
  560. }
  561. }
  562. .table{
  563. width: 100%;
  564. }
  565. }
  566. .btn{
  567. width: 100%;
  568. display: flex;
  569. justify-content: flex-end;
  570. }
  571. }
  572. </style>
  573. <style lang="scss">
  574. .header-cell{
  575. background-color: rgba(160,205,255,0.48);
  576. }
  577. </style>