detailModal.vue 12 KB

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