detailModal.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <a-modal
  3. centered
  4. class="sendGood-gz-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. v-model="isShow"
  8. :title="modalTit"
  9. @cancle="handleCommonCancel"
  10. width="60%">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <div class="common-main">
  13. <div style="display: flex;align-items: center;justify-content: space-between;padding-bottom: 10px;">
  14. <a-alert type="info" v-if="sendBillStockOutList.length" style="margin-bottom:10px">
  15. <div slot="message">{{ customeName||'' }},共 {{ sendBillStockOutList && sendBillStockOutList.length }} 个出库单,产品款数合计 <span>{{ productTotal&&productTotal.totalCategory }}</span> ,产品数量合计 <span>{{ productTotal&&productTotal.totalQty }}</span>。</div>
  16. </a-alert>
  17. <a-button size="small" v-if="type==1" @click="printOrder" type="primary">发货单打印</a-button>
  18. </div>
  19. <div>
  20. <a-table :columns="outColumns" :pagination="false" :data-source="sendBillStockOutList" bordered></a-table>
  21. </div>
  22. <div class="toolsBar forms" v-if="detail">
  23. <div style="flex-basis:35%">托运日期:{{ detail.sendDate }}</div>
  24. <div style="flex-basis:65%">目的地:{{ detail.customerAddress||'--' }}</div>
  25. <div style="flex-basis:35%">收货人:{{ detail.customerCacateName }}<span v-if="detail.customerCacatePhone">({{ detail.customerCacatePhone }})</span></div>
  26. <div style="flex-basis:65%;word-break: break-all;">详细地址:{{ detail.customerAddressDetail }}</div>
  27. <div style="flex-basis:35%">收款方式:{{ detail.payTypeDictValue||'--' }}</div>
  28. <div style="flex-basis:35%">交货方式:{{ detail.handoverTypeDictValue||'--' }}</div>
  29. <div style="flex-basis:30%">运费合计:{{ detail.totalSendAmount }}</div>
  30. <div style="flex-basis:100%;word-break: break-all;">发货备注:{{ detail.sendRemark||'--' }}</div>
  31. <div style="flex-basis:35%" :class="type==0?'requerd':''">物流情况:
  32. <v-select
  33. v-model="form.transportState"
  34. ref="transportState"
  35. showType="radio"
  36. v-if="type==0"
  37. code="TRANSPORT_STATE"
  38. allowClear></v-select>
  39. <span v-else>{{ detail.transportStateDictValue||'--' }}</span>
  40. </div>
  41. <div style="flex-basis:35%">
  42. 是否收货:
  43. <div>
  44. <a-checkbox v-model="form.receiveFlag" @change="receiveFlagChange" v-if="type==0">已收货</a-checkbox>
  45. <span v-else>{{ detail.receiveFlag == 1?'是':'否' }}</span>
  46. </div>
  47. </div>
  48. <div style="flex-basis:30%" :class="type==0&&form.receiveFlag?'requerd':''">
  49. 收货时间:
  50. <a-date-picker inputReadOnly format="YYYY-MM-DD" v-model="form.receiveDate" v-if="type==0"/>
  51. <span v-else>{{ detail.receiveDate||'--' }}</span>
  52. </div>
  53. <div style="flex-basis:100%">
  54. <label>物流备注:</label>
  55. <a-textarea v-model="form.transportRemark" placeholder="请输入备注" v-if="type==0"/>
  56. <span v-else>{{ detail.transportRemark||'--' }}</span>
  57. </div>
  58. </div>
  59. <div>
  60. <a-table :columns="columns" :pagination="false" :data-source="tableData" bordered></a-table>
  61. </div>
  62. </div>
  63. <div class="btn-box" v-if="type==0">
  64. <a-button @click="handleCommonCancel" v-if="isCancel">{{ cancelText }}</a-button>
  65. <a-button type="primary" @click="handleCommonOk">{{ okText }}</a-button>
  66. </div>
  67. <!-- 发货打印 -->
  68. <printModel ref="printModel" :detail="detail"></printModel>
  69. </a-spin>
  70. </a-modal>
  71. </template>
  72. <script>
  73. import moment from 'moment'
  74. import { STable, VSelect } from '@/components'
  75. import printModel from './printModel.vue'
  76. import { updateTransportInfo, sendBillFindBySn } from '@/api/sendBill'
  77. export default {
  78. name: 'CommonModal',
  79. components: { STable, VSelect, printModel },
  80. props: {
  81. openModal: { // 弹框显示状态
  82. type: Boolean,
  83. default: false
  84. },
  85. okText: { // 确定 按钮文字
  86. type: String,
  87. default: '保存'
  88. },
  89. cancelText: { // 取消 按钮文字
  90. type: String,
  91. default: '取消'
  92. },
  93. isCancel: { // 是否显示 取消 按钮
  94. type: Boolean,
  95. default: true
  96. }
  97. },
  98. data () {
  99. return {
  100. isShow: this.openModal, // 是否打开弹框
  101. disabled: false,
  102. spinning: false,
  103. detail: null,
  104. modalTit: '',
  105. type: 0,
  106. form: {
  107. transportState: 'NORMAL',
  108. receiveDate: '',
  109. receiveFlag: false,
  110. transportRemark: ''
  111. },
  112. tableData: [],
  113. columns: [
  114. { title: '序号', dataIndex: 'no', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  115. { title: '货物名称', dataIndex: 'goodsName', scopedSlots: { customRender: 'goodName' }, width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  116. { title: '件数', dataIndex: 'goodsQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  117. { title: '体积(m³)', dataIndex: 'goodsVolume', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  118. { title: '重量(kg)', dataIndex: 'goodsWeight', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  119. { title: '计费单价(元)', dataIndex: 'unitPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  120. { title: '运费(元)', dataIndex: 'transportAmount', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  121. { title: '保价(万)', dataIndex: 'supportValue', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  122. { title: '送货费', dataIndex: 'sendAmount', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  123. { title: '其他', dataIndex: 'otherAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  124. { title: '合计', dataIndex: 'totalAmount', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  125. ],
  126. sendBillStockOutList: [],
  127. outColumns: [
  128. { title: '序号', dataIndex: 'no', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  129. { title: '出库单号', dataIndex: 'stockOutNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  130. { title: '业务单号', dataIndex: 'outBizSubNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  131. { title: '出库类型', dataIndex: 'outBizTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  132. { title: '发货编号', dataIndex: 'sendNo', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  133. { title: '客户名称', dataIndex: 'buyerName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  134. { title: '收货客户名称', dataIndex: 'receiverName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  135. { title: '产品款数', dataIndex: 'productTotalCategory', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  136. { title: '产品数量', dataIndex: 'productTotalQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  137. { title: '收款时间', dataIndex: 'settleTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
  138. ],
  139. sendBillSn: null,
  140. customeName: ''
  141. }
  142. },
  143. methods: {
  144. receiveFlagChange (e) {
  145. console.log(e)
  146. const v = e.target.checked
  147. this.form.receiveDate = v ? moment() : ''
  148. },
  149. // 打印
  150. printOrder () {
  151. this.$refs.printModel.printDom()
  152. },
  153. // 编辑
  154. getDetail (data, type, title) {
  155. this.type = type // 0 是物流跟踪,1是详情
  156. this.modalTit = title
  157. this.sendBillSn = data.sendBillSn
  158. this.customeName = data.customeName
  159. this.spinning = true
  160. sendBillFindBySn({ sn: data.sendBillSn }).then(res => {
  161. console.log(res)
  162. this.spinning = false
  163. if (res.data) {
  164. this.detail = res.data
  165. this.detail.receiveFlag = res.data.receiveFlag == 1
  166. this.form.receiveFlag = false
  167. this.form.receiveDate = ''
  168. // 出库单明细
  169. this.sendBillStockOutList = res.data.sendBillStockOutList || []
  170. this.sendBillStockOutList.map((item, i) => {
  171. item.no = i + 1
  172. })
  173. // 发货明细
  174. this.tableData = res.data.detailList
  175. this.tableData.map((item, i) => {
  176. item.no = i + 1
  177. })
  178. // 统计出库单
  179. this.getProductTotal()
  180. }
  181. })
  182. },
  183. // 出库单数据统计
  184. getProductTotal () {
  185. const ret = {
  186. totalCategory: 0,
  187. totalQty: 0
  188. }
  189. this.sendBillStockOutList.map(item => {
  190. ret.totalCategory = ret.totalCategory + item.productTotalCategory
  191. ret.totalQty = ret.totalQty + item.productTotalQty
  192. })
  193. this.productTotal = ret
  194. },
  195. // 确定
  196. handleCommonOk () {
  197. const params = {
  198. sendBillSn: this.sendBillSn,
  199. receiveDate: this.form.receiveDate ? this.form.receiveDate.format('YYYY-MM-DD') : '',
  200. receiveFlag: this.form.receiveFlag ? 1 : 0,
  201. transportState: this.form.transportState,
  202. transportRemark: this.form.transportRemark || ''
  203. }
  204. console.log(params)
  205. updateTransportInfo(params).then(res => {
  206. if (res.status == 200) {
  207. this.$emit('ok')
  208. }
  209. })
  210. },
  211. // 取消
  212. handleCommonCancel () {
  213. this.$emit('cancel')
  214. this.form = {
  215. transportState: 'NORMAL',
  216. receiveDate: moment(),
  217. receiveFlag: true,
  218. transportRemark: ''
  219. }
  220. this.detail = null
  221. this.sendBillStockOutList = []
  222. this.tableData = []
  223. }
  224. },
  225. watch: {
  226. // 父页面传过来的弹框状态
  227. openModal (newValue, oldValue) {
  228. this.isShow = newValue
  229. },
  230. // 重定义的弹框状态
  231. isShow (newValue, oldValue) {
  232. if (!newValue) {
  233. this.handleCommonCancel()
  234. }
  235. }
  236. }
  237. }
  238. </script>
  239. <style lang="less">
  240. .sendGood-gz-modal{
  241. .common-main{
  242. .toolsBar{
  243. display: flex;
  244. align-items: center;
  245. margin: 10px 0;
  246. }
  247. .forms{
  248. flex-wrap: wrap;
  249. }
  250. .forms > div{
  251. flex-grow: 1;
  252. flex-basis: 50%;
  253. padding: 10px;
  254. display: flex;
  255. align-items: center;
  256. > label{
  257. flex-basis: 70px;
  258. }
  259. }
  260. .requerd{
  261. &::before{
  262. content: '*';
  263. color: red;
  264. }
  265. }
  266. }
  267. .btn-box{
  268. text-align: center;
  269. margin-top: 30px;
  270. .ant-btn{
  271. margin:0 10px;
  272. }
  273. }
  274. }
  275. </style>