detailModal.vue 13 KB

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