deliveryGoodsInfo.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. <template>
  2. <div class="info">
  3. <div class="edit" v-if="!readOnly">
  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.tmsOrderNo">{{ value.tmsOrderNo }}</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">
  21. <span class="label">业务员:</span>
  22. <span :title="value.tmsBusinessMan">{{ value.tmsBusinessMan }}</span>
  23. </div>
  24. </div>
  25. <div class="info-row">
  26. <div class="info-col col-width">
  27. <span class="label">业务员手机:</span>
  28. <span :title="value.tmsBusinessPhone">{{ value.tmsBusinessPhone }}</span>
  29. </div>
  30. </div>
  31. <div class="info-row">
  32. <div class="info-col col-width">
  33. <span class="label">运输方式:</span>
  34. <span :title="value.tmsTransportMethod">{{ value.tmsTransportMethod }}</span>
  35. </div>
  36. <div class="info-col col-width">
  37. <span class="label">备注:</span>
  38. <span :title="value.tmsRemark">{{ value.tmsRemark }}</span>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="g-box">
  43. <div class="info-row">
  44. <div class="info-col col-width">
  45. <span class="label">发货省:</span>
  46. <span :title="value.tmsShipmentProvince">{{ value.tmsShipmentProvince }}</span>
  47. </div>
  48. <div class="info-col col-width">
  49. <span class="label">收货省:</span>
  50. <span :title="value.tmsUnloadingProvince">{{ value.tmsUnloadingProvince }}</span>
  51. </div>
  52. </div>
  53. <div class="info-row">
  54. <div class="info-col col-width">
  55. <span class="label">发货市:</span>
  56. <span :title="value.tmsShipmentCity">{{ value.tmsShipmentCity }}</span>
  57. </div>
  58. <div class="info-col col-width">
  59. <span class="label">收货市:</span>
  60. <span :title="value.tmsUnloadingCity">{{ value.tmsUnloadingCity }}</span>
  61. </div>
  62. </div>
  63. <div class="info-row">
  64. <div class="info-col col-width">
  65. <span class="label">发货区(县):</span>
  66. <span :title="value.tmsShipmentRegion">{{ value.tmsShipmentRegion }}</span>
  67. </div>
  68. <div class="info-col col-width">
  69. <span class="label">收货区(县):</span>
  70. <span :title="value.tmsUnloadingRegion">{{ value.tmsUnloadingRegion }}</span>
  71. </div>
  72. </div>
  73. <div class="info-row">
  74. <div class="info-col col-width">
  75. <span class="label">发货街道:</span>
  76. <span :title="value.tmsShipmentStreet">{{ value.tmsShipmentStreet }}</span>
  77. </div>
  78. <div class="info-col col-width">
  79. <span class="label">收货街道:</span>
  80. <span :title="value.tmsUnloadingStreet">{{ value.tmsUnloadingStreet }}</span>
  81. </div>
  82. </div>
  83. <div class="info-row">
  84. <div class="info-col col-width">
  85. <span class="label">发货地址(详情):</span>
  86. <span :title="value.tmsShipmentAddress">{{ value.tmsShipmentAddress }}</span>
  87. </div>
  88. <div class="info-col col-width">
  89. <span class="label">收货地址(详情):</span>
  90. <span :title="value.tmsUnloadingAddress">{{ value.tmsUnloadingAddress }}</span>
  91. </div>
  92. </div>
  93. <div class="info-row">
  94. <div class="info-col col-width">
  95. <span class="label">发货人:</span>
  96. <span :title="value.tmsShipmentConsignor">{{ value.tmsShipmentConsignor }}</span>
  97. </div>
  98. <div class="info-col col-width">
  99. <span class="label">收货人:</span>
  100. <span :title="value.tmsUnloadingConsignor">{{ value.tmsUnloadingConsignor }}</span>
  101. </div>
  102. </div>
  103. <div class="info-row">
  104. <div class="info-col col-width">
  105. <span class="label">发货人联系电话:</span>
  106. <span :title="value.tmsShipmentContacts">{{ value.tmsShipmentContacts }}</span>
  107. </div>
  108. <div class="info-col col-width">
  109. <span class="label">收货人联系电话:</span>
  110. <span :title="value.tmsUnloadingContacts">{{ value.tmsUnloadingContacts }}</span>
  111. </div>
  112. </div>
  113. <div class="info-row">
  114. <div class="info-col col-width">
  115. <span class="label">期望送达时间:</span>
  116. <span class="time">{{value.tmsArrivalDate}}</span>
  117. </div>
  118. <div class="info-col col-width">
  119. <span class="label">期望提货时间:</span>
  120. <span class="time">{{value.tmsDeliveryDate}}</span>
  121. </div>
  122. </div>
  123. </div>
  124. <div class="g-box">
  125. <div class="goods-top">
  126. <div class="g-label">物料信息</div>
  127. <div class="g-cont">
  128. <div class="g-total">
  129. <span class="name-label">重量合计:</span>
  130. <span class="total-num">{{totalWeight}}kg</span>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="table">
  135. <vxe-table
  136. border
  137. size="mini"
  138. align="center"
  139. header-cell-class-name="header-cell"
  140. :data="value.subItem">
  141. <vxe-column field="tmsGoodsCode" title="物料编码" width="130"></vxe-column>
  142. <vxe-column field="name" title="物料名称" width="260"></vxe-column>
  143. <vxe-column field="weight" title="重量"></vxe-column>
  144. <vxe-column field="price" title="单价"></vxe-column>
  145. <vxe-column field="tmsQuantity" title="数量" width="120">
  146. <template #default="{ row }">
  147. <el-input v-model="row.tmsQuantity" type="number" size="mini" placeholder="" @input="qtyChange(row)"></el-input>
  148. </template>
  149. </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="编辑" resize show-zoom 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. @Prop()
  173. sendState?:Boolean
  174. @Prop()
  175. readOnly?:Boolean
  176. data:Array<any>=[];
  177. value:any={};
  178. showModal=false;
  179. totalWeight:any=0;
  180. config:any={
  181. attr:{
  182. size:'small',
  183. labelWidth:'120px',
  184. rules:{
  185. // orderType:[{
  186. // required: true, message: '请选择订单类型!', trigger: 'change'
  187. // }],
  188. tmsBusinessMan:[{
  189. required: true, message: '业务员不能为空!', trigger: 'blur'
  190. }],
  191. tmsBusinessPhone:[{
  192. required: true, message: '业务员手机不能为空!', trigger: 'blur'
  193. },{
  194. validator: this.validatePhone, trigger: 'blur'
  195. }],
  196. tmsShipmentConsignor:[{
  197. required: true, message: '发货人不能为空!', trigger: 'blur'
  198. }],
  199. tmsShipmentContacts:[{
  200. required: true, message: '发货人电话不能为空!', trigger: 'blur'
  201. }],
  202. tmsShipmentProvince:[{
  203. required: true, message: '请选择发货地址!', trigger: 'change'
  204. }],
  205. tmsShipmentAddress:[{
  206. required: true, message: '发货地址不能为空!', trigger: 'blur'
  207. }],
  208. tmsUnloadingConsignor:[{
  209. required: true, message: '收货人不能为空!', trigger: 'blur'
  210. }],
  211. tmsUnloadingContacts:[{
  212. required: true, message: '收货人电话不能为空!', trigger: 'blur'
  213. }],
  214. tmsUnloadingProvince:[{
  215. required: true, message: '请选择收货地址!', trigger: 'change'
  216. }],
  217. tmsUnloadingAddress:[{
  218. required: true, message: '收货地址不能为空!', trigger: 'blur'
  219. }],
  220. storeHouseId:[{
  221. required: true, message: '请选择仓库!', trigger: 'change'
  222. }],
  223. tmsArrivalDate:[{
  224. required: true, message: '期望送达时间不能为空!', trigger: 'blur'
  225. }],
  226. tmsDeliveryDate:[{
  227. required: true, message: '期望提货时间不能为空!', trigger: 'blur'
  228. }],
  229. // tmsTransportMethod: [{
  230. // required: true, message: '运输方式不能为空!', trigger: 'change'
  231. // }],
  232. sendType: [{
  233. required: true, message: '出库方式不能为空!', trigger: 'change'
  234. }]
  235. }
  236. },
  237. columns:[
  238. // [
  239. // {
  240. // label:'订单类型',
  241. // prop:'orderType',
  242. // component:'by-select',
  243. // compConfig:{
  244. // attr:{
  245. // data: [{
  246. // label:'B2C',
  247. // value:'B2C'
  248. // },{
  249. // label:'B2B',
  250. // value:'B2B'
  251. // }],
  252. // clearable:true
  253. // }
  254. // }
  255. // }
  256. // ],
  257. [{
  258. label:'业务员',
  259. prop:'tmsBusinessMan',
  260. component:'by-input',
  261. compConfig:{
  262. attr:{
  263. clearable:true
  264. }
  265. }
  266. },{
  267. label:'业务员手机',
  268. prop:'tmsBusinessPhone',
  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:'storeHouseId',
  394. component:'warehouse',
  395. compConfig:{
  396. attr:{
  397. placeholder:'请选择仓库',
  398. clearable:true
  399. }
  400. }
  401. },{
  402. span:12,
  403. label:'出库方式',
  404. prop:'sendType',
  405. component:'by-select',
  406. compConfig:{
  407. attr:{
  408. clearable:true,
  409. data: [{
  410. label:'越库出库',
  411. value:'YKCK'
  412. },{
  413. label:'B2B出库',
  414. value:'B2BCK'
  415. },{
  416. label:'B2C出库',
  417. value:'B2CCK'
  418. }]
  419. }
  420. }
  421. }],
  422. [{
  423. label:'备注',
  424. prop:'tmsRemark',
  425. component:'by-input',
  426. compConfig:{
  427. attr:{
  428. clearable:true
  429. }
  430. }
  431. }]
  432. ]
  433. }
  434. validatePhone(rule:any, value:any, callback:any){
  435. if (value) {
  436. if(!/^1[3|4|5|6|7|8|9][0-9]\d{8}$/.test(value)) {
  437. 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);
  438. }else{
  439. callback();
  440. }
  441. } else {
  442. callback();
  443. }
  444. }
  445. setValue(v:any){
  446. this.value = v ? v : {};
  447. this.totalFun()
  448. }
  449. qtyChange(row:any){
  450. row.tmsGoodsTotalPrice = multiply(Number(row.tmsQuantity),Number(row.price))
  451. this.totalFun()
  452. }
  453. totalFun(){
  454. this.totalWeight = 0;
  455. if(this.value.subItem && this.value.subItem.length > 0){
  456. for(const item of this.value.subItem){
  457. if(Number(item.weight)){
  458. let totalWeight = multiply(Number(item.weight),Number(item.tmsQuantity))
  459. this.totalWeight = add(this.totalWeight,totalWeight);
  460. }
  461. }
  462. }
  463. }
  464. hide(){
  465. this.$emit('editState',true)
  466. }
  467. show(){
  468. this.value.tmsBusinessMan = (this as any).$store.getters.userInfo.userName;
  469. this.value.tmsBusinessPhone = (this as any).$store.getters.userInfo.phonenumber;
  470. this.$nextTick(()=>{
  471. if(this.$refs.form){
  472. (this.$refs.form as any).clearValue();
  473. (this.$refs.form as any).setValue(this.value);
  474. }
  475. })
  476. }
  477. edit(){
  478. this.showModal = true;
  479. this.$emit('editState',false)
  480. }
  481. btn() {
  482. if(this.$refs.form){
  483. (this.$refs.form as any).validate().then(()=>{
  484. this.value = (this.$refs.form as any).getValue();
  485. if(!this.value.tmsShipmentCity){
  486. this.$message({
  487. message:'请选择发货城市!',
  488. type:'warning'
  489. })
  490. return
  491. }
  492. if(!this.value.tmsShipmentRegion){
  493. this.$message({
  494. message:'请选择发货区/县!',
  495. type:'warning'
  496. })
  497. return
  498. }
  499. if(!this.value.tmsUnloadingCity){
  500. this.$message({
  501. message:'请选择收货城市!',
  502. type:'warning'
  503. })
  504. return
  505. }
  506. if(!this.value.tmsUnloadingRegion){
  507. this.$message({
  508. message:'请选择收货区/县!',
  509. type:'warning'
  510. })
  511. return
  512. }
  513. this.showModal = false;
  514. this.$emit('editState',true);
  515. this.$emit('editResult',this.value);
  516. }).catch(()=>{})
  517. }
  518. }
  519. }
  520. </script>
  521. <style lang="scss" scoped>
  522. .info{
  523. width: 100%;
  524. .edit{
  525. width: 100%;
  526. display: flex;
  527. justify-content: flex-end;
  528. padding-bottom: 8px;
  529. span{
  530. color: rgb(0, 119, 255);
  531. font-size: 14px;
  532. cursor: pointer;
  533. }
  534. }
  535. .g-box{
  536. width: 100%;
  537. background-color: rgba(160,205,255,0.22);
  538. margin-bottom: 16px;
  539. padding:16px;
  540. box-sizing: border-box;
  541. .info-row{
  542. width: 100%;
  543. display: flex;
  544. padding-bottom: 16px;
  545. .info-col{
  546. width: 100%;
  547. overflow: hidden;
  548. text-overflow: ellipsis;
  549. white-space: nowrap;
  550. span{
  551. font-size: 14px;
  552. }
  553. .label{
  554. color: #666;
  555. }
  556. .time{
  557. color: #F00;
  558. }
  559. }
  560. .col-width{
  561. width: 50%;
  562. }
  563. }
  564. .info-row:last-child{
  565. padding: 0;
  566. }
  567. .goods-top{
  568. padding-bottom: 8px;
  569. width: 100%;
  570. display: flex;
  571. align-items: center;
  572. justify-content: space-between;
  573. .g-label{
  574. font-size: 14px;
  575. }
  576. .g-cont{
  577. width: 60%;
  578. display: flex;
  579. align-items: center;
  580. justify-content: flex-end;
  581. .g-total{
  582. padding-left: 8px;
  583. font-size: 12px;
  584. .name-label{
  585. color: #999;
  586. }
  587. }
  588. }
  589. }
  590. .table{
  591. width: 100%;
  592. }
  593. }
  594. .btn{
  595. width: 100%;
  596. display: flex;
  597. justify-content: flex-end;
  598. }
  599. }
  600. </style>
  601. <style lang="scss">
  602. .header-cell{
  603. background-color: rgba(160,205,255,0.48);
  604. }
  605. </style>