detailModal.vue 12 KB

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